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
25 * Types of coordination defined in ACPI 3.0. Same macros can be used across
28 #define DOMAIN_COORD_TYPE_SW_ALL 0xfc
29 #define DOMAIN_COORD_TYPE_SW_ANY 0xfd
30 #define DOMAIN_COORD_TYPE_HW_ALL 0xfe
32 #define ACPI_CSTATE_SYSTEMIO (0)
33 #define ACPI_CSTATE_FFH (1)
35 /* Power Management */
37 struct acpi_processor_cx
;
39 struct acpi_power_register
{
47 } __attribute__ ((packed
));
49 struct acpi_processor_cx_policy
{
51 struct acpi_processor_cx
*state
;
60 struct acpi_processor_cx
{
71 struct acpi_processor_cx_policy promotion
;
72 struct acpi_processor_cx_policy demotion
;
75 struct acpi_processor_power
{
76 struct acpi_processor_cx
*state
;
77 unsigned long bm_check_timestamp
;
81 struct acpi_processor_cx states
[ACPI_PROCESSOR_MAX_POWER
];
82 int timer_broadcast_on_state
;
85 /* Performance Management */
87 struct acpi_psd_package
{
88 acpi_integer num_entries
;
89 acpi_integer revision
;
91 acpi_integer coord_type
;
92 acpi_integer num_processors
;
93 } __attribute__ ((packed
));
95 struct acpi_pct_register
{
103 } __attribute__ ((packed
));
105 struct acpi_processor_px
{
106 acpi_integer core_frequency
; /* megahertz */
107 acpi_integer power
; /* milliWatts */
108 acpi_integer transition_latency
; /* microseconds */
109 acpi_integer bus_master_latency
; /* microseconds */
110 acpi_integer control
; /* control value */
111 acpi_integer status
; /* success indicator */
114 struct acpi_processor_performance
{
116 unsigned int platform_limit
;
117 struct acpi_pct_register control_register
;
118 struct acpi_pct_register status_register
;
119 unsigned int state_count
;
120 struct acpi_processor_px
*states
;
121 struct acpi_psd_package domain_info
;
122 cpumask_t shared_cpu_map
;
123 unsigned int shared_type
;
126 /* Throttling Control */
128 struct acpi_processor_tx
{
133 struct acpi_processor_throttling
{
139 struct acpi_processor_tx states
[ACPI_PROCESSOR_MAX_THROTTLING
];
142 /* Limit Interface */
144 struct acpi_processor_lx
{
145 int px
; /* performace state */
146 int tx
; /* throttle level */
149 struct acpi_processor_limit
{
150 struct acpi_processor_lx state
; /* current limit */
151 struct acpi_processor_lx thermal
; /* thermal limit */
152 struct acpi_processor_lx user
; /* user limit */
155 struct acpi_processor_flags
{
163 u8 power_setup_done
:1;
166 struct acpi_processor
{
171 int performance_platform_limit
;
172 struct acpi_processor_flags flags
;
173 struct acpi_processor_power power
;
174 struct acpi_processor_performance
*performance
;
175 struct acpi_processor_throttling throttling
;
176 struct acpi_processor_limit limit
;
178 /* the _PDC objects for this processor, if any */
179 struct acpi_object_list
*pdc
;
182 struct acpi_processor_errata
{
192 extern int acpi_processor_preregister_performance(struct
193 acpi_processor_performance
196 extern int acpi_processor_register_performance(struct acpi_processor_performance
197 *performance
, unsigned int cpu
);
198 extern void acpi_processor_unregister_performance(struct
199 acpi_processor_performance
203 /* note: this locks both the calling module and the processor module
204 if a _PPC object exists, rmmod is disallowed then */
205 int acpi_processor_notify_smm(struct module
*calling_module
);
207 /* for communication between multiple parts of the processor kernel module */
208 extern struct acpi_processor
*processors
[NR_CPUS
];
209 extern struct acpi_processor_errata errata
;
211 void arch_acpi_processor_init_pdc(struct acpi_processor
*pr
);
213 #ifdef ARCH_HAS_POWER_INIT
214 void acpi_processor_power_init_bm_check(struct acpi_processor_flags
*flags
,
216 int acpi_processor_ffh_cstate_probe(unsigned int cpu
,
217 struct acpi_processor_cx
*cx
,
218 struct acpi_power_register
*reg
);
219 void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
*cstate
);
221 static inline void acpi_processor_power_init_bm_check(struct
223 *flags
, unsigned int cpu
)
228 static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu
,
229 struct acpi_processor_cx
*cx
,
230 struct acpi_power_register
235 static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
242 /* in processor_perflib.c */
244 #ifdef CONFIG_CPU_FREQ
245 void acpi_processor_ppc_init(void);
246 void acpi_processor_ppc_exit(void);
247 int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
);
249 static inline void acpi_processor_ppc_init(void)
253 static inline void acpi_processor_ppc_exit(void)
257 static inline int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
)
259 static unsigned int printout
= 1;
262 "Warning: Processor Platform Limit event detected, but not handled.\n");
264 "Consider compiling CPUfreq support into your kernel.\n");
269 #endif /* CONFIG_CPU_FREQ */
271 /* in processor_throttling.c */
272 int acpi_processor_get_throttling_info(struct acpi_processor
*pr
);
273 int acpi_processor_set_throttling(struct acpi_processor
*pr
, int state
);
274 extern struct file_operations acpi_processor_throttling_fops
;
276 /* in processor_idle.c */
277 int acpi_processor_power_init(struct acpi_processor
*pr
,
278 struct acpi_device
*device
);
279 int acpi_processor_cst_has_changed(struct acpi_processor
*pr
);
280 int acpi_processor_power_exit(struct acpi_processor
*pr
,
281 struct acpi_device
*device
);
282 int acpi_processor_suspend(struct acpi_device
* device
, pm_message_t state
);
283 int acpi_processor_resume(struct acpi_device
* device
);
285 /* in processor_thermal.c */
286 int acpi_processor_get_limit_info(struct acpi_processor
*pr
);
287 extern struct file_operations acpi_processor_limit_fops
;
289 #ifdef CONFIG_CPU_FREQ
290 void acpi_thermal_cpufreq_init(void);
291 void acpi_thermal_cpufreq_exit(void);
293 static inline void acpi_thermal_cpufreq_init(void)
297 static inline void acpi_thermal_cpufreq_exit(void)