Lines Matching full:pr
39 struct acpi_processor *pr; member
47 static int acpi_processor_get_throttling(struct acpi_processor *pr);
48 static int __acpi_processor_set_throttling(struct acpi_processor *pr,
57 struct acpi_processor *pr, *match_pr; in acpi_processor_update_tsd_coord() local
69 pr = per_cpu(processors, i); in acpi_processor_update_tsd_coord()
70 if (!pr) in acpi_processor_update_tsd_coord()
74 pthrottling = &(pr->throttling); in acpi_processor_update_tsd_coord()
90 pr = per_cpu(processors, i); in acpi_processor_update_tsd_coord()
91 if (!pr) in acpi_processor_update_tsd_coord()
96 pthrottling = &pr->throttling; in acpi_processor_update_tsd_coord()
169 pr = per_cpu(processors, i); in acpi_processor_update_tsd_coord()
170 if (!pr) in acpi_processor_update_tsd_coord()
178 pthrottling = &(pr->throttling); in acpi_processor_update_tsd_coord()
201 struct acpi_processor *pr; in acpi_processor_throttling_notifier() local
208 pr = per_cpu(processors, cpu); in acpi_processor_throttling_notifier()
209 if (!pr) { in acpi_processor_throttling_notifier()
210 pr_debug("Invalid pr pointer\n"); in acpi_processor_throttling_notifier()
213 if (!pr->flags.throttling) { in acpi_processor_throttling_notifier()
214 acpi_handle_debug(pr->handle, in acpi_processor_throttling_notifier()
220 p_throttling = &(pr->throttling); in acpi_processor_throttling_notifier()
227 p_limit = &pr->limit; in acpi_processor_throttling_notifier()
232 if (pr->throttling_platform_limit > target_state) in acpi_processor_throttling_notifier()
233 target_state = pr->throttling_platform_limit; in acpi_processor_throttling_notifier()
239 acpi_handle_debug(pr->handle, in acpi_processor_throttling_notifier()
249 acpi_handle_debug(pr->handle, in acpi_processor_throttling_notifier()
264 static int acpi_processor_get_platform_limit(struct acpi_processor *pr) in acpi_processor_get_platform_limit() argument
269 if (!pr) in acpi_processor_get_platform_limit()
275 status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); in acpi_processor_get_platform_limit()
278 acpi_evaluation_failure_warn(pr->handle, "_TPC", status); in acpi_processor_get_platform_limit()
284 pr->throttling_platform_limit = (int)tpc; in acpi_processor_get_platform_limit()
288 int acpi_processor_tstate_has_changed(struct acpi_processor *pr) in acpi_processor_tstate_has_changed() argument
299 result = acpi_processor_get_platform_limit(pr); in acpi_processor_tstate_has_changed()
305 throttling_limit = pr->throttling_platform_limit; in acpi_processor_tstate_has_changed()
306 if (throttling_limit >= pr->throttling.state_count) { in acpi_processor_tstate_has_changed()
311 current_state = pr->throttling.state; in acpi_processor_tstate_has_changed()
320 limit = &pr->limit; in acpi_processor_tstate_has_changed()
341 return acpi_processor_set_throttling(pr, target_state, false); in acpi_processor_tstate_has_changed()
353 void acpi_processor_reevaluate_tstate(struct acpi_processor *pr, in acpi_processor_reevaluate_tstate() argument
362 pr->flags.throttling = 0; in acpi_processor_reevaluate_tstate()
368 if (!pr->throttling.state_count) { in acpi_processor_reevaluate_tstate()
372 pr->flags.throttling = 0; in acpi_processor_reevaluate_tstate()
375 pr->flags.throttling = 1; in acpi_processor_reevaluate_tstate()
382 result = acpi_processor_get_throttling(pr); in acpi_processor_reevaluate_tstate()
386 if (pr->throttling.state) { in acpi_processor_reevaluate_tstate()
387 result = acpi_processor_set_throttling(pr, 0, false); in acpi_processor_reevaluate_tstate()
394 pr->flags.throttling = 0; in acpi_processor_reevaluate_tstate()
399 static int acpi_processor_get_throttling_control(struct acpi_processor *pr) in acpi_processor_get_throttling_control() argument
408 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); in acpi_processor_get_throttling_control()
411 acpi_evaluation_failure_warn(pr->handle, "_PTC", status); in acpi_processor_get_throttling_control()
437 memcpy(&pr->throttling.control_register, obj.buffer.pointer, in acpi_processor_get_throttling_control()
454 memcpy(&pr->throttling.status_register, obj.buffer.pointer, in acpi_processor_get_throttling_control()
457 throttling = &pr->throttling; in acpi_processor_get_throttling_control()
482 static int acpi_processor_get_throttling_states(struct acpi_processor *pr) in acpi_processor_get_throttling_states() argument
492 status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); in acpi_processor_get_throttling_states()
495 acpi_evaluation_failure_warn(pr->handle, "_TSS", status); in acpi_processor_get_throttling_states()
507 acpi_handle_debug(pr->handle, "Found %d throttling states\n", in acpi_processor_get_throttling_states()
510 pr->throttling.state_count = tss->package.count; in acpi_processor_get_throttling_states()
511 pr->throttling.states_tss = in acpi_processor_get_throttling_states()
515 if (!pr->throttling.states_tss) { in acpi_processor_get_throttling_states()
520 for (i = 0; i < pr->throttling.state_count; i++) { in acpi_processor_get_throttling_states()
523 (struct acpi_processor_tx_tss *)&(pr->throttling. in acpi_processor_get_throttling_states()
529 acpi_handle_debug(pr->handle, "Extracting state %d\n", i); in acpi_processor_get_throttling_states()
534 acpi_handle_warn(pr->handle, "Invalid _TSS data: %s\n", in acpi_processor_get_throttling_states()
537 kfree(pr->throttling.states_tss); in acpi_processor_get_throttling_states()
544 kfree(pr->throttling.states_tss); in acpi_processor_get_throttling_states()
558 static int acpi_processor_get_tsd(struct acpi_processor *pr) in acpi_processor_get_tsd() argument
569 pthrottling = &pr->throttling; in acpi_processor_get_tsd()
572 status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); in acpi_processor_get_tsd()
575 acpi_evaluation_failure_warn(pr->handle, "_TSD", status); in acpi_processor_get_tsd()
593 pdomain = &(pr->throttling.domain_info); in acpi_processor_get_tsd()
618 pthrottling = &pr->throttling; in acpi_processor_get_tsd()
621 cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map); in acpi_processor_get_tsd()
642 static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) in acpi_processor_get_throttling_fadt() argument
649 if (!pr) in acpi_processor_get_throttling_fadt()
652 if (!pr->flags.throttling) in acpi_processor_get_throttling_fadt()
662 request_region(pr->throttling.address, 6, "ACPI CPU throttle"); in acpi_processor_get_throttling_fadt()
664 pr->throttling.state = 0; in acpi_processor_get_throttling_fadt()
666 duty_mask = pr->throttling.state_count - 1; in acpi_processor_get_throttling_fadt()
668 duty_mask <<= pr->throttling.duty_offset; in acpi_processor_get_throttling_fadt()
672 value = inl(pr->throttling.address); in acpi_processor_get_throttling_fadt()
680 duty_value >>= pr->throttling.duty_offset; in acpi_processor_get_throttling_fadt()
683 state = pr->throttling.state_count - duty_value; in acpi_processor_get_throttling_fadt()
686 pr->throttling.state = state; in acpi_processor_get_throttling_fadt()
690 acpi_handle_debug(pr->handle, in acpi_processor_get_throttling_fadt()
692 state, pr->throttling.states[state].performance); in acpi_processor_get_throttling_fadt()
749 static int acpi_read_throttling_status(struct acpi_processor *pr, in acpi_read_throttling_status() argument
758 throttling = &pr->throttling; in acpi_read_throttling_status()
781 static int acpi_write_throttling_state(struct acpi_processor *pr, in acpi_write_throttling_state() argument
790 throttling = &pr->throttling; in acpi_write_throttling_state()
814 static int acpi_get_throttling_state(struct acpi_processor *pr, in acpi_get_throttling_state() argument
819 for (i = 0; i < pr->throttling.state_count; i++) { in acpi_get_throttling_state()
821 (struct acpi_processor_tx_tss *)&(pr->throttling. in acpi_get_throttling_state()
829 static int acpi_get_throttling_value(struct acpi_processor *pr, in acpi_get_throttling_value() argument
834 if (state >= 0 && state <= pr->throttling.state_count) { in acpi_get_throttling_value()
836 (struct acpi_processor_tx_tss *)&(pr->throttling. in acpi_get_throttling_value()
844 static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) in acpi_processor_get_throttling_ptc() argument
850 if (!pr) in acpi_processor_get_throttling_ptc()
853 if (!pr->flags.throttling) in acpi_processor_get_throttling_ptc()
856 pr->throttling.state = 0; in acpi_processor_get_throttling_ptc()
859 ret = acpi_read_throttling_status(pr, &value); in acpi_processor_get_throttling_ptc()
861 state = acpi_get_throttling_state(pr, value); in acpi_processor_get_throttling_ptc()
863 acpi_handle_debug(pr->handle, in acpi_processor_get_throttling_ptc()
866 ret = __acpi_processor_set_throttling(pr, state, true, in acpi_processor_get_throttling_ptc()
871 pr->throttling.state = state; in acpi_processor_get_throttling_ptc()
879 struct acpi_processor *pr = data; in __acpi_processor_get_throttling() local
881 return pr->throttling.acpi_processor_get_throttling(pr); in __acpi_processor_get_throttling()
884 static int acpi_processor_get_throttling(struct acpi_processor *pr) in acpi_processor_get_throttling() argument
886 if (!pr) in acpi_processor_get_throttling()
889 if (!pr->flags.throttling) in acpi_processor_get_throttling()
898 if (!cpu_online(pr->id)) in acpi_processor_get_throttling()
901 return call_on_cpu(pr->id, __acpi_processor_get_throttling, pr, false); in acpi_processor_get_throttling()
904 static int acpi_processor_get_fadt_info(struct acpi_processor *pr) in acpi_processor_get_fadt_info() argument
908 if (!pr->throttling.address) { in acpi_processor_get_fadt_info()
909 acpi_handle_debug(pr->handle, "No throttling register\n"); in acpi_processor_get_fadt_info()
911 } else if (!pr->throttling.duty_width) { in acpi_processor_get_fadt_info()
912 acpi_handle_debug(pr->handle, "No throttling states\n"); in acpi_processor_get_fadt_info()
916 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { in acpi_processor_get_fadt_info()
921 pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; in acpi_processor_get_fadt_info()
929 step = (1000 / pr->throttling.state_count); in acpi_processor_get_fadt_info()
931 for (i = 0; i < pr->throttling.state_count; i++) { in acpi_processor_get_fadt_info()
932 pr->throttling.states[i].performance = 1000 - step * i; in acpi_processor_get_fadt_info()
933 pr->throttling.states[i].power = 1000 - step * i; in acpi_processor_get_fadt_info()
938 static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, in acpi_processor_set_throttling_fadt() argument
945 if (!pr) in acpi_processor_set_throttling_fadt()
948 if ((state < 0) || (state > (pr->throttling.state_count - 1))) in acpi_processor_set_throttling_fadt()
951 if (!pr->flags.throttling) in acpi_processor_set_throttling_fadt()
954 if (!force && (state == pr->throttling.state)) in acpi_processor_set_throttling_fadt()
957 if (state < pr->throttling_platform_limit) in acpi_processor_set_throttling_fadt()
963 duty_value = pr->throttling.state_count - state; in acpi_processor_set_throttling_fadt()
965 duty_value <<= pr->throttling.duty_offset; in acpi_processor_set_throttling_fadt()
968 duty_mask = pr->throttling.state_count - 1; in acpi_processor_set_throttling_fadt()
980 value = inl(pr->throttling.address); in acpi_processor_set_throttling_fadt()
983 outl(value, pr->throttling.address); in acpi_processor_set_throttling_fadt()
993 outl(value, pr->throttling.address); in acpi_processor_set_throttling_fadt()
996 outl(value, pr->throttling.address); in acpi_processor_set_throttling_fadt()
999 pr->throttling.state = state; in acpi_processor_set_throttling_fadt()
1003 acpi_handle_debug(pr->handle, in acpi_processor_set_throttling_fadt()
1005 (pr->throttling.states[state].performance ? pr-> in acpi_processor_set_throttling_fadt()
1011 static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, in acpi_processor_set_throttling_ptc() argument
1017 if (!pr) in acpi_processor_set_throttling_ptc()
1020 if ((state < 0) || (state > (pr->throttling.state_count - 1))) in acpi_processor_set_throttling_ptc()
1023 if (!pr->flags.throttling) in acpi_processor_set_throttling_ptc()
1026 if (!force && (state == pr->throttling.state)) in acpi_processor_set_throttling_ptc()
1029 if (state < pr->throttling_platform_limit) in acpi_processor_set_throttling_ptc()
1033 ret = acpi_get_throttling_value(pr, state, &value); in acpi_processor_set_throttling_ptc()
1035 acpi_write_throttling_state(pr, value); in acpi_processor_set_throttling_ptc()
1036 pr->throttling.state = state; in acpi_processor_set_throttling_ptc()
1045 struct acpi_processor *pr = arg->pr; in acpi_processor_throttling_fn() local
1047 return pr->throttling.acpi_processor_set_throttling(pr, in acpi_processor_throttling_fn()
1051 static int __acpi_processor_set_throttling(struct acpi_processor *pr, in __acpi_processor_set_throttling() argument
1061 if (!pr) in __acpi_processor_set_throttling()
1064 if (!pr->flags.throttling) in __acpi_processor_set_throttling()
1067 if ((state < 0) || (state > (pr->throttling.state_count - 1))) in __acpi_processor_set_throttling()
1070 if (cpu_is_offline(pr->id)) { in __acpi_processor_set_throttling()
1072 * the cpu pointed by pr->id is offline. Unnecessary to change in __acpi_processor_set_throttling()
1079 p_throttling = &(pr->throttling); in __acpi_processor_set_throttling()
1095 * it can be called only for the cpu pointed by pr. in __acpi_processor_set_throttling()
1098 arg.pr = pr; in __acpi_processor_set_throttling()
1101 ret = call_on_cpu(pr->id, acpi_processor_throttling_fn, &arg, in __acpi_processor_set_throttling()
1117 acpi_handle_debug(pr->handle, in __acpi_processor_set_throttling()
1126 acpi_handle_debug(pr->handle, in __acpi_processor_set_throttling()
1131 arg.pr = match_pr; in __acpi_processor_set_throttling()
1134 ret = call_on_cpu(pr->id, acpi_processor_throttling_fn, in __acpi_processor_set_throttling()
1153 int acpi_processor_set_throttling(struct acpi_processor *pr, int state, in acpi_processor_set_throttling() argument
1156 return __acpi_processor_set_throttling(pr, state, force, false); in acpi_processor_set_throttling()
1159 int acpi_processor_get_throttling_info(struct acpi_processor *pr) in acpi_processor_get_throttling_info() argument
1164 acpi_handle_debug(pr->handle, in acpi_processor_get_throttling_info()
1166 pr->throttling.address, in acpi_processor_get_throttling_info()
1167 pr->throttling.duty_offset, in acpi_processor_get_throttling_info()
1168 pr->throttling.duty_width); in acpi_processor_get_throttling_info()
1174 if (acpi_processor_get_throttling_control(pr) || in acpi_processor_get_throttling_info()
1175 acpi_processor_get_throttling_states(pr) || in acpi_processor_get_throttling_info()
1176 acpi_processor_get_platform_limit(pr)) { in acpi_processor_get_throttling_info()
1177 pr->throttling.acpi_processor_get_throttling = in acpi_processor_get_throttling_info()
1179 pr->throttling.acpi_processor_set_throttling = in acpi_processor_get_throttling_info()
1181 if (acpi_processor_get_fadt_info(pr)) in acpi_processor_get_throttling_info()
1184 pr->throttling.acpi_processor_get_throttling = in acpi_processor_get_throttling_info()
1186 pr->throttling.acpi_processor_set_throttling = in acpi_processor_get_throttling_info()
1194 if (acpi_processor_get_tsd(pr)) { in acpi_processor_get_throttling_info()
1195 pthrottling = &pr->throttling; in acpi_processor_get_throttling_info()
1197 cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map); in acpi_processor_get_throttling_info()
1207 acpi_handle_debug(pr->handle, in acpi_processor_get_throttling_info()
1212 acpi_handle_debug(pr->handle, "Found %d throttling states\n", in acpi_processor_get_throttling_info()
1213 pr->throttling.state_count); in acpi_processor_get_throttling_info()
1215 pr->flags.throttling = 1; in acpi_processor_get_throttling_info()
1223 result = acpi_processor_get_throttling(pr); in acpi_processor_get_throttling_info()
1227 if (pr->throttling.state) { in acpi_processor_get_throttling_info()
1228 acpi_handle_debug(pr->handle, in acpi_processor_get_throttling_info()
1230 pr->throttling.state); in acpi_processor_get_throttling_info()
1231 result = acpi_processor_set_throttling(pr, 0, false); in acpi_processor_get_throttling_info()
1238 pr->flags.throttling = 0; in acpi_processor_get_throttling_info()