[CONNECTOR]: Update documentation to match reality.
[linux-2.6/verdex.git] / include / acpi / processor.h
blob7a00d5089de983d0fb91f39f410aa60ee152e2e8
1 #ifndef __ACPI_PROCESSOR_H
2 #define __ACPI_PROCESSOR_H
4 #include <linux/kernel.h>
5 #include <linux/config.h>
7 #include <asm/acpi.h>
9 #define ACPI_PROCESSOR_BUSY_METRIC 10
11 #define ACPI_PROCESSOR_MAX_POWER 8
12 #define ACPI_PROCESSOR_MAX_C2_LATENCY 100
13 #define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
15 #define ACPI_PROCESSOR_MAX_THROTTLING 16
16 #define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
17 #define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
19 #define ACPI_PDC_REVISION_ID 0x1
21 /* Power Management */
23 struct acpi_processor_cx;
25 struct acpi_power_register {
26 u8 descriptor;
27 u16 length;
28 u8 space_id;
29 u8 bit_width;
30 u8 bit_offset;
31 u8 reserved;
32 u64 address;
33 } __attribute__ ((packed));
35 struct acpi_processor_cx_policy {
36 u32 count;
37 struct acpi_processor_cx *state;
38 struct {
39 u32 time;
40 u32 ticks;
41 u32 count;
42 u32 bm;
43 } threshold;
46 struct acpi_processor_cx {
47 u8 valid;
48 u8 type;
49 u32 address;
50 u32 latency;
51 u32 latency_ticks;
52 u32 power;
53 u32 usage;
54 struct acpi_processor_cx_policy promotion;
55 struct acpi_processor_cx_policy demotion;
58 struct acpi_processor_power {
59 struct acpi_processor_cx *state;
60 unsigned long bm_check_timestamp;
61 u32 default_state;
62 u32 bm_activity;
63 int count;
64 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
66 /* the _PDC objects passed by the driver, if any */
67 struct acpi_object_list *pdc;
70 /* Performance Management */
72 struct acpi_pct_register {
73 u8 descriptor;
74 u16 length;
75 u8 space_id;
76 u8 bit_width;
77 u8 bit_offset;
78 u8 reserved;
79 u64 address;
80 } __attribute__ ((packed));
82 struct acpi_processor_px {
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 */
91 struct acpi_processor_performance {
92 unsigned int state;
93 unsigned int platform_limit;
94 struct acpi_pct_register control_register;
95 struct acpi_pct_register status_register;
96 unsigned int state_count;
97 struct acpi_processor_px *states;
99 /* the _PDC objects passed by the driver, if any */
100 struct acpi_object_list *pdc;
103 /* Throttling Control */
105 struct acpi_processor_tx {
106 u16 power;
107 u16 performance;
110 struct acpi_processor_throttling {
111 int state;
112 u32 address;
113 u8 duty_offset;
114 u8 duty_width;
115 int state_count;
116 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
119 /* Limit Interface */
121 struct acpi_processor_lx {
122 int px; /* performace state */
123 int tx; /* throttle level */
126 struct acpi_processor_limit {
127 struct acpi_processor_lx state; /* current limit */
128 struct acpi_processor_lx thermal; /* thermal limit */
129 struct acpi_processor_lx user; /* user limit */
132 struct acpi_processor_flags {
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;
143 struct acpi_processor {
144 acpi_handle handle;
145 u32 acpi_id;
146 u32 id;
147 u32 pblk;
148 int performance_platform_limit;
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;
156 struct acpi_processor_errata {
157 u8 smp;
158 struct {
159 u8 throttle:1;
160 u8 fdma:1;
161 u8 reserved:6;
162 u32 bmisx;
163 } piix4;
166 extern int acpi_processor_register_performance(struct acpi_processor_performance
167 *performance, unsigned int cpu);
168 extern void acpi_processor_unregister_performance(struct
169 acpi_processor_performance
170 *performance,
171 unsigned int cpu);
173 /* note: this locks both the calling module and the processor module
174 if a _PPC object exists, rmmod is disallowed then */
175 int acpi_processor_notify_smm(struct module *calling_module);
177 /* for communication between multiple parts of the processor kernel module */
178 extern struct acpi_processor *processors[NR_CPUS];
179 extern struct acpi_processor_errata errata;
181 int acpi_processor_set_pdc(struct acpi_processor *pr,
182 struct acpi_object_list *pdc_in);
184 #ifdef ARCH_HAS_POWER_PDC_INIT
185 void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
186 unsigned int cpu);
187 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
188 unsigned int cpu);
189 #else
190 static inline void acpi_processor_power_init_pdc(struct acpi_processor_power
191 *pow, unsigned int cpu)
193 pow->pdc = NULL;
194 return;
197 static inline void acpi_processor_power_init_bm_check(struct
198 acpi_processor_flags
199 *flags, unsigned int cpu)
201 flags->bm_check = 1;
202 return;
204 #endif
206 /* in processor_perflib.c */
208 #ifdef CONFIG_CPU_FREQ
209 void acpi_processor_ppc_init(void);
210 void acpi_processor_ppc_exit(void);
211 int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
212 #else
213 static inline void acpi_processor_ppc_init(void)
215 return;
217 static inline void acpi_processor_ppc_exit(void)
219 return;
221 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
223 static unsigned int printout = 1;
224 if (printout) {
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");
229 printout = 0;
231 return 0;
233 #endif /* CONFIG_CPU_FREQ */
235 /* in processor_throttling.c */
236 int acpi_processor_get_throttling_info(struct acpi_processor *pr);
237 int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
238 ssize_t acpi_processor_write_throttling(struct file *file,
239 const char __user * buffer,
240 size_t count, loff_t * data);
241 extern struct file_operations acpi_processor_throttling_fops;
243 /* in processor_idle.c */
244 int acpi_processor_power_init(struct acpi_processor *pr,
245 struct acpi_device *device);
246 int acpi_processor_cst_has_changed(struct acpi_processor *pr);
247 int acpi_processor_power_exit(struct acpi_processor *pr,
248 struct acpi_device *device);
250 /* in processor_thermal.c */
251 int acpi_processor_get_limit_info(struct acpi_processor *pr);
252 ssize_t acpi_processor_write_limit(struct file *file,
253 const char __user * buffer,
254 size_t count, loff_t * data);
255 extern struct file_operations acpi_processor_limit_fops;
257 #ifdef CONFIG_CPU_FREQ
258 void acpi_thermal_cpufreq_init(void);
259 void acpi_thermal_cpufreq_exit(void);
260 #else
261 static inline void acpi_thermal_cpufreq_init(void)
263 return;
265 static inline void acpi_thermal_cpufreq_exit(void)
267 return;
269 #endif
271 #endif