armreg.h revision 1.65 1 1.65 skrll /* $NetBSD: armreg.h,v 1.65 2023/09/24 10:13:44 skrll Exp $ */
2 1.1 matt
3 1.1 matt /*-
4 1.1 matt * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 1.1 matt * All rights reserved.
6 1.1 matt *
7 1.1 matt * This code is derived from software contributed to The NetBSD Foundation
8 1.1 matt * by Matt Thomas of 3am Software Foundry.
9 1.1 matt *
10 1.1 matt * Redistribution and use in source and binary forms, with or without
11 1.1 matt * modification, are permitted provided that the following conditions
12 1.1 matt * are met:
13 1.1 matt * 1. Redistributions of source code must retain the above copyright
14 1.1 matt * notice, this list of conditions and the following disclaimer.
15 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 matt * notice, this list of conditions and the following disclaimer in the
17 1.1 matt * documentation and/or other materials provided with the distribution.
18 1.1 matt *
19 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 matt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 matt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 matt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 matt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 matt * POSSIBILITY OF SUCH DAMAGE.
30 1.1 matt */
31 1.1 matt
32 1.1 matt #ifndef _AARCH64_ARMREG_H_
33 1.1 matt #define _AARCH64_ARMREG_H_
34 1.1 matt
35 1.8 ryo #include <arm/cputypes.h>
36 1.1 matt #include <sys/types.h>
37 1.1 matt
38 1.42 ryo #ifdef __clang__
39 1.42 ryo #define ATTR_ARCH(arch) ".arch " arch ";"
40 1.42 ryo #define ATTR_TARGET_ARCH(x)
41 1.42 ryo #define ASM_ARCH(x) x
42 1.42 ryo #else
43 1.42 ryo #define ATTR_ARCH(arch) __attribute__((target("arch=" arch)))
44 1.42 ryo #define ATTR_TARGET_ARCH(x) x
45 1.42 ryo #define ASM_ARCH(x)
46 1.42 ryo #endif
47 1.42 ryo
48 1.42 ryo #define AARCH64REG_READ_INLINE3(regname, regdesc, arch) \
49 1.42 ryo static __inline uint64_t ATTR_TARGET_ARCH(arch) \
50 1.7 skrll reg_##regname##_read(void) \
51 1.7 skrll { \
52 1.7 skrll uint64_t __rv; \
53 1.42 ryo __asm __volatile( \
54 1.42 ryo ASM_ARCH(arch) \
55 1.42 ryo "mrs %0, " #regdesc : "=r"(__rv) \
56 1.42 ryo ); \
57 1.7 skrll return __rv; \
58 1.1 matt }
59 1.1 matt
60 1.33 maxv #define AARCH64REG_READ_INLINE2(regname, regdesc) \
61 1.33 maxv AARCH64REG_READ_INLINE3(regname, regdesc, )
62 1.33 maxv
63 1.42 ryo #define AARCH64REG_WRITE_INLINE3(regname, regdesc, arch) \
64 1.42 ryo static __inline void ATTR_TARGET_ARCH(arch) \
65 1.7 skrll reg_##regname##_write(uint64_t __val) \
66 1.7 skrll { \
67 1.42 ryo __asm __volatile( \
68 1.42 ryo ASM_ARCH(arch) \
69 1.51 maxv "msr " #regdesc ", %0" :: "r"(__val) : "memory" \
70 1.42 ryo ); \
71 1.1 matt }
72 1.1 matt
73 1.33 maxv #define AARCH64REG_WRITE_INLINE2(regname, regdesc) \
74 1.33 maxv AARCH64REG_WRITE_INLINE3(regname, regdesc, )
75 1.33 maxv
76 1.7 skrll #define AARCH64REG_WRITEIMM_INLINE2(regname, regdesc) \
77 1.59 ryo static __inline void __always_inline \
78 1.59 ryo reg_##regname##_write(const uint64_t __val) \
79 1.7 skrll { \
80 1.51 maxv __asm __volatile( \
81 1.51 maxv "msr " #regdesc ", %0" :: "n"(__val) : "memory" \
82 1.51 maxv ); \
83 1.1 matt }
84 1.1 matt
85 1.7 skrll #define AARCH64REG_READ_INLINE(regname) \
86 1.1 matt AARCH64REG_READ_INLINE2(regname, regname)
87 1.1 matt
88 1.7 skrll #define AARCH64REG_WRITE_INLINE(regname) \
89 1.1 matt AARCH64REG_WRITE_INLINE2(regname, regname)
90 1.1 matt
91 1.7 skrll #define AARCH64REG_WRITEIMM_INLINE(regname) \
92 1.1 matt AARCH64REG_WRITEIMM_INLINE2(regname, regname)
93 1.15 jmcneill
94 1.15 jmcneill #define AARCH64REG_READWRITE_INLINE2(regname, regdesc) \
95 1.15 jmcneill AARCH64REG_READ_INLINE2(regname, regdesc) \
96 1.15 jmcneill AARCH64REG_WRITE_INLINE2(regname, regdesc)
97 1.15 jmcneill
98 1.24 ryo #define AARCH64REG_ATWRITE_INLINE2(regname, regdesc) \
99 1.24 ryo static __inline void \
100 1.24 ryo reg_##regname##_write(uint64_t __val) \
101 1.24 ryo { \
102 1.51 maxv __asm __volatile( \
103 1.51 maxv "at " #regdesc ", %0" :: "r"(__val) : "memory" \
104 1.51 maxv ); \
105 1.24 ryo }
106 1.24 ryo
107 1.24 ryo #define AARCH64REG_ATWRITE_INLINE(regname) \
108 1.24 ryo AARCH64REG_ATWRITE_INLINE2(regname, regname)
109 1.24 ryo
110 1.1 matt /*
111 1.1 matt * System registers available at EL0 (user)
112 1.1 matt */
113 1.1 matt AARCH64REG_READ_INLINE(ctr_el0) // Cache Type Register
114 1.1 matt
115 1.48 skrll #define CTR_EL0_TMIN_LINE __BITS(37,32) // Tag MIN LINE size
116 1.48 skrll #define CTR_EL0_DIC __BIT(29) // Instruction cache requirement
117 1.48 skrll #define CTR_EL0_IDC __BIT(28) // Data Cache clean requirement
118 1.13 skrll #define CTR_EL0_CWG_LINE __BITS(27,24) // Cacheback Writeback Granule
119 1.13 skrll #define CTR_EL0_ERG_LINE __BITS(23,20) // Exclusives Reservation Granule
120 1.13 skrll #define CTR_EL0_DMIN_LINE __BITS(19,16) // Dcache MIN LINE size (log2 - 2)
121 1.12 christos #define CTR_EL0_L1IP_MASK __BITS(15,14)
122 1.37 ryo #define CTR_EL0_L1IP_VPIPT 0 // VMID-aware Physical Index, Physical Tag
123 1.13 skrll #define CTR_EL0_L1IP_AIVIVT 1 // ASID-tagged Virtual Index, Virtual Tag
124 1.13 skrll #define CTR_EL0_L1IP_VIPT 2 // Virtual Index, Physical Tag
125 1.13 skrll #define CTR_EL0_L1IP_PIPT 3 // Physical Index, Physical Tag
126 1.13 skrll #define CTR_EL0_IMIN_LINE __BITS(3,0) // Icache MIN LINE size (log2 - 2)
127 1.1 matt
128 1.14 skrll AARCH64REG_READ_INLINE(dczid_el0) // Data Cache Zero ID Register
129 1.1 matt
130 1.13 skrll #define DCZID_DZP __BIT(4) // Data Zero Prohibited
131 1.13 skrll #define DCZID_BS __BITS(3,0) // Block Size (log2 - 2)
132 1.1 matt
133 1.14 skrll AARCH64REG_READ_INLINE(fpcr) // Floating Point Control Register
134 1.1 matt AARCH64REG_WRITE_INLINE(fpcr)
135 1.1 matt
136 1.13 skrll #define FPCR_AHP __BIT(26) // Alternative Half Precision
137 1.13 skrll #define FPCR_DN __BIT(25) // Default Nan Control
138 1.13 skrll #define FPCR_FZ __BIT(24) // Flush-To-Zero
139 1.13 skrll #define FPCR_RMODE __BITS(23,22) // Rounding Mode
140 1.13 skrll #define FPCR_RN 0 // Round Nearest
141 1.13 skrll #define FPCR_RP 1 // Round towards Plus infinity
142 1.13 skrll #define FPCR_RM 2 // Round towards Minus infinity
143 1.13 skrll #define FPCR_RZ 3 // Round towards Zero
144 1.13 skrll #define FPCR_STRIDE __BITS(21,20)
145 1.20 riastrad #define FPCR_FZ16 __BIT(19) // Flush-To-Zero for FP16
146 1.13 skrll #define FPCR_LEN __BITS(18,16)
147 1.13 skrll #define FPCR_IDE __BIT(15) // Input Denormal Exception enable
148 1.13 skrll #define FPCR_IXE __BIT(12) // IneXact Exception enable
149 1.13 skrll #define FPCR_UFE __BIT(11) // UnderFlow Exception enable
150 1.13 skrll #define FPCR_OFE __BIT(10) // OverFlow Exception enable
151 1.13 skrll #define FPCR_DZE __BIT(9) // Divide by Zero Exception enable
152 1.13 skrll #define FPCR_IOE __BIT(8) // Invalid Operation Exception enable
153 1.13 skrll #define FPCR_ESUM 0x1F00
154 1.1 matt
155 1.1 matt AARCH64REG_READ_INLINE(fpsr) // Floating Point Status Register
156 1.1 matt AARCH64REG_WRITE_INLINE(fpsr)
157 1.1 matt
158 1.13 skrll #define FPSR_N32 __BIT(31) // AARCH32 Negative
159 1.13 skrll #define FPSR_Z32 __BIT(30) // AARCH32 Zero
160 1.13 skrll #define FPSR_C32 __BIT(29) // AARCH32 Carry
161 1.13 skrll #define FPSR_V32 __BIT(28) // AARCH32 Overflow
162 1.13 skrll #define FPSR_QC __BIT(27) // SIMD Saturation
163 1.13 skrll #define FPSR_IDC __BIT(7) // Input Denormal Cumulative status
164 1.13 skrll #define FPSR_IXC __BIT(4) // IneXact Cumulative status
165 1.13 skrll #define FPSR_UFC __BIT(3) // UnderFlow Cumulative status
166 1.13 skrll #define FPSR_OFC __BIT(2) // OverFlow Cumulative status
167 1.13 skrll #define FPSR_DZC __BIT(1) // Divide by Zero Cumulative status
168 1.13 skrll #define FPSR_IOC __BIT(0) // Invalid Operation Cumulative status
169 1.13 skrll #define FPSR_CSUM 0x1F
170 1.1 matt
171 1.1 matt AARCH64REG_READ_INLINE(nzcv) // condition codes
172 1.1 matt AARCH64REG_WRITE_INLINE(nzcv)
173 1.1 matt
174 1.13 skrll #define NZCV_N __BIT(31) // Negative
175 1.13 skrll #define NZCV_Z __BIT(30) // Zero
176 1.13 skrll #define NZCV_C __BIT(29) // Carry
177 1.13 skrll #define NZCV_V __BIT(28) // Overflow
178 1.1 matt
179 1.1 matt AARCH64REG_READ_INLINE(tpidr_el0) // Thread Pointer ID Register (RW)
180 1.1 matt AARCH64REG_WRITE_INLINE(tpidr_el0)
181 1.1 matt
182 1.9 ryo AARCH64REG_READ_INLINE(tpidrro_el0) // Thread Pointer ID Register (RO)
183 1.9 ryo
184 1.3 skrll /*
185 1.1 matt * From here on, these can only be accessed at EL1 (kernel)
186 1.1 matt */
187 1.1 matt
188 1.1 matt /*
189 1.1 matt * These are readonly registers
190 1.1 matt */
191 1.9 ryo AARCH64REG_READ_INLINE(aidr_el1)
192 1.9 ryo
193 1.14 skrll AARCH64REG_READ_INLINE2(cbar_el1, s3_1_c15_c3_0) // Cortex-A57
194 1.1 matt
195 1.13 skrll #define CBAR_PA __BITS(47,18)
196 1.1 matt
197 1.9 ryo AARCH64REG_READ_INLINE(ccsidr_el1)
198 1.9 ryo
199 1.46 ryo /* 32bit format CCSIDR_EL1 */
200 1.37 ryo #define CCSIDR_WT __BIT(31) // OBSOLETE: Write-through supported
201 1.37 ryo #define CCSIDR_WB __BIT(30) // OBSOLETE: Write-back supported
202 1.37 ryo #define CCSIDR_RA __BIT(29) // OBSOLETE: Read-allocation supported
203 1.37 ryo #define CCSIDR_WA __BIT(28) // OBSOLETE: Write-allocation supported
204 1.13 skrll #define CCSIDR_NUMSET __BITS(27,13) // (Number of sets in cache) - 1
205 1.13 skrll #define CCSIDR_ASSOC __BITS(12,3) // (Associativity of cache) - 1
206 1.13 skrll #define CCSIDR_LINESIZE __BITS(2,0) // Number of bytes in cache line
207 1.9 ryo
208 1.46 ryo /* 64bit format CCSIDR_EL1 (ARMv8.3-CCIDX is implemented) */
209 1.46 ryo #define CCSIDR64_NUMSET __BITS(55,32) // (Number of sets in cache) - 1
210 1.46 ryo #define CCSIDR64_ASSOC __BITS(23,3) // (Associativity of cache) - 1
211 1.46 ryo #define CCSIDR64_LINESIZE __BITS(2,0) // Number of bytes in cache line
212 1.46 ryo
213 1.1 matt AARCH64REG_READ_INLINE(clidr_el1)
214 1.9 ryo
215 1.37 ryo #define CLIDR_ICB __BITS(32,30) // Inner cache boundary
216 1.13 skrll #define CLIDR_LOUU __BITS(29,27) // Level of Unification Uniprocessor
217 1.13 skrll #define CLIDR_LOC __BITS(26,24) // Level of Coherency
218 1.13 skrll #define CLIDR_LOUIS __BITS(23,21) // Level of Unification InnerShareable*/
219 1.13 skrll #define CLIDR_CTYPE7 __BITS(20,18) // Cache Type field for level7
220 1.13 skrll #define CLIDR_CTYPE6 __BITS(17,15) // Cache Type field for level6
221 1.13 skrll #define CLIDR_CTYPE5 __BITS(14,12) // Cache Type field for level5
222 1.13 skrll #define CLIDR_CTYPE4 __BITS(11,9) // Cache Type field for level4
223 1.13 skrll #define CLIDR_CTYPE3 __BITS(8,6) // Cache Type field for level3
224 1.13 skrll #define CLIDR_CTYPE2 __BITS(5,3) // Cache Type field for level2
225 1.13 skrll #define CLIDR_CTYPE1 __BITS(2,0) // Cache Type field for level1
226 1.13 skrll #define CLIDR_TYPE_NOCACHE 0 // No cache
227 1.13 skrll #define CLIDR_TYPE_ICACHE 1 // Instruction cache only
228 1.13 skrll #define CLIDR_TYPE_DCACHE 2 // Data cache only
229 1.13 skrll #define CLIDR_TYPE_IDCACHE 3 // Separate inst and data caches
230 1.13 skrll #define CLIDR_TYPE_UNIFIEDCACHE 4 // Unified cache
231 1.9 ryo
232 1.65 skrll AARCH64REG_READ_INLINE(contextidr_el1)
233 1.65 skrll AARCH64REG_WRITE_INLINE(contextidr_el1)
234 1.65 skrll
235 1.9 ryo AARCH64REG_READ_INLINE(currentel)
236 1.65 skrll
237 1.65 skrll #define CURRENTEL_EL __BITS(3,2) // Current exception Level
238 1.65 skrll
239 1.9 ryo AARCH64REG_READ_INLINE(id_aa64afr0_el1)
240 1.9 ryo AARCH64REG_READ_INLINE(id_aa64afr1_el1)
241 1.9 ryo AARCH64REG_READ_INLINE(id_aa64dfr0_el1)
242 1.9 ryo
243 1.37 ryo #define ID_AA64DFR0_EL1_TRACEFILT __BITS(43,40)
244 1.37 ryo #define ID_AA64DFR0_EL1_TRACEFILT_NONE 0
245 1.37 ryo #define ID_AA64DFR0_EL1_TRACEFILT_IMPL 1
246 1.38 ryo #define ID_AA64DFR0_EL1_DBLLOCK __BITS(39,36)
247 1.37 ryo #define ID_AA64DFR0_EL1_DBLLOCK_IMPL 0
248 1.37 ryo #define ID_AA64DFR0_EL1_DBLLOCK_NONE 15
249 1.37 ryo #define ID_AA64DFR0_EL1_PMSVER __BITS(35,32)
250 1.13 skrll #define ID_AA64DFR0_EL1_CTX_CMPS __BITS(31,28)
251 1.13 skrll #define ID_AA64DFR0_EL1_WRPS __BITS(20,23)
252 1.13 skrll #define ID_AA64DFR0_EL1_BRPS __BITS(12,15)
253 1.13 skrll #define ID_AA64DFR0_EL1_PMUVER __BITS(8,11)
254 1.13 skrll #define ID_AA64DFR0_EL1_PMUVER_NONE 0
255 1.12 christos #define ID_AA64DFR0_EL1_PMUVER_V3 1
256 1.13 skrll #define ID_AA64DFR0_EL1_PMUVER_NOV3 2
257 1.63 ryo #define ID_AA64DFR0_EL1_PMUVER_V3P1 4
258 1.63 ryo #define ID_AA64DFR0_EL1_PMUVER_V3P4 5
259 1.63 ryo #define ID_AA64DFR0_EL1_PMUVER_V3P5 6
260 1.63 ryo #define ID_AA64DFR0_EL1_PMUVER_V3P7 7
261 1.57 jmcneill #define ID_AA64DFR0_EL1_PMUVER_IMPL 15
262 1.13 skrll #define ID_AA64DFR0_EL1_TRACEVER __BITS(4,7)
263 1.13 skrll #define ID_AA64DFR0_EL1_TRACEVER_NONE 0
264 1.13 skrll #define ID_AA64DFR0_EL1_TRACEVER_IMPL 1
265 1.13 skrll #define ID_AA64DFR0_EL1_DEBUGVER __BITS(0,3)
266 1.13 skrll #define ID_AA64DFR0_EL1_DEBUGVER_V8A 6
267 1.9 ryo
268 1.9 ryo AARCH64REG_READ_INLINE(id_aa64dfr1_el1)
269 1.9 ryo
270 1.9 ryo AARCH64REG_READ_INLINE(id_aa64isar0_el1)
271 1.9 ryo
272 1.41 riastrad #define ID_AA64ISAR0_EL1_RNDR __BITS(63,60)
273 1.37 ryo #define ID_AA64ISAR0_EL1_RNDR_NONE 0
274 1.37 ryo #define ID_AA64ISAR0_EL1_RNDR_RNDRRS 1
275 1.37 ryo #define ID_AA64ISAR0_EL1_TLB __BITS(59,56)
276 1.37 ryo #define ID_AA64ISAR0_EL1_TLB_NONE 0
277 1.37 ryo #define ID_AA64ISAR0_EL1_TLB_OS 1
278 1.37 ryo #define ID_AA64ISAR0_EL1_TLB_OS_TLB 2
279 1.37 ryo #define ID_AA64ISAR0_EL1_TS __BITS(55,52)
280 1.37 ryo #define ID_AA64ISAR0_EL1_TS_NONE 0
281 1.37 ryo #define ID_AA64ISAR0_EL1_TS_CFINV 1
282 1.37 ryo #define ID_AA64ISAR0_EL1_TS_AXFLAG 2
283 1.37 ryo #define ID_AA64ISAR0_EL1_FHM __BITS(51,48)
284 1.37 ryo #define ID_AA64ISAR0_EL1_FHM_NONE 0
285 1.37 ryo #define ID_AA64ISAR0_EL1_FHM_FMLAL 1
286 1.37 ryo #define ID_AA64ISAR0_EL1_DP __BITS(47,44)
287 1.37 ryo #define ID_AA64ISAR0_EL1_DP_NONE 0
288 1.37 ryo #define ID_AA64ISAR0_EL1_DP_UDOT 1
289 1.37 ryo #define ID_AA64ISAR0_EL1_SM4 __BITS(43,40)
290 1.37 ryo #define ID_AA64ISAR0_EL1_SM4_NONE 0
291 1.37 ryo #define ID_AA64ISAR0_EL1_SM4_SM4 1
292 1.37 ryo #define ID_AA64ISAR0_EL1_SM3 __BITS(39,36)
293 1.37 ryo #define ID_AA64ISAR0_EL1_SM3_NONE 0
294 1.37 ryo #define ID_AA64ISAR0_EL1_SM3_SM3 1
295 1.37 ryo #define ID_AA64ISAR0_EL1_SHA3 __BITS(35,32)
296 1.37 ryo #define ID_AA64ISAR0_EL1_SHA3_NONE 0
297 1.37 ryo #define ID_AA64ISAR0_EL1_SHA3_EOR3 1
298 1.37 ryo #define ID_AA64ISAR0_EL1_RDM __BITS(31,28)
299 1.37 ryo #define ID_AA64ISAR0_EL1_RDM_NONE 0
300 1.37 ryo #define ID_AA64ISAR0_EL1_RDM_SQRDML 1
301 1.37 ryo #define ID_AA64ISAR0_EL1_ATOMIC __BITS(23,20)
302 1.37 ryo #define ID_AA64ISAR0_EL1_ATOMIC_NONE 0
303 1.60 ryo #define ID_AA64ISAR0_EL1_ATOMIC_SWP 2
304 1.13 skrll #define ID_AA64ISAR0_EL1_CRC32 __BITS(19,16)
305 1.13 skrll #define ID_AA64ISAR0_EL1_CRC32_NONE 0
306 1.13 skrll #define ID_AA64ISAR0_EL1_CRC32_CRC32X 1
307 1.13 skrll #define ID_AA64ISAR0_EL1_SHA2 __BITS(15,12)
308 1.12 christos #define ID_AA64ISAR0_EL1_SHA2_NONE 0
309 1.12 christos #define ID_AA64ISAR0_EL1_SHA2_SHA256HSU 1
310 1.37 ryo #define ID_AA64ISAR0_EL1_SHA2_SHA512HSU 2
311 1.13 skrll #define ID_AA64ISAR0_EL1_SHA1 __BITS(11,8)
312 1.12 christos #define ID_AA64ISAR0_EL1_SHA1_NONE 0
313 1.12 christos #define ID_AA64ISAR0_EL1_SHA1_SHA1CPMHSU 1
314 1.13 skrll #define ID_AA64ISAR0_EL1_AES __BITS(7,4)
315 1.12 christos #define ID_AA64ISAR0_EL1_AES_NONE 0
316 1.12 christos #define ID_AA64ISAR0_EL1_AES_AES 1
317 1.12 christos #define ID_AA64ISAR0_EL1_AES_PMUL 2
318 1.9 ryo
319 1.9 ryo AARCH64REG_READ_INLINE(id_aa64isar1_el1)
320 1.31 maxv
321 1.54 ryo #define ID_AA64ISAR1_EL1_I8MM __BITS(55,52)
322 1.54 ryo #define ID_AA64ISAR1_EL1_I8MM_NONE 0
323 1.54 ryo #define ID_AA64ISAR1_EL1_I8MM_SUPPORTED 1
324 1.54 ryo #define ID_AA64ISAR1_EL1_DGH __BITS(51,48)
325 1.54 ryo #define ID_AA64ISAR1_EL1_DGH_NONE 0
326 1.54 ryo #define ID_AA64ISAR1_EL1_DGH_SUPPORTED 1
327 1.54 ryo #define ID_AA64ISAR1_EL1_BF16 __BITS(47,44)
328 1.54 ryo #define ID_AA64ISAR1_EL1_BF16_NONE 0
329 1.54 ryo #define ID_AA64ISAR1_EL1_BF16_BFDOT 1
330 1.31 maxv #define ID_AA64ISAR1_EL1_SPECRES __BITS(43,40)
331 1.31 maxv #define ID_AA64ISAR1_EL1_SPECRES_NONE 0
332 1.31 maxv #define ID_AA64ISAR1_EL1_SPECRES_SUPPORTED 1
333 1.31 maxv #define ID_AA64ISAR1_EL1_SB __BITS(39,36)
334 1.31 maxv #define ID_AA64ISAR1_EL1_SB_NONE 0
335 1.31 maxv #define ID_AA64ISAR1_EL1_SB_SUPPORTED 1
336 1.31 maxv #define ID_AA64ISAR1_EL1_FRINTTS __BITS(35,32)
337 1.31 maxv #define ID_AA64ISAR1_EL1_FRINTTS_NONE 0
338 1.31 maxv #define ID_AA64ISAR1_EL1_FRINTTS_SUPPORTED 1
339 1.31 maxv #define ID_AA64ISAR1_EL1_GPI __BITS(31,28)
340 1.31 maxv #define ID_AA64ISAR1_EL1_GPI_NONE 0
341 1.31 maxv #define ID_AA64ISAR1_EL1_GPI_SUPPORTED 1
342 1.31 maxv #define ID_AA64ISAR1_EL1_GPA __BITS(27,24)
343 1.31 maxv #define ID_AA64ISAR1_EL1_GPA_NONE 0
344 1.31 maxv #define ID_AA64ISAR1_EL1_GPA_QARMA 1
345 1.31 maxv #define ID_AA64ISAR1_EL1_LRCPC __BITS(23,20)
346 1.31 maxv #define ID_AA64ISAR1_EL1_LRCPC_NONE 0
347 1.31 maxv #define ID_AA64ISAR1_EL1_LRCPC_PR 1
348 1.31 maxv #define ID_AA64ISAR1_EL1_LRCPC_PR_UR 2
349 1.31 maxv #define ID_AA64ISAR1_EL1_FCMA __BITS(19,16)
350 1.31 maxv #define ID_AA64ISAR1_EL1_FCMA_NONE 0
351 1.31 maxv #define ID_AA64ISAR1_EL1_FCMA_SUPPORTED 1
352 1.31 maxv #define ID_AA64ISAR1_EL1_JSCVT __BITS(15,12)
353 1.31 maxv #define ID_AA64ISAR1_EL1_JSCVT_NONE 0
354 1.31 maxv #define ID_AA64ISAR1_EL1_JSCVT_SUPPORTED 1
355 1.31 maxv #define ID_AA64ISAR1_EL1_API __BITS(11,8)
356 1.31 maxv #define ID_AA64ISAR1_EL1_API_NONE 0
357 1.31 maxv #define ID_AA64ISAR1_EL1_API_SUPPORTED 1
358 1.31 maxv #define ID_AA64ISAR1_EL1_API_ENHANCED 2
359 1.31 maxv #define ID_AA64ISAR1_EL1_APA __BITS(7,4)
360 1.31 maxv #define ID_AA64ISAR1_EL1_APA_NONE 0
361 1.31 maxv #define ID_AA64ISAR1_EL1_APA_QARMA 1
362 1.31 maxv #define ID_AA64ISAR1_EL1_APA_QARMA_ENH 2
363 1.31 maxv #define ID_AA64ISAR1_EL1_DPB __BITS(3,0)
364 1.31 maxv #define ID_AA64ISAR1_EL1_DPB_NONE 0
365 1.31 maxv #define ID_AA64ISAR1_EL1_DPB_CVAP 1
366 1.31 maxv #define ID_AA64ISAR1_EL1_DPB_CVAP_CVADP 2
367 1.31 maxv
368 1.9 ryo AARCH64REG_READ_INLINE(id_aa64mmfr0_el1)
369 1.9 ryo
370 1.37 ryo #define ID_AA64MMFR0_EL1_EXS __BITS(43,40)
371 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN4 __BITS(31,28)
372 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN4_4KB 0
373 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN4_NONE 15
374 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN64 __BITS(24,27)
375 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN64_64KB 0
376 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN64_NONE 15
377 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN16 __BITS(20,23)
378 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN16_NONE 0
379 1.13 skrll #define ID_AA64MMFR0_EL1_TGRAN16_16KB 1
380 1.13 skrll #define ID_AA64MMFR0_EL1_BIGENDEL0 __BITS(16,19)
381 1.12 christos #define ID_AA64MMFR0_EL1_BIGENDEL0_NONE 0
382 1.13 skrll #define ID_AA64MMFR0_EL1_BIGENDEL0_MIX 1
383 1.13 skrll #define ID_AA64MMFR0_EL1_SNSMEM __BITS(12,15)
384 1.13 skrll #define ID_AA64MMFR0_EL1_SNSMEM_NONE 0
385 1.13 skrll #define ID_AA64MMFR0_EL1_SNSMEM_SNSMEM 1
386 1.13 skrll #define ID_AA64MMFR0_EL1_BIGEND __BITS(8,11)
387 1.13 skrll #define ID_AA64MMFR0_EL1_BIGEND_NONE 0
388 1.13 skrll #define ID_AA64MMFR0_EL1_BIGEND_MIX 1
389 1.13 skrll #define ID_AA64MMFR0_EL1_ASIDBITS __BITS(4,7)
390 1.13 skrll #define ID_AA64MMFR0_EL1_ASIDBITS_8BIT 0
391 1.12 christos #define ID_AA64MMFR0_EL1_ASIDBITS_16BIT 2
392 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE __BITS(0,3)
393 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE_4G 0
394 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE_64G 1
395 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE_1T 2
396 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE_4T 3
397 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE_16T 4
398 1.13 skrll #define ID_AA64MMFR0_EL1_PARANGE_256T 5
399 1.37 ryo #define ID_AA64MMFR0_EL1_PARANGE_4P 6
400 1.9 ryo
401 1.9 ryo AARCH64REG_READ_INLINE(id_aa64mmfr1_el1)
402 1.31 maxv
403 1.31 maxv #define ID_AA64MMFR1_EL1_XNX __BITS(31,28)
404 1.31 maxv #define ID_AA64MMFR1_EL1_XNX_NONE 0
405 1.31 maxv #define ID_AA64MMFR1_EL1_XNX_SUPPORTED 1
406 1.31 maxv #define ID_AA64MMFR1_EL1_SPECSEI __BITS(27,24)
407 1.31 maxv #define ID_AA64MMFR1_EL1_SPECSEI_NONE 0
408 1.31 maxv #define ID_AA64MMFR1_EL1_SPECSEI_EXTINT 1
409 1.31 maxv #define ID_AA64MMFR1_EL1_PAN __BITS(23,20)
410 1.31 maxv #define ID_AA64MMFR1_EL1_PAN_NONE 0
411 1.31 maxv #define ID_AA64MMFR1_EL1_PAN_SUPPORTED 1
412 1.31 maxv #define ID_AA64MMFR1_EL1_PAN_S1E1 2
413 1.31 maxv #define ID_AA64MMFR1_EL1_LO __BITS(19,16)
414 1.31 maxv #define ID_AA64MMFR1_EL1_LO_NONE 0
415 1.31 maxv #define ID_AA64MMFR1_EL1_LO_SUPPORTED 1
416 1.31 maxv #define ID_AA64MMFR1_EL1_HPDS __BITS(15,12)
417 1.31 maxv #define ID_AA64MMFR1_EL1_HPDS_NONE 0
418 1.31 maxv #define ID_AA64MMFR1_EL1_HPDS_SUPPORTED 1
419 1.31 maxv #define ID_AA64MMFR1_EL1_HPDS_EXTRA_PTD 2
420 1.31 maxv #define ID_AA64MMFR1_EL1_VH __BITS(11,8)
421 1.31 maxv #define ID_AA64MMFR1_EL1_VH_NONE 0
422 1.31 maxv #define ID_AA64MMFR1_EL1_VH_SUPPORTED 1
423 1.31 maxv #define ID_AA64MMFR1_EL1_VMIDBITS __BITS(7,4)
424 1.31 maxv #define ID_AA64MMFR1_EL1_VMIDBITS_8BIT 0
425 1.31 maxv #define ID_AA64MMFR1_EL1_VMIDBITS_16BIT 2
426 1.31 maxv #define ID_AA64MMFR1_EL1_HAFDBS __BITS(3,0)
427 1.31 maxv #define ID_AA64MMFR1_EL1_HAFDBS_NONE 0
428 1.31 maxv #define ID_AA64MMFR1_EL1_HAFDBS_A 1
429 1.31 maxv #define ID_AA64MMFR1_EL1_HAFDBS_AD 2
430 1.31 maxv
431 1.33 maxv AARCH64REG_READ_INLINE3(id_aa64mmfr2_el1, id_aa64mmfr2_el1,
432 1.42 ryo ATTR_ARCH("armv8.2-a"))
433 1.31 maxv
434 1.31 maxv #define ID_AA64MMFR2_EL1_E0PD __BITS(63,60)
435 1.31 maxv #define ID_AA64MMFR2_EL1_E0PD_NONE 0
436 1.31 maxv #define ID_AA64MMFR2_EL1_E0PD_SUPPORTED 1
437 1.31 maxv #define ID_AA64MMFR2_EL1_EVT __BITS(59,56)
438 1.31 maxv #define ID_AA64MMFR2_EL1_EVT_NONE 0
439 1.31 maxv #define ID_AA64MMFR2_EL1_EVT_TO_TI 1
440 1.31 maxv #define ID_AA64MMFR2_EL1_EVT_TO_TI_TTL 2
441 1.31 maxv #define ID_AA64MMFR2_EL1_BBM __BITS(55,52)
442 1.31 maxv #define ID_AA64MMFR2_EL1_BBM_L0 0
443 1.31 maxv #define ID_AA64MMFR2_EL1_BBM_L1 1
444 1.31 maxv #define ID_AA64MMFR2_EL1_BBM_L2 2
445 1.31 maxv #define ID_AA64MMFR2_EL1_TTL __BITS(51,48)
446 1.31 maxv #define ID_AA64MMFR2_EL1_TTL_NONE 0
447 1.31 maxv #define ID_AA64MMFR2_EL1_TTL_SUPPORTED 1
448 1.31 maxv #define ID_AA64MMFR2_EL1_FWB __BITS(43,40)
449 1.31 maxv #define ID_AA64MMFR2_EL1_FWB_NONE 0
450 1.31 maxv #define ID_AA64MMFR2_EL1_FWB_SUPPORTED 1
451 1.31 maxv #define ID_AA64MMFR2_EL1_IDS __BITS(39,36)
452 1.31 maxv #define ID_AA64MMFR2_EL1_IDS_0X0 0
453 1.31 maxv #define ID_AA64MMFR2_EL1_IDS_0X18 1
454 1.31 maxv #define ID_AA64MMFR2_EL1_AT __BITS(35,32)
455 1.31 maxv #define ID_AA64MMFR2_EL1_AT_NONE 0
456 1.31 maxv #define ID_AA64MMFR2_EL1_AT_16BIT 1
457 1.31 maxv #define ID_AA64MMFR2_EL1_ST __BITS(31,28)
458 1.31 maxv #define ID_AA64MMFR2_EL1_ST_39 0
459 1.31 maxv #define ID_AA64MMFR2_EL1_ST_48 1
460 1.31 maxv #define ID_AA64MMFR2_EL1_NV __BITS(27,24)
461 1.31 maxv #define ID_AA64MMFR2_EL1_NV_NONE 0
462 1.31 maxv #define ID_AA64MMFR2_EL1_NV_HCR 1
463 1.31 maxv #define ID_AA64MMFR2_EL1_NV_HCR_VNCR 2
464 1.31 maxv #define ID_AA64MMFR2_EL1_CCIDX __BITS(23,20)
465 1.31 maxv #define ID_AA64MMFR2_EL1_CCIDX_32BIT 0
466 1.31 maxv #define ID_AA64MMFR2_EL1_CCIDX_64BIT 1
467 1.31 maxv #define ID_AA64MMFR2_EL1_VARANGE __BITS(19,16)
468 1.31 maxv #define ID_AA64MMFR2_EL1_VARANGE_48BIT 0
469 1.31 maxv #define ID_AA64MMFR2_EL1_VARANGE_52BIT 1
470 1.31 maxv #define ID_AA64MMFR2_EL1_IESB __BITS(15,12)
471 1.31 maxv #define ID_AA64MMFR2_EL1_IESB_NONE 0
472 1.31 maxv #define ID_AA64MMFR2_EL1_IESB_SUPPORTED 1
473 1.31 maxv #define ID_AA64MMFR2_EL1_LSM __BITS(11,8)
474 1.31 maxv #define ID_AA64MMFR2_EL1_LSM_NONE 0
475 1.31 maxv #define ID_AA64MMFR2_EL1_LSM_SUPPORTED 1
476 1.31 maxv #define ID_AA64MMFR2_EL1_UAO __BITS(7,4)
477 1.31 maxv #define ID_AA64MMFR2_EL1_UAO_NONE 0
478 1.31 maxv #define ID_AA64MMFR2_EL1_UAO_SUPPORTED 1
479 1.31 maxv #define ID_AA64MMFR2_EL1_CNP __BITS(3,0)
480 1.31 maxv #define ID_AA64MMFR2_EL1_CNP_NONE 0
481 1.31 maxv #define ID_AA64MMFR2_EL1_CNP_SUPPORTED 1
482 1.31 maxv
483 1.31 maxv AARCH64REG_READ_INLINE2(a72_cpuactlr_el1, s3_1_c15_c2_0)
484 1.9 ryo AARCH64REG_READ_INLINE(id_aa64pfr0_el1)
485 1.9 ryo AARCH64REG_READ_INLINE(id_aa64pfr1_el1)
486 1.31 maxv
487 1.31 maxv #define ID_AA64PFR1_EL1_RASFRAC __BITS(15,12)
488 1.31 maxv #define ID_AA64PFR1_EL1_RASFRAC_NORMAL 0
489 1.31 maxv #define ID_AA64PFR1_EL1_RASFRAC_EXTRA 1
490 1.31 maxv #define ID_AA64PFR1_EL1_MTE __BITS(11,8)
491 1.31 maxv #define ID_AA64PFR1_EL1_MTE_NONE 0
492 1.31 maxv #define ID_AA64PFR1_EL1_MTE_PARTIAL 1
493 1.31 maxv #define ID_AA64PFR1_EL1_MTE_SUPPORTED 2
494 1.31 maxv #define ID_AA64PFR1_EL1_SSBS __BITS(7,4)
495 1.31 maxv #define ID_AA64PFR1_EL1_SSBS_NONE 0
496 1.31 maxv #define ID_AA64PFR1_EL1_SSBS_SUPPORTED 1
497 1.31 maxv #define ID_AA64PFR1_EL1_SSBS_MSR_MRS 2
498 1.31 maxv #define ID_AA64PFR1_EL1_BT __BITS(3,0)
499 1.31 maxv #define ID_AA64PFR1_EL1_BT_NONE 0
500 1.31 maxv #define ID_AA64PFR1_EL1_BT_SUPPORTED 1
501 1.31 maxv
502 1.21 mrg AARCH64REG_READ_INLINE(id_aa64zfr0_el1)
503 1.9 ryo AARCH64REG_READ_INLINE(id_pfr1_el1)
504 1.1 matt AARCH64REG_READ_INLINE(isr_el1)
505 1.1 matt AARCH64REG_READ_INLINE(midr_el1)
506 1.1 matt AARCH64REG_READ_INLINE(mpidr_el1)
507 1.9 ryo
508 1.21 mrg #define MIDR_EL1_IMPL __BITS(31,24) // Implementor
509 1.21 mrg #define MIDR_EL1_VARIANT __BITS(23,20) // CPU Variant
510 1.21 mrg #define MIDR_EL1_ARCH __BITS(19,16) // Architecture
511 1.21 mrg #define MIDR_EL1_PARTNUM __BITS(15,4) // PartNum
512 1.21 mrg #define MIDR_EL1_REVISION __BITS(3,0) // Revision
513 1.21 mrg
514 1.13 skrll #define MPIDR_AFF3 __BITS(32,39)
515 1.13 skrll #define MPIDR_U __BIT(30) // 1 = Uni-Processor System
516 1.13 skrll #define MPIDR_MT __BIT(24) // 1 = SMT(AFF0 is logical)
517 1.13 skrll #define MPIDR_AFF2 __BITS(16,23)
518 1.13 skrll #define MPIDR_AFF1 __BITS(8,15)
519 1.13 skrll #define MPIDR_AFF0 __BITS(0,7)
520 1.9 ryo
521 1.1 matt AARCH64REG_READ_INLINE(mvfr0_el1)
522 1.9 ryo
523 1.14 skrll #define MVFR0_FPROUND __BITS(31,28)
524 1.14 skrll #define MVFR0_FPROUND_NEAREST 0
525 1.12 christos #define MVFR0_FPROUND_ALL 1
526 1.14 skrll #define MVFR0_FPSHVEC __BITS(27,24)
527 1.12 christos #define MVFR0_FPSHVEC_NONE 0
528 1.14 skrll #define MVFR0_FPSHVEC_SHVEC 1
529 1.14 skrll #define MVFR0_FPSQRT __BITS(23,20)
530 1.12 christos #define MVFR0_FPSQRT_NONE 0
531 1.12 christos #define MVFR0_FPSQRT_VSQRT 1
532 1.14 skrll #define MVFR0_FPDIVIDE __BITS(19,16)
533 1.14 skrll #define MVFR0_FPDIVIDE_NONE 0
534 1.14 skrll #define MVFR0_FPDIVIDE_VDIV 1
535 1.14 skrll #define MVFR0_FPTRAP __BITS(15,12)
536 1.12 christos #define MVFR0_FPTRAP_NONE 0
537 1.12 christos #define MVFR0_FPTRAP_TRAP 1
538 1.14 skrll #define MVFR0_FPDP __BITS(11,8)
539 1.12 christos #define MVFR0_FPDP_NONE 0
540 1.12 christos #define MVFR0_FPDP_VFPV2 1
541 1.12 christos #define MVFR0_FPDP_VFPV3 2
542 1.14 skrll #define MVFR0_FPSP __BITS(7,4)
543 1.12 christos #define MVFR0_FPSP_NONE 0
544 1.12 christos #define MVFR0_FPSP_VFPV2 1
545 1.12 christos #define MVFR0_FPSP_VFPV3 2
546 1.14 skrll #define MVFR0_SIMDREG __BITS(3,0)
547 1.12 christos #define MVFR0_SIMDREG_NONE 0
548 1.14 skrll #define MVFR0_SIMDREG_16x64 1
549 1.14 skrll #define MVFR0_SIMDREG_32x64 2
550 1.9 ryo
551 1.1 matt AARCH64REG_READ_INLINE(mvfr1_el1)
552 1.9 ryo
553 1.14 skrll #define MVFR1_SIMDFMAC __BITS(31,28)
554 1.14 skrll #define MVFR1_SIMDFMAC_NONE 0
555 1.14 skrll #define MVFR1_SIMDFMAC_FMAC 1
556 1.14 skrll #define MVFR1_FPHP __BITS(27,24)
557 1.12 christos #define MVFR1_FPHP_NONE 0
558 1.14 skrll #define MVFR1_FPHP_HALF_SINGLE 1
559 1.14 skrll #define MVFR1_FPHP_HALF_DOUBLE 2
560 1.20 riastrad #define MVFR1_FPHP_HALF_ARITH 3
561 1.14 skrll #define MVFR1_SIMDHP __BITS(23,20)
562 1.12 christos #define MVFR1_SIMDHP_NONE 0
563 1.12 christos #define MVFR1_SIMDHP_HALF 1
564 1.20 riastrad #define MVFR1_SIMDHP_HALF_ARITH 3
565 1.14 skrll #define MVFR1_SIMDSP __BITS(19,16)
566 1.12 christos #define MVFR1_SIMDSP_NONE 0
567 1.14 skrll #define MVFR1_SIMDSP_SINGLE 1
568 1.14 skrll #define MVFR1_SIMDINT __BITS(15,12)
569 1.12 christos #define MVFR1_SIMDINT_NONE 0
570 1.14 skrll #define MVFR1_SIMDINT_INTEGER 1
571 1.14 skrll #define MVFR1_SIMDLS __BITS(11,8)
572 1.12 christos #define MVFR1_SIMDLS_NONE 0
573 1.14 skrll #define MVFR1_SIMDLS_LOADSTORE 1
574 1.14 skrll #define MVFR1_FPDNAN __BITS(7,4)
575 1.12 christos #define MVFR1_FPDNAN_NONE 0
576 1.12 christos #define MVFR1_FPDNAN_NAN 1
577 1.14 skrll #define MVFR1_FPFTZ __BITS(3,0)
578 1.12 christos #define MVFR1_FPFTZ_NONE 0
579 1.14 skrll #define MVFR1_FPFTZ_DENORMAL 1
580 1.9 ryo
581 1.1 matt AARCH64REG_READ_INLINE(mvfr2_el1)
582 1.9 ryo
583 1.14 skrll #define MVFR2_FPMISC __BITS(7,4)
584 1.12 christos #define MVFR2_FPMISC_NONE 0
585 1.12 christos #define MVFR2_FPMISC_SEL 1
586 1.14 skrll #define MVFR2_FPMISC_DROUND 2
587 1.14 skrll #define MVFR2_FPMISC_ROUNDINT 3
588 1.14 skrll #define MVFR2_FPMISC_MAXMIN 4
589 1.14 skrll #define MVFR2_SIMDMISC __BITS(3,0)
590 1.14 skrll #define MVFR2_SIMDMISC_NONE 0
591 1.14 skrll #define MVFR2_SIMDMISC_DROUND 1
592 1.12 christos #define MVFR2_SIMDMISC_ROUNDINT 2
593 1.14 skrll #define MVFR2_SIMDMISC_MAXMIN 3
594 1.9 ryo
595 1.1 matt AARCH64REG_READ_INLINE(revidr_el1)
596 1.1 matt
597 1.1 matt /*
598 1.1 matt * These are read/write registers
599 1.1 matt */
600 1.42 ryo AARCH64REG_READ_INLINE3(APIAKeyLo_EL1, apiakeylo_el1, ATTR_ARCH("armv8.3-a"))
601 1.42 ryo AARCH64REG_WRITE_INLINE3(APIAKeyLo_EL1, apiakeylo_el1, ATTR_ARCH("armv8.3-a"))
602 1.42 ryo AARCH64REG_READ_INLINE3(APIAKeyHi_EL1, apiakeyhi_el1, ATTR_ARCH("armv8.3-a"))
603 1.42 ryo AARCH64REG_WRITE_INLINE3(APIAKeyHi_EL1, apiakeyhi_el1, ATTR_ARCH("armv8.3-a"))
604 1.42 ryo
605 1.45 ryo AARCH64REG_READ_INLINE3(APIBKeyLo_EL1, apibkeylo_el1, ATTR_ARCH("armv8.3-a"))
606 1.45 ryo AARCH64REG_WRITE_INLINE3(APIBKeyLo_EL1, apibkeylo_el1, ATTR_ARCH("armv8.3-a"))
607 1.45 ryo AARCH64REG_READ_INLINE3(APIBKeyHi_EL1, apibkeyhi_el1, ATTR_ARCH("armv8.3-a"))
608 1.45 ryo AARCH64REG_WRITE_INLINE3(APIBKeyHi_EL1, apibkeyhi_el1, ATTR_ARCH("armv8.3-a"))
609 1.45 ryo
610 1.45 ryo AARCH64REG_READ_INLINE3(APDAKeyLo_EL1, apdakeylo_el1, ATTR_ARCH("armv8.3-a"))
611 1.45 ryo AARCH64REG_WRITE_INLINE3(APDAKeyLo_EL1, apdakeylo_el1, ATTR_ARCH("armv8.3-a"))
612 1.45 ryo AARCH64REG_READ_INLINE3(APDAKeyHi_EL1, apdakeyhi_el1, ATTR_ARCH("armv8.3-a"))
613 1.45 ryo AARCH64REG_WRITE_INLINE3(APDAKeyHi_EL1, apdakeyhi_el1, ATTR_ARCH("armv8.3-a"))
614 1.45 ryo
615 1.45 ryo AARCH64REG_READ_INLINE3(APDBKeyLo_EL1, apdbkeylo_el1, ATTR_ARCH("armv8.3-a"))
616 1.45 ryo AARCH64REG_WRITE_INLINE3(APDBKeyLo_EL1, apdbkeylo_el1, ATTR_ARCH("armv8.3-a"))
617 1.45 ryo AARCH64REG_READ_INLINE3(APDBKeyHi_EL1, apdbkeyhi_el1, ATTR_ARCH("armv8.3-a"))
618 1.45 ryo AARCH64REG_WRITE_INLINE3(APDBKeyHi_EL1, apdbkeyhi_el1, ATTR_ARCH("armv8.3-a"))
619 1.45 ryo
620 1.45 ryo AARCH64REG_READ_INLINE3(APGAKeyLo_EL1, apgakeylo_el1, ATTR_ARCH("armv8.3-a"))
621 1.45 ryo AARCH64REG_WRITE_INLINE3(APGAKeyLo_EL1, apgakeylo_el1, ATTR_ARCH("armv8.3-a"))
622 1.45 ryo AARCH64REG_READ_INLINE3(APGAKeyHi_EL1, apgakeyhi_el1, ATTR_ARCH("armv8.3-a"))
623 1.45 ryo AARCH64REG_WRITE_INLINE3(APGAKeyHi_EL1, apgakeyhi_el1, ATTR_ARCH("armv8.3-a"))
624 1.45 ryo
625 1.52 maxv AARCH64REG_READ_INLINE3(pan, pan, ATTR_ARCH("armv8.1-a"))
626 1.52 maxv AARCH64REG_WRITE_INLINE3(pan, pan, ATTR_ARCH("armv8.1-a"))
627 1.52 maxv
628 1.64 andvar AARCH64REG_READ_INLINE(cpacr_el1) // Coprocessor Access Control Register
629 1.1 matt AARCH64REG_WRITE_INLINE(cpacr_el1)
630 1.1 matt
631 1.14 skrll #define CPACR_TTA __BIT(28) // System Register Access Traps
632 1.14 skrll #define CPACR_FPEN __BITS(21,20)
633 1.14 skrll #define CPACR_FPEN_NONE __SHIFTIN(0, CPACR_FPEN)
634 1.14 skrll #define CPACR_FPEN_EL1 __SHIFTIN(1, CPACR_FPEN)
635 1.14 skrll #define CPACR_FPEN_NONE_2 __SHIFTIN(2, CPACR_FPEN)
636 1.14 skrll #define CPACR_FPEN_ALL __SHIFTIN(3, CPACR_FPEN)
637 1.1 matt
638 1.9 ryo AARCH64REG_READ_INLINE(csselr_el1) // Cache Size Selection Register
639 1.9 ryo AARCH64REG_WRITE_INLINE(csselr_el1)
640 1.9 ryo
641 1.14 skrll #define CSSELR_LEVEL __BITS(3,1) // Cache level of required cache
642 1.14 skrll #define CSSELR_IND __BIT(0) // Instruction not Data bit
643 1.9 ryo
644 1.9 ryo AARCH64REG_READ_INLINE(daif) // Debug Async Irq Fiq mask register
645 1.9 ryo AARCH64REG_WRITE_INLINE(daif)
646 1.9 ryo AARCH64REG_WRITEIMM_INLINE(daifclr)
647 1.9 ryo AARCH64REG_WRITEIMM_INLINE(daifset)
648 1.9 ryo
649 1.14 skrll #define DAIF_D __BIT(9) // Debug Exception Mask
650 1.14 skrll #define DAIF_A __BIT(8) // SError Abort Mask
651 1.14 skrll #define DAIF_I __BIT(7) // IRQ Mask
652 1.14 skrll #define DAIF_F __BIT(6) // FIQ Mask
653 1.14 skrll #define DAIF_SETCLR_SHIFT 6 // for daifset/daifclr #imm shift
654 1.9 ryo
655 1.1 matt AARCH64REG_READ_INLINE(elr_el1) // Exception Link Register
656 1.1 matt AARCH64REG_WRITE_INLINE(elr_el1)
657 1.1 matt
658 1.1 matt AARCH64REG_READ_INLINE(esr_el1) // Exception Symdrone Register
659 1.1 matt AARCH64REG_WRITE_INLINE(esr_el1)
660 1.1 matt
661 1.14 skrll #define ESR_EC __BITS(31,26) // Exception Cause
662 1.14 skrll #define ESR_EC_UNKNOWN 0x00 // AXX: Unknown Reason
663 1.14 skrll #define ESR_EC_WFX 0x01 // AXX: WFI or WFE instruction execution
664 1.14 skrll #define ESR_EC_CP15_RT 0x03 // A32: MCR/MRC access to CP15 !EC=0
665 1.14 skrll #define ESR_EC_CP15_RRT 0x04 // A32: MCRR/MRRC access to CP15 !EC=0
666 1.14 skrll #define ESR_EC_CP14_RT 0x05 // A32: MCR/MRC access to CP14
667 1.14 skrll #define ESR_EC_CP14_DT 0x06 // A32: LDC/STC access to CP14
668 1.14 skrll #define ESR_EC_FP_ACCESS 0x07 // AXX: Access to SIMD/FP Registers
669 1.14 skrll #define ESR_EC_FPID 0x08 // A32: MCR/MRC access to CP10 !EC=7
670 1.65 skrll #define ESR_EC_PAUTH 0x09 // A64: Pointer auth trap (FEAT_PAUTH)
671 1.65 skrll #define ESR_EC_LS64 0x0a // AXX: LD64B/ST64B instruction (FEAT_LS64) // XXXNH
672 1.14 skrll #define ESR_EC_CP14_RRT 0x0c // A32: MRRC access to CP14
673 1.35 maxv #define ESR_EC_BTE_A64 0x0d // A64: Branch Target Exception (V8.5)
674 1.14 skrll #define ESR_EC_ILL_STATE 0x0e // AXX: Illegal Execution State
675 1.14 skrll #define ESR_EC_SVC_A32 0x11 // A32: SVC Instruction Execution
676 1.14 skrll #define ESR_EC_HVC_A32 0x12 // A32: HVC Instruction Execution
677 1.14 skrll #define ESR_EC_SMC_A32 0x13 // A32: SMC Instruction Execution
678 1.14 skrll #define ESR_EC_SVC_A64 0x15 // A64: SVC Instruction Execution
679 1.14 skrll #define ESR_EC_HVC_A64 0x16 // A64: HVC Instruction Execution
680 1.14 skrll #define ESR_EC_SMC_A64 0x17 // A64: SMC Instruction Execution
681 1.14 skrll #define ESR_EC_SYS_REG 0x18 // A64: MSR/MRS/SYS instruction (!EC0/1/7)
682 1.65 skrll #define ESR_EC_SVE 0x19 // AXX: SVE Instruction Execution (FEAT_SVE)
683 1.65 skrll #define ESR_EC_PAUTH_ERET 0x1a // A64: ERET/ERETAA/ERETAB (FEAT_PAUTH and FEAT_NV)
684 1.65 skrll #define ESR_EC_TME 0x1b // A64: TSTART instruction (FEAT_TME)
685 1.65 skrll #define ESR_EC_FRAC 0x1c // A64: Pointer auth trap (FEAT_FPAC)
686 1.65 skrll #define ESR_EC_SME 0x1d // AXX: Access to SME (FEAT_SME)
687 1.65 skrll #define ESR_EC_RME 0x1e // A64: Granule Protection Check (FEAT_RME)
688 1.65 skrll #define ESR_EC_INSN_ABT_EL_LOW 0x20 // AXX: Instruction Abort from lower level
689 1.65 skrll #define ESR_EC_INSN_ABT_EL_CUR 0x21 // AXX: Instruction Abort from current level
690 1.14 skrll #define ESR_EC_PC_ALIGNMENT 0x22 // AXX: Misaligned PC
691 1.65 skrll #define ESR_EC_DATA_ABT_EL_LOW 0x24 // AXX: Data Abort from lower level
692 1.65 skrll #define ESR_EC_DATA_ABT_EL_CUR 0x25 // AXX: Data Abort from current level
693 1.65 skrll #define ESR_EC_SP_ALIGNMENT 0x26 // AXX: Misaligned SP
694 1.65 skrll #define ESR_EC_MOPS 0x27 // A64: Memory Operation Exception (FEAT_MOPS)
695 1.14 skrll #define ESR_EC_FP_TRAP_A32 0x28 // A32: FP Exception
696 1.14 skrll #define ESR_EC_FP_TRAP_A64 0x2c // A64: FP Exception
697 1.65 skrll #define ESR_EC_SERROR 0x2f // AXX: SError Interrupt
698 1.65 skrll #define ESR_EC_BRKPNT_EL_LOW 0x30 // AXX: Breakpoint Exception from lower level
699 1.65 skrll #define ESR_EC_BRKPNT_EL_CUR 0x31 // AXX: Breakpoint Exception from current level
700 1.65 skrll #define ESR_EC_SW_STEP_EL_LOW 0x32 // AXX: Software Step from lower level
701 1.65 skrll #define ESR_EC_SW_STEP_EL_CUR 0x33 // AXX: Software Step from current level
702 1.65 skrll #define ESR_EC_WTCHPNT_EL_LOW 0x34 // AXX: Watchpoint from lower level
703 1.65 skrll #define ESR_EC_WTCHPNT_EL_CUR 0x35 // AXX: Watchpoint from current level
704 1.14 skrll #define ESR_EC_BKPT_INSN_A32 0x38 // A32: BKPT Instruction Execution
705 1.14 skrll #define ESR_EC_VECTOR_CATCH 0x3a // A32: Vector Catch Exception
706 1.14 skrll #define ESR_EC_BKPT_INSN_A64 0x3c // A64: BKPT Instruction Execution
707 1.65 skrll /* alias for EL1 kernel */
708 1.65 skrll #define ESR_EC_INSN_ABT_EL0 ESR_EC_INSN_ABT_EL_LOW
709 1.65 skrll #define ESR_EC_INSN_ABT_EL1 ESR_EC_INSN_ABT_EL_CUR
710 1.65 skrll #define ESR_EC_DATA_ABT_EL0 ESR_EC_DATA_ABT_EL_LOW
711 1.65 skrll #define ESR_EC_DATA_ABT_EL1 ESR_EC_DATA_ABT_EL_CUR
712 1.65 skrll #define ESR_EC_BRKPNT_EL0 ESR_EC_BRKPNT_EL_LOW
713 1.65 skrll #define ESR_EC_BRKPNT_EL1 ESR_EC_BRKPNT_EL_CUR
714 1.65 skrll #define ESR_EC_SW_STEP_EL0 ESR_EC_SW_STEP_EL_LOW
715 1.65 skrll #define ESR_EC_SW_STEP_EL1 ESR_EC_SW_STEP_EL_CUR
716 1.65 skrll #define ESR_EC_WTCHPNT_EL0 ESR_EC_WTCHPNT_EL_LOW
717 1.65 skrll #define ESR_EC_WTCHPNT_EL1 ESR_EC_WTCHPNT_EL_CUR
718 1.14 skrll #define ESR_IL __BIT(25) // Instruction Length (1=32-bit)
719 1.14 skrll #define ESR_ISS __BITS(24,0) // Instruction Specific Syndrome
720 1.12 christos #define ESR_ISS_CV __BIT(24) // common
721 1.12 christos #define ESR_ISS_COND __BITS(23,20) // common
722 1.12 christos #define ESR_ISS_WFX_TRAP_INSN __BIT(0) // for ESR_EC_WFX
723 1.65 skrll #define ESR_ISS_SYSREG_OP0 __BITS(21,20) // for ESR_EC_SYS_REG
724 1.65 skrll #define ESR_ISS_SYSREG_OP2 __BITS(19,17) // for ESR_EC_SYS_REG
725 1.65 skrll #define ESR_ISS_SYSREG_OP1 __BITS(16,14) // for ESR_EC_SYS_REG
726 1.65 skrll #define ESR_ISS_SYSREG_CRN __BITS(13,10) // for ESR_EC_SYS_REG
727 1.65 skrll #define ESR_ISS_SYSREG_RT __BITS(9,5) // for ESR_EC_SYS_REG
728 1.65 skrll #define ESR_ISS_SYSREG_CRM __BITS(4,1) // for ESR_EC_SYS_REG
729 1.65 skrll #define ESR_ISS_SYSREG_DIRECTION __BIT(0) // for ESR_EC_SYS_REG
730 1.12 christos #define ESR_ISS_MRC_OPC2 __BITS(19,17) // for ESR_EC_CP15_RT
731 1.12 christos #define ESR_ISS_MRC_OPC1 __BITS(16,14) // for ESR_EC_CP15_RT
732 1.12 christos #define ESR_ISS_MRC_CRN __BITS(13,10) // for ESR_EC_CP15_RT
733 1.12 christos #define ESR_ISS_MRC_RT __BITS(9,5) // for ESR_EC_CP15_RT
734 1.12 christos #define ESR_ISS_MRC_CRM __BITS(4,1) // for ESR_EC_CP15_RT
735 1.12 christos #define ESR_ISS_MRC_DIRECTION __BIT(0) // for ESR_EC_CP15_RT
736 1.12 christos #define ESR_ISS_MCRR_OPC1 __BITS(19,16) // for ESR_EC_CP15_RRT
737 1.12 christos #define ESR_ISS_MCRR_RT2 __BITS(14,10) // for ESR_EC_CP15_RRT
738 1.12 christos #define ESR_ISS_MCRR_RT __BITS(9,5) // for ESR_EC_CP15_RRT
739 1.12 christos #define ESR_ISS_MCRR_CRM __BITS(4,1) // for ESR_EC_CP15_RRT
740 1.12 christos #define ESR_ISS_MCRR_DIRECTION __BIT(0) // for ESR_EC_CP15_RRT
741 1.12 christos #define ESR_ISS_HVC_IMM16 __BITS(15,0) // for ESR_EC_{SVC,HVC}
742 1.12 christos // ...
743 1.12 christos #define ESR_ISS_INSNABORT_EA __BIT(9) // for ESC_RC_INSN_ABT_EL[01]
744 1.12 christos #define ESR_ISS_INSNABORT_S1PTW __BIT(7) // for ESC_RC_INSN_ABT_EL[01]
745 1.12 christos #define ESR_ISS_INSNABORT_IFSC __BITS(0,5) // for ESC_RC_INSN_ABT_EL[01]
746 1.12 christos #define ESR_ISS_DATAABORT_ISV __BIT(24) // for ESC_RC_DATA_ABT_EL[01]
747 1.12 christos #define ESR_ISS_DATAABORT_SAS __BITS(23,22) // for ESC_RC_DATA_ABT_EL[01]
748 1.12 christos #define ESR_ISS_DATAABORT_SSE __BIT(21) // for ESC_RC_DATA_ABT_EL[01]
749 1.65 skrll #define ESR_ISS_DATAABORT_SRT __BITS(20,16) // for ESC_RC_DATA_ABT_EL[01]
750 1.12 christos #define ESR_ISS_DATAABORT_SF __BIT(15) // for ESC_RC_DATA_ABT_EL[01]
751 1.12 christos #define ESR_ISS_DATAABORT_AR __BIT(14) // for ESC_RC_DATA_ABT_EL[01]
752 1.12 christos #define ESR_ISS_DATAABORT_EA __BIT(9) // for ESC_RC_DATA_ABT_EL[01]
753 1.12 christos #define ESR_ISS_DATAABORT_CM __BIT(8) // for ESC_RC_DATA_ABT_EL[01]
754 1.12 christos #define ESR_ISS_DATAABORT_S1PTW __BIT(7) // for ESC_RC_DATA_ABT_EL[01]
755 1.12 christos #define ESR_ISS_DATAABORT_WnR __BIT(6) // for ESC_RC_DATA_ABT_EL[01]
756 1.12 christos #define ESR_ISS_DATAABORT_DFSC __BITS(0,5) // for ESC_RC_DATA_ABT_EL[01]
757 1.12 christos
758 1.14 skrll #define ESR_ISS_FSC_ADDRESS_SIZE_FAULT_0 0x00
759 1.14 skrll #define ESR_ISS_FSC_ADDRESS_SIZE_FAULT_1 0x01
760 1.14 skrll #define ESR_ISS_FSC_ADDRESS_SIZE_FAULT_2 0x02
761 1.14 skrll #define ESR_ISS_FSC_ADDRESS_SIZE_FAULT_3 0x03
762 1.14 skrll #define ESR_ISS_FSC_TRANSLATION_FAULT_0 0x04
763 1.14 skrll #define ESR_ISS_FSC_TRANSLATION_FAULT_1 0x05
764 1.14 skrll #define ESR_ISS_FSC_TRANSLATION_FAULT_2 0x06
765 1.14 skrll #define ESR_ISS_FSC_TRANSLATION_FAULT_3 0x07
766 1.14 skrll #define ESR_ISS_FSC_ACCESS_FAULT_0 0x08
767 1.14 skrll #define ESR_ISS_FSC_ACCESS_FAULT_1 0x09
768 1.14 skrll #define ESR_ISS_FSC_ACCESS_FAULT_2 0x0a
769 1.14 skrll #define ESR_ISS_FSC_ACCESS_FAULT_3 0x0b
770 1.14 skrll #define ESR_ISS_FSC_PERM_FAULT_0 0x0c
771 1.14 skrll #define ESR_ISS_FSC_PERM_FAULT_1 0x0d
772 1.14 skrll #define ESR_ISS_FSC_PERM_FAULT_2 0x0e
773 1.14 skrll #define ESR_ISS_FSC_PERM_FAULT_3 0x0f
774 1.14 skrll #define ESR_ISS_FSC_SYNC_EXTERNAL_ABORT 0x10
775 1.14 skrll #define ESR_ISS_FSC_SYNC_EXTERNAL_ABORT_TTWALK_0 0x14
776 1.14 skrll #define ESR_ISS_FSC_SYNC_EXTERNAL_ABORT_TTWALK_1 0x15
777 1.14 skrll #define ESR_ISS_FSC_SYNC_EXTERNAL_ABORT_TTWALK_2 0x16
778 1.14 skrll #define ESR_ISS_FSC_SYNC_EXTERNAL_ABORT_TTWALK_3 0x17
779 1.14 skrll #define ESR_ISS_FSC_SYNC_PARITY_ERROR 0x18
780 1.14 skrll #define ESR_ISS_FSC_SYNC_PARITY_ERROR_ON_TTWALK_0 0x1c
781 1.14 skrll #define ESR_ISS_FSC_SYNC_PARITY_ERROR_ON_TTWALK_1 0x1d
782 1.14 skrll #define ESR_ISS_FSC_SYNC_PARITY_ERROR_ON_TTWALK_2 0x1e
783 1.14 skrll #define ESR_ISS_FSC_SYNC_PARITY_ERROR_ON_TTWALK_3 0x1f
784 1.14 skrll #define ESR_ISS_FSC_ALIGNMENT_FAULT 0x21
785 1.14 skrll #define ESR_ISS_FSC_TLB_CONFLICT_FAULT 0x30
786 1.14 skrll #define ESR_ISS_FSC_LOCKDOWN_ABORT 0x34
787 1.14 skrll #define ESR_ISS_FSC_UNSUPPORTED_EXCLUSIVE 0x35
788 1.14 skrll #define ESR_ISS_FSC_FIRST_LEVEL_DOMAIN_FAULT 0x3d
789 1.14 skrll #define ESR_ISS_FSC_SECOND_LEVEL_DOMAIN_FAULT 0x3e
790 1.1 matt
791 1.1 matt
792 1.1 matt AARCH64REG_READ_INLINE(far_el1) // Fault Address Register
793 1.1 matt AARCH64REG_WRITE_INLINE(far_el1)
794 1.65 skrll AARCH64REG_READ_INLINE(far_el2)
795 1.65 skrll AARCH64REG_WRITE_INLINE(far_el2)
796 1.65 skrll
797 1.65 skrll AARCH64REG_READ_INLINE(hcr_el2) // Hypervisor Configuration Register
798 1.65 skrll AARCH64REG_WRITE_INLINE(hcr_el2)
799 1.65 skrll
800 1.65 skrll #define HCR_EL2_TWEDEL __BITS(63,60) // TWE Delay (FEAT_TWED)
801 1.65 skrll #define HCR_EL2_TWEDEN __BIT(59) // TWE Delay Enable (FEAT_TWED)
802 1.65 skrll #define HCR_EL2_TID5 __BIT(58) // Trap ID group 5 (FEAT_MTE2)
803 1.65 skrll #define HCR_EL2_DCT __BIT(57) // Default Cacheability Tagging (FEAT_MTE2)
804 1.65 skrll #define HCR_EL2_ATA __BIT(56) // Allocation Tag Access (FEAT_MTE2)
805 1.65 skrll #define HCR_EL2_TTLBOS __BIT(55) // Trap TLB maintenance OS (FEAT_EVT)
806 1.65 skrll #define HCR_EL2_TTLBIS __BIT(54) // Trap TLB maintenance IS (FEAT_EVT)
807 1.65 skrll #define HCR_EL2_ENSCXT __BIT(53) // Enable SCXTNUM_EL[01] access (FEAT_CSV2)
808 1.65 skrll #define HCR_EL2_TOCU __BIT(52) // Trap PoU cache maintenance
809 1.65 skrll #define HCR_EL2_AMVOFFEN __BIT(51) // Activity Monitors Virtual Offsets Enable (FEAT_AMUv1p1)
810 1.65 skrll #define HCR_EL2_TICAB __BIT(50) // Trap IC all broadcast maintenance.
811 1.65 skrll #define HCR_EL2_TID4 __BIT(49) // Trap ID group 4 (FEAT_EVT)
812 1.65 skrll #define HCR_EL2_GPF __BIT(48) // Granule Protection Faults (FEAT_RME)
813 1.65 skrll #define HCR_EL2_FIEN __BIT(47) // Fault Injection Enable (FEAT_RASv1p1)
814 1.65 skrll #define HCR_EL2_FWB __BIT(46) // Forced Write-Back (FEAT_S2FWB)
815 1.65 skrll #define HCR_EL2_NV2 __BIT(45) // Nested Virtualization (FEAT_NV2)
816 1.65 skrll #define HCR_EL2_AT __BIT(44) // Address Translation (FEAT_NV)
817 1.65 skrll #define HCR_EL2_NV1 __BIT(43) // Nested Virtualization (FEAT_NV2/FEAT_NV)
818 1.65 skrll #define HCR_EL2_NV __BIT(42) // Nested Virtualization (FEAT_NV2/FEAT_NV)
819 1.65 skrll #define HCR_EL2_API __BIT(41) // Pointer Authentication instruction (FEAT_PAuth)
820 1.65 skrll #define HCR_EL2_APK __BIT(40) // Pointer Authentication key (FEAT_PAuth)
821 1.65 skrll #define HCR_EL2_TME __BIT(39) // TME enable (FEAT_TME)
822 1.65 skrll #define HCR_EL2_MIOCNCE __BIT(38) // Mismatched Inner/Outer Cacheable Non-Coherency Enable,
823 1.65 skrll #define HCR_EL2_TEA __BIT(37) // Route synchronous External abort exceptions to EL2 (FEAT_RAS)
824 1.65 skrll #define HCR_EL2_TERR __BIT(36) // Trap accesses of Error Record registers (FEAT_RAS)
825 1.65 skrll #define HCR_EL2_TLOR __BIT(35) // Trap LOR registers (FEAT_LOR)
826 1.65 skrll #define HCR_EL2_VHE __BIT(34) // EL2 Host (FEAT_VHE)
827 1.65 skrll #define HCR_EL2_ID __BIT(33) // stage2 IC disable
828 1.65 skrll #define HCR_EL2_CD __BIT(32) // stage2 DC disable
829 1.65 skrll #define HCR_EL2_RW __BIT(31) // register width
830 1.65 skrll #define HCR_EL2_TRVM __BIT(30) // trap VM control regs read
831 1.65 skrll #define HCR_EL2_HCD __BIT(29) // HVC disable
832 1.65 skrll #define HCR_EL2_TDZ __BIT(28) // trap DC ZVA
833 1.65 skrll #define HCR_EL2_TGE __BIT(27) // trap general exceptions
834 1.65 skrll #define HCR_EL2_TVM __BIT(26) // trap VM control regs write
835 1.65 skrll #define HCR_EL2_TTLB __BIT(25) // trap TLB maintanance op
836 1.65 skrll #define HCR_EL2_TPU __BIT(24) // trap IC {IVAU,IALLU,IALLUIS},DC CVAU
837 1.65 skrll #define HCR_EL2_TPC __BIT(23) // trap DC {IVAC,CIVAC,CVAC}
838 1.65 skrll #define HCR_EL2_TSW __BIT(22) // trap DC {ISW,CSW,CISW}
839 1.65 skrll #define HCR_EL2_TACR __BIT(21) // trap ACTRL_EL1 access
840 1.65 skrll #define HCR_EL2_TIDCP __BIT(20) // trap IMPLEMENTATION DEFINED system regs
841 1.65 skrll #define HCR_EL2_TSC __BIT(19) // trap SMC
842 1.65 skrll #define HCR_EL2_TID3 __BIT(18) // trap ID group3 regs
843 1.65 skrll #define HCR_EL2_TID2 __BIT(17) // trap ID group2 regs
844 1.65 skrll #define HCR_EL2_TID1 __BIT(16) // trap ID group1 regs
845 1.65 skrll #define HCR_EL2_TID0 __BIT(15) // trap ID group0 regs
846 1.65 skrll #define HCR_EL2_TWE __BIT(14) // trap WFE
847 1.65 skrll #define HCR_EL2_TWI __BIT(13) // trap WFI
848 1.65 skrll #define HCR_EL2_DC __BIT(12) // default cacheablility
849 1.65 skrll #define HCR_EL2_BSU __BITS(11,10) // barrier shareability upgrade
850 1.65 skrll #define HCR_EL2_FB __BIT(9) // force broadcast TLBI and IC
851 1.65 skrll #define HCR_EL2_VSE __BIT(8) // inject Virtual SError
852 1.65 skrll #define HCR_EL2_VI __BIT(7) // inject Virtual IRQ
853 1.65 skrll #define HCR_EL2_VF __BIT(6) // inject Virtual FIQ
854 1.65 skrll #define HCR_EL2_AMO __BIT(5) // trap SError/AsyncAbort
855 1.65 skrll #define HCR_EL2_IMO __BIT(4) // trap IRQ
856 1.65 skrll #define HCR_EL2_FMO __BIT(3) // trap FIQ
857 1.65 skrll #define HCR_EL2_PTW __BIT(2) // Protect table walk
858 1.65 skrll #define HCR_EL2_SWIO __BIT(1) // override DC ISW to DC CISW
859 1.65 skrll #define HCR_EL2_VM __BIT(0) // enable stage2 translation
860 1.65 skrll
861 1.65 skrll AARCH64REG_READ_INLINE(hpfar_el2) // Hypervisor IPA Fault Address Register
862 1.65 skrll AARCH64REG_WRITE_INLINE(hpfar_el2)
863 1.65 skrll
864 1.65 skrll #define HPFAR_EL2_NS __BIT(63) // Faulting IPA address space (FEAT_SEL2)
865 1.65 skrll #define HPFAR_EL2_FIPA_D128 __BITS(47,4) // Faulting Intermediate Physical Address Bits [55:12]
866 1.65 skrll #define HPFAR_EL2_FIPA __BITS(43,4) // Faulting Intermediate Physical Address Bits [51:12]
867 1.65 skrll #define HPFAR_EL2_FIPA_BITSHIFT 12
868 1.65 skrll
869 1.65 skrll
870 1.65 skrll AARCH64REG_READ_INLINE(hstr_el2) // Hypervisor System Trap Register
871 1.65 skrll AARCH64REG_WRITE_INLINE(hstr_el2)
872 1.65 skrll
873 1.65 skrll #define HSTR_EL2_T15 __BIT(15)
874 1.65 skrll // __BIT(14) Res0
875 1.65 skrll #define HSTR_EL2_T13 __BIT(13)
876 1.65 skrll #define HSTR_EL2_T12 __BIT(12)
877 1.65 skrll #define HSTR_EL2_T11 __BIT(11)
878 1.65 skrll #define HSTR_EL2_T10 __BIT(10)
879 1.65 skrll #define HSTR_EL2_T9 __BIT(9)
880 1.65 skrll #define HSTR_EL2_T8 __BIT(8)
881 1.65 skrll #define HSTR_EL2_T7 __BIT(7)
882 1.65 skrll #define HSTR_EL2_T6 __BIT(6)
883 1.65 skrll #define HSTR_EL2_T5 __BIT(5)
884 1.65 skrll // __BIT(4) Res0
885 1.65 skrll #define HSTR_EL2_T3 __BIT(3)
886 1.65 skrll #define HSTR_EL2_T2 __BIT(2)
887 1.65 skrll #define HSTR_EL2_T1 __BIT(1)
888 1.65 skrll #define HSTR_EL2_T0 __BIT(0)
889 1.1 matt
890 1.9 ryo AARCH64REG_READ_INLINE2(l2ctlr_el1, s3_1_c11_c0_2) // Cortex-A53,57,72,73
891 1.9 ryo AARCH64REG_WRITE_INLINE2(l2ctlr_el1, s3_1_c11_c0_2) // Cortex-A53,57,72,73
892 1.9 ryo
893 1.12 christos #define L2CTLR_NUMOFCORE __BITS(25,24) // Number of cores
894 1.12 christos #define L2CTLR_CPUCACHEPROT __BIT(22) // CPU Cache Protection
895 1.12 christos #define L2CTLR_SCUL2CACHEPROT __BIT(21) // SCU-L2 Cache Protection
896 1.12 christos #define L2CTLR_L2_INPUT_LATENCY __BIT(5) // L2 Data RAM input latency
897 1.12 christos #define L2CTLR_L2_OUTPUT_LATENCY __BIT(0) // L2 Data RAM output latency
898 1.9 ryo
899 1.9 ryo AARCH64REG_READ_INLINE(mair_el1) // Memory Attribute Indirection Register
900 1.1 matt AARCH64REG_WRITE_INLINE(mair_el1)
901 1.65 skrll AARCH64REG_READ_INLINE(mair_el2)
902 1.65 skrll AARCH64REG_WRITE_INLINE(mair_el2)
903 1.65 skrll AARCH64REG_READ_INLINE(amair_el1) // Auxiliary MAIR
904 1.65 skrll AARCH64REG_WRITE_INLINE(amair_el1)
905 1.65 skrll AARCH64REG_READ_INLINE(amair_el2)
906 1.65 skrll AARCH64REG_WRITE_INLINE(amair_el2)
907 1.1 matt
908 1.14 skrll #define MAIR_ATTR0 __BITS(7,0)
909 1.14 skrll #define MAIR_ATTR1 __BITS(15,8)
910 1.14 skrll #define MAIR_ATTR2 __BITS(23,16)
911 1.14 skrll #define MAIR_ATTR3 __BITS(31,24)
912 1.14 skrll #define MAIR_ATTR4 __BITS(39,32)
913 1.14 skrll #define MAIR_ATTR5 __BITS(47,40)
914 1.14 skrll #define MAIR_ATTR6 __BITS(55,48)
915 1.14 skrll #define MAIR_ATTR7 __BITS(63,56)
916 1.14 skrll #define MAIR_DEVICE_nGnRnE 0x00 // NoGathering,NoReordering,NoEarlyWriteAck.
917 1.29 jmcneill #define MAIR_DEVICE_nGnRE 0x04 // NoGathering,NoReordering,EarlyWriteAck.
918 1.14 skrll #define MAIR_NORMAL_NC 0x44
919 1.14 skrll #define MAIR_NORMAL_WT 0xbb
920 1.14 skrll #define MAIR_NORMAL_WB 0xff
921 1.9 ryo
922 1.1 matt AARCH64REG_READ_INLINE(par_el1) // Physical Address Register
923 1.1 matt AARCH64REG_WRITE_INLINE(par_el1)
924 1.1 matt
925 1.14 skrll #define PAR_ATTR __BITS(63,56) // F=0 memory attributes
926 1.36 ryo #define PAR_PA __BITS(51,12) // F=0 physical address
927 1.36 ryo #define PAR_PA_SHIFT 12
928 1.65 skrll #define PAR_PA_LOWMASK __BITS(11,0)
929 1.14 skrll #define PAR_NS __BIT(9) // F=0 non-secure
930 1.61 skrll #define PAR_SH __BITS(8,7) // F=0 shareability attribute
931 1.61 skrll #define PAR_SH_NONE 0
932 1.61 skrll #define PAR_SH_OUTER 2
933 1.61 skrll #define PAR_SH_INNER 3
934 1.61 skrll
935 1.14 skrll #define PAR_S __BIT(9) // F=1 failure stage
936 1.14 skrll #define PAR_PTW __BIT(8) // F=1 partial table walk
937 1.14 skrll #define PAR_FST __BITS(6,1) // F=1 fault status code
938 1.14 skrll #define PAR_F __BIT(0) // translation failed
939 1.1 matt
940 1.1 matt AARCH64REG_READ_INLINE(rmr_el1) // Reset Management Register
941 1.1 matt AARCH64REG_WRITE_INLINE(rmr_el1)
942 1.1 matt
943 1.1 matt AARCH64REG_READ_INLINE(rvbar_el1) // Reset Vector Base Address Register
944 1.1 matt AARCH64REG_WRITE_INLINE(rvbar_el1)
945 1.1 matt
946 1.65 skrll AARCH64REG_ATWRITE_INLINE(s1e0r) // Address Translate Stages 1 EL0
947 1.65 skrll AARCH64REG_ATWRITE_INLINE(s1e0w)
948 1.65 skrll AARCH64REG_ATWRITE_INLINE(s1e1r) // Address Translate Stages 1 EL1
949 1.65 skrll AARCH64REG_ATWRITE_INLINE(s1e1w)
950 1.65 skrll AARCH64REG_ATWRITE_INLINE(s12e0r) // Address Translate Stages 1 and 2 EL0
951 1.65 skrll AARCH64REG_ATWRITE_INLINE(s12e0w)
952 1.65 skrll AARCH64REG_ATWRITE_INLINE(s12e1r) // Address Translate Stages 1 and 2 EL1
953 1.65 skrll AARCH64REG_ATWRITE_INLINE(s12e1w)
954 1.24 ryo
955 1.2 skrll AARCH64REG_READ_INLINE(sctlr_el1) // System Control Register
956 1.2 skrll AARCH64REG_WRITE_INLINE(sctlr_el1)
957 1.65 skrll AARCH64REG_READ_INLINE(sctlr_el2)
958 1.65 skrll AARCH64REG_WRITE_INLINE(sctlr_el2)
959 1.1 matt
960 1.14 skrll #define SCTLR_RES0 0xc8222400 // Reserved ARMv8.0, write 0
961 1.14 skrll #define SCTLR_RES1 0x30d00800 // Reserved ARMv8.0, write 1
962 1.14 skrll #define SCTLR_M __BIT(0)
963 1.14 skrll #define SCTLR_A __BIT(1)
964 1.14 skrll #define SCTLR_C __BIT(2)
965 1.14 skrll #define SCTLR_SA __BIT(3)
966 1.14 skrll #define SCTLR_SA0 __BIT(4)
967 1.14 skrll #define SCTLR_CP15BEN __BIT(5)
968 1.32 maxv #define SCTLR_nAA __BIT(6)
969 1.14 skrll #define SCTLR_ITD __BIT(7)
970 1.14 skrll #define SCTLR_SED __BIT(8)
971 1.14 skrll #define SCTLR_UMA __BIT(9)
972 1.34 maxv #define SCTLR_EnRCTX __BIT(10)
973 1.34 maxv #define SCTLR_EOS __BIT(11)
974 1.14 skrll #define SCTLR_I __BIT(12)
975 1.34 maxv #define SCTLR_EnDB __BIT(13)
976 1.14 skrll #define SCTLR_DZE __BIT(14)
977 1.14 skrll #define SCTLR_UCT __BIT(15)
978 1.14 skrll #define SCTLR_nTWI __BIT(16)
979 1.14 skrll #define SCTLR_nTWE __BIT(18)
980 1.14 skrll #define SCTLR_WXN __BIT(19)
981 1.34 maxv #define SCTLR_TSCXT __BIT(20)
982 1.14 skrll #define SCTLR_IESB __BIT(21)
983 1.34 maxv #define SCTLR_EIS __BIT(22)
984 1.14 skrll #define SCTLR_SPAN __BIT(23)
985 1.53 ryo #define SCTLR_E0E __BIT(24)
986 1.14 skrll #define SCTLR_EE __BIT(25)
987 1.14 skrll #define SCTLR_UCI __BIT(26)
988 1.34 maxv #define SCTLR_EnDA __BIT(27)
989 1.14 skrll #define SCTLR_nTLSMD __BIT(28)
990 1.14 skrll #define SCTLR_LSMAOE __BIT(29)
991 1.34 maxv #define SCTLR_EnIB __BIT(30)
992 1.34 maxv #define SCTLR_EnIA __BIT(31)
993 1.34 maxv #define SCTLR_BT0 __BIT(35)
994 1.34 maxv #define SCTLR_BT1 __BIT(36)
995 1.34 maxv #define SCTLR_ITFSB __BIT(37)
996 1.34 maxv #define SCTLR_TCF0 __BITS(39,38)
997 1.34 maxv #define SCTLR_TCF __BITS(41,40)
998 1.34 maxv #define SCTLR_ATA0 __BIT(42)
999 1.34 maxv #define SCTLR_ATA __BIT(43)
1000 1.34 maxv #define SCTLR_DSSBS __BIT(44)
1001 1.9 ryo
1002 1.9 ryo // current EL stack pointer
1003 1.12 christos static __inline uint64_t
1004 1.9 ryo reg_sp_read(void)
1005 1.9 ryo {
1006 1.9 ryo uint64_t __rv;
1007 1.9 ryo __asm __volatile ("mov %0, sp" : "=r"(__rv));
1008 1.9 ryo return __rv;
1009 1.9 ryo }
1010 1.9 ryo
1011 1.9 ryo AARCH64REG_READ_INLINE(sp_el0) // EL0 Stack Pointer
1012 1.1 matt AARCH64REG_WRITE_INLINE(sp_el0)
1013 1.65 skrll AARCH64REG_READ_INLINE(sp_el1) // EL1 Stack Pointer
1014 1.65 skrll AARCH64REG_WRITE_INLINE(sp_el1)
1015 1.1 matt
1016 1.9 ryo AARCH64REG_READ_INLINE(spsel) // Stack Pointer Select
1017 1.9 ryo AARCH64REG_WRITE_INLINE(spsel)
1018 1.1 matt
1019 1.14 skrll #define SPSEL_SP __BIT(0); // use SP_EL0 at all exception levels
1020 1.1 matt
1021 1.1 matt AARCH64REG_READ_INLINE(spsr_el1) // Saved Program Status Register
1022 1.1 matt AARCH64REG_WRITE_INLINE(spsr_el1)
1023 1.1 matt
1024 1.14 skrll #define SPSR_NZCV __BITS(31,28) // mask of N Z C V
1025 1.14 skrll #define SPSR_N __BIT(31) // Negative
1026 1.14 skrll #define SPSR_Z __BIT(30) // Zero
1027 1.14 skrll #define SPSR_C __BIT(29) // Carry
1028 1.14 skrll #define SPSR_V __BIT(28) // oVerflow
1029 1.14 skrll #define SPSR_A32_Q __BIT(27) // A32: Overflow
1030 1.32 maxv #define SPSR_A32_IT1 __BIT(26) // A32: IT[1]
1031 1.32 maxv #define SPSR_A32_IT0 __BIT(25) // A32: IT[0]
1032 1.52 maxv #define SPSR_PAN __BIT(22) // Privileged Access Never
1033 1.14 skrll #define SPSR_SS __BIT(21) // Software Step
1034 1.22 ryo #define SPSR_SS_SHIFT 21
1035 1.14 skrll #define SPSR_IL __BIT(20) // Instruction Length
1036 1.14 skrll #define SPSR_GE __BITS(19,16) // A32: SIMD GE
1037 1.14 skrll #define SPSR_IT7 __BIT(15) // A32: IT[7]
1038 1.14 skrll #define SPSR_IT6 __BIT(14) // A32: IT[6]
1039 1.14 skrll #define SPSR_IT5 __BIT(13) // A32: IT[5]
1040 1.14 skrll #define SPSR_IT4 __BIT(12) // A32: IT[4]
1041 1.14 skrll #define SPSR_IT3 __BIT(11) // A32: IT[3]
1042 1.14 skrll #define SPSR_IT2 __BIT(10) // A32: IT[2]
1043 1.44 ryo #define SPSR_A64_BTYPE __BITS(11,10) // A64: BTYPE
1044 1.14 skrll #define SPSR_A64_D __BIT(9) // A64: Debug Exception Mask
1045 1.14 skrll #define SPSR_A32_E __BIT(9) // A32: BE Endian Mode
1046 1.14 skrll #define SPSR_A __BIT(8) // Async abort (SError) Mask
1047 1.14 skrll #define SPSR_I __BIT(7) // IRQ Mask
1048 1.14 skrll #define SPSR_F __BIT(6) // FIQ Mask
1049 1.14 skrll #define SPSR_A32_T __BIT(5) // A32 Thumb Mode
1050 1.19 ryo #define SPSR_A32 __BIT(4) // A32 Mode (a part of SPSR_M)
1051 1.14 skrll #define SPSR_M __BITS(4,0) // Execution State
1052 1.14 skrll #define SPSR_M_EL3H 0x0d
1053 1.14 skrll #define SPSR_M_EL3T 0x0c
1054 1.14 skrll #define SPSR_M_EL2H 0x09
1055 1.14 skrll #define SPSR_M_EL2T 0x08
1056 1.14 skrll #define SPSR_M_EL1H 0x05
1057 1.14 skrll #define SPSR_M_EL1T 0x04
1058 1.14 skrll #define SPSR_M_EL0T 0x00
1059 1.14 skrll #define SPSR_M_SYS32 0x1f
1060 1.14 skrll #define SPSR_M_UND32 0x1b
1061 1.14 skrll #define SPSR_M_ABT32 0x17
1062 1.14 skrll #define SPSR_M_SVC32 0x13
1063 1.14 skrll #define SPSR_M_IRQ32 0x12
1064 1.14 skrll #define SPSR_M_FIQ32 0x11
1065 1.14 skrll #define SPSR_M_USR32 0x10
1066 1.1 matt
1067 1.65 skrll #define SPSR_USER_P(spsr) (((spsr) & (SPSR_M & ~SPSR_A32)) == 0)
1068 1.65 skrll #define SPSR_PRIVILEGED_P(spsr) (!SPSR_USER_P((spsr)))
1069 1.65 skrll
1070 1.1 matt AARCH64REG_READ_INLINE(tcr_el1) // Translation Control Register
1071 1.1 matt AARCH64REG_WRITE_INLINE(tcr_el1)
1072 1.1 matt
1073 1.27 skrll /* TCR_EL1 - Translation Control Register */
1074 1.47 ryo #define TCR_TCMA1 __BIT(58) /* ARMv8.5-MemTag control when ADDR[59:55] = 0b11111 */
1075 1.47 ryo #define TCR_TCMA0 __BIT(57) /* ARMv8.5-MemTag control when ADDR[59:55] = 0b00000 */
1076 1.47 ryo #define TCR_E0PD1 __BIT(56) /* ARMv8.5-E0PD Faulting control for EL0 by TTBR1 */
1077 1.47 ryo #define TCR_E0PD0 __BIT(55) /* ARMv8.5-E0PD Faulting control for EL0 by TTBR0 */
1078 1.47 ryo #define TCR_NFD1 __BIT(54) /* SVE Non-fault translation table walk disable (TTBR1) */
1079 1.47 ryo #define TCR_NFD0 __BIT(53) /* SVE Non-fault translation table walk disable (TTBR0) */
1080 1.47 ryo #define TCR_TBID1 __BIT(52) /* ARMv8.3-PAuth TBI for instruction addr (TTBR1) */
1081 1.47 ryo #define TCR_TBID0 __BIT(51) /* ARMv8.3-PAuth TBI for instruction addr (TTBR0) */
1082 1.47 ryo #define TCR_HWU162 __BIT(50) /* ARMv8.1-TTPBHA bit[62] of PTE (TTBR1) */
1083 1.47 ryo #define TCR_HWU161 __BIT(49) /* ARMv8.1-TTPBHA bit[61] of PTE (TTBR1) */
1084 1.47 ryo #define TCR_HWU160 __BIT(48) /* ARMv8.1-TTPBHA bit[60] of PTE (TTBR1) */
1085 1.47 ryo #define TCR_HWU159 __BIT(47) /* ARMv8.1-TTPBHA bit[59] of PTE (TTBR1) */
1086 1.47 ryo #define TCR_HWU062 __BIT(46) /* ARMv8.1-TTPBHA bit[62] of PTE (TTBR0) */
1087 1.47 ryo #define TCR_HWU061 __BIT(45) /* ARMv8.1-TTPBHA bit[61] of PTE (TTBR0) */
1088 1.47 ryo #define TCR_HWU060 __BIT(44) /* ARMv8.1-TTPBHA bit[60] of PTE (TTBR0) */
1089 1.47 ryo #define TCR_HWU059 __BIT(43) /* ARMv8.1-TTPBHA bit[59] of PTE (TTBR0) */
1090 1.47 ryo #define TCR_HPD1 __BIT(42) /* ARMv8.1-HPD Hierarchical Permission (TTBR1) */
1091 1.47 ryo #define TCR_HPD0 __BIT(41) /* ARMv8.1-HPD Hierarchical Permission (TTBR0) */
1092 1.47 ryo #define TCR_HD __BIT(40) /* ARMv8.1-TTHM Hardware Dirty flag */
1093 1.47 ryo #define TCR_HA __BIT(39) /* ARMv8.1-TTHM Hardware Access flag */
1094 1.27 skrll #define TCR_TBI1 __BIT(38) /* ignore Top Byte TTBR1_EL1 */
1095 1.27 skrll #define TCR_TBI0 __BIT(37) /* ignore Top Byte TTBR0_EL1 */
1096 1.27 skrll #define TCR_AS64K __BIT(36) /* Use 64K ASIDs */
1097 1.27 skrll #define TCR_IPS __BITS(34,32) /* Intermediate PhysAdr Size */
1098 1.27 skrll #define TCR_IPS_4PB __SHIFTIN(6,TCR_IPS) /* 52 bits ( 4 PB) */
1099 1.27 skrll #define TCR_IPS_256TB __SHIFTIN(5,TCR_IPS) /* 48 bits (256 TB) */
1100 1.27 skrll #define TCR_IPS_16TB __SHIFTIN(4,TCR_IPS) /* 44 bits (16 TB) */
1101 1.27 skrll #define TCR_IPS_4TB __SHIFTIN(3,TCR_IPS) /* 42 bits ( 4 TB) */
1102 1.27 skrll #define TCR_IPS_1TB __SHIFTIN(2,TCR_IPS) /* 40 bits ( 1 TB) */
1103 1.27 skrll #define TCR_IPS_64GB __SHIFTIN(1,TCR_IPS) /* 36 bits (64 GB) */
1104 1.27 skrll #define TCR_IPS_4GB __SHIFTIN(0,TCR_IPS) /* 32 bits (4 GB) */
1105 1.27 skrll #define TCR_TG1 __BITS(31,30) /* TTBR1 Page Granule Size */
1106 1.27 skrll #define TCR_TG1_16KB __SHIFTIN(1,TCR_TG1) /* 16KB page size */
1107 1.27 skrll #define TCR_TG1_4KB __SHIFTIN(2,TCR_TG1) /* 4KB page size */
1108 1.27 skrll #define TCR_TG1_64KB __SHIFTIN(3,TCR_TG1) /* 64KB page size */
1109 1.27 skrll #define TCR_SH1 __BITS(29,28)
1110 1.27 skrll #define TCR_SH1_NONE __SHIFTIN(0,TCR_SH1)
1111 1.27 skrll #define TCR_SH1_OUTER __SHIFTIN(2,TCR_SH1)
1112 1.27 skrll #define TCR_SH1_INNER __SHIFTIN(3,TCR_SH1)
1113 1.27 skrll #define TCR_ORGN1 __BITS(27,26) /* TTBR1 Outer cacheability */
1114 1.27 skrll #define TCR_ORGN1_NC __SHIFTIN(0,TCR_ORGN1) /* Non Cacheable */
1115 1.27 skrll #define TCR_ORGN1_WB_WA __SHIFTIN(1,TCR_ORGN1) /* WriteBack WriteAllocate */
1116 1.27 skrll #define TCR_ORGN1_WT __SHIFTIN(2,TCR_ORGN1) /* WriteThrough */
1117 1.27 skrll #define TCR_ORGN1_WB __SHIFTIN(3,TCR_ORGN1) /* WriteBack */
1118 1.27 skrll #define TCR_IRGN1 __BITS(25,24) /* TTBR1 Inner cacheability */
1119 1.27 skrll #define TCR_IRGN1_NC __SHIFTIN(0,TCR_IRGN1) /* Non Cacheable */
1120 1.27 skrll #define TCR_IRGN1_WB_WA __SHIFTIN(1,TCR_IRGN1) /* WriteBack WriteAllocate */
1121 1.27 skrll #define TCR_IRGN1_WT __SHIFTIN(2,TCR_IRGN1) /* WriteThrough */
1122 1.27 skrll #define TCR_IRGN1_WB __SHIFTIN(3,TCR_IRGN1) /* WriteBack */
1123 1.27 skrll #define TCR_EPD1 __BIT(23) /* Walk Disable for TTBR1_EL1 */
1124 1.27 skrll #define TCR_A1 __BIT(22) /* ASID is in TTBR1_EL1 */
1125 1.27 skrll #define TCR_T1SZ __BITS(21,16) /* Size offset for TTBR1_EL1 */
1126 1.27 skrll #define TCR_TG0 __BITS(15,14) /* TTBR0 Page Granule Size */
1127 1.27 skrll #define TCR_TG0_4KB __SHIFTIN(0,TCR_TG0) /* 4KB page size */
1128 1.27 skrll #define TCR_TG0_64KB __SHIFTIN(1,TCR_TG0) /* 64KB page size */
1129 1.27 skrll #define TCR_TG0_16KB __SHIFTIN(2,TCR_TG0) /* 16KB page size */
1130 1.27 skrll #define TCR_SH0 __BITS(13,12)
1131 1.27 skrll #define TCR_SH0_NONE __SHIFTIN(0,TCR_SH0)
1132 1.27 skrll #define TCR_SH0_OUTER __SHIFTIN(2,TCR_SH0)
1133 1.27 skrll #define TCR_SH0_INNER __SHIFTIN(3,TCR_SH0)
1134 1.27 skrll #define TCR_ORGN0 __BITS(11,10) /* TTBR0 Outer cacheability */
1135 1.27 skrll #define TCR_ORGN0_NC __SHIFTIN(0,TCR_ORGN0) /* Non Cacheable */
1136 1.27 skrll #define TCR_ORGN0_WB_WA __SHIFTIN(1,TCR_ORGN0) /* WriteBack WriteAllocate */
1137 1.27 skrll #define TCR_ORGN0_WT __SHIFTIN(2,TCR_ORGN0) /* WriteThrough */
1138 1.27 skrll #define TCR_ORGN0_WB __SHIFTIN(3,TCR_ORGN0) /* WriteBack */
1139 1.27 skrll #define TCR_IRGN0 __BITS(9,8) /* TTBR0 Inner cacheability */
1140 1.27 skrll #define TCR_IRGN0_NC __SHIFTIN(0,TCR_IRGN0) /* Non Cacheable */
1141 1.27 skrll #define TCR_IRGN0_WB_WA __SHIFTIN(1,TCR_IRGN0) /* WriteBack WriteAllocate */
1142 1.27 skrll #define TCR_IRGN0_WT __SHIFTIN(2,TCR_IRGN0) /* WriteThrough */
1143 1.27 skrll #define TCR_IRGN0_WB __SHIFTIN(3,TCR_IRGN0) /* WriteBack */
1144 1.27 skrll #define TCR_EPD0 __BIT(7) /* Walk Disable for TTBR0 */
1145 1.27 skrll #define TCR_T0SZ __BITS(5,0) /* Size offset for TTBR0_EL1 */
1146 1.1 matt
1147 1.65 skrll AARCH64REG_READ_INLINE(tcr_el2) // Translation Control Register EL2
1148 1.65 skrll AARCH64REG_WRITE_INLINE(tcr_el2)
1149 1.65 skrll
1150 1.65 skrll /* TCR_EL2 - Translation Control Register */
1151 1.65 skrll // __BITS(63, 34) // Res0
1152 1.65 skrll #define TCR_EL2_MTX __BIT(33) // Extended memory tag checking
1153 1.65 skrll #define TCR_EL2_DS __BIT(32) // 52-bit output address (FEAT_LPA2)
1154 1.65 skrll // __BIT(31) // Res1
1155 1.65 skrll #define TCR_EL2_TCMA __BIT(30) // Unchecked accesses control (FEAT_MTE2)
1156 1.65 skrll #define TCR_EL2_TBID __BIT(29) // Top Byte Instruction ddress matching (FEAT_PAuth)
1157 1.65 skrll #define TCR_EL2_HWU62 __BIT(28) // Hardware use bit 62 (FEAT_HPDS2)
1158 1.65 skrll #define TCR_EL2_HWU61 __BIT(27) // Hardware use bit 61 (FEAT_HPDS2)
1159 1.65 skrll #define TCR_EL2_HWU60 __BIT(26) // Hardware use bit 60 (FEAT_HPDS2)
1160 1.65 skrll #define TCR_EL2_HWU59 __BIT(25) // Hardware use bit 59 (FEAT_HPDS2)
1161 1.65 skrll #define TCR_EL2_HPD __BIT(24) // Hierarchical Permission Disables (FEAT_HPDS)
1162 1.65 skrll // __BIT(23) // Res1
1163 1.65 skrll #define TCR_EL2_HD __BIT(22) // Hardware management of dirty state (FEAT_HAFDBS)
1164 1.65 skrll #define TCR_EL2_HA __BIT(21) // Hardware Access flag update (FEAT_HAFDBS)
1165 1.65 skrll #define TCR_EL2_TBI __BIT(20) // Top Byte Ignored
1166 1.65 skrll // __BIT(19) // Res1
1167 1.65 skrll #define TCR_EL2_PS __BITS(18,16) // Physical Address Size
1168 1.65 skrll #define TCR_EL2_TG0 __BITS(15,14) // TTBR0_EL2 Granule size
1169 1.65 skrll #define TCR_EL2_TG0_4KB __SHIFTIN(0,TCR_EL2_TG0) // 4KB page size
1170 1.65 skrll #define TCR_EL2_TG0_64KB __SHIFTIN(1,TCR_EL2_TG0) // 64KB page size
1171 1.65 skrll #define TCR_EL2_TG0_16KB __SHIFTIN(2,TCR_EL2_TG0) // 16KB page size
1172 1.65 skrll #define TCR_EL2_SH0 __BITS(13,12) // TTBR0_EL2 Shareability attribute
1173 1.65 skrll #define TCR_EL2_SH0_NONE __SHIFTIN(0,TCR_EL2_SH0) // non-shareable
1174 1.65 skrll #define TCR_EL2_SH0_OUTER __SHIFTIN(2,TCR_EL2_SH0) // Outer shareable
1175 1.65 skrll #define TCR_EL2_SH0_INNER __SHIFTIN(3,TCR_EL2_SH0) // Inner shareable
1176 1.65 skrll #define TCR_EL2_ORGN0 __BITS(11,10) // TTBR0_EL2 Outer cacheability attribute
1177 1.65 skrll #define TCR_EL2_ORGN0_NC __SHIFTIN(0,TCR_EL2_ORGN0) // Non Cacheable
1178 1.65 skrll #define TCR_EL2_ORGN0_WB_WA __SHIFTIN(1,TCR_EL2_ORGN0) // WriteBack WriteAllocate
1179 1.65 skrll #define TCR_EL2_ORGN0_WT __SHIFTIN(2,TCR_EL2_ORGN0) // WriteThrough
1180 1.65 skrll #define TCR_EL2_ORGN0_WB __SHIFTIN(3,TCR_EL2_ORGN0) // WriteBack
1181 1.65 skrll #define TCR_EL2_IRGN0 __BITS(9,8) // TTBR0_EL2 Inner cacheability attribute
1182 1.65 skrll #define TCR_EL2_IRGN0_NC __SHIFTIN(0,TCR_EL2_IRGN0) // Non Cacheable
1183 1.65 skrll #define TCR_EL2_IRGN0_WB_WA __SHIFTIN(1,TCR_EL2_IRGN0) // WriteBack WriteAllocate
1184 1.65 skrll #define TCR_EL2_IRGN0_WT __SHIFTIN(2,TCR_EL2_IRGN0) // WriteThrough
1185 1.65 skrll #define TCR_EL2_IRGN0_WB __SHIFTIN(3,TCR_EL2_IRGN0) // WriteBack
1186 1.65 skrll #define TCR_EL2_T0SZ __BITS(5,0) // TTBR0_EL2 Size offset
1187 1.65 skrll
1188 1.1 matt AARCH64REG_READ_INLINE(tpidr_el1) // Thread ID Register (EL1)
1189 1.1 matt AARCH64REG_WRITE_INLINE(tpidr_el1)
1190 1.65 skrll AARCH64REG_READ_INLINE(tpidr_el2) // Thread ID Register (EL2)
1191 1.65 skrll AARCH64REG_WRITE_INLINE(tpidr_el2)
1192 1.1 matt
1193 1.1 matt AARCH64REG_WRITE_INLINE(tpidrro_el0) // Thread ID Register (RO for EL0)
1194 1.1 matt
1195 1.65 skrll AARCH64REG_READ_INLINE(ttbr0_el1) // Translation Table Base Register 0 EL1
1196 1.1 matt AARCH64REG_WRITE_INLINE(ttbr0_el1)
1197 1.65 skrll AARCH64REG_READ_INLINE(ttbr0_el2) // Translation Table Base Register 0 EL2
1198 1.65 skrll AARCH64REG_WRITE_INLINE(ttbr0_el2)
1199 1.1 matt
1200 1.65 skrll AARCH64REG_READ_INLINE(ttbr1_el1) // Translation Table Base Register 1 EL1
1201 1.1 matt AARCH64REG_WRITE_INLINE(ttbr1_el1)
1202 1.1 matt
1203 1.27 skrll #define TTBR_ASID __BITS(63,48)
1204 1.27 skrll #define TTBR_BADDR __BITS(47,0)
1205 1.27 skrll
1206 1.1 matt AARCH64REG_READ_INLINE(vbar_el1) // Vector Base Address Register
1207 1.1 matt AARCH64REG_WRITE_INLINE(vbar_el1)
1208 1.65 skrll AARCH64REG_READ_INLINE(vbar_el2)
1209 1.65 skrll AARCH64REG_WRITE_INLINE(vbar_el2)
1210 1.65 skrll
1211 1.65 skrll AARCH64REG_READ_INLINE(vpidr_el2) // Virtualization Processor ID Register
1212 1.65 skrll AARCH64REG_WRITE_INLINE(vpidr_el2)
1213 1.65 skrll AARCH64REG_READ_INLINE(vmpidr_el2) // Virtualization Multiprocessor ID Register
1214 1.65 skrll AARCH64REG_WRITE_INLINE(vmpidr_el2)
1215 1.65 skrll AARCH64REG_READ_INLINE(vtcr_el2) // Virtualization Translation Control Register
1216 1.65 skrll AARCH64REG_WRITE_INLINE(vtcr_el2)
1217 1.65 skrll
1218 1.65 skrll #define VTCR_EL2_HAFT __BIT(44) // Hardware managed Access Flag (FEAT_HAFT)
1219 1.65 skrll // __BITS(43, 42) // Res0
1220 1.65 skrll #define VTCR_EL2_TL0 __BIT(41) // TopLevel0 permission attribute control (FEAT_THE)
1221 1.65 skrll #define VTCR_EL2_GCSH __BIT(40) // Assured translations for guarded control stacks (FEAT_THE+FEAT_GCS)
1222 1.65 skrll // __BIT(39) // Res0
1223 1.65 skrll #define VTCR_EL2_D128 __BIT(38) // VMSAv9-128 (FEAT_D128)
1224 1.65 skrll #define VTCR_EL2_S2POE __BIT(37) // Enable stage 2 Permission Overlay (FEAT_S2POE)
1225 1.65 skrll #define VTCR_EL2_S2PIE __BIT(36) // Select Permission Model. (FEAT_S2PIE)
1226 1.65 skrll #define VTCR_EL2_TL1 __BIT(35) // TopLevel1 permission attribute control (FEAT_THE)
1227 1.65 skrll #define VTCR_EL2_AO __BIT(34) // AssuredOnly attribute enable (FEAT_THE)
1228 1.65 skrll #define VTCR_EL2_SL2 __BIT(33) // Stage 2 starting level (FEAT_LPA2)
1229 1.65 skrll #define VTCR_EL2_DS __BIT(32) // 52-bit output address (FEAT_LPA2)
1230 1.65 skrll // __BIT(31) // Res1
1231 1.65 skrll #define VTCR_EL2_NSA __BIT(30) // Non-secure S2 translation output address space (FEAT_SEL2)
1232 1.65 skrll #define VTCR_EL2_NSW __BIT(29) // Non-secure S2 translation table address space (FEAT_SEL2)
1233 1.65 skrll #define VTCR_EL2_HWU62 __BIT(28) // Hardware use bit 62 (FEAT_HPDS2)
1234 1.65 skrll #define VTCR_EL2_HWU61 __BIT(27) // Hardware use bit 61 (FEAT_HPDS2)
1235 1.65 skrll #define VTCR_EL2_HWU60 __BIT(26) // Hardware use bit 60 (FEAT_HPDS2)
1236 1.65 skrll #define VTCR_EL2_HWU59 __BIT(25) // Hardware use bit 59 (FEAT_HPDS2)
1237 1.65 skrll // __BITS(24, 23) // Res0
1238 1.65 skrll #define VTCR_EL2_HD __BIT(22) // Hardware Dirty state management (FEAT_HAFDBS)
1239 1.65 skrll #define VTCR_EL2_HA __BIT(21) // Hardware Access flag management (FEAT_HAFDBS)
1240 1.65 skrll #define VTCR_EL2_VS __BIT(19) // VMID size (FEAT_VMID16)
1241 1.65 skrll #define VTCR_EL2_PS __BITS(18,16) // Physical address Size
1242 1.65 skrll #define VTCR_EL2_TG0 __BITS(15,14) // VTTBR_EL2 Granule size
1243 1.65 skrll #define VTCR_EL2_SH0 __BITS(13,12) // V{,S}TTBR_EL2 shareability attribute
1244 1.65 skrll #define VTCR_EL2_ORGN0 __BITS(11,10) // V{,S}TTBR_EL2 outer cacheability
1245 1.65 skrll #define VTCR_EL2_IRGN0 __BITS(9,8) // V{,S}TTBR_EL2 inner cacheability
1246 1.65 skrll #define VTCR_EL2_SL0 __BITS(7,6) // Start Level of S2 translation lookup.
1247 1.65 skrll #define VTCR_EL2_T0SZ __BITS(5,0) // VTTBR_EL2 Size offset
1248 1.65 skrll
1249 1.65 skrll
1250 1.65 skrll AARCH64REG_READ_INLINE(vttbr_el2) // Virtualization Translation Table Base Register
1251 1.65 skrll AARCH64REG_WRITE_INLINE(vttbr_el2)
1252 1.65 skrll
1253 1.65 skrll #define VTTBR_VIMD __BITS(55,48)
1254 1.65 skrll #define VTTBR_BADDR __BITS(47,0)
1255 1.1 matt
1256 1.9 ryo /*
1257 1.9 ryo * From here on, these are DEBUG registers
1258 1.9 ryo */
1259 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr0_el1) // Debug Breakpoint Control Register 0
1260 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr0_el1)
1261 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr1_el1) // Debug Breakpoint Control Register 1
1262 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr1_el1)
1263 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr2_el1) // Debug Breakpoint Control Register 2
1264 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr2_el1)
1265 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr3_el1) // Debug Breakpoint Control Register 3
1266 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr3_el1)
1267 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr4_el1) // Debug Breakpoint Control Register 4
1268 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr4_el1)
1269 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr5_el1) // Debug Breakpoint Control Register 5
1270 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr5_el1)
1271 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr6_el1) // Debug Breakpoint Control Register 6
1272 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr6_el1)
1273 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr7_el1) // Debug Breakpoint Control Register 7
1274 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr7_el1)
1275 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr8_el1) // Debug Breakpoint Control Register 8
1276 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr8_el1)
1277 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr9_el1) // Debug Breakpoint Control Register 9
1278 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr9_el1)
1279 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr10_el1) // Debug Breakpoint Control Register 10
1280 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr10_el1)
1281 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr11_el1) // Debug Breakpoint Control Register 11
1282 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr11_el1)
1283 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr12_el1) // Debug Breakpoint Control Register 12
1284 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr12_el1)
1285 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr13_el1) // Debug Breakpoint Control Register 13
1286 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr13_el1)
1287 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr14_el1) // Debug Breakpoint Control Register 14
1288 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr14_el1)
1289 1.9 ryo AARCH64REG_READ_INLINE(dbgbcr15_el1) // Debug Breakpoint Control Register 15
1290 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbcr15_el1)
1291 1.9 ryo
1292 1.14 skrll #define DBGBCR_BT __BITS(23,20)
1293 1.14 skrll #define DBGBCR_LBN __BITS(19,16)
1294 1.14 skrll #define DBGBCR_SSC __BITS(15,14)
1295 1.14 skrll #define DBGBCR_HMC __BIT(13)
1296 1.14 skrll #define DBGBCR_BAS __BITS(8,5)
1297 1.14 skrll #define DBGBCR_PMC __BITS(2,1)
1298 1.14 skrll #define DBGBCR_E __BIT(0)
1299 1.9 ryo
1300 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr0_el1) // Debug Breakpoint Value Register 0
1301 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr0_el1)
1302 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr1_el1) // Debug Breakpoint Value Register 1
1303 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr1_el1)
1304 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr2_el1) // Debug Breakpoint Value Register 2
1305 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr2_el1)
1306 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr3_el1) // Debug Breakpoint Value Register 3
1307 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr3_el1)
1308 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr4_el1) // Debug Breakpoint Value Register 4
1309 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr4_el1)
1310 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr5_el1) // Debug Breakpoint Value Register 5
1311 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr5_el1)
1312 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr6_el1) // Debug Breakpoint Value Register 6
1313 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr6_el1)
1314 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr7_el1) // Debug Breakpoint Value Register 7
1315 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr7_el1)
1316 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr8_el1) // Debug Breakpoint Value Register 8
1317 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr8_el1)
1318 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr9_el1) // Debug Breakpoint Value Register 9
1319 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr9_el1)
1320 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr10_el1) // Debug Breakpoint Value Register 10
1321 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr10_el1)
1322 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr11_el1) // Debug Breakpoint Value Register 11
1323 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr11_el1)
1324 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr12_el1) // Debug Breakpoint Value Register 12
1325 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr12_el1)
1326 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr13_el1) // Debug Breakpoint Value Register 13
1327 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr13_el1)
1328 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr14_el1) // Debug Breakpoint Value Register 14
1329 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr14_el1)
1330 1.9 ryo AARCH64REG_READ_INLINE(dbgbvr15_el1) // Debug Breakpoint Value Register 15
1331 1.9 ryo AARCH64REG_WRITE_INLINE(dbgbvr15_el1)
1332 1.9 ryo
1333 1.55 ryo #define DBGBVR_MASK __BITS(63,2)
1334 1.55 ryo
1335 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr0_el1) // Debug Watchpoint Control Register 0
1336 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr0_el1)
1337 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr1_el1) // Debug Watchpoint Control Register 1
1338 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr1_el1)
1339 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr2_el1) // Debug Watchpoint Control Register 2
1340 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr2_el1)
1341 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr3_el1) // Debug Watchpoint Control Register 3
1342 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr3_el1)
1343 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr4_el1) // Debug Watchpoint Control Register 4
1344 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr4_el1)
1345 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr5_el1) // Debug Watchpoint Control Register 5
1346 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr5_el1)
1347 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr6_el1) // Debug Watchpoint Control Register 6
1348 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr6_el1)
1349 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr7_el1) // Debug Watchpoint Control Register 7
1350 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr7_el1)
1351 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr8_el1) // Debug Watchpoint Control Register 8
1352 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr8_el1)
1353 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr9_el1) // Debug Watchpoint Control Register 9
1354 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr9_el1)
1355 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr10_el1) // Debug Watchpoint Control Register 10
1356 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr10_el1)
1357 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr11_el1) // Debug Watchpoint Control Register 11
1358 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr11_el1)
1359 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr12_el1) // Debug Watchpoint Control Register 12
1360 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr12_el1)
1361 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr13_el1) // Debug Watchpoint Control Register 13
1362 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr13_el1)
1363 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr14_el1) // Debug Watchpoint Control Register 14
1364 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr14_el1)
1365 1.9 ryo AARCH64REG_READ_INLINE(dbgwcr15_el1) // Debug Watchpoint Control Register 15
1366 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwcr15_el1)
1367 1.9 ryo
1368 1.14 skrll #define DBGWCR_MASK __BITS(28,24)
1369 1.14 skrll #define DBGWCR_WT __BIT(20)
1370 1.14 skrll #define DBGWCR_LBN __BITS(19,16)
1371 1.14 skrll #define DBGWCR_SSC __BITS(15,14)
1372 1.14 skrll #define DBGWCR_HMC __BIT(13)
1373 1.14 skrll #define DBGWCR_BAS __BITS(12,5)
1374 1.14 skrll #define DBGWCR_LSC __BITS(4,3)
1375 1.14 skrll #define DBGWCR_PAC __BITS(2,1)
1376 1.14 skrll #define DBGWCR_E __BIT(0)
1377 1.9 ryo
1378 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr0_el1) // Debug Watchpoint Value Register 0
1379 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr0_el1)
1380 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr1_el1) // Debug Watchpoint Value Register 1
1381 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr1_el1)
1382 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr2_el1) // Debug Watchpoint Value Register 2
1383 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr2_el1)
1384 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr3_el1) // Debug Watchpoint Value Register 3
1385 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr3_el1)
1386 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr4_el1) // Debug Watchpoint Value Register 4
1387 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr4_el1)
1388 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr5_el1) // Debug Watchpoint Value Register 5
1389 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr5_el1)
1390 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr6_el1) // Debug Watchpoint Value Register 6
1391 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr6_el1)
1392 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr7_el1) // Debug Watchpoint Value Register 7
1393 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr7_el1)
1394 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr8_el1) // Debug Watchpoint Value Register 8
1395 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr8_el1)
1396 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr9_el1) // Debug Watchpoint Value Register 9
1397 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr9_el1)
1398 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr10_el1) // Debug Watchpoint Value Register 10
1399 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr10_el1)
1400 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr11_el1) // Debug Watchpoint Value Register 11
1401 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr11_el1)
1402 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr12_el1) // Debug Watchpoint Value Register 12
1403 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr12_el1)
1404 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr13_el1) // Debug Watchpoint Value Register 13
1405 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr13_el1)
1406 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr14_el1) // Debug Watchpoint Value Register 14
1407 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr14_el1)
1408 1.9 ryo AARCH64REG_READ_INLINE(dbgwvr15_el1) // Debug Watchpoint Value Register 15
1409 1.9 ryo AARCH64REG_WRITE_INLINE(dbgwvr15_el1)
1410 1.9 ryo
1411 1.55 ryo #define DBGWVR_MASK __BITS(63,2)
1412 1.9 ryo
1413 1.9 ryo
1414 1.9 ryo AARCH64REG_READ_INLINE(mdscr_el1) // Monitor Debug System Control Register
1415 1.9 ryo AARCH64REG_WRITE_INLINE(mdscr_el1)
1416 1.9 ryo
1417 1.22 ryo #define MDSCR_RXFULL __BIT(30) // for EDSCR.RXfull
1418 1.22 ryo #define MDSCR_TXFULL __BIT(29) // for EDSCR.TXfull
1419 1.22 ryo #define MDSCR_RXO __BIT(27) // for EDSCR.RXO
1420 1.22 ryo #define MDSCR_TXU __BIT(26) // for EDSCR.TXU
1421 1.22 ryo #define MDSCR_INTDIS __BITS(32,22) // for EDSCR.INTdis
1422 1.22 ryo #define MDSCR_TDA __BIT(21) // for EDSCR.TDA
1423 1.22 ryo #define MDSCR_MDE __BIT(15) // Monitor debug events
1424 1.22 ryo #define MDSCR_HDE __BIT(14) // for EDSCR.HDE
1425 1.22 ryo #define MDSCR_KDE __BIT(13) // Local debug enable
1426 1.22 ryo #define MDSCR_TDCC __BIT(12) // Trap Debug CommCh access
1427 1.22 ryo #define MDSCR_ERR __BIT(6) // for EDSCR.ERR
1428 1.22 ryo #define MDSCR_SS __BIT(0) // Software step
1429 1.22 ryo
1430 1.9 ryo AARCH64REG_WRITE_INLINE(oslar_el1) // OS Lock Access Register
1431 1.9 ryo
1432 1.9 ryo AARCH64REG_READ_INLINE(oslsr_el1) // OS Lock Status Register
1433 1.9 ryo
1434 1.9 ryo /*
1435 1.9 ryo * From here on, these are PMC registers
1436 1.9 ryo */
1437 1.9 ryo
1438 1.1 matt AARCH64REG_READ_INLINE(pmccfiltr_el0)
1439 1.1 matt AARCH64REG_WRITE_INLINE(pmccfiltr_el0)
1440 1.1 matt
1441 1.14 skrll #define PMCCFILTR_P __BIT(31) // Don't count cycles in EL1
1442 1.14 skrll #define PMCCFILTR_U __BIT(30) // Don't count cycles in EL0
1443 1.14 skrll #define PMCCFILTR_NSK __BIT(29) // Don't count cycles in NS EL1
1444 1.14 skrll #define PMCCFILTR_NSU __BIT(28) // Don't count cycles in NS EL0
1445 1.14 skrll #define PMCCFILTR_NSH __BIT(27) // Don't count cycles in NS EL2
1446 1.14 skrll #define PMCCFILTR_M __BIT(26) // Don't count cycles in EL3
1447 1.1 matt
1448 1.1 matt AARCH64REG_READ_INLINE(pmccntr_el0)
1449 1.1 matt
1450 1.12 christos AARCH64REG_READ_INLINE(pmceid0_el0)
1451 1.12 christos AARCH64REG_READ_INLINE(pmceid1_el0)
1452 1.11 jmcneill
1453 1.12 christos AARCH64REG_WRITE_INLINE(pmcntenclr_el0)
1454 1.12 christos AARCH64REG_WRITE_INLINE(pmcntenset_el0)
1455 1.11 jmcneill
1456 1.39 jmcneill #define PMCNTEN_C __BIT(31) // Enable the cycle counter
1457 1.39 jmcneill #define PMCNTEN_P __BITS(30,0) // Enable event counter bits
1458 1.39 jmcneill
1459 1.11 jmcneill AARCH64REG_READ_INLINE(pmcr_el0)
1460 1.11 jmcneill AARCH64REG_WRITE_INLINE(pmcr_el0)
1461 1.11 jmcneill
1462 1.14 skrll #define PMCR_IMP __BITS(31,24) // Implementor code
1463 1.14 skrll #define PMCR_IDCODE __BITS(23,16) // Identification code
1464 1.14 skrll #define PMCR_N __BITS(15,11) // Number of event counters
1465 1.63 ryo #define PMCR_LP __BIT(7) // Long event counter enable
1466 1.14 skrll #define PMCR_LC __BIT(6) // Long cycle counter enable
1467 1.14 skrll #define PMCR_DP __BIT(5) // Disable cycle counter when event
1468 1.14 skrll // counting is prohibited
1469 1.14 skrll #define PMCR_X __BIT(4) // Enable export of events
1470 1.14 skrll #define PMCR_D __BIT(3) // Clock divider
1471 1.14 skrll #define PMCR_C __BIT(2) // Cycle counter reset
1472 1.14 skrll #define PMCR_P __BIT(1) // Event counter reset
1473 1.14 skrll #define PMCR_E __BIT(0) // Enable
1474 1.11 jmcneill
1475 1.11 jmcneill
1476 1.12 christos AARCH64REG_READ_INLINE(pmevcntr1_el0)
1477 1.12 christos AARCH64REG_WRITE_INLINE(pmevcntr1_el0)
1478 1.11 jmcneill
1479 1.11 jmcneill AARCH64REG_READ_INLINE(pmevtyper1_el0)
1480 1.11 jmcneill AARCH64REG_WRITE_INLINE(pmevtyper1_el0)
1481 1.11 jmcneill
1482 1.14 skrll #define PMEVTYPER_P __BIT(31) // Don't count events in EL1
1483 1.14 skrll #define PMEVTYPER_U __BIT(30) // Don't count events in EL0
1484 1.14 skrll #define PMEVTYPER_NSK __BIT(29) // Don't count events in NS EL1
1485 1.14 skrll #define PMEVTYPER_NSU __BIT(28) // Don't count events in NS EL0
1486 1.14 skrll #define PMEVTYPER_NSH __BIT(27) // Count events in NS EL2
1487 1.14 skrll #define PMEVTYPER_M __BIT(26) // Don't count events in EL3
1488 1.14 skrll #define PMEVTYPER_MT __BIT(25) // Count events on all CPUs with same
1489 1.14 skrll // aff1 level
1490 1.14 skrll #define PMEVTYPER_EVTCOUNT __BITS(15,0) // Event to count
1491 1.11 jmcneill
1492 1.12 christos AARCH64REG_WRITE_INLINE(pmintenclr_el1)
1493 1.12 christos AARCH64REG_WRITE_INLINE(pmintenset_el1)
1494 1.11 jmcneill
1495 1.62 ryo #define PMINTEN_C __BIT(31) // for the cycle counter
1496 1.62 ryo #define PMINTEN_P __BITS(30,0) // for event counters (0-30)
1497 1.62 ryo
1498 1.12 christos AARCH64REG_WRITE_INLINE(pmovsclr_el0)
1499 1.12 christos AARCH64REG_READ_INLINE(pmovsset_el0)
1500 1.12 christos AARCH64REG_WRITE_INLINE(pmovsset_el0)
1501 1.11 jmcneill
1502 1.62 ryo #define PMOVS_C __BIT(31) // for the cycle counter
1503 1.62 ryo #define PMOVS_P __BITS(30,0) // for event counters (0-30)
1504 1.62 ryo
1505 1.12 christos AARCH64REG_WRITE_INLINE(pmselr_el0)
1506 1.11 jmcneill
1507 1.12 christos AARCH64REG_WRITE_INLINE(pmswinc_el0)
1508 1.11 jmcneill
1509 1.12 christos AARCH64REG_READ_INLINE(pmuserenr_el0)
1510 1.12 christos AARCH64REG_WRITE_INLINE(pmuserenr_el0)
1511 1.11 jmcneill
1512 1.12 christos AARCH64REG_READ_INLINE(pmxevcntr_el0)
1513 1.12 christos AARCH64REG_WRITE_INLINE(pmxevcntr_el0)
1514 1.11 jmcneill
1515 1.12 christos AARCH64REG_READ_INLINE(pmxevtyper_el0)
1516 1.12 christos AARCH64REG_WRITE_INLINE(pmxevtyper_el0)
1517 1.11 jmcneill
1518 1.11 jmcneill /*
1519 1.11 jmcneill * Generic timer registers
1520 1.11 jmcneill */
1521 1.11 jmcneill
1522 1.1 matt AARCH64REG_READ_INLINE(cntfrq_el0)
1523 1.1 matt
1524 1.9 ryo AARCH64REG_READ_INLINE(cnthctl_el2)
1525 1.9 ryo AARCH64REG_WRITE_INLINE(cnthctl_el2)
1526 1.9 ryo
1527 1.14 skrll #define CNTHCTL_EVNTDIR __BIT(3)
1528 1.14 skrll #define CNTHCTL_EVNTEN __BIT(2)
1529 1.14 skrll #define CNTHCTL_EL1PCEN __BIT(1)
1530 1.14 skrll #define CNTHCTL_EL1PCTEN __BIT(0)
1531 1.9 ryo
1532 1.1 matt AARCH64REG_READ_INLINE(cntkctl_el1)
1533 1.1 matt AARCH64REG_WRITE_INLINE(cntkctl_el1)
1534 1.1 matt
1535 1.14 skrll #define CNTKCTL_EL0PTEN __BIT(9) // EL0 access for CNTP CVAL/TVAL/CTL
1536 1.14 skrll #define CNTKCTL_PL0PTEN CNTKCTL_EL0PTEN
1537 1.14 skrll #define CNTKCTL_EL0VTEN __BIT(8) // EL0 access for CNTV CVAL/TVAL/CTL
1538 1.14 skrll #define CNTKCTL_PL0VTEN CNTKCTL_EL0VTEN
1539 1.14 skrll #define CNTKCTL_ELNTI __BITS(7,4)
1540 1.14 skrll #define CNTKCTL_EVNTDIR __BIT(3)
1541 1.14 skrll #define CNTKCTL_EVNTEN __BIT(2)
1542 1.14 skrll #define CNTKCTL_EL0VCTEN __BIT(1) // EL0 access for CNTVCT and CNTFRQ
1543 1.14 skrll #define CNTKCTL_PL0VCTEN CNTKCTL_EL0VCTEN
1544 1.14 skrll #define CNTKCTL_EL0PCTEN __BIT(0) // EL0 access for CNTPCT and CNTFRQ
1545 1.14 skrll #define CNTKCTL_PL0PCTEN CNTKCTL_EL0PCTEN
1546 1.1 matt
1547 1.1 matt AARCH64REG_READ_INLINE(cntp_ctl_el0)
1548 1.1 matt AARCH64REG_WRITE_INLINE(cntp_ctl_el0)
1549 1.1 matt AARCH64REG_READ_INLINE(cntp_cval_el0)
1550 1.1 matt AARCH64REG_WRITE_INLINE(cntp_cval_el0)
1551 1.1 matt AARCH64REG_READ_INLINE(cntp_tval_el0)
1552 1.1 matt AARCH64REG_WRITE_INLINE(cntp_tval_el0)
1553 1.1 matt AARCH64REG_READ_INLINE(cntpct_el0)
1554 1.1 matt AARCH64REG_WRITE_INLINE(cntpct_el0)
1555 1.1 matt
1556 1.1 matt AARCH64REG_READ_INLINE(cntps_ctl_el1)
1557 1.1 matt AARCH64REG_WRITE_INLINE(cntps_ctl_el1)
1558 1.1 matt AARCH64REG_READ_INLINE(cntps_cval_el1)
1559 1.1 matt AARCH64REG_WRITE_INLINE(cntps_cval_el1)
1560 1.1 matt AARCH64REG_READ_INLINE(cntps_tval_el1)
1561 1.1 matt AARCH64REG_WRITE_INLINE(cntps_tval_el1)
1562 1.1 matt
1563 1.1 matt AARCH64REG_READ_INLINE(cntv_ctl_el0)
1564 1.1 matt AARCH64REG_WRITE_INLINE(cntv_ctl_el0)
1565 1.1 matt AARCH64REG_READ_INLINE(cntv_cval_el0)
1566 1.1 matt AARCH64REG_WRITE_INLINE(cntv_cval_el0)
1567 1.1 matt AARCH64REG_READ_INLINE(cntv_tval_el0)
1568 1.1 matt AARCH64REG_WRITE_INLINE(cntv_tval_el0)
1569 1.1 matt AARCH64REG_READ_INLINE(cntvct_el0)
1570 1.1 matt AARCH64REG_WRITE_INLINE(cntvct_el0)
1571 1.1 matt
1572 1.14 skrll #define CNTCTL_ISTATUS __BIT(2) // Interrupt Asserted
1573 1.14 skrll #define CNTCTL_IMASK __BIT(1) // Timer Interrupt is Masked
1574 1.14 skrll #define CNTCTL_ENABLE __BIT(0) // Timer Enabled
1575 1.1 matt
1576 1.9 ryo // ID_AA64PFR0_EL1: AArch64 Processor Feature Register 0
1577 1.49 riastrad #define ID_AA64PFR0_EL1_CSV3 __BITS(63,60) // Speculative fault data
1578 1.49 riastrad #define ID_AA64PFR0_EL1_CSV3_NONE 0
1579 1.49 riastrad #define ID_AA64PFR0_EL1_CSV3_IMPL 1
1580 1.49 riastrad #define ID_AA64PFR0_EL1_CSV2 __BITS(59,56) // Speculative branches
1581 1.49 riastrad #define ID_AA64PFR0_EL1_CSV2_NONE 0
1582 1.49 riastrad #define ID_AA64PFR0_EL1_CSV2_IMPL 1
1583 1.49 riastrad // reserved [55:52]
1584 1.49 riastrad #define ID_AA64PFR0_EL1_DIT __BITS(51,48) // Data-indep. timing
1585 1.49 riastrad #define ID_AA64PFR0_EL1_DIT_NONE 0
1586 1.49 riastrad #define ID_AA64PFR0_EL1_DIT_IMPL 1
1587 1.49 riastrad #define ID_AA64PFR0_EL1_AMU __BITS(47,44) // Activity monitors ext.
1588 1.49 riastrad #define ID_AA64PFR0_EL1_AMU_NONE 0
1589 1.49 riastrad #define ID_AA64PFR0_EL1_AMU_IMPLv8_4 1
1590 1.49 riastrad #define ID_AA64PFR0_EL1_AMU_IMPLv8_6 2
1591 1.49 riastrad #define ID_AA64PFR0_EL1_MPAM __BITS(43,40) // MPAM Extension
1592 1.49 riastrad #define ID_AA64PFR0_EL1_MPAM_NONE 0
1593 1.49 riastrad #define ID_AA64PFR0_EL1_MPAM_IMPL 1
1594 1.49 riastrad #define ID_AA64PFR0_EL1_SEL2 __BITS(43,40) // Secure EL2
1595 1.49 riastrad #define ID_AA64PFR0_EL1_SEL2_NONE 0
1596 1.49 riastrad #define ID_AA64PFR0_EL1_SEL2_IMPL 1
1597 1.37 ryo #define ID_AA64PFR0_EL1_SVE __BITS(35,32) // Scalable Vector
1598 1.37 ryo #define ID_AA64PFR0_EL1_SVE_NONE 0
1599 1.37 ryo #define ID_AA64PFR0_EL1_SVE_IMPL 1
1600 1.37 ryo #define ID_AA64PFR0_EL1_RAS __BITS(31,28) // RAS Extension
1601 1.37 ryo #define ID_AA64PFR0_EL1_RAS_NONE 0
1602 1.37 ryo #define ID_AA64PFR0_EL1_RAS_IMPL 1
1603 1.37 ryo #define ID_AA64PFR0_EL1_RAS_ERX 2
1604 1.12 christos #define ID_AA64PFR0_EL1_GIC __BITS(24,27) // GIC CPU IF
1605 1.12 christos #define ID_AA64PFR0_EL1_GIC_SHIFT 24
1606 1.14 skrll #define ID_AA64PFR0_EL1_GIC_CPUIF_EN 1
1607 1.14 skrll #define ID_AA64PFR0_EL1_GIC_CPUIF_NONE 0
1608 1.12 christos #define ID_AA64PFR0_EL1_ADVSIMD __BITS(23,20) // SIMD
1609 1.14 skrll #define ID_AA64PFR0_EL1_ADV_SIMD_IMPL 0x0
1610 1.37 ryo #define ID_AA64PFR0_EL1_ADV_SIMD_HP 0x1
1611 1.14 skrll #define ID_AA64PFR0_EL1_ADV_SIMD_NONE 0xf
1612 1.12 christos #define ID_AA64PFR0_EL1_FP __BITS(19,16) // FP
1613 1.14 skrll #define ID_AA64PFR0_EL1_FP_IMPL 0x0
1614 1.37 ryo #define ID_AA64PFR0_EL1_FP_HP 0x1
1615 1.14 skrll #define ID_AA64PFR0_EL1_FP_NONE 0xf
1616 1.12 christos #define ID_AA64PFR0_EL1_EL3 __BITS(15,12) // EL3 handling
1617 1.14 skrll #define ID_AA64PFR0_EL1_EL3_NONE 0
1618 1.14 skrll #define ID_AA64PFR0_EL1_EL3_64 1
1619 1.14 skrll #define ID_AA64PFR0_EL1_EL3_64_32 2
1620 1.12 christos #define ID_AA64PFR0_EL1_EL2 __BITS(11,8) // EL2 handling
1621 1.14 skrll #define ID_AA64PFR0_EL1_EL2_NONE 0
1622 1.14 skrll #define ID_AA64PFR0_EL1_EL2_64 1
1623 1.14 skrll #define ID_AA64PFR0_EL1_EL2_64_32 2
1624 1.12 christos #define ID_AA64PFR0_EL1_EL1 __BITS(7,4) // EL1 handling
1625 1.14 skrll #define ID_AA64PFR0_EL1_EL1_64 1
1626 1.14 skrll #define ID_AA64PFR0_EL1_EL1_64_32 2
1627 1.12 christos #define ID_AA64PFR0_EL1_EL0 __BITS(3,0) // EL0 handling
1628 1.14 skrll #define ID_AA64PFR0_EL1_EL0_64 1
1629 1.14 skrll #define ID_AA64PFR0_EL1_EL0_64_32 2
1630 1.9 ryo
1631 1.15 jmcneill /*
1632 1.15 jmcneill * GICv3 system registers
1633 1.15 jmcneill */
1634 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_sre_el1, s3_0_c12_c12_5)
1635 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_ctlr_el1, s3_0_c12_c12_4)
1636 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_pmr_el1, s3_0_c4_c6_0)
1637 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_bpr0_el1, s3_0_c12_c8_3)
1638 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_bpr1_el1, s3_0_c12_c12_3)
1639 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_igrpen0_el1, s3_0_c12_c12_6)
1640 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_igrpen1_el1, s3_0_c12_c12_7)
1641 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_eoir0_el1, s3_0_c12_c8_1)
1642 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_eoir1_el1, s3_0_c12_c12_1)
1643 1.15 jmcneill AARCH64REG_READWRITE_INLINE2(icc_sgi1r_el1, s3_0_c12_c11_5)
1644 1.15 jmcneill AARCH64REG_READ_INLINE2(icc_iar1_el1, s3_0_c12_c12_0)
1645 1.15 jmcneill
1646 1.9 ryo // ICC_SRE_EL1: Interrupt Controller System Register Enable register
1647 1.15 jmcneill #define ICC_SRE_EL1_DIB __BIT(2)
1648 1.15 jmcneill #define ICC_SRE_EL1_DFB __BIT(1)
1649 1.15 jmcneill #define ICC_SRE_EL1_SRE __BIT(0)
1650 1.15 jmcneill
1651 1.16 jmcneill // ICC_SRE_EL2: Interrupt Controller System Register Enable register
1652 1.16 jmcneill #define ICC_SRE_EL2_EN __BIT(3)
1653 1.16 jmcneill #define ICC_SRE_EL2_DIB __BIT(2)
1654 1.16 jmcneill #define ICC_SRE_EL2_DFB __BIT(1)
1655 1.16 jmcneill #define ICC_SRE_EL2_SRE __BIT(0)
1656 1.16 jmcneill
1657 1.15 jmcneill // ICC_BPR[01]_EL1: Interrupt Controller Binary Point Register 0/1
1658 1.15 jmcneill #define ICC_BPR_EL1_BinaryPoint __BITS(2,0)
1659 1.15 jmcneill
1660 1.15 jmcneill // ICC_CTLR_EL1: Interrupt Controller Control Register
1661 1.15 jmcneill #define ICC_CTLR_EL1_A3V __BIT(15)
1662 1.15 jmcneill #define ICC_CTLR_EL1_SEIS __BIT(14)
1663 1.15 jmcneill #define ICC_CTLR_EL1_IDbits __BITS(13,11)
1664 1.15 jmcneill #define ICC_CTLR_EL1_PRIbits __BITS(10,8)
1665 1.15 jmcneill #define ICC_CTLR_EL1_PMHE __BIT(6)
1666 1.15 jmcneill #define ICC_CTLR_EL1_EOImode __BIT(1)
1667 1.15 jmcneill #define ICC_CTLR_EL1_CBPR __BIT(0)
1668 1.15 jmcneill
1669 1.15 jmcneill // ICC_IGRPEN[01]_EL1: Interrupt Controller Interrupt Group 0/1 Enable register
1670 1.15 jmcneill #define ICC_IGRPEN_EL1_Enable __BIT(0)
1671 1.15 jmcneill
1672 1.15 jmcneill // ICC_SGI[01]R_EL1: Interrupt Controller Software Generated Interrupt Group 0/1 Register
1673 1.15 jmcneill #define ICC_SGIR_EL1_Aff3 __BITS(55,48)
1674 1.15 jmcneill #define ICC_SGIR_EL1_IRM __BIT(40)
1675 1.15 jmcneill #define ICC_SGIR_EL1_Aff2 __BITS(39,32)
1676 1.15 jmcneill #define ICC_SGIR_EL1_INTID __BITS(27,24)
1677 1.15 jmcneill #define ICC_SGIR_EL1_Aff1 __BITS(23,16)
1678 1.15 jmcneill #define ICC_SGIR_EL1_TargetList __BITS(15,0)
1679 1.15 jmcneill #define ICC_SGIR_EL1_Aff (ICC_SGIR_EL1_Aff3|ICC_SGIR_EL1_Aff2|ICC_SGIR_EL1_Aff1)
1680 1.15 jmcneill
1681 1.15 jmcneill // ICC_IAR[01]_EL1: Interrupt Controller Interrupt Acknowledge Register 0/1
1682 1.15 jmcneill #define ICC_IAR_INTID __BITS(23,0)
1683 1.15 jmcneill #define ICC_IAR_INTID_SPURIOUS 1023
1684 1.15 jmcneill
1685 1.15 jmcneill /*
1686 1.15 jmcneill * GICv3 REGISTER ACCESS
1687 1.15 jmcneill */
1688 1.9 ryo
1689 1.15 jmcneill #define icc_sre_read reg_icc_sre_el1_read
1690 1.15 jmcneill #define icc_sre_write reg_icc_sre_el1_write
1691 1.25 skrll #define icc_pmr_read reg_icc_pmr_el1_read
1692 1.15 jmcneill #define icc_pmr_write reg_icc_pmr_el1_write
1693 1.15 jmcneill #define icc_bpr0_write reg_icc_bpr0_el1_write
1694 1.15 jmcneill #define icc_bpr1_write reg_icc_bpr1_el1_write
1695 1.15 jmcneill #define icc_ctlr_read reg_icc_ctlr_el1_read
1696 1.15 jmcneill #define icc_ctlr_write reg_icc_ctlr_el1_write
1697 1.15 jmcneill #define icc_igrpen1_write reg_icc_igrpen1_el1_write
1698 1.15 jmcneill #define icc_sgi1r_write reg_icc_sgi1r_el1_write
1699 1.15 jmcneill #define icc_iar1_read reg_icc_iar1_el1_read
1700 1.15 jmcneill #define icc_eoi1r_write reg_icc_eoir1_el1_write
1701 1.9 ryo
1702 1.18 skrll #if defined(_KERNEL)
1703 1.18 skrll
1704 1.18 skrll /*
1705 1.18 skrll * CPU REGISTER ACCESS
1706 1.18 skrll */
1707 1.18 skrll static __inline register_t
1708 1.18 skrll cpu_mpidr_aff_read(void)
1709 1.18 skrll {
1710 1.18 skrll
1711 1.18 skrll return reg_mpidr_el1_read() &
1712 1.18 skrll (MPIDR_AFF3|MPIDR_AFF2|MPIDR_AFF1|MPIDR_AFF0);
1713 1.18 skrll }
1714 1.18 skrll
1715 1.9 ryo /*
1716 1.9 ryo * GENERIC TIMER REGISTER ACCESS
1717 1.9 ryo */
1718 1.12 christos static __inline uint32_t
1719 1.9 ryo gtmr_cntfrq_read(void)
1720 1.9 ryo {
1721 1.9 ryo
1722 1.9 ryo return reg_cntfrq_el0_read();
1723 1.9 ryo }
1724 1.9 ryo
1725 1.12 christos static __inline uint32_t
1726 1.9 ryo gtmr_cntk_ctl_read(void)
1727 1.9 ryo {
1728 1.1 matt
1729 1.9 ryo return reg_cntkctl_el1_read();
1730 1.9 ryo }
1731 1.9 ryo
1732 1.12 christos static __inline void
1733 1.9 ryo gtmr_cntk_ctl_write(uint32_t val)
1734 1.9 ryo {
1735 1.9 ryo
1736 1.9 ryo reg_cntkctl_el1_write(val);
1737 1.9 ryo }
1738 1.9 ryo
1739 1.9 ryo /*
1740 1.9 ryo * Counter-timer Virtual Count timer
1741 1.9 ryo */
1742 1.12 christos static __inline uint64_t
1743 1.9 ryo gtmr_cntpct_read(void)
1744 1.9 ryo {
1745 1.9 ryo
1746 1.9 ryo return reg_cntpct_el0_read();
1747 1.9 ryo }
1748 1.9 ryo
1749 1.12 christos static __inline uint64_t
1750 1.9 ryo gtmr_cntvct_read(void)
1751 1.9 ryo {
1752 1.9 ryo
1753 1.9 ryo return reg_cntvct_el0_read();
1754 1.9 ryo }
1755 1.9 ryo
1756 1.9 ryo /*
1757 1.9 ryo * Counter-timer Virtual Timer Control register
1758 1.9 ryo */
1759 1.56 jmcneill static __inline uint64_t
1760 1.9 ryo gtmr_cntv_ctl_read(void)
1761 1.9 ryo {
1762 1.9 ryo
1763 1.9 ryo return reg_cntv_ctl_el0_read();
1764 1.9 ryo }
1765 1.9 ryo
1766 1.12 christos static __inline void
1767 1.56 jmcneill gtmr_cntv_ctl_write(uint64_t val)
1768 1.9 ryo {
1769 1.9 ryo
1770 1.9 ryo reg_cntv_ctl_el0_write(val);
1771 1.9 ryo }
1772 1.9 ryo
1773 1.26 jmcneill /*
1774 1.26 jmcneill * Counter-timer Physical Timer Control register
1775 1.26 jmcneill */
1776 1.26 jmcneill static __inline uint32_t
1777 1.26 jmcneill gtmr_cntp_ctl_read(void)
1778 1.26 jmcneill {
1779 1.26 jmcneill
1780 1.26 jmcneill return reg_cntp_ctl_el0_read();
1781 1.26 jmcneill }
1782 1.26 jmcneill
1783 1.12 christos static __inline void
1784 1.9 ryo gtmr_cntp_ctl_write(uint32_t val)
1785 1.9 ryo {
1786 1.9 ryo
1787 1.9 ryo reg_cntp_ctl_el0_write(val);
1788 1.9 ryo }
1789 1.9 ryo
1790 1.9 ryo /*
1791 1.26 jmcneill * Counter-timer Physical Timer TimerValue register
1792 1.26 jmcneill */
1793 1.26 jmcneill static __inline uint32_t
1794 1.26 jmcneill gtmr_cntp_tval_read(void)
1795 1.26 jmcneill {
1796 1.26 jmcneill
1797 1.26 jmcneill return reg_cntp_tval_el0_read();
1798 1.26 jmcneill }
1799 1.26 jmcneill
1800 1.26 jmcneill static __inline void
1801 1.26 jmcneill gtmr_cntp_tval_write(uint32_t val)
1802 1.26 jmcneill {
1803 1.26 jmcneill
1804 1.26 jmcneill reg_cntp_tval_el0_write(val);
1805 1.26 jmcneill }
1806 1.26 jmcneill
1807 1.26 jmcneill /*
1808 1.9 ryo * Counter-timer Virtual Timer TimerValue register
1809 1.9 ryo */
1810 1.12 christos static __inline uint32_t
1811 1.10 joerg gtmr_cntv_tval_read(void)
1812 1.10 joerg {
1813 1.10 joerg
1814 1.10 joerg return reg_cntv_tval_el0_read();
1815 1.10 joerg }
1816 1.10 joerg
1817 1.12 christos static __inline void
1818 1.9 ryo gtmr_cntv_tval_write(uint32_t val)
1819 1.9 ryo {
1820 1.9 ryo
1821 1.9 ryo reg_cntv_tval_el0_write(val);
1822 1.9 ryo }
1823 1.9 ryo
1824 1.26 jmcneill /*
1825 1.26 jmcneill * Counter-timer Physical Timer CompareValue register
1826 1.26 jmcneill */
1827 1.26 jmcneill static __inline uint64_t
1828 1.26 jmcneill gtmr_cntp_cval_read(void)
1829 1.26 jmcneill {
1830 1.26 jmcneill
1831 1.26 jmcneill return reg_cntp_cval_el0_read();
1832 1.26 jmcneill }
1833 1.26 jmcneill
1834 1.26 jmcneill static __inline void
1835 1.26 jmcneill gtmr_cntp_cval_write(uint64_t val)
1836 1.26 jmcneill {
1837 1.26 jmcneill
1838 1.26 jmcneill reg_cntp_cval_el0_write(val);
1839 1.26 jmcneill }
1840 1.9 ryo
1841 1.9 ryo /*
1842 1.9 ryo * Counter-timer Virtual Timer CompareValue register
1843 1.9 ryo */
1844 1.12 christos static __inline uint64_t
1845 1.9 ryo gtmr_cntv_cval_read(void)
1846 1.9 ryo {
1847 1.9 ryo
1848 1.9 ryo return reg_cntv_cval_el0_read();
1849 1.9 ryo }
1850 1.23 jmcneill
1851 1.23 jmcneill static __inline void
1852 1.23 jmcneill gtmr_cntv_cval_write(uint64_t val)
1853 1.23 jmcneill {
1854 1.23 jmcneill
1855 1.23 jmcneill reg_cntv_cval_el0_write(val);
1856 1.23 jmcneill }
1857 1.18 skrll #endif /* _KERNEL */
1858 1.1 matt
1859 1.21 mrg /*
1860 1.21 mrg * Structure attached to machdep.cpuN.cpu_id sysctl node.
1861 1.21 mrg * Always add new members to the end, and avoid arrays.
1862 1.21 mrg */
1863 1.21 mrg struct aarch64_sysctl_cpu_id {
1864 1.21 mrg uint64_t ac_midr; /* Main ID Register */
1865 1.21 mrg uint64_t ac_revidr; /* Revision ID Register */
1866 1.21 mrg uint64_t ac_mpidr; /* Multiprocessor Affinity Register */
1867 1.21 mrg
1868 1.21 mrg uint64_t ac_aa64dfr0; /* A64 Debug Feature Register 0 */
1869 1.21 mrg uint64_t ac_aa64dfr1; /* A64 Debug Feature Register 1 */
1870 1.21 mrg
1871 1.21 mrg uint64_t ac_aa64isar0; /* A64 Instruction Set Attribute Register 0 */
1872 1.21 mrg uint64_t ac_aa64isar1; /* A64 Instruction Set Attribute Register 1 */
1873 1.21 mrg
1874 1.30 rjs uint64_t ac_aa64mmfr0; /* A64 Memory Model Feature Register 0 */
1875 1.30 rjs uint64_t ac_aa64mmfr1; /* A64 Memory Model Feature Register 1 */
1876 1.30 rjs uint64_t ac_aa64mmfr2; /* A64 Memory Model Feature Register 2 */
1877 1.21 mrg
1878 1.21 mrg uint64_t ac_aa64pfr0; /* A64 Processor Feature Register 0 */
1879 1.21 mrg uint64_t ac_aa64pfr1; /* A64 Processor Feature Register 1 */
1880 1.21 mrg
1881 1.21 mrg uint64_t ac_aa64zfr0; /* A64 SVE Feature ID Register 0 */
1882 1.21 mrg
1883 1.21 mrg uint32_t ac_mvfr0; /* Media and VFP Feature Register 0 */
1884 1.21 mrg uint32_t ac_mvfr1; /* Media and VFP Feature Register 1 */
1885 1.21 mrg uint32_t ac_mvfr2; /* Media and VFP Feature Register 2 */
1886 1.50 ryo uint32_t ac_pad;
1887 1.50 ryo
1888 1.58 skrll uint64_t ac_clidr; /* Cache Level ID Register */
1889 1.50 ryo uint64_t ac_ctr; /* Cache Type Register */
1890 1.21 mrg };
1891 1.21 mrg
1892 1.1 matt #endif /* _AARCH64_ARMREG_H_ */
1893