#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/sched.h>
#include <linux/tick.h>
#include <linux/cpuidle.h>
#include <linux/cpu.h>
#include <linux/minmax.h>
#include <linux/perf_event.h>
#include <acpi/processor.h>
#include <linux/context_tracking.h>
#ifdef CONFIG_X86
#include <asm/apic.h>
#include <asm/cpu.h>
#endif
#define ACPI_IDLE_STATE_START …
static unsigned int max_cstate __read_mostly = …;
module_param(max_cstate, uint, 0400);
static bool nocst __read_mostly;
module_param(nocst, bool, 0400);
static bool bm_check_disable __read_mostly;
module_param(bm_check_disable, bool, 0400);
static unsigned int latency_factor __read_mostly = …;
module_param(latency_factor, uint, 0644);
static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
struct cpuidle_driver acpi_idle_driver = …;
#ifdef CONFIG_ACPI_PROCESSOR_CSTATE
static
DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX], acpi_cstate);
static int disabled_by_idle_boot_param(void)
{ … }
static int set_max_cstate(const struct dmi_system_id *id)
{ … }
static const struct dmi_system_id processor_power_dmi_table[] = …;
static void __cpuidle acpi_safe_halt(void)
{ … }
#ifdef ARCH_APICTIMER_STOPS_ON_C3
static void lapic_timer_check_state(int state, struct acpi_processor *pr,
struct acpi_processor_cx *cx)
{ … }
static void __lapic_timer_propagate_broadcast(void *arg)
{ … }
static void lapic_timer_propagate_broadcast(struct acpi_processor *pr)
{ … }
static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
struct acpi_processor_cx *cx)
{ … }
#else
static void lapic_timer_check_state(int state, struct acpi_processor *pr,
struct acpi_processor_cx *cstate) { }
static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
struct acpi_processor_cx *cx)
{
return false;
}
#endif
#if defined(CONFIG_X86)
static void tsc_check_state(int state)
{ … }
#else
static void tsc_check_state(int state) { return; }
#endif
static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
{ … }
static int acpi_processor_get_power_info_default(struct acpi_processor *pr)
{ … }
static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
{ … }
static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
struct acpi_processor_cx *cx)
{ … }
static void acpi_cst_latency_sort(struct acpi_processor_cx *states, size_t length)
{ … }
static int acpi_processor_power_verify(struct acpi_processor *pr)
{ … }
static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
{ … }
static int acpi_idle_bm_check(void)
{ … }
static __cpuidle void io_idle(unsigned long addr)
{ … }
static void __cpuidle acpi_idle_do_entry(struct acpi_processor_cx *cx)
{ … }
static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
{ … }
static __always_inline bool acpi_idle_fallback_to_c1(struct acpi_processor *pr)
{ … }
static int c3_cpu_count;
static DEFINE_RAW_SPINLOCK(c3_lock);
static int __cpuidle acpi_idle_enter_bm(struct cpuidle_driver *drv,
struct acpi_processor *pr,
struct acpi_processor_cx *cx,
int index)
{ … }
static int __cpuidle acpi_idle_enter(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static int __cpuidle acpi_idle_enter_s2idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
struct cpuidle_device *dev)
{ … }
static int acpi_processor_setup_cstates(struct acpi_processor *pr)
{ … }
static inline void acpi_processor_cstate_first_run_checks(void)
{ … }
#else
static inline int disabled_by_idle_boot_param(void) { return 0; }
static inline void acpi_processor_cstate_first_run_checks(void) { }
static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
{
return -ENODEV;
}
static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
struct cpuidle_device *dev)
{
return -EINVAL;
}
static int acpi_processor_setup_cstates(struct acpi_processor *pr)
{
return -EINVAL;
}
#endif
struct acpi_lpi_states_array { … };
static int obj_get_integer(union acpi_object *obj, u32 *value)
{ … }
static int acpi_processor_evaluate_lpi(acpi_handle handle,
struct acpi_lpi_states_array *info)
{ … }
static int flat_state_cnt;
static bool combine_lpi_states(struct acpi_lpi_state *local,
struct acpi_lpi_state *parent,
struct acpi_lpi_state *result)
{ … }
#define ACPI_LPI_STATE_FLAGS_ENABLED …
static void stash_composite_state(struct acpi_lpi_states_array *curr_level,
struct acpi_lpi_state *t)
{ … }
static int flatten_lpi_states(struct acpi_processor *pr,
struct acpi_lpi_states_array *curr_level,
struct acpi_lpi_states_array *prev_level)
{ … }
int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu)
{ … }
static int acpi_processor_get_lpi_info(struct acpi_processor *pr)
{ … }
int __weak acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi)
{ … }
static int acpi_idle_lpi_enter(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static int acpi_processor_setup_lpi_states(struct acpi_processor *pr)
{ … }
static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
{ … }
static int acpi_processor_setup_cpuidle_dev(struct acpi_processor *pr,
struct cpuidle_device *dev)
{ … }
static int acpi_processor_get_power_info(struct acpi_processor *pr)
{ … }
int acpi_processor_hotplug(struct acpi_processor *pr)
{ … }
int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
{ … }
static int acpi_processor_registered;
int acpi_processor_power_init(struct acpi_processor *pr)
{ … }
int acpi_processor_power_exit(struct acpi_processor *pr)
{ … }