]> Zhao Yanbai Git Server - minix.git/commitdiff
Zero no more hardwired as BSP apic id
authorTomas Hruby <tom@minix3.org>
Thu, 21 Oct 2010 17:07:07 +0000 (17:07 +0000)
committerTomas Hruby <tom@minix3.org>
Thu, 21 Oct 2010 17:07:07 +0000 (17:07 +0000)
- the BSP apic id is written in the io apic redirection entries to
  deliver the interrupts to BSP

kernel/arch/i386/apic.c

index 1655f167214f4af386d9d5458279c4b9924da1f5..bc8b8a3fe45c3932b1cc28971e3bf2b2fc6b298f 100644 (file)
@@ -399,7 +399,7 @@ PUBLIC void ioapic_mask_irq(unsigned irq)
 
 PUBLIC unsigned int apicid(void)
 {
-       return lapic_read(LAPIC_ID);
+       return lapic_read(LAPIC_ID) >> 24;
 }
 
 PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook))
@@ -1100,6 +1100,7 @@ PUBLIC int apic_single_cpu_init(void)
        }
 
        bsp_lapic_id = apicid();
+       printf("Boot cpu apic id %d\n", bsp_lapic_id);
 
        acpi_init();
 
@@ -1186,7 +1187,7 @@ PUBLIC void ioapic_set_irq(unsigned irq)
                        /*
                         * route the interrupts to the bsp by default
                         */
-                       hi_32 = 0;
+                       hi_32 = bsp_lapic_id << 24;
                        ioapic_redirt_entry_write((void *) io_apic[ioa].addr,
                                        io_apic_irq[irq].pin, hi_32, low_32);
                }