diff options
author | Andi Kleen <ak@suse.de> | 2008-01-30 07:30:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:40 -0500 |
commit | 739f33b38bf88312447e38ae8b7ac3acdbb72a6b (patch) | |
tree | 2d5e09f00175f7078f519609c20624a8e77f0e5b | |
parent | 3f6e5a12b8384ab9816ba6703f4b4be87ac94b5a (diff) |
x86: untable __init references between IO data
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>
-rw-r--r-- | arch/x86/kernel/apic_64.c | 46 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot_64.c | 8 | ||||
-rw-r--r-- | include/asm-x86/apic.h | 1 |
3 files changed, 32 insertions, 23 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index 994298bf4921..d341f798255c 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -677,7 +677,7 @@ void __init init_bsp_APIC(void) | |||
677 | */ | 677 | */ |
678 | void __cpuinit setup_local_APIC(void) | 678 | void __cpuinit setup_local_APIC(void) |
679 | { | 679 | { |
680 | unsigned int value, maxlvt; | 680 | unsigned int value; |
681 | int i, j; | 681 | int i, j; |
682 | 682 | ||
683 | value = apic_read(APIC_LVR); | 683 | value = apic_read(APIC_LVR); |
@@ -773,32 +773,23 @@ void __cpuinit setup_local_APIC(void) | |||
773 | else | 773 | else |
774 | value = APIC_DM_NMI | APIC_LVT_MASKED; | 774 | value = APIC_DM_NMI | APIC_LVT_MASKED; |
775 | apic_write(APIC_LVT1, value); | 775 | apic_write(APIC_LVT1, value); |
776 | } | ||
777 | |||
778 | void __cpuinit lapic_setup_esr(void) | ||
779 | { | ||
780 | unsigned maxlvt = lapic_get_maxlvt(); | ||
776 | 781 | ||
782 | apic_write(APIC_LVTERR, ERROR_APIC_VECTOR); | ||
777 | /* | 783 | /* |
778 | * Now enable IO-APICs, actually call clear_IO_APIC | 784 | * spec says clear errors after enabling vector. |
779 | * We need clear_IO_APIC before enabling vector on BP | ||
780 | */ | 785 | */ |
781 | if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics) | 786 | if (maxlvt > 3) |
782 | enable_IO_APIC(); | 787 | apic_write(APIC_ESR, 0); |
783 | 788 | } | |
784 | { | ||
785 | unsigned oldvalue; | ||
786 | maxlvt = lapic_get_maxlvt(); | ||
787 | oldvalue = apic_read(APIC_ESR); | ||
788 | value = ERROR_APIC_VECTOR; // enables sending errors | ||
789 | apic_write(APIC_LVTERR, value); | ||
790 | /* | ||
791 | * spec says clear errors after enabling vector. | ||
792 | */ | ||
793 | if (maxlvt > 3) | ||
794 | apic_write(APIC_ESR, 0); | ||
795 | value = apic_read(APIC_ESR); | ||
796 | if (value != oldvalue) | ||
797 | apic_printk(APIC_VERBOSE, | ||
798 | "ESR value after enabling vector: %08x, after %08x\n", | ||
799 | oldvalue, value); | ||
800 | } | ||
801 | 789 | ||
790 | void __cpuinit end_local_APIC_setup(void) | ||
791 | { | ||
792 | lapic_setup_esr(); | ||
802 | nmi_watchdog_default(); | 793 | nmi_watchdog_default(); |
803 | setup_apic_nmi_watchdog(NULL); | 794 | setup_apic_nmi_watchdog(NULL); |
804 | apic_pm_activate(); | 795 | apic_pm_activate(); |
@@ -879,6 +870,15 @@ int __init APIC_init_uniprocessor(void) | |||
879 | 870 | ||
880 | setup_local_APIC(); | 871 | setup_local_APIC(); |
881 | 872 | ||
873 | /* | ||
874 | * Now enable IO-APICs, actually call clear_IO_APIC | ||
875 | * We need clear_IO_APIC before enabling vector on BP | ||
876 | */ | ||
877 | if (!skip_ioapic_setup && nr_ioapics) | ||
878 | enable_IO_APIC(); | ||
879 | |||
880 | end_local_APIC_setup(); | ||
881 | |||
882 | if (smp_found_config && !skip_ioapic_setup && nr_ioapics) | 882 | if (smp_found_config && !skip_ioapic_setup && nr_ioapics) |
883 | setup_IO_APIC(); | 883 | setup_IO_APIC(); |
884 | else | 884 | else |
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c index 7552db9ee9ff..ddefb38c53fb 100644 --- a/arch/x86/kernel/smpboot_64.c +++ b/arch/x86/kernel/smpboot_64.c | |||
@@ -210,6 +210,7 @@ void __cpuinit smp_callin(void) | |||
210 | 210 | ||
211 | Dprintk("CALLIN, before setup_local_APIC().\n"); | 211 | Dprintk("CALLIN, before setup_local_APIC().\n"); |
212 | setup_local_APIC(); | 212 | setup_local_APIC(); |
213 | end_local_APIC_setup(); | ||
213 | 214 | ||
214 | /* | 215 | /* |
215 | * Get our bogomips. | 216 | * Get our bogomips. |
@@ -884,6 +885,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
884 | */ | 885 | */ |
885 | setup_local_APIC(); | 886 | setup_local_APIC(); |
886 | 887 | ||
888 | /* | ||
889 | * Enable IO APIC before setting up error vector | ||
890 | */ | ||
891 | if (!skip_ioapic_setup && nr_ioapics) | ||
892 | enable_IO_APIC(); | ||
893 | end_local_APIC_setup(); | ||
894 | |||
887 | if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) { | 895 | if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) { |
888 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", | 896 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", |
889 | GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id); | 897 | GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id); |
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h index 18d932dff476..5e8192d36e5a 100644 --- a/include/asm-x86/apic.h +++ b/include/asm-x86/apic.h | |||
@@ -112,6 +112,7 @@ extern void cache_APIC_registers(void); | |||
112 | extern void sync_Arb_IDs(void); | 112 | extern void sync_Arb_IDs(void); |
113 | extern void init_bsp_APIC(void); | 113 | extern void init_bsp_APIC(void); |
114 | extern void setup_local_APIC(void); | 114 | extern void setup_local_APIC(void); |
115 | extern void end_local_APIC_setup(void); | ||
115 | extern void init_apic_mappings(void); | 116 | extern void init_apic_mappings(void); |
116 | extern void setup_boot_APIC_clock(void); | 117 | extern void setup_boot_APIC_clock(void); |
117 | extern void setup_secondary_APIC_clock(void); | 118 | extern void setup_secondary_APIC_clock(void); |