1 #ifndef __ACPI_PROCESSOR_H
2 #define __ACPI_PROCESSOR_H
4 #include <linux/kernel.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 ACPI_TSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
25 #define ACPI_TSD_REV0_ENTRIES 5
27 * Types of coordination defined in ACPI 3.0. Same macros can be used across
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 #define ACPI_CSTATE_SYSTEMIO (0)
35 #define ACPI_CSTATE_FFH (1)
37 /* Power Management */
39 struct acpi_processor_cx
;
41 struct acpi_power_register
{
49 } __attribute__ ((packed
));
51 struct acpi_processor_cx_policy
{
53 struct acpi_processor_cx
*state
;
62 struct acpi_processor_cx
{
73 struct acpi_processor_cx_policy promotion
;
74 struct acpi_processor_cx_policy demotion
;
77 struct acpi_processor_power
{
78 struct acpi_processor_cx
*state
;
79 unsigned long bm_check_timestamp
;
83 struct acpi_processor_cx states
[ACPI_PROCESSOR_MAX_POWER
];
84 int timer_broadcast_on_state
;
87 /* Performance Management */
89 struct acpi_psd_package
{
90 acpi_integer num_entries
;
91 acpi_integer revision
;
93 acpi_integer coord_type
;
94 acpi_integer num_processors
;
95 } __attribute__ ((packed
));
97 struct acpi_pct_register
{
105 } __attribute__ ((packed
));
107 struct acpi_processor_px
{
108 acpi_integer core_frequency
; /* megahertz */
109 acpi_integer power
; /* milliWatts */
110 acpi_integer transition_latency
; /* microseconds */
111 acpi_integer bus_master_latency
; /* microseconds */
112 acpi_integer control
; /* control value */
113 acpi_integer status
; /* success indicator */
116 struct acpi_processor_performance
{
118 unsigned int platform_limit
;
119 struct acpi_pct_register control_register
;
120 struct acpi_pct_register status_register
;
121 unsigned int state_count
;
122 struct acpi_processor_px
*states
;
123 struct acpi_psd_package domain_info
;
124 cpumask_t shared_cpu_map
;
125 unsigned int shared_type
;
128 /* Throttling Control */
130 struct acpi_tsd_package
{
131 acpi_integer num_entries
;
132 acpi_integer revision
;
134 acpi_integer coord_type
;
135 acpi_integer num_processors
;
136 } __attribute__ ((packed
));
138 struct acpi_ptc_register
{
146 } __attribute__ ((packed
));
148 struct acpi_processor_tx_tss
{
149 acpi_integer freqpercentage
; /* */
150 acpi_integer power
; /* milliWatts */
151 acpi_integer transition_latency
; /* microseconds */
152 acpi_integer control
; /* control value */
153 acpi_integer status
; /* success indicator */
155 struct acpi_processor_tx
{
160 struct acpi_processor
;
161 struct acpi_processor_throttling
{
163 unsigned int platform_limit
;
164 struct acpi_pct_register control_register
;
165 struct acpi_pct_register status_register
;
166 unsigned int state_count
;
167 struct acpi_processor_tx_tss
*states_tss
;
168 struct acpi_tsd_package domain_info
;
169 cpumask_t shared_cpu_map
;
170 int (*acpi_processor_get_throttling
) (struct acpi_processor
* pr
);
171 int (*acpi_processor_set_throttling
) (struct acpi_processor
* pr
,
177 struct acpi_processor_tx states
[ACPI_PROCESSOR_MAX_THROTTLING
];
180 /* Limit Interface */
182 struct acpi_processor_lx
{
183 int px
; /* performace state */
184 int tx
; /* throttle level */
187 struct acpi_processor_limit
{
188 struct acpi_processor_lx state
; /* current limit */
189 struct acpi_processor_lx thermal
; /* thermal limit */
190 struct acpi_processor_lx user
; /* user limit */
193 struct acpi_processor_flags
{
201 u8 power_setup_done
:1;
204 struct acpi_processor
{
209 int performance_platform_limit
;
210 int throttling_platform_limit
;
211 /* 0 - states 0..n-th state available */
213 struct acpi_processor_flags flags
;
214 struct acpi_processor_power power
;
215 struct acpi_processor_performance
*performance
;
216 struct acpi_processor_throttling throttling
;
217 struct acpi_processor_limit limit
;
219 /* the _PDC objects for this processor, if any */
220 struct acpi_object_list
*pdc
;
223 struct acpi_processor_errata
{
233 extern int acpi_processor_preregister_performance(struct
234 acpi_processor_performance
237 extern int acpi_processor_register_performance(struct acpi_processor_performance
238 *performance
, unsigned int cpu
);
239 extern void acpi_processor_unregister_performance(struct
240 acpi_processor_performance
244 /* note: this locks both the calling module and the processor module
245 if a _PPC object exists, rmmod is disallowed then */
246 int acpi_processor_notify_smm(struct module
*calling_module
);
248 /* for communication between multiple parts of the processor kernel module */
249 extern struct acpi_processor
*processors
[NR_CPUS
];
250 extern struct acpi_processor_errata errata
;
252 void arch_acpi_processor_init_pdc(struct acpi_processor
*pr
);
254 #ifdef ARCH_HAS_POWER_INIT
255 void acpi_processor_power_init_bm_check(struct acpi_processor_flags
*flags
,
257 int acpi_processor_ffh_cstate_probe(unsigned int cpu
,
258 struct acpi_processor_cx
*cx
,
259 struct acpi_power_register
*reg
);
260 void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
*cstate
);
262 static inline void acpi_processor_power_init_bm_check(struct
264 *flags
, unsigned int cpu
)
269 static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu
,
270 struct acpi_processor_cx
*cx
,
271 struct acpi_power_register
276 static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
283 /* in processor_perflib.c */
285 #ifdef CONFIG_CPU_FREQ
286 void acpi_processor_ppc_init(void);
287 void acpi_processor_ppc_exit(void);
288 int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
);
290 static inline void acpi_processor_ppc_init(void)
294 static inline void acpi_processor_ppc_exit(void)
298 static inline int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
)
300 static unsigned int printout
= 1;
303 "Warning: Processor Platform Limit event detected, but not handled.\n");
305 "Consider compiling CPUfreq support into your kernel.\n");
310 #endif /* CONFIG_CPU_FREQ */
312 /* in processor_throttling.c */
313 int acpi_processor_get_throttling_info(struct acpi_processor
*pr
);
314 extern int acpi_processor_set_throttling(struct acpi_processor
*pr
, int state
);
315 extern struct file_operations acpi_processor_throttling_fops
;
317 /* in processor_idle.c */
318 int acpi_processor_power_init(struct acpi_processor
*pr
,
319 struct acpi_device
*device
);
320 int acpi_processor_cst_has_changed(struct acpi_processor
*pr
);
321 int acpi_processor_power_exit(struct acpi_processor
*pr
,
322 struct acpi_device
*device
);
323 int acpi_processor_suspend(struct acpi_device
* device
, pm_message_t state
);
324 int acpi_processor_resume(struct acpi_device
* device
);
326 /* in processor_thermal.c */
327 int acpi_processor_get_limit_info(struct acpi_processor
*pr
);
328 extern struct file_operations acpi_processor_limit_fops
;
330 #ifdef CONFIG_CPU_FREQ
331 void acpi_thermal_cpufreq_init(void);
332 void acpi_thermal_cpufreq_exit(void);
334 static inline void acpi_thermal_cpufreq_init(void)
338 static inline void acpi_thermal_cpufreq_exit(void)