• Home
  • Raw
  • Download

Lines Matching +full:c +full:- +full:states

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * processor_idle - idle state submodule to the ACPI processor driver
5 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
6 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
7 * Copyright (C) 2004, 2005 Dominik Brodowski <linux@brodo.de>
8 * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
9 * - Added processor hotplug support
10 * Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
11 * - Added support for C3 on SMP
29 * creating an empty asm-ia64/apic.h would just trade pest vs. cholera.
80 pr_notice("%s detected - limiting to C%ld max_cstate." in set_max_cstate()
81 " Override with \"processor.max_cstate=%d\"\n", id->ident, in set_max_cstate()
82 (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); in set_max_cstate()
84 max_cstate = (long)id->driver_data; in set_max_cstate()
92 DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")},
95 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
129 struct acpi_processor_power *pwr = &pr->power; in lapic_timer_check_state()
132 if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) in lapic_timer_check_state()
139 * Check, if one of the previous states already marked the lapic in lapic_timer_check_state()
142 if (pwr->timer_broadcast_on_state < state) in lapic_timer_check_state()
145 if (cx->type >= type) in lapic_timer_check_state()
146 pr->power.timer_broadcast_on_state = state; in lapic_timer_check_state()
153 if (pr->power.timer_broadcast_on_state < INT_MAX) in __lapic_timer_propagate_broadcast()
161 smp_call_function_single(pr->id, __lapic_timer_propagate_broadcast, in lapic_timer_propagate_broadcast()
165 /* Power(C) State timer broadcast control */
169 return cx - pr->power.states >= pr->power.timer_broadcast_on_state; in lapic_timer_needs_broadcast()
197 * C/P/S0/S1 states when this bit is set. in tsc_check_state()
215 if (!pr->pblk) in acpi_processor_get_power_info_fadt()
216 return -ENODEV; in acpi_processor_get_power_info_fadt()
219 pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; in acpi_processor_get_power_info_fadt()
220 pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; in acpi_processor_get_power_info_fadt()
229 return -ENODEV; in acpi_processor_get_power_info_fadt()
233 pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4; in acpi_processor_get_power_info_fadt()
234 pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5; in acpi_processor_get_power_info_fadt()
237 pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.c2_latency; in acpi_processor_get_power_info_fadt()
238 pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.c3_latency; in acpi_processor_get_power_info_fadt()
248 pr->power.states[ACPI_STATE_C2].address = 0; in acpi_processor_get_power_info_fadt()
259 pr->power.states[ACPI_STATE_C3].address = 0; in acpi_processor_get_power_info_fadt()
264 pr->power.states[ACPI_STATE_C2].address, in acpi_processor_get_power_info_fadt()
265 pr->power.states[ACPI_STATE_C3].address)); in acpi_processor_get_power_info_fadt()
267 snprintf(pr->power.states[ACPI_STATE_C2].desc, in acpi_processor_get_power_info_fadt()
269 pr->power.states[ACPI_STATE_C2].address); in acpi_processor_get_power_info_fadt()
270 snprintf(pr->power.states[ACPI_STATE_C3].desc, in acpi_processor_get_power_info_fadt()
272 pr->power.states[ACPI_STATE_C3].address); in acpi_processor_get_power_info_fadt()
279 if (!pr->power.states[ACPI_STATE_C1].valid) { in acpi_processor_get_power_info_default()
280 /* set the first C-State to C1 */ in acpi_processor_get_power_info_default()
282 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; in acpi_processor_get_power_info_default()
283 pr->power.states[ACPI_STATE_C1].valid = 1; in acpi_processor_get_power_info_default()
284 pr->power.states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_HALT; in acpi_processor_get_power_info_default()
286 snprintf(pr->power.states[ACPI_STATE_C1].desc, in acpi_processor_get_power_info_default()
290 pr->power.states[ACPI_STATE_C0].valid = 1; in acpi_processor_get_power_info_default()
299 return -ENODEV; in acpi_processor_get_power_info_cst()
301 ret = acpi_processor_evaluate_cst(pr->handle, pr->id, &pr->power); in acpi_processor_get_power_info_cst()
305 if (!pr->power.count) in acpi_processor_get_power_info_cst()
306 return -EFAULT; in acpi_processor_get_power_info_cst()
308 pr->flags.has_cst = 1; in acpi_processor_get_power_info_cst()
315 static int bm_check_flag = -1; in acpi_processor_power_verify_c3()
316 static int bm_control_flag = -1; in acpi_processor_power_verify_c3()
319 if (!cx->address) in acpi_processor_power_verify_c3()
323 * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) in acpi_processor_power_verify_c3()
325 * Note that we could disable Type-F DMA (as recommended by in acpi_processor_power_verify_c3()
331 "C3 not supported on PIIX4 with Type-F DMA\n")); in acpi_processor_power_verify_c3()
336 if (bm_check_flag == -1) { in acpi_processor_power_verify_c3()
338 acpi_processor_power_init_bm_check(&(pr->flags), pr->id); in acpi_processor_power_verify_c3()
339 bm_check_flag = pr->flags.bm_check; in acpi_processor_power_verify_c3()
340 bm_control_flag = pr->flags.bm_control; in acpi_processor_power_verify_c3()
342 pr->flags.bm_check = bm_check_flag; in acpi_processor_power_verify_c3()
343 pr->flags.bm_control = bm_control_flag; in acpi_processor_power_verify_c3()
346 if (pr->flags.bm_check) { in acpi_processor_power_verify_c3()
347 if (!pr->flags.bm_control) { in acpi_processor_power_verify_c3()
348 if (pr->flags.has_cst != 1) { in acpi_processor_power_verify_c3()
378 cx->valid = 1; in acpi_processor_power_verify_c3()
397 if (!(x->valid && y->valid)) in acpi_cst_latency_cmp()
399 if (x->latency > y->latency) in acpi_cst_latency_cmp()
401 if (x->latency < y->latency) in acpi_cst_latency_cmp()
402 return -1; in acpi_cst_latency_cmp()
410 if (!(x->valid && y->valid)) in acpi_cst_latency_swap()
412 tmp = x->latency; in acpi_cst_latency_swap()
413 x->latency = y->latency; in acpi_cst_latency_swap()
414 y->latency = tmp; in acpi_cst_latency_swap()
425 pr->power.timer_broadcast_on_state = INT_MAX; in acpi_processor_power_verify()
428 struct acpi_processor_cx *cx = &pr->power.states[i]; in acpi_processor_power_verify()
430 switch (cx->type) { in acpi_processor_power_verify()
432 cx->valid = 1; in acpi_processor_power_verify()
436 if (!cx->address) in acpi_processor_power_verify()
438 cx->valid = 1; in acpi_processor_power_verify()
445 if (!cx->valid) in acpi_processor_power_verify()
447 if (cx->type >= last_type && cx->latency < last_latency) in acpi_processor_power_verify()
449 last_latency = cx->latency; in acpi_processor_power_verify()
450 last_type = cx->type; in acpi_processor_power_verify()
453 tsc_check_state(cx->type); in acpi_processor_power_verify()
458 pr_notice("FW issue: working around C-state latencies out of order\n"); in acpi_processor_power_verify()
459 sort(&pr->power.states[1], max_cstate, in acpi_processor_power_verify()
479 /* Zero initialize all the C-states info. */ in acpi_processor_get_cstate_info()
480 memset(pr->power.states, 0, sizeof(pr->power.states)); in acpi_processor_get_cstate_info()
483 if (result == -ENODEV) in acpi_processor_get_cstate_info()
491 pr->power.count = acpi_processor_power_verify(pr); in acpi_processor_get_cstate_info()
498 if (pr->power.states[i].valid) { in acpi_processor_get_cstate_info()
499 pr->power.count = i; in acpi_processor_get_cstate_info()
500 pr->flags.power = 1; in acpi_processor_get_cstate_info()
508 * acpi_idle_bm_check - checks if bus master activity was detected
543 * that the motivating chipset issue was Intel-only. in wait_for_freeze()
549 * Dummy wait op - must do something useless after P_LVL2 read in wait_for_freeze()
564 * acpi_idle_do_entry - enter idle state using the appropriate method
571 if (cx->entry_method == ACPI_CSTATE_FFH) { in acpi_idle_do_entry()
572 /* Call into architectural FFH based C-state */ in acpi_idle_do_entry()
574 } else if (cx->entry_method == ACPI_CSTATE_HALT) { in acpi_idle_do_entry()
577 /* IO port based C-state */ in acpi_idle_do_entry()
578 inb(cx->address); in acpi_idle_do_entry()
584 * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining)
590 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_play_dead()
596 if (cx->entry_method == ACPI_CSTATE_HALT) in acpi_idle_play_dead()
598 else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { in acpi_idle_play_dead()
599 inb(cx->address); in acpi_idle_play_dead()
602 return -ENODEV; in acpi_idle_play_dead()
615 return IS_ENABLED(CONFIG_HOTPLUG_CPU) && !pr->flags.has_cst && in acpi_idle_fallback_to_c1()
623 * acpi_idle_enter_bm - enters C3 with proper BM handling
646 bool dis_bm = pr->flags.bm_control; in acpi_idle_enter_bm()
649 if (!cx->bm_sts_skip && acpi_idle_bm_check()) { in acpi_idle_enter_bm()
651 index = drv->safe_state_index; in acpi_idle_enter_bm()
656 index = -EBUSY; in acpi_idle_enter_bm()
675 /* Re-enable bus master arbitration */ in acpi_idle_enter_bm()
679 c3_cpu_count--; in acpi_idle_enter_bm()
689 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_enter()
694 return -EINVAL; in acpi_idle_enter()
696 if (cx->type != ACPI_STATE_C1) { in acpi_idle_enter()
697 if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) in acpi_idle_enter()
703 cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_enter()
707 if (cx->type == ACPI_STATE_C3) in acpi_idle_enter()
718 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); in acpi_idle_enter_s2idle()
720 if (cx->type == ACPI_STATE_C3) { in acpi_idle_enter_s2idle()
726 if (pr->flags.bm_check) { in acpi_idle_enter_s2idle()
727 u8 bm_sts_skip = cx->bm_sts_skip; in acpi_idle_enter_s2idle()
730 cx->bm_sts_skip = 1; in acpi_idle_enter_s2idle()
732 cx->bm_sts_skip = bm_sts_skip; in acpi_idle_enter_s2idle()
755 state = &acpi_idle_driver.states[count]; in acpi_processor_setup_cpuidle_cx()
756 cx = &pr->power.states[i]; in acpi_processor_setup_cpuidle_cx()
758 if (!cx->valid) in acpi_processor_setup_cpuidle_cx()
761 per_cpu(acpi_cstate[count], dev->cpu) = cx; in acpi_processor_setup_cpuidle_cx()
764 state->flags |= CPUIDLE_FLAG_TIMER_STOP; in acpi_processor_setup_cpuidle_cx()
766 if (cx->type == ACPI_STATE_C3) { in acpi_processor_setup_cpuidle_cx()
767 state->flags |= CPUIDLE_FLAG_TLB_FLUSHED; in acpi_processor_setup_cpuidle_cx()
768 if (pr->flags.bm_check) in acpi_processor_setup_cpuidle_cx()
769 state->flags |= CPUIDLE_FLAG_RCU_IDLE; in acpi_processor_setup_cpuidle_cx()
778 return -EINVAL; in acpi_processor_setup_cpuidle_cx()
801 cx = &pr->power.states[i]; in acpi_processor_setup_cstates()
803 if (!cx->valid) in acpi_processor_setup_cstates()
806 state = &drv->states[count]; in acpi_processor_setup_cstates()
807 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); in acpi_processor_setup_cstates()
808 strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); in acpi_processor_setup_cstates()
809 state->exit_latency = cx->latency; in acpi_processor_setup_cstates()
810 state->target_residency = cx->latency * latency_factor; in acpi_processor_setup_cstates()
811 state->enter = acpi_idle_enter; in acpi_processor_setup_cstates()
813 state->flags = 0; in acpi_processor_setup_cstates()
814 if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) { in acpi_processor_setup_cstates()
815 state->enter_dead = acpi_idle_play_dead; in acpi_processor_setup_cstates()
816 drv->safe_state_index = count; in acpi_processor_setup_cstates()
819 * Halt-induced C1 is not good for ->enter_s2idle, because it in acpi_processor_setup_cstates()
820 * re-enables interrupts on exit. Moreover, C1 is generally not in acpi_processor_setup_cstates()
821 * particularly interesting from the suspend-to-idle angle, so in acpi_processor_setup_cstates()
825 if (cx->type != ACPI_STATE_C1 && !acpi_idle_fallback_to_c1(pr)) in acpi_processor_setup_cstates()
826 state->enter_s2idle = acpi_idle_enter_s2idle; in acpi_processor_setup_cstates()
833 drv->state_count = count; in acpi_processor_setup_cstates()
836 return -EINVAL; in acpi_processor_setup_cstates()
850 pr_notice("ACPI: processor limited to max C-state %d\n", in acpi_processor_cstate_first_run_checks()
865 return -ENODEV; in acpi_processor_get_cstate_info()
871 return -EINVAL; in acpi_processor_setup_cpuidle_cx()
876 return -EINVAL; in acpi_processor_setup_cstates()
890 if (obj->type != ACPI_TYPE_INTEGER) in obj_get_integer()
891 return -EINVAL; in obj_get_integer()
893 *value = obj->integer.value; in obj_get_integer()
910 return -ENODEV; in acpi_processor_evaluate_lpi()
916 if (!lpi_data || lpi_data->type != ACPI_TYPE_PACKAGE || in acpi_processor_evaluate_lpi()
917 lpi_data->package.count < 4) { in acpi_processor_evaluate_lpi()
919 ret = -ENODATA; in acpi_processor_evaluate_lpi()
923 pkg_count = lpi_data->package.elements[2].integer.value; in acpi_processor_evaluate_lpi()
925 /* Validate number of power states. */ in acpi_processor_evaluate_lpi()
926 if (pkg_count < 1 || pkg_count != lpi_data->package.count - 3) { in acpi_processor_evaluate_lpi()
928 ret = -ENODATA; in acpi_processor_evaluate_lpi()
934 ret = -ENOMEM; in acpi_processor_evaluate_lpi()
938 info->size = pkg_count; in acpi_processor_evaluate_lpi()
939 info->entries = lpi_state; in acpi_processor_evaluate_lpi()
941 /* LPI States start at index 3 */ in acpi_processor_evaluate_lpi()
945 element = &lpi_data->package.elements[loop]; in acpi_processor_evaluate_lpi()
946 if (element->type != ACPI_TYPE_PACKAGE || element->package.count < 7) in acpi_processor_evaluate_lpi()
949 pkg_elem = element->package.elements; in acpi_processor_evaluate_lpi()
952 if (obj->type == ACPI_TYPE_BUFFER) { in acpi_processor_evaluate_lpi()
955 reg = (struct acpi_power_register *)obj->buffer.pointer; in acpi_processor_evaluate_lpi()
956 if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && in acpi_processor_evaluate_lpi()
957 reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) in acpi_processor_evaluate_lpi()
960 lpi_state->address = reg->address; in acpi_processor_evaluate_lpi()
961 lpi_state->entry_method = in acpi_processor_evaluate_lpi()
962 reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE ? in acpi_processor_evaluate_lpi()
964 } else if (obj->type == ACPI_TYPE_INTEGER) { in acpi_processor_evaluate_lpi()
965 lpi_state->entry_method = ACPI_CSTATE_INTEGER; in acpi_processor_evaluate_lpi()
966 lpi_state->address = obj->integer.value; in acpi_processor_evaluate_lpi()
974 if (obj->type == ACPI_TYPE_STRING) in acpi_processor_evaluate_lpi()
975 strlcpy(lpi_state->desc, obj->string.pointer, in acpi_processor_evaluate_lpi()
978 lpi_state->index = state_idx; in acpi_processor_evaluate_lpi()
979 if (obj_get_integer(pkg_elem + 0, &lpi_state->min_residency)) { in acpi_processor_evaluate_lpi()
981 lpi_state->min_residency = 10; in acpi_processor_evaluate_lpi()
984 if (obj_get_integer(pkg_elem + 1, &lpi_state->wake_latency)) { in acpi_processor_evaluate_lpi()
986 lpi_state->wake_latency = 10; in acpi_processor_evaluate_lpi()
989 if (obj_get_integer(pkg_elem + 2, &lpi_state->flags)) in acpi_processor_evaluate_lpi()
990 lpi_state->flags = 0; in acpi_processor_evaluate_lpi()
992 if (obj_get_integer(pkg_elem + 3, &lpi_state->arch_flags)) in acpi_processor_evaluate_lpi()
993 lpi_state->arch_flags = 0; in acpi_processor_evaluate_lpi()
995 if (obj_get_integer(pkg_elem + 4, &lpi_state->res_cnt_freq)) in acpi_processor_evaluate_lpi()
996 lpi_state->res_cnt_freq = 1; in acpi_processor_evaluate_lpi()
998 if (obj_get_integer(pkg_elem + 5, &lpi_state->enable_parent_state)) in acpi_processor_evaluate_lpi()
999 lpi_state->enable_parent_state = 0; in acpi_processor_evaluate_lpi()
1002 acpi_handle_debug(handle, "Found %d power states\n", state_idx); in acpi_processor_evaluate_lpi()
1009 * flat_state_cnt - the number of composite LPI states after the process of flattening
1014 * combine_lpi_states - combine local and parent LPI states to form a composite LPI state
1024 if (parent->entry_method == ACPI_CSTATE_INTEGER) { in combine_lpi_states()
1025 if (!parent->address) /* 0 means autopromotable */ in combine_lpi_states()
1027 result->address = local->address + parent->address; in combine_lpi_states()
1029 result->address = parent->address; in combine_lpi_states()
1032 result->min_residency = max(local->min_residency, parent->min_residency); in combine_lpi_states()
1033 result->wake_latency = local->wake_latency + parent->wake_latency; in combine_lpi_states()
1034 result->enable_parent_state = parent->enable_parent_state; in combine_lpi_states()
1035 result->entry_method = local->entry_method; in combine_lpi_states()
1037 result->flags = parent->flags; in combine_lpi_states()
1038 result->arch_flags = parent->arch_flags; in combine_lpi_states()
1039 result->index = parent->index; in combine_lpi_states()
1041 strlcpy(result->desc, local->desc, ACPI_CX_DESC_LEN); in combine_lpi_states()
1042 strlcat(result->desc, "+", ACPI_CX_DESC_LEN); in combine_lpi_states()
1043 strlcat(result->desc, parent->desc, ACPI_CX_DESC_LEN); in combine_lpi_states()
1052 curr_level->composite_states[curr_level->composite_states_size++] = t; in stash_composite_state()
1059 int i, j, state_count = curr_level->size; in flatten_lpi_states()
1060 struct acpi_lpi_state *p, *t = curr_level->entries; in flatten_lpi_states()
1062 curr_level->composite_states_size = 0; in flatten_lpi_states()
1066 if (!(t->flags & ACPI_LPI_STATE_FLAGS_ENABLED)) in flatten_lpi_states()
1070 pr_warn("Limiting number of LPI states to max (%d)\n", in flatten_lpi_states()
1076 flpi = &pr->power.lpi_states[flat_state_cnt]; in flatten_lpi_states()
1085 for (i = 0; i < prev_level->composite_states_size; i++) { in flatten_lpi_states()
1086 p = prev_level->composite_states[i]; in flatten_lpi_states()
1087 if (t->index <= p->enable_parent_state && in flatten_lpi_states()
1096 kfree(curr_level->entries); in flatten_lpi_states()
1102 return -EOPNOTSUPP; in acpi_processor_ffh_lpi_probe()
1109 acpi_handle handle = pr->handle, pr_ahandle; in acpi_processor_get_lpi_info()
1114 ret = acpi_processor_ffh_lpi_probe(pr->id); in acpi_processor_get_lpi_info()
1115 if (ret == -EOPNOTSUPP) in acpi_processor_get_lpi_info()
1119 return -EOPNOTSUPP; in acpi_processor_get_lpi_info()
1122 return -EINVAL; in acpi_processor_get_lpi_info()
1127 handle = pr->handle; in acpi_processor_get_lpi_info()
1149 /* flatten all the LPI states in this level of hierarchy */ in acpi_processor_get_lpi_info()
1157 pr->power.count = flat_state_cnt; in acpi_processor_get_lpi_info()
1159 for (i = 0; i < pr->power.count; i++) in acpi_processor_get_lpi_info()
1160 pr->power.lpi_states[i].index = i; in acpi_processor_get_lpi_info()
1163 pr->flags.has_lpi = 1; in acpi_processor_get_lpi_info()
1164 pr->flags.power = 1; in acpi_processor_get_lpi_info()
1171 return -ENODEV; in acpi_processor_ffh_lpi_enter()
1175 * acpi_idle_lpi_enter - enters an ACPI any LPI state
1191 return -EINVAL; in acpi_idle_lpi_enter()
1193 lpi = &pr->power.lpi_states[index]; in acpi_idle_lpi_enter()
1194 if (lpi->entry_method == ACPI_CSTATE_FFH) in acpi_idle_lpi_enter()
1197 return -EINVAL; in acpi_idle_lpi_enter()
1207 if (!pr->flags.has_lpi) in acpi_processor_setup_lpi_states()
1208 return -EOPNOTSUPP; in acpi_processor_setup_lpi_states()
1210 for (i = 0; i < pr->power.count && i < CPUIDLE_STATE_MAX; i++) { in acpi_processor_setup_lpi_states()
1211 lpi = &pr->power.lpi_states[i]; in acpi_processor_setup_lpi_states()
1213 state = &drv->states[i]; in acpi_processor_setup_lpi_states()
1214 snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i); in acpi_processor_setup_lpi_states()
1215 strlcpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); in acpi_processor_setup_lpi_states()
1216 state->exit_latency = lpi->wake_latency; in acpi_processor_setup_lpi_states()
1217 state->target_residency = lpi->min_residency; in acpi_processor_setup_lpi_states()
1218 if (lpi->arch_flags) in acpi_processor_setup_lpi_states()
1219 state->flags |= CPUIDLE_FLAG_TIMER_STOP; in acpi_processor_setup_lpi_states()
1220 state->enter = acpi_idle_lpi_enter; in acpi_processor_setup_lpi_states()
1221 drv->safe_state_index = i; in acpi_processor_setup_lpi_states()
1224 drv->state_count = i; in acpi_processor_setup_lpi_states()
1230 * acpi_processor_setup_cpuidle_states- prepares and configures cpuidle
1240 if (!pr->flags.power_setup_done || !pr->flags.power) in acpi_processor_setup_cpuidle_states()
1241 return -EINVAL; in acpi_processor_setup_cpuidle_states()
1243 drv->safe_state_index = -1; in acpi_processor_setup_cpuidle_states()
1245 drv->states[i].name[0] = '\0'; in acpi_processor_setup_cpuidle_states()
1246 drv->states[i].desc[0] = '\0'; in acpi_processor_setup_cpuidle_states()
1249 if (pr->flags.has_lpi) in acpi_processor_setup_cpuidle_states()
1256 * acpi_processor_setup_cpuidle_dev - prepares and configures CPUIDLE
1257 * device i.e. per-cpu data
1265 if (!pr->flags.power_setup_done || !pr->flags.power || !dev) in acpi_processor_setup_cpuidle_dev()
1266 return -EINVAL; in acpi_processor_setup_cpuidle_dev()
1268 dev->cpu = pr->id; in acpi_processor_setup_cpuidle_dev()
1269 if (pr->flags.has_lpi) in acpi_processor_setup_cpuidle_dev()
1270 return acpi_processor_ffh_lpi_probe(pr->id); in acpi_processor_setup_cpuidle_dev()
1294 if (!pr->flags.power_setup_done) in acpi_processor_hotplug()
1295 return -ENODEV; in acpi_processor_hotplug()
1297 dev = per_cpu(acpi_cpuidle_device, pr->id); in acpi_processor_hotplug()
1301 if (!ret && pr->flags.power) { in acpi_processor_hotplug()
1319 if (!pr->flags.power_setup_done) in acpi_processor_power_state_has_changed()
1320 return -ENODEV; in acpi_processor_power_state_has_changed()
1324 * system instead of once per-cpu. This condition is a hack in acpi_processor_power_state_has_changed()
1325 * to make the code that updates C-States be called once. in acpi_processor_power_state_has_changed()
1328 if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { in acpi_processor_power_state_has_changed()
1330 /* Protect against cpu-hotplug */ in acpi_processor_power_state_has_changed()
1337 if (!_pr || !_pr->flags.power_setup_done) in acpi_processor_power_state_has_changed()
1343 /* Populate Updated C-state information */ in acpi_processor_power_state_has_changed()
1350 if (!_pr || !_pr->flags.power_setup_done) in acpi_processor_power_state_has_changed()
1353 if (_pr->flags.power) { in acpi_processor_power_state_has_changed()
1379 pr->flags.power_setup_done = 1; in acpi_processor_power_init()
1386 if (pr->flags.power) { in acpi_processor_power_init()
1399 return -ENOMEM; in acpi_processor_power_init()
1400 per_cpu(acpi_cpuidle_device, pr->id) = dev; in acpi_processor_power_init()
1404 /* Register per-cpu cpuidle_device. Cpuidle driver in acpi_processor_power_init()
1420 struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); in acpi_processor_power_exit()
1425 if (pr->flags.power) { in acpi_processor_power_exit()
1427 acpi_processor_registered--; in acpi_processor_power_exit()
1434 pr->flags.power_setup_done = 0; in acpi_processor_power_exit()