[SeaBIOS] [PATCH 2/2] mptable: Use same PCI irqs as ACPI code.

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


The ACPI code has a hardcoded list of PCI interrupts.  Use that same
list in the mptable code generation.  This will ensure that both
tables are in synch - it may also make the mptable easier to generate
from QEMU.

Also, move the irq0_override lookup outside of the irq loop.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/acpi.c    | 5 +----
 src/config.h  | 3 +++
 src/mptable.c | 8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/acpi.c b/src/acpi.c
index 119d1c1..d1cb653 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -131,9 +131,6 @@ struct madt_io_apic
                                  * lines start */
 } PACKED;
 
-/* IRQs 5,9,10,11 */
-#define PCI_ISA_IRQ_MASK    0x0e20
-
 struct madt_intsrcovr {
     ACPI_SUB_HEADER_DEF
     u8  bus;
@@ -372,7 +369,7 @@ build_madt(void)
         intsrcovr++;
     }
     for (i = 1; i < 16; i++) {
-        if (!(PCI_ISA_IRQ_MASK & (1 << i)))
+        if (!(BUILD_PCI_IRQS & (1 << i)))
             /* No need for a INT source override structure. */
             continue;
         memset(intsrcovr, 0, sizeof(*intsrcovr));
diff --git a/src/config.h b/src/config.h
index 8b888b9..64e3c92 100644
--- a/src/config.h
+++ b/src/config.h
@@ -53,6 +53,9 @@
 #define BUILD_HPET_ADDRESS        0xfed00000
 #define BUILD_APIC_ADDR           0xfee00000
 
+// PCI IRQS
+#define BUILD_PCI_IRQS	        ((1<<5) | (1<<9) | (1<<10) | (1<<11))
+
 // Important real-mode segments
 #define SEG_IVT      0x0000
 #define SEG_BDA      0x0040
diff --git a/src/mptable.c b/src/mptable.c
index de188ca..7d485eb 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -99,7 +99,7 @@ mptable_setup(void)
     /* irqs */
     struct mpt_intsrc *intsrcs = (void*)&ioapic[1], *intsrc = intsrcs;
     int dev = -1;
-    unsigned short mask = 0, pinmask = 0;
+    unsigned short pinmask = 0;
 
     struct pci_device *pci;
     foreachpci(pci) {
@@ -117,7 +117,6 @@ mptable_setup(void)
         if (pinmask & (1 << pin)) /* pin was seen already */
             continue;
         pinmask |= (1 << pin);
-        mask |= (1 << irq);
         memset(intsrc, 0, sizeof(*intsrc));
         intsrc->type = MPT_TYPE_INTSRC;
         intsrc->irqtype = 0; /* INT */
@@ -129,9 +128,10 @@ mptable_setup(void)
         intsrc++;
     }
 
+    int irq0_override = romfile_loadint("etc/irq0-override", 0);
     for (i = 0; i < 16; i++) {
         memset(intsrc, 0, sizeof(*intsrc));
-        if (mask & (1 << i))
+        if (BUILD_PCI_IRQS & (1 << i))
             continue;
         intsrc->type = MPT_TYPE_INTSRC;
         intsrc->irqtype = 0; /* INT */
@@ -140,7 +140,7 @@ mptable_setup(void)
         intsrc->srcbusirq = i;
         intsrc->dstapic = ioapic_id;
         intsrc->dstirq = i;
-        if (romfile_loadint("etc/irq0-override", 0)) {
+        if (irq0_override) {
             /* Destination 2 is covered by irq0->inti2 override (i ==
                0). Source IRQ 2 is unused */
             if (i == 0)
-- 
1.7.11.7




More information about the SeaBIOS mailing list