[PATCH] Remove some unneeded ACPI externs in mpparse.c
[powerpc.git] / arch / x86_64 / kernel / mpparse.c
index 9013a90..0cc88f7 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>
@@ -43,7 +42,7 @@ int acpi_found_madt;
  * MP-table.
  */
 unsigned char apic_version [MAX_APICS];
-unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
+DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
 
 static int mp_current_pci_id = 0;
@@ -57,7 +56,6 @@ struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
 int mp_irq_entries;
 
 int nr_ioapics;
-int pic_mode;
 unsigned long mp_lapic_addr = 0;
 
 
@@ -72,19 +70,6 @@ unsigned disabled_cpus __initdata;
 /* Bitmask of physically existing CPUs */
 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 +91,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 +118,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 +147,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;
 
@@ -182,15 +164,11 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
        Dprintk("Bus #%d is %s\n", m->mpc_busid, str);
 
        if (strncmp(str, "ISA", 3) == 0) {
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
-       } else if (strncmp(str, "EISA", 4) == 0) {
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA;
+               set_bit(m->mpc_busid, mp_bus_not_pci);
        } else if (strncmp(str, "PCI", 3) == 0) {
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI;
+               clear_bit(m->mpc_busid, mp_bus_not_pci);
                mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id;
                mp_current_pci_id++;
-       } else if (strncmp(str, "MCA", 3) == 0) {
-               mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA;
        } else {
                printk(KERN_ERR "Unknown bustype %s\n", str);
        }
@@ -236,19 +214,6 @@ static void __init MP_lintsrc_info (struct mpc_config_lintsrc *m)
                        m->mpc_irqtype, m->mpc_irqflag & 3,
                        (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid,
                        m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint);
-       /*
-        * Well it seems all SMP boards in existence
-        * use ExtINT/LVT1 == LINT0 and
-        * NMI/LVT2 == LINT1 - the following check
-        * will show us if this assumptions is false.
-        * Until then we do not have to add baggage.
-        */
-       if ((m->mpc_irqtype == mp_ExtINT) &&
-               (m->mpc_destapiclint != 0))
-                       BUG();
-       if ((m->mpc_irqtype == mp_NMI) &&
-               (m->mpc_destapiclint != 1))
-                       BUG();
 }
 
 /*
@@ -473,14 +438,6 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
                case 5:
                        memcpy(bus.mpc_bustype, "ISA   ", 6);
                        break;
-               case 2:
-               case 6:
-               case 3:
-                       memcpy(bus.mpc_bustype, "EISA  ", 6);
-                       break;
-               case 4:
-               case 7:
-                       memcpy(bus.mpc_bustype, "MCA   ", 6);
        }
        MP_bus_info(&bus);
        if (mpc_default_type > 4) {
@@ -534,13 +491,6 @@ void __init get_smp_config (void)
                printk(KERN_INFO "Using ACPI for processor (LAPIC) configuration information\n");
 
        printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification);
-       if (mpf->mpf_feature2 & (1<<7)) {
-               printk(KERN_INFO "    IMCR and PIC compatibility mode.\n");
-               pic_mode = 1;
-       } else {
-               printk(KERN_INFO "    Virtual Wire compatibility mode.\n");
-               pic_mode = 0;
-       }
 
        /*
         * Now see if we need to read further.
@@ -620,7 +570,7 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
        return 0;
 }
 
-void __init find_intel_smp (void)
+void __init find_smp_config(void)
 {
        unsigned int address;
 
@@ -637,9 +587,7 @@ void __init find_intel_smp (void)
                        smp_scan_config(0xF0000,0x10000))
                return;
        /*
-        * If it is an SMP machine we should know now, unless the
-        * configuration is in an EISA/MCA bus machine with an
-        * extended bios data area.
+        * If it is an SMP machine we should know now.
         *
         * there is a real-mode segmented pointer pointing to the
         * 4K EBDA area at 0x40E, calculate and scan it here.
@@ -660,17 +608,6 @@ void __init find_intel_smp (void)
         printk(KERN_INFO "No mptable found.\n");
 }
 
-/*
- * - Intel MP Configuration Table
- */
-void __init find_smp_config (void)
-{
-#ifdef CONFIG_X86_LOCAL_APIC
-       find_intel_smp();
-#endif
-}
-
-
 /* --------------------------------------------------------------------------
                             ACPI-based MP Configuration
    -------------------------------------------------------------------------- */
@@ -691,7 +628,7 @@ void __init mp_register_lapic_address (
 }
 
 
-void __init mp_register_lapic (
+void __cpuinit mp_register_lapic (
        u8                      id, 
        u8                      enabled)
 {
@@ -721,8 +658,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
 
@@ -855,8 +790,7 @@ void __init mp_config_acpi_legacy_irqs (void)
        /* 
         * Fabricate the legacy ISA bus (bus #31).
         */
-       mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
-       Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
+       set_bit(MP_ISA_BUS, mp_bus_not_pci);
 
        /* 
         * Locate the IOAPIC that manages the ISA IRQs (0-15). 
@@ -971,7 +905,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 +935,4 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
        return gsi;
 }
 
-#endif /*CONFIG_X86_IO_APIC*/
 #endif /*CONFIG_ACPI*/