x86: use cpumask_var_t in acpi/boot.c
[safe/jmp/linux-2.6] / arch / x86 / kernel / acpi / boot.c
index 12e260e..29dc0c8 100644 (file)
@@ -58,7 +58,6 @@ EXPORT_SYMBOL(acpi_disabled);
 #ifdef CONFIG_X86_64
 
 #include <asm/proto.h>
-#include <asm/genapic.h>
 
 #else                          /* X86 */
 
@@ -154,10 +153,21 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
 }
 
 #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;
@@ -190,8 +200,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);
@@ -239,10 +253,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);
 }
@@ -526,9 +538,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;
@@ -557,23 +570,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 */
@@ -586,7 +613,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);
@@ -762,10 +789,8 @@ 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  = read_apic_id();
-#ifdef CONFIG_X86_32
                apic_version[boot_cpu_physical_apicid] =
                         GET_APIC_VERSION(apic_read(APIC_LVR));
-#endif
        }
 }
 
@@ -1127,7 +1152,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
                return gsi;
        }
        if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {
-               pr_debug(KERN_DEBUG "Pin %d-%d already programmed\n",
+               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]);
@@ -1247,7 +1272,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");
@@ -1267,7 +1292,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 */
@@ -1333,7 +1358,6 @@ 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;
@@ -1351,6 +1375,17 @@ static void __init acpi_process_madt(void)
                        disable_acpi();
                }
        }
+
+       /*
+        * 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;
 }
@@ -1409,8 +1444,16 @@ static int __init force_acpi_ht(const struct dmi_system_id *d)
  */
 static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
 {
-       pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n", d->ident);
-       acpi_skip_timer_override = 1;
+       /*
+        * 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;
 }
 
@@ -1581,6 +1624,11 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
                     DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
                     },
         },
+       {}
+};
+
+/* 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
@@ -1593,6 +1641,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
         */
        {
         .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"),
@@ -1607,6 +1663,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
                     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"),
+                    },
+        },
        {}
 };
 
@@ -1693,6 +1757,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