]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
pci: brcmstb: Fix PCIe bus numbers
authorAndrea della Porta <andrea.porta@suse.com>
Mon, 1 Jun 2026 10:39:23 +0000 (12:39 +0200)
committerPeter Robinson <pbrobinson@gmail.com>
Thu, 4 Jun 2026 09:50:04 +0000 (10:50 +0100)
The linux kernel assigns a new domain for every Root Complex where bus
numbering starts from 0 for each domain. U-Boot does not have domains
and uses a flattened bus numbering scheme instead. This means that any
device or bridge on the second enumerated RC will receive a bus number
equal to the last assigned one +1. This bus number contributes to the
address written into the index register, which will select the
configuration space to be read. Compensate for this contribution by
subtracting the base bus number.

Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
Signed-off-by: Torsten Duwe <duwe@suse.de>
Tested-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
drivers/pci/pcie_brcmstb.c

index f089c48f02869693abcbc13f9e18727f2a34c33c..47c0802df23d0a755a3eda19f6f1d747a4714a65 100644 (file)
@@ -125,7 +125,7 @@ static int brcm_pcie_config_address(const struct udevice *dev, pci_dev_t bdf,
                                    uint offset, void **paddress)
 {
        struct brcm_pcie *pcie = dev_get_priv(dev);
-       unsigned int pci_bus = PCI_BUS(bdf);
+       unsigned int pci_bus = PCI_BUS(bdf) - dev_seq(dev);
        unsigned int pci_dev = PCI_DEV(bdf);
        unsigned int pci_func = PCI_FUNC(bdf);
        int idx;