1 #ifndef __ACPI_PROCESSOR_H
2 #define __ACPI_PROCESSOR_H
4 #include <linux/kernel.h>
5 #include <linux/config.h>
7 #define ACPI_PROCESSOR_BUSY_METRIC 10
9 #define ACPI_PROCESSOR_MAX_POWER 8
10 #define ACPI_PROCESSOR_MAX_C2_LATENCY 100
11 #define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
13 #define ACPI_PROCESSOR_MAX_THROTTLING 16
14 #define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
15 #define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
17 /* Power Management */
19 struct acpi_processor_cx
;
21 struct acpi_power_register
{
29 } __attribute__ ((packed
));
32 struct acpi_processor_cx_policy
{
34 struct acpi_processor_cx
*state
;
43 struct acpi_processor_cx
{
51 struct acpi_processor_cx_policy promotion
;
52 struct acpi_processor_cx_policy demotion
;
55 struct acpi_processor_power
{
56 struct acpi_processor_cx
*state
;
57 unsigned long bm_check_timestamp
;
61 struct acpi_processor_cx states
[ACPI_PROCESSOR_MAX_POWER
];
64 /* Performance Management */
66 struct acpi_pct_register
{
74 } __attribute__ ((packed
));
76 struct acpi_processor_px
{
77 acpi_integer core_frequency
; /* megahertz */
78 acpi_integer power
; /* milliWatts */
79 acpi_integer transition_latency
; /* microseconds */
80 acpi_integer bus_master_latency
; /* microseconds */
81 acpi_integer control
; /* control value */
82 acpi_integer status
; /* success indicator */
85 #define ACPI_PDC_REVISION_ID 0x1
87 struct acpi_processor_performance
{
89 unsigned int platform_limit
;
90 struct acpi_pct_register control_register
;
91 struct acpi_pct_register status_register
;
92 unsigned int state_count
;
93 struct acpi_processor_px
*states
;
95 /* the _PDC objects passed by the driver, if any */
96 struct acpi_object_list
*pdc
;
101 /* Throttling Control */
103 struct acpi_processor_tx
{
108 struct acpi_processor_throttling
{
114 struct acpi_processor_tx states
[ACPI_PROCESSOR_MAX_THROTTLING
];
117 /* Limit Interface */
119 struct acpi_processor_lx
{
120 int px
; /* performace state */
121 int tx
; /* throttle level */
124 struct acpi_processor_limit
{
125 struct acpi_processor_lx state
; /* current limit */
126 struct acpi_processor_lx thermal
; /* thermal limit */
127 struct acpi_processor_lx user
; /* user limit */
131 struct acpi_processor_flags
{
139 u8 power_setup_done
:1;
142 struct acpi_processor
{
147 int performance_platform_limit
;
148 struct acpi_processor_flags flags
;
149 struct acpi_processor_power power
;
150 struct acpi_processor_performance
*performance
;
151 struct acpi_processor_throttling throttling
;
152 struct acpi_processor_limit limit
;
155 struct acpi_processor_errata
{
165 extern int acpi_processor_register_performance (
166 struct acpi_processor_performance
* performance
,
168 extern void acpi_processor_unregister_performance (
169 struct acpi_processor_performance
* performance
,
172 /* note: this locks both the calling module and the processor module
173 if a _PPC object exists, rmmod is disallowed then */
174 int acpi_processor_notify_smm(struct module
*calling_module
);
178 /* for communication between multiple parts of the processor kernel module */
179 extern struct acpi_processor
*processors
[NR_CPUS
];
180 extern struct acpi_processor_errata errata
;
182 /* in processor_perflib.c */
183 #ifdef CONFIG_CPU_FREQ
184 void acpi_processor_ppc_init(void);
185 void acpi_processor_ppc_exit(void);
186 int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
);
188 static inline void acpi_processor_ppc_init(void) { return; }
189 static inline void acpi_processor_ppc_exit(void) { return; }
190 static inline int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
) {
191 static unsigned int printout
= 1;
193 printk(KERN_WARNING
"Warning: Processor Platform Limit event detected, but not handled.\n");
194 printk(KERN_WARNING
"Consider compiling CPUfreq support into your kernel.\n");
199 #endif /* CONFIG_CPU_FREQ */
201 /* in processor_throttling.c */
202 int acpi_processor_get_throttling_info (struct acpi_processor
*pr
);
203 int acpi_processor_set_throttling (struct acpi_processor
*pr
, int state
);
204 ssize_t
acpi_processor_write_throttling (
206 const char __user
*buffer
,
209 extern struct file_operations acpi_processor_throttling_fops
;
211 /* in processor_idle.c */
212 int acpi_processor_power_init(struct acpi_processor
*pr
, struct acpi_device
*device
);
213 int acpi_processor_cst_has_changed (struct acpi_processor
*pr
);
214 int acpi_processor_power_exit(struct acpi_processor
*pr
, struct acpi_device
*device
);
217 /* in processor_thermal.c */
218 int acpi_processor_get_limit_info (struct acpi_processor
*pr
);
219 ssize_t
acpi_processor_write_limit (
221 const char __user
*buffer
,
224 extern struct file_operations acpi_processor_limit_fops
;
226 #ifdef CONFIG_CPU_FREQ
227 void acpi_thermal_cpufreq_init(void);
228 void acpi_thermal_cpufreq_exit(void);
230 static inline void acpi_thermal_cpufreq_init(void) { return; }
231 static inline void acpi_thermal_cpufreq_exit(void) { return; }