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 /* Power Management */
34 struct acpi_processor_cx
;
36 struct acpi_power_register
{
44 } __attribute__ ((packed
));
46 struct acpi_processor_cx_policy
{
48 struct acpi_processor_cx
*state
;
57 struct acpi_processor_cx
{
66 struct acpi_processor_cx_policy promotion
;
67 struct acpi_processor_cx_policy demotion
;
70 struct acpi_processor_power
{
71 struct acpi_processor_cx
*state
;
72 unsigned long bm_check_timestamp
;
76 struct acpi_processor_cx states
[ACPI_PROCESSOR_MAX_POWER
];
79 /* Performance Management */
81 struct acpi_psd_package
{
82 acpi_integer num_entries
;
83 acpi_integer revision
;
85 acpi_integer coord_type
;
86 acpi_integer num_processors
;
87 } __attribute__ ((packed
));
89 struct acpi_pct_register
{
97 } __attribute__ ((packed
));
99 struct acpi_processor_px
{
100 acpi_integer core_frequency
; /* megahertz */
101 acpi_integer power
; /* milliWatts */
102 acpi_integer transition_latency
; /* microseconds */
103 acpi_integer bus_master_latency
; /* microseconds */
104 acpi_integer control
; /* control value */
105 acpi_integer status
; /* success indicator */
108 struct acpi_processor_performance
{
110 unsigned int platform_limit
;
111 struct acpi_pct_register control_register
;
112 struct acpi_pct_register status_register
;
113 unsigned int state_count
;
114 struct acpi_processor_px
*states
;
115 struct acpi_psd_package domain_info
;
116 cpumask_t shared_cpu_map
;
117 unsigned int shared_type
;
120 /* Throttling Control */
122 struct acpi_processor_tx
{
127 struct acpi_processor_throttling
{
133 struct acpi_processor_tx states
[ACPI_PROCESSOR_MAX_THROTTLING
];
136 /* Limit Interface */
138 struct acpi_processor_lx
{
139 int px
; /* performace state */
140 int tx
; /* throttle level */
143 struct acpi_processor_limit
{
144 struct acpi_processor_lx state
; /* current limit */
145 struct acpi_processor_lx thermal
; /* thermal limit */
146 struct acpi_processor_lx user
; /* user limit */
149 struct acpi_processor_flags
{
157 u8 power_setup_done
:1;
160 struct acpi_processor
{
165 int performance_platform_limit
;
166 struct acpi_processor_flags flags
;
167 struct acpi_processor_power power
;
168 struct acpi_processor_performance
*performance
;
169 struct acpi_processor_throttling throttling
;
170 struct acpi_processor_limit limit
;
172 /* the _PDC objects for this processor, if any */
173 struct acpi_object_list
*pdc
;
176 struct acpi_processor_errata
{
186 extern int acpi_processor_preregister_performance(
187 struct acpi_processor_performance
**performance
);
189 extern int acpi_processor_register_performance(struct acpi_processor_performance
190 *performance
, unsigned int cpu
);
191 extern void acpi_processor_unregister_performance(struct
192 acpi_processor_performance
196 /* note: this locks both the calling module and the processor module
197 if a _PPC object exists, rmmod is disallowed then */
198 int acpi_processor_notify_smm(struct module
*calling_module
);
200 /* for communication between multiple parts of the processor kernel module */
201 extern struct acpi_processor
*processors
[NR_CPUS
];
202 extern struct acpi_processor_errata errata
;
204 void arch_acpi_processor_init_pdc(struct acpi_processor
*pr
);
206 #ifdef ARCH_HAS_POWER_INIT
207 void acpi_processor_power_init_bm_check(struct acpi_processor_flags
*flags
,
210 static inline void acpi_processor_power_init_bm_check(struct
212 *flags
, unsigned int cpu
)
219 /* in processor_perflib.c */
221 #ifdef CONFIG_CPU_FREQ
222 void acpi_processor_ppc_init(void);
223 void acpi_processor_ppc_exit(void);
224 int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
);
226 static inline void acpi_processor_ppc_init(void)
230 static inline void acpi_processor_ppc_exit(void)
234 static inline int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
)
236 static unsigned int printout
= 1;
239 "Warning: Processor Platform Limit event detected, but not handled.\n");
241 "Consider compiling CPUfreq support into your kernel.\n");
246 #endif /* CONFIG_CPU_FREQ */
248 /* in processor_throttling.c */
249 int acpi_processor_get_throttling_info(struct acpi_processor
*pr
);
250 int acpi_processor_set_throttling(struct acpi_processor
*pr
, int state
);
251 extern struct file_operations acpi_processor_throttling_fops
;
253 /* in processor_idle.c */
254 int acpi_processor_power_init(struct acpi_processor
*pr
,
255 struct acpi_device
*device
);
256 int acpi_processor_cst_has_changed(struct acpi_processor
*pr
);
257 int acpi_processor_power_exit(struct acpi_processor
*pr
,
258 struct acpi_device
*device
);
260 /* in processor_thermal.c */
261 int acpi_processor_get_limit_info(struct acpi_processor
*pr
);
262 extern struct file_operations acpi_processor_limit_fops
;
264 #ifdef CONFIG_CPU_FREQ
265 void acpi_thermal_cpufreq_init(void);
266 void acpi_thermal_cpufreq_exit(void);
268 static inline void acpi_thermal_cpufreq_init(void)
272 static inline void acpi_thermal_cpufreq_exit(void)