aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_idle.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/processor_idle.c')
-rw-r--r--drivers/acpi/processor_idle.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 10a2d913635a..0efa59e7e3af 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -139,7 +139,7 @@ static void acpi_safe_halt(void)
139 * are affected too. We pick the most conservative approach: we assume 139 * are affected too. We pick the most conservative approach: we assume
140 * that the local APIC stops in both C2 and C3. 140 * that the local APIC stops in both C2 and C3.
141 */ 141 */
142static void acpi_timer_check_state(int state, struct acpi_processor *pr, 142static void lapic_timer_check_state(int state, struct acpi_processor *pr,
143 struct acpi_processor_cx *cx) 143 struct acpi_processor_cx *cx)
144{ 144{
145 struct acpi_processor_power *pwr = &pr->power; 145 struct acpi_processor_power *pwr = &pr->power;
@@ -162,7 +162,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
162 pr->power.timer_broadcast_on_state = state; 162 pr->power.timer_broadcast_on_state = state;
163} 163}
164 164
165static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) 165static void lapic_timer_propagate_broadcast(struct acpi_processor *pr)
166{ 166{
167 unsigned long reason; 167 unsigned long reason;
168 168
@@ -173,7 +173,7 @@ static void acpi_propagate_timer_broadcast(struct acpi_processor *pr)
173} 173}
174 174
175/* Power(C) State timer broadcast control */ 175/* Power(C) State timer broadcast control */
176static void acpi_state_timer_broadcast(struct acpi_processor *pr, 176static void lapic_timer_state_broadcast(struct acpi_processor *pr,
177 struct acpi_processor_cx *cx, 177 struct acpi_processor_cx *cx,
178 int broadcast) 178 int broadcast)
179{ 179{
@@ -190,10 +190,10 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
190 190
191#else 191#else
192 192
193static void acpi_timer_check_state(int state, struct acpi_processor *pr, 193static void lapic_timer_check_state(int state, struct acpi_processor *pr,
194 struct acpi_processor_cx *cstate) { } 194 struct acpi_processor_cx *cstate) { }
195static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) { } 195static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
196static void acpi_state_timer_broadcast(struct acpi_processor *pr, 196static void lapic_timer_state_broadcast(struct acpi_processor *pr,
197 struct acpi_processor_cx *cx, 197 struct acpi_processor_cx *cx,
198 int broadcast) 198 int broadcast)
199{ 199{
@@ -515,7 +515,8 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
515static void acpi_processor_power_verify_c3(struct acpi_processor *pr, 515static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
516 struct acpi_processor_cx *cx) 516 struct acpi_processor_cx *cx)
517{ 517{
518 static int bm_check_flag; 518 static int bm_check_flag = -1;
519 static int bm_control_flag = -1;
519 520
520 521
521 if (!cx->address) 522 if (!cx->address)
@@ -545,12 +546,14 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
545 } 546 }
546 547
547 /* All the logic here assumes flags.bm_check is same across all CPUs */ 548 /* All the logic here assumes flags.bm_check is same across all CPUs */
548 if (!bm_check_flag) { 549 if (bm_check_flag == -1) {
549 /* Determine whether bm_check is needed based on CPU */ 550 /* Determine whether bm_check is needed based on CPU */
550 acpi_processor_power_init_bm_check(&(pr->flags), pr->id); 551 acpi_processor_power_init_bm_check(&(pr->flags), pr->id);
551 bm_check_flag = pr->flags.bm_check; 552 bm_check_flag = pr->flags.bm_check;
553 bm_control_flag = pr->flags.bm_control;
552 } else { 554 } else {
553 pr->flags.bm_check = bm_check_flag; 555 pr->flags.bm_check = bm_check_flag;
556 pr->flags.bm_control = bm_control_flag;
554 } 557 }
555 558
556 if (pr->flags.bm_check) { 559 if (pr->flags.bm_check) {
@@ -614,29 +617,25 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
614 switch (cx->type) { 617 switch (cx->type) {
615 case ACPI_STATE_C1: 618 case ACPI_STATE_C1:
616 cx->valid = 1; 619 cx->valid = 1;
617 acpi_timer_check_state(i, pr, cx);
618 break; 620 break;
619 621
620 case ACPI_STATE_C2: 622 case ACPI_STATE_C2:
621 acpi_processor_power_verify_c2(cx); 623 acpi_processor_power_verify_c2(cx);
622 if (cx->valid)
623 acpi_timer_check_state(i, pr, cx);
624 break; 624 break;
625 625
626 case ACPI_STATE_C3: 626 case ACPI_STATE_C3:
627 acpi_processor_power_verify_c3(pr, cx); 627 acpi_processor_power_verify_c3(pr, cx);
628 if (cx->valid)
629 acpi_timer_check_state(i, pr, cx);
630 break; 628 break;
631 } 629 }
632 if (cx->valid) 630 if (!cx->valid)
633 tsc_check_state(cx->type); 631 continue;
634 632
635 if (cx->valid) 633 lapic_timer_check_state(i, pr, cx);
636 working++; 634 tsc_check_state(cx->type);
635 working++;
637 } 636 }
638 637
639 acpi_propagate_timer_broadcast(pr); 638 lapic_timer_propagate_broadcast(pr);
640 639
641 return (working); 640 return (working);
642} 641}
@@ -839,7 +838,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
839 return 0; 838 return 0;
840 } 839 }
841 840
842 acpi_state_timer_broadcast(pr, cx, 1); 841 lapic_timer_state_broadcast(pr, cx, 1);
843 kt1 = ktime_get_real(); 842 kt1 = ktime_get_real();
844 acpi_idle_do_entry(cx); 843 acpi_idle_do_entry(cx);
845 kt2 = ktime_get_real(); 844 kt2 = ktime_get_real();
@@ -847,7 +846,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
847 846
848 local_irq_enable(); 847 local_irq_enable();
849 cx->usage++; 848 cx->usage++;
850 acpi_state_timer_broadcast(pr, cx, 0); 849 lapic_timer_state_broadcast(pr, cx, 0);
851 850
852 return idle_time; 851 return idle_time;
853} 852}
@@ -892,7 +891,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
892 * Must be done before busmaster disable as we might need to 891 * Must be done before busmaster disable as we might need to
893 * access HPET ! 892 * access HPET !
894 */ 893 */
895 acpi_state_timer_broadcast(pr, cx, 1); 894 lapic_timer_state_broadcast(pr, cx, 1);
896 895
897 if (cx->type == ACPI_STATE_C3) 896 if (cx->type == ACPI_STATE_C3)
898 ACPI_FLUSH_CPU_CACHE(); 897 ACPI_FLUSH_CPU_CACHE();
@@ -914,7 +913,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
914 913
915 cx->usage++; 914 cx->usage++;
916 915
917 acpi_state_timer_broadcast(pr, cx, 0); 916 lapic_timer_state_broadcast(pr, cx, 0);
918 cx->time += sleep_ticks; 917 cx->time += sleep_ticks;
919 return idle_time; 918 return idle_time;
920} 919}
@@ -981,7 +980,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
981 * Must be done before busmaster disable as we might need to 980 * Must be done before busmaster disable as we might need to
982 * access HPET ! 981 * access HPET !
983 */ 982 */
984 acpi_state_timer_broadcast(pr, cx, 1); 983 lapic_timer_state_broadcast(pr, cx, 1);
985 984
986 kt1 = ktime_get_real(); 985 kt1 = ktime_get_real();
987 /* 986 /*
@@ -1026,7 +1025,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1026 1025
1027 cx->usage++; 1026 cx->usage++;
1028 1027
1029 acpi_state_timer_broadcast(pr, cx, 0); 1028 lapic_timer_state_broadcast(pr, cx, 0);
1030 cx->time += sleep_ticks; 1029 cx->time += sleep_ticks;
1031 return idle_time; 1030 return idle_time;
1032} 1031}