aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2009-12-20 14:19:19 -0500
committerLen Brown <len.brown@intel.com>2009-12-22 03:24:11 -0500
commit407cd87c54e76c266245e8faef8dd4a84b7254fe (patch)
treee07067c0d51317a4dc93144f1d16c050a0f5ca89 /drivers/acpi
parent1d9cb470a755409ce97c3376174b1e234bd20371 (diff)
ACPI: processor: unify arch_acpi_processor_init_pdc
The x86 and ia64 implementations of arch_acpi_processor_init_pdc() are almost exactly the same. The only difference is in what bits they set in obj_list buffer. Combine the boilerplate memory management code, and leave the arch-specific bit twiddling in separate implementations. Cc: Tony Luck <tony.luck@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_pdc.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c
index 931e735e9e37..87946b6da765 100644
--- a/drivers/acpi/processor_pdc.c
+++ b/drivers/acpi/processor_pdc.c
@@ -33,6 +33,49 @@ static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
33 {}, 33 {},
34}; 34};
35 35
36static void acpi_processor_init_pdc(struct acpi_processor *pr)
37{
38 struct acpi_object_list *obj_list;
39 union acpi_object *obj;
40 u32 *buf;
41
42 pr->pdc = NULL;
43
44 /* allocate and initialize pdc. It will be used later. */
45 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
46 if (!obj_list) {
47 printk(KERN_ERR "Memory allocation error\n");
48 return;
49 }
50
51 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
52 if (!obj) {
53 printk(KERN_ERR "Memory allocation error\n");
54 kfree(obj_list);
55 return;
56 }
57
58 buf = kmalloc(12, GFP_KERNEL);
59 if (!buf) {
60 printk(KERN_ERR "Memory allocation error\n");
61 kfree(obj);
62 kfree(obj_list);
63 return;
64 }
65
66 obj->type = ACPI_TYPE_BUFFER;
67 obj->buffer.length = 12;
68 obj->buffer.pointer = (u8 *) buf;
69 obj_list->count = 1;
70 obj_list->pointer = obj;
71 pr->pdc = obj_list;
72
73 /* Now let the arch do the bit-twiddling to buf[] */
74 arch_acpi_processor_init_pdc(pr);
75
76 return;
77}
78
36/* 79/*
37 * _PDC is required for a BIOS-OS handshake for most of the newer 80 * _PDC is required for a BIOS-OS handshake for most of the newer
38 * ACPI processor features. 81 * ACPI processor features.
@@ -72,7 +115,7 @@ void acpi_processor_set_pdc(struct acpi_processor *pr)
72 if (arch_has_acpi_pdc() == false) 115 if (arch_has_acpi_pdc() == false)
73 return; 116 return;
74 117
75 arch_acpi_processor_init_pdc(pr); 118 acpi_processor_init_pdc(pr);
76 acpi_processor_eval_pdc(pr); 119 acpi_processor_eval_pdc(pr);
77 arch_acpi_processor_cleanup_pdc(pr); 120 arch_acpi_processor_cleanup_pdc(pr);
78} 121}