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