x86: let setup_arch call init_apic_mappings for 32bit
authorYinghai Lu <yhlu.kernel@gmail.com>
Fri, 27 Jun 2008 08:41:56 +0000 (01:41 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 8 Jul 2008 11:16:04 +0000 (13:16 +0200)
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>
arch/x86/kernel/apic_32.c
arch/x86/kernel/io_apic_32.c
arch/x86/kernel/setup.c
arch/x86/kernel/traps_32.c
include/asm-x86/apic.h
include/asm-x86/io_apic.h

index b5571fb0f77ee9b64858e5f60fbfc73979de38fc..8fbad8ed0ebe481c286305de7bd5e75d8f954528 100644 (file)
@@ -1197,36 +1197,6 @@ void __init init_apic_mappings(void)
        if (boot_cpu_physical_apicid == -1U)
                boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
 
-#ifdef CONFIG_X86_IO_APIC
-       {
-               unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
-               int i;
-
-               for (i = 0; i < nr_ioapics; i++) {
-                       if (smp_found_config) {
-                               ioapic_phys = mp_ioapics[i].mp_apicaddr;
-                               if (!ioapic_phys) {
-                                       printk(KERN_ERR
-                                              "WARNING: bogus zero IO-APIC "
-                                              "address found in MPTABLE, "
-                                              "disabling IO/APIC support!\n");
-                                       smp_found_config = 0;
-                                       skip_ioapic_setup = 1;
-                                       goto fake_ioapic_page;
-                               }
-                       } else {
-fake_ioapic_page:
-                               ioapic_phys = (unsigned long)
-                                             alloc_bootmem_pages(PAGE_SIZE);
-                               ioapic_phys = __pa(ioapic_phys);
-                       }
-                       set_fixmap_nocache(idx, ioapic_phys);
-                       printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
-                              __fix_to_virt(idx), ioapic_phys);
-                       idx++;
-               }
-       }
-#endif
 }
 
 /*
index d6af301c822bb4127ca7bcb3dd1a76a7488533e2..337ec3438a8f2f90655efa6c2a1e5419e8bd1000 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
+#include <linux/bootmem.h>
 #include <linux/mc146818rtc.h>
 #include <linux/compiler.h>
 #include <linux/acpi.h>
@@ -2852,3 +2853,34 @@ static int __init parse_noapic(char *arg)
        return 0;
 }
 early_param("noapic", parse_noapic);
+
+void __init ioapic_init_mappings(void)
+{
+       unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
+       int i;
+
+       for (i = 0; i < nr_ioapics; i++) {
+               if (smp_found_config) {
+                       ioapic_phys = mp_ioapics[i].mp_apicaddr;
+                       if (!ioapic_phys) {
+                               printk(KERN_ERR
+                                      "WARNING: bogus zero IO-APIC "
+                                      "address found in MPTABLE, "
+                                      "disabling IO/APIC support!\n");
+                               smp_found_config = 0;
+                               skip_ioapic_setup = 1;
+                               goto fake_ioapic_page;
+                       }
+               } else {
+fake_ioapic_page:
+                       ioapic_phys = (unsigned long)
+                                     alloc_bootmem_pages(PAGE_SIZE);
+                       ioapic_phys = __pa(ioapic_phys);
+               }
+               set_fixmap_nocache(idx, ioapic_phys);
+               printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
+                      __fix_to_virt(idx), ioapic_phys);
+               idx++;
+       }
+}
+
index bf528b23750a814a26c604445cf4aff935b3c0f4..4716460607b4ad1172c64d5441c84e9cf945c7e0 100644 (file)
@@ -766,16 +766,14 @@ void __init setup_arch(char **cmdline_p)
                get_smp_config();
 #endif
 
-#ifdef CONFIG_X86_64
        init_apic_mappings();
        ioapic_init_mappings();
-#else
-# if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
+
+#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) && defined(CONFIG_X86_32)
        if (def_to_bigsmp)
                printk(KERN_WARNING "More than 8 CPUs detected and "
                        "CONFIG_X86_PC cannot handle it.\nUse "
                        "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
-# endif
 #endif
        kvm_guest_init();
 
index dc7c05e5cfe7be479452dac18133583364afefef..f60feee83253a757ccf637963ae38e9d9f34e7d6 100644 (file)
@@ -1198,10 +1198,6 @@ void __init trap_init(void)
        early_iounmap(p, 4);
 #endif
 
-#ifdef CONFIG_X86_LOCAL_APIC
-       init_apic_mappings();
-#endif
-       set_trap_gate(0,  &divide_error);
        set_intr_gate(1,  &debug);
        set_intr_gate(2,  &nmi);
        set_system_intr_gate(3, &int3); /* int3/4 can be called from all */
index 9fe941cd843dd07aab30a6f2aad4d045cf557399..6ae6ae68d4cd2732ff14f0fe218376fcc90bbb48 100644 (file)
@@ -135,6 +135,7 @@ extern int apic_is_clustered_box(void);
 #else /* !CONFIG_X86_LOCAL_APIC */
 static inline void lapic_shutdown(void) { }
 #define local_apic_timer_c2_ok         1
+static inline void init_apic_mappings(void) { }
 
 #endif /* !CONFIG_X86_LOCAL_APIC */
 
index 8b1f5684842e2b3afc1357796984b404dfac22cb..14f82bbcb5fd6ee5d09f05be363651258ff4e9bb 100644 (file)
@@ -186,6 +186,7 @@ extern void ioapic_init_mappings(void);
 #else  /* !CONFIG_X86_IO_APIC */
 #define io_apic_assign_pci_irqs 0
 static const int timer_through_8259 = 0;
+static inline void ioapic_init_mappings(void) { }
 #endif
 
 #endif