linux/drivers/cpufreq/acpi-cpufreq.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * acpi-cpufreq.c - ACPI Processor P-States Driver
 *
 *  Copyright (C) 2001, 2002 Andy Grover <[email protected]>
 *  Copyright (C) 2001, 2002 Paul Diefenbaugh <[email protected]>
 *  Copyright (C) 2002 - 2004 Dominik Brodowski <[email protected]>
 *  Copyright (C) 2006       Denis Sadykov <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/sched.h>
#include <linux/cpufreq.h>
#include <linux/compiler.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <linux/string_helpers.h>
#include <linux/platform_device.h>

#include <linux/acpi.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/uaccess.h>

#include <acpi/processor.h>
#include <acpi/cppc_acpi.h>

#include <asm/msr.h>
#include <asm/processor.h>
#include <asm/cpufeature.h>
#include <asm/cpu_device_id.h>

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

enum {};

#define INTEL_MSR_RANGE
#define AMD_MSR_RANGE
#define HYGON_MSR_RANGE

struct acpi_cpufreq_data {};

/* acpi_perf_data is a pointer to percpu data. */
static struct acpi_processor_performance __percpu *acpi_perf_data;

static inline struct acpi_processor_performance *to_perf_data(struct acpi_cpufreq_data *data)
{}

static struct cpufreq_driver acpi_cpufreq_driver;

static unsigned int acpi_pstate_strict;

static bool boost_state(unsigned int cpu)
{}

static int boost_set_msr(bool enable)
{}

static void boost_set_msr_each(void *p_en)
{}

static int set_boost(struct cpufreq_policy *policy, int val)
{}

static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
{}

cpufreq_freq_attr_ro();

#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
			 size_t count)
{}

static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf)
{}

cpufreq_freq_attr_rw();
#endif

static int check_est_cpu(unsigned int cpuid)
{}

static int check_amd_hwpstate_cpu(unsigned int cpuid)
{}

static unsigned extract_io(struct cpufreq_policy *policy, u32 value)
{}

static unsigned extract_msr(struct cpufreq_policy *policy, u32 msr)
{}

static unsigned extract_freq(struct cpufreq_policy *policy, u32 val)
{}

static u32 cpu_freq_read_intel(struct acpi_pct_register *not_used)
{}

static void cpu_freq_write_intel(struct acpi_pct_register *not_used, u32 val)
{}

static u32 cpu_freq_read_amd(struct acpi_pct_register *not_used)
{}

static void cpu_freq_write_amd(struct acpi_pct_register *not_used, u32 val)
{}

static u32 cpu_freq_read_io(struct acpi_pct_register *reg)
{}

static void cpu_freq_write_io(struct acpi_pct_register *reg, u32 val)
{}

struct drv_cmd {};

/* Called via smp_call_function_single(), on the target CPU */
static void do_drv_read(void *_cmd)
{}

static u32 drv_read(struct acpi_cpufreq_data *data, const struct cpumask *mask)
{}

/* Called via smp_call_function_many(), on the target CPUs */
static void do_drv_write(void *_cmd)
{}

static void drv_write(struct acpi_cpufreq_data *data,
		      const struct cpumask *mask, u32 val)
{}

static u32 get_cur_val(const struct cpumask *mask, struct acpi_cpufreq_data *data)
{}

static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
{}

static unsigned int check_freqs(struct cpufreq_policy *policy,
				const struct cpumask *mask, unsigned int freq)
{}

static int acpi_cpufreq_target(struct cpufreq_policy *policy,
			       unsigned int index)
{}

static unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
					     unsigned int target_freq)
{}

static unsigned long
acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
{}

static void free_acpi_perf_data(void)
{}

static int cpufreq_boost_down_prep(unsigned int cpu)
{}

/*
 * acpi_cpufreq_early_init - initialize ACPI P-States library
 *
 * Initialize the ACPI P-States library (drivers/acpi/processor_perflib.c)
 * in order to determine correct frequency and voltage pairings. We can
 * do _PDC and _PSD and find out the processor dependency for the
 * actual init that will happen later...
 */
static int __init acpi_cpufreq_early_init(void)
{}

#ifdef CONFIG_SMP
/*
 * Some BIOSes do SW_ANY coordination internally, either set it up in hw
 * or do it in BIOS firmware and won't inform about it to OS. If not
 * detected, this has a side effect of making CPU run at a different speed
 * than OS intended it to run at. Detect it and handle it cleanly.
 */
static int bios_with_sw_any_bug;

static int sw_any_bug_found(const struct dmi_system_id *d)
{}

static const struct dmi_system_id sw_any_bug_dmi_table[] =;

static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)
{}
#endif

#ifdef CONFIG_ACPI_CPPC_LIB
static u64 get_max_boost_ratio(unsigned int cpu)
{}
#else
static inline u64 get_max_boost_ratio(unsigned int cpu) { return 0; }
#endif

static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
{}

static void acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
{}

static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
{}

static struct freq_attr *acpi_cpufreq_attr[] =;

static struct cpufreq_driver acpi_cpufreq_driver =;

static void __init acpi_cpufreq_boost_init(void)
{}

static int __init acpi_cpufreq_probe(struct platform_device *pdev)
{}

static void acpi_cpufreq_remove(struct platform_device *pdev)
{}

static struct platform_driver acpi_cpufreq_platdrv =;

static int __init acpi_cpufreq_init(void)
{}

static void __exit acpi_cpufreq_exit(void)
{}

module_param(acpi_pstate_strict, uint, 0644);
MODULE_PARM_DESC();

late_initcall(acpi_cpufreq_init);
module_exit(acpi_cpufreq_exit);

MODULE_ALIAS();