aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2012-07-24 05:20:02 -0400
committerJiang Liu <liuj97@gmail.com>2012-08-20 10:32:20 -0400
commit786e22885d9959fda0473ace5a61cb11620fba9b (patch)
treebfd70885b7d52deaef338ee212bf66ac682f8e42 /include/linux/pci.h
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff)
PCI: Add pcie_flags_reg to cache PCIe capabilities register
Since PCI Express Capabilities Register is read only, cache its value into struct pci_dev to avoid repeatedly calling pci_read_config_*(). Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5faa8310eec9..95662b2f0c3d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -258,6 +258,7 @@ struct pci_dev {
258 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ 258 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */
259 u8 rom_base_reg; /* which config register controls the ROM */ 259 u8 rom_base_reg; /* which config register controls the ROM */
260 u8 pin; /* which interrupt pin this device uses */ 260 u8 pin; /* which interrupt pin this device uses */
261 u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */
261 262
262 struct pci_driver *driver; /* which driver has allocated this device */ 263 struct pci_driver *driver; /* which driver has allocated this device */
263 u64 dma_mask; /* Mask of the bits of bus address this 264 u64 dma_mask; /* Mask of the bits of bus address this
@@ -1650,6 +1651,15 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
1650 return !!pci_pcie_cap(dev); 1651 return !!pci_pcie_cap(dev);
1651} 1652}
1652 1653
1654/**
1655 * pci_pcie_type - get the PCIe device/port type
1656 * @dev: PCI device
1657 */
1658static inline int pci_pcie_type(const struct pci_dev *dev)
1659{
1660 return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4;
1661}
1662
1653void pci_request_acs(void); 1663void pci_request_acs(void);
1654bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); 1664bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);
1655bool pci_acs_path_enabled(struct pci_dev *start, 1665bool pci_acs_path_enabled(struct pci_dev *start,