aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-27 04:41:56 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 07:16:04 -0400
commitf3294a33e765d8308c3e17b951a13e0db9cf5f00 (patch)
treed73b3b157bd1e21b9dbbdd49bfbb64f5763accfb
parentab67715c7201be2fe729888a09007b6ba5bb2326 (diff)
x86: let setup_arch call init_apic_mappings for 32bit
instead of calling it from trap_init() also move init ioapic mapping out of apic_32.c so 32 bit do same as 64 bit Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic_32.c30
-rw-r--r--arch/x86/kernel/io_apic_32.c32
-rw-r--r--arch/x86/kernel/setup.c6
-rw-r--r--arch/x86/kernel/traps_32.c4
-rw-r--r--include/asm-x86/apic.h1
-rw-r--r--include/asm-x86/io_apic.h1
6 files changed, 36 insertions, 38 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index b5571fb0f77e..8fbad8ed0ebe 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1197,36 +1197,6 @@ void __init init_apic_mappings(void)
1197 if (boot_cpu_physical_apicid == -1U) 1197 if (boot_cpu_physical_apicid == -1U)
1198 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); 1198 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
1199 1199
1200#ifdef CONFIG_X86_IO_APIC
1201 {
1202 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
1203 int i;
1204
1205 for (i = 0; i < nr_ioapics; i++) {
1206 if (smp_found_config) {
1207 ioapic_phys = mp_ioapics[i].mp_apicaddr;
1208 if (!ioapic_phys) {
1209 printk(KERN_ERR
1210 "WARNING: bogus zero IO-APIC "
1211 "address found in MPTABLE, "
1212 "disabling IO/APIC support!\n");
1213 smp_found_config = 0;
1214 skip_ioapic_setup = 1;
1215 goto fake_ioapic_page;
1216 }
1217 } else {
1218fake_ioapic_page:
1219 ioapic_phys = (unsigned long)
1220 alloc_bootmem_pages(PAGE_SIZE);
1221 ioapic_phys = __pa(ioapic_phys);
1222 }
1223 set_fixmap_nocache(idx, ioapic_phys);
1224 printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
1225 __fix_to_virt(idx), ioapic_phys);
1226 idx++;
1227 }
1228 }
1229#endif
1230} 1200}
1231 1201
1232/* 1202/*
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index d6af301c822b..337ec3438a8f 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -25,6 +25,7 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/bootmem.h>
28#include <linux/mc146818rtc.h> 29#include <linux/mc146818rtc.h>
29#include <linux/compiler.h> 30#include <linux/compiler.h>
30#include <linux/acpi.h> 31#include <linux/acpi.h>
@@ -2852,3 +2853,34 @@ static int __init parse_noapic(char *arg)
2852 return 0; 2853 return 0;
2853} 2854}
2854early_param("noapic", parse_noapic); 2855early_param("noapic", parse_noapic);
2856
2857void __init ioapic_init_mappings(void)
2858{
2859 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
2860 int i;
2861
2862 for (i = 0; i < nr_ioapics; i++) {
2863 if (smp_found_config) {
2864 ioapic_phys = mp_ioapics[i].mp_apicaddr;
2865 if (!ioapic_phys) {
2866 printk(KERN_ERR
2867 "WARNING: bogus zero IO-APIC "
2868 "address found in MPTABLE, "
2869 "disabling IO/APIC support!\n");
2870 smp_found_config = 0;
2871 skip_ioapic_setup = 1;
2872 goto fake_ioapic_page;
2873 }
2874 } else {
2875fake_ioapic_page:
2876 ioapic_phys = (unsigned long)
2877 alloc_bootmem_pages(PAGE_SIZE);
2878 ioapic_phys = __pa(ioapic_phys);
2879 }
2880 set_fixmap_nocache(idx, ioapic_phys);
2881 printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
2882 __fix_to_virt(idx), ioapic_phys);
2883 idx++;
2884 }
2885}
2886
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bf528b23750a..4716460607b4 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -766,16 +766,14 @@ void __init setup_arch(char **cmdline_p)
766 get_smp_config(); 766 get_smp_config();
767#endif 767#endif
768 768
769#ifdef CONFIG_X86_64
770 init_apic_mappings(); 769 init_apic_mappings();
771 ioapic_init_mappings(); 770 ioapic_init_mappings();
772#else 771
773# if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) 772#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) && defined(CONFIG_X86_32)
774 if (def_to_bigsmp) 773 if (def_to_bigsmp)
775 printk(KERN_WARNING "More than 8 CPUs detected and " 774 printk(KERN_WARNING "More than 8 CPUs detected and "
776 "CONFIG_X86_PC cannot handle it.\nUse " 775 "CONFIG_X86_PC cannot handle it.\nUse "
777 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n"); 776 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
778# endif
779#endif 777#endif
780 kvm_guest_init(); 778 kvm_guest_init();
781 779
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index dc7c05e5cfe7..f60feee83253 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -1198,10 +1198,6 @@ void __init trap_init(void)
1198 early_iounmap(p, 4); 1198 early_iounmap(p, 4);
1199#endif 1199#endif
1200 1200
1201#ifdef CONFIG_X86_LOCAL_APIC
1202 init_apic_mappings();
1203#endif
1204 set_trap_gate(0, &divide_error);
1205 set_intr_gate(1, &debug); 1201 set_intr_gate(1, &debug);
1206 set_intr_gate(2, &nmi); 1202 set_intr_gate(2, &nmi);
1207 set_system_intr_gate(3, &int3); /* int3/4 can be called from all */ 1203 set_system_intr_gate(3, &int3); /* int3/4 can be called from all */
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index 9fe941cd843d..6ae6ae68d4cd 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -135,6 +135,7 @@ extern int apic_is_clustered_box(void);
135#else /* !CONFIG_X86_LOCAL_APIC */ 135#else /* !CONFIG_X86_LOCAL_APIC */
136static inline void lapic_shutdown(void) { } 136static inline void lapic_shutdown(void) { }
137#define local_apic_timer_c2_ok 1 137#define local_apic_timer_c2_ok 1
138static inline void init_apic_mappings(void) { }
138 139
139#endif /* !CONFIG_X86_LOCAL_APIC */ 140#endif /* !CONFIG_X86_LOCAL_APIC */
140 141
diff --git a/include/asm-x86/io_apic.h b/include/asm-x86/io_apic.h
index 8b1f5684842e..14f82bbcb5fd 100644
--- a/include/asm-x86/io_apic.h
+++ b/include/asm-x86/io_apic.h
@@ -186,6 +186,7 @@ extern void ioapic_init_mappings(void);
186#else /* !CONFIG_X86_IO_APIC */ 186#else /* !CONFIG_X86_IO_APIC */
187#define io_apic_assign_pci_irqs 0 187#define io_apic_assign_pci_irqs 0
188static const int timer_through_8259 = 0; 188static const int timer_through_8259 = 0;
189static inline void ioapic_init_mappings(void) { }
189#endif 190#endif
190 191
191#endif 192#endif