pci: Honour pci_skip_dev()
authorThierry Reding <treding@nvidia.com>
Thu, 13 Nov 2014 01:26:49 +0000 (18:26 -0700)
committerTom Rini <trini@ti.com>
Sun, 23 Nov 2014 11:49:01 +0000 (06:49 -0500)
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>
common/cmd_pci.c
drivers/pci/pci.c
include/pci.h

index 5a6048c9260476300d8ab79ca1ef6cb8efa7cfb6..e3a77e35820cbda7c663f2b737c187ed0f9e2227 100644 (file)
@@ -71,6 +71,9 @@ void pciinfo(int BusNum, int ShortPCIListing)
 
                        dev = PCI_BDF(BusNum, Device, Function);
 
+                       if (pci_skip_dev(hose, dev))
+                               continue;
+
                        pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID);
                        if ((VendorID == 0xFFFF) || (VendorID == 0x0000))
                                continue;
index 5d547901b81659e43d86c291a252eaa7ded9b10b..7ee21d1c1d1d039c734a64f635e0c8236569b422 100644 (file)
@@ -195,6 +195,9 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)
                             bdf < PCI_BDF(bus + 1, 0, 0);
 #endif
                             bdf += PCI_BDF(0, 0, 1)) {
+                               if (pci_skip_dev(hose, bdf))
+                                       continue;
+
                                if (!PCI_FUNC(bdf)) {
                                        pci_read_config_byte(bdf,
                                                             PCI_HEADER_TYPE,
index 2ff73653c5c2382ae654a22c047e743c67b55df1..d211351e44becf9b4c70e4f5cda357cce12f5a7e 100644 (file)
@@ -623,6 +623,7 @@ extern void pci_register_hose(struct pci_controller* hose);
 extern struct pci_controller* pci_bus_to_hose(int bus);
 extern struct pci_controller *find_hose_by_cfg_addr(void *cfg_addr);
 
+extern int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev);
 extern int pci_hose_scan(struct pci_controller *hose);
 extern int pci_hose_scan_bus(struct pci_controller *hose, int bus);