aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/processor.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/acpi/processor.h')
-rw-r--r--include/acpi/processor.h235
1 files changed, 235 insertions, 0 deletions
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
new file mode 100644
index 000000000000..2f50a5bb0c78
--- /dev/null
+++ b/include/acpi/processor.h
@@ -0,0 +1,235 @@
1#ifndef __ACPI_PROCESSOR_H
2#define __ACPI_PROCESSOR_H
3
4#include <linux/kernel.h>
5#include <linux/config.h>
6
7#define ACPI_PROCESSOR_BUSY_METRIC 10
8
9#define ACPI_PROCESSOR_MAX_POWER 8
10#define ACPI_PROCESSOR_MAX_C2_LATENCY 100
11#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
12
13#define ACPI_PROCESSOR_MAX_THROTTLING 16
14#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
15#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
16
17/* Power Management */
18
19struct acpi_processor_cx;
20
21struct acpi_power_register {
22 u8 descriptor;
23 u16 length;
24 u8 space_id;
25 u8 bit_width;
26 u8 bit_offset;
27 u8 reserved;
28 u64 address;
29} __attribute__ ((packed));
30
31
32struct acpi_processor_cx_policy {
33 u32 count;
34 struct acpi_processor_cx *state;
35 struct {
36 u32 time;
37 u32 ticks;
38 u32 count;
39 u32 bm;
40 } threshold;
41};
42
43struct acpi_processor_cx {
44 u8 valid;
45 u8 type;
46 u32 address;
47 u32 latency;
48 u32 latency_ticks;
49 u32 power;
50 u32 usage;
51 struct acpi_processor_cx_policy promotion;
52 struct acpi_processor_cx_policy demotion;
53};
54
55struct acpi_processor_power {
56 struct acpi_processor_cx *state;
57 unsigned long bm_check_timestamp;
58 u32 default_state;
59 u32 bm_activity;
60 int count;
61 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
62};
63
64/* Performance Management */
65
66struct acpi_pct_register {
67 u8 descriptor;
68 u16 length;
69 u8 space_id;
70 u8 bit_width;
71 u8 bit_offset;
72 u8 reserved;
73 u64 address;
74} __attribute__ ((packed));
75
76struct 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 */
83};
84
85#define ACPI_PDC_REVISION_ID 0x1
86
87struct acpi_processor_performance {
88 unsigned int state;
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;
94
95 /* the _PDC objects passed by the driver, if any */
96 struct acpi_object_list *pdc;
97};
98
99
100
101/* Throttling Control */
102
103struct acpi_processor_tx {
104 u16 power;
105 u16 performance;
106};
107
108struct acpi_processor_throttling {
109 int state;
110 u32 address;
111 u8 duty_offset;
112 u8 duty_width;
113 int state_count;
114 struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
115};
116
117/* Limit Interface */
118
119struct acpi_processor_lx {
120 int px; /* performace state */
121 int tx; /* throttle level */
122};
123
124struct 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 */
128};
129
130
131struct acpi_processor_flags {
132 u8 power:1;
133 u8 performance:1;
134 u8 throttling:1;
135 u8 limit:1;
136 u8 bm_control:1;
137 u8 bm_check:1;
138 u8 has_cst:1;
139 u8 power_setup_done:1;
140};
141
142struct acpi_processor {
143 acpi_handle handle;
144 u32 acpi_id;
145 u32 id;
146 u32 pblk;
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;
153};
154
155struct acpi_processor_errata {
156 u8 smp;
157 struct {
158 u8 throttle:1;
159 u8 fdma:1;
160 u8 reserved:6;
161 u32 bmisx;
162 } piix4;
163};
164
165extern int acpi_processor_register_performance (
166 struct acpi_processor_performance * performance,
167 unsigned int cpu);
168extern void acpi_processor_unregister_performance (
169 struct acpi_processor_performance * performance,
170 unsigned int cpu);
171
172/* note: this locks both the calling module and the processor module
173 if a _PPC object exists, rmmod is disallowed then */
174int acpi_processor_notify_smm(struct module *calling_module);
175
176
177
178/* for communication between multiple parts of the processor kernel module */
179extern struct acpi_processor *processors[NR_CPUS];
180extern struct acpi_processor_errata errata;
181
182/* in processor_perflib.c */
183#ifdef CONFIG_CPU_FREQ
184void acpi_processor_ppc_init(void);
185void acpi_processor_ppc_exit(void);
186int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
187#else
188static inline void acpi_processor_ppc_init(void) { return; }
189static inline void acpi_processor_ppc_exit(void) { return; }
190static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) {
191 static unsigned int printout = 1;
192 if (printout) {
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");
195 printout = 0;
196 }
197 return 0;
198}
199#endif /* CONFIG_CPU_FREQ */
200
201/* in processor_throttling.c */
202int acpi_processor_get_throttling_info (struct acpi_processor *pr);
203int acpi_processor_set_throttling (struct acpi_processor *pr, int state);
204ssize_t acpi_processor_write_throttling (
205 struct file *file,
206 const char __user *buffer,
207 size_t count,
208 loff_t *data);
209extern struct file_operations acpi_processor_throttling_fops;
210
211/* in processor_idle.c */
212int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device);
213int acpi_processor_cst_has_changed (struct acpi_processor *pr);
214int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device);
215
216
217/* in processor_thermal.c */
218int acpi_processor_get_limit_info (struct acpi_processor *pr);
219ssize_t acpi_processor_write_limit (
220 struct file *file,
221 const char __user *buffer,
222 size_t count,
223 loff_t *data);
224extern struct file_operations acpi_processor_limit_fops;
225
226#ifdef CONFIG_CPU_FREQ
227void acpi_thermal_cpufreq_init(void);
228void acpi_thermal_cpufreq_exit(void);
229#else
230static inline void acpi_thermal_cpufreq_init(void) { return; }
231static inline void acpi_thermal_cpufreq_exit(void) { return; }
232#endif
233
234
235#endif