]> err.no Git - linux-2.6/commitdiff
x86: untable __init references between IO data
authorAndi Kleen <ak@suse.de>
Wed, 30 Jan 2008 12:30:40 +0000 (13:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:30:40 +0000 (13:30 +0100)
Earlier patch added IO APIC setup into local APIC setup. This caused
modpost warnings. Fix them by untangling setup_local_APIC() and splitting
it into smaller functions. The IO APIC initialization is only called
for the BP init.

Also removed some outdated debugging code and minor cleanup.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/apic_64.c
arch/x86/kernel/smpboot_64.c
include/asm-x86/apic.h

index 994298bf4921b1483c76e2040b86f25487d3a8dc..d341f798255ce77810707ad6a931edfb687cb962 100644 (file)
@@ -677,7 +677,7 @@ void __init init_bsp_APIC(void)
  */
 void __cpuinit setup_local_APIC(void)
 {
-       unsigned int value, maxlvt;
+       unsigned int value;
        int i, j;
 
        value = apic_read(APIC_LVR);
@@ -773,32 +773,23 @@ void __cpuinit setup_local_APIC(void)
        else
                value = APIC_DM_NMI | APIC_LVT_MASKED;
        apic_write(APIC_LVT1, value);
+}
+
+void __cpuinit lapic_setup_esr(void)
+{
+       unsigned maxlvt = lapic_get_maxlvt();
 
+       apic_write(APIC_LVTERR, ERROR_APIC_VECTOR);
        /*
-        * Now enable IO-APICs, actually call clear_IO_APIC
-        * We need clear_IO_APIC before enabling vector on BP
+        * spec says clear errors after enabling vector.
         */
-       if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics)
-               enable_IO_APIC();
-
-       {
-               unsigned oldvalue;
-               maxlvt = lapic_get_maxlvt();
-               oldvalue = apic_read(APIC_ESR);
-               value = ERROR_APIC_VECTOR;      // enables sending errors
-               apic_write(APIC_LVTERR, value);
-               /*
-                * spec says clear errors after enabling vector.
-                */
-               if (maxlvt > 3)
-                       apic_write(APIC_ESR, 0);
-               value = apic_read(APIC_ESR);
-               if (value != oldvalue)
-                       apic_printk(APIC_VERBOSE,
-                       "ESR value after enabling vector: %08x, after %08x\n",
-                       oldvalue, value);
-       }
+       if (maxlvt > 3)
+               apic_write(APIC_ESR, 0);
+}
 
+void __cpuinit end_local_APIC_setup(void)
+{
+       lapic_setup_esr();
        nmi_watchdog_default();
        setup_apic_nmi_watchdog(NULL);
        apic_pm_activate();
@@ -879,6 +870,15 @@ int __init APIC_init_uniprocessor(void)
 
        setup_local_APIC();
 
+       /*
+        * Now enable IO-APICs, actually call clear_IO_APIC
+        * We need clear_IO_APIC before enabling vector on BP
+        */
+       if (!skip_ioapic_setup && nr_ioapics)
+               enable_IO_APIC();
+
+       end_local_APIC_setup();
+
        if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
                setup_IO_APIC();
        else
index 7552db9ee9ff2a7fa1387ac0f838641f29028c27..ddefb38c53fb5f5b766bdf00d7367a8a5439f7eb 100644 (file)
@@ -210,6 +210,7 @@ void __cpuinit smp_callin(void)
 
        Dprintk("CALLIN, before setup_local_APIC().\n");
        setup_local_APIC();
+       end_local_APIC_setup();
 
        /*
         * Get our bogomips.
@@ -884,6 +885,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
         */
        setup_local_APIC();
 
+       /*
+        * Enable IO APIC before setting up error vector
+        */
+       if (!skip_ioapic_setup && nr_ioapics)
+               enable_IO_APIC();
+       end_local_APIC_setup();
+
        if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
                panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
                      GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id);
index 18d932dff476f501945f10c0c92f84a967428dd2..5e8192d36e5ae6f2917a3d983505a34e46c4a66b 100644 (file)
@@ -112,6 +112,7 @@ extern void cache_APIC_registers(void);
 extern void sync_Arb_IDs(void);
 extern void init_bsp_APIC(void);
 extern void setup_local_APIC(void);
+extern void end_local_APIC_setup(void);
 extern void init_apic_mappings(void);
 extern void setup_boot_APIC_clock(void);
 extern void setup_secondary_APIC_clock(void);