coreinfo: Skip unpopulated PCI functions
commit1dc5ce31ced5baee363f6d30049ca418ce414866
authorKyösti Mälkki <kyosti.malkki@gmail.com>
Sat, 9 Jun 2018 05:25:03 +0000 (9 08:25 +0300)
committerKyösti Mälkki <kyosti.malkki@gmail.com>
Thu, 14 Jun 2018 07:59:05 +0000 (14 07:59 +0000)
tree7b49e7ceed093073e1c434c77401bb6c0469037f
parent3414f6035b5af0ef004742f0ba91fbad266a6162
coreinfo: Skip unpopulated PCI functions

Per PCI specification, function 0 must be present,
so functions 1 to 7 can be skipped in this case.

For a device that is not multi-function, it may not
decode function number in the hardware at all. To
avoid registering such a device eight times, skip
scanning functions 1 to 7.

Without the latter fix, a single-function PCI bridge
may call pci_scan_bus() second time and secondary
side devices would get appended second time in the
array devices[]. At that point, quicksort() apparently
hits an infinite recursion loop.

Since pci_scan_bus() is called in part of the early
modules->init() sequence early in main(), the errors
here left coreinfo payload completely silent when
PCI module was built-in on affected system.

Terminal screen was cleared, though.

Change-Id: Ifc6622f050b98afb7196de0cc3a863c4cdfa6c94
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/26990
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
payloads/coreinfo/pci_module.c