1 // THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2 
3 /**
4  * Copyright (c) 2024 Raspberry Pi Ltd.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 // =============================================================================
9 // Register block : XIP
10 // Version        : 1
11 // Bus type       : ahb
12 // Description    : QSPI flash execute-in-place block
13 // =============================================================================
14 #ifndef _HARDWARE_REGS_XIP_H
15 #define _HARDWARE_REGS_XIP_H
16 // =============================================================================
17 // Register    : XIP_CTRL
18 // Description : Cache control register. Read-only from a Non-secure context.
19 #define XIP_CTRL_OFFSET _u(0x00000000)
20 #define XIP_CTRL_BITS   _u(0x00000ffb)
21 #define XIP_CTRL_RESET  _u(0x00000083)
22 // -----------------------------------------------------------------------------
23 // Field       : XIP_CTRL_WRITABLE_M1
24 // Description : If 1, enable writes to XIP memory window 1 (addresses
25 //               0x11000000 through 0x11ffffff, and their uncached mirrors). If
26 //               0, this region is read-only.
27 //
28 //               XIP memory is *read-only by default*. This bit must be set to
29 //               enable writes if a RAM device is attached on QSPI chip select
30 //               1.
31 //
32 //               The default read-only behaviour avoids two issues with writing
33 //               to a read-only QSPI device (e.g. flash). First, a write will
34 //               initially appear to succeed due to caching, but the data will
35 //               eventually be lost when the written line is evicted, causing
36 //               unpredictable behaviour.
37 //
38 //               Second, when a written line is evicted, it will cause a write
39 //               command to be issued to the flash, which can break the flash
40 //               out of its continuous read mode. After this point, flash reads
41 //               will return garbage. This is a security concern, as it allows
42 //               Non-secure software to break Secure flash reads if it has
43 //               permission to write to any flash address.
44 //
45 //               Note the read-only behaviour is implemented by downgrading
46 //               writes to reads, so writes will still cause allocation of an
47 //               address, but have no other effect.
48 #define XIP_CTRL_WRITABLE_M1_RESET  _u(0x0)
49 #define XIP_CTRL_WRITABLE_M1_BITS   _u(0x00000800)
50 #define XIP_CTRL_WRITABLE_M1_MSB    _u(11)
51 #define XIP_CTRL_WRITABLE_M1_LSB    _u(11)
52 #define XIP_CTRL_WRITABLE_M1_ACCESS "RW"
53 // -----------------------------------------------------------------------------
54 // Field       : XIP_CTRL_WRITABLE_M0
55 // Description : If 1, enable writes to XIP memory window 0 (addresses
56 //               0x10000000 through 0x10ffffff, and their uncached mirrors). If
57 //               0, this region is read-only.
58 //
59 //               XIP memory is *read-only by default*. This bit must be set to
60 //               enable writes if a RAM device is attached on QSPI chip select
61 //               0.
62 //
63 //               The default read-only behaviour avoids two issues with writing
64 //               to a read-only QSPI device (e.g. flash). First, a write will
65 //               initially appear to succeed due to caching, but the data will
66 //               eventually be lost when the written line is evicted, causing
67 //               unpredictable behaviour.
68 //
69 //               Second, when a written line is evicted, it will cause a write
70 //               command to be issued to the flash, which can break the flash
71 //               out of its continuous read mode. After this point, flash reads
72 //               will return garbage. This is a security concern, as it allows
73 //               Non-secure software to break Secure flash reads if it has
74 //               permission to write to any flash address.
75 //
76 //               Note the read-only behaviour is implemented by downgrading
77 //               writes to reads, so writes will still cause allocation of an
78 //               address, but have no other effect.
79 #define XIP_CTRL_WRITABLE_M0_RESET  _u(0x0)
80 #define XIP_CTRL_WRITABLE_M0_BITS   _u(0x00000400)
81 #define XIP_CTRL_WRITABLE_M0_MSB    _u(10)
82 #define XIP_CTRL_WRITABLE_M0_LSB    _u(10)
83 #define XIP_CTRL_WRITABLE_M0_ACCESS "RW"
84 // -----------------------------------------------------------------------------
85 // Field       : XIP_CTRL_SPLIT_WAYS
86 // Description : When 1, route all cached+Secure accesses to way 0 of the cache,
87 //               and route all cached+Non-secure accesses to way 1 of the cache.
88 //
89 //               This partitions the cache into two half-sized direct-mapped
90 //               regions, such that Non-secure code can not observe cache line
91 //               state changes caused by Secure execution.
92 //
93 //               A full cache flush is required when changing the value of
94 //               SPLIT_WAYS. The flush should be performed whilst SPLIT_WAYS is
95 //               0, so that both cache ways are accessible for invalidation.
96 #define XIP_CTRL_SPLIT_WAYS_RESET  _u(0x0)
97 #define XIP_CTRL_SPLIT_WAYS_BITS   _u(0x00000200)
98 #define XIP_CTRL_SPLIT_WAYS_MSB    _u(9)
99 #define XIP_CTRL_SPLIT_WAYS_LSB    _u(9)
100 #define XIP_CTRL_SPLIT_WAYS_ACCESS "RW"
101 // -----------------------------------------------------------------------------
102 // Field       : XIP_CTRL_MAINT_NONSEC
103 // Description : When 0, Non-secure accesses to the cache maintenance address
104 //               window (addr[27] == 1, addr[26] == 0) will generate a bus
105 //               error. When 1, Non-secure accesses can perform cache
106 //               maintenance operations by writing to the cache maintenance
107 //               address window.
108 //
109 //               Cache maintenance operations may be used to corrupt Secure data
110 //               by invalidating cache lines inappropriately, or map Secure
111 //               content into a Non-secure region by pinning cache lines.
112 //               Therefore this bit should generally be set to 0, unless Secure
113 //               code is not using the cache.
114 //
115 //               Care should also be taken to clear the cache data memory and
116 //               tag memory before granting maintenance operations to Non-secure
117 //               code.
118 #define XIP_CTRL_MAINT_NONSEC_RESET  _u(0x0)
119 #define XIP_CTRL_MAINT_NONSEC_BITS   _u(0x00000100)
120 #define XIP_CTRL_MAINT_NONSEC_MSB    _u(8)
121 #define XIP_CTRL_MAINT_NONSEC_LSB    _u(8)
122 #define XIP_CTRL_MAINT_NONSEC_ACCESS "RW"
123 // -----------------------------------------------------------------------------
124 // Field       : XIP_CTRL_NO_UNTRANSLATED_NONSEC
125 // Description : When 1, Non-secure accesses to the uncached, untranslated
126 //               window (addr[27:26] == 3) will generate a bus error.
127 #define XIP_CTRL_NO_UNTRANSLATED_NONSEC_RESET  _u(0x1)
128 #define XIP_CTRL_NO_UNTRANSLATED_NONSEC_BITS   _u(0x00000080)
129 #define XIP_CTRL_NO_UNTRANSLATED_NONSEC_MSB    _u(7)
130 #define XIP_CTRL_NO_UNTRANSLATED_NONSEC_LSB    _u(7)
131 #define XIP_CTRL_NO_UNTRANSLATED_NONSEC_ACCESS "RW"
132 // -----------------------------------------------------------------------------
133 // Field       : XIP_CTRL_NO_UNTRANSLATED_SEC
134 // Description : When 1, Secure accesses to the uncached, untranslated window
135 //               (addr[27:26] == 3) will generate a bus error.
136 #define XIP_CTRL_NO_UNTRANSLATED_SEC_RESET  _u(0x0)
137 #define XIP_CTRL_NO_UNTRANSLATED_SEC_BITS   _u(0x00000040)
138 #define XIP_CTRL_NO_UNTRANSLATED_SEC_MSB    _u(6)
139 #define XIP_CTRL_NO_UNTRANSLATED_SEC_LSB    _u(6)
140 #define XIP_CTRL_NO_UNTRANSLATED_SEC_ACCESS "RW"
141 // -----------------------------------------------------------------------------
142 // Field       : XIP_CTRL_NO_UNCACHED_NONSEC
143 // Description : When 1, Non-secure accesses to the uncached window (addr[27:26]
144 //               == 1) will generate a bus error. This may reduce the number of
145 //               SAU/MPU/PMP regions required to protect flash contents.
146 //
147 //               Note this does not disable access to the uncached, untranslated
148 //               window -- see NO_UNTRANSLATED_SEC.
149 #define XIP_CTRL_NO_UNCACHED_NONSEC_RESET  _u(0x0)
150 #define XIP_CTRL_NO_UNCACHED_NONSEC_BITS   _u(0x00000020)
151 #define XIP_CTRL_NO_UNCACHED_NONSEC_MSB    _u(5)
152 #define XIP_CTRL_NO_UNCACHED_NONSEC_LSB    _u(5)
153 #define XIP_CTRL_NO_UNCACHED_NONSEC_ACCESS "RW"
154 // -----------------------------------------------------------------------------
155 // Field       : XIP_CTRL_NO_UNCACHED_SEC
156 // Description : When 1, Secure accesses to the uncached window (addr[27:26] ==
157 //               1) will generate a bus error. This may reduce the number of
158 //               SAU/MPU/PMP regions required to protect flash contents.
159 //
160 //               Note this does not disable access to the uncached, untranslated
161 //               window -- see NO_UNTRANSLATED_SEC.
162 #define XIP_CTRL_NO_UNCACHED_SEC_RESET  _u(0x0)
163 #define XIP_CTRL_NO_UNCACHED_SEC_BITS   _u(0x00000010)
164 #define XIP_CTRL_NO_UNCACHED_SEC_MSB    _u(4)
165 #define XIP_CTRL_NO_UNCACHED_SEC_LSB    _u(4)
166 #define XIP_CTRL_NO_UNCACHED_SEC_ACCESS "RW"
167 // -----------------------------------------------------------------------------
168 // Field       : XIP_CTRL_POWER_DOWN
169 // Description : When 1, the cache memories are powered down. They retain state,
170 //               but can not be accessed. This reduces static power dissipation.
171 //               Writing 1 to this bit forces CTRL_EN_SECURE and
172 //               CTRL_EN_NONSECURE to 0, i.e. the cache cannot be enabled when
173 //               powered down.
174 #define XIP_CTRL_POWER_DOWN_RESET  _u(0x0)
175 #define XIP_CTRL_POWER_DOWN_BITS   _u(0x00000008)
176 #define XIP_CTRL_POWER_DOWN_MSB    _u(3)
177 #define XIP_CTRL_POWER_DOWN_LSB    _u(3)
178 #define XIP_CTRL_POWER_DOWN_ACCESS "RW"
179 // -----------------------------------------------------------------------------
180 // Field       : XIP_CTRL_EN_NONSECURE
181 // Description : When 1, enable the cache for Non-secure accesses. When enabled,
182 //               Non-secure XIP accesses to the cached (addr[26] == 0) window
183 //               will query the cache, and QSPI accesses are performed only if
184 //               the requested data is not present. When disabled, Secure access
185 //               ignore the cache contents, and always access the QSPI
186 //               interface.
187 //
188 //               Accesses to the uncached (addr[26] == 1) window will never
189 //               query the cache, irrespective of this bit.
190 #define XIP_CTRL_EN_NONSECURE_RESET  _u(0x1)
191 #define XIP_CTRL_EN_NONSECURE_BITS   _u(0x00000002)
192 #define XIP_CTRL_EN_NONSECURE_MSB    _u(1)
193 #define XIP_CTRL_EN_NONSECURE_LSB    _u(1)
194 #define XIP_CTRL_EN_NONSECURE_ACCESS "RW"
195 // -----------------------------------------------------------------------------
196 // Field       : XIP_CTRL_EN_SECURE
197 // Description : When 1, enable the cache for Secure accesses. When enabled,
198 //               Secure XIP accesses to the cached (addr[26] == 0) window will
199 //               query the cache, and QSPI accesses are performed only if the
200 //               requested data is not present. When disabled, Secure access
201 //               ignore the cache contents, and always access the QSPI
202 //               interface.
203 //
204 //               Accesses to the uncached (addr[26] == 1) window will never
205 //               query the cache, irrespective of this bit.
206 //
207 //               There is no cache-as-SRAM address window. Cache lines are
208 //               allocated for SRAM-like use by individually pinning them, and
209 //               keeping the cache enabled.
210 #define XIP_CTRL_EN_SECURE_RESET  _u(0x1)
211 #define XIP_CTRL_EN_SECURE_BITS   _u(0x00000001)
212 #define XIP_CTRL_EN_SECURE_MSB    _u(0)
213 #define XIP_CTRL_EN_SECURE_LSB    _u(0)
214 #define XIP_CTRL_EN_SECURE_ACCESS "RW"
215 // =============================================================================
216 // Register    : XIP_STAT
217 #define XIP_STAT_OFFSET _u(0x00000008)
218 #define XIP_STAT_BITS   _u(0x00000006)
219 #define XIP_STAT_RESET  _u(0x00000002)
220 // -----------------------------------------------------------------------------
221 // Field       : XIP_STAT_FIFO_FULL
222 // Description : When 1, indicates the XIP streaming FIFO is completely full.
223 //               The streaming FIFO is 2 entries deep, so the full and empty
224 //               flag allow its level to be ascertained.
225 #define XIP_STAT_FIFO_FULL_RESET  _u(0x0)
226 #define XIP_STAT_FIFO_FULL_BITS   _u(0x00000004)
227 #define XIP_STAT_FIFO_FULL_MSB    _u(2)
228 #define XIP_STAT_FIFO_FULL_LSB    _u(2)
229 #define XIP_STAT_FIFO_FULL_ACCESS "RO"
230 // -----------------------------------------------------------------------------
231 // Field       : XIP_STAT_FIFO_EMPTY
232 // Description : When 1, indicates the XIP streaming FIFO is completely empty.
233 #define XIP_STAT_FIFO_EMPTY_RESET  _u(0x1)
234 #define XIP_STAT_FIFO_EMPTY_BITS   _u(0x00000002)
235 #define XIP_STAT_FIFO_EMPTY_MSB    _u(1)
236 #define XIP_STAT_FIFO_EMPTY_LSB    _u(1)
237 #define XIP_STAT_FIFO_EMPTY_ACCESS "RO"
238 // =============================================================================
239 // Register    : XIP_CTR_HIT
240 // Description : Cache Hit counter
241 //               A 32 bit saturating counter that increments upon each cache
242 //               hit,
243 //               i.e. when an XIP access is serviced directly from cached data.
244 //               Write any value to clear.
245 #define XIP_CTR_HIT_OFFSET _u(0x0000000c)
246 #define XIP_CTR_HIT_BITS   _u(0xffffffff)
247 #define XIP_CTR_HIT_RESET  _u(0x00000000)
248 #define XIP_CTR_HIT_MSB    _u(31)
249 #define XIP_CTR_HIT_LSB    _u(0)
250 #define XIP_CTR_HIT_ACCESS "WC"
251 // =============================================================================
252 // Register    : XIP_CTR_ACC
253 // Description : Cache Access counter
254 //               A 32 bit saturating counter that increments upon each XIP
255 //               access,
256 //               whether the cache is hit or not. This includes noncacheable
257 //               accesses.
258 //               Write any value to clear.
259 #define XIP_CTR_ACC_OFFSET _u(0x00000010)
260 #define XIP_CTR_ACC_BITS   _u(0xffffffff)
261 #define XIP_CTR_ACC_RESET  _u(0x00000000)
262 #define XIP_CTR_ACC_MSB    _u(31)
263 #define XIP_CTR_ACC_LSB    _u(0)
264 #define XIP_CTR_ACC_ACCESS "WC"
265 // =============================================================================
266 // Register    : XIP_STREAM_ADDR
267 // Description : FIFO stream address
268 //               The address of the next word to be streamed from flash to the
269 //               streaming FIFO.
270 //               Increments automatically after each flash access.
271 //               Write the initial access address here before starting a
272 //               streaming read.
273 #define XIP_STREAM_ADDR_OFFSET _u(0x00000014)
274 #define XIP_STREAM_ADDR_BITS   _u(0xfffffffc)
275 #define XIP_STREAM_ADDR_RESET  _u(0x00000000)
276 #define XIP_STREAM_ADDR_MSB    _u(31)
277 #define XIP_STREAM_ADDR_LSB    _u(2)
278 #define XIP_STREAM_ADDR_ACCESS "RW"
279 // =============================================================================
280 // Register    : XIP_STREAM_CTR
281 // Description : FIFO stream control
282 //               Write a nonzero value to start a streaming read. This will then
283 //               progress in the background, using flash idle cycles to transfer
284 //               a linear data block from flash to the streaming FIFO.
285 //               Decrements automatically (1 at a time) as the stream
286 //               progresses, and halts on reaching 0.
287 //               Write 0 to halt an in-progress stream, and discard any in-
288 //               flight
289 //               read, so that a new stream can immediately be started (after
290 //               draining the FIFO and reinitialising STREAM_ADDR)
291 #define XIP_STREAM_CTR_OFFSET _u(0x00000018)
292 #define XIP_STREAM_CTR_BITS   _u(0x003fffff)
293 #define XIP_STREAM_CTR_RESET  _u(0x00000000)
294 #define XIP_STREAM_CTR_MSB    _u(21)
295 #define XIP_STREAM_CTR_LSB    _u(0)
296 #define XIP_STREAM_CTR_ACCESS "RW"
297 // =============================================================================
298 // Register    : XIP_STREAM_FIFO
299 // Description : FIFO stream data
300 //               Streamed data is buffered here, for retrieval by the system
301 //               DMA.
302 //               This FIFO can also be accessed via the XIP_AUX slave, to avoid
303 //               exposing
304 //               the DMA to bus stalls caused by other XIP traffic.
305 #define XIP_STREAM_FIFO_OFFSET _u(0x0000001c)
306 #define XIP_STREAM_FIFO_BITS   _u(0xffffffff)
307 #define XIP_STREAM_FIFO_RESET  _u(0x00000000)
308 #define XIP_STREAM_FIFO_MSB    _u(31)
309 #define XIP_STREAM_FIFO_LSB    _u(0)
310 #define XIP_STREAM_FIFO_ACCESS "RF"
311 // =============================================================================
312 #endif // _HARDWARE_REGS_XIP_H
313 
314