Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[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>
5#include <linux/config.h>
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
1da177e4
LT
21/* Power Management */
22
23struct acpi_processor_cx;
24
25struct acpi_power_register {
4be44fcd
LB
26 u8 descriptor;
27 u16 length;
28 u8 space_id;
29 u8 bit_width;
30 u8 bit_offset;
31 u8 reserved;
32 u64 address;
1da177e4
LT
33} __attribute__ ((packed));
34
1da177e4 35struct acpi_processor_cx_policy {
4be44fcd 36 u32 count;
1da177e4
LT
37 struct acpi_processor_cx *state;
38 struct {
4be44fcd
LB
39 u32 time;
40 u32 ticks;
41 u32 count;
42 u32 bm;
43 } threshold;
1da177e4
LT
44};
45
46struct acpi_processor_cx {
4be44fcd
LB
47 u8 valid;
48 u8 type;
49 u32 address;
50 u32 latency;
51 u32 latency_ticks;
52 u32 power;
53 u32 usage;
1da177e4
LT
54 struct acpi_processor_cx_policy promotion;
55 struct acpi_processor_cx_policy demotion;
56};
57
58struct acpi_processor_power {
59 struct acpi_processor_cx *state;
4be44fcd
LB
60 unsigned long bm_check_timestamp;
61 u32 default_state;
62 u32 bm_activity;
63 int count;
1da177e4 64 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
02df8b93
VP
65
66 /* the _PDC objects passed by the driver, if any */
67 struct acpi_object_list *pdc;
1da177e4
LT
68};
69
70/* Performance Management */
71
72struct acpi_pct_register {
4be44fcd
LB
73 u8 descriptor;
74 u16 length;
75 u8 space_id;
76 u8 bit_width;
77 u8 bit_offset;
78 u8 reserved;
79 u64 address;
1da177e4
LT
80} __attribute__ ((packed));
81
82struct acpi_processor_px {
4be44fcd
LB
83 acpi_integer core_frequency; /* megahertz */
84 acpi_integer power; /* milliWatts */
85 acpi_integer transition_latency; /* microseconds */
86 acpi_integer bus_master_latency; /* microseconds */
87 acpi_integer control; /* control value */
88 acpi_integer status; /* success indicator */
1da177e4
LT
89};
90
1da177e4 91struct acpi_processor_performance {
4be44fcd
LB
92 unsigned int state;
93 unsigned int platform_limit;
1da177e4
LT
94 struct acpi_pct_register control_register;
95 struct acpi_pct_register status_register;
4be44fcd 96 unsigned int state_count;
1da177e4
LT
97 struct acpi_processor_px *states;
98
99 /* the _PDC objects passed by the driver, if any */
100 struct acpi_object_list *pdc;
101};
102
1da177e4
LT
103/* Throttling Control */
104
105struct acpi_processor_tx {
4be44fcd
LB
106 u16 power;
107 u16 performance;
1da177e4
LT
108};
109
110struct acpi_processor_throttling {
4be44fcd
LB
111 int state;
112 u32 address;
113 u8 duty_offset;
114 u8 duty_width;
115 int state_count;
1da177e4
LT
116 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
117};
118
119/* Limit Interface */
120
121struct acpi_processor_lx {
4be44fcd
LB
122 int px; /* performace state */
123 int tx; /* throttle level */
1da177e4
LT
124};
125
126struct acpi_processor_limit {
4be44fcd 127 struct acpi_processor_lx state; /* current limit */
1da177e4 128 struct acpi_processor_lx thermal; /* thermal limit */
4be44fcd 129 struct acpi_processor_lx user; /* user limit */
1da177e4
LT
130};
131
1da177e4 132struct acpi_processor_flags {
4be44fcd
LB
133 u8 power:1;
134 u8 performance:1;
135 u8 throttling:1;
136 u8 limit:1;
137 u8 bm_control:1;
138 u8 bm_check:1;
139 u8 has_cst:1;
140 u8 power_setup_done:1;
1da177e4
LT
141};
142
143struct acpi_processor {
4be44fcd
LB
144 acpi_handle handle;
145 u32 acpi_id;
146 u32 id;
147 u32 pblk;
148 int performance_platform_limit;
1da177e4
LT
149 struct acpi_processor_flags flags;
150 struct acpi_processor_power power;
151 struct acpi_processor_performance *performance;
152 struct acpi_processor_throttling throttling;
153 struct acpi_processor_limit limit;
154};
155
156struct acpi_processor_errata {
4be44fcd 157 u8 smp;
1da177e4 158 struct {
4be44fcd
LB
159 u8 throttle:1;
160 u8 fdma:1;
161 u8 reserved:6;
162 u32 bmisx;
163 } piix4;
1da177e4
LT
164};
165
4be44fcd
LB
166extern int acpi_processor_register_performance(struct acpi_processor_performance
167 *performance, unsigned int cpu);
168extern void acpi_processor_unregister_performance(struct
169 acpi_processor_performance
170 *performance,
171 unsigned int cpu);
1da177e4
LT
172
173/* note: this locks both the calling module and the processor module
174 if a _PPC object exists, rmmod is disallowed then */
175int acpi_processor_notify_smm(struct module *calling_module);
176
1da177e4 177/* for communication between multiple parts of the processor kernel module */
4be44fcd 178extern struct acpi_processor *processors[NR_CPUS];
1da177e4
LT
179extern struct acpi_processor_errata errata;
180
02df8b93 181int acpi_processor_set_pdc(struct acpi_processor *pr,
4be44fcd 182 struct acpi_object_list *pdc_in);
02df8b93
VP
183
184#ifdef ARCH_HAS_POWER_PDC_INIT
185void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
4be44fcd 186 unsigned int cpu);
02df8b93 187void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
4be44fcd 188 unsigned int cpu);
02df8b93 189#else
4be44fcd
LB
190static inline void acpi_processor_power_init_pdc(struct acpi_processor_power
191 *pow, unsigned int cpu)
02df8b93
VP
192{
193 pow->pdc = NULL;
194 return;
195}
196
4be44fcd
LB
197static inline void acpi_processor_power_init_bm_check(struct
198 acpi_processor_flags
199 *flags, unsigned int cpu)
02df8b93
VP
200{
201 flags->bm_check = 1;
202 return;
203}
204#endif
205
1da177e4 206/* in processor_perflib.c */
02df8b93 207
1da177e4
LT
208#ifdef CONFIG_CPU_FREQ
209void acpi_processor_ppc_init(void);
210void acpi_processor_ppc_exit(void);
211int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
212#else
4be44fcd
LB
213static inline void acpi_processor_ppc_init(void)
214{
215 return;
216}
217static inline void acpi_processor_ppc_exit(void)
218{
219 return;
220}
221static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
222{
1da177e4
LT
223 static unsigned int printout = 1;
224 if (printout) {
4be44fcd
LB
225 printk(KERN_WARNING
226 "Warning: Processor Platform Limit event detected, but not handled.\n");
227 printk(KERN_WARNING
228 "Consider compiling CPUfreq support into your kernel.\n");
1da177e4
LT
229 printout = 0;
230 }
231 return 0;
232}
4be44fcd 233#endif /* CONFIG_CPU_FREQ */
1da177e4
LT
234
235/* in processor_throttling.c */
4be44fcd
LB
236int acpi_processor_get_throttling_info(struct acpi_processor *pr);
237int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
238ssize_t acpi_processor_write_throttling(struct file *file,
239 const char __user * buffer,
240 size_t count, loff_t * data);
1da177e4
LT
241extern struct file_operations acpi_processor_throttling_fops;
242
243/* in processor_idle.c */
4be44fcd
LB
244int acpi_processor_power_init(struct acpi_processor *pr,
245 struct acpi_device *device);
246int acpi_processor_cst_has_changed(struct acpi_processor *pr);
247int acpi_processor_power_exit(struct acpi_processor *pr,
248 struct acpi_device *device);
1da177e4
LT
249
250/* in processor_thermal.c */
4be44fcd
LB
251int acpi_processor_get_limit_info(struct acpi_processor *pr);
252ssize_t acpi_processor_write_limit(struct file *file,
253 const char __user * buffer,
254 size_t count, loff_t * data);
1da177e4
LT
255extern struct file_operations acpi_processor_limit_fops;
256
257#ifdef CONFIG_CPU_FREQ
258void acpi_thermal_cpufreq_init(void);
259void acpi_thermal_cpufreq_exit(void);
260#else
4be44fcd
LB
261static inline void acpi_thermal_cpufreq_init(void)
262{
263 return;
264}
265static inline void acpi_thermal_cpufreq_exit(void)
266{
267 return;
268}
1da177e4
LT
269#endif
270
1da177e4 271#endif
This page took 0.093828 seconds and 5 git commands to generate.