1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/***********************************************************************************************************************
 * Copyright (c) 2020 by the authors
 *
 * Author: André Borrmann <pspwizard@gmx.de>
 * License: Apache License 2.0 / MIT
 **********************************************************************************************************************/

//! # MAIR_EL1 - Memory Attribute Indirection Register EL1
//!
//! Provides the memory attribute encodings corresponding to the possible AttrIndx values in a
//! Long-descriptor format translation table entry for stage 1 translations at EL1.
//!
//! ## Usage Constraints
//! EL0 | EL1 (NS) | EL1(S) | EL2 | EL3(NS) | EL3(S)
//! ----|----------|--------|-----|---------|-------
//!  -  | R/W      | R/W    | R/W | R/W     | R/W
//!

use crate::register::*;
use crate::{define_aarch64_register, impl_system_register_rw};

define_aarch64_register! {
    @mair_el1<u64> {
        MAIR0 OFFSET(0) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR1 OFFSET(8) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR2 OFFSET(16) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR3 OFFSET(24) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR4 OFFSET(32) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR5 OFFSET(40) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR6 OFFSET(48) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ],
        MAIR7 OFFSET(56) BITS(8) [
            /// Device Memory nGnRnE
            NGNRNE = 0x00,
            /// Device Memory nGnRE
            NGNRE = 0x04,
            /// Device Memory GRE
            GRE = 0x0C,
            /// Normal Memory Outer and Inner non-cacheable
            NC = 0x44,
            /// Normal Memory Outer and Inner Write Back non transient
            NORM = 0xFF,
            /// Device Memory nGRE
            NGRE = 0x08,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTIWT = 0x33,
            /// Normal Memory Outer and Inner Write Through transient
            NOWTNTIWTNT = 0xBB,
            /// Normal Memory Outer and Inner Write Back transient
            NOWBTIWBT = 0x55
        ]
    }
}