aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-12-24 01:17:21 -0500
committerLen Brown <len.brown@intel.com>2009-12-24 01:17:21 -0500
commitda3df858c88f7bb420f2517ee9aab238da2e6ed7 (patch)
tree49c9e69818d7a7fc59ebda96dc7abf17a0f3b088
parent309ddc53be1766d6ed5411a3dc1782c2040198fa (diff)
parente59897fe443b5b0a71e135ef4020d1937c9f8901 (diff)
Merge branch 'pdc' into release
-rw-r--r--arch/ia64/include/asm/acpi.h6
-rw-r--r--arch/ia64/kernel/Makefile4
-rw-r--r--arch/ia64/kernel/acpi-processor.c85
-rw-r--r--arch/x86/include/asm/acpi.h26
-rw-r--r--arch/x86/kernel/acpi/Makefile2
-rw-r--r--arch/x86/kernel/acpi/processor.c101
-rw-r--r--drivers/acpi/processor_core.c2
-rw-r--r--drivers/acpi/processor_pdc.c101
-rw-r--r--include/acpi/processor.h7
9 files changed, 114 insertions, 220 deletions
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 91df9686a0da..7ae58892ba8d 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -132,6 +132,12 @@ extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
132extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 132extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
133#endif 133#endif
134 134
135static inline bool arch_has_acpi_pdc(void) { return true; }
136static inline void arch_acpi_set_pdc_bits(u32 *buf)
137{
138 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
139}
140
135#define acpi_unlazy_tlb(x) 141#define acpi_unlazy_tlb(x)
136 142
137#ifdef CONFIG_ACPI_NUMA 143#ifdef CONFIG_ACPI_NUMA
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 2a75e937ae8d..e1236349c99f 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -18,10 +18,6 @@ obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o
18obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o 18obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o
19obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o 19obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
20 20
21ifneq ($(CONFIG_ACPI_PROCESSOR),)
22obj-y += acpi-processor.o
23endif
24
25obj-$(CONFIG_IA64_PALINFO) += palinfo.o 21obj-$(CONFIG_IA64_PALINFO) += palinfo.o
26obj-$(CONFIG_IOSAPIC) += iosapic.o 22obj-$(CONFIG_IOSAPIC) += iosapic.o
27obj-$(CONFIG_MODULES) += module.o 23obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c
deleted file mode 100644
index dbda7bde6112..000000000000
--- a/arch/ia64/kernel/acpi-processor.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * arch/ia64/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 */
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
17static 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;
47 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
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;
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 */
66void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
67{
68 pr->pdc = NULL;
69 init_intel_pdc(pr);
70 return;
71}
72
73EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
74
75void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
76{
77 if (pr->pdc) {
78 kfree(pr->pdc->pointer->buffer.pointer);
79 kfree(pr->pdc->pointer);
80 kfree(pr->pdc);
81 pr->pdc = NULL;
82 }
83}
84
85EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 60d2b2db0bc5..56f462cf22d2 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -142,6 +142,32 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
142 return max_cstate; 142 return max_cstate;
143} 143}
144 144
145static inline bool arch_has_acpi_pdc(void)
146{
147 struct cpuinfo_x86 *c = &cpu_data(0);
148 return (c->x86_vendor == X86_VENDOR_INTEL ||
149 c->x86_vendor == X86_VENDOR_CENTAUR);
150}
151
152static inline void arch_acpi_set_pdc_bits(u32 *buf)
153{
154 struct cpuinfo_x86 *c = &cpu_data(0);
155
156 buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
157
158 if (cpu_has(c, X86_FEATURE_EST))
159 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
160
161 if (cpu_has(c, X86_FEATURE_ACPI))
162 buf[2] |= ACPI_PDC_T_FFH;
163
164 /*
165 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
166 */
167 if (!cpu_has(c, X86_FEATURE_MWAIT))
168 buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
169}
170
145#else /* !CONFIG_ACPI */ 171#else /* !CONFIG_ACPI */
146 172
147#define acpi_lapic 0 173#define acpi_lapic 0
diff --git a/arch/x86/kernel/acpi/Makefile b/arch/x86/kernel/acpi/Makefile
index fd5ca97a2ad5..6f35260bb3ef 100644
--- a/arch/x86/kernel/acpi/Makefile
+++ b/arch/x86/kernel/acpi/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_ACPI) += boot.o
4obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o 4obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o
5 5
6ifneq ($(CONFIG_ACPI_PROCESSOR),) 6ifneq ($(CONFIG_ACPI_PROCESSOR),)
7obj-y += cstate.o processor.o 7obj-y += cstate.o
8endif 8endif
9 9
10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin 10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
deleted file mode 100644
index d85d1b2432ba..000000000000
--- a/arch/x86/kernel/acpi/processor.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Copyright (C) 2005 Intel Corporation
3 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
4 * - Added _PDC for platforms with Intel CPUs
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/init.h>
10#include <linux/acpi.h>
11
12#include <acpi/processor.h>
13#include <asm/acpi.h>
14
15static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
16{
17 struct acpi_object_list *obj_list;
18 union acpi_object *obj;
19 u32 *buf;
20
21 /* allocate and initialize pdc. It will be used later. */
22 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
23 if (!obj_list) {
24 printk(KERN_ERR "Memory allocation error\n");
25 return;
26 }
27
28 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
29 if (!obj) {
30 printk(KERN_ERR "Memory allocation error\n");
31 kfree(obj_list);
32 return;
33 }
34
35 buf = kmalloc(12, GFP_KERNEL);
36 if (!buf) {
37 printk(KERN_ERR "Memory allocation error\n");
38 kfree(obj);
39 kfree(obj_list);
40 return;
41 }
42
43 buf[0] = ACPI_PDC_REVISION_ID;
44 buf[1] = 1;
45 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
46
47 /*
48 * The default of PDC_SMP_T_SWCOORD bit is set for intel x86 cpu so
49 * that OSPM is capable of native ACPI throttling software
50 * coordination using BIOS supplied _TSD info.
51 */
52 buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
53 if (cpu_has(c, X86_FEATURE_EST))
54 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
55
56 if (cpu_has(c, X86_FEATURE_ACPI))
57 buf[2] |= ACPI_PDC_T_FFH;
58
59 /*
60 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
61 */
62 if (!cpu_has(c, X86_FEATURE_MWAIT))
63 buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
64
65 obj->type = ACPI_TYPE_BUFFER;
66 obj->buffer.length = 12;
67 obj->buffer.pointer = (u8 *) buf;
68 obj_list->count = 1;
69 obj_list->pointer = obj;
70 pr->pdc = obj_list;
71
72 return;
73}
74
75
76/* Initialize _PDC data based on the CPU vendor */
77void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
78{
79 struct cpuinfo_x86 *c = &cpu_data(pr->id);
80
81 pr->pdc = NULL;
82 if (c->x86_vendor == X86_VENDOR_INTEL ||
83 c->x86_vendor == X86_VENDOR_CENTAUR)
84 init_intel_pdc(pr, c);
85
86 return;
87}
88
89EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
90
91void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
92{
93 if (pr->pdc) {
94 kfree(pr->pdc->pointer->buffer.pointer);
95 kfree(pr->pdc->pointer);
96 kfree(pr->pdc);
97 pr->pdc = NULL;
98 }
99}
100
101EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index a19a4ff962ea..9863c98c81ba 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -763,7 +763,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
763 } 763 }
764 764
765 /* _PDC call should be done before doing anything else (if reqd.). */ 765 /* _PDC call should be done before doing anything else (if reqd.). */
766 acpi_processor_set_pdc(pr); 766 acpi_processor_set_pdc(pr->handle);
767 767
768#ifdef CONFIG_CPU_FREQ 768#ifdef CONFIG_CPU_FREQ
769 acpi_processor_ppc_has_changed(pr, 0); 769 acpi_processor_ppc_has_changed(pr, 0);
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c
index b416c32dda04..30e4dc0cdf30 100644
--- a/drivers/acpi/processor_pdc.c
+++ b/drivers/acpi/processor_pdc.c
@@ -1,3 +1,12 @@
1/*
2 * Copyright (C) 2005 Intel Corporation
3 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
4 *
5 * Alex Chiang <achiang@hp.com>
6 * - Unified x86/ia64 implementations
7 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
8 * - Added _PDC for platforms with Intel CPUs
9 */
1#include <linux/dmi.h> 10#include <linux/dmi.h>
2 11
3#include <acpi/acpi_drivers.h> 12#include <acpi/acpi_drivers.h>
@@ -33,17 +42,66 @@ static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
33 {}, 42 {},
34}; 43};
35 44
45static void acpi_set_pdc_bits(u32 *buf)
46{
47 buf[0] = ACPI_PDC_REVISION_ID;
48 buf[1] = 1;
49
50 /* Enable coordination with firmware's _TSD info */
51 buf[2] = ACPI_PDC_SMP_T_SWCOORD;
52
53 /* Twiddle arch-specific bits needed for _PDC */
54 arch_acpi_set_pdc_bits(buf);
55}
56
57static struct acpi_object_list *acpi_processor_alloc_pdc(void)
58{
59 struct acpi_object_list *obj_list;
60 union acpi_object *obj;
61 u32 *buf;
62
63 /* allocate and initialize pdc. It will be used later. */
64 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
65 if (!obj_list) {
66 printk(KERN_ERR "Memory allocation error\n");
67 return NULL;
68 }
69
70 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
71 if (!obj) {
72 printk(KERN_ERR "Memory allocation error\n");
73 kfree(obj_list);
74 return NULL;
75 }
76
77 buf = kmalloc(12, GFP_KERNEL);
78 if (!buf) {
79 printk(KERN_ERR "Memory allocation error\n");
80 kfree(obj);
81 kfree(obj_list);
82 return NULL;
83 }
84
85 acpi_set_pdc_bits(buf);
86
87 obj->type = ACPI_TYPE_BUFFER;
88 obj->buffer.length = 12;
89 obj->buffer.pointer = (u8 *) buf;
90 obj_list->count = 1;
91 obj_list->pointer = obj;
92
93 return obj_list;
94}
95
36/* 96/*
37 * _PDC is required for a BIOS-OS handshake for most of the newer 97 * _PDC is required for a BIOS-OS handshake for most of the newer
38 * ACPI processor features. 98 * ACPI processor features.
39 */ 99 */
40static int acpi_processor_eval_pdc(struct acpi_processor *pr) 100static int
101acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
41{ 102{
42 struct acpi_object_list *pdc_in = pr->pdc;
43 acpi_status status = AE_OK; 103 acpi_status status = AE_OK;
44 104
45 if (!pdc_in)
46 return status;
47 if (idle_nomwait) { 105 if (idle_nomwait) {
48 /* 106 /*
49 * If mwait is disabled for CPU C-states, the C2C3_FFH access 107 * If mwait is disabled for CPU C-states, the C2C3_FFH access
@@ -58,7 +116,7 @@ static int acpi_processor_eval_pdc(struct acpi_processor *pr)
58 buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); 116 buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
59 117
60 } 118 }
61 status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); 119 status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
62 120
63 if (ACPI_FAILURE(status)) 121 if (ACPI_FAILURE(status))
64 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 122 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -67,30 +125,29 @@ static int acpi_processor_eval_pdc(struct acpi_processor *pr)
67 return status; 125 return status;
68} 126}
69 127
70void acpi_processor_set_pdc(struct acpi_processor *pr) 128void acpi_processor_set_pdc(acpi_handle handle)
71{ 129{
72 arch_acpi_processor_init_pdc(pr); 130 struct acpi_object_list *obj_list;
73 acpi_processor_eval_pdc(pr); 131
74 arch_acpi_processor_cleanup_pdc(pr); 132 if (arch_has_acpi_pdc() == false)
133 return;
134
135 obj_list = acpi_processor_alloc_pdc();
136 if (!obj_list)
137 return;
138
139 acpi_processor_eval_pdc(handle, obj_list);
140
141 kfree(obj_list->pointer->buffer.pointer);
142 kfree(obj_list->pointer);
143 kfree(obj_list);
75} 144}
76EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); 145EXPORT_SYMBOL_GPL(acpi_processor_set_pdc);
77 146
78static acpi_status 147static acpi_status
79early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) 148early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
80{ 149{
81 struct acpi_processor pr; 150 acpi_processor_set_pdc(handle);
82
83 pr.handle = handle;
84
85 /* x86 implementation looks at pr.id to determine some
86 * CPU capabilites. We can just hard code to 0 since we're
87 * assuming the CPUs in the system are homogenous and all
88 * have the same capabilities.
89 */
90 pr.id = 0;
91
92 acpi_processor_set_pdc(&pr);
93
94 return AE_OK; 151 return AE_OK;
95} 152}
96 153
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index a1b748a7a766..0ea5ef4eb6a9 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -224,8 +224,6 @@ struct acpi_processor {
224 struct acpi_processor_throttling throttling; 224 struct acpi_processor_throttling throttling;
225 struct acpi_processor_limit limit; 225 struct acpi_processor_limit limit;
226 struct thermal_cooling_device *cdev; 226 struct thermal_cooling_device *cdev;
227 /* the _PDC objects for this processor, if any */
228 struct acpi_object_list *pdc;
229}; 227};
230 228
231struct acpi_processor_errata { 229struct acpi_processor_errata {
@@ -257,9 +255,6 @@ int acpi_processor_notify_smm(struct module *calling_module);
257DECLARE_PER_CPU(struct acpi_processor *, processors); 255DECLARE_PER_CPU(struct acpi_processor *, processors);
258extern struct acpi_processor_errata errata; 256extern struct acpi_processor_errata errata;
259 257
260void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
261void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr);
262
263#ifdef ARCH_HAS_POWER_INIT 258#ifdef ARCH_HAS_POWER_INIT
264void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 259void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
265 unsigned int cpu); 260 unsigned int cpu);
@@ -326,7 +321,7 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
326#endif /* CONFIG_CPU_FREQ */ 321#endif /* CONFIG_CPU_FREQ */
327 322
328/* in processor_pdc.c */ 323/* in processor_pdc.c */
329void acpi_processor_set_pdc(struct acpi_processor *pr); 324void acpi_processor_set_pdc(acpi_handle handle);
330 325
331/* in processor_throttling.c */ 326/* in processor_throttling.c */
332int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 327int acpi_processor_tstate_has_changed(struct acpi_processor *pr);