[CPUFREQ] Longhaul - Disable arbiter CLE266
[powerpc.git] / arch / i386 / kernel / mpparse.c
index 8d8aa9d..442aaf8 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/bootmem.h>
 #include <linux/smp_lock.h>
 #include <linux/kernel_stat.h>
@@ -31,6 +30,7 @@
 #include <asm/io_apic.h>
 
 #include <mach_apic.h>
+#include <mach_apicdef.h>
 #include <mach_mpparse.h>
 #include <bios_ebda.h>
 
 int smp_found_config;
 unsigned int __initdata maxcpus = NR_CPUS;
 
-#ifdef CONFIG_HOTPLUG_CPU
-#define CPU_HOTPLUG_ENABLED    (1)
-#else
-#define CPU_HOTPLUG_ENABLED    (0)
-#endif
-
 /*
  * Various Linux-internal data structures created from the
  * MP-table.
@@ -75,7 +69,7 @@ unsigned int def_to_bigsmp = 0;
 /* Processor that is doing the boot up */
 unsigned int boot_cpu_physical_apicid = -1U;
 /* Internal processor count */
-static unsigned int __devinitdata num_processors;
+unsigned int __cpuinitdata num_processors;
 
 /* Bitmask of physically existing CPUs */
 physid_mask_t phys_cpu_present_map;
@@ -110,21 +104,6 @@ static int __init mpf_checksum(unsigned char *mp, int len)
 static int mpc_record; 
 static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata;
 
-#ifdef CONFIG_X86_NUMAQ
-static int MP_valid_apicid(int apicid, int version)
-{
-       return hweight_long(apicid & 0xf) == 1 && (apicid >> 4) != 0xf;
-}
-#else
-static int MP_valid_apicid(int apicid, int version)
-{
-       if (version >= 0x14)
-               return apicid < 0xff;
-       else
-               return apicid < 0xf;
-}
-#endif
-
 static void __devinit MP_processor_info (struct mpc_config_processor *m)
 {
        int ver, apicid;
@@ -190,12 +169,6 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m)
 
        ver = m->mpc_apicver;
 
-       if (!MP_valid_apicid(apicid, ver)) {
-               printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n",
-                       m->mpc_apicid, MAX_APICS);
-               return;
-       }
-
        /*
         * Validate version
         */
@@ -225,7 +198,14 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m)
        cpu_set(num_processors, cpu_possible_map);
        num_processors++;
 
-       if (CPU_HOTPLUG_ENABLED || (num_processors > 8)) {
+       /*
+        * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
+        * but we need to work other dependencies like SMP_SUSPEND etc
+        * before this can be done without some confusion.
+        * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
+        *       - Ashok Raj <ashok.raj@intel.com>
+        */
+       if (num_processors > 8) {
                switch (boot_cpu_data.x86_vendor) {
                case X86_VENDOR_INTEL:
                        if (!APIC_XAPIC(ver)) {
@@ -249,6 +229,15 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
 
        mpc_oem_bus_info(m, str, translation_table[mpc_record]);
 
+#if MAX_MP_BUSSES < 256
+       if (m->mpc_busid >= MAX_MP_BUSSES) {
+               printk(KERN_WARNING "MP table busid value (%d) for bustype %s "
+                       " is too large, max. supported is %d\n",
+                       m->mpc_busid, str, MAX_MP_BUSSES - 1);
+               return;
+       }
+#endif
+
        if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
                mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
        } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) {
@@ -307,19 +296,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();
 }
 
 #ifdef CONFIG_X86_NUMAQ
@@ -836,8 +812,7 @@ int es7000_plat;
 
 #ifdef CONFIG_ACPI
 
-void __init mp_register_lapic_address (
-       u64                     address)
+void __init mp_register_lapic_address(u64 address)
 {
        mp_lapic_addr = (unsigned long) address;
 
@@ -849,13 +824,10 @@ void __init mp_register_lapic_address (
        Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid);
 }
 
-
-void __devinit mp_register_lapic (
-       u8                      id, 
-       u8                      enabled)
+void __devinit mp_register_lapic (u8 id, u8 enabled)
 {
        struct mpc_config_processor processor;
-       int                     boot_cpu = 0;
+       int boot_cpu = 0;
        
        if (MAX_APICS - id <= 0) {
                printk(KERN_WARNING "Processor #%d invalid (max %d)\n",
@@ -892,11 +864,9 @@ static struct mp_ioapic_routing {
        u32                     pin_programmed[4];
 } mp_ioapic_routing[MAX_IO_APICS];
 
-
-static int mp_find_ioapic (
-       int                     gsi)
+static int mp_find_ioapic (int gsi)
 {
-       int                     i = 0;
+       int i = 0;
 
        /* Find the IOAPIC that manages this GSI. */
        for (i = 0; i < nr_ioapics; i++) {
@@ -909,15 +879,11 @@ static int mp_find_ioapic (
 
        return -1;
 }
-       
 
-void __init mp_register_ioapic (
-       u8                      id, 
-       u32                     address,
-       u32                     gsi_base)
+void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
 {
-       int                     idx = 0;
-       int                     tmpid;
+       int idx = 0;
+       int tmpid;
 
        if (nr_ioapics >= MAX_IO_APICS) {
                printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
@@ -963,16 +929,10 @@ void __init mp_register_ioapic (
                mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr,
                mp_ioapic_routing[idx].gsi_base,
                mp_ioapic_routing[idx].gsi_end);
-
-       return;
 }
 
-
-void __init mp_override_legacy_irq (
-       u8                      bus_irq,
-       u8                      polarity, 
-       u8                      trigger, 
-       u32                     gsi)
+void __init
+mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
 {
        struct mpc_config_intsrc intsrc;
        int                     ioapic = -1;
@@ -1010,15 +970,13 @@ void __init mp_override_legacy_irq (
        mp_irqs[mp_irq_entries] = intsrc;
        if (++mp_irq_entries == MAX_IRQ_SOURCES)
                panic("Max # of irq sources exceeded!\n");
-
-       return;
 }
 
 void __init mp_config_acpi_legacy_irqs (void)
 {
        struct mpc_config_intsrc intsrc;
-       int                     i = 0;
-       int                     ioapic = -1;
+       int i = 0;
+       int ioapic = -1;
 
        /* 
         * Fabricate the legacy ISA bus (bus #31).
@@ -1087,12 +1045,12 @@ void __init mp_config_acpi_legacy_irqs (void)
 
 #define MAX_GSI_NUM    4096
 
-int mp_register_gsi (u32 gsi, int triggering, int polarity)
+int mp_register_gsi(u32 gsi, int triggering, int polarity)
 {
-       int                     ioapic = -1;
-       int                     ioapic_pin = 0;
-       int                     idx, bit = 0;
-       static int              pci_irq = 16;
+       int ioapic = -1;
+       int ioapic_pin = 0;
+       int idx, bit = 0;
+       static int pci_irq = 16;
        /*
         * Mapping between Global System Interrups, which
         * represent all possible interrupts, and IRQs
@@ -1143,7 +1101,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