Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40474 )
Change subject: device: Add a helper to find device behind a PCI bridge device ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/40474/4/src/device/device_const.c File src/device/device_const.c:
https://review.coreboot.org/c/coreboot/+/40474/4/src/device/device_const.c@2... PS4, Line 233: link_list
The whole concept of multiple links for a PCI bridge is weird. […]
You seem to be looking at it from the downstream side (i.e. the PCI device you are looking for). On this side everything should be clearly PCI, the path is PCI, the `bus` should have a secondary bus number reflecting the PCI hierarchy, etc. But looking at it from the upstream side things can be more complicated. Imagine somebody would integrate multiple PCI and non-PCI devices into a chip, everything connected upstream via PCI. Now if the hierarchy starts with a PCI-to-PCI bridge that also happens to integrate an I2C controller (weirder things have happened, AFAICT), we could either model all the downstream devices on a single weird bus (mixed PCI and non-PCI devices) or have multiple downstream buses. If the I2C bus would come first in the `link_list`, the current implementation would fail.