cortex_a/registers/
mair_el2.rs

1// SPDX-License-Identifier: Apache-2.0 OR MIT
2//
3// Copyright (c) 2018-2022 by the author(s)
4//
5// Author(s):
6//   - Andre Richter <andre.o.richter@gmail.com>
7//   - Erik Verbruggen <erik.verbruggen@me.com>
8//   - Bradley Landherr <landhb@users.noreply.github.com>
9
10//! Memory Attribute Indirection Register - EL2
11//!
12//! Provides the memory attribute encodings corresponding to the possible AttrIndx values in a
13//! Long-descriptor format translation table entry for stage 1 translations at EL2.
14
15use tock_registers::{
16    interfaces::{Readable, Writeable},
17    register_bitfields,
18};
19
20register_bitfields! {u64,
21    pub MAIR_EL2 [
22        /// Attribute 7
23        Attr7_Normal_Outer OFFSET(60) NUMBITS(4) [
24            Device = 0b0000,
25
26            WriteThrough_Transient_WriteAlloc = 0b0001,
27            WriteThrough_Transient_ReadAlloc = 0b0010,
28            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
29
30            NonCacheable = 0b0100,
31            WriteBack_Transient_WriteAlloc = 0b0101,
32            WriteBack_Transient_ReadAlloc = 0b0110,
33            WriteBack_Transient_ReadWriteAlloc = 0b0111,
34
35            WriteThrough_NonTransient = 0b1000,
36            WriteThrough_NonTransient_WriteAlloc = 0b1001,
37            WriteThrough_NonTransient_ReadAlloc = 0b1010,
38            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
39
40            WriteBack_NonTransient = 0b1100,
41            WriteBack_NonTransient_WriteAlloc = 0b1101,
42            WriteBack_NonTransient_ReadAlloc = 0b1110,
43            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
44        ],
45        Attr7_Device OFFSET(56) NUMBITS(8) [
46            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
47            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
48            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
49            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
50        ],
51        Attr7_Normal_Inner OFFSET(56) NUMBITS(4) [
52            WriteThrough_Transient = 0x0000,
53            WriteThrough_Transient_WriteAlloc = 0x0001,
54            WriteThrough_Transient_ReadAlloc = 0x0010,
55            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
56
57            NonCacheable = 0b0100,
58            WriteBack_Transient_WriteAlloc = 0b0101,
59            WriteBack_Transient_ReadAlloc = 0b0110,
60            WriteBack_Transient_ReadWriteAlloc = 0b0111,
61
62            WriteThrough_NonTransient = 0b1000,
63            WriteThrough_NonTransient_WriteAlloc = 0b1001,
64            WriteThrough_NonTransient_ReadAlloc = 0b1010,
65            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
66
67            WriteBack_NonTransient = 0b1100,
68            WriteBack_NonTransient_WriteAlloc = 0b1101,
69            WriteBack_NonTransient_ReadAlloc = 0b1110,
70            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
71        ],
72
73        /// Attribute 6
74        Attr6_Normal_Outer OFFSET(52) NUMBITS(4) [
75            Device = 0b0000,
76
77            WriteThrough_Transient_WriteAlloc = 0b0001,
78            WriteThrough_Transient_ReadAlloc = 0b0010,
79            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
80
81            NonCacheable = 0b0100,
82            WriteBack_Transient_WriteAlloc = 0b0101,
83            WriteBack_Transient_ReadAlloc = 0b0110,
84            WriteBack_Transient_ReadWriteAlloc = 0b0111,
85
86            WriteThrough_NonTransient = 0b1000,
87            WriteThrough_NonTransient_WriteAlloc = 0b1001,
88            WriteThrough_NonTransient_ReadAlloc = 0b1010,
89            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
90
91            WriteBack_NonTransient = 0b1100,
92            WriteBack_NonTransient_WriteAlloc = 0b1101,
93            WriteBack_NonTransient_ReadAlloc = 0b1110,
94            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
95        ],
96        Attr6_Device OFFSET(48) NUMBITS(8) [
97            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
98            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
99            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
100            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
101        ],
102        Attr6_Normal_Inner OFFSET(48) NUMBITS(4) [
103            WriteThrough_Transient = 0x0000,
104            WriteThrough_Transient_WriteAlloc = 0x0001,
105            WriteThrough_Transient_ReadAlloc = 0x0010,
106            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
107
108            NonCacheable = 0b0100,
109            WriteBack_Transient_WriteAlloc = 0b0101,
110            WriteBack_Transient_ReadAlloc = 0b0110,
111            WriteBack_Transient_ReadWriteAlloc = 0b0111,
112
113            WriteThrough_NonTransient = 0b1000,
114            WriteThrough_NonTransient_WriteAlloc = 0b1001,
115            WriteThrough_NonTransient_ReadAlloc = 0b1010,
116            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
117
118            WriteBack_NonTransient = 0b1100,
119            WriteBack_NonTransient_WriteAlloc = 0b1101,
120            WriteBack_NonTransient_ReadAlloc = 0b1110,
121            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
122        ],
123
124        /// Attribute 5
125        Attr5_Normal_Outer OFFSET(44) NUMBITS(4) [
126            Device = 0b0000,
127
128            WriteThrough_Transient_WriteAlloc = 0b0001,
129            WriteThrough_Transient_ReadAlloc = 0b0010,
130            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
131
132            NonCacheable = 0b0100,
133            WriteBack_Transient_WriteAlloc = 0b0101,
134            WriteBack_Transient_ReadAlloc = 0b0110,
135            WriteBack_Transient_ReadWriteAlloc = 0b0111,
136
137            WriteThrough_NonTransient = 0b1000,
138            WriteThrough_NonTransient_WriteAlloc = 0b1001,
139            WriteThrough_NonTransient_ReadAlloc = 0b1010,
140            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
141
142            WriteBack_NonTransient = 0b1100,
143            WriteBack_NonTransient_WriteAlloc = 0b1101,
144            WriteBack_NonTransient_ReadAlloc = 0b1110,
145            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
146        ],
147        Attr5_Device OFFSET(40) NUMBITS(8) [
148            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
149            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
150            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
151            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
152        ],
153        Attr5_Normal_Inner OFFSET(40) NUMBITS(4) [
154            WriteThrough_Transient = 0x0000,
155            WriteThrough_Transient_WriteAlloc = 0x0001,
156            WriteThrough_Transient_ReadAlloc = 0x0010,
157            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
158
159            NonCacheable = 0b0100,
160            WriteBack_Transient_WriteAlloc = 0b0101,
161            WriteBack_Transient_ReadAlloc = 0b0110,
162            WriteBack_Transient_ReadWriteAlloc = 0b0111,
163
164            WriteThrough_NonTransient = 0b1000,
165            WriteThrough_NonTransient_WriteAlloc = 0b1001,
166            WriteThrough_NonTransient_ReadAlloc = 0b1010,
167            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
168
169            WriteBack_NonTransient = 0b1100,
170            WriteBack_NonTransient_WriteAlloc = 0b1101,
171            WriteBack_NonTransient_ReadAlloc = 0b1110,
172            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
173        ],
174
175        /// Attribute 4
176        Attr4_Normal_Outer OFFSET(36) NUMBITS(4) [
177            Device = 0b0000,
178
179            WriteThrough_Transient_WriteAlloc = 0b0001,
180            WriteThrough_Transient_ReadAlloc = 0b0010,
181            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
182
183            NonCacheable = 0b0100,
184            WriteBack_Transient_WriteAlloc = 0b0101,
185            WriteBack_Transient_ReadAlloc = 0b0110,
186            WriteBack_Transient_ReadWriteAlloc = 0b0111,
187
188            WriteThrough_NonTransient = 0b1000,
189            WriteThrough_NonTransient_WriteAlloc = 0b1001,
190            WriteThrough_NonTransient_ReadAlloc = 0b1010,
191            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
192
193            WriteBack_NonTransient = 0b1100,
194            WriteBack_NonTransient_WriteAlloc = 0b1101,
195            WriteBack_NonTransient_ReadAlloc = 0b1110,
196            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
197        ],
198        Attr4_Device OFFSET(32) NUMBITS(8) [
199            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
200            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
201            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
202            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
203        ],
204        Attr4_Normal_Inner OFFSET(32) NUMBITS(4) [
205            WriteThrough_Transient = 0x0000,
206            WriteThrough_Transient_WriteAlloc = 0x0001,
207            WriteThrough_Transient_ReadAlloc = 0x0010,
208            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
209
210            NonCacheable = 0b0100,
211            WriteBack_Transient_WriteAlloc = 0b0101,
212            WriteBack_Transient_ReadAlloc = 0b0110,
213            WriteBack_Transient_ReadWriteAlloc = 0b0111,
214
215            WriteThrough_NonTransient = 0b1000,
216            WriteThrough_NonTransient_WriteAlloc = 0b1001,
217            WriteThrough_NonTransient_ReadAlloc = 0b1010,
218            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
219
220            WriteBack_NonTransient = 0b1100,
221            WriteBack_NonTransient_WriteAlloc = 0b1101,
222            WriteBack_NonTransient_ReadAlloc = 0b1110,
223            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
224        ],
225
226        /// Attribute 3
227        Attr3_Normal_Outer OFFSET(28) NUMBITS(4) [
228            Device = 0b0000,
229
230            WriteThrough_Transient_WriteAlloc = 0b0001,
231            WriteThrough_Transient_ReadAlloc = 0b0010,
232            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
233
234            NonCacheable = 0b0100,
235            WriteBack_Transient_WriteAlloc = 0b0101,
236            WriteBack_Transient_ReadAlloc = 0b0110,
237            WriteBack_Transient_ReadWriteAlloc = 0b0111,
238
239            WriteThrough_NonTransient = 0b1000,
240            WriteThrough_NonTransient_WriteAlloc = 0b1001,
241            WriteThrough_NonTransient_ReadAlloc = 0b1010,
242            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
243
244            WriteBack_NonTransient = 0b1100,
245            WriteBack_NonTransient_WriteAlloc = 0b1101,
246            WriteBack_NonTransient_ReadAlloc = 0b1110,
247            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
248        ],
249        Attr3_Device OFFSET(24) NUMBITS(8) [
250            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
251            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
252            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
253            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
254        ],
255        Attr3_Normal_Inner OFFSET(24) NUMBITS(4) [
256            WriteThrough_Transient = 0x0000,
257            WriteThrough_Transient_WriteAlloc = 0x0001,
258            WriteThrough_Transient_ReadAlloc = 0x0010,
259            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
260
261            NonCacheable = 0b0100,
262            WriteBack_Transient_WriteAlloc = 0b0101,
263            WriteBack_Transient_ReadAlloc = 0b0110,
264            WriteBack_Transient_ReadWriteAlloc = 0b0111,
265
266            WriteThrough_NonTransient = 0b1000,
267            WriteThrough_NonTransient_WriteAlloc = 0b1001,
268            WriteThrough_NonTransient_ReadAlloc = 0b1010,
269            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
270
271            WriteBack_NonTransient = 0b1100,
272            WriteBack_NonTransient_WriteAlloc = 0b1101,
273            WriteBack_NonTransient_ReadAlloc = 0b1110,
274            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
275        ],
276
277        /// Attribute 2
278        Attr2_Normal_Outer OFFSET(20) NUMBITS(4) [
279            Device = 0b0000,
280
281            WriteThrough_Transient_WriteAlloc = 0b0001,
282            WriteThrough_Transient_ReadAlloc = 0b0010,
283            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
284
285            NonCacheable = 0b0100,
286            WriteBack_Transient_WriteAlloc = 0b0101,
287            WriteBack_Transient_ReadAlloc = 0b0110,
288            WriteBack_Transient_ReadWriteAlloc = 0b0111,
289
290            WriteThrough_NonTransient = 0b1000,
291            WriteThrough_NonTransient_WriteAlloc = 0b1001,
292            WriteThrough_NonTransient_ReadAlloc = 0b1010,
293            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
294
295            WriteBack_NonTransient = 0b1100,
296            WriteBack_NonTransient_WriteAlloc = 0b1101,
297            WriteBack_NonTransient_ReadAlloc = 0b1110,
298            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
299        ],
300        Attr2_Device OFFSET(16) NUMBITS(8) [
301            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
302            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
303            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
304            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
305        ],
306        Attr2_Normal_Inner OFFSET(16) NUMBITS(4) [
307            WriteThrough_Transient = 0x0000,
308            WriteThrough_Transient_WriteAlloc = 0x0001,
309            WriteThrough_Transient_ReadAlloc = 0x0010,
310            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
311
312            NonCacheable = 0b0100,
313            WriteBack_Transient_WriteAlloc = 0b0101,
314            WriteBack_Transient_ReadAlloc = 0b0110,
315            WriteBack_Transient_ReadWriteAlloc = 0b0111,
316
317            WriteThrough_NonTransient = 0b1000,
318            WriteThrough_NonTransient_WriteAlloc = 0b1001,
319            WriteThrough_NonTransient_ReadAlloc = 0b1010,
320            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
321
322            WriteBack_NonTransient = 0b1100,
323            WriteBack_NonTransient_WriteAlloc = 0b1101,
324            WriteBack_NonTransient_ReadAlloc = 0b1110,
325            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
326        ],
327
328        /// Attribute 1
329        Attr1_Normal_Outer OFFSET(12) NUMBITS(4) [
330            Device = 0b0000,
331
332            WriteThrough_Transient_WriteAlloc = 0b0001,
333            WriteThrough_Transient_ReadAlloc = 0b0010,
334            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
335
336            NonCacheable = 0b0100,
337            WriteBack_Transient_WriteAlloc = 0b0101,
338            WriteBack_Transient_ReadAlloc = 0b0110,
339            WriteBack_Transient_ReadWriteAlloc = 0b0111,
340
341            WriteThrough_NonTransient = 0b1000,
342            WriteThrough_NonTransient_WriteAlloc = 0b1001,
343            WriteThrough_NonTransient_ReadAlloc = 0b1010,
344            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
345
346            WriteBack_NonTransient = 0b1100,
347            WriteBack_NonTransient_WriteAlloc = 0b1101,
348            WriteBack_NonTransient_ReadAlloc = 0b1110,
349            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
350        ],
351        Attr1_Device OFFSET(8) NUMBITS(8) [
352            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
353            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
354            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
355            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
356        ],
357        Attr1_Normal_Inner OFFSET(8) NUMBITS(4) [
358            WriteThrough_Transient = 0x0000,
359            WriteThrough_Transient_WriteAlloc = 0x0001,
360            WriteThrough_Transient_ReadAlloc = 0x0010,
361            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
362
363            NonCacheable = 0b0100,
364            WriteBack_Transient_WriteAlloc = 0b0101,
365            WriteBack_Transient_ReadAlloc = 0b0110,
366            WriteBack_Transient_ReadWriteAlloc = 0b0111,
367
368            WriteThrough_NonTransient = 0b1000,
369            WriteThrough_NonTransient_WriteAlloc = 0b1001,
370            WriteThrough_NonTransient_ReadAlloc = 0b1010,
371            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
372
373            WriteBack_NonTransient = 0b1100,
374            WriteBack_NonTransient_WriteAlloc = 0b1101,
375            WriteBack_NonTransient_ReadAlloc = 0b1110,
376            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
377        ],
378
379        /// Attribute 0
380        Attr0_Normal_Outer OFFSET(4) NUMBITS(4) [
381            Device = 0b0000,
382
383            WriteThrough_Transient_WriteAlloc = 0b0001,
384            WriteThrough_Transient_ReadAlloc = 0b0010,
385            WriteThrough_Transient_ReadWriteAlloc = 0b0011,
386
387            NonCacheable = 0b0100,
388            WriteBack_Transient_WriteAlloc = 0b0101,
389            WriteBack_Transient_ReadAlloc = 0b0110,
390            WriteBack_Transient_ReadWriteAlloc = 0b0111,
391
392            WriteThrough_NonTransient = 0b1000,
393            WriteThrough_NonTransient_WriteAlloc = 0b1001,
394            WriteThrough_NonTransient_ReadAlloc = 0b1010,
395            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
396
397            WriteBack_NonTransient = 0b1100,
398            WriteBack_NonTransient_WriteAlloc = 0b1101,
399            WriteBack_NonTransient_ReadAlloc = 0b1110,
400            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
401        ],
402        Attr0_Device OFFSET(0) NUMBITS(8) [
403            nonGathering_nonReordering_noEarlyWriteAck = 0b0000_0000,
404            nonGathering_nonReordering_EarlyWriteAck = 0b0000_0100,
405            nonGathering_Reordering_EarlyWriteAck = 0b0000_1000,
406            Gathering_Reordering_EarlyWriteAck = 0b0000_1100
407        ],
408        Attr0_Normal_Inner OFFSET(0) NUMBITS(4) [
409            WriteThrough_Transient = 0x0000,
410            WriteThrough_Transient_WriteAlloc = 0x0001,
411            WriteThrough_Transient_ReadAlloc = 0x0010,
412            WriteThrough_Transient_ReadWriteAlloc = 0x0011,
413
414            NonCacheable = 0b0100,
415            WriteBack_Transient_WriteAlloc = 0b0101,
416            WriteBack_Transient_ReadAlloc = 0b0110,
417            WriteBack_Transient_ReadWriteAlloc = 0b0111,
418
419            WriteThrough_NonTransient = 0b1000,
420            WriteThrough_NonTransient_WriteAlloc = 0b1001,
421            WriteThrough_NonTransient_ReadAlloc = 0b1010,
422            WriteThrough_NonTransient_ReadWriteAlloc = 0b1011,
423
424            WriteBack_NonTransient = 0b1100,
425            WriteBack_NonTransient_WriteAlloc = 0b1101,
426            WriteBack_NonTransient_ReadAlloc = 0b1110,
427            WriteBack_NonTransient_ReadWriteAlloc = 0b1111
428        ]
429    ]
430}
431
432pub struct Reg;
433
434impl Readable for Reg {
435    type T = u64;
436    type R = MAIR_EL2::Register;
437
438    sys_coproc_read_raw!(u64, "MAIR_EL2", "x");
439}
440
441impl Writeable for Reg {
442    type T = u64;
443    type R = MAIR_EL2::Register;
444
445    sys_coproc_write_raw!(u64, "MAIR_EL2", "x");
446}
447
448pub const MAIR_EL2: Reg = Reg {};