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