mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
dm: pci: Fix pci_last_busno() to return the real last bus no
Currently pci_last_busno() only checks the last bridge device under the first UCLASS_PCI device. This is not the case when there are multiple bridge devices. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
af67e7ce23
commit
069155cbb4
1 changed files with 1 additions and 24 deletions
|
@ -85,30 +85,7 @@ static int pci_get_bus_max(void)
|
||||||
|
|
||||||
int pci_last_busno(void)
|
int pci_last_busno(void)
|
||||||
{
|
{
|
||||||
struct pci_controller *hose;
|
return pci_get_bus_max();
|
||||||
struct udevice *bus;
|
|
||||||
struct uclass *uc;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
debug("pci_last_busno\n");
|
|
||||||
ret = uclass_get(UCLASS_PCI, &uc);
|
|
||||||
if (ret || list_empty(&uc->dev_head))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Probe the last bus */
|
|
||||||
bus = list_entry(uc->dev_head.prev, struct udevice, uclass_node);
|
|
||||||
debug("bus = %p, %s\n", bus, bus->name);
|
|
||||||
assert(bus);
|
|
||||||
ret = device_probe(bus);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
/* If that bus has bridges, we may have new buses now. Get the last */
|
|
||||||
bus = list_entry(uc->dev_head.prev, struct udevice, uclass_node);
|
|
||||||
hose = dev_get_uclass_priv(bus);
|
|
||||||
debug("bus = %s, hose = %p\n", bus->name, hose);
|
|
||||||
|
|
||||||
return hose->last_busno;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_get_ff(enum pci_size_t size)
|
int pci_get_ff(enum pci_size_t size)
|
||||||
|
|
Loading…
Add table
Reference in a new issue