summaryrefslogtreecommitdiff
path: root/src/device/device_const.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2019-09-26 12:05:27 -0600
committerAaron Durbin <adurbin@chromium.org>2019-09-27 21:08:24 +0000
commit55ef0d25d32ecabfec7dcd425793f972cbca890d (patch)
tree59634eef620afd2436c3f1666d33596460cda73b /src/device/device_const.c
parent99655530110135ebf9eeaf3532d90c38fafd9ce9 (diff)
downloadcoreboot-55ef0d25d32ecabfec7dcd425793f972cbca890d.tar.xz
device: add commentary to dev_find_slot()
dev_find_slot() can sometimes fail to return the desired device object prior to full PCI enumeration. Comment the declaration and implementation accordingly to help the user understand the problem and avoid its usage. Change-Id: I3fe1f24ff015d3e4f272323947f057e4c910186c Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35632 Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/device/device_const.c')
-rw-r--r--src/device/device_const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/device/device_const.c b/src/device/device_const.c
index 5143563a87..27197f251c 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -24,6 +24,12 @@ DEVTREE_CONST struct device * DEVTREE_CONST all_devices = &dev_root;
/**
* Given a PCI bus and a devfn number, find the device structure.
*
+ * Note that this function can return the incorrect device prior
+ * to PCI enumeration because the secondary field of the bus object
+ * is 0. The failing scenario is determined by the order of the
+ * devices in all_devices singly-linked list as well as the time
+ * when this function is called (secondary reflecting topology).
+ *
* @param bus The bus number.
* @param devfn A device/function number.
* @return Pointer to the device structure (if found), 0 otherwise.