device/pci_device.c: Make sure the PCI bus has a device

Some SOC add PCI root busses structs at runtime without adding a
device struct to the bus because pci_scan_bus does it. An example
would be xeon_sp which has multiple root busses.

TEST: ocp/deltalake boots again.

Change-Id: I81d9c94652e34dbf9e8cec64fc34ef0042563037
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60876
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
This commit is contained in:
Arthur Heymans 2022-01-06 20:56:01 +01:00 committed by Felix Held
parent 5352d22378
commit db199cc073
1 changed files with 3 additions and 0 deletions

View File

@ -1216,6 +1216,9 @@ static bool pci_bus_only_one_child(struct bus *bus)
u16 pcie_pos, pcie_flags_reg;
int pcie_type;
if (!bridge)
return false;
pcie_pos = pci_find_capability(bridge, PCI_CAP_ID_PCIE);
if (!pcie_pos)
return false;