diff options
Diffstat (limited to 'drivers/acpi/processor_throttling.c')
| -rw-r--r-- | drivers/acpi/processor_throttling.c | 410 |
1 files changed, 395 insertions, 15 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index b33486009f41..3f55d1f90c11 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
| @@ -44,17 +44,231 @@ | |||
| 44 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 44 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
| 45 | ACPI_MODULE_NAME("processor_throttling"); | 45 | ACPI_MODULE_NAME("processor_throttling"); |
| 46 | 46 | ||
| 47 | static int acpi_processor_get_throttling(struct acpi_processor *pr); | ||
| 48 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state); | ||
| 49 | |||
| 50 | static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | ||
| 51 | { | ||
| 52 | acpi_status status = 0; | ||
| 53 | unsigned long tpc = 0; | ||
| 54 | |||
| 55 | if (!pr) | ||
| 56 | return -EINVAL; | ||
| 57 | status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); | ||
| 58 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
| 59 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC")); | ||
| 60 | return -ENODEV; | ||
| 61 | } | ||
| 62 | pr->throttling_platform_limit = (int)tpc; | ||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | |||
| 66 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | ||
| 67 | { | ||
| 68 | return acpi_processor_get_platform_limit(pr); | ||
| 69 | } | ||
| 70 | |||
| 71 | /* -------------------------------------------------------------------------- | ||
| 72 | _PTC, _TSS, _TSD support | ||
| 73 | -------------------------------------------------------------------------- */ | ||
| 74 | static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | ||
| 75 | { | ||
| 76 | int result = 0; | ||
| 77 | acpi_status status = 0; | ||
| 78 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 79 | union acpi_object *ptc = NULL; | ||
| 80 | union acpi_object obj = { 0 }; | ||
| 81 | |||
| 82 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); | ||
| 83 | if (ACPI_FAILURE(status)) { | ||
| 84 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC")); | ||
| 85 | return -ENODEV; | ||
| 86 | } | ||
| 87 | |||
| 88 | ptc = (union acpi_object *)buffer.pointer; | ||
| 89 | if (!ptc || (ptc->type != ACPI_TYPE_PACKAGE) | ||
| 90 | || (ptc->package.count != 2)) { | ||
| 91 | printk(KERN_ERR PREFIX "Invalid _PTC data\n"); | ||
| 92 | result = -EFAULT; | ||
| 93 | goto end; | ||
| 94 | } | ||
| 95 | |||
| 96 | /* | ||
| 97 | * control_register | ||
| 98 | */ | ||
| 99 | |||
| 100 | obj = ptc->package.elements[0]; | ||
| 101 | |||
| 102 | if ((obj.type != ACPI_TYPE_BUFFER) | ||
| 103 | || (obj.buffer.length < sizeof(struct acpi_ptc_register)) | ||
| 104 | || (obj.buffer.pointer == NULL)) { | ||
| 105 | printk(KERN_ERR PREFIX | ||
| 106 | "Invalid _PTC data (control_register)\n"); | ||
| 107 | result = -EFAULT; | ||
| 108 | goto end; | ||
| 109 | } | ||
| 110 | memcpy(&pr->throttling.control_register, obj.buffer.pointer, | ||
| 111 | sizeof(struct acpi_ptc_register)); | ||
| 112 | |||
| 113 | /* | ||
| 114 | * status_register | ||
| 115 | */ | ||
| 116 | |||
| 117 | obj = ptc->package.elements[1]; | ||
| 118 | |||
| 119 | if ((obj.type != ACPI_TYPE_BUFFER) | ||
| 120 | || (obj.buffer.length < sizeof(struct acpi_ptc_register)) | ||
| 121 | || (obj.buffer.pointer == NULL)) { | ||
| 122 | printk(KERN_ERR PREFIX "Invalid _PTC data (status_register)\n"); | ||
| 123 | result = -EFAULT; | ||
| 124 | goto end; | ||
| 125 | } | ||
| 126 | |||
| 127 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, | ||
| 128 | sizeof(struct acpi_ptc_register)); | ||
| 129 | |||
| 130 | end: | ||
| 131 | kfree(buffer.pointer); | ||
| 132 | |||
| 133 | return result; | ||
| 134 | } | ||
| 135 | static int acpi_processor_get_throttling_states(struct acpi_processor *pr) | ||
| 136 | { | ||
| 137 | int result = 0; | ||
| 138 | acpi_status status = AE_OK; | ||
| 139 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 140 | struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" }; | ||
| 141 | struct acpi_buffer state = { 0, NULL }; | ||
| 142 | union acpi_object *tss = NULL; | ||
| 143 | int i; | ||
| 144 | |||
| 145 | status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); | ||
| 146 | if (ACPI_FAILURE(status)) { | ||
| 147 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS")); | ||
| 148 | return -ENODEV; | ||
| 149 | } | ||
| 150 | |||
| 151 | tss = buffer.pointer; | ||
| 152 | if (!tss || (tss->type != ACPI_TYPE_PACKAGE)) { | ||
| 153 | printk(KERN_ERR PREFIX "Invalid _TSS data\n"); | ||
| 154 | result = -EFAULT; | ||
| 155 | goto end; | ||
| 156 | } | ||
| 157 | |||
| 158 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", | ||
| 159 | tss->package.count)); | ||
| 160 | |||
| 161 | pr->throttling.state_count = tss->package.count; | ||
| 162 | pr->throttling.states_tss = | ||
| 163 | kmalloc(sizeof(struct acpi_processor_tx_tss) * tss->package.count, | ||
| 164 | GFP_KERNEL); | ||
| 165 | if (!pr->throttling.states_tss) { | ||
| 166 | result = -ENOMEM; | ||
| 167 | goto end; | ||
| 168 | } | ||
| 169 | |||
| 170 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
| 171 | |||
| 172 | struct acpi_processor_tx_tss *tx = | ||
| 173 | (struct acpi_processor_tx_tss *)&(pr->throttling. | ||
| 174 | states_tss[i]); | ||
| 175 | |||
| 176 | state.length = sizeof(struct acpi_processor_tx_tss); | ||
| 177 | state.pointer = tx; | ||
| 178 | |||
| 179 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i)); | ||
| 180 | |||
| 181 | status = acpi_extract_package(&(tss->package.elements[i]), | ||
| 182 | &format, &state); | ||
| 183 | if (ACPI_FAILURE(status)) { | ||
| 184 | ACPI_EXCEPTION((AE_INFO, status, "Invalid _TSS data")); | ||
| 185 | result = -EFAULT; | ||
| 186 | kfree(pr->throttling.states_tss); | ||
| 187 | goto end; | ||
| 188 | } | ||
| 189 | |||
| 190 | if (!tx->freqpercentage) { | ||
| 191 | printk(KERN_ERR PREFIX | ||
| 192 | "Invalid _TSS data: freq is zero\n"); | ||
| 193 | result = -EFAULT; | ||
| 194 | kfree(pr->throttling.states_tss); | ||
| 195 | goto end; | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | end: | ||
| 200 | kfree(buffer.pointer); | ||
| 201 | |||
| 202 | return result; | ||
| 203 | } | ||
| 204 | static int acpi_processor_get_tsd(struct acpi_processor *pr) | ||
| 205 | { | ||
| 206 | int result = 0; | ||
| 207 | acpi_status status = AE_OK; | ||
| 208 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 209 | struct acpi_buffer format = { sizeof("NNNNN"), "NNNNN" }; | ||
| 210 | struct acpi_buffer state = { 0, NULL }; | ||
| 211 | union acpi_object *tsd = NULL; | ||
| 212 | struct acpi_tsd_package *pdomain; | ||
| 213 | |||
| 214 | status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); | ||
| 215 | if (ACPI_FAILURE(status)) { | ||
| 216 | return -ENODEV; | ||
| 217 | } | ||
| 218 | |||
| 219 | tsd = buffer.pointer; | ||
| 220 | if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) { | ||
| 221 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n")); | ||
| 222 | result = -EFAULT; | ||
| 223 | goto end; | ||
| 224 | } | ||
| 225 | |||
| 226 | if (tsd->package.count != 1) { | ||
| 227 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n")); | ||
| 228 | result = -EFAULT; | ||
| 229 | goto end; | ||
| 230 | } | ||
| 231 | |||
| 232 | pdomain = &(pr->throttling.domain_info); | ||
| 233 | |||
| 234 | state.length = sizeof(struct acpi_tsd_package); | ||
| 235 | state.pointer = pdomain; | ||
| 236 | |||
| 237 | status = acpi_extract_package(&(tsd->package.elements[0]), | ||
| 238 | &format, &state); | ||
| 239 | if (ACPI_FAILURE(status)) { | ||
| 240 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n")); | ||
| 241 | result = -EFAULT; | ||
| 242 | goto end; | ||
| 243 | } | ||
| 244 | |||
| 245 | if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) { | ||
| 246 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _TSD:num_entries\n")); | ||
| 247 | result = -EFAULT; | ||
| 248 | goto end; | ||
| 249 | } | ||
| 250 | |||
| 251 | if (pdomain->revision != ACPI_TSD_REV0_REVISION) { | ||
| 252 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _TSD:revision\n")); | ||
| 253 | result = -EFAULT; | ||
| 254 | goto end; | ||
| 255 | } | ||
| 256 | |||
| 257 | end: | ||
| 258 | kfree(buffer.pointer); | ||
| 259 | return result; | ||
| 260 | } | ||
| 261 | |||
| 47 | /* -------------------------------------------------------------------------- | 262 | /* -------------------------------------------------------------------------- |
| 48 | Throttling Control | 263 | Throttling Control |
| 49 | -------------------------------------------------------------------------- */ | 264 | -------------------------------------------------------------------------- */ |
| 50 | static int acpi_processor_get_throttling(struct acpi_processor *pr) | 265 | static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) |
| 51 | { | 266 | { |
| 52 | int state = 0; | 267 | int state = 0; |
| 53 | u32 value = 0; | 268 | u32 value = 0; |
| 54 | u32 duty_mask = 0; | 269 | u32 duty_mask = 0; |
| 55 | u32 duty_value = 0; | 270 | u32 duty_value = 0; |
| 56 | 271 | ||
| 57 | |||
| 58 | if (!pr) | 272 | if (!pr) |
| 59 | return -EINVAL; | 273 | return -EINVAL; |
| 60 | 274 | ||
| @@ -94,13 +308,115 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) | |||
| 94 | return 0; | 308 | return 0; |
| 95 | } | 309 | } |
| 96 | 310 | ||
| 97 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | 311 | static int acpi_read_throttling_status(struct acpi_processor_throttling |
| 312 | *throttling) | ||
| 313 | { | ||
| 314 | int value = -1; | ||
| 315 | switch (throttling->status_register.space_id) { | ||
| 316 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
| 317 | acpi_os_read_port((acpi_io_address) throttling->status_register. | ||
| 318 | address, &value, | ||
| 319 | (u32) throttling->status_register.bit_width * | ||
| 320 | 8); | ||
| 321 | break; | ||
| 322 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | ||
| 323 | printk(KERN_ERR PREFIX | ||
| 324 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 325 | break; | ||
| 326 | default: | ||
| 327 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | ||
| 328 | (u32) (throttling->status_register.space_id)); | ||
| 329 | } | ||
| 330 | return value; | ||
| 331 | } | ||
| 332 | |||
| 333 | static int acpi_write_throttling_state(struct acpi_processor_throttling | ||
| 334 | *throttling, int value) | ||
| 335 | { | ||
| 336 | int ret = -1; | ||
| 337 | |||
| 338 | switch (throttling->control_register.space_id) { | ||
| 339 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
| 340 | acpi_os_write_port((acpi_io_address) throttling-> | ||
| 341 | control_register.address, value, | ||
| 342 | (u32) throttling->control_register. | ||
| 343 | bit_width * 8); | ||
| 344 | ret = 0; | ||
| 345 | break; | ||
| 346 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | ||
| 347 | printk(KERN_ERR PREFIX | ||
| 348 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 349 | break; | ||
| 350 | default: | ||
| 351 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | ||
| 352 | (u32) (throttling->control_register.space_id)); | ||
| 353 | } | ||
| 354 | return ret; | ||
| 355 | } | ||
| 356 | |||
| 357 | static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | ||
| 358 | { | ||
| 359 | int i; | ||
| 360 | |||
| 361 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
| 362 | struct acpi_processor_tx_tss *tx = | ||
| 363 | (struct acpi_processor_tx_tss *)&(pr->throttling. | ||
| 364 | states_tss[i]); | ||
| 365 | if (tx->control == value) | ||
| 366 | break; | ||
| 367 | } | ||
| 368 | if (i > pr->throttling.state_count) | ||
| 369 | i = -1; | ||
| 370 | return i; | ||
| 371 | } | ||
| 372 | |||
| 373 | static int acpi_get_throttling_value(struct acpi_processor *pr, int state) | ||
| 374 | { | ||
| 375 | int value = -1; | ||
| 376 | if (state >= 0 && state <= pr->throttling.state_count) { | ||
| 377 | struct acpi_processor_tx_tss *tx = | ||
| 378 | (struct acpi_processor_tx_tss *)&(pr->throttling. | ||
| 379 | states_tss[state]); | ||
| 380 | value = tx->control; | ||
| 381 | } | ||
| 382 | return value; | ||
| 383 | } | ||
| 384 | |||
| 385 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | ||
| 386 | { | ||
| 387 | int state = 0; | ||
| 388 | u32 value = 0; | ||
| 389 | |||
| 390 | if (!pr) | ||
| 391 | return -EINVAL; | ||
| 392 | |||
| 393 | if (!pr->flags.throttling) | ||
| 394 | return -ENODEV; | ||
| 395 | |||
| 396 | pr->throttling.state = 0; | ||
| 397 | local_irq_disable(); | ||
| 398 | value = acpi_read_throttling_status(&pr->throttling); | ||
| 399 | if (value >= 0) { | ||
| 400 | state = acpi_get_throttling_state(pr, value); | ||
| 401 | pr->throttling.state = state; | ||
| 402 | } | ||
| 403 | local_irq_enable(); | ||
| 404 | |||
| 405 | return 0; | ||
| 406 | } | ||
| 407 | |||
| 408 | static int acpi_processor_get_throttling(struct acpi_processor *pr) | ||
| 409 | { | ||
| 410 | return pr->throttling.acpi_processor_get_throttling(pr); | ||
| 411 | } | ||
| 412 | |||
| 413 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | ||
| 414 | int state) | ||
| 98 | { | 415 | { |
| 99 | u32 value = 0; | 416 | u32 value = 0; |
| 100 | u32 duty_mask = 0; | 417 | u32 duty_mask = 0; |
| 101 | u32 duty_value = 0; | 418 | u32 duty_value = 0; |
| 102 | 419 | ||
| 103 | |||
| 104 | if (!pr) | 420 | if (!pr) |
| 105 | return -EINVAL; | 421 | return -EINVAL; |
| 106 | 422 | ||
| @@ -113,6 +429,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
| 113 | if (state == pr->throttling.state) | 429 | if (state == pr->throttling.state) |
| 114 | return 0; | 430 | return 0; |
| 115 | 431 | ||
| 432 | if (state < pr->throttling_platform_limit) | ||
| 433 | return -EPERM; | ||
| 116 | /* | 434 | /* |
| 117 | * Calculate the duty_value and duty_mask. | 435 | * Calculate the duty_value and duty_mask. |
| 118 | */ | 436 | */ |
| @@ -165,12 +483,51 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
| 165 | return 0; | 483 | return 0; |
| 166 | } | 484 | } |
| 167 | 485 | ||
| 486 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | ||
| 487 | int state) | ||
| 488 | { | ||
| 489 | u32 value = 0; | ||
| 490 | |||
| 491 | if (!pr) | ||
| 492 | return -EINVAL; | ||
| 493 | |||
| 494 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) | ||
| 495 | return -EINVAL; | ||
| 496 | |||
| 497 | if (!pr->flags.throttling) | ||
| 498 | return -ENODEV; | ||
| 499 | |||
| 500 | if (state == pr->throttling.state) | ||
| 501 | return 0; | ||
| 502 | |||
| 503 | if (state < pr->throttling_platform_limit) | ||
| 504 | return -EPERM; | ||
| 505 | |||
| 506 | local_irq_disable(); | ||
| 507 | |||
| 508 | value = acpi_get_throttling_value(pr, state); | ||
| 509 | if (value >= 0) { | ||
| 510 | acpi_write_throttling_state(&pr->throttling, value); | ||
| 511 | pr->throttling.state = state; | ||
| 512 | } | ||
| 513 | local_irq_enable(); | ||
| 514 | |||
| 515 | return 0; | ||
| 516 | } | ||
| 517 | |||
| 518 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | ||
| 519 | { | ||
| 520 | return pr->throttling.acpi_processor_set_throttling(pr, state); | ||
| 521 | } | ||
| 522 | |||
| 168 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) | 523 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |
| 169 | { | 524 | { |
| 170 | int result = 0; | 525 | int result = 0; |
| 171 | int step = 0; | 526 | int step = 0; |
| 172 | int i = 0; | 527 | int i = 0; |
| 173 | 528 | int no_ptc = 0; | |
| 529 | int no_tss = 0; | ||
| 530 | int no_tsd = 0; | ||
| 174 | 531 | ||
| 175 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 532 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 176 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 533 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
| @@ -182,6 +539,21 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
| 182 | return -EINVAL; | 539 | return -EINVAL; |
| 183 | 540 | ||
| 184 | /* TBD: Support ACPI 2.0 objects */ | 541 | /* TBD: Support ACPI 2.0 objects */ |
| 542 | no_ptc = acpi_processor_get_throttling_control(pr); | ||
| 543 | no_tss = acpi_processor_get_throttling_states(pr); | ||
| 544 | no_tsd = acpi_processor_get_tsd(pr); | ||
| 545 | |||
| 546 | if (no_ptc || no_tss) { | ||
| 547 | pr->throttling.acpi_processor_get_throttling = | ||
| 548 | &acpi_processor_get_throttling_fadt; | ||
| 549 | pr->throttling.acpi_processor_set_throttling = | ||
| 550 | &acpi_processor_set_throttling_fadt; | ||
| 551 | } else { | ||
| 552 | pr->throttling.acpi_processor_get_throttling = | ||
| 553 | &acpi_processor_get_throttling_ptc; | ||
| 554 | pr->throttling.acpi_processor_set_throttling = | ||
| 555 | &acpi_processor_set_throttling_ptc; | ||
| 556 | } | ||
| 185 | 557 | ||
| 186 | if (!pr->throttling.address) { | 558 | if (!pr->throttling.address) { |
| 187 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | 559 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); |
| @@ -262,7 +634,6 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, | |||
| 262 | int i = 0; | 634 | int i = 0; |
| 263 | int result = 0; | 635 | int result = 0; |
| 264 | 636 | ||
| 265 | |||
| 266 | if (!pr) | 637 | if (!pr) |
| 267 | goto end; | 638 | goto end; |
| 268 | 639 | ||
| @@ -280,15 +651,25 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, | |||
| 280 | } | 651 | } |
| 281 | 652 | ||
| 282 | seq_printf(seq, "state count: %d\n" | 653 | seq_printf(seq, "state count: %d\n" |
| 283 | "active state: T%d\n", | 654 | "active state: T%d\n" |
| 284 | pr->throttling.state_count, pr->throttling.state); | 655 | "state available: T%d to T%d\n", |
| 656 | pr->throttling.state_count, pr->throttling.state, | ||
| 657 | pr->throttling_platform_limit, | ||
| 658 | pr->throttling.state_count - 1); | ||
| 285 | 659 | ||
| 286 | seq_puts(seq, "states:\n"); | 660 | seq_puts(seq, "states:\n"); |
| 287 | for (i = 0; i < pr->throttling.state_count; i++) | 661 | if (acpi_processor_get_throttling == acpi_processor_get_throttling_fadt) |
| 288 | seq_printf(seq, " %cT%d: %02d%%\n", | 662 | for (i = 0; i < pr->throttling.state_count; i++) |
| 289 | (i == pr->throttling.state ? '*' : ' '), i, | 663 | seq_printf(seq, " %cT%d: %02d%%\n", |
| 290 | (pr->throttling.states[i].performance ? pr-> | 664 | (i == pr->throttling.state ? '*' : ' '), i, |
| 291 | throttling.states[i].performance / 10 : 0)); | 665 | (pr->throttling.states[i].performance ? pr-> |
| 666 | throttling.states[i].performance / 10 : 0)); | ||
| 667 | else | ||
| 668 | for (i = 0; i < pr->throttling.state_count; i++) | ||
| 669 | seq_printf(seq, " %cT%d: %02d%%\n", | ||
| 670 | (i == pr->throttling.state ? '*' : ' '), i, | ||
| 671 | (int)pr->throttling.states_tss[i]. | ||
| 672 | freqpercentage); | ||
| 292 | 673 | ||
| 293 | end: | 674 | end: |
| 294 | return 0; | 675 | return 0; |
| @@ -301,7 +682,7 @@ static int acpi_processor_throttling_open_fs(struct inode *inode, | |||
| 301 | PDE(inode)->data); | 682 | PDE(inode)->data); |
| 302 | } | 683 | } |
| 303 | 684 | ||
| 304 | static ssize_t acpi_processor_write_throttling(struct file * file, | 685 | static ssize_t acpi_processor_write_throttling(struct file *file, |
| 305 | const char __user * buffer, | 686 | const char __user * buffer, |
| 306 | size_t count, loff_t * data) | 687 | size_t count, loff_t * data) |
| 307 | { | 688 | { |
| @@ -310,7 +691,6 @@ static ssize_t acpi_processor_write_throttling(struct file * file, | |||
| 310 | struct acpi_processor *pr = m->private; | 691 | struct acpi_processor *pr = m->private; |
| 311 | char state_string[12] = { '\0' }; | 692 | char state_string[12] = { '\0' }; |
| 312 | 693 | ||
| 313 | |||
| 314 | if (!pr || (count > sizeof(state_string) - 1)) | 694 | if (!pr || (count > sizeof(state_string) - 1)) |
| 315 | return -EINVAL; | 695 | return -EINVAL; |
| 316 | 696 | ||
