]> err.no Git - linux-2.6/blobdiff - arch/x86_64/kernel/mpparse.c
[PATCH] Remove all ifdefs for local/io apic
[linux-2.6] / arch / x86_64 / kernel / mpparse.c
index 9013a90b5c2e69aebbcc038c2abc57e84d715c49..c73dd1f41e651551880fe760209104f012f8efb4 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/bootmem.h>
 #include <linux/smp_lock.h>
 #include <linux/kernel_stat.h>
@@ -75,14 +74,10 @@ physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
 /* ACPI MADT entry parsing functions */
 #ifdef CONFIG_ACPI
 extern struct acpi_boot_flags acpi_boot;
-#ifdef CONFIG_X86_LOCAL_APIC
 extern int acpi_parse_lapic (acpi_table_entry_header *header);
 extern int acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header);
 extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header);
-#endif /*CONFIG_X86_LOCAL_APIC*/
-#ifdef CONFIG_X86_IO_APIC
 extern int acpi_parse_ioapic (acpi_table_entry_header *header);
-#endif /*CONFIG_X86_IO_APIC*/
 #endif /*CONFIG_ACPI*/
 
 u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
@@ -106,11 +101,11 @@ static int __init mpf_checksum(unsigned char *mp, int len)
        return sum & 0xFF;
 }
 
-static void __init MP_processor_info (struct mpc_config_processor *m)
+static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 {
        int cpu;
        unsigned char ver;
-       static int found_bsp=0;
+       cpumask_t tmp_map;
 
        if (!(m->mpc_cpuflag & CPU_ENABLED)) {
                disabled_cpus++;
@@ -133,8 +128,10 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
                return;
        }
 
-       cpu = num_processors++;
-       
+       num_processors++;
+       cpus_complement(tmp_map, cpu_present_map);
+       cpu = first_cpu(tmp_map);
+
 #if MAX_APICS < 255    
        if ((int)m->mpc_apicid > MAX_APICS) {
                printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
@@ -160,12 +157,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
                 * entry is BSP, and so on.
                 */
                cpu = 0;
-
-               bios_cpu_apicid[0] = m->mpc_apicid;
-               x86_cpu_to_apicid[0] = m->mpc_apicid;
-               found_bsp = 1;
-       } else
-               cpu = num_processors - found_bsp;
+       }
        bios_cpu_apicid[cpu] = m->mpc_apicid;
        x86_cpu_to_apicid[cpu] = m->mpc_apicid;
 
@@ -665,9 +657,7 @@ void __init find_intel_smp (void)
  */
 void __init find_smp_config (void)
 {
-#ifdef CONFIG_X86_LOCAL_APIC
        find_intel_smp();
-#endif
 }
 
 
@@ -691,7 +681,7 @@ void __init mp_register_lapic_address (
 }
 
 
-void __init mp_register_lapic (
+void __cpuinit mp_register_lapic (
        u8                      id, 
        u8                      enabled)
 {
@@ -721,8 +711,6 @@ void __init mp_register_lapic (
        MP_processor_info(&processor);
 }
 
-#ifdef CONFIG_X86_IO_APIC
-
 #define MP_ISA_BUS             0
 #define MP_MAX_IOAPIC_PIN      127
 
@@ -971,7 +959,17 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
                 */
                int irq = gsi;
                if (gsi < MAX_GSI_NUM) {
-                       if (gsi > 15)
+                       /*
+                        * Retain the VIA chipset work-around (gsi > 15), but
+                        * avoid a problem where the 8254 timer (IRQ0) is setup
+                        * via an override (so it's not on pin 0 of the ioapic),
+                        * and at the same time, the pin 0 interrupt is a PCI
+                        * type.  The gsi > 15 test could cause these two pins
+                        * to be shared as IRQ0, and they are not shareable.
+                        * So test for this condition, and if necessary, avoid
+                        * the pin collision.
+                        */
+                       if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
                                gsi = pci_irq++;
                        /*
                         * Don't assign IRQ used by ACPI SCI
@@ -991,5 +989,4 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
        return gsi;
 }
 
-#endif /*CONFIG_X86_IO_APIC*/
 #endif /*CONFIG_ACPI*/