ioapic: Don't assume that BSP's APIC ID is 0
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 23 Mar 2011 10:54:33 +0000 (18:54 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 23 Mar 2011 15:12:49 +0000 (23:12 +0800)
sys/platform/pc32/apic/mpapic.c
sys/platform/pc64/apic/mpapic.c

index 9cc02d1..f7467cf 100644 (file)
@@ -1483,7 +1483,8 @@ ioapic_pin_prog(void *addr, int pin, int vec,
        }
 
        target = ioapic_read(addr, select + 1) & IOART_HI_DEST_RESV;
-       target |= 0;
+       target |= (CPU_TO_ID(0) << IOART_HI_DEST_SHIFT) &
+                 IOART_HI_DEST_MASK;
 
        ioapic_write(addr, select, flags | vec);
        ioapic_write(addr, select + 1, target);
index 73cc70e..edbb135 100644 (file)
@@ -1545,7 +1545,8 @@ ioapic_pin_prog(void *addr, int pin, int vec,
        }
 
        target = ioapic_read(addr, select + 1) & IOART_HI_DEST_RESV;
-       target |= 0;
+       target |= (CPU_TO_ID(0) << IOART_HI_DEST_SHIFT) &
+                 IOART_HI_DEST_MASK;
 
        ioapic_write(addr, select, flags | vec);
        ioapic_write(addr, select + 1, target);