Blame view

include/acpi/processor.h 8.9 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
  #ifndef __ACPI_PROCESSOR_H
  #define __ACPI_PROCESSOR_H
  
  #include <linux/kernel.h>
3b2d99429   Venkatesh Pallipadi   P-state software ...
5
  #include <linux/cpu.h>
4f86d3a8e   Len Brown   cpuidle: consolid...
6
  #include <linux/cpuidle.h>
d9460fd22   Zhang Rui   ACPI: register AC...
7
  #include <linux/thermal.h>
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
8
  #include <asm/acpi.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
9
10
11
12
13
14
15
16
17
  #define ACPI_PROCESSOR_BUSY_METRIC	10
  
  #define ACPI_PROCESSOR_MAX_POWER	8
  #define ACPI_PROCESSOR_MAX_C2_LATENCY	100
  #define ACPI_PROCESSOR_MAX_C3_LATENCY	1000
  
  #define ACPI_PROCESSOR_MAX_THROTTLING	16
  #define ACPI_PROCESSOR_MAX_THROTTLE	250	/* 25% */
  #define ACPI_PROCESSOR_MAX_DUTY_WIDTH	4
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
18
  #define ACPI_PDC_REVISION_ID		0x1
fd3509436   Len Brown   ACPICA: Lindent
19
  #define ACPI_PSD_REV0_REVISION		0	/* Support for _PSD as in ACPI 3.0 */
3b2d99429   Venkatesh Pallipadi   P-state software ...
20
  #define ACPI_PSD_REV0_ENTRIES		5
01854e697   Luming Yu   ACPI: add ACPI 3....
21
22
  #define ACPI_TSD_REV0_REVISION		0	/* Support for _PSD as in ACPI 3.0 */
  #define ACPI_TSD_REV0_ENTRIES		5
3b2d99429   Venkatesh Pallipadi   P-state software ...
23
24
25
26
27
28
29
  /*
   * Types of coordination defined in ACPI 3.0. Same macros can be used across
   * P, C and T states
   */
  #define DOMAIN_COORD_TYPE_SW_ALL	0xfc
  #define DOMAIN_COORD_TYPE_SW_ANY	0xfd
  #define DOMAIN_COORD_TYPE_HW_ALL	0xfe
4fcb2fcd4   Venkatesh Pallipadi   ACPI, cpuidle: Cl...
30
31
32
33
34
  #define ACPI_CSTATE_SYSTEMIO	0
  #define ACPI_CSTATE_FFH		1
  #define ACPI_CSTATE_HALT	2
  
  #define ACPI_CX_DESC_LEN	32
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
35

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36
37
38
39
40
  /* Power Management */
  
  struct acpi_processor_cx;
  
  struct acpi_power_register {
4be44fcd3   Len Brown   [ACPI] Lindent al...
41
42
43
44
45
  	u8 descriptor;
  	u16 length;
  	u8 space_id;
  	u8 bit_width;
  	u8 bit_offset;
718be4aaf   Len Brown   ACPI: skip checki...
46
  	u8 access_size;
4be44fcd3   Len Brown   [ACPI] Lindent al...
47
  	u64 address;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
  } __attribute__ ((packed));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
  struct acpi_processor_cx {
4be44fcd3   Len Brown   [ACPI] Lindent al...
50
51
52
  	u8 valid;
  	u8 type;
  	u32 address;
bc71bec91   venkatesh.pallipadi@intel.com   ACPI: enable MWAI...
53
  	u8 entry_method;
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
54
  	u8 index;
4be44fcd3   Len Brown   [ACPI] Lindent al...
55
56
57
58
  	u32 latency;
  	u32 latency_ticks;
  	u32 power;
  	u32 usage;
a3c6598f9   Dominik Brodowski   ACPI: C-States: a...
59
  	u64 time;
718be4aaf   Len Brown   ACPI: skip checki...
60
  	u8 bm_sts_skip;
4fcb2fcd4   Venkatesh Pallipadi   ACPI, cpuidle: Cl...
61
  	char desc[ACPI_CX_DESC_LEN];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62
63
64
  };
  
  struct acpi_processor_power {
4f86d3a8e   Len Brown   cpuidle: consolid...
65
  	struct cpuidle_device dev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
  	struct acpi_processor_cx *state;
4be44fcd3   Len Brown   [ACPI] Lindent al...
67
68
  	unsigned long bm_check_timestamp;
  	u32 default_state;
4be44fcd3   Len Brown   [ACPI] Lindent al...
69
  	int count;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
  	struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
169a0abbe   Thomas Gleixner   [PATCH] ACPI keep...
71
  	int timer_broadcast_on_state;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
73
74
  };
  
  /* Performance Management */
3b2d99429   Venkatesh Pallipadi   P-state software ...
75
  struct acpi_psd_package {
439913fff   Lin Ming   ACPI: replace acp...
76
77
78
79
80
  	u64 num_entries;
  	u64 revision;
  	u64 domain;
  	u64 coord_type;
  	u64 num_processors;
3b2d99429   Venkatesh Pallipadi   P-state software ...
81
  } __attribute__ ((packed));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
  struct acpi_pct_register {
4be44fcd3   Len Brown   [ACPI] Lindent al...
83
84
85
86
87
88
89
  	u8 descriptor;
  	u16 length;
  	u8 space_id;
  	u8 bit_width;
  	u8 bit_offset;
  	u8 reserved;
  	u64 address;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
92
  } __attribute__ ((packed));
  
  struct acpi_processor_px {
439913fff   Lin Ming   ACPI: replace acp...
93
94
95
96
97
98
  	u64 core_frequency;	/* megahertz */
  	u64 power;	/* milliWatts */
  	u64 transition_latency;	/* microseconds */
  	u64 bus_master_latency;	/* microseconds */
  	u64 control;	/* control value */
  	u64 status;	/* success indicator */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
99
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
100
  struct acpi_processor_performance {
4be44fcd3   Len Brown   [ACPI] Lindent al...
101
102
  	unsigned int state;
  	unsigned int platform_limit;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
103
104
  	struct acpi_pct_register control_register;
  	struct acpi_pct_register status_register;
4be44fcd3   Len Brown   [ACPI] Lindent al...
105
  	unsigned int state_count;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
106
  	struct acpi_processor_px *states;
3b2d99429   Venkatesh Pallipadi   P-state software ...
107
  	struct acpi_psd_package domain_info;
2fdf66b49   Rusty Russell   cpumask: convert ...
108
  	cpumask_var_t shared_cpu_map;
3b2d99429   Venkatesh Pallipadi   P-state software ...
109
  	unsigned int shared_type;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
110
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
  /* Throttling Control */
01854e697   Luming Yu   ACPI: add ACPI 3....
112
  struct acpi_tsd_package {
439913fff   Lin Ming   ACPI: replace acp...
113
114
115
116
117
  	u64 num_entries;
  	u64 revision;
  	u64 domain;
  	u64 coord_type;
  	u64 num_processors;
01854e697   Luming Yu   ACPI: add ACPI 3....
118
119
120
121
122
123
124
125
126
127
128
129
130
  } __attribute__ ((packed));
  
  struct acpi_ptc_register {
  	u8 descriptor;
  	u16 length;
  	u8 space_id;
  	u8 bit_width;
  	u8 bit_offset;
  	u8 reserved;
  	u64 address;
  } __attribute__ ((packed));
  
  struct acpi_processor_tx_tss {
439913fff   Lin Ming   ACPI: replace acp...
131
132
133
134
135
  	u64 freqpercentage;	/* */
  	u64 power;	/* milliWatts */
  	u64 transition_latency;	/* microseconds */
  	u64 control;	/* control value */
  	u64 status;	/* success indicator */
01854e697   Luming Yu   ACPI: add ACPI 3....
136
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137
  struct acpi_processor_tx {
4be44fcd3   Len Brown   [ACPI] Lindent al...
138
139
  	u16 power;
  	u16 performance;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
  };
01854e697   Luming Yu   ACPI: add ACPI 3....
141
  struct acpi_processor;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
142
  struct acpi_processor_throttling {
01854e697   Luming Yu   ACPI: add ACPI 3....
143
144
145
146
147
148
149
  	unsigned int state;
  	unsigned int platform_limit;
  	struct acpi_pct_register control_register;
  	struct acpi_pct_register status_register;
  	unsigned int state_count;
  	struct acpi_processor_tx_tss *states_tss;
  	struct acpi_tsd_package domain_info;
2fdf66b49   Rusty Russell   cpumask: convert ...
150
  	cpumask_var_t shared_cpu_map;
ff55a9ceb   Len Brown   ACPI: Lindent pro...
151
152
  	int (*acpi_processor_get_throttling) (struct acpi_processor * pr);
  	int (*acpi_processor_set_throttling) (struct acpi_processor * pr,
2a908002c   Frans Pop   ACPI processor: f...
153
  					      int state, bool force);
01854e697   Luming Yu   ACPI: add ACPI 3....
154

4be44fcd3   Len Brown   [ACPI] Lindent al...
155
156
157
  	u32 address;
  	u8 duty_offset;
  	u8 duty_width;
1180509f6   Zhao Yakui   ACPI : Update T-s...
158
159
  	u8 tsd_valid_flag;
  	unsigned int shared_type;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
160
161
162
163
164
165
  	struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
  };
  
  /* Limit Interface */
  
  struct acpi_processor_lx {
aee07ba68   Joe Perches   include/acpi/: Sp...
166
  	int px;			/* performance state */
4be44fcd3   Len Brown   [ACPI] Lindent al...
167
  	int tx;			/* throttle level */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
168
169
170
  };
  
  struct acpi_processor_limit {
4be44fcd3   Len Brown   [ACPI] Lindent al...
171
  	struct acpi_processor_lx state;	/* current limit */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
172
  	struct acpi_processor_lx thermal;	/* thermal limit */
4be44fcd3   Len Brown   [ACPI] Lindent al...
173
  	struct acpi_processor_lx user;	/* user limit */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
174
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
175
  struct acpi_processor_flags {
4be44fcd3   Len Brown   [ACPI] Lindent al...
176
177
178
179
180
181
182
183
  	u8 power:1;
  	u8 performance:1;
  	u8 throttling:1;
  	u8 limit:1;
  	u8 bm_control:1;
  	u8 bm_check:1;
  	u8 has_cst:1;
  	u8 power_setup_done:1;
4f86d3a8e   Len Brown   cpuidle: consolid...
184
  	u8 bm_rld_set:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
185
186
187
  };
  
  struct acpi_processor {
4be44fcd3   Len Brown   [ACPI] Lindent al...
188
189
190
191
192
  	acpi_handle handle;
  	u32 acpi_id;
  	u32 id;
  	u32 pblk;
  	int performance_platform_limit;
01854e697   Luming Yu   ACPI: add ACPI 3....
193
  	int throttling_platform_limit;
ff55a9ceb   Len Brown   ACPI: Lindent pro...
194
  	/* 0 - states 0..n-th state available */
01854e697   Luming Yu   ACPI: add ACPI 3....
195

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
196
197
198
199
200
  	struct acpi_processor_flags flags;
  	struct acpi_processor_power power;
  	struct acpi_processor_performance *performance;
  	struct acpi_processor_throttling throttling;
  	struct acpi_processor_limit limit;
d9460fd22   Zhang Rui   ACPI: register AC...
201
  	struct thermal_cooling_device *cdev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
202
203
204
  };
  
  struct acpi_processor_errata {
4be44fcd3   Len Brown   [ACPI] Lindent al...
205
  	u8 smp;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
206
  	struct {
4be44fcd3   Len Brown   [ACPI] Lindent al...
207
208
209
210
211
  		u8 throttle:1;
  		u8 fdma:1;
  		u8 reserved:6;
  		u32 bmisx;
  	} piix4;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
212
  };
fd3509436   Len Brown   ACPICA: Lindent
213
214
  extern int acpi_processor_preregister_performance(struct
  						  acpi_processor_performance
a29d8b8e2   Tejun Heo   percpu: add __per...
215
  						  __percpu *performance);
3b2d99429   Venkatesh Pallipadi   P-state software ...
216

4be44fcd3   Len Brown   [ACPI] Lindent al...
217
218
219
220
221
222
  extern int acpi_processor_register_performance(struct acpi_processor_performance
  					       *performance, unsigned int cpu);
  extern void acpi_processor_unregister_performance(struct
  						  acpi_processor_performance
  						  *performance,
  						  unsigned int cpu);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
223
224
225
226
  
  /* note: this locks both the calling module and the processor module
           if a _PPC object exists, rmmod is disallowed then */
  int acpi_processor_notify_smm(struct module *calling_module);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
227
  /* for communication between multiple parts of the processor kernel module */
706546d02   Mike Travis   ACPI: change proc...
228
  DECLARE_PER_CPU(struct acpi_processor *, processors);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
229
  extern struct acpi_processor_errata errata;
05131ecc9   Venkatesh Pallipadi   [ACPI] Avoid BIOS...
230
  #ifdef ARCH_HAS_POWER_INIT
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
231
  void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
4be44fcd3   Len Brown   [ACPI] Lindent al...
232
  					unsigned int cpu);
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
233
  int acpi_processor_ffh_cstate_probe(unsigned int cpu,
fd3509436   Len Brown   ACPICA: Lindent
234
235
  				    struct acpi_processor_cx *cx,
  				    struct acpi_power_register *reg);
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
236
  void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
237
  #else
4be44fcd3   Len Brown   [ACPI] Lindent al...
238
239
240
  static inline void acpi_processor_power_init_bm_check(struct
  						      acpi_processor_flags
  						      *flags, unsigned int cpu)
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
241
242
243
244
  {
  	flags->bm_check = 1;
  	return;
  }
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
245
  static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu,
fd3509436   Len Brown   ACPICA: Lindent
246
247
248
  						  struct acpi_processor_cx *cx,
  						  struct acpi_power_register
  						  *reg)
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
249
250
251
  {
  	return -1;
  }
fd3509436   Len Brown   ACPICA: Lindent
252
253
  static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
  						   *cstate)
991528d73   Venkatesh Pallipadi   ACPI: Processor n...
254
255
256
  {
  	return;
  }
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
257
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
258
  /* in processor_perflib.c */
02df8b938   Venkatesh Pallipadi   [ACPI] enable C2 ...
259

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
260
261
262
  #ifdef CONFIG_CPU_FREQ
  void acpi_processor_ppc_init(void);
  void acpi_processor_ppc_exit(void);
d81c45e1c   Zhao Yakui   ACPI: Notify the ...
263
  int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag);
e2f74f355   Thomas Renninger   [ACPI/CPUFREQ] In...
264
  extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
265
  #else
4be44fcd3   Len Brown   [ACPI] Lindent al...
266
267
268
269
270
271
272
273
  static inline void acpi_processor_ppc_init(void)
  {
  	return;
  }
  static inline void acpi_processor_ppc_exit(void)
  {
  	return;
  }
d81c45e1c   Zhao Yakui   ACPI: Notify the ...
274
275
  static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr,
  								int event_flag)
4be44fcd3   Len Brown   [ACPI] Lindent al...
276
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
277
278
  	static unsigned int printout = 1;
  	if (printout) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
279
280
281
282
283
284
  		printk(KERN_WARNING
  		       "Warning: Processor Platform Limit event detected, but not handled.
  ");
  		printk(KERN_WARNING
  		       "Consider compiling CPUfreq support into your kernel.
  ");
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
285
286
287
288
  		printout = 0;
  	}
  	return 0;
  }
e2f74f355   Thomas Renninger   [ACPI/CPUFREQ] In...
289
290
291
292
  static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
  {
  	return -ENODEV;
  }
4be44fcd3   Len Brown   [ACPI] Lindent al...
293
  #endif				/* CONFIG_CPU_FREQ */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
294

4d5d4cd88   Alex Chiang   ACPI: processor: ...
295
  /* in processor_core.c */
43bab25ce   Alex Chiang   ACPI: processor: ...
296
  void acpi_processor_set_pdc(acpi_handle handle);
2e9d5e4ef   Alex Chiang   ACPI: processor: ...
297
  int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
78f169965   Alex Chiang   ACPI: processor: ...
298

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
299
  /* in processor_throttling.c */
a66b34b26   Adrian Bunk   proper prototype ...
300
  int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
4be44fcd3   Len Brown   [ACPI] Lindent al...
301
  int acpi_processor_get_throttling_info(struct acpi_processor *pr);
2a908002c   Frans Pop   ACPI processor: f...
302
303
  extern int acpi_processor_set_throttling(struct acpi_processor *pr,
  					 int state, bool force);
5a344a505   Zhao Yakui   ACPI: Reevaluate ...
304
305
306
307
308
309
  /*
   * Reevaluate whether the T-state is invalid after one cpu is
   * onlined/offlined. In such case the flags.throttling will be updated.
   */
  extern void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
  			unsigned long action);
070d8eb1f   Jan Engelhardt   ACPI: constify VF...
310
  extern const struct file_operations acpi_processor_throttling_fops;
1180509f6   Zhao Yakui   ACPI : Update T-s...
311
  extern void acpi_processor_throttling_init(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
312
  /* in processor_idle.c */
4be44fcd3   Len Brown   [ACPI] Lindent al...
313
314
315
  int acpi_processor_power_init(struct acpi_processor *pr,
  			      struct acpi_device *device);
  int acpi_processor_cst_has_changed(struct acpi_processor *pr);
46bcfad7a   Deepthi Dharwar   cpuidle: Single/G...
316
  int acpi_processor_hotplug(struct acpi_processor *pr);
4be44fcd3   Len Brown   [ACPI] Lindent al...
317
318
  int acpi_processor_power_exit(struct acpi_processor *pr,
  			      struct acpi_device *device);
b04e7bdb9   Thomas Gleixner   ACPI: disable low...
319
320
  int acpi_processor_suspend(struct acpi_device * device, pm_message_t state);
  int acpi_processor_resume(struct acpi_device * device);
4f86d3a8e   Len Brown   cpuidle: consolid...
321
  extern struct cpuidle_driver acpi_idle_driver;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
322
323
  
  /* in processor_thermal.c */
4be44fcd3   Len Brown   [ACPI] Lindent al...
324
  int acpi_processor_get_limit_info(struct acpi_processor *pr);
9c8b04be4   Vasiliy Kulikov   ACPI: constify op...
325
  extern const struct thermal_cooling_device_ops processor_cooling_ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
326
327
328
329
  #ifdef CONFIG_CPU_FREQ
  void acpi_thermal_cpufreq_init(void);
  void acpi_thermal_cpufreq_exit(void);
  #else
4be44fcd3   Len Brown   [ACPI] Lindent al...
330
331
332
333
334
335
336
337
  static inline void acpi_thermal_cpufreq_init(void)
  {
  	return;
  }
  static inline void acpi_thermal_cpufreq_exit(void)
  {
  	return;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
338
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
339
  #endif