Commit 4efe52bf23c96cee7052273bd8549caee4d0fdc2

Authored by Thierry Reding
Committed by Tom Rini
1 parent 042b83d4c5

pci: Honour pci_skip_dev()

When enumerating devices, honour the pci_skip_dev() function. This can
be used by PCI controller drivers to restrict which devices will be
probed.

This is required by the NVIDIA Tegra PCIe controller driver, which will
fail with a data abort exception if an access is attempted to a device
number larger than 0 outside of bus 0. pci_skip_dev() is therefore
implemented to prevent any such accesses.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 3 changed files with 7 additions and 0 deletions Side-by-side Diff

... ... @@ -71,6 +71,9 @@
71 71  
72 72 dev = PCI_BDF(BusNum, Device, Function);
73 73  
  74 + if (pci_skip_dev(hose, dev))
  75 + continue;
  76 +
74 77 pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID);
75 78 if ((VendorID == 0xFFFF) || (VendorID == 0x0000))
76 79 continue;
... ... @@ -195,6 +195,9 @@
195 195 bdf < PCI_BDF(bus + 1, 0, 0);
196 196 #endif
197 197 bdf += PCI_BDF(0, 0, 1)) {
  198 + if (pci_skip_dev(hose, bdf))
  199 + continue;
  200 +
198 201 if (!PCI_FUNC(bdf)) {
199 202 pci_read_config_byte(bdf,
200 203 PCI_HEADER_TYPE,
... ... @@ -623,6 +623,7 @@
623 623 extern struct pci_controller* pci_bus_to_hose(int bus);
624 624 extern struct pci_controller *find_hose_by_cfg_addr(void *cfg_addr);
625 625  
  626 +extern int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev);
626 627 extern int pci_hose_scan(struct pci_controller *hose);
627 628 extern int pci_hose_scan_bus(struct pci_controller *hose, int bus);
628 629