LCOV - code coverage report
Current view: top level - drivers/pci/msi - pcidev_msi.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 16 0.0 %
Date: 2023-03-27 20:00:47 Functions: 0 2 0.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : /*
       3             :  * MSI[X} related functions which are available unconditionally.
       4             :  */
       5             : #include "../pci.h"
       6             : 
       7             : /*
       8             :  * Disable the MSI[X] hardware to avoid screaming interrupts during boot.
       9             :  * This is the power on reset default so usually this should be a noop.
      10             :  */
      11             : 
      12           0 : void pci_msi_init(struct pci_dev *dev)
      13             : {
      14             :         u16 ctrl;
      15             : 
      16           0 :         dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI);
      17           0 :         if (!dev->msi_cap)
      18           0 :                 return;
      19             : 
      20           0 :         pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &ctrl);
      21           0 :         if (ctrl & PCI_MSI_FLAGS_ENABLE) {
      22           0 :                 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS,
      23             :                                       ctrl & ~PCI_MSI_FLAGS_ENABLE);
      24             :         }
      25             : 
      26           0 :         if (!(ctrl & PCI_MSI_FLAGS_64BIT))
      27           0 :                 dev->no_64bit_msi = 1;
      28             : }
      29             : 
      30           0 : void pci_msix_init(struct pci_dev *dev)
      31             : {
      32             :         u16 ctrl;
      33             : 
      34           0 :         dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX);
      35           0 :         if (!dev->msix_cap)
      36           0 :                 return;
      37             : 
      38           0 :         pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
      39           0 :         if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
      40           0 :                 pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS,
      41             :                                       ctrl & ~PCI_MSIX_FLAGS_ENABLE);
      42             :         }
      43             : }

Generated by: LCOV version 1.14