aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da172f956ad6..835ec7bf6c05 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -330,8 +330,6 @@ struct pci_dev {
330 unsigned int msix_enabled:1; 330 unsigned int msix_enabled:1;
331 unsigned int ari_enabled:1; /* ARI forwarding */ 331 unsigned int ari_enabled:1; /* ARI forwarding */
332 unsigned int is_managed:1; 332 unsigned int is_managed:1;
333 unsigned int is_pcie:1; /* Obsolete. Will be removed.
334 Use pci_is_pcie() instead */
335 unsigned int needs_freset:1; /* Dev requires fundamental reset */ 333 unsigned int needs_freset:1; /* Dev requires fundamental reset */
336 unsigned int state_saved:1; 334 unsigned int state_saved:1;
337 unsigned int is_physfn:1; 335 unsigned int is_physfn:1;
@@ -472,12 +470,25 @@ struct pci_bus {
472/* 470/*
473 * Returns true if the pci bus is root (behind host-pci bridge), 471 * Returns true if the pci bus is root (behind host-pci bridge),
474 * false otherwise 472 * false otherwise
473 *
474 * Some code assumes that "bus->self == NULL" means that bus is a root bus.
475 * This is incorrect because "virtual" buses added for SR-IOV (via
476 * virtfn_add_bus()) have "bus->self == NULL" but are not root buses.
475 */ 477 */
476static inline bool pci_is_root_bus(struct pci_bus *pbus) 478static inline bool pci_is_root_bus(struct pci_bus *pbus)
477{ 479{
478 return !(pbus->parent); 480 return !(pbus->parent);
479} 481}
480 482
483static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
484{
485 dev = pci_physfn(dev);
486 if (pci_is_root_bus(dev->bus))
487 return NULL;
488
489 return dev->bus->self;
490}
491
481#ifdef CONFIG_PCI_MSI 492#ifdef CONFIG_PCI_MSI
482static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 493static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
483{ 494{
@@ -1749,11 +1760,11 @@ static inline int pci_pcie_cap(struct pci_dev *dev)
1749 * pci_is_pcie - check if the PCI device is PCI Express capable 1760 * pci_is_pcie - check if the PCI device is PCI Express capable
1750 * @dev: PCI device 1761 * @dev: PCI device
1751 * 1762 *
1752 * Retrun true if the PCI device is PCI Express capable, false otherwise. 1763 * Returns: true if the PCI device is PCI Express capable, false otherwise.
1753 */ 1764 */
1754static inline bool pci_is_pcie(struct pci_dev *dev) 1765static inline bool pci_is_pcie(struct pci_dev *dev)
1755{ 1766{
1756 return !!pci_pcie_cap(dev); 1767 return pci_pcie_cap(dev);
1757} 1768}
1758 1769
1759/** 1770/**