1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * CPPC (Collaborative Processor Performance Control) methods used
6 * (C) Copyright 2014, 2015 Linaro Ltd.
7 * Author: Ashwin Chaugule <ashwin.chaugule@linaro.org>
13 #include <linux/acpi.h>
14 #include <linux/types.h>
17 #include <acpi/processor.h>
19 /* Support CPPCv2 and CPPCv3 */
22 #define CPPC_V2_NUM_ENT 21
23 #define CPPC_V3_NUM_ENT 23
25 #define PCC_CMD_COMPLETE_MASK (1 << 0)
26 #define PCC_ERROR_MASK (1 << 2)
28 #define MAX_CPC_REG_ENT 21
30 /* CPPC specific PCC commands. */
34 /* Each register has the folowing format. */
46 * Each entry in the CPC table is either
47 * of type ACPI_TYPE_BUFFER or
50 struct cpc_register_resource {
51 acpi_object_type type;
52 u64 __iomem *sys_mem_vaddr;
59 /* Container to hold the CPC details for each CPU */
66 struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT];
67 struct acpi_psd_package domain_info;
71 /* These are indexes into the per-cpu cpc_regs[]. Order is important. */
97 * Categorization of registers as described
98 * in the ACPI v.5.1 spec.
99 * XXX: Only filling up ones which are used by governors
102 struct cppc_perf_caps {
107 u32 lowest_nonlinear_perf;
112 struct cppc_perf_ctrls {
118 struct cppc_perf_fb_ctrs {
125 /* Per CPU container for runtime CPPC management. */
126 struct cppc_cpudata {
128 struct cppc_perf_caps perf_caps;
129 struct cppc_perf_ctrls perf_ctrls;
130 struct cppc_perf_fb_ctrs perf_fb_ctrs;
131 struct cpufreq_policy *cur_policy;
132 unsigned int shared_type;
133 cpumask_var_t shared_cpu_map;
136 extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
137 extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
138 extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
139 extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
140 extern int acpi_get_psd_map(struct cppc_cpudata **);
141 extern unsigned int cppc_get_transition_latency(int cpu);
142 extern bool cpc_ffh_supported(void);
143 extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
144 extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
146 #endif /* _CPPC_ACPI_H*/