device/pci_device: Fix PCIe bridge detection

PCI bus 0 is not below any PCI device. In case of pci_domain_scan_bus(),
it's our virtual `domain` device.

Expecting a PCI device above bus 0 resulted in undefined behavior for
all boards with PCI. Only boards with a PCI device 00:00.0 that looked
like a PCIe bridge showed issues, though (e.g. OCP/DeltaLake).

Change-Id: I1fd68b9dc0d2e388ec2bbba4adbadd33e14f0171
Signed-off-by: Nico Huber <nico.h@gmx.de>
Fixes: commit 777ffff442 (device/pci_device.c: Scan only one device for PCIe)
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62376
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2022-02-25 14:25:57 +01:00 committed by Felix Held
parent e6ab52e289
commit f514b8ae82
1 changed files with 3 additions and 0 deletions

View File

@ -1352,6 +1352,9 @@ static bool pci_bus_only_one_child(struct bus *bus)
if (!bridge) if (!bridge)
return false; return false;
if (bridge->path.type != DEVICE_PATH_PCI)
return false;
pcie_pos = pci_find_capability(bridge, PCI_CAP_ID_PCIE); pcie_pos = pci_find_capability(bridge, PCI_CAP_ID_PCIE);
if (!pcie_pos) if (!pcie_pos)
return false; return false;