]> xenbits.xensource.com Git - seabios.git/commitdiff
pciinit: bridges can have two regions too
authorAlexey Korolev <alexey.korolev@endace.com>
Thu, 19 Apr 2012 05:40:13 +0000 (17:40 +1200)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 27 Apr 2012 01:52:30 +0000 (21:52 -0400)
 Patch takes into account PCI bar and ROM regions of PCI bridges

Original patch by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
src/pci.h
src/pciinit.c

index 5598100aa959857afe378b53437bc18bf50d3d13..6be838c2ffcc194e91a84bd12d3d46bb4556b8b8 100644 (file)
--- a/src/pci.h
+++ b/src/pci.h
@@ -5,6 +5,7 @@
 
 #define PCI_ROM_SLOT 6
 #define PCI_NUM_REGIONS 7
+#define PCI_BRIDGE_NUM_REGIONS 2
 
 static inline u8 pci_bdf_to_bus(u16 bdf) {
     return bdf >> 8;
index 2bd44260c87af47d53ae0cd840ef38b2eb84e71b..9b521e3a89ad5084a6089d5b29ffaf4c73753c70 100644 (file)
@@ -370,13 +370,15 @@ static int pci_bios_check_devices(struct pci_bus *busses)
     // Calculate resources needed for regular (non-bus) devices.
     struct pci_device *pci;
     foreachpci(pci) {
-        if (pci->class == PCI_CLASS_BRIDGE_PCI) {
+        if (pci->class == PCI_CLASS_BRIDGE_PCI)
             busses[pci->secondary_bus].bus_dev = pci;
-            continue;
-        }
+
         struct pci_bus *bus = &busses[pci_bdf_to_bus(pci->bdf)];
         int i;
         for (i = 0; i < PCI_NUM_REGIONS; i++) {
+            if ((pci->class == PCI_CLASS_BRIDGE_PCI) &&
+                (i >= PCI_BRIDGE_NUM_REGIONS && i < PCI_ROM_SLOT))
+                continue;
             u32 val, size;
             pci_bios_get_bar(pci, i, &val, &size);
             if (val == 0)