Lines Matching refs:pr

43 	struct acpi_processor *pr;
51 static int acpi_processor_get_throttling(struct acpi_processor *pr);
52 static int __acpi_processor_set_throttling(struct acpi_processor *pr,
61 struct acpi_processor *pr, *match_pr;
73 pr = per_cpu(processors, i);
74 if (!pr)
78 pthrottling = &(pr->throttling);
94 pr = per_cpu(processors, i);
95 if (!pr)
100 pthrottling = &pr->throttling;
175 pr = per_cpu(processors, i);
176 if (!pr)
184 pthrottling = &(pr->throttling);
211 struct acpi_processor *pr;
218 pr = per_cpu(processors, cpu);
219 if (!pr) {
220 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid pr pointer\n"));
223 if (!pr->flags.throttling) {
229 p_throttling = &(pr->throttling);
236 p_limit = &pr->limit;
241 if (pr->throttling_platform_limit > target_state)
242 target_state = pr->throttling_platform_limit;
275 static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
280 if (!pr)
286 status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
295 pr->throttling_platform_limit = (int)tpc;
299 int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
310 result = acpi_processor_get_platform_limit(pr);
316 throttling_limit = pr->throttling_platform_limit;
317 if (throttling_limit >= pr->throttling.state_count) {
322 current_state = pr->throttling.state;
331 limit = &pr->limit;
352 return acpi_processor_set_throttling(pr, target_state, false);
364 void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
373 pr->flags.throttling = 0;
379 if (!pr->throttling.state_count) {
383 pr->flags.throttling = 0;
386 pr->flags.throttling = 1;
393 result = acpi_processor_get_throttling(pr);
397 if (pr->throttling.state) {
398 result = acpi_processor_set_throttling(pr, 0, false);
405 pr->flags.throttling = 0;
410 static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
419 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
449 memcpy(&pr->throttling.control_register, obj.buffer.pointer,
466 memcpy(&pr->throttling.status_register, obj.buffer.pointer,
469 throttling = &pr->throttling;
494 static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
504 status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
522 pr->throttling.state_count = tss->package.count;
523 pr->throttling.states_tss =
527 if (!pr->throttling.states_tss) {
532 for (i = 0; i < pr->throttling.state_count; i++) {
535 (struct acpi_processor_tx_tss *)&(pr->throttling.
548 kfree(pr->throttling.states_tss);
556 kfree(pr->throttling.states_tss);
570 static int acpi_processor_get_tsd(struct acpi_processor *pr)
581 pthrottling = &pr->throttling;
584 status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
605 pdomain = &(pr->throttling.domain_info);
630 pthrottling = &pr->throttling;
633 cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map);
654 static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
661 if (!pr)
664 if (!pr->flags.throttling)
674 request_region(pr->throttling.address, 6, "ACPI CPU throttle");
676 pr->throttling.state = 0;
678 duty_mask = pr->throttling.state_count - 1;
680 duty_mask <<= pr->throttling.duty_offset;
684 value = inl(pr->throttling.address);
692 duty_value >>= pr->throttling.duty_offset;
695 state = pr->throttling.state_count - duty_value;
698 pr->throttling.state = state;
704 state, pr->throttling.states[state].performance));
765 static int acpi_read_throttling_status(struct acpi_processor *pr,
774 throttling = &pr->throttling;
797 static int acpi_write_throttling_state(struct acpi_processor *pr,
806 throttling = &pr->throttling;
830 static int acpi_get_throttling_state(struct acpi_processor *pr,
835 for (i = 0; i < pr->throttling.state_count; i++) {
837 (struct acpi_processor_tx_tss *)&(pr->throttling.
845 static int acpi_get_throttling_value(struct acpi_processor *pr,
850 if (state >= 0 && state <= pr->throttling.state_count) {
852 (struct acpi_processor_tx_tss *)&(pr->throttling.
860 static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
866 if (!pr)
869 if (!pr->flags.throttling)
872 pr->throttling.state = 0;
875 ret = acpi_read_throttling_status(pr, &value);
877 state = acpi_get_throttling_state(pr, value);
882 ret = __acpi_processor_set_throttling(pr, state, true,
887 pr->throttling.state = state;
895 struct acpi_processor *pr = data;
897 return pr->throttling.acpi_processor_get_throttling(pr);
900 static int acpi_processor_get_throttling(struct acpi_processor *pr)
902 if (!pr)
905 if (!pr->flags.throttling)
914 if (!cpu_online(pr->id))
917 return call_on_cpu(pr->id, __acpi_processor_get_throttling, pr, false);
920 static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
924 if (!pr->throttling.address) {
927 } else if (!pr->throttling.duty_width) {
932 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
937 pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
945 step = (1000 / pr->throttling.state_count);
947 for (i = 0; i < pr->throttling.state_count; i++) {
948 pr->throttling.states[i].performance = 1000 - step * i;
949 pr->throttling.states[i].power = 1000 - step * i;
954 static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
961 if (!pr)
964 if ((state < 0) || (state > (pr->throttling.state_count - 1)))
967 if (!pr->flags.throttling)
970 if (!force && (state == pr->throttling.state))
973 if (state < pr->throttling_platform_limit)
979 duty_value = pr->throttling.state_count - state;
981 duty_value <<= pr->throttling.duty_offset;
984 duty_mask = pr->throttling.state_count - 1;
996 value = inl(pr->throttling.address);
999 outl(value, pr->throttling.address);
1009 outl(value, pr->throttling.address);
1012 outl(value, pr->throttling.address);
1015 pr->throttling.state = state;
1021 (pr->throttling.states[state].performance ? pr->
1027 static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
1033 if (!pr)
1036 if ((state < 0) || (state > (pr->throttling.state_count - 1)))
1039 if (!pr->flags.throttling)
1042 if (!force && (state == pr->throttling.state))
1045 if (state < pr->throttling_platform_limit)
1049 ret = acpi_get_throttling_value(pr, state, &value);
1051 acpi_write_throttling_state(pr, value);
1052 pr->throttling.state = state;
1061 struct acpi_processor *pr = arg->pr;
1063 return pr->throttling.acpi_processor_set_throttling(pr,
1067 static int __acpi_processor_set_throttling(struct acpi_processor *pr,
1077 if (!pr)
1080 if (!pr->flags.throttling)
1083 if ((state < 0) || (state > (pr->throttling.state_count - 1)))
1086 if (cpu_is_offline(pr->id)) {
1088 * the cpu pointed by pr->id is offline. Unnecessary to change
1095 p_throttling = &(pr->throttling);
1111 * it can be called only for the cpu pointed by pr.
1114 arg.pr = pr;
1117 ret = call_on_cpu(pr->id, acpi_processor_throttling_fn, &arg,
1148 arg.pr = match_pr;
1151 ret = call_on_cpu(pr->id, acpi_processor_throttling_fn,
1170 int acpi_processor_set_throttling(struct acpi_processor *pr, int state,
1173 return __acpi_processor_set_throttling(pr, state, force, false);
1176 int acpi_processor_get_throttling_info(struct acpi_processor *pr)
1183 pr->throttling.address,
1184 pr->throttling.duty_offset,
1185 pr->throttling.duty_width));
1191 if (acpi_processor_get_throttling_control(pr) ||
1192 acpi_processor_get_throttling_states(pr) ||
1193 acpi_processor_get_platform_limit(pr))
1195 pr->throttling.acpi_processor_get_throttling =
1197 pr->throttling.acpi_processor_set_throttling =
1199 if (acpi_processor_get_fadt_info(pr))
1202 pr->throttling.acpi_processor_get_throttling =
1204 pr->throttling.acpi_processor_set_throttling =
1212 if (acpi_processor_get_tsd(pr)) {
1213 pthrottling = &pr->throttling;
1215 cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map);
1231 pr->throttling.state_count));
1233 pr->flags.throttling = 1;
1241 result = acpi_processor_get_throttling(pr);
1245 if (pr->throttling.state) {
1248 pr->throttling.state));
1249 result = acpi_processor_set_throttling(pr, 0, false);
1256 pr->flags.throttling = 0;