ACPI: add ACPI 3.0 _TPC _TSS _PTC throttling support
[deliverable/linux.git] / include / acpi / processor.h
CommitLineData
1da177e4
LT
1#ifndef __ACPI_PROCESSOR_H
2#define __ACPI_PROCESSOR_H
3
4#include <linux/kernel.h>
3b2d9942 5#include <linux/cpu.h>
1da177e4 6
02df8b93
VP
7#include <asm/acpi.h>
8
1da177e4
LT
9#define ACPI_PROCESSOR_BUSY_METRIC 10
10
11#define ACPI_PROCESSOR_MAX_POWER 8
12#define ACPI_PROCESSOR_MAX_C2_LATENCY 100
13#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
14
15#define ACPI_PROCESSOR_MAX_THROTTLING 16
16#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
17#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
18
02df8b93
VP
19#define ACPI_PDC_REVISION_ID 0x1
20
fd350943 21#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
3b2d9942
VP
22#define ACPI_PSD_REV0_ENTRIES 5
23
01854e69
LY
24#define ACPI_TSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
25#define ACPI_TSD_REV0_ENTRIES 5
3b2d9942
VP
26/*
27 * Types of coordination defined in ACPI 3.0. Same macros can be used across
28 * P, C and T states
29 */
30#define DOMAIN_COORD_TYPE_SW_ALL 0xfc
31#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
32#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
33
991528d7
VP
34#define ACPI_CSTATE_SYSTEMIO (0)
35#define ACPI_CSTATE_FFH (1)
36
1da177e4
LT
37/* Power Management */
38
39struct acpi_processor_cx;
40
41struct acpi_power_register {
4be44fcd
LB
42 u8 descriptor;
43 u16 length;
44 u8 space_id;
45 u8 bit_width;
46 u8 bit_offset;
47 u8 reserved;
48 u64 address;
1da177e4
LT
49} __attribute__ ((packed));
50
1da177e4 51struct acpi_processor_cx_policy {
4be44fcd 52 u32 count;
1da177e4
LT
53 struct acpi_processor_cx *state;
54 struct {
4be44fcd
LB
55 u32 time;
56 u32 ticks;
57 u32 count;
58 u32 bm;
59 } threshold;
1da177e4
LT
60};
61
62struct acpi_processor_cx {
4be44fcd
LB
63 u8 valid;
64 u8 type;
65 u32 address;
991528d7
VP
66 u8 space_id;
67 u8 index;
4be44fcd
LB
68 u32 latency;
69 u32 latency_ticks;
70 u32 power;
71 u32 usage;
a3c6598f 72 u64 time;
1da177e4
LT
73 struct acpi_processor_cx_policy promotion;
74 struct acpi_processor_cx_policy demotion;
75};
76
77struct acpi_processor_power {
78 struct acpi_processor_cx *state;
4be44fcd
LB
79 unsigned long bm_check_timestamp;
80 u32 default_state;
81 u32 bm_activity;
82 int count;
1da177e4 83 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
169a0abb 84 int timer_broadcast_on_state;
1da177e4
LT
85};
86
87/* Performance Management */
88
3b2d9942
VP
89struct acpi_psd_package {
90 acpi_integer num_entries;
91 acpi_integer revision;
92 acpi_integer domain;
93 acpi_integer coord_type;
94 acpi_integer num_processors;
95} __attribute__ ((packed));
96
1da177e4 97struct acpi_pct_register {
4be44fcd
LB
98 u8 descriptor;
99 u16 length;
100 u8 space_id;
101 u8 bit_width;
102 u8 bit_offset;
103 u8 reserved;
104 u64 address;
1da177e4
LT
105} __attribute__ ((packed));
106
107struct acpi_processor_px {
4be44fcd
LB
108 acpi_integer core_frequency; /* megahertz */
109 acpi_integer power; /* milliWatts */
110 acpi_integer transition_latency; /* microseconds */
111 acpi_integer bus_master_latency; /* microseconds */
112 acpi_integer control; /* control value */
113 acpi_integer status; /* success indicator */
1da177e4
LT
114};
115
1da177e4 116struct acpi_processor_performance {
4be44fcd
LB
117 unsigned int state;
118 unsigned int platform_limit;
1da177e4
LT
119 struct acpi_pct_register control_register;
120 struct acpi_pct_register status_register;
4be44fcd 121 unsigned int state_count;
1da177e4 122 struct acpi_processor_px *states;
3b2d9942
VP
123 struct acpi_psd_package domain_info;
124 cpumask_t shared_cpu_map;
125 unsigned int shared_type;
1da177e4
LT
126};
127
1da177e4
LT
128/* Throttling Control */
129
01854e69
LY
130struct acpi_tsd_package {
131 acpi_integer num_entries;
132 acpi_integer revision;
133 acpi_integer domain;
134 acpi_integer coord_type;
135 acpi_integer num_processors;
136} __attribute__ ((packed));
137
138struct acpi_ptc_register {
139 u8 descriptor;
140 u16 length;
141 u8 space_id;
142 u8 bit_width;
143 u8 bit_offset;
144 u8 reserved;
145 u64 address;
146} __attribute__ ((packed));
147
148struct acpi_processor_tx_tss {
149 acpi_integer freqpercentage; /* */
150 acpi_integer power; /* milliWatts */
151 acpi_integer transition_latency; /* microseconds */
152 acpi_integer control; /* control value */
153 acpi_integer status; /* success indicator */
154};
1da177e4 155struct acpi_processor_tx {
4be44fcd
LB
156 u16 power;
157 u16 performance;
1da177e4
LT
158};
159
01854e69 160struct acpi_processor;
1da177e4 161struct acpi_processor_throttling {
01854e69
LY
162 unsigned int state;
163 unsigned int platform_limit;
164 struct acpi_pct_register control_register;
165 struct acpi_pct_register status_register;
166 unsigned int state_count;
167 struct acpi_processor_tx_tss *states_tss;
168 struct acpi_tsd_package domain_info;
169 cpumask_t shared_cpu_map;
170 int (*acpi_processor_get_throttling) (struct acpi_processor *pr);
171 int (*acpi_processor_set_throttling) (struct acpi_processor *pr, int state);
172
4be44fcd
LB
173 u32 address;
174 u8 duty_offset;
175 u8 duty_width;
1da177e4
LT
176 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
177};
178
179/* Limit Interface */
180
181struct acpi_processor_lx {
4be44fcd
LB
182 int px; /* performace state */
183 int tx; /* throttle level */
1da177e4
LT
184};
185
186struct acpi_processor_limit {
4be44fcd 187 struct acpi_processor_lx state; /* current limit */
1da177e4 188 struct acpi_processor_lx thermal; /* thermal limit */
4be44fcd 189 struct acpi_processor_lx user; /* user limit */
1da177e4
LT
190};
191
1da177e4 192struct acpi_processor_flags {
4be44fcd
LB
193 u8 power:1;
194 u8 performance:1;
195 u8 throttling:1;
196 u8 limit:1;
197 u8 bm_control:1;
198 u8 bm_check:1;
199 u8 has_cst:1;
200 u8 power_setup_done:1;
1da177e4
LT
201};
202
203struct acpi_processor {
4be44fcd
LB
204 acpi_handle handle;
205 u32 acpi_id;
206 u32 id;
207 u32 pblk;
208 int performance_platform_limit;
01854e69
LY
209 int throttling_platform_limit;
210 /*0 - states 0..n-th satte available*/
211
1da177e4
LT
212 struct acpi_processor_flags flags;
213 struct acpi_processor_power power;
214 struct acpi_processor_performance *performance;
215 struct acpi_processor_throttling throttling;
216 struct acpi_processor_limit limit;
05131ecc
VP
217
218 /* the _PDC objects for this processor, if any */
219 struct acpi_object_list *pdc;
1da177e4
LT
220};
221
222struct acpi_processor_errata {
4be44fcd 223 u8 smp;
1da177e4 224 struct {
4be44fcd
LB
225 u8 throttle:1;
226 u8 fdma:1;
227 u8 reserved:6;
228 u32 bmisx;
229 } piix4;
1da177e4
LT
230};
231
fd350943
LB
232extern int acpi_processor_preregister_performance(struct
233 acpi_processor_performance
234 **performance);
3b2d9942 235
4be44fcd
LB
236extern int acpi_processor_register_performance(struct acpi_processor_performance
237 *performance, unsigned int cpu);
238extern void acpi_processor_unregister_performance(struct
239 acpi_processor_performance
240 *performance,
241 unsigned int cpu);
1da177e4
LT
242
243/* note: this locks both the calling module and the processor module
244 if a _PPC object exists, rmmod is disallowed then */
245int acpi_processor_notify_smm(struct module *calling_module);
246
1da177e4 247/* for communication between multiple parts of the processor kernel module */
4be44fcd 248extern struct acpi_processor *processors[NR_CPUS];
1da177e4
LT
249extern struct acpi_processor_errata errata;
250
05131ecc 251void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
02df8b93 252
05131ecc 253#ifdef ARCH_HAS_POWER_INIT
02df8b93 254void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
4be44fcd 255 unsigned int cpu);
991528d7 256int acpi_processor_ffh_cstate_probe(unsigned int cpu,
fd350943
LB
257 struct acpi_processor_cx *cx,
258 struct acpi_power_register *reg);
991528d7 259void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
02df8b93 260#else
4be44fcd
LB
261static inline void acpi_processor_power_init_bm_check(struct
262 acpi_processor_flags
263 *flags, unsigned int cpu)
02df8b93
VP
264{
265 flags->bm_check = 1;
266 return;
267}
991528d7 268static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu,
fd350943
LB
269 struct acpi_processor_cx *cx,
270 struct acpi_power_register
271 *reg)
991528d7
VP
272{
273 return -1;
274}
fd350943
LB
275static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
276 *cstate)
991528d7
VP
277{
278 return;
279}
02df8b93
VP
280#endif
281
1da177e4 282/* in processor_perflib.c */
02df8b93 283
1da177e4
LT
284#ifdef CONFIG_CPU_FREQ
285void acpi_processor_ppc_init(void);
286void acpi_processor_ppc_exit(void);
287int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
288#else
4be44fcd
LB
289static inline void acpi_processor_ppc_init(void)
290{
291 return;
292}
293static inline void acpi_processor_ppc_exit(void)
294{
295 return;
296}
297static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
298{
1da177e4
LT
299 static unsigned int printout = 1;
300 if (printout) {
4be44fcd
LB
301 printk(KERN_WARNING
302 "Warning: Processor Platform Limit event detected, but not handled.\n");
303 printk(KERN_WARNING
304 "Consider compiling CPUfreq support into your kernel.\n");
1da177e4
LT
305 printout = 0;
306 }
307 return 0;
308}
4be44fcd 309#endif /* CONFIG_CPU_FREQ */
1da177e4
LT
310
311/* in processor_throttling.c */
4be44fcd 312int acpi_processor_get_throttling_info(struct acpi_processor *pr);
01854e69 313extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
1da177e4
LT
314extern struct file_operations acpi_processor_throttling_fops;
315
316/* in processor_idle.c */
4be44fcd
LB
317int acpi_processor_power_init(struct acpi_processor *pr,
318 struct acpi_device *device);
319int acpi_processor_cst_has_changed(struct acpi_processor *pr);
320int acpi_processor_power_exit(struct acpi_processor *pr,
321 struct acpi_device *device);
1da177e4
LT
322
323/* in processor_thermal.c */
4be44fcd 324int acpi_processor_get_limit_info(struct acpi_processor *pr);
1da177e4
LT
325extern struct file_operations acpi_processor_limit_fops;
326
327#ifdef CONFIG_CPU_FREQ
328void acpi_thermal_cpufreq_init(void);
329void acpi_thermal_cpufreq_exit(void);
330#else
4be44fcd
LB
331static inline void acpi_thermal_cpufreq_init(void)
332{
333 return;
334}
335static inline void acpi_thermal_cpufreq_exit(void)
336{
337 return;
338}
1da177e4
LT
339#endif
340
1da177e4 341#endif
This page took 0.395569 seconds and 5 git commands to generate.