[SeaBIOS] [PATCH] MPTable pci bus

Kevin O'Connor kevin at koconnor.net
Sat Dec 26 17:25:54 CET 2009


Order the bus descriptions in ascending order by busid as per MPTable
spec.

Current code only works with pci bus 0, so add a sanity check in case
foreachpci were to return a higher bus.

-Kevin


diff --git a/src/mptable.c b/src/mptable.c
index 6e02524..6b47b28 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -65,19 +65,19 @@ mptable_init(void)
     }
     int entrycount = cpu - cpus;
 
-    /* isa bus */
+    /* buses */
     struct mpt_bus *bus = (void*)cpu;
     memset(bus, 0, sizeof(*bus));
     bus->type = MPT_TYPE_BUS;
-    bus->busid = 1;
-    memcpy(bus->bustype, "ISA   ", sizeof(bus->bustype));
+    bus->busid = 0;
+    memcpy(bus->bustype, "PCI   ", sizeof(bus->bustype));
     entrycount++;
 
     bus++;
     memset(bus, 0, sizeof(*bus));
     bus->type = MPT_TYPE_BUS;
-    bus->busid = 0;
-    memcpy(bus->bustype, "PCI   ", sizeof(bus->bustype));
+    bus->busid = 1;
+    memcpy(bus->bustype, "ISA   ", sizeof(bus->bustype));
     entrycount++;
 
     /* ioapic */
@@ -97,6 +97,9 @@ mptable_init(void)
     unsigned short mask = 0, pinmask;
 
     foreachpci(bdf, max) {
+        if (pci_bdf_to_bus(bdf) > 0)
+            // Code currently only handles bus 0.
+            break;
         int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
         int irq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);
         if (pin == 0)



More information about the SeaBIOS mailing list