• Home
  • Raw
  • Download

Lines Matching +full:p +full:- +full:states

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * processor_idle - idle state submodule to the ACPI processor driver
9 * - Added processor hotplug support
11 * - Added support for C3 on SMP
31 * creating an empty asm-ia64/apic.h would just trade pest vs. cholera.
78 pr_notice("%s detected - limiting to C%ld max_cstate." in set_max_cstate()
79 " Override with \"processor.max_cstate=%d\"\n", id->ident, in set_max_cstate()
80 (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); in set_max_cstate()
82 max_cstate = (long)id->driver_data; in set_max_cstate()
93 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
127 struct acpi_processor_power *pwr = &pr->power; in lapic_timer_check_state()
130 if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) in lapic_timer_check_state()
137 * Check, if one of the previous states already marked the lapic in lapic_timer_check_state()
140 if (pwr->timer_broadcast_on_state < state) in lapic_timer_check_state()
143 if (cx->type >= type) in lapic_timer_check_state()
144 pr->power.timer_broadcast_on_state = state; in lapic_timer_check_state()
151 if (pr->power.timer_broadcast_on_state < INT_MAX) in __lapic_timer_propagate_broadcast()
159 smp_call_function_single(pr->id, __lapic_timer_propagate_broadcast, in lapic_timer_propagate_broadcast()
167 return cx - pr->power.states >= pr->power.timer_broadcast_on_state; in lapic_timer_needs_broadcast()
195 * C/P/S0/S1 states when this bit is set. in tsc_check_state()
213 if (!pr->pblk) in acpi_processor_get_power_info_fadt()
214 return -ENODEV; in acpi_processor_get_power_info_fadt()
217 pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; in acpi_processor_get_power_info_fadt()
218 pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; in acpi_processor_get_power_info_fadt()
227 return -ENODEV; in acpi_processor_get_power_info_fadt()
231 pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4; in acpi_processor_get_power_info_fadt()
232 pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5; in acpi_processor_get_power_info_fadt()
235 pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.c2_latency; in acpi_processor_get_power_info_fadt()
236 pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.c3_latency; in acpi_processor_get_power_info_fadt()
243 acpi_handle_debug(pr->handle, "C2 latency too large [%d]\n", in acpi_processor_get_power_info_fadt()
246 pr->power.states[ACPI_STATE_C2].address = 0; in acpi_processor_get_power_info_fadt()
254 acpi_handle_debug(pr->handle, "C3 latency too large [%d]\n", in acpi_processor_get_power_info_fadt()
257 pr->power.states[ACPI_STATE_C3].address = 0; in acpi_processor_get_power_info_fadt()
260 acpi_handle_debug(pr->handle, "lvl2[0x%08x] lvl3[0x%08x]\n", in acpi_processor_get_power_info_fadt()
261 pr->power.states[ACPI_STATE_C2].address, in acpi_processor_get_power_info_fadt()
262 pr->power.states[ACPI_STATE_C3].address); in acpi_processor_get_power_info_fadt()
264 snprintf(pr->power.states[ACPI_STATE_C2].desc, in acpi_processor_get_power_info_fadt()
266 pr->power.states[ACPI_STATE_C2].address); in acpi_processor_get_power_info_fadt()
267 snprintf(pr->power.states[ACPI_STATE_C3].desc, in acpi_processor_get_power_info_fadt()
269 pr->power.states[ACPI_STATE_C3].address); in acpi_processor_get_power_info_fadt()
271 if (!pr->power.states[ACPI_STATE_C2].address && in acpi_processor_get_power_info_fadt()
272 !pr->power.states[ACPI_STATE_C3].address) in acpi_processor_get_power_info_fadt()
273 return -ENODEV; in acpi_processor_get_power_info_fadt()
280 if (!pr->power.states[ACPI_STATE_C1].valid) { in acpi_processor_get_power_info_default()
281 /* set the first C-State to C1 */ in acpi_processor_get_power_info_default()
283 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; in acpi_processor_get_power_info_default()
284 pr->power.states[ACPI_STATE_C1].valid = 1; in acpi_processor_get_power_info_default()
285 pr->power.states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_HALT; in acpi_processor_get_power_info_default()
287 snprintf(pr->power.states[ACPI_STATE_C1].desc, in acpi_processor_get_power_info_default()
291 pr->power.states[ACPI_STATE_C0].valid = 1; in acpi_processor_get_power_info_default()
300 return -ENODEV; in acpi_processor_get_power_info_cst()
302 ret = acpi_processor_evaluate_cst(pr->handle, pr->id, &pr->power); in acpi_processor_get_power_info_cst()
306 if (!pr->power.count) in acpi_processor_get_power_info_cst()
307 return -EFAULT; in acpi_processor_get_power_info_cst()
309 pr->flags.has_cst = 1; in acpi_processor_get_power_info_cst()
316 static int bm_check_flag = -1; in acpi_processor_power_verify_c3()
317 static int bm_control_flag = -1; in acpi_processor_power_verify_c3()
320 if (!cx->address) in acpi_processor_power_verify_c3()
324 * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) in acpi_processor_power_verify_c3()
326 * Note that we could disable Type-F DMA (as recommended by in acpi_processor_power_verify_c3()
331 acpi_handle_debug(pr->handle, in acpi_processor_power_verify_c3()
332 "C3 not supported on PIIX4 with Type-F DMA\n"); in acpi_processor_power_verify_c3()
337 if (bm_check_flag == -1) { in acpi_processor_power_verify_c3()
339 acpi_processor_power_init_bm_check(&(pr->flags), pr->id); in acpi_processor_power_verify_c3()
340 bm_check_flag = pr->flags.bm_check; in acpi_processor_power_verify_c3()
341 bm_control_flag = pr->flags.bm_control; in acpi_processor_power_verify_c3()
343 pr->flags.bm_check = bm_check_flag; in acpi_processor_power_verify_c3()
344 pr->flags.bm_control = bm_control_flag; in acpi_processor_power_verify_c3()
347 if (pr->flags.bm_check) { in acpi_processor_power_verify_c3()
348 if (!pr->flags.bm_control) { in acpi_processor_power_verify_c3()
349 if (pr->flags.has_cst != 1) { in acpi_processor_power_verify_c3()
351 acpi_handle_debug(pr->handle, in acpi_processor_power_verify_c3()
356 acpi_handle_debug(pr->handle, in acpi_processor_power_verify_c3()
366 acpi_handle_debug(pr->handle, in acpi_processor_power_verify_c3()
379 cx->valid = 1; in acpi_processor_power_verify_c3()
392 static void acpi_cst_latency_sort(struct acpi_processor_cx *states, size_t length) in acpi_cst_latency_sort() argument
397 if (!states[i].valid) in acpi_cst_latency_sort()
400 for (j = i - 1, k = i; j >= 0; j--) { in acpi_cst_latency_sort()
401 if (!states[j].valid) in acpi_cst_latency_sort()
404 if (states[j].latency > states[k].latency) in acpi_cst_latency_sort()
405 swap(states[j].latency, states[k].latency); in acpi_cst_latency_sort()
420 pr->power.timer_broadcast_on_state = INT_MAX; in acpi_processor_power_verify()
423 struct acpi_processor_cx *cx = &pr->power.states[i]; in acpi_processor_power_verify()
425 switch (cx->type) { in acpi_processor_power_verify()
427 cx->valid = 1; in acpi_processor_power_verify()
431 if (!cx->address) in acpi_processor_power_verify()
433 cx->valid = 1; in acpi_processor_power_verify()
440 if (!cx->valid) in acpi_processor_power_verify()
442 if (cx->type >= last_type && cx->latency < last_latency) in acpi_processor_power_verify()
444 last_latency = cx->latency; in acpi_processor_power_verify()
445 last_type = cx->type; in acpi_processor_power_verify()
448 tsc_check_state(cx->type); in acpi_processor_power_verify()
453 pr_notice("FW issue: working around C-state latencies out of order\n"); in acpi_processor_power_verify()
454 acpi_cst_latency_sort(&pr->power.states[1], max_cstate); in acpi_processor_power_verify()
471 /* Zero initialize all the C-states info. */ in acpi_processor_get_cstate_info()
472 memset(pr->power.states, 0, sizeof(pr->power.states)); in acpi_processor_get_cstate_info()
475 if (result == -ENODEV) in acpi_processor_get_cstate_info()
483 pr->power.count = acpi_processor_power_verify(pr); in acpi_processor_get_cstate_info()
490 if (pr->power.states[i].valid) { in acpi_processor_get_cstate_info()
491 pr->power.count = i; in acpi_processor_get_cstate_info()
492 pr->flags.power = 1; in acpi_processor_get_cstate_info()
500 * acpi_idle_bm_check - checks if bus master activity was detected
527 /* IO port based C-state */ in io_idle()
538 * that the motivating chipset issue was Intel-only. in io_idle()
544 * Dummy wait op - must do something useless after P_LVL2 read in io_idle()
559 * acpi_idle_do_entry - enter idle state using the appropriate method
568 if (cx->entry_method == ACPI_CSTATE_FFH) { in acpi_idle_do_entry()
569 /* Call into architectural FFH based C-state */ in acpi_idle_do_entry()
571 } else if (cx->entry_method == ACPI_CSTATE_HALT) { in acpi_idle_do_entry()
574 io_idle(cx->address); in acpi_idle_do_entry()
581 * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining)
587 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_play_dead()
593 if (cx->entry_method == ACPI_CSTATE_HALT) in acpi_idle_play_dead()
595 else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { in acpi_idle_play_dead()
596 io_idle(cx->address); in acpi_idle_play_dead()
598 return -ENODEV; in acpi_idle_play_dead()
607 return IS_ENABLED(CONFIG_HOTPLUG_CPU) && !pr->flags.has_cst && in acpi_idle_fallback_to_c1()
615 * acpi_idle_enter_bm - enters C3 with proper BM handling
638 bool dis_bm = pr->flags.bm_control; in acpi_idle_enter_bm()
643 if (!cx->bm_sts_skip && acpi_idle_bm_check()) { in acpi_idle_enter_bm()
645 index = drv->safe_state_index; in acpi_idle_enter_bm()
650 index = -EBUSY; in acpi_idle_enter_bm()
669 /* Re-enable bus master arbitration */ in acpi_idle_enter_bm()
673 c3_cpu_count--; in acpi_idle_enter_bm()
685 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_enter()
690 return -EINVAL; in acpi_idle_enter()
692 if (cx->type != ACPI_STATE_C1) { in acpi_idle_enter()
693 if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) in acpi_idle_enter()
699 cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_enter()
703 if (cx->type == ACPI_STATE_C3) in acpi_idle_enter()
714 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_enter_s2idle()
716 if (cx->type == ACPI_STATE_C3) { in acpi_idle_enter_s2idle()
722 if (pr->flags.bm_check) { in acpi_idle_enter_s2idle()
723 u8 bm_sts_skip = cx->bm_sts_skip; in acpi_idle_enter_s2idle()
726 cx->bm_sts_skip = 1; in acpi_idle_enter_s2idle()
728 cx->bm_sts_skip = bm_sts_skip; in acpi_idle_enter_s2idle()
751 state = &acpi_idle_driver.states[count]; in acpi_processor_setup_cpuidle_cx()
752 cx = &pr->power.states[i]; in acpi_processor_setup_cpuidle_cx()
754 if (!cx->valid) in acpi_processor_setup_cpuidle_cx()
757 per_cpu(acpi_cstate[count], dev->cpu) = cx; in acpi_processor_setup_cpuidle_cx()
760 state->flags |= CPUIDLE_FLAG_TIMER_STOP; in acpi_processor_setup_cpuidle_cx()
762 if (cx->type == ACPI_STATE_C3) { in acpi_processor_setup_cpuidle_cx()
763 state->flags |= CPUIDLE_FLAG_TLB_FLUSHED; in acpi_processor_setup_cpuidle_cx()
764 if (pr->flags.bm_check) in acpi_processor_setup_cpuidle_cx()
765 state->flags |= CPUIDLE_FLAG_RCU_IDLE; in acpi_processor_setup_cpuidle_cx()
774 return -EINVAL; in acpi_processor_setup_cpuidle_cx()
797 cx = &pr->power.states[i]; in acpi_processor_setup_cstates()
799 if (!cx->valid) in acpi_processor_setup_cstates()
802 state = &drv->states[count]; in acpi_processor_setup_cstates()
803 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); in acpi_processor_setup_cstates()
804 strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); in acpi_processor_setup_cstates()
805 state->exit_latency = cx->latency; in acpi_processor_setup_cstates()
806 state->target_residency = cx->latency * latency_factor; in acpi_processor_setup_cstates()
807 state->enter = acpi_idle_enter; in acpi_processor_setup_cstates()
809 state->flags = 0; in acpi_processor_setup_cstates()
810 if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 || in acpi_processor_setup_cstates()
811 cx->type == ACPI_STATE_C3) { in acpi_processor_setup_cstates()
812 state->enter_dead = acpi_idle_play_dead; in acpi_processor_setup_cstates()
813 if (cx->type != ACPI_STATE_C3) in acpi_processor_setup_cstates()
814 drv->safe_state_index = count; in acpi_processor_setup_cstates()
817 * Halt-induced C1 is not good for ->enter_s2idle, because it in acpi_processor_setup_cstates()
818 * re-enables interrupts on exit. Moreover, C1 is generally not in acpi_processor_setup_cstates()
819 * particularly interesting from the suspend-to-idle angle, so in acpi_processor_setup_cstates()
823 if (cx->type != ACPI_STATE_C1 && !acpi_idle_fallback_to_c1(pr)) in acpi_processor_setup_cstates()
824 state->enter_s2idle = acpi_idle_enter_s2idle; in acpi_processor_setup_cstates()
831 drv->state_count = count; in acpi_processor_setup_cstates()
834 return -EINVAL; in acpi_processor_setup_cstates()
848 pr_notice("processor limited to max C-state %d\n", max_cstate); in acpi_processor_cstate_first_run_checks()
863 return -ENODEV; in acpi_processor_get_cstate_info()
869 return -EINVAL; in acpi_processor_setup_cpuidle_cx()
874 return -EINVAL; in acpi_processor_setup_cstates()
888 if (obj->type != ACPI_TYPE_INTEGER) in obj_get_integer()
889 return -EINVAL; in obj_get_integer()
891 *value = obj->integer.value; in obj_get_integer()
908 return -ENODEV; in acpi_processor_evaluate_lpi()
914 if (!lpi_data || lpi_data->type != ACPI_TYPE_PACKAGE || in acpi_processor_evaluate_lpi()
915 lpi_data->package.count < 4) { in acpi_processor_evaluate_lpi()
917 ret = -ENODATA; in acpi_processor_evaluate_lpi()
921 pkg_count = lpi_data->package.elements[2].integer.value; in acpi_processor_evaluate_lpi()
923 /* Validate number of power states. */ in acpi_processor_evaluate_lpi()
924 if (pkg_count < 1 || pkg_count != lpi_data->package.count - 3) { in acpi_processor_evaluate_lpi()
926 ret = -ENODATA; in acpi_processor_evaluate_lpi()
932 ret = -ENOMEM; in acpi_processor_evaluate_lpi()
936 info->size = pkg_count; in acpi_processor_evaluate_lpi()
937 info->entries = lpi_state; in acpi_processor_evaluate_lpi()
939 /* LPI States start at index 3 */ in acpi_processor_evaluate_lpi()
943 element = &lpi_data->package.elements[loop]; in acpi_processor_evaluate_lpi()
944 if (element->type != ACPI_TYPE_PACKAGE || element->package.count < 7) in acpi_processor_evaluate_lpi()
947 pkg_elem = element->package.elements; in acpi_processor_evaluate_lpi()
950 if (obj->type == ACPI_TYPE_BUFFER) { in acpi_processor_evaluate_lpi()
953 reg = (struct acpi_power_register *)obj->buffer.pointer; in acpi_processor_evaluate_lpi()
954 if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && in acpi_processor_evaluate_lpi()
955 reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) in acpi_processor_evaluate_lpi()
958 lpi_state->address = reg->address; in acpi_processor_evaluate_lpi()
959 lpi_state->entry_method = in acpi_processor_evaluate_lpi()
960 reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE ? in acpi_processor_evaluate_lpi()
962 } else if (obj->type == ACPI_TYPE_INTEGER) { in acpi_processor_evaluate_lpi()
963 lpi_state->entry_method = ACPI_CSTATE_INTEGER; in acpi_processor_evaluate_lpi()
964 lpi_state->address = obj->integer.value; in acpi_processor_evaluate_lpi()
972 if (obj->type == ACPI_TYPE_STRING) in acpi_processor_evaluate_lpi()
973 strscpy(lpi_state->desc, obj->string.pointer, in acpi_processor_evaluate_lpi()
976 lpi_state->index = state_idx; in acpi_processor_evaluate_lpi()
977 if (obj_get_integer(pkg_elem + 0, &lpi_state->min_residency)) { in acpi_processor_evaluate_lpi()
979 lpi_state->min_residency = 10; in acpi_processor_evaluate_lpi()
982 if (obj_get_integer(pkg_elem + 1, &lpi_state->wake_latency)) { in acpi_processor_evaluate_lpi()
984 lpi_state->wake_latency = 10; in acpi_processor_evaluate_lpi()
987 if (obj_get_integer(pkg_elem + 2, &lpi_state->flags)) in acpi_processor_evaluate_lpi()
988 lpi_state->flags = 0; in acpi_processor_evaluate_lpi()
990 if (obj_get_integer(pkg_elem + 3, &lpi_state->arch_flags)) in acpi_processor_evaluate_lpi()
991 lpi_state->arch_flags = 0; in acpi_processor_evaluate_lpi()
993 if (obj_get_integer(pkg_elem + 4, &lpi_state->res_cnt_freq)) in acpi_processor_evaluate_lpi()
994 lpi_state->res_cnt_freq = 1; in acpi_processor_evaluate_lpi()
996 if (obj_get_integer(pkg_elem + 5, &lpi_state->enable_parent_state)) in acpi_processor_evaluate_lpi()
997 lpi_state->enable_parent_state = 0; in acpi_processor_evaluate_lpi()
1000 acpi_handle_debug(handle, "Found %d power states\n", state_idx); in acpi_processor_evaluate_lpi()
1007 * flat_state_cnt - the number of composite LPI states after the process of flattening
1012 * combine_lpi_states - combine local and parent LPI states to form a composite LPI state
1022 if (parent->entry_method == ACPI_CSTATE_INTEGER) { in combine_lpi_states()
1023 if (!parent->address) /* 0 means autopromotable */ in combine_lpi_states()
1025 result->address = local->address + parent->address; in combine_lpi_states()
1027 result->address = parent->address; in combine_lpi_states()
1030 result->min_residency = max(local->min_residency, parent->min_residency); in combine_lpi_states()
1031 result->wake_latency = local->wake_latency + parent->wake_latency; in combine_lpi_states()
1032 result->enable_parent_state = parent->enable_parent_state; in combine_lpi_states()
1033 result->entry_method = local->entry_method; in combine_lpi_states()
1035 result->flags = parent->flags; in combine_lpi_states()
1036 result->arch_flags = parent->arch_flags; in combine_lpi_states()
1037 result->index = parent->index; in combine_lpi_states()
1039 strscpy(result->desc, local->desc, ACPI_CX_DESC_LEN); in combine_lpi_states()
1040 strlcat(result->desc, "+", ACPI_CX_DESC_LEN); in combine_lpi_states()
1041 strlcat(result->desc, parent->desc, ACPI_CX_DESC_LEN); in combine_lpi_states()
1050 curr_level->composite_states[curr_level->composite_states_size++] = t; in stash_composite_state()
1057 int i, j, state_count = curr_level->size; in flatten_lpi_states()
1058 struct acpi_lpi_state *p, *t = curr_level->entries; in flatten_lpi_states() local
1060 curr_level->composite_states_size = 0; in flatten_lpi_states()
1064 if (!(t->flags & ACPI_LPI_STATE_FLAGS_ENABLED)) in flatten_lpi_states()
1068 pr_warn("Limiting number of LPI states to max (%d)\n", in flatten_lpi_states()
1074 flpi = &pr->power.lpi_states[flat_state_cnt]; in flatten_lpi_states()
1083 for (i = 0; i < prev_level->composite_states_size; i++) { in flatten_lpi_states()
1084 p = prev_level->composite_states[i]; in flatten_lpi_states()
1085 if (t->index <= p->enable_parent_state && in flatten_lpi_states()
1086 combine_lpi_states(p, t, flpi)) { in flatten_lpi_states()
1094 kfree(curr_level->entries); in flatten_lpi_states()
1100 return -EOPNOTSUPP; in acpi_processor_ffh_lpi_probe()
1107 acpi_handle handle = pr->handle, pr_ahandle; in acpi_processor_get_lpi_info()
1112 ret = acpi_processor_ffh_lpi_probe(pr->id); in acpi_processor_get_lpi_info()
1113 if (ret == -EOPNOTSUPP) in acpi_processor_get_lpi_info()
1117 return -EOPNOTSUPP; in acpi_processor_get_lpi_info()
1120 return -EINVAL; in acpi_processor_get_lpi_info()
1125 handle = pr->handle; in acpi_processor_get_lpi_info()
1150 /* flatten all the LPI states in this level of hierarchy */ in acpi_processor_get_lpi_info()
1158 pr->power.count = flat_state_cnt; in acpi_processor_get_lpi_info()
1160 for (i = 0; i < pr->power.count; i++) in acpi_processor_get_lpi_info()
1161 pr->power.lpi_states[i].index = i; in acpi_processor_get_lpi_info()
1164 pr->flags.has_lpi = 1; in acpi_processor_get_lpi_info()
1165 pr->flags.power = 1; in acpi_processor_get_lpi_info()
1172 return -ENODEV; in acpi_processor_ffh_lpi_enter()
1176 * acpi_idle_lpi_enter - enters an ACPI any LPI state
1192 return -EINVAL; in acpi_idle_lpi_enter()
1194 lpi = &pr->power.lpi_states[index]; in acpi_idle_lpi_enter()
1195 if (lpi->entry_method == ACPI_CSTATE_FFH) in acpi_idle_lpi_enter()
1198 return -EINVAL; in acpi_idle_lpi_enter()
1208 if (!pr->flags.has_lpi) in acpi_processor_setup_lpi_states()
1209 return -EOPNOTSUPP; in acpi_processor_setup_lpi_states()
1211 for (i = 0; i < pr->power.count && i < CPUIDLE_STATE_MAX; i++) { in acpi_processor_setup_lpi_states()
1212 lpi = &pr->power.lpi_states[i]; in acpi_processor_setup_lpi_states()
1214 state = &drv->states[i]; in acpi_processor_setup_lpi_states()
1215 snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i); in acpi_processor_setup_lpi_states()
1216 strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); in acpi_processor_setup_lpi_states()
1217 state->exit_latency = lpi->wake_latency; in acpi_processor_setup_lpi_states()
1218 state->target_residency = lpi->min_residency; in acpi_processor_setup_lpi_states()
1219 state->flags |= arch_get_idle_state_flags(lpi->arch_flags); in acpi_processor_setup_lpi_states()
1220 if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH) in acpi_processor_setup_lpi_states()
1221 state->flags |= CPUIDLE_FLAG_RCU_IDLE; in acpi_processor_setup_lpi_states()
1222 state->enter = acpi_idle_lpi_enter; in acpi_processor_setup_lpi_states()
1223 drv->safe_state_index = i; in acpi_processor_setup_lpi_states()
1226 drv->state_count = i; in acpi_processor_setup_lpi_states()
1232 * acpi_processor_setup_cpuidle_states- prepares and configures cpuidle
1242 if (!pr->flags.power_setup_done || !pr->flags.power) in acpi_processor_setup_cpuidle_states()
1243 return -EINVAL; in acpi_processor_setup_cpuidle_states()
1245 drv->safe_state_index = -1; in acpi_processor_setup_cpuidle_states()
1247 drv->states[i].name[0] = '\0'; in acpi_processor_setup_cpuidle_states()
1248 drv->states[i].desc[0] = '\0'; in acpi_processor_setup_cpuidle_states()
1251 if (pr->flags.has_lpi) in acpi_processor_setup_cpuidle_states()
1258 * acpi_processor_setup_cpuidle_dev - prepares and configures CPUIDLE
1259 * device i.e. per-cpu data
1267 if (!pr->flags.power_setup_done || !pr->flags.power || !dev) in acpi_processor_setup_cpuidle_dev()
1268 return -EINVAL; in acpi_processor_setup_cpuidle_dev()
1270 dev->cpu = pr->id; in acpi_processor_setup_cpuidle_dev()
1271 if (pr->flags.has_lpi) in acpi_processor_setup_cpuidle_dev()
1272 return acpi_processor_ffh_lpi_probe(pr->id); in acpi_processor_setup_cpuidle_dev()
1296 if (!pr->flags.power_setup_done) in acpi_processor_hotplug()
1297 return -ENODEV; in acpi_processor_hotplug()
1299 dev = per_cpu(acpi_cpuidle_device, pr->id); in acpi_processor_hotplug()
1303 if (!ret && pr->flags.power) { in acpi_processor_hotplug()
1321 if (!pr->flags.power_setup_done) in acpi_processor_power_state_has_changed()
1322 return -ENODEV; in acpi_processor_power_state_has_changed()
1326 * system instead of once per-cpu. This condition is a hack in acpi_processor_power_state_has_changed()
1327 * to make the code that updates C-States be called once. in acpi_processor_power_state_has_changed()
1330 if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { in acpi_processor_power_state_has_changed()
1332 /* Protect against cpu-hotplug */ in acpi_processor_power_state_has_changed()
1339 if (!_pr || !_pr->flags.power_setup_done) in acpi_processor_power_state_has_changed()
1345 /* Populate Updated C-state information */ in acpi_processor_power_state_has_changed()
1352 if (!_pr || !_pr->flags.power_setup_done) in acpi_processor_power_state_has_changed()
1355 if (_pr->flags.power) { in acpi_processor_power_state_has_changed()
1381 pr->flags.power_setup_done = 1; in acpi_processor_power_init()
1388 if (pr->flags.power) { in acpi_processor_power_init()
1401 return -ENOMEM; in acpi_processor_power_init()
1402 per_cpu(acpi_cpuidle_device, pr->id) = dev; in acpi_processor_power_init()
1406 /* Register per-cpu cpuidle_device. Cpuidle driver in acpi_processor_power_init()
1422 struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); in acpi_processor_power_exit()
1427 if (pr->flags.power) { in acpi_processor_power_exit()
1429 acpi_processor_registered--; in acpi_processor_power_exit()
1436 pr->flags.power_setup_done = 0; in acpi_processor_power_exit()