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));
35 struct acpi_processor_cx_policy {
37 struct acpi_processor_cx *state;
46 struct acpi_processor_cx {
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;
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 {
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 {
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 {
110 struct acpi_processor_throttling {
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 {
140 u8 power_setup_done:1;
143 struct acpi_processor {
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 {
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
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,
187 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
190 static inline void acpi_processor_power_init_pdc(struct acpi_processor_power
191 *pow, unsigned int cpu)
197 static inline void acpi_processor_power_init_bm_check(struct
199 *flags, unsigned int cpu)
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);
213 static inline void acpi_processor_ppc_init(void)
217 static inline void acpi_processor_ppc_exit(void)
221 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
223 static unsigned int printout = 1;
226 "Warning: Processor Platform Limit event detected, but not handled.\n");
228 "Consider compiling CPUfreq support into your kernel.\n");
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);
261 static inline void acpi_thermal_cpufreq_init(void)
265 static inline void acpi_thermal_cpufreq_exit(void)