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
];
67 /* Performance Management */
69 struct acpi_pct_register
{
77 } __attribute__ ((packed
));
79 struct acpi_processor_px
{
80 acpi_integer core_frequency
; /* megahertz */
81 acpi_integer power
; /* milliWatts */
82 acpi_integer transition_latency
; /* microseconds */
83 acpi_integer bus_master_latency
; /* microseconds */
84 acpi_integer control
; /* control value */
85 acpi_integer status
; /* success indicator */
88 struct acpi_processor_performance
{
90 unsigned int platform_limit
;
91 struct acpi_pct_register control_register
;
92 struct acpi_pct_register status_register
;
93 unsigned int state_count
;
94 struct acpi_processor_px
*states
;
98 /* Throttling Control */
100 struct acpi_processor_tx
{
105 struct acpi_processor_throttling
{
111 struct acpi_processor_tx states
[ACPI_PROCESSOR_MAX_THROTTLING
];
114 /* Limit Interface */
116 struct acpi_processor_lx
{
117 int px
; /* performace state */
118 int tx
; /* throttle level */
121 struct acpi_processor_limit
{
122 struct acpi_processor_lx state
; /* current limit */
123 struct acpi_processor_lx thermal
; /* thermal limit */
124 struct acpi_processor_lx user
; /* user limit */
127 struct acpi_processor_flags
{
135 u8 power_setup_done
:1;
138 struct acpi_processor
{
143 int performance_platform_limit
;
144 struct acpi_processor_flags flags
;
145 struct acpi_processor_power power
;
146 struct acpi_processor_performance
*performance
;
147 struct acpi_processor_throttling throttling
;
148 struct acpi_processor_limit limit
;
150 /* the _PDC objects for this processor, if any */
151 struct acpi_object_list
*pdc
;
154 struct acpi_processor_errata
{
164 extern int acpi_processor_register_performance(struct acpi_processor_performance
165 *performance
, unsigned int cpu
);
166 extern void acpi_processor_unregister_performance(struct
167 acpi_processor_performance
171 /* note: this locks both the calling module and the processor module
172 if a _PPC object exists, rmmod is disallowed then */
173 int acpi_processor_notify_smm(struct module
*calling_module
);
175 /* for communication between multiple parts of the processor kernel module */
176 extern struct acpi_processor
*processors
[NR_CPUS
];
177 extern struct acpi_processor_errata errata
;
179 void arch_acpi_processor_init_pdc(struct acpi_processor
*pr
);
181 #ifdef ARCH_HAS_POWER_INIT
182 void acpi_processor_power_init_bm_check(struct acpi_processor_flags
*flags
,
185 static inline void acpi_processor_power_init_bm_check(struct
187 *flags
, unsigned int cpu
)
194 /* in processor_perflib.c */
196 #ifdef CONFIG_CPU_FREQ
197 void acpi_processor_ppc_init(void);
198 void acpi_processor_ppc_exit(void);
199 int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
);
201 static inline void acpi_processor_ppc_init(void)
205 static inline void acpi_processor_ppc_exit(void)
209 static inline int acpi_processor_ppc_has_changed(struct acpi_processor
*pr
)
211 static unsigned int printout
= 1;
214 "Warning: Processor Platform Limit event detected, but not handled.\n");
216 "Consider compiling CPUfreq support into your kernel.\n");
221 #endif /* CONFIG_CPU_FREQ */
223 /* in processor_throttling.c */
224 int acpi_processor_get_throttling_info(struct acpi_processor
*pr
);
225 int acpi_processor_set_throttling(struct acpi_processor
*pr
, int state
);
226 extern struct file_operations acpi_processor_throttling_fops
;
228 /* in processor_idle.c */
229 int acpi_processor_power_init(struct acpi_processor
*pr
,
230 struct acpi_device
*device
);
231 int acpi_processor_cst_has_changed(struct acpi_processor
*pr
);
232 int acpi_processor_power_exit(struct acpi_processor
*pr
,
233 struct acpi_device
*device
);
235 /* in processor_thermal.c */
236 int acpi_processor_get_limit_info(struct acpi_processor
*pr
);
237 extern struct file_operations acpi_processor_limit_fops
;
239 #ifdef CONFIG_CPU_FREQ
240 void acpi_thermal_cpufreq_init(void);
241 void acpi_thermal_cpufreq_exit(void);
243 static inline void acpi_thermal_cpufreq_init(void)
247 static inline void acpi_thermal_cpufreq_exit(void)