1 #ifndef __ACPI_PROCESSOR_H
2 #define __ACPI_PROCESSOR_H
4 #include <linux/kernel.h>
5 #include <linux/config.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 {
33 } __attribute__ ((packed));
36 struct acpi_processor_cx_policy {
38 struct acpi_processor_cx *state;
47 struct acpi_processor_cx {
55 struct acpi_processor_cx_policy promotion;
56 struct acpi_processor_cx_policy demotion;
59 struct acpi_processor_power {
60 struct acpi_processor_cx *state;
61 unsigned long bm_check_timestamp;
65 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
67 /* the _PDC objects passed by the driver, if any */
68 struct acpi_object_list *pdc;
71 /* Performance Management */
73 struct acpi_pct_register {
81 } __attribute__ ((packed));
83 struct acpi_processor_px {
84 acpi_integer core_frequency; /* megahertz */
85 acpi_integer power; /* milliWatts */
86 acpi_integer transition_latency; /* microseconds */
87 acpi_integer bus_master_latency; /* microseconds */
88 acpi_integer control; /* control value */
89 acpi_integer status; /* success indicator */
92 struct acpi_processor_performance {
94 unsigned int platform_limit;
95 struct acpi_pct_register control_register;
96 struct acpi_pct_register status_register;
97 unsigned int state_count;
98 struct acpi_processor_px *states;
100 /* the _PDC objects passed by the driver, if any */
101 struct acpi_object_list *pdc;
106 /* Throttling Control */
108 struct acpi_processor_tx {
113 struct acpi_processor_throttling {
119 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
122 /* Limit Interface */
124 struct acpi_processor_lx {
125 int px; /* performace state */
126 int tx; /* throttle level */
129 struct acpi_processor_limit {
130 struct acpi_processor_lx state; /* current limit */
131 struct acpi_processor_lx thermal; /* thermal limit */
132 struct acpi_processor_lx user; /* user limit */
136 struct acpi_processor_flags {
144 u8 power_setup_done:1;
147 struct acpi_processor {
152 int performance_platform_limit;
153 struct acpi_processor_flags flags;
154 struct acpi_processor_power power;
155 struct acpi_processor_performance *performance;
156 struct acpi_processor_throttling throttling;
157 struct acpi_processor_limit limit;
160 struct acpi_processor_errata {
170 extern int acpi_processor_register_performance (
171 struct acpi_processor_performance * performance,
173 extern void acpi_processor_unregister_performance (
174 struct acpi_processor_performance * performance,
177 /* note: this locks both the calling module and the processor module
178 if a _PPC object exists, rmmod is disallowed then */
179 int acpi_processor_notify_smm(struct module *calling_module);
183 /* for communication between multiple parts of the processor kernel module */
184 extern struct acpi_processor *processors[NR_CPUS];
185 extern struct acpi_processor_errata errata;
187 int acpi_processor_set_pdc(struct acpi_processor *pr,
188 struct acpi_object_list *pdc_in);
190 #ifdef ARCH_HAS_POWER_PDC_INIT
191 void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
193 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
196 static inline void acpi_processor_power_init_pdc(
197 struct acpi_processor_power *pow, unsigned int cpu)
203 static inline void acpi_processor_power_init_bm_check(
204 struct acpi_processor_flags *flags, unsigned int cpu)
211 /* in processor_perflib.c */
213 #ifdef CONFIG_CPU_FREQ
214 void acpi_processor_ppc_init(void);
215 void acpi_processor_ppc_exit(void);
216 int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
218 static inline void acpi_processor_ppc_init(void) { return; }
219 static inline void acpi_processor_ppc_exit(void) { return; }
220 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) {
221 static unsigned int printout = 1;
223 printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n");
224 printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n");
229 #endif /* CONFIG_CPU_FREQ */
231 /* in processor_throttling.c */
232 int acpi_processor_get_throttling_info (struct acpi_processor *pr);
233 int acpi_processor_set_throttling (struct acpi_processor *pr, int state);
234 ssize_t acpi_processor_write_throttling (
236 const char __user *buffer,
239 extern struct file_operations acpi_processor_throttling_fops;
241 /* in processor_idle.c */
242 int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device);
243 int acpi_processor_cst_has_changed (struct acpi_processor *pr);
244 int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device);
247 /* in processor_thermal.c */
248 int acpi_processor_get_limit_info (struct acpi_processor *pr);
249 ssize_t acpi_processor_write_limit (
251 const char __user *buffer,
254 extern struct file_operations acpi_processor_limit_fops;
256 #ifdef CONFIG_CPU_FREQ
257 void acpi_thermal_cpufreq_init(void);
258 void acpi_thermal_cpufreq_exit(void);
260 static inline void acpi_thermal_cpufreq_init(void) { return; }
261 static inline void acpi_thermal_cpufreq_exit(void) { return; }