include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / acpi / processor_driver.c
index 7b0f4c2..5675d97 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/dmi.h>
 #include <linux/moduleparam.h>
 #include <linux/cpuidle.h>
+#include <linux/slab.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -359,162 +360,6 @@ static inline int acpi_processor_remove_fs(struct acpi_device *device)
 }
 #endif
 
-/* Use the acpiid in MADT to map cpus in case of SMP */
-
-#ifndef CONFIG_SMP
-static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) { return -1; }
-#else
-
-static struct acpi_table_madt *madt;
-
-static int map_lapic_id(struct acpi_subtable_header *entry,
-                u32 acpi_id, int *apic_id)
-{
-       struct acpi_madt_local_apic *lapic =
-               (struct acpi_madt_local_apic *)entry;
-       if ((lapic->lapic_flags & ACPI_MADT_ENABLED) &&
-           lapic->processor_id == acpi_id) {
-               *apic_id = lapic->id;
-               return 1;
-       }
-       return 0;
-}
-
-static int map_x2apic_id(struct acpi_subtable_header *entry,
-                        int device_declaration, u32 acpi_id, int *apic_id)
-{
-       struct acpi_madt_local_x2apic *apic =
-               (struct acpi_madt_local_x2apic *)entry;
-       u32 tmp = apic->local_apic_id;
-
-       /* Only check enabled APICs*/
-       if (!(apic->lapic_flags & ACPI_MADT_ENABLED))
-               return 0;
-
-       /* Device statement declaration type */
-       if (device_declaration) {
-               if (apic->uid == acpi_id)
-                       goto found;
-       }
-
-       return 0;
-found:
-       *apic_id = tmp;
-       return 1;
-}
-
-static int map_lsapic_id(struct acpi_subtable_header *entry,
-               int device_declaration, u32 acpi_id, int *apic_id)
-{
-       struct acpi_madt_local_sapic *lsapic =
-               (struct acpi_madt_local_sapic *)entry;
-       u32 tmp = (lsapic->id << 8) | lsapic->eid;
-
-       /* Only check enabled APICs*/
-       if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))
-               return 0;
-
-       /* Device statement declaration type */
-       if (device_declaration) {
-               if (entry->length < 16)
-                       printk(KERN_ERR PREFIX
-                           "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n",
-                           tmp);
-               else if (lsapic->uid == acpi_id)
-                       goto found;
-       /* Processor statement declaration type */
-       } else if (lsapic->processor_id == acpi_id)
-               goto found;
-
-       return 0;
-found:
-       *apic_id = tmp;
-       return 1;
-}
-
-static int map_madt_entry(int type, u32 acpi_id)
-{
-       unsigned long madt_end, entry;
-       int apic_id = -1;
-
-       if (!madt)
-               return apic_id;
-
-       entry = (unsigned long)madt;
-       madt_end = entry + madt->header.length;
-
-       /* Parse all entries looking for a match. */
-
-       entry += sizeof(struct acpi_table_madt);
-       while (entry + sizeof(struct acpi_subtable_header) < madt_end) {
-               struct acpi_subtable_header *header =
-                       (struct acpi_subtable_header *)entry;
-               if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
-                       if (map_lapic_id(header, acpi_id, &apic_id))
-                               break;
-               } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) {
-                       if (map_x2apic_id(header, type, acpi_id, &apic_id))
-                               break;
-               } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
-                       if (map_lsapic_id(header, type, acpi_id, &apic_id))
-                               break;
-               }
-               entry += header->length;
-       }
-       return apic_id;
-}
-
-static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
-{
-       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-       union acpi_object *obj;
-       struct acpi_subtable_header *header;
-       int apic_id = -1;
-
-       if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
-               goto exit;
-
-       if (!buffer.length || !buffer.pointer)
-               goto exit;
-
-       obj = buffer.pointer;
-       if (obj->type != ACPI_TYPE_BUFFER ||
-           obj->buffer.length < sizeof(struct acpi_subtable_header)) {
-               goto exit;
-       }
-
-       header = (struct acpi_subtable_header *)obj->buffer.pointer;
-       if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
-               map_lapic_id(header, acpi_id, &apic_id);
-       } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
-               map_lsapic_id(header, type, acpi_id, &apic_id);
-       }
-
-exit:
-       if (buffer.pointer)
-               kfree(buffer.pointer);
-       return apic_id;
-}
-
-static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id)
-{
-       int i;
-       int apic_id = -1;
-
-       apic_id = map_mat_entry(handle, type, acpi_id);
-       if (apic_id == -1)
-               apic_id = map_madt_entry(type, acpi_id);
-       if (apic_id == -1)
-               return apic_id;
-
-       for_each_possible_cpu(i) {
-               if (cpu_physical_id(i) == apic_id)
-                       return i;
-       }
-       return -1;
-}
-#endif
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
@@ -579,7 +424,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
                device_declaration = 1;
                pr->acpi_id = value;
        }
-       cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id);
+       cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id);
 
        /* Handle UP system running SMP kernel, with no LAPIC in MADT */
        if (!cpu0_initialized && (cpu_index == -1) &&
@@ -764,9 +609,6 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
                goto err_remove_fs;
        }
 
-       /* _PDC call should be done before doing anything else (if reqd.). */
-       acpi_processor_set_pdc(pr->handle);
-
 #ifdef CONFIG_CPU_FREQ
        acpi_processor_ppc_has_changed(pr, 0);
 #endif
@@ -1073,11 +915,6 @@ static int __init acpi_processor_init(void)
 
        memset(&errata, 0, sizeof(errata));
 
-#ifdef CONFIG_SMP
-       if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
-                               (struct acpi_table_header **)&madt)))
-               madt = NULL;
-#endif
 #ifdef CONFIG_ACPI_PROCFS
        acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
        if (!acpi_processor_dir)