Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35632 )
Change subject: device: add commentary to dev_find_slot() ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35632/1/src/device/device_const.c File src/device/device_const.c:
https://review.coreboot.org/c/coreboot/+/35632/1/src/device/device_const.c@2... PS1, Line 236: DEVTREE_CONST struct device *pcidev_path_on_root_debug(pci_devfn_t devfn, const char *func)
Can't we provide a variant that supplies bus number? Go through dev_root->link_list to find those devices/buses?
IMO we should not support API to search for a device on a specific bus number as we already have pcidev_path_behind(). Even that function is questionable, it can return devices behind bridges before said bridge has had secondary and subordinate bus numbers assigned. In other words, PCI configuration writes would not go through.
I was thinking of fixed buses such as nehalem/westmere server sockets where there were multiple static buses in addition to bus 0. In that situation it makes sense, but your point about pcidev_path_behind() would equally work well once we can grab the device easier with a symbol that makes sense.