grml...
[seabios.git] / src / mptable.c
index d7cab03fa3833b0f84ca7620d07953105f1a3a18..103f46243d8cd3b89afa3fc44f97901f8e265908 100644 (file)
@@ -68,9 +68,10 @@ mptable_init(void)
 
     // PCI buses
     struct mpt_bus *buses = (void*)cpu, *bus = buses;
-    int bdf, max, lastbus = -1;
-    foreachbdf(bdf, max) {
-        int curbus = pci_bdf_to_bus(bdf);
+    int lastbus = -1;
+    struct pci_device *pci;
+    foreachpci(pci) {
+        int curbus = pci_bdf_to_bus(pci->bdf);
         if (curbus == lastbus)
             continue;
         lastbus = curbus;
@@ -106,7 +107,8 @@ mptable_init(void)
     int dev = -1;
     unsigned short mask = 0, pinmask = 0;
 
-    foreachbdf(bdf, max) {
+    foreachpci(pci) {
+        u16 bdf = pci->bdf;
         int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
         int irq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);
         if (pin == 0)
@@ -167,7 +169,7 @@ mptable_init(void)
     intsrc->irqflag = 0; /* PO, EL default */
     intsrc->srcbus = isabusid; /* ISA */
     intsrc->srcbusirq = 0;
-    intsrc->dstapic = 0; /* BSP == APIC #0 */
+    intsrc->dstapic = 0xff; /* to all local APICs */
     intsrc->dstirq = 1; /* LINTIN1 */
     intsrc++;
     entrycount += intsrc - intsrcs;