[PATCH] pci: correct PCI device enumeration to include all functions on device 0

Simon Glass sjg at chromium.org
Mon Apr 20 06:30:45 CEST 2026


Hi Maximilian,

On 2026-04-16T16:13:05, Maximilian Brune <maximilian.brune at 9elements.com> wrote:
> pci: correct PCI device enumeration to include all functions on device 0
>
> Currently the implementation does not just skip all devices beside
> device 0, it also skips all functions (besides 0) on device 0. This
> broke basically all AMD platforms, since they have a lot of internal SOC
> devices behind on these functions.
>
> This was detected, because the XHCI controller and therefore the USB
> devices were not found by u-boot on AMD/crater platform.
>
> Fix it by checking all functions on device 0 (Linux does the same).
>
> TEST=build u-boot as coreboot payload and run it on a recent x86 AMD
> platform. Devices like the XHCI controller are now found again.
>
> drivers/pci/pci-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> @@ -927,7 +927,7 @@ int pci_bind_bus_devices(struct udevice *bus)

Right, PCI_MASK_BUS() returns both device and function bits, so it
skipps any bdf where either device > 0 or function > 0. Using
PCI_DEV() extracts only the device number, matching the intent in
only_one_child().

Fixes: fbde868ba4aa ("pci: skip unnecessary PCIe scanning")

BTW, the TEST= format is non-standard for U-Boot - you could reword to
prose or omit it.

I notice the mention of AMD - have you tried booting on a coreboot +
OpenSIL platform?

Regards,
Simon


More information about the U-Boot mailing list