diff options
Diffstat (limited to 'drivers/acpi/processor_idle.c')
-rw-r--r-- | drivers/acpi/processor_idle.c | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 786851da85c6..89d3fd4c3cd2 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -517,10 +517,9 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) | |||
517 | struct acpi_processor_cx *higher = NULL; | 517 | struct acpi_processor_cx *higher = NULL; |
518 | struct acpi_processor_cx *cx; | 518 | struct acpi_processor_cx *cx; |
519 | 519 | ||
520 | ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); | ||
521 | 520 | ||
522 | if (!pr) | 521 | if (!pr) |
523 | return_VALUE(-EINVAL); | 522 | return -EINVAL; |
524 | 523 | ||
525 | /* | 524 | /* |
526 | * This function sets the default Cx state policy (OS idle handler). | 525 | * This function sets the default Cx state policy (OS idle handler). |
@@ -544,7 +543,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) | |||
544 | } | 543 | } |
545 | 544 | ||
546 | if (!state_is_set) | 545 | if (!state_is_set) |
547 | return_VALUE(-ENODEV); | 546 | return -ENODEV; |
548 | 547 | ||
549 | /* demotion */ | 548 | /* demotion */ |
550 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 549 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
@@ -583,18 +582,17 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) | |||
583 | higher = cx; | 582 | higher = cx; |
584 | } | 583 | } |
585 | 584 | ||
586 | return_VALUE(0); | 585 | return 0; |
587 | } | 586 | } |
588 | 587 | ||
589 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | 588 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) |
590 | { | 589 | { |
591 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); | ||
592 | 590 | ||
593 | if (!pr) | 591 | if (!pr) |
594 | return_VALUE(-EINVAL); | 592 | return -EINVAL; |
595 | 593 | ||
596 | if (!pr->pblk) | 594 | if (!pr->pblk) |
597 | return_VALUE(-ENODEV); | 595 | return -ENODEV; |
598 | 596 | ||
599 | /* if info is obtained from pblk/fadt, type equals state */ | 597 | /* if info is obtained from pblk/fadt, type equals state */ |
600 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; | 598 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; |
@@ -606,7 +604,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
606 | * an SMP system. | 604 | * an SMP system. |
607 | */ | 605 | */ |
608 | if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) | 606 | if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) |
609 | return_VALUE(-ENODEV); | 607 | return -ENODEV; |
610 | #endif | 608 | #endif |
611 | 609 | ||
612 | /* determine C2 and C3 address from pblk */ | 610 | /* determine C2 and C3 address from pblk */ |
@@ -622,12 +620,11 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
622 | pr->power.states[ACPI_STATE_C2].address, | 620 | pr->power.states[ACPI_STATE_C2].address, |
623 | pr->power.states[ACPI_STATE_C3].address)); | 621 | pr->power.states[ACPI_STATE_C3].address)); |
624 | 622 | ||
625 | return_VALUE(0); | 623 | return 0; |
626 | } | 624 | } |
627 | 625 | ||
628 | static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) | 626 | static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) |
629 | { | 627 | { |
630 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | ||
631 | 628 | ||
632 | /* Zero initialize all the C-states info. */ | 629 | /* Zero initialize all the C-states info. */ |
633 | memset(pr->power.states, 0, sizeof(pr->power.states)); | 630 | memset(pr->power.states, 0, sizeof(pr->power.states)); |
@@ -640,7 +637,7 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) | |||
640 | pr->power.states[ACPI_STATE_C0].valid = 1; | 637 | pr->power.states[ACPI_STATE_C0].valid = 1; |
641 | pr->power.states[ACPI_STATE_C1].valid = 1; | 638 | pr->power.states[ACPI_STATE_C1].valid = 1; |
642 | 639 | ||
643 | return_VALUE(0); | 640 | return 0; |
644 | } | 641 | } |
645 | 642 | ||
646 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | 643 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) |
@@ -652,10 +649,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
652 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 649 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
653 | union acpi_object *cst; | 650 | union acpi_object *cst; |
654 | 651 | ||
655 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); | ||
656 | 652 | ||
657 | if (nocst) | 653 | if (nocst) |
658 | return_VALUE(-ENODEV); | 654 | return -ENODEV; |
659 | 655 | ||
660 | current_count = 1; | 656 | current_count = 1; |
661 | 657 | ||
@@ -667,7 +663,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
667 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); | 663 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); |
668 | if (ACPI_FAILURE(status)) { | 664 | if (ACPI_FAILURE(status)) { |
669 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); | 665 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); |
670 | return_VALUE(-ENODEV); | 666 | return -ENODEV; |
671 | } | 667 | } |
672 | 668 | ||
673 | cst = (union acpi_object *)buffer.pointer; | 669 | cst = (union acpi_object *)buffer.pointer; |
@@ -773,15 +769,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
773 | end: | 769 | end: |
774 | acpi_os_free(buffer.pointer); | 770 | acpi_os_free(buffer.pointer); |
775 | 771 | ||
776 | return_VALUE(status); | 772 | return status; |
777 | } | 773 | } |
778 | 774 | ||
779 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | 775 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) |
780 | { | 776 | { |
781 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); | ||
782 | 777 | ||
783 | if (!cx->address) | 778 | if (!cx->address) |
784 | return_VOID; | 779 | return; |
785 | 780 | ||
786 | /* | 781 | /* |
787 | * C2 latency must be less than or equal to 100 | 782 | * C2 latency must be less than or equal to 100 |
@@ -790,7 +785,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
790 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | 785 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { |
791 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 786 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
792 | "latency too large [%d]\n", cx->latency)); | 787 | "latency too large [%d]\n", cx->latency)); |
793 | return_VOID; | 788 | return; |
794 | } | 789 | } |
795 | 790 | ||
796 | /* | 791 | /* |
@@ -800,7 +795,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
800 | cx->valid = 1; | 795 | cx->valid = 1; |
801 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); | 796 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); |
802 | 797 | ||
803 | return_VOID; | 798 | return; |
804 | } | 799 | } |
805 | 800 | ||
806 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | 801 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, |
@@ -808,10 +803,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
808 | { | 803 | { |
809 | static int bm_check_flag; | 804 | static int bm_check_flag; |
810 | 805 | ||
811 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); | ||
812 | 806 | ||
813 | if (!cx->address) | 807 | if (!cx->address) |
814 | return_VOID; | 808 | return; |
815 | 809 | ||
816 | /* | 810 | /* |
817 | * C3 latency must be less than or equal to 1000 | 811 | * C3 latency must be less than or equal to 1000 |
@@ -820,7 +814,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
820 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | 814 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { |
821 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 815 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
822 | "latency too large [%d]\n", cx->latency)); | 816 | "latency too large [%d]\n", cx->latency)); |
823 | return_VOID; | 817 | return; |
824 | } | 818 | } |
825 | 819 | ||
826 | /* | 820 | /* |
@@ -833,7 +827,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
833 | else if (errata.piix4.fdma) { | 827 | else if (errata.piix4.fdma) { |
834 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 828 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
835 | "C3 not supported on PIIX4 with Type-F DMA\n")); | 829 | "C3 not supported on PIIX4 with Type-F DMA\n")); |
836 | return_VOID; | 830 | return; |
837 | } | 831 | } |
838 | 832 | ||
839 | /* All the logic here assumes flags.bm_check is same across all CPUs */ | 833 | /* All the logic here assumes flags.bm_check is same across all CPUs */ |
@@ -850,7 +844,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
850 | if (!pr->flags.bm_control) { | 844 | if (!pr->flags.bm_control) { |
851 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 845 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
852 | "C3 support requires bus mastering control\n")); | 846 | "C3 support requires bus mastering control\n")); |
853 | return_VOID; | 847 | return; |
854 | } | 848 | } |
855 | } else { | 849 | } else { |
856 | /* | 850 | /* |
@@ -861,7 +855,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
861 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 855 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
862 | "Cache invalidation should work properly" | 856 | "Cache invalidation should work properly" |
863 | " for C3 to be enabled on SMP systems\n")); | 857 | " for C3 to be enabled on SMP systems\n")); |
864 | return_VOID; | 858 | return; |
865 | } | 859 | } |
866 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, | 860 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, |
867 | 0, ACPI_MTX_DO_NOT_LOCK); | 861 | 0, ACPI_MTX_DO_NOT_LOCK); |
@@ -876,7 +870,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
876 | cx->valid = 1; | 870 | cx->valid = 1; |
877 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); | 871 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); |
878 | 872 | ||
879 | return_VOID; | 873 | return; |
880 | } | 874 | } |
881 | 875 | ||
882 | static int acpi_processor_power_verify(struct acpi_processor *pr) | 876 | static int acpi_processor_power_verify(struct acpi_processor *pr) |
@@ -935,7 +929,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
935 | unsigned int i; | 929 | unsigned int i; |
936 | int result; | 930 | int result; |
937 | 931 | ||
938 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info"); | ||
939 | 932 | ||
940 | /* NOTE: the idle thread may not be running while calling | 933 | /* NOTE: the idle thread may not be running while calling |
941 | * this function */ | 934 | * this function */ |
@@ -958,7 +951,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
958 | */ | 951 | */ |
959 | result = acpi_processor_set_power_policy(pr); | 952 | result = acpi_processor_set_power_policy(pr); |
960 | if (result) | 953 | if (result) |
961 | return_VALUE(result); | 954 | return result; |
962 | 955 | ||
963 | /* | 956 | /* |
964 | * if one state of type C2 or C3 is available, mark this | 957 | * if one state of type C2 or C3 is available, mark this |
@@ -972,24 +965,23 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
972 | } | 965 | } |
973 | } | 966 | } |
974 | 967 | ||
975 | return_VALUE(0); | 968 | return 0; |
976 | } | 969 | } |
977 | 970 | ||
978 | int acpi_processor_cst_has_changed(struct acpi_processor *pr) | 971 | int acpi_processor_cst_has_changed(struct acpi_processor *pr) |
979 | { | 972 | { |
980 | int result = 0; | 973 | int result = 0; |
981 | 974 | ||
982 | ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); | ||
983 | 975 | ||
984 | if (!pr) | 976 | if (!pr) |
985 | return_VALUE(-EINVAL); | 977 | return -EINVAL; |
986 | 978 | ||
987 | if (nocst) { | 979 | if (nocst) { |
988 | return_VALUE(-ENODEV); | 980 | return -ENODEV; |
989 | } | 981 | } |
990 | 982 | ||
991 | if (!pr->flags.power_setup_done) | 983 | if (!pr->flags.power_setup_done) |
992 | return_VALUE(-ENODEV); | 984 | return -ENODEV; |
993 | 985 | ||
994 | /* Fall back to the default idle loop */ | 986 | /* Fall back to the default idle loop */ |
995 | pm_idle = pm_idle_save; | 987 | pm_idle = pm_idle_save; |
@@ -1000,7 +992,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1000 | if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) | 992 | if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) |
1001 | pm_idle = acpi_processor_idle; | 993 | pm_idle = acpi_processor_idle; |
1002 | 994 | ||
1003 | return_VALUE(result); | 995 | return result; |
1004 | } | 996 | } |
1005 | 997 | ||
1006 | /* proc interface */ | 998 | /* proc interface */ |
@@ -1010,7 +1002,6 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
1010 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 1002 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; |
1011 | unsigned int i; | 1003 | unsigned int i; |
1012 | 1004 | ||
1013 | ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); | ||
1014 | 1005 | ||
1015 | if (!pr) | 1006 | if (!pr) |
1016 | goto end; | 1007 | goto end; |
@@ -1068,7 +1059,7 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
1068 | } | 1059 | } |
1069 | 1060 | ||
1070 | end: | 1061 | end: |
1071 | return_VALUE(0); | 1062 | return 0; |
1072 | } | 1063 | } |
1073 | 1064 | ||
1074 | static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) | 1065 | static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) |
@@ -1092,7 +1083,6 @@ int acpi_processor_power_init(struct acpi_processor *pr, | |||
1092 | struct proc_dir_entry *entry = NULL; | 1083 | struct proc_dir_entry *entry = NULL; |
1093 | unsigned int i; | 1084 | unsigned int i; |
1094 | 1085 | ||
1095 | ACPI_FUNCTION_TRACE("acpi_processor_power_init"); | ||
1096 | 1086 | ||
1097 | if (!first_run) { | 1087 | if (!first_run) { |
1098 | dmi_check_system(processor_power_dmi_table); | 1088 | dmi_check_system(processor_power_dmi_table); |
@@ -1104,7 +1094,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, | |||
1104 | } | 1094 | } |
1105 | 1095 | ||
1106 | if (!pr) | 1096 | if (!pr) |
1107 | return_VALUE(-EINVAL); | 1097 | return -EINVAL; |
1108 | 1098 | ||
1109 | if (acpi_fadt.cst_cnt && !nocst) { | 1099 | if (acpi_fadt.cst_cnt && !nocst) { |
1110 | status = | 1100 | status = |
@@ -1149,13 +1139,12 @@ int acpi_processor_power_init(struct acpi_processor *pr, | |||
1149 | 1139 | ||
1150 | pr->flags.power_setup_done = 1; | 1140 | pr->flags.power_setup_done = 1; |
1151 | 1141 | ||
1152 | return_VALUE(0); | 1142 | return 0; |
1153 | } | 1143 | } |
1154 | 1144 | ||
1155 | int acpi_processor_power_exit(struct acpi_processor *pr, | 1145 | int acpi_processor_power_exit(struct acpi_processor *pr, |
1156 | struct acpi_device *device) | 1146 | struct acpi_device *device) |
1157 | { | 1147 | { |
1158 | ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); | ||
1159 | 1148 | ||
1160 | pr->flags.power_setup_done = 0; | 1149 | pr->flags.power_setup_done = 0; |
1161 | 1150 | ||
@@ -1175,5 +1164,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr, | |||
1175 | cpu_idle_wait(); | 1164 | cpu_idle_wait(); |
1176 | } | 1165 | } |
1177 | 1166 | ||
1178 | return_VALUE(0); | 1167 | return 0; |
1179 | } | 1168 | } |