Merge branch 'x86/core' into core/ipi
[safe/jmp/linux-2.6] / arch / x86 / kernel / acpi / boot.c
index caf4ed7..a18eb7c 100644 (file)
 #include <asm/mpspec.h>
 #include <asm/smp.h>
 
-#ifdef CONFIG_X86_LOCAL_APIC
-# include <mach_apic.h>
-#endif
-
 static int __initdata acpi_force = 0;
-
+u32 acpi_rsdt_forced;
 #ifdef CONFIG_ACPI
 int acpi_disabled = 0;
 #else
@@ -55,17 +51,7 @@ int acpi_disabled = 1;
 EXPORT_SYMBOL(acpi_disabled);
 
 #ifdef CONFIG_X86_64
-
-#include <asm/proto.h>
-#include <asm/genapic.h>
-
-#else                          /* X86 */
-
-#ifdef CONFIG_X86_LOCAL_APIC
-#include <mach_apic.h>
-#include <mach_mpparse.h>
-#endif                         /* CONFIG_X86_LOCAL_APIC */
-
+# include <asm/proto.h>
 #endif                         /* X86 */
 
 #define BAD_MADT_ENTRY(entry, end) (                                       \
@@ -106,21 +92,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
  */
 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 
-#ifdef CONFIG_X86_64
-
-/* rely on all ACPI tables being in the direct mapping */
-char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
-{
-       if (!phys_addr || !size)
-               return NULL;
-
-       if (phys_addr+size <= (max_pfn_mapped << PAGE_SHIFT) + PAGE_SIZE)
-               return __va(phys_addr);
-
-       return NULL;
-}
-
-#else
 
 /*
  * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
@@ -136,38 +107,36 @@ char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
  */
 char *__init __acpi_map_table(unsigned long phys, unsigned long size)
 {
-       unsigned long base, offset, mapped_size;
-       int idx;
-
-       if (phys + size < 8 * 1024 * 1024)
-               return __va(phys);
 
-       offset = phys & (PAGE_SIZE - 1);
-       mapped_size = PAGE_SIZE - offset;
-       set_fixmap(FIX_ACPI_END, phys);
-       base = fix_to_virt(FIX_ACPI_END);
+       if (!phys || !size)
+               return NULL;
 
-       /*
-        * Most cases can be covered by the below.
-        */
-       idx = FIX_ACPI_END;
-       while (mapped_size < size) {
-               if (--idx < FIX_ACPI_BEGIN)
-                       return NULL;    /* cannot handle this */
-               phys += PAGE_SIZE;
-               set_fixmap(idx, phys);
-               mapped_size += PAGE_SIZE;
-       }
+       return early_ioremap(phys, size);
+}
+void __init __acpi_unmap_table(char *map, unsigned long size)
+{
+       if (!map || !size)
+               return;
 
-       return ((unsigned char *)base + offset);
+       early_iounmap(map, size);
 }
-#endif
 
 #ifdef CONFIG_PCI_MMCONFIG
+
+static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
+
 /* The physical address of the MMCONFIG aperture.  Set from ACPI tables. */
 struct acpi_mcfg_allocation *pci_mmcfg_config;
 int pci_mmcfg_config_num;
 
+static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
+{
+       if (!strcmp(mcfg->header.oem_id, "SGI"))
+               acpi_mcfg_64bit_base_addr = TRUE;
+
+       return 0;
+}
+
 int __init acpi_parse_mcfg(struct acpi_table_header *header)
 {
        struct acpi_table_mcfg *mcfg;
@@ -200,8 +169,12 @@ int __init acpi_parse_mcfg(struct acpi_table_header *header)
        }
 
        memcpy(pci_mmcfg_config, &mcfg[1], config_size);
+
+       acpi_mcfg_oem_check(mcfg);
+
        for (i = 0; i < pci_mmcfg_config_num; ++i) {
-               if (pci_mmcfg_config[i].address > 0xFFFFFFFF) {
+               if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) &&
+                   !acpi_mcfg_64bit_base_addr) {
                        printk(KERN_ERR PREFIX
                               "MMCONFIG not in low 4GB of memory\n");
                        kfree(pci_mmcfg_config);
@@ -235,7 +208,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
                       madt->address);
        }
 
-       acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
+       default_acpi_madt_oem_check(madt->header.oem_id,
+                                   madt->header.oem_table_id);
 
        return 0;
 }
@@ -249,10 +223,8 @@ static void __cpuinit acpi_register_lapic(int id, u8 enabled)
                return;
        }
 
-#ifdef CONFIG_X86_32
        if (boot_cpu_physical_apicid != -1U)
                ver = apic_version[boot_cpu_physical_apicid];
-#endif
 
        generic_processor_info(id, ver);
 }
@@ -512,8 +484,6 @@ int acpi_register_gsi(u32 gsi, int triggering, int polarity)
         * Make sure all (legacy) PCI IRQs are set as level-triggered.
         */
        if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
-               extern void eisa_set_level_irq(unsigned int irq);
-
                if (triggering == ACPI_LEVEL_SENSITIVE)
                        eisa_set_level_irq(gsi);
        }
@@ -538,9 +508,10 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        union acpi_object *obj;
        struct acpi_madt_local_apic *lapic;
-       cpumask_t tmp_map, new_map;
+       cpumask_var_t tmp_map, new_map;
        u8 physid;
        int cpu;
+       int retval = -ENOMEM;
 
        if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
                return -EINVAL;
@@ -569,23 +540,37 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
        buffer.length = ACPI_ALLOCATE_BUFFER;
        buffer.pointer = NULL;
 
-       tmp_map = cpu_present_map;
+       if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
+               goto out;
+
+       if (!alloc_cpumask_var(&new_map, GFP_KERNEL))
+               goto free_tmp_map;
+
+       cpumask_copy(tmp_map, cpu_present_mask);
        acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
 
        /*
         * If mp_register_lapic successfully generates a new logical cpu
         * number, then the following will get us exactly what was mapped
         */
-       cpus_andnot(new_map, cpu_present_map, tmp_map);
-       if (cpus_empty(new_map)) {
+       cpumask_andnot(new_map, cpu_present_mask, tmp_map);
+       if (cpumask_empty(new_map)) {
                printk ("Unable to map lapic to logical cpu number\n");
-               return -EINVAL;
+               retval = -EINVAL;
+               goto free_new_map;
        }
 
-       cpu = first_cpu(new_map);
+       cpu = cpumask_first(new_map);
 
        *pcpu = cpu;
-       return 0;
+       retval = 0;
+
+free_new_map:
+       free_cpumask_var(new_map);
+free_tmp_map:
+       free_cpumask_var(tmp_map);
+out:
+       return retval;
 }
 
 /* wrapper to silence section mismatch warning */
@@ -598,7 +583,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
 int acpi_unmap_lsapic(int cpu)
 {
        per_cpu(x86_cpu_to_apicid, cpu) = -1;
-       cpu_clear(cpu, cpu_present_map);
+       set_cpu_present(cpu, false);
        num_processors--;
 
        return (0);
@@ -773,11 +758,9 @@ static void __init acpi_register_lapic_address(unsigned long address)
 
        set_fixmap_nocache(FIX_APIC_BASE, address);
        if (boot_cpu_physical_apicid == -1U) {
-               boot_cpu_physical_apicid  = GET_APIC_ID(read_apic_id());
-#ifdef CONFIG_X86_32
+               boot_cpu_physical_apicid  = read_apic_id();
                apic_version[boot_cpu_physical_apicid] =
                         GET_APIC_VERSION(apic_read(APIC_LVR));
-#endif
        }
 }
 
@@ -871,7 +854,7 @@ static struct {
        DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
 } mp_ioapic_routing[MAX_IO_APICS];
 
-static int mp_find_ioapic(int gsi)
+int mp_find_ioapic(int gsi)
 {
        int i = 0;
 
@@ -886,6 +869,16 @@ static int mp_find_ioapic(int gsi)
        return -1;
 }
 
+int mp_find_ioapic_pin(int ioapic, int gsi)
+{
+       if (WARN_ON(ioapic == -1))
+               return -1;
+       if (WARN_ON(gsi > mp_ioapic_routing[ioapic].gsi_end))
+               return -1;
+
+       return gsi - mp_ioapic_routing[ioapic].gsi_base;
+}
+
 static u8 __init uniq_ioapic_id(u8 id)
 {
 #ifdef CONFIG_X86_32
@@ -899,8 +892,8 @@ static u8 __init uniq_ioapic_id(u8 id)
        DECLARE_BITMAP(used, 256);
        bitmap_zero(used, 256);
        for (i = 0; i < nr_ioapics; i++) {
-               struct mp_config_ioapic *ia = &mp_ioapics[i];
-               __set_bit(ia->mp_apicid, used);
+               struct mpc_ioapic *ia = &mp_ioapics[i];
+               __set_bit(ia->apicid, used);
        }
        if (!test_bit(id, used))
                return id;
@@ -932,38 +925,88 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
 
        idx = nr_ioapics;
 
-       mp_ioapics[idx].mp_type = MP_IOAPIC;
-       mp_ioapics[idx].mp_flags = MPC_APIC_USABLE;
-       mp_ioapics[idx].mp_apicaddr = address;
+       mp_ioapics[idx].type = MP_IOAPIC;
+       mp_ioapics[idx].flags = MPC_APIC_USABLE;
+       mp_ioapics[idx].apicaddr = address;
 
        set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
-       mp_ioapics[idx].mp_apicid = uniq_ioapic_id(id);
+       mp_ioapics[idx].apicid = uniq_ioapic_id(id);
 #ifdef CONFIG_X86_32
-       mp_ioapics[idx].mp_apicver = io_apic_get_version(idx);
+       mp_ioapics[idx].apicver = io_apic_get_version(idx);
 #else
-       mp_ioapics[idx].mp_apicver = 0;
+       mp_ioapics[idx].apicver = 0;
 #endif
        /*
         * Build basic GSI lookup table to facilitate gsi->io_apic lookups
         * and to prevent reprogramming of IOAPIC pins (PCI GSIs).
         */
-       mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mp_apicid;
+       mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].apicid;
        mp_ioapic_routing[idx].gsi_base = gsi_base;
        mp_ioapic_routing[idx].gsi_end = gsi_base +
            io_apic_get_redir_entries(idx);
 
-       printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, "
-              "GSI %d-%d\n", idx, mp_ioapics[idx].mp_apicid,
-              mp_ioapics[idx].mp_apicver, mp_ioapics[idx].mp_apicaddr,
+       printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
+              "GSI %d-%d\n", idx, mp_ioapics[idx].apicid,
+              mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr,
               mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end);
 
        nr_ioapics++;
 }
 
+int __init acpi_probe_gsi(void)
+{
+       int idx;
+       int gsi;
+       int max_gsi = 0;
+
+       if (acpi_disabled)
+               return 0;
+
+       if (!acpi_ioapic)
+               return 0;
+
+       max_gsi = 0;
+       for (idx = 0; idx < nr_ioapics; idx++) {
+               gsi = mp_ioapic_routing[idx].gsi_end;
+
+               if (gsi > max_gsi)
+                       max_gsi = gsi;
+       }
+
+       return max_gsi + 1;
+}
+
+static void assign_to_mp_irq(struct mpc_intsrc *m,
+                                   struct mpc_intsrc *mp_irq)
+{
+       memcpy(mp_irq, m, sizeof(struct mpc_intsrc));
+}
+
+static int mp_irq_cmp(struct mpc_intsrc *mp_irq,
+                               struct mpc_intsrc *m)
+{
+       return memcmp(mp_irq, m, sizeof(struct mpc_intsrc));
+}
+
+static void save_mp_irq(struct mpc_intsrc *m)
+{
+       int i;
+
+       for (i = 0; i < mp_irq_entries; i++) {
+               if (!mp_irq_cmp(&mp_irqs[i], m))
+                       return;
+       }
+
+       assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
+       if (++mp_irq_entries == MAX_IRQ_SOURCES)
+               panic("Max # of irq sources exceeded!!\n");
+}
+
 void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
 {
-       int ioapic = -1;
-       int pin = -1;
+       int ioapic;
+       int pin;
+       struct mpc_intsrc mp_irq;
 
        /*
         * Convert 'gsi' to 'ioapic.pin'.
@@ -971,7 +1014,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
        ioapic = mp_find_ioapic(gsi);
        if (ioapic < 0)
                return;
-       pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
+       pin = mp_find_ioapic_pin(ioapic, gsi);
 
        /*
         * TBD: This check is for faulty timer entries, where the override
@@ -981,24 +1024,23 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
        if ((bus_irq == 0) && (trigger == 3))
                trigger = 1;
 
-       mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
-       mp_irqs[mp_irq_entries].mp_irqtype = mp_INT;
-       mp_irqs[mp_irq_entries].mp_irqflag = (trigger << 2) | polarity;
-       mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
-       mp_irqs[mp_irq_entries].mp_srcbusirq = bus_irq; /* IRQ */
-       mp_irqs[mp_irq_entries].mp_dstapic =
-                       mp_ioapics[ioapic].mp_apicid;   /* APIC ID */
-       mp_irqs[mp_irq_entries].mp_dstirq = pin;        /* INTIN# */
-
-       if (++mp_irq_entries == MAX_IRQ_SOURCES)
-               panic("Max # of irq sources exceeded!!\n");
+       mp_irq.type = MP_INTSRC;
+       mp_irq.irqtype = mp_INT;
+       mp_irq.irqflag = (trigger << 2) | polarity;
+       mp_irq.srcbus = MP_ISA_BUS;
+       mp_irq.srcbusirq = bus_irq;     /* IRQ */
+       mp_irq.dstapic = mp_ioapics[ioapic].apicid; /* APIC ID */
+       mp_irq.dstirq = pin;    /* INTIN# */
 
+       save_mp_irq(&mp_irq);
 }
 
 void __init mp_config_acpi_legacy_irqs(void)
 {
-       int i = 0;
-       int ioapic = -1;
+       int i;
+       int ioapic;
+       unsigned int dstapic;
+       struct mpc_intsrc mp_irq;
 
 #if defined (CONFIG_MCA) || defined (CONFIG_EISA)
        /*
@@ -1007,7 +1049,7 @@ void __init mp_config_acpi_legacy_irqs(void)
        mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
 #endif
        set_bit(MP_ISA_BUS, mp_bus_not_pci);
-       Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
+       pr_debug("Bus #%d is ISA\n", MP_ISA_BUS);
 
 #ifdef CONFIG_X86_ES7000
        /*
@@ -1023,6 +1065,7 @@ void __init mp_config_acpi_legacy_irqs(void)
        ioapic = mp_find_ioapic(0);
        if (ioapic < 0)
                return;
+       dstapic = mp_ioapics[ioapic].apicid;
 
        /*
         * Use the default configuration for the IRQs 0-15.  Unless
@@ -1031,23 +1074,15 @@ void __init mp_config_acpi_legacy_irqs(void)
        for (i = 0; i < 16; i++) {
                int idx;
 
-               mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
-               mp_irqs[mp_irq_entries].mp_irqflag = 0; /* Conforming */
-               mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
-               mp_irqs[mp_irq_entries].mp_dstapic = mp_ioapics[ioapic].mp_apicid;
-
                for (idx = 0; idx < mp_irq_entries; idx++) {
-                       struct mp_config_intsrc *irq = mp_irqs + idx;
+                       struct mpc_intsrc *irq = mp_irqs + idx;
 
                        /* Do we already have a mapping for this ISA IRQ? */
-                       if (irq->mp_srcbus == MP_ISA_BUS
-                           && irq->mp_srcbusirq == i)
+                       if (irq->srcbus == MP_ISA_BUS && irq->srcbusirq == i)
                                break;
 
                        /* Do we already have a mapping for this IOAPIC pin */
-                       if ((irq->mp_dstapic ==
-                               mp_irqs[mp_irq_entries].mp_dstapic) &&
-                           (irq->mp_dstirq == i))
+                       if (irq->dstapic == dstapic && irq->dstirq == i)
                                break;
                }
 
@@ -1056,12 +1091,15 @@ void __init mp_config_acpi_legacy_irqs(void)
                        continue;       /* IRQ already used */
                }
 
-               mp_irqs[mp_irq_entries].mp_irqtype = mp_INT;
-               mp_irqs[mp_irq_entries].mp_srcbusirq = i;       /* Identity mapped */
-               mp_irqs[mp_irq_entries].mp_dstirq = i;
+               mp_irq.type = MP_INTSRC;
+               mp_irq.irqflag = 0;     /* Conforming */
+               mp_irq.srcbus = MP_ISA_BUS;
+               mp_irq.dstapic = dstapic;
+               mp_irq.irqtype = mp_INT;
+               mp_irq.srcbusirq = i; /* Identity mapped */
+               mp_irq.dstirq = i;
 
-               if (++mp_irq_entries == MAX_IRQ_SOURCES)
-                       panic("Max # of irq sources exceeded!!\n");
+               save_mp_irq(&mp_irq);
        }
 }
 
@@ -1096,7 +1134,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
                return gsi;
        }
 
-       ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
+       ioapic_pin = mp_find_ioapic_pin(ioapic, gsi);
 
 #ifdef CONFIG_X86_32
        if (ioapic_renumber_irq)
@@ -1115,8 +1153,8 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
                return gsi;
        }
        if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {
-               Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n",
-                       mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
+               pr_debug("Pin %d-%d already programmed\n",
+                        mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
 #ifdef CONFIG_X86_32
                return (gsi < IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]);
 #else
@@ -1169,22 +1207,26 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
 int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
                        u32 gsi, int triggering, int polarity)
 {
-       struct mpc_config_intsrc intsrc;
+#ifdef CONFIG_X86_MPPARSE
+       struct mpc_intsrc mp_irq;
        int ioapic;
 
+       if (!acpi_ioapic)
+               return 0;
+
        /* print the entry should happen on mptable identically */
-       intsrc.mpc_type = MP_INTSRC;
-       intsrc.mpc_irqtype = mp_INT;
-       intsrc.mpc_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
+       mp_irq.type = MP_INTSRC;
+       mp_irq.irqtype = mp_INT;
+       mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
                                (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
-       intsrc.mpc_srcbus = number;
-       intsrc.mpc_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
+       mp_irq.srcbus = number;
+       mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
        ioapic = mp_find_ioapic(gsi);
-       intsrc.mpc_dstapic = mp_ioapic_routing[ioapic].apic_id;
-       intsrc.mpc_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base;
-
-       MP_intsrc_info(&intsrc);
+       mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id;
+       mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
 
+       save_mp_irq(&mp_irq);
+#endif
        return 0;
 }
 
@@ -1231,7 +1273,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
 
        count =
            acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
-                                 NR_IRQ_VECTORS);
+                                 nr_irqs);
        if (count < 0) {
                printk(KERN_ERR PREFIX
                       "Error parsing interrupt source overrides entry\n");
@@ -1251,7 +1293,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
 
        count =
            acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src,
-                                 NR_IRQ_VECTORS);
+                                 nr_irqs);
        if (count < 0) {
                printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
                /* TBD: Cleanup to allow fallback to MPS */
@@ -1308,7 +1350,7 @@ static void __init acpi_process_madt(void)
                if (!error) {
                        acpi_lapic = 1;
 
-#ifdef CONFIG_X86_GENERICARCH
+#ifdef CONFIG_X86_BIGSMP
                        generic_bigsmp_probe();
 #endif
                        /*
@@ -1317,11 +1359,11 @@ static void __init acpi_process_madt(void)
                        error = acpi_parse_madt_ioapic_entries();
                        if (!error) {
                                acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
-                               acpi_irq_balance_set(NULL);
                                acpi_ioapic = 1;
 
                                smp_found_config = 1;
-                               setup_apic_routing();
+                               if (apic->setup_apic_routing)
+                                       apic->setup_apic_routing();
                        }
                }
                if (error == -EINVAL) {
@@ -1332,13 +1374,33 @@ static void __init acpi_process_madt(void)
                               "Invalid BIOS MADT, disabling ACPI\n");
                        disable_acpi();
                }
+       } else {
+               /*
+                * ACPI found no MADT, and so ACPI wants UP PIC mode.
+                * In the event an MPS table was found, forget it.
+                * Boot with "acpi=off" to use MPS on such a system.
+                */
+               if (smp_found_config) {
+                       printk(KERN_WARNING PREFIX
+                               "No APIC-table, disabling MPS\n");
+                       smp_found_config = 0;
+               }
        }
+
+       /*
+        * ACPI supports both logical (e.g. Hyper-Threading) and physical
+        * processors, where MPS only supports physical.
+        */
+       if (acpi_lapic && acpi_ioapic)
+               printk(KERN_INFO "Using ACPI (MADT) for SMP configuration "
+                      "information\n");
+       else if (acpi_lapic)
+               printk(KERN_INFO "Using ACPI for processor (LAPIC) "
+                      "configuration information\n");
 #endif
        return;
 }
 
-#ifdef __i386__
-
 static int __init disable_acpi_irq(const struct dmi_system_id *d)
 {
        if (!acpi_force) {
@@ -1389,6 +1451,24 @@ static int __init force_acpi_ht(const struct dmi_system_id *d)
 }
 
 /*
+ * Force ignoring BIOS IRQ0 pin2 override
+ */
+static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
+{
+       /*
+        * The ati_ixp4x0_rev() early PCI quirk should have set
+        * the acpi_skip_timer_override flag already:
+        */
+       if (!acpi_skip_timer_override) {
+               WARN(1, KERN_ERR "ati_ixp4x0 quirk not complete.\n");
+               pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n",
+                       d->ident);
+               acpi_skip_timer_override = 1;
+       }
+       return 0;
+}
+
+/*
  * If your system is blacklisted here, but you find that acpi=force
  * works for you, please contact acpi-devel@sourceforge.net
  */
@@ -1558,7 +1638,52 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
        {}
 };
 
-#endif                         /* __i386__ */
+/* second table for DMI checks that should run after early-quirks */
+static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
+       /*
+        * HP laptops which use a DSDT reporting as HP/SB400/10000,
+        * which includes some code which overrides all temperature
+        * trip points to 16C if the INTIN2 input of the I/O APIC
+        * is enabled.  This input is incorrectly designated the
+        * ISA IRQ 0 via an interrupt source override even though
+        * it is wired to the output of the master 8259A and INTIN0
+        * is not connected at all.  Force ignoring BIOS IRQ0 pin2
+        * override in that cases.
+        */
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP nx6115 laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6115"),
+                    },
+        },
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP NX6125 laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6125"),
+                    },
+        },
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP NX6325 laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
+                    },
+        },
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP 6715b laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+                    },
+        },
+       {}
+};
 
 /*
  * acpi_boot_table_init() and acpi_boot_init()
@@ -1587,9 +1712,7 @@ int __init acpi_boot_table_init(void)
 {
        int error;
 
-#ifdef __i386__
        dmi_check_system(acpi_dmi_table);
-#endif
 
        /*
         * If acpi_disabled, bail out
@@ -1645,6 +1768,9 @@ int __init early_acpi_boot_init(void)
 
 int __init acpi_boot_init(void)
 {
+       /* those are executed after early-quirks are executed */
+       dmi_check_system(acpi_dmi_table_late);
+
        /*
         * If acpi_disabled, bail out
         * One exception: acpi=ht continues far enough to enumerate LAPICs
@@ -1694,6 +1820,10 @@ static int __init parse_acpi(char *arg)
                        disable_acpi();
                acpi_ht = 1;
        }
+       /* acpi=rsdt use RSDT instead of XSDT */
+       else if (strcmp(arg, "rsdt") == 0) {
+               acpi_rsdt_forced = 1;
+       }
        /* "acpi=noirq" disables ACPI interrupt routing */
        else if (strcmp(arg, "noirq") == 0) {
                acpi_noirq_set();
@@ -1714,6 +1844,20 @@ static int __init parse_pci(char *arg)
 }
 early_param("pci", parse_pci);
 
+int __init acpi_mps_check(void)
+{
+#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
+/* mptable code is not built-in*/
+       if (acpi_disabled || acpi_noirq) {
+               printk(KERN_WARNING "MPS support code is not built-in.\n"
+                      "Using acpi=off or acpi=noirq or pci=noacpi "
+                      "may have problem\n");
+               return 1;
+       }
+#endif
+       return 0;
+}
+
 #ifdef CONFIG_X86_IO_APIC
 static int __init parse_acpi_skip_timer_override(char *arg)
 {