2 * CPPC (Collaborative Processor Performance Control) methods used
5 * (C) Copyright 2014, 2015 Linaro Ltd.
6 * Author: Ashwin Chaugule <ashwin.chaugule@linaro.org>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; version 2
17 #include <linux/acpi.h>
18 #include <linux/types.h>
21 #include <acpi/processor.h>
23 /* Support CPPCv2 and CPPCv3 */
26 #define CPPC_V2_NUM_ENT 21
27 #define CPPC_V3_NUM_ENT 23
29 #define PCC_CMD_COMPLETE_MASK (1 << 0)
30 #define PCC_ERROR_MASK (1 << 2)
32 #define MAX_CPC_REG_ENT 21
34 /* CPPC specific PCC commands. */
38 /* Each register has the folowing format. */
50 * Each entry in the CPC table is either
51 * of type ACPI_TYPE_BUFFER or
54 struct cpc_register_resource {
55 acpi_object_type type;
56 u64 __iomem *sys_mem_vaddr;
63 /* Container to hold the CPC details for each CPU */
70 struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT];
71 struct acpi_psd_package domain_info;
75 /* These are indexes into the per-cpu cpc_regs[]. Order is important. */
101 * Categorization of registers as described
102 * in the ACPI v.5.1 spec.
103 * XXX: Only filling up ones which are used by governors
106 struct cppc_perf_caps {
111 u32 lowest_nonlinear_perf;
116 struct cppc_perf_ctrls {
122 struct cppc_perf_fb_ctrs {
129 /* Per CPU container for runtime CPPC management. */
130 struct cppc_cpudata {
132 struct cppc_perf_caps perf_caps;
133 struct cppc_perf_ctrls perf_ctrls;
134 struct cppc_perf_fb_ctrs perf_fb_ctrs;
135 struct cpufreq_policy *cur_policy;
136 unsigned int shared_type;
137 cpumask_var_t shared_cpu_map;
140 extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
141 extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
142 extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
143 extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
144 extern int acpi_get_psd_map(struct cppc_cpudata **);
145 extern unsigned int cppc_get_transition_latency(int cpu);
146 extern bool cpc_ffh_supported(void);
147 extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
148 extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
150 #endif /* _CPPC_ACPI_H*/