Print this page
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/sys/cpu_acpi.h
+++ new/usr/src/uts/i86pc/sys/cpu_acpi.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #ifndef _CPU_ACPI_H
27 27 #define _CPU_ACPI_H
28 28
29 29 #include <sys/cpuvar.h>
30 -#include <sys/acpi/acpi.h>
31 -#include <sys/acpi/accommon.h>
32 -#include <sys/acpi/acresrc.h>
30 +
31 +#include <acpica/include/acpi.h>
32 +#include <acpica/include/accommon.h>
33 +#include <acpica/include/acresrc.h>
33 34 #include <sys/acpica.h>
34 35
35 36 #ifdef __cplusplus
36 37 extern "C" {
37 38 #endif
38 39
39 40 /*
40 41 * P-state related macros
41 42 */
42 43 #define CPU_ACPI_PPC(sp) sp->cs_ppc
43 44 #define CPU_ACPI_PSD(sp) sp->cs_psd
44 45 #define CPU_ACPI_PCT(sp) sp->cs_pct
45 46 #define CPU_ACPI_PCT_CTRL(sp) &sp->cs_pct[0]
46 47 #define CPU_ACPI_PCT_STATUS(sp) &sp->cs_pct[1]
47 48 #define CPU_ACPI_PSTATES(sp) sp->cs_pstates.ss_states
48 49 #define CPU_ACPI_PSTATES_COUNT(sp) sp->cs_pstates.ss_count
49 50
50 51 #define CPU_ACPI_FREQ(pstate) pstate->ps_freq
51 52 #define CPU_ACPI_PSTATE_TRANSLAT(pstate) pstate->ps_translat
52 53 #define CPU_ACPI_PSTATE_CTRL(pstate) pstate->ps_ctrl
53 54
54 55 /*
55 56 * T-state related macros
56 57 */
57 58 #define CPU_ACPI_TPC(sp) sp->cs_tpc
58 59 #define CPU_ACPI_TSD(sp) sp->cs_tsd
59 60 #define CPU_ACPI_PTC(sp) sp->cs_ptc
60 61 #define CPU_ACPI_PTC_CTRL(sp) &sp->cs_ptc[0]
61 62 #define CPU_ACPI_PTC_STATUS(sp) &sp->cs_ptc[1]
62 63 #define CPU_ACPI_TSTATES(sp) sp->cs_tstates.ss_states
63 64 #define CPU_ACPI_TSTATES_COUNT(sp) sp->cs_tstates.ss_count
64 65
65 66 #define CPU_ACPI_FREQPER(tstate) tstate->ts_freqper
66 67 #define CPU_ACPI_TSTATE_TRANSLAT(tstate) tstate->ts_translat
67 68 #define CPU_ACPI_TSTATE_CTRL(tstate) tstate->ts_ctrl
68 69 #define CPU_ACPI_TSTATE_STAT(tstate) tstate->ts_state
69 70
70 71 /*
71 72 * C-state realted macros
72 73 */
73 74 #define CPU_ACPI_CSD(sp) sp->cs_csd
74 75 #define CPU_ACPI_CSTATES(sp) sp->cs_cstates.ss_states
75 76 #define CPU_ACPI_CSTATES_COUNT(sp) sp->cs_cstates.ss_count
76 77
77 78 #define CPU_ACPI_NONE_CACHED 0x0000
78 79 #define CPU_ACPI_PCT_CACHED 0x0001
79 80 #define CPU_ACPI_PSS_CACHED 0x0002
80 81 #define CPU_ACPI_PSD_CACHED 0x0004
81 82 #define CPU_ACPI_PPC_CACHED 0x0008
82 83 #define CPU_ACPI_PTC_CACHED 0x0010
83 84 #define CPU_ACPI_TSS_CACHED 0x0020
84 85 #define CPU_ACPI_TSD_CACHED 0x0040
85 86 #define CPU_ACPI_TPC_CACHED 0x0080
86 87 #define CPU_ACPI_CST_CACHED 0x0100
87 88 #define CPU_ACPI_CSD_CACHED 0x0200
88 89
89 90 #define CPU_ACPI_IS_OBJ_CACHED(sp, obj) (sp->cpu_acpi_cached & obj)
90 91 #define CPU_ACPI_OBJ_IS_CACHED(sp, obj) (sp->cpu_acpi_cached |= obj)
91 92 #define CPU_ACPI_OBJ_IS_NOT_CACHED(sp, obj) (sp->cpu_acpi_cached &= ~obj)
92 93
93 94 #define CPU_ACPI_PSTATES_SIZE(cnt) (cnt * sizeof (cpu_acpi_pstate_t))
94 95 #define CPU_ACPI_PSS_CNT (sizeof (cpu_acpi_pstate_t) / sizeof (uint32_t))
95 96 #define CPU_ACPI_TSTATES_SIZE(cnt) (cnt * sizeof (cpu_acpi_tstate_t))
96 97 #define CPU_ACPI_TSS_CNT (sizeof (cpu_acpi_tstate_t) / sizeof (uint32_t))
97 98 #define CPU_ACPI_CSTATES_SIZE(cnt) (cnt * sizeof (cpu_acpi_cstate_t))
98 99 #define CPU_ACPI_CST_CNT (sizeof (cpu_acpi_cstate_t) / sizeof (uint32_t))
99 100 /*
100 101 * CPU Domain Coordination Types
101 102 */
102 103 #define CPU_ACPI_SW_ALL 0xfc
103 104 #define CPU_ACPI_SW_ANY 0xfd
104 105 #define CPU_ACPI_HW_ALL 0xfe
105 106
106 107 /*
107 108 * Container for ACPI processor state dependency information
108 109 */
109 110 typedef struct cpu_acpi_state_dependency
110 111 {
111 112 uint8_t sd_entries;
112 113 uint8_t sd_revision;
113 114 uint32_t sd_domain;
114 115 uint32_t sd_type;
115 116 uint32_t sd_num;
116 117 uint32_t sd_index;
117 118 } cpu_acpi_state_dependency_t;
118 119
119 120 typedef cpu_acpi_state_dependency_t cpu_acpi_psd_t;
120 121 typedef cpu_acpi_state_dependency_t cpu_acpi_tsd_t;
121 122 typedef cpu_acpi_state_dependency_t cpu_acpi_csd_t;
122 123
123 124 /*
124 125 * Container for ACPI processor control register information
125 126 */
126 127 typedef struct cpu_acpi_ctrl_regs
127 128 {
128 129 uint8_t cr_addrspace_id;
129 130 uint8_t cr_width;
130 131 uint8_t cr_offset;
131 132 uint8_t cr_asize;
132 133 ACPI_IO_ADDRESS cr_address;
133 134 } cpu_acpi_ctrl_regs_t;
134 135
135 136 typedef cpu_acpi_ctrl_regs_t cpu_acpi_pct_t;
136 137 typedef cpu_acpi_ctrl_regs_t cpu_acpi_ptc_t;
137 138
138 139 /*
139 140 * Container for ACPI _PSS information
140 141 */
141 142 typedef struct cpu_acpi_pstate
142 143 {
143 144 uint32_t ps_freq;
144 145 uint32_t ps_disp;
145 146 uint32_t ps_translat;
146 147 uint32_t ps_buslat;
147 148 uint32_t ps_ctrl;
148 149 uint32_t ps_state;
149 150 } cpu_acpi_pstate_t;
150 151
151 152 /*
152 153 * Container for _TSS information
153 154 */
154 155 typedef struct cpu_acpi_tstate
155 156 {
156 157 uint32_t ts_freqper;
157 158 uint32_t ts_disp;
158 159 uint32_t ts_translat;
159 160 uint32_t ts_ctrl;
160 161 uint32_t ts_state;
161 162
162 163 } cpu_acpi_tstate_t;
163 164
164 165 /*
165 166 * Container for _CST information
166 167 */
167 168 typedef struct cpu_acpi_cstate
168 169 {
169 170 uint32_t cs_addrspace_id;
170 171 uint32_t cs_address;
171 172 uint32_t cs_type;
172 173 uint32_t cs_latency;
173 174 uint32_t cs_power;
174 175 kstat_t *cs_ksp;
175 176 } cpu_acpi_cstate_t;
176 177
177 178 typedef struct cpu_acpi_supported_states {
178 179 void *ss_states;
179 180 uint32_t ss_count;
180 181 } cpu_acpi_supported_states_t;
181 182
182 183 typedef cpu_acpi_supported_states_t cpu_acpi_pstates_t;
183 184 typedef cpu_acpi_supported_states_t cpu_acpi_tstates_t;
184 185 typedef cpu_acpi_supported_states_t cpu_acpi_cstates_t;
185 186
186 187 typedef int cpu_acpi_present_capabilities_t;
187 188 typedef int cpu_acpi_ppc_t;
188 189 typedef int cpu_acpi_tpc_t;
189 190
190 191 /*
191 192 * Container for cached ACPI data.
192 193 */
193 194 typedef struct cpu_acpi_state {
194 195 ACPI_HANDLE cs_handle;
195 196 int cs_id;
196 197 uint_t cpu_acpi_cached;
197 198 cpu_acpi_pstates_t cs_pstates;
198 199 cpu_acpi_pct_t cs_pct[2];
199 200 cpu_acpi_psd_t cs_psd;
200 201 cpu_acpi_ppc_t cs_ppc;
201 202 cpu_acpi_tstates_t cs_tstates;
202 203 cpu_acpi_ptc_t cs_ptc[2];
203 204 cpu_acpi_tsd_t cs_tsd;
204 205 cpu_acpi_tpc_t cs_tpc;
205 206 cpu_acpi_cstates_t cs_cstates;
206 207 cpu_acpi_csd_t cs_csd;
207 208 } cpu_acpi_state_t;
208 209
209 210 typedef cpu_acpi_state_t *cpu_acpi_handle_t;
210 211
211 212 extern void cpu_acpi_cache_ppc(cpu_acpi_handle_t);
212 213 extern void cpu_acpi_cache_tpc(cpu_acpi_handle_t);
213 214 extern int cpu_acpi_cache_pstate_data(cpu_acpi_handle_t);
214 215 extern void cpu_acpi_free_pstate_data(cpu_acpi_handle_t);
215 216 extern int cpu_acpi_cache_tstate_data(cpu_acpi_handle_t);
216 217 extern void cpu_acpi_free_tstate_data(cpu_acpi_handle_t);
217 218 extern int cpu_acpi_cache_cstate_data(cpu_acpi_handle_t);
218 219 extern void cpu_acpi_free_cstate_data(cpu_acpi_handle_t);
219 220 extern void cpu_acpi_install_notify_handler(cpu_acpi_handle_t,
220 221 ACPI_NOTIFY_HANDLER, void *);
221 222 extern void cpu_acpi_remove_notify_handler(cpu_acpi_handle_t,
222 223 ACPI_NOTIFY_HANDLER);
223 224 extern int cpu_acpi_write_pdc(cpu_acpi_handle_t, uint32_t, uint32_t,
224 225 uint32_t *);
225 226 extern int cpu_acpi_write_port(ACPI_IO_ADDRESS, uint32_t, uint32_t);
226 227 extern int cpu_acpi_read_port(ACPI_IO_ADDRESS, uint32_t *, uint32_t);
227 228 extern void cpu_acpi_set_register(uint32_t, uint32_t);
228 229 extern void cpu_acpi_get_register(uint32_t, uint32_t *);
229 230 extern uint_t cpu_acpi_get_speeds(cpu_acpi_handle_t, int **);
230 231 extern uint_t cpu_acpi_get_max_cstates(cpu_acpi_handle_t);
231 232 extern void cpu_acpi_free_speeds(int *, uint_t);
232 233 extern cpu_acpi_handle_t cpu_acpi_init(cpu_t *);
233 234 extern void cpu_acpi_fini(cpu_acpi_handle_t);
234 235
235 236 #ifdef __cplusplus
236 237 }
237 238 #endif
238 239
239 240 #endif /* _CPU_ACPI_H */
↓ open down ↓ |
197 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX