ia64/linux-2.6.18-xen.hg

view arch/i386/kernel/acpi/processor.c @ 800:ae2cf9ef03ac

ACPI: Backport to support ACPI throttling s/w coordination

commit 3abbd337c60591305cbfeb984ff2922c175be37f
Author: Zhao Yakui <yakui.zhao@intel.com>
Date: Mon Jan 28 13:53:21 2008 +0800

ACPI: Set _PSD ACPI_PDC_SMP_T_SWCOORD

The ACPI_PDC_SMP_T_SWCOORD bit is set by and OS that is capable of
native ACPI throttling software coordination for mutli-processors
using the _TSD information.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 02 10:54:44 2009 +0000 (2009-03-02)
parents b02a90bf5bbc
children
line source
1 /*
2 * arch/i386/kernel/acpi/processor.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for platforms with Intel CPUs
7 */
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/acpi.h>
14 #include <acpi/processor.h>
15 #include <asm/acpi.h>
17 static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
18 {
19 struct acpi_object_list *obj_list;
20 union acpi_object *obj;
21 u32 *buf;
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 }
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 }
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 }
45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1;
47 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
49 /*
50 * The default of PDC_SMP_T_SWCOORD bit is set for intel x86 cpu so
51 * that OSPM is capable of native ACPI throttling software
52 * coordination using BIOS supplied _TSD info.
53 */
54 buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
55 if (cpu_has(c, X86_FEATURE_EST))
56 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
58 if (cpu_has(c, X86_FEATURE_ACPI))
59 buf[2] |= ACPI_PDC_T_FFH;
61 obj->type = ACPI_TYPE_BUFFER;
62 obj->buffer.length = 12;
63 obj->buffer.pointer = (u8 *) buf;
64 obj_list->count = 1;
65 obj_list->pointer = obj;
66 pr->pdc = obj_list;
68 return;
69 }
71 /* Initialize _PDC data based on the CPU vendor */
72 void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
73 {
74 #ifdef CONFIG_XEN
75 /*
76 * As a work-around, just use cpu0's cpuinfo for all processors.
77 * Further work is required to expose xen hypervisor interface of
78 * getting physical cpuinfo to dom0 kernel and then
79 * arch_acpi_processor_init_pdc can set _PDC parameters according
80 * to Xen's phys information.
81 */
82 unsigned int cpu = 0;
83 #else
84 unsigned int cpu = pr->id;
85 #endif /* CONFIG_XEN */
86 struct cpuinfo_x86 *c = cpu_data + cpu;
88 pr->pdc = NULL;
89 if (c->x86_vendor == X86_VENDOR_INTEL)
90 init_intel_pdc(pr, c);
92 return;
93 }
95 EXPORT_SYMBOL(arch_acpi_processor_init_pdc);