[SeaBIOS] [PATCH 1/2] mptable: Don't describe pci-to-pci bridges.

Kevin O'Connor kevin at koconnor.net
Tue Mar 19 01:39:08 CET 2013


It should not be necessary to describe PCI-to-PCI bridges in the
mptable.  (The mptable was designed to fit in ROM, so it seems
unlikely that it would be used for bridges that could be dynamically
added.)  Describing only the root bus should make it easier to port
this content into QEMU.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/mptable.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/mptable.c b/src/mptable.c
index 0f2d756..de188ca 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -65,30 +65,25 @@ mptable_setup(void)
     }
     int entrycount = cpu - cpus;
 
-    // PCI buses
+    // PCI bus
     struct mpt_bus *buses = (void*)cpu, *bus = buses;
-    int lastbus = -1;
-    struct pci_device *pci;
-    foreachpci(pci) {
-        int curbus = pci_bdf_to_bus(pci->bdf);
-        if (curbus == lastbus)
-            continue;
-        lastbus = curbus;
+    if (PCIDevices) {
         memset(bus, 0, sizeof(*bus));
         bus->type = MPT_TYPE_BUS;
-        bus->busid = curbus;
+        bus->busid = 0;
         memcpy(bus->bustype, "PCI   ", sizeof(bus->bustype));
         bus++;
+        entrycount++;
     }
 
     /* isa bus */
-    int isabusid;
+    int isabusid = bus - buses;
     memset(bus, 0, sizeof(*bus));
     bus->type = MPT_TYPE_BUS;
-    isabusid = bus->busid = lastbus + 1;
+    bus->busid = isabusid;
     memcpy(bus->bustype, "ISA   ", sizeof(bus->bustype));
     bus++;
-    entrycount += bus - buses;
+    entrycount++;
 
     /* ioapic */
     u8 ioapic_id = BUILD_IOAPIC_ID;
@@ -106,8 +101,11 @@ mptable_setup(void)
     int dev = -1;
     unsigned short mask = 0, pinmask = 0;
 
+    struct pci_device *pci;
     foreachpci(pci) {
         u16 bdf = pci->bdf;
+        if (pci_bdf_to_bus(bdf) != 0)
+            break;
         int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
         int irq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);
         if (pin == 0)
-- 
1.7.11.7




More information about the SeaBIOS mailing list