Blame view

include/acpi/cppc_acpi.h 2.91 KB
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  /*
   * CPPC (Collaborative Processor Performance Control) methods used
   * by CPUfreq drivers.
   *
   * (C) Copyright 2014, 2015 Linaro Ltd.
   * Author: Ashwin Chaugule <ashwin.chaugule@linaro.org>
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
   * as published by the Free Software Foundation; version 2
   * of the License.
   */
  
  #ifndef _CPPC_ACPI_H
  #define _CPPC_ACPI_H
  
  #include <linux/acpi.h>
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
18
  #include <linux/types.h>
866ae696e   Hoan Tran   mailbox: pcc: Add...
19
  #include <acpi/pcc.h>
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
20
21
22
23
24
  #include <acpi/processor.h>
  
  /* Only support CPPCv2 for now. */
  #define CPPC_NUM_ENT	21
  #define CPPC_REV	2
139aee73f   Prakash, Prashanth   ACPI / CPPC: chec...
25
26
  #define PCC_CMD_COMPLETE_MASK	(1 << 0)
  #define PCC_ERROR_MASK		(1 << 2)
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  #define MAX_CPC_REG_ENT 19
  
  /* CPPC specific PCC commands. */
  #define	CMD_READ 0
  #define	CMD_WRITE 1
  
  /* Each register has the folowing format. */
  struct cpc_reg {
  	u8 descriptor;
  	u16 length;
  	u8 space_id;
  	u8 bit_width;
  	u8 bit_offset;
  	u8 access_width;
  	u64 __iomem address;
  } __packed;
  
  /*
   * Each entry in the CPC table is either
   * of type ACPI_TYPE_BUFFER or
   * ACPI_TYPE_INTEGER.
   */
  struct cpc_register_resource {
  	acpi_object_type type;
5bbb86aa4   Ashwin Chaugule   ACPI / CPPC: rest...
51
  	u64 __iomem *sys_mem_vaddr;
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
52
53
54
55
56
57
58
59
60
61
62
  	union {
  		struct cpc_reg reg;
  		u64 int_value;
  	} cpc_entry;
  };
  
  /* Container to hold the CPC details for each CPU */
  struct cpc_desc {
  	int num_entries;
  	int version;
  	int cpu_id;
80b8286ae   Prakash, Prashanth   ACPI / CPPC: supp...
63
64
  	int write_cmd_status;
  	int write_cmd_id;
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
65
66
  	struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT];
  	struct acpi_psd_package domain_info;
158c998ea   Ashwin Chaugule   ACPI / CPPC: add ...
67
  	struct kobject kobj;
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  };
  
  /* These are indexes into the per-cpu cpc_regs[]. Order is important. */
  enum cppc_regs {
  	HIGHEST_PERF,
  	NOMINAL_PERF,
  	LOW_NON_LINEAR_PERF,
  	LOWEST_PERF,
  	GUARANTEED_PERF,
  	DESIRED_PERF,
  	MIN_PERF,
  	MAX_PERF,
  	PERF_REDUC_TOLERANCE,
  	TIME_WINDOW,
  	CTR_WRAP_TIME,
  	REFERENCE_CTR,
  	DELIVERED_CTR,
  	PERF_LIMITED,
  	ENABLE,
  	AUTO_SEL_ENABLE,
  	AUTO_ACT_WINDOW,
  	ENERGY_PERF,
  	REFERENCE_PERF,
  };
  
  /*
   * Categorization of registers as described
   * in the ACPI v.5.1 spec.
   * XXX: Only filling up ones which are used by governors
   * today.
   */
  struct cppc_perf_caps {
  	u32 highest_perf;
  	u32 nominal_perf;
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
102
103
104
105
106
107
108
109
110
111
112
  	u32 lowest_perf;
  };
  
  struct cppc_perf_ctrls {
  	u32 max_perf;
  	u32 min_perf;
  	u32 desired_perf;
  };
  
  struct cppc_perf_fb_ctrs {
  	u64 reference;
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
113
  	u64 delivered;
158c998ea   Ashwin Chaugule   ACPI / CPPC: add ...
114
115
  	u64 reference_perf;
  	u64 ctr_wrap_time;
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
116
117
118
  };
  
  /* Per CPU container for runtime CPPC management. */
41dd64038   Srinivas Pandruvada   ACPI / CPPC: Add ...
119
  struct cppc_cpudata {
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
120
121
122
123
124
125
126
127
128
129
130
131
  	int cpu;
  	struct cppc_perf_caps perf_caps;
  	struct cppc_perf_ctrls perf_ctrls;
  	struct cppc_perf_fb_ctrs perf_fb_ctrs;
  	struct cpufreq_policy *cur_policy;
  	unsigned int shared_type;
  	cpumask_var_t shared_cpu_map;
  };
  
  extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
  extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
  extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
41dd64038   Srinivas Pandruvada   ACPI / CPPC: Add ...
132
  extern int acpi_get_psd_map(struct cppc_cpudata **);
be8b88d7d   Prakash, Prashanth   ACPI / CPPC: set ...
133
  extern unsigned int cppc_get_transition_latency(int cpu);
337aadff8   Ashwin Chaugule   ACPI: Introduce C...
134

337aadff8   Ashwin Chaugule   ACPI: Introduce C...
135
  #endif /* _CPPC_ACPI_H*/