ia64/linux-2.6.18-xen.hg

view include/acpi/processor.h @ 533:d62d60eaba6e

Handle dom0_max_vcpus < nr_pcpu cases, e.g. UP dom0.

Just try to pass info about all acpi processors to xen even in such cases.

Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 01 10:53:37 2008 +0100 (2008-05-01)
parents e97855b90cc2
children e39cf97647af
line source
1 #ifndef __ACPI_PROCESSOR_H
2 #define __ACPI_PROCESSOR_H
4 #include <linux/kernel.h>
5 #include <linux/cpu.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 #define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
22 #define ACPI_PSD_REV0_ENTRIES 5
24 #define NR_ACPI_CPUS 256
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
34 /* Power Management */
36 struct acpi_processor_cx;
38 #ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
39 struct acpi_csd_package {
40 acpi_integer num_entries;
41 acpi_integer revision;
42 acpi_integer domain;
43 acpi_integer coord_type;
44 acpi_integer num_processors;
45 acpi_integer index;
46 } __attribute__ ((packed));
47 #endif
49 struct acpi_power_register {
50 u8 descriptor;
51 u16 length;
52 u8 space_id;
53 u8 bit_width;
54 u8 bit_offset;
55 u8 reserved;
56 u64 address;
57 } __attribute__ ((packed));
59 struct acpi_processor_cx_policy {
60 u32 count;
61 struct acpi_processor_cx *state;
62 struct {
63 u32 time;
64 u32 ticks;
65 u32 count;
66 u32 bm;
67 } threshold;
68 };
70 struct acpi_processor_cx {
71 u8 valid;
72 u8 type;
73 u32 address;
74 u32 latency;
75 u32 latency_ticks;
76 u32 power;
77 u32 usage;
78 u64 time;
79 #ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
80 /* Require raw information for external control logic */
81 struct acpi_power_register reg;
82 u32 csd_count;
83 struct acpi_csd_package *domain_info;
84 #endif
85 struct acpi_processor_cx_policy promotion;
86 struct acpi_processor_cx_policy demotion;
87 };
89 struct acpi_processor_power {
90 struct acpi_processor_cx *state;
91 unsigned long bm_check_timestamp;
92 u32 default_state;
93 u32 bm_activity;
94 int count;
95 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
96 };
98 /* Performance Management */
100 struct acpi_psd_package {
101 acpi_integer num_entries;
102 acpi_integer revision;
103 acpi_integer domain;
104 acpi_integer coord_type;
105 acpi_integer num_processors;
106 } __attribute__ ((packed));
108 struct acpi_pct_register {
109 u8 descriptor;
110 u16 length;
111 u8 space_id;
112 u8 bit_width;
113 u8 bit_offset;
114 u8 reserved;
115 u64 address;
116 } __attribute__ ((packed));
118 struct acpi_processor_px {
119 acpi_integer core_frequency; /* megahertz */
120 acpi_integer power; /* milliWatts */
121 acpi_integer transition_latency; /* microseconds */
122 acpi_integer bus_master_latency; /* microseconds */
123 acpi_integer control; /* control value */
124 acpi_integer status; /* success indicator */
125 };
127 struct acpi_processor_performance {
128 unsigned int state;
129 unsigned int platform_limit;
130 struct acpi_pct_register control_register;
131 struct acpi_pct_register status_register;
132 unsigned int state_count;
133 struct acpi_processor_px *states;
134 struct acpi_psd_package domain_info;
135 cpumask_t shared_cpu_map;
136 unsigned int shared_type;
137 };
139 /* Throttling Control */
141 struct acpi_processor_tx {
142 u16 power;
143 u16 performance;
144 };
146 struct acpi_processor_throttling {
147 int state;
148 u32 address;
149 u8 duty_offset;
150 u8 duty_width;
151 int state_count;
152 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
153 };
155 /* Limit Interface */
157 struct acpi_processor_lx {
158 int px; /* performace state */
159 int tx; /* throttle level */
160 };
162 struct acpi_processor_limit {
163 struct acpi_processor_lx state; /* current limit */
164 struct acpi_processor_lx thermal; /* thermal limit */
165 struct acpi_processor_lx user; /* user limit */
166 };
168 struct acpi_processor_flags {
169 u8 power:1;
170 u8 performance:1;
171 u8 throttling:1;
172 u8 limit:1;
173 u8 bm_control:1;
174 u8 bm_check:1;
175 u8 has_cst:1;
176 u8 power_setup_done:1;
177 };
179 struct acpi_processor {
180 acpi_handle handle;
181 u32 acpi_id;
182 u32 id;
183 u32 pblk;
184 int performance_platform_limit;
185 struct acpi_processor_flags flags;
186 struct acpi_processor_power power;
187 struct acpi_processor_performance *performance;
188 struct acpi_processor_throttling throttling;
189 struct acpi_processor_limit limit;
191 /* the _PDC objects for this processor, if any */
192 struct acpi_object_list *pdc;
193 };
195 struct acpi_processor_errata {
196 u8 smp;
197 struct {
198 u8 throttle:1;
199 u8 fdma:1;
200 u8 reserved:6;
201 u32 bmisx;
202 } piix4;
203 };
205 extern int acpi_processor_preregister_performance(
206 struct acpi_processor_performance **performance);
208 extern int acpi_processor_register_performance(struct acpi_processor_performance
209 *performance, unsigned int cpu);
210 extern void acpi_processor_unregister_performance(struct
211 acpi_processor_performance
212 *performance,
213 unsigned int cpu);
215 /* note: this locks both the calling module and the processor module
216 if a _PPC object exists, rmmod is disallowed then */
217 int acpi_processor_notify_smm(struct module *calling_module);
219 /* for communication between multiple parts of the processor kernel module */
220 extern struct acpi_processor *processors[NR_CPUS];
221 extern struct acpi_processor_errata errata;
223 void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
225 #ifdef ARCH_HAS_POWER_INIT
226 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
227 unsigned int cpu);
228 #else
229 static inline void acpi_processor_power_init_bm_check(struct
230 acpi_processor_flags
231 *flags, unsigned int cpu)
232 {
233 flags->bm_check = 1;
234 return;
235 }
236 #endif
238 /* in processor_perflib.c */
240 #ifdef CONFIG_CPU_FREQ
241 void acpi_processor_ppc_init(void);
242 void acpi_processor_ppc_exit(void);
243 int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
244 #else
245 static inline void acpi_processor_ppc_init(void)
246 {
247 return;
248 }
249 static inline void acpi_processor_ppc_exit(void)
250 {
251 return;
252 }
253 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
254 {
255 static unsigned int printout = 1;
256 if (printout) {
257 printk(KERN_WARNING
258 "Warning: Processor Platform Limit event detected, but not handled.\n");
259 printk(KERN_WARNING
260 "Consider compiling CPUfreq support into your kernel.\n");
261 printout = 0;
262 }
263 return 0;
264 }
265 #endif /* CONFIG_CPU_FREQ */
267 /* in processor_throttling.c */
268 int acpi_processor_get_throttling_info(struct acpi_processor *pr);
269 int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
270 extern struct file_operations acpi_processor_throttling_fops;
272 /* in processor_idle.c */
273 int acpi_processor_power_init(struct acpi_processor *pr,
274 struct acpi_device *device);
275 int acpi_processor_cst_has_changed(struct acpi_processor *pr);
276 int acpi_processor_power_exit(struct acpi_processor *pr,
277 struct acpi_device *device);
279 /* in processor_thermal.c */
280 int acpi_processor_get_limit_info(struct acpi_processor *pr);
281 extern struct file_operations acpi_processor_limit_fops;
283 #ifdef CONFIG_CPU_FREQ
284 void acpi_thermal_cpufreq_init(void);
285 void acpi_thermal_cpufreq_exit(void);
286 #else
287 static inline void acpi_thermal_cpufreq_init(void)
288 {
289 return;
290 }
291 static inline void acpi_thermal_cpufreq_exit(void)
292 {
293 return;
294 }
295 #endif
297 /*
298 * Following are interfaces geared to external processor PM control
299 * logic like a VMM
300 */
301 /* Events notified to external control logic */
302 #define PROCESSOR_PM_INIT 1
303 #define PROCESSOR_PM_CHANGE 2
304 #define PROCESSOR_HOTPLUG 3
306 /* Objects for the PM envents */
307 #define PM_TYPE_IDLE 0
308 #define PM_TYPE_PERF 1
309 #define PM_TYPE_THR 2
310 #define PM_TYPE_MAX 3
312 /* Processor hotplug events */
313 #define HOTPLUG_TYPE_ADD 0
314 #define HOTPLUG_TYPE_REMOVE 1
316 #ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
317 struct processor_extcntl_ops {
318 /* Transfer processor PM events to external control logic */
319 int (*pm_ops[PM_TYPE_MAX])(struct acpi_processor *pr, int event);
320 /* Notify physical processor status to external control logic */
321 int (*hotplug)(struct acpi_processor *pr, int event);
322 };
323 extern struct processor_extcntl_ops *processor_extcntl_ops;
325 static inline int processor_cntl_external(void)
326 {
327 return (processor_extcntl_ops != NULL);
328 }
330 static inline int processor_pm_external(void)
331 {
332 return processor_cntl_external() &&
333 (processor_extcntl_ops->pm_ops[PM_TYPE_IDLE] != NULL);
334 }
336 static inline int processor_pmperf_external(void)
337 {
338 return processor_cntl_external() &&
339 (processor_extcntl_ops->pm_ops[PM_TYPE_PERF] != NULL);
340 }
342 static inline int processor_pmthr_external(void)
343 {
344 return processor_cntl_external() &&
345 (processor_extcntl_ops->pm_ops[PM_TYPE_THR] != NULL);
346 }
348 extern int processor_notify_external(struct acpi_processor *pr,
349 int event, int type);
350 extern int processor_register_extcntl(struct processor_extcntl_ops *ops);
351 extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops);
352 extern int processor_extcntl_init(struct acpi_processor *pr);
353 #else
354 static inline int processor_cntl_external(void) {return 0;}
355 static inline int processor_pm_external(void) {return 0;}
356 static inline int processor_pmperf_external(void) {return 0;}
357 static inline int processor_pmthr_external(void) {return 0;}
358 static inline int processor_notify_external(struct acpi_processor *pr,
359 int event, int type)
360 {
361 return -EINVAL;
362 }
363 static inline int processor_extcntl_init(struct acpi_processor *pr)
364 {
365 return -EINVAL;
366 }
367 #endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */
369 #endif