aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_throttling.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/processor_throttling.c')
-rw-r--r--drivers/acpi/processor_throttling.c59
1 files changed, 41 insertions, 18 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 3f55d1f90c11..0b8204e7082a 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -47,6 +47,9 @@ ACPI_MODULE_NAME("processor_throttling");
47static int acpi_processor_get_throttling(struct acpi_processor *pr); 47static int acpi_processor_get_throttling(struct acpi_processor *pr);
48int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 48int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
49 49
50/*
51 * _TPC - Throttling Present Capabilities
52 */
50static int acpi_processor_get_platform_limit(struct acpi_processor *pr) 53static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
51{ 54{
52 acpi_status status = 0; 55 acpi_status status = 0;
@@ -55,8 +58,10 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
55 if (!pr) 58 if (!pr)
56 return -EINVAL; 59 return -EINVAL;
57 status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); 60 status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
58 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 61 if (ACPI_FAILURE(status)) {
59 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC")); 62 if (status != AE_NOT_FOUND) {
63 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC"));
64 }
60 return -ENODEV; 65 return -ENODEV;
61 } 66 }
62 pr->throttling_platform_limit = (int)tpc; 67 pr->throttling_platform_limit = (int)tpc;
@@ -68,9 +73,9 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
68 return acpi_processor_get_platform_limit(pr); 73 return acpi_processor_get_platform_limit(pr);
69} 74}
70 75
71/* -------------------------------------------------------------------------- 76/*
72 _PTC, _TSS, _TSD support 77 * _PTC - Processor Throttling Control (and status) register location
73 -------------------------------------------------------------------------- */ 78 */
74static int acpi_processor_get_throttling_control(struct acpi_processor *pr) 79static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
75{ 80{
76 int result = 0; 81 int result = 0;
@@ -81,7 +86,9 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
81 86
82 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); 87 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
83 if (ACPI_FAILURE(status)) { 88 if (ACPI_FAILURE(status)) {
84 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC")); 89 if (status != AE_NOT_FOUND) {
90 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC"));
91 }
85 return -ENODEV; 92 return -ENODEV;
86 } 93 }
87 94
@@ -132,6 +139,10 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
132 139
133 return result; 140 return result;
134} 141}
142
143/*
144 * _TSS - Throttling Supported States
145 */
135static int acpi_processor_get_throttling_states(struct acpi_processor *pr) 146static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
136{ 147{
137 int result = 0; 148 int result = 0;
@@ -144,7 +155,9 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
144 155
145 status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); 156 status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
146 if (ACPI_FAILURE(status)) { 157 if (ACPI_FAILURE(status)) {
147 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS")); 158 if (status != AE_NOT_FOUND) {
159 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS"));
160 }
148 return -ENODEV; 161 return -ENODEV;
149 } 162 }
150 163
@@ -201,6 +214,10 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
201 214
202 return result; 215 return result;
203} 216}
217
218/*
219 * _TSD - T-State Dependencies
220 */
204static int acpi_processor_get_tsd(struct acpi_processor *pr) 221static int acpi_processor_get_tsd(struct acpi_processor *pr)
205{ 222{
206 int result = 0; 223 int result = 0;
@@ -213,6 +230,9 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
213 230
214 status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); 231 status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
215 if (ACPI_FAILURE(status)) { 232 if (ACPI_FAILURE(status)) {
233 if (status != AE_NOT_FOUND) {
234 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSD"));
235 }
216 return -ENODEV; 236 return -ENODEV;
217 } 237 }
218 238
@@ -525,9 +545,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
525 int result = 0; 545 int result = 0;
526 int step = 0; 546 int step = 0;
527 int i = 0; 547 int i = 0;
528 int no_ptc = 0;
529 int no_tss = 0;
530 int no_tsd = 0;
531 548
532 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 549 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
533 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", 550 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
@@ -538,12 +555,14 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
538 if (!pr) 555 if (!pr)
539 return -EINVAL; 556 return -EINVAL;
540 557
541 /* TBD: Support ACPI 2.0 objects */ 558 /*
542 no_ptc = acpi_processor_get_throttling_control(pr); 559 * Evaluate _PTC, _TSS and _TPC
543 no_tss = acpi_processor_get_throttling_states(pr); 560 * They must all be present or none of them can be used.
544 no_tsd = acpi_processor_get_tsd(pr); 561 */
545 562 if (acpi_processor_get_throttling_control(pr) ||
546 if (no_ptc || no_tss) { 563 acpi_processor_get_throttling_states(pr) ||
564 acpi_processor_get_platform_limit(pr))
565 {
547 pr->throttling.acpi_processor_get_throttling = 566 pr->throttling.acpi_processor_get_throttling =
548 &acpi_processor_get_throttling_fadt; 567 &acpi_processor_get_throttling_fadt;
549 pr->throttling.acpi_processor_set_throttling = 568 pr->throttling.acpi_processor_set_throttling =
@@ -555,6 +574,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
555 &acpi_processor_set_throttling_ptc; 574 &acpi_processor_set_throttling_ptc;
556 } 575 }
557 576
577 acpi_processor_get_tsd(pr);
578
558 if (!pr->throttling.address) { 579 if (!pr->throttling.address) {
559 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); 580 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
560 return 0; 581 return 0;
@@ -658,18 +679,20 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq,
658 pr->throttling.state_count - 1); 679 pr->throttling.state_count - 1);
659 680
660 seq_puts(seq, "states:\n"); 681 seq_puts(seq, "states:\n");
661 if (acpi_processor_get_throttling == acpi_processor_get_throttling_fadt) 682 if (pr->throttling.acpi_processor_get_throttling ==
683 acpi_processor_get_throttling_fadt) {
662 for (i = 0; i < pr->throttling.state_count; i++) 684 for (i = 0; i < pr->throttling.state_count; i++)
663 seq_printf(seq, " %cT%d: %02d%%\n", 685 seq_printf(seq, " %cT%d: %02d%%\n",
664 (i == pr->throttling.state ? '*' : ' '), i, 686 (i == pr->throttling.state ? '*' : ' '), i,
665 (pr->throttling.states[i].performance ? pr-> 687 (pr->throttling.states[i].performance ? pr->
666 throttling.states[i].performance / 10 : 0)); 688 throttling.states[i].performance / 10 : 0));
667 else 689 } else {
668 for (i = 0; i < pr->throttling.state_count; i++) 690 for (i = 0; i < pr->throttling.state_count; i++)
669 seq_printf(seq, " %cT%d: %02d%%\n", 691 seq_printf(seq, " %cT%d: %02d%%\n",
670 (i == pr->throttling.state ? '*' : ' '), i, 692 (i == pr->throttling.state ? '*' : ' '), i,
671 (int)pr->throttling.states_tss[i]. 693 (int)pr->throttling.states_tss[i].
672 freqpercentage); 694 freqpercentage);
695 }
673 696
674 end: 697 end:
675 return 0; 698 return 0;