Venkatesh Pallipadi | 05131ec | 2005-10-23 16:31:00 -0400 | [diff] [blame] | 1 | /* |
Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 2 | * arch/ia64/kernel/acpi-processor.c |
Venkatesh Pallipadi | 05131ec | 2005-10-23 16:31:00 -0400 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 Intel Corporation |
| 5 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> |
| 6 | * - Added _PDC for platforms with Intel CPUs |
| 7 | */ |
| 8 | |
| 9 | #include <linux/kernel.h> |
| 10 | #include <linux/module.h> |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/acpi.h> |
| 13 | |
| 14 | #include <acpi/processor.h> |
| 15 | #include <asm/acpi.h> |
| 16 | |
| 17 | static void init_intel_pdc(struct acpi_processor *pr) |
| 18 | { |
| 19 | struct acpi_object_list *obj_list; |
| 20 | union acpi_object *obj; |
| 21 | u32 *buf; |
| 22 | |
| 23 | /* allocate and initialize pdc. It will be used later. */ |
| 24 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); |
| 25 | if (!obj_list) { |
| 26 | printk(KERN_ERR "Memory allocation error\n"); |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); |
| 31 | if (!obj) { |
| 32 | printk(KERN_ERR "Memory allocation error\n"); |
| 33 | kfree(obj_list); |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | buf = kmalloc(12, GFP_KERNEL); |
| 38 | if (!buf) { |
| 39 | printk(KERN_ERR "Memory allocation error\n"); |
| 40 | kfree(obj); |
| 41 | kfree(obj_list); |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | buf[0] = ACPI_PDC_REVISION_ID; |
| 46 | buf[1] = 1; |
Venki Pallipadi | ce45b51 | 2007-05-22 15:35:24 -0700 | [diff] [blame] | 47 | buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; |
Zhao Yakui | 3abbd33 | 2008-01-28 13:53:21 +0800 | [diff] [blame] | 48 | /* |
| 49 | * The default of PDC_SMP_T_SWCOORD bit is set for IA64 cpu so |
| 50 | * that OSPM is capable of native ACPI throttling software |
| 51 | * coordination using BIOS supplied _TSD info. |
| 52 | */ |
| 53 | buf[2] |= ACPI_PDC_SMP_T_SWCOORD; |
Venkatesh Pallipadi | 05131ec | 2005-10-23 16:31:00 -0400 | [diff] [blame] | 54 | |
| 55 | obj->type = ACPI_TYPE_BUFFER; |
| 56 | obj->buffer.length = 12; |
| 57 | obj->buffer.pointer = (u8 *) buf; |
| 58 | obj_list->count = 1; |
| 59 | obj_list->pointer = obj; |
| 60 | pr->pdc = obj_list; |
| 61 | |
| 62 | return; |
| 63 | } |
| 64 | |
| 65 | /* Initialize _PDC data based on the CPU vendor */ |
| 66 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) |
| 67 | { |
| 68 | pr->pdc = NULL; |
| 69 | init_intel_pdc(pr); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); |