ACPI: delete extra #defines in /drivers/acpi/ drivers
[safe/jmp/linux-2.6] / drivers / acpi / processor_core.c
index 6893c0b..911fc8c 100644 (file)
@@ -60,7 +60,6 @@
 
 #define ACPI_PROCESSOR_COMPONENT       0x01000000
 #define ACPI_PROCESSOR_CLASS           "processor"
-#define ACPI_PROCESSOR_DRIVER_NAME     "ACPI Processor Driver"
 #define ACPI_PROCESSOR_DEVICE_NAME     "Processor"
 #define ACPI_PROCESSOR_FILE_INFO       "info"
 #define ACPI_PROCESSOR_FILE_THROTTLING "throttling"
 #define ACPI_STA_PRESENT 0x00000001
 
 #define _COMPONENT             ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME("acpi_processor")
+ACPI_MODULE_NAME("processor_core");
 
-    MODULE_AUTHOR("Paul Diefenbaugh");
-MODULE_DESCRIPTION(ACPI_PROCESSOR_DRIVER_NAME);
+MODULE_AUTHOR("Paul Diefenbaugh");
+MODULE_DESCRIPTION("ACPI Processor Driver");
 MODULE_LICENSE("GPL");
 
 static int acpi_processor_add(struct acpi_device *device);
@@ -89,7 +88,7 @@ static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
 static int acpi_processor_handle_eject(struct acpi_processor *pr);
 
 static struct acpi_driver acpi_processor_driver = {
-       .name = ACPI_PROCESSOR_DRIVER_NAME,
+       .name = "processor",
        .class = ACPI_PROCESSOR_CLASS,
        .ids = ACPI_PROCESSOR_HID,
        .ops = {
@@ -377,7 +376,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
 /* Use the acpiid in MADT to map cpus in case of SMP */
 
 #ifndef CONFIG_SMP
-#define convert_acpiid_to_cpu(acpi_id) (-1)
+static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;}
 #else
 
 static struct acpi_table_madt *madt;
@@ -483,7 +482,7 @@ exit:
        return apic_id;
 }
 
-static int get_apic_id(acpi_handle handle, u32 acpi_id)
+static int get_cpu_id(acpi_handle handle, u32 acpi_id)
 {
        int i;
        int apic_id = -1;
@@ -506,7 +505,7 @@ static int get_apic_id(acpi_handle handle, u32 acpi_id)
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static int acpi_processor_get_info(struct acpi_processor *pr)
+static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
 {
        acpi_status status = 0;
        union acpi_object object = { 0 };
@@ -535,24 +534,35 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                  "No bus mastering arbitration control\n"));
 
-       /*
-        * Evalute the processor object.  Note that it is common on SMP to
-        * have the first (boot) processor with a valid PBLK address while
-        * all others have a NULL address.
-        */
-       status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
-       if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Evaluating processor object\n");
-               return -ENODEV;
-       }
-
-       /*
-        * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
-        *      >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c
-        */
-       pr->acpi_id = object.processor.proc_id;
+       /* Check if it is a Device with HID and UID */
+       if (has_uid) {
+               unsigned long value;
+               status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
+                                               NULL, &value);
+               if (ACPI_FAILURE(status)) {
+                       printk(KERN_ERR PREFIX "Evaluating processor _UID\n");
+                       return -ENODEV;
+               }
+               pr->acpi_id = value;
+       } else {
+               /*
+               * Evalute the processor object.  Note that it is common on SMP to
+               * have the first (boot) processor with a valid PBLK address while
+               * all others have a NULL address.
+               */
+               status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
+               if (ACPI_FAILURE(status)) {
+                       printk(KERN_ERR PREFIX "Evaluating processor object\n");
+                       return -ENODEV;
+               }
 
-       cpu_index = get_apic_id(pr->handle, pr->acpi_id);
+               /*
+               * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
+               *      >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c
+               */
+               pr->acpi_id = object.processor.proc_id;
+       }
+       cpu_index = get_cpu_id(pr->handle, pr->acpi_id);
 
        /* Handle UP system running SMP kernel, with no LAPIC in MADT */
        if (!cpu0_initialized && (cpu_index == -1) &&
@@ -621,7 +631,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 
        pr = acpi_driver_data(device);
 
-       result = acpi_processor_get_info(pr);
+       result = acpi_processor_get_info(pr, device->flags.unique_id);
        if (result) {
                /* Processor is physically not present */
                return 0;
@@ -803,7 +813,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
                return -ENODEV;
 
        if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
-               kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
+               kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE);
        }
        return 0;
 }
@@ -841,13 +851,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
                }
 
                if (pr->id >= 0 && (pr->id < NR_CPUS)) {
-                       kobject_uevent(&device->kobj, KOBJ_OFFLINE);
+                       kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
                        break;
                }
 
                result = acpi_processor_start(device);
                if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) {
-                       kobject_uevent(&device->kobj, KOBJ_ONLINE);
+                       kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
                } else {
                        printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
                                    acpi_device_bid(device));
@@ -870,7 +880,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
                }
 
                if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
-                       kobject_uevent(&device->kobj, KOBJ_OFFLINE);
+                       kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,