apic: Initialize LAPIC before programming I/O APIC
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 19 Mar 2011 07:47:20 +0000 (15:47 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 19 Mar 2011 07:52:10 +0000 (15:52 +0800)
On the system without IMCR, I/O APIC is enabled when it is first accessed.
Before I/O APIC is enabled, LAPIC should be initialized.

sys/platform/pc32/i386/mp_machdep.c
sys/platform/pc64/x86_64/mp_machdep.c

index 3be06c9..41848a4 100644 (file)
@@ -652,6 +652,9 @@ mp_enable(u_int boot_addr)
 
        lapic_config();
 
+       /* Initialize BSP's local APIC */
+       lapic_init(TRUE);
+
        if (apic_io_enable)
                ioapic_config();
 
@@ -689,6 +692,9 @@ if (apic_io_enable && ioapic_use_old) {
 
 }
 
+       /* Finalize PIC */
+       MachIntrABI.finalize();
+
        /* start each Application Processor */
        start_all_aps(boot_addr);
 }
@@ -2137,12 +2143,6 @@ start_all_aps(u_int boot_addr)
 
        POSTCODE(START_ALL_APS_POST);
 
-       /* Initialize BSP's local APIC */
-       lapic_init(TRUE);
-
-       /* Finalize PIC */
-       MachIntrABI.finalize();
-
        /* install the AP 1st level boot code */
        install_ap_tramp(boot_addr);
 
index 911f447..9dba673 100644 (file)
@@ -673,6 +673,9 @@ mp_enable(u_int boot_addr)
 
        lapic_config();
 
+       /* Initialize BSP's local APIC */
+       lapic_init(TRUE);
+
        if (apic_io_enable)
                ioapic_config();
 
@@ -710,6 +713,9 @@ if (apic_io_enable && ioapic_use_old) {
 
 }
 
+       /* Finalize PIC */
+       MachIntrABI.finalize();
+
        /* start each Application Processor */
        start_all_aps(boot_addr);
 }
@@ -2134,12 +2140,6 @@ start_all_aps(u_int boot_addr)
 
        POSTCODE(START_ALL_APS_POST);
 
-       /* Initialize BSP's local APIC */
-       lapic_init(TRUE);
-
-       /* Finalize PIC */
-       MachIntrABI.finalize();
-
        /* install the AP 1st level boot code */
        pmap_kenter(va, boot_address);
        cpu_invlpg((void *)va);         /* JG XXX */