summaryrefslogtreecommitdiff
path: root/drivers/pci/pci-uclass.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-01-09 08:52:21 -0500
committerTom Rini <trini@konsulko.com>2020-01-09 08:52:21 -0500
commitd6b92b9742f125542dd0985976c3a6c560ed40fd (patch)
treedf47458afa5280a80aa6ea789ac4d935aabe64ed /drivers/pci/pci-uclass.c
parenta74a2134b245d19a999c796d29285597a22954ed (diff)
parentaaa05deb1283b6beb7334adfa4094fb6bd4ab750 (diff)
Merge tag 'dm-pull-8jan20' of git://git.denx.de/u-boot-dm
dm: Increased separation of ofdata_to_platdata() and probe methods
Diffstat (limited to 'drivers/pci/pci-uclass.c')
-rw-r--r--drivers/pci/pci-uclass.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 7308f612b67..5be2dfd0bf6 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -48,6 +48,19 @@ pci_dev_t dm_pci_get_bdf(struct udevice *dev)
struct pci_child_platdata *pplat = dev_get_parent_platdata(dev);
struct udevice *bus = dev->parent;
+ /*
+ * This error indicates that @dev is a device on an unprobed PCI bus.
+ * The bus likely has bus=seq == -1, so the PCI_ADD_BUS() macro below
+ * will produce a bad BDF>
+ *
+ * A common cause of this problem is that this function is called in the
+ * ofdata_to_platdata() method of @dev. Accessing the PCI bus in that
+ * method is not allowed, since it has not yet been probed. To fix this,
+ * move that access to the probe() method of @dev instead.
+ */
+ if (!device_active(bus))
+ log_err("PCI: Device '%s' on unprobed bus '%s'\n", dev->name,
+ bus->name);
return PCI_ADD_BUS(bus->seq, pplat->devfn);
}