Commit e784930b authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Bjorn Helgaas

PCI: Export pcie_find_root_port

Export pcie_find_root_port() so we can use it outside of PCIe-AER error
injection.
Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 9f46107b
...@@ -307,20 +307,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus) ...@@ -307,20 +307,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus)
return 0; return 0;
} }
static struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
{
while (1) {
if (!pci_is_pcie(dev))
break;
if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
return dev;
if (!dev->bus->self)
break;
dev = dev->bus->self;
}
return NULL;
}
static int find_aer_device_iter(struct device *device, void *data) static int find_aer_device_iter(struct device *device, void *data)
{ {
struct pcie_device **result = data; struct pcie_device **result = data;
......
...@@ -1928,6 +1928,20 @@ static inline int pci_pcie_type(const struct pci_dev *dev) ...@@ -1928,6 +1928,20 @@ static inline int pci_pcie_type(const struct pci_dev *dev)
return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
} }
static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
{
while (1) {
if (!pci_is_pcie(dev))
break;
if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
return dev;
if (!dev->bus->self)
break;
dev = dev->bus->self;
}
return NULL;
}
void pci_request_acs(void); void pci_request_acs(void);
bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);
bool pci_acs_path_enabled(struct pci_dev *start, bool pci_acs_path_enabled(struct pci_dev *start,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment