From: Marcel Apfelbaum Date: Mon, 16 Feb 2015 17:29:20 +0000 (+0200) Subject: fw/pci: map memory and IO regions for multiple pci root buses X-Git-Tag: rel-1.8.1~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f16479727d131feff2d023bf005cf656c32dce2e;p=seabios.git fw/pci: map memory and IO regions for multiple pci root buses For resource sizing and mapping purposes treat devices on extra root buses as if they are on the default root bus (bus 0). Signed-off-by: Kevin O'Connor Signed-off-by: Marcel Apfelbaum Signed-off-by: Gerd Hoffmann (cherry picked from commit 0fe4c9ee7af5f6bb3a1fcbf1d39116a894600c90) --- diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 43c6e2f..46ae709 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -677,6 +677,11 @@ static int pci_bios_check_devices(struct pci_bus *busses) busses[pci->secondary_bus].bus_dev = pci; struct pci_bus *bus = &busses[pci_bdf_to_bus(pci->bdf)]; + if (!bus->bus_dev) + /* + * Resources for all root busses go in busses[0] + */ + bus = &busses[0]; int i; for (i = 0; i < PCI_NUM_REGIONS; i++) { if ((pci->class == PCI_CLASS_BRIDGE_PCI) && @@ -707,6 +712,11 @@ static int pci_bios_check_devices(struct pci_bus *busses) if (!s->bus_dev) continue; struct pci_bus *parent = &busses[pci_bdf_to_bus(s->bus_dev->bdf)]; + if (!parent->bus_dev) + /* + * Resources for all root busses go in busses[0] + */ + parent = &busses[0]; int type; int hotplug_support = pci_bus_hotplug_support(s); for (type = 0; type < PCI_REGION_TYPE_COUNT; type++) {