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