Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


3c4461d2ad4a62ec7935aaf02ad8a8f8977a3caa
[palacios.git] / kitten / include / acpi / processor.h
1 #ifndef __ACPI_PROCESSOR_H
2 #define __ACPI_PROCESSOR_H
3
4 #include <linux/kernel.h>
5 #include <linux/config.h>
6 #include <linux/cpu.h>
7
8 #include <asm/acpi.h>
9
10 #define ACPI_PROCESSOR_BUSY_METRIC      10
11
12 #define ACPI_PROCESSOR_MAX_POWER        8
13 #define ACPI_PROCESSOR_MAX_C2_LATENCY   100
14 #define ACPI_PROCESSOR_MAX_C3_LATENCY   1000
15
16 #define ACPI_PROCESSOR_MAX_THROTTLING   16
17 #define ACPI_PROCESSOR_MAX_THROTTLE     250     /* 25% */
18 #define ACPI_PROCESSOR_MAX_DUTY_WIDTH   4
19
20 #define ACPI_PDC_REVISION_ID            0x1
21
22 #define ACPI_PSD_REV0_REVISION          0 /* Support for _PSD as in ACPI 3.0 */
23 #define ACPI_PSD_REV0_ENTRIES           5
24
25 /*
26  * Types of coordination defined in ACPI 3.0. Same macros can be used across
27  * P, C and T states
28  */
29 #define DOMAIN_COORD_TYPE_SW_ALL        0xfc
30 #define DOMAIN_COORD_TYPE_SW_ANY        0xfd
31 #define DOMAIN_COORD_TYPE_HW_ALL        0xfe
32
33 /* Power Management */
34
35 struct acpi_processor_cx;
36
37 struct acpi_power_register {
38         u8 descriptor;
39         u16 length;
40         u8 space_id;
41         u8 bit_width;
42         u8 bit_offset;
43         u8 reserved;
44         u64 address;
45 } __attribute__ ((packed));
46
47 struct acpi_processor_cx_policy {
48         u32 count;
49         struct acpi_processor_cx *state;
50         struct {
51                 u32 time;
52                 u32 ticks;
53                 u32 count;
54                 u32 bm;
55         } threshold;
56 };
57
58 struct acpi_processor_cx {
59         u8 valid;
60         u8 type;
61         u32 address;
62         u32 latency;
63         u32 latency_ticks;
64         u32 power;
65         u32 usage;
66         u64 time;
67         struct acpi_processor_cx_policy promotion;
68         struct acpi_processor_cx_policy demotion;
69 };
70
71 struct acpi_processor_power {
72         struct acpi_processor_cx *state;
73         unsigned long bm_check_timestamp;
74         u32 default_state;
75         u32 bm_activity;
76         int count;
77         struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
78 };
79
80 /* Performance Management */
81
82 struct acpi_psd_package {
83         acpi_integer num_entries;
84         acpi_integer revision;
85         acpi_integer domain;
86         acpi_integer coord_type;
87         acpi_integer num_processors;
88 } __attribute__ ((packed));
89
90 struct acpi_pct_register {
91         u8 descriptor;
92         u16 length;
93         u8 space_id;
94         u8 bit_width;
95         u8 bit_offset;
96         u8 reserved;
97         u64 address;
98 } __attribute__ ((packed));
99
100 struct acpi_processor_px {
101         acpi_integer core_frequency;    /* megahertz */
102         acpi_integer power;     /* milliWatts */
103         acpi_integer transition_latency;        /* microseconds */
104         acpi_integer bus_master_latency;        /* microseconds */
105         acpi_integer control;   /* control value */
106         acpi_integer status;    /* success indicator */
107 };
108
109 struct acpi_processor_performance {
110         unsigned int state;
111         unsigned int platform_limit;
112         struct acpi_pct_register control_register;
113         struct acpi_pct_register status_register;
114         unsigned int state_count;
115         struct acpi_processor_px *states;
116         struct acpi_psd_package domain_info;
117         cpumask_t shared_cpu_map;
118         unsigned int shared_type;
119 };
120
121 /* Throttling Control */
122
123 struct acpi_processor_tx {
124         u16 power;
125         u16 performance;
126 };
127
128 struct acpi_processor_throttling {
129         int state;
130         u32 address;
131         u8 duty_offset;
132         u8 duty_width;
133         int state_count;
134         struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
135 };
136
137 /* Limit Interface */
138
139 struct acpi_processor_lx {
140         int px;                 /* performace state */
141         int tx;                 /* throttle level */
142 };
143
144 struct acpi_processor_limit {
145         struct acpi_processor_lx state; /* current limit */
146         struct acpi_processor_lx thermal;       /* thermal limit */
147         struct acpi_processor_lx user;  /* user limit */
148 };
149
150 struct acpi_processor_flags {
151         u8 power:1;
152         u8 performance:1;
153         u8 throttling:1;
154         u8 limit:1;
155         u8 bm_control:1;
156         u8 bm_check:1;
157         u8 has_cst:1;
158         u8 power_setup_done:1;
159 };
160
161 struct acpi_processor {
162         acpi_handle handle;
163         u32 acpi_id;
164         u32 id;
165         u32 pblk;
166         int performance_platform_limit;
167         struct acpi_processor_flags flags;
168         struct acpi_processor_power power;
169         struct acpi_processor_performance *performance;
170         struct acpi_processor_throttling throttling;
171         struct acpi_processor_limit limit;
172
173         /* the _PDC objects for this processor, if any */
174         struct acpi_object_list *pdc;
175 };
176
177 struct acpi_processor_errata {
178         u8 smp;
179         struct {
180                 u8 throttle:1;
181                 u8 fdma:1;
182                 u8 reserved:6;
183                 u32 bmisx;
184         } piix4;
185 };
186
187 extern int acpi_processor_preregister_performance(
188                 struct acpi_processor_performance **performance);
189
190 extern int acpi_processor_register_performance(struct acpi_processor_performance
191                                                *performance, unsigned int cpu);
192 extern void acpi_processor_unregister_performance(struct
193                                                   acpi_processor_performance
194                                                   *performance,
195                                                   unsigned int cpu);
196
197 /* note: this locks both the calling module and the processor module
198          if a _PPC object exists, rmmod is disallowed then */
199 int acpi_processor_notify_smm(struct module *calling_module);
200
201 /* for communication between multiple parts of the processor kernel module */
202 extern struct acpi_processor *processors[NR_CPUS];
203 extern struct acpi_processor_errata errata;
204
205 void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
206
207 #ifdef ARCH_HAS_POWER_INIT
208 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
209                                         unsigned int cpu);
210 #else
211 static inline void acpi_processor_power_init_bm_check(struct
212                                                       acpi_processor_flags
213                                                       *flags, unsigned int cpu)
214 {
215         flags->bm_check = 1;
216         return;
217 }
218 #endif
219
220 /* in processor_perflib.c */
221
222 #ifdef CONFIG_CPU_FREQ
223 void acpi_processor_ppc_init(void);
224 void acpi_processor_ppc_exit(void);
225 int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
226 #else
227 static inline void acpi_processor_ppc_init(void)
228 {
229         return;
230 }
231 static inline void acpi_processor_ppc_exit(void)
232 {
233         return;
234 }
235 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
236 {
237         static unsigned int printout = 1;
238         if (printout) {
239                 printk(KERN_WARNING
240                        "Warning: Processor Platform Limit event detected, but not handled.\n");
241                 printk(KERN_WARNING
242                        "Consider compiling CPUfreq support into your kernel.\n");
243                 printout = 0;
244         }
245         return 0;
246 }
247 #endif                          /* CONFIG_CPU_FREQ */
248
249 /* in processor_throttling.c */
250 int acpi_processor_get_throttling_info(struct acpi_processor *pr);
251 int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
252 extern struct file_operations acpi_processor_throttling_fops;
253
254 /* in processor_idle.c */
255 int acpi_processor_power_init(struct acpi_processor *pr,
256                               struct acpi_device *device);
257 int acpi_processor_cst_has_changed(struct acpi_processor *pr);
258 int acpi_processor_power_exit(struct acpi_processor *pr,
259                               struct acpi_device *device);
260
261 /* in processor_thermal.c */
262 int acpi_processor_get_limit_info(struct acpi_processor *pr);
263 extern struct file_operations acpi_processor_limit_fops;
264
265 #ifdef CONFIG_CPU_FREQ
266 void acpi_thermal_cpufreq_init(void);
267 void acpi_thermal_cpufreq_exit(void);
268 #else
269 static inline void acpi_thermal_cpufreq_init(void)
270 {
271         return;
272 }
273 static inline void acpi_thermal_cpufreq_exit(void)
274 {
275         return;
276 }
277 #endif
278
279 #endif