Implement program buffer preexec/postexec.
[riscv-isa-sim.git] / riscv / debug_defines.h
1 #define AC_ACCESS_REGISTER None
2 /*
3 * 2: Access the lowest 32 bits of the register.
4 *
5 * 3: Access the lowest 64 bits of the register.
6 *
7 * 4: Access the lowest 128 bits of the register.
8 *
9 * If \Fsize specifies a size larger than the register is, then the
10 * access must fail. If a register is accessible, then \Fsize matching
11 * the register's actual size must be supported.
12 */
13 #define AC_ACCESS_REGISTER_SIZE_OFFSET 19
14 #define AC_ACCESS_REGISTER_SIZE_LENGTH 3
15 #define AC_ACCESS_REGISTER_SIZE (0x7 << AC_ACCESS_REGISTER_SIZE_OFFSET)
16 /*
17 * When 1, execute the program in the Program Buffer exactly once
18 * before performing the read/write.
19 */
20 #define AC_ACCESS_REGISTER_PREEXEC_OFFSET 18
21 #define AC_ACCESS_REGISTER_PREEXEC_LENGTH 1
22 #define AC_ACCESS_REGISTER_PREEXEC (0x1 << AC_ACCESS_REGISTER_PREEXEC_OFFSET)
23 /*
24 * When 1, execute the program in the Program Buffer exactly once
25 * after performing the read/write.
26 */
27 #define AC_ACCESS_REGISTER_POSTEXEC_OFFSET 17
28 #define AC_ACCESS_REGISTER_POSTEXEC_LENGTH 1
29 #define AC_ACCESS_REGISTER_POSTEXEC (0x1 << AC_ACCESS_REGISTER_POSTEXEC_OFFSET)
30 /*
31 * 0: Copy data from \Rdatazero into the specified register.
32 *
33 * 1: Copy data from the specified register into \Rdatazero.
34 *
35 * (If XLEN is greater than 32, more {\tt data} registers are involved.)
36 */
37 #define AC_ACCESS_REGISTER_WRITE_OFFSET 16
38 #define AC_ACCESS_REGISTER_WRITE_LENGTH 1
39 #define AC_ACCESS_REGISTER_WRITE (0x1 << AC_ACCESS_REGISTER_WRITE_OFFSET)
40 /*
41 * Number of the register to access, as described in Table~\ref{tab:regno}.
42 */
43 #define AC_ACCESS_REGISTER_REGNO_OFFSET 0
44 #define AC_ACCESS_REGISTER_REGNO_LENGTH 16
45 #define AC_ACCESS_REGISTER_REGNO (0xffff << AC_ACCESS_REGISTER_REGNO_OFFSET)
46 #define AC_QUICK_ACCESS None
47 #define AC_QUICK_ACCESS_1_OFFSET 24
48 #define AC_QUICK_ACCESS_1_LENGTH 8
49 #define AC_QUICK_ACCESS_1 (0xff << AC_QUICK_ACCESS_1_OFFSET)
50 #define CSR_DCSR 0x7b0
51 /*
52 * 0: There is no external debug support.
53 *
54 * 1: External debug support exists as it is described in this document.
55 *
56 * Other values are reserved for future standards.
57 */
58 #define CSR_DCSR_XDEBUGVER_OFFSET 30
59 #define CSR_DCSR_XDEBUGVER_LENGTH 2
60 #define CSR_DCSR_XDEBUGVER (0x3 << CSR_DCSR_XDEBUGVER_OFFSET)
61 /*
62 * When 1, {\tt ebreak} instructions in Machine Mode enter Halt Mode.
63 */
64 #define CSR_DCSR_EBREAKM_OFFSET 15
65 #define CSR_DCSR_EBREAKM_LENGTH 1
66 #define CSR_DCSR_EBREAKM (0x1 << CSR_DCSR_EBREAKM_OFFSET)
67 /*
68 * When 1, {\tt ebreak} instructions in Hypervisor Mode enter Halt Mode.
69 */
70 #define CSR_DCSR_EBREAKH_OFFSET 14
71 #define CSR_DCSR_EBREAKH_LENGTH 1
72 #define CSR_DCSR_EBREAKH (0x1 << CSR_DCSR_EBREAKH_OFFSET)
73 /*
74 * When 1, {\tt ebreak} instructions in Supervisor Mode enter Halt Mode.
75 */
76 #define CSR_DCSR_EBREAKS_OFFSET 13
77 #define CSR_DCSR_EBREAKS_LENGTH 1
78 #define CSR_DCSR_EBREAKS (0x1 << CSR_DCSR_EBREAKS_OFFSET)
79 /*
80 * When 1, {\tt ebreak} instructions in User/Application Mode enter
81 * Halt Mode.
82 */
83 #define CSR_DCSR_EBREAKU_OFFSET 12
84 #define CSR_DCSR_EBREAKU_LENGTH 1
85 #define CSR_DCSR_EBREAKU (0x1 << CSR_DCSR_EBREAKU_OFFSET)
86 /*
87 * Controls the behavior of any counters while the component is in
88 * Halt Mode. This includes the {\tt cycle} and {\tt instret} CSRs.
89 * When 1, counters are stopped when the component is in Halt Mode.
90 * Otherwise, the counters continue to run.
91 *
92 * An implementation may choose not to support writing to this bit.
93 * The debugger must read back the value it writes to check whether
94 * the feature is supported.
95 */
96 #define CSR_DCSR_STOPCYCLE_OFFSET 10
97 #define CSR_DCSR_STOPCYCLE_LENGTH 1
98 #define CSR_DCSR_STOPCYCLE (0x1 << CSR_DCSR_STOPCYCLE_OFFSET)
99 /*
100 * Controls the behavior of any timers while the component is in Debug
101 * Mode. This includes the {\tt time} and {tt timeh} CSRs. When 1,
102 * timers are stopped when the component is in Halt Mode. Otherwise,
103 * the timers continue to run.
104 *
105 * An implementation may choose not to support writing to this bit.
106 * The debugger must read back the value it writes to check whether
107 * the feature is supported.
108 */
109 #define CSR_DCSR_STOPTIME_OFFSET 9
110 #define CSR_DCSR_STOPTIME_LENGTH 1
111 #define CSR_DCSR_STOPTIME (0x1 << CSR_DCSR_STOPTIME_OFFSET)
112 /*
113 * Explains why Halt Mode was entered.
114 *
115 * When there are multiple reasons to enter Halt Mode in a single
116 * cycle, the cause with the highest priority is the one written.
117 *
118 * 1: A software breakpoint was hit. (priority 3)
119 *
120 * 2: The Trigger Module caused a halt. (priority 4)
121 *
122 * 3: The debug interrupt was asserted by the Debug Module. (priority 2)
123 *
124 * 4: The hart single stepped because \Fstep was set. (priority 1)
125 *
126 * 5: \Fhaltreq was set. (priority 0)
127 *
128 * Other values are reserved for future use.
129 */
130 #define CSR_DCSR_CAUSE_OFFSET 6
131 #define CSR_DCSR_CAUSE_LENGTH 3
132 #define CSR_DCSR_CAUSE (0x7 << CSR_DCSR_CAUSE_OFFSET)
133 /*
134 * When set and not in Halt Mode, the hart will only execute a single
135 * instruction, and then enter Halt Mode. Interrupts are disabled
136 * when this bit is set.
137 */
138 #define CSR_DCSR_STEP_OFFSET 2
139 #define CSR_DCSR_STEP_LENGTH 1
140 #define CSR_DCSR_STEP (0x1 << CSR_DCSR_STEP_OFFSET)
141 /*
142 * Contains the privilege level the hart was operating in when Debug
143 * Mode was entered. The encoding is describe in Table
144 * \ref{tab:privlevel}. A debugger can change this value to change
145 * the hart's privilege level when exiting Halt Mode.
146 *
147 * Not all privilege levels are supported on all harts. If the
148 * encoding written is not supported or the debugger is not allowed to
149 * change to it, the hart may change to any supported privilege level.
150 */
151 #define CSR_DCSR_PRV_OFFSET 0
152 #define CSR_DCSR_PRV_LENGTH 2
153 #define CSR_DCSR_PRV (0x3 << CSR_DCSR_PRV_OFFSET)
154 #define CSR_DPC 0x7b1
155 #define CSR_DPC_DPC_OFFSET 0
156 #define CSR_DPC_DPC_LENGTH XLEN
157 #define CSR_DPC_DPC (((1L<<XLEN)-1) << CSR_DPC_DPC_OFFSET)
158 #define CSR_DSCRATCH0 0x7b2
159 #define CSR_DSCRATCH1 0x7b3
160 #define CSR_PRIV virtual
161 /*
162 * Contains the privilege level the hart was operating in when Debug
163 * Mode was entered. The encoding is describe in Table
164 * \ref{tab:privlevel}. A user can write this value to change the
165 * hart's privilege level when exiting Halt Mode.
166 */
167 #define CSR_PRIV_PRV_OFFSET 0
168 #define CSR_PRIV_PRV_LENGTH 2
169 #define CSR_PRIV_PRV (0x3 << CSR_PRIV_PRV_OFFSET)
170 #define DMI_DMCONTROL 0x00
171 /*
172 * Halt request signal for the hart selected by \Fhartsel. Writes
173 * apply to the new value of \Fhartsel.
174 */
175 #define DMI_DMCONTROL_HALTREQ_OFFSET 31
176 #define DMI_DMCONTROL_HALTREQ_LENGTH 1
177 #define DMI_DMCONTROL_HALTREQ (0x1 << DMI_DMCONTROL_HALTREQ_OFFSET)
178 /*
179 * This bit controls the reset signal from the DM to the rest of the
180 * system. To perform a reset the debugger writes 1, and then writes 0
181 * to deassert the reset.
182 */
183 #define DMI_DMCONTROL_RESET_OFFSET 30
184 #define DMI_DMCONTROL_RESET_LENGTH 1
185 #define DMI_DMCONTROL_RESET (0x1 << DMI_DMCONTROL_RESET_OFFSET)
186 /*
187 * This bit serves as a reset signal for the Debug Module itself.
188 * When 0, the module is held in reset. When 1, it functions normally.
189 * No other mechanism should exist that may result in resetting the
190 * Debug Module after power up, including the platform's system reset
191 * or Debug Transport reset signals.
192 *
193 * A debugger should pulse this bit low to ensure that the Debug
194 * Module is fully reset and ready to use.
195 *
196 * Implementations may use this bit to aid debugging, for example by
197 * preventing the Debug Module from being power gated while debugging
198 * is active.
199 */
200 #define DMI_DMCONTROL_DMACTIVE_OFFSET 29
201 #define DMI_DMCONTROL_DMACTIVE_LENGTH 1
202 #define DMI_DMCONTROL_DMACTIVE (0x1 << DMI_DMCONTROL_DMACTIVE_OFFSET)
203 /*
204 * The status of the currently selected hart.
205 *
206 * 0: Halted.
207 *
208 * 1: Running.
209 *
210 * 2: Unavailable (eg. powered down, held in reset).
211 *
212 * 3: \Fhartsel specifies a hart that does not exist in this system.
213 */
214 #define DMI_DMCONTROL_HARTSTATUS_OFFSET 26
215 #define DMI_DMCONTROL_HARTSTATUS_LENGTH 2
216 #define DMI_DMCONTROL_HARTSTATUS (0x3 << DMI_DMCONTROL_HARTSTATUS_OFFSET)
217 /*
218 * The DM-specific index of the hart to select.
219 */
220 #define DMI_DMCONTROL_HARTSEL_OFFSET 16
221 #define DMI_DMCONTROL_HARTSEL_LENGTH 10
222 #define DMI_DMCONTROL_HARTSEL (0x3ff << DMI_DMCONTROL_HARTSEL_OFFSET)
223 /*
224 * 0 when authentication is required before using the DM. 1 when the
225 * authentication check has passed. On components that don't implement
226 * authentication, this bit must be preset as 1.
227 */
228 #define DMI_DMCONTROL_AUTHENTICATED_OFFSET 7
229 #define DMI_DMCONTROL_AUTHENTICATED_LENGTH 1
230 #define DMI_DMCONTROL_AUTHENTICATED (0x1 << DMI_DMCONTROL_AUTHENTICATED_OFFSET)
231 /*
232 * While 1, writes to \Rauthdatazero and \Rauthdataone may be ignored
233 * or may result in authentication failing. Authentication mechanisms
234 * that are slow (or intentionally delayed) must set this bit when
235 * they're not ready to process another write.
236 */
237 #define DMI_DMCONTROL_AUTHBUSY_OFFSET 6
238 #define DMI_DMCONTROL_AUTHBUSY_LENGTH 1
239 #define DMI_DMCONTROL_AUTHBUSY (0x1 << DMI_DMCONTROL_AUTHBUSY_OFFSET)
240 /*
241 * Defines the kind of authentication required to use this DM.
242 *
243 * 0: No authentication is required.
244 *
245 * 1: A password is required.
246 *
247 * 2: A challenge-response mechanism is in place.
248 *
249 * 3: Reserved for future use.
250 */
251 #define DMI_DMCONTROL_AUTHTYPE_OFFSET 4
252 #define DMI_DMCONTROL_AUTHTYPE_LENGTH 2
253 #define DMI_DMCONTROL_AUTHTYPE (0x3 << DMI_DMCONTROL_AUTHTYPE_OFFSET)
254 /*
255 * 0: There is no Debug Module present.
256 *
257 * 1: There is a Debug Module and it conforms to version 0.12 of this
258 * specification.
259 *
260 * Other values are reserved for future use.
261 */
262 #define DMI_DMCONTROL_VERSION_OFFSET 0
263 #define DMI_DMCONTROL_VERSION_LENGTH 4
264 #define DMI_DMCONTROL_VERSION (0xf << DMI_DMCONTROL_VERSION_OFFSET)
265 #define DMI_HARTINFO 0x01
266 /*
267 * 0: The {\tt data} registers are shadowed in the hart by CSR
268 * registers. Each CSR register is XLEN bits in size, and corresponds
269 * to a single argument, per Table~\ref{tab:datareg}.
270 *
271 * 1: The {\tt data} registers are shadowed in the hart's memory map.
272 * Each register takes up 4 bytes in the memory map.
273 */
274 #define DMI_HARTINFO_DATAACCESS_OFFSET 16
275 #define DMI_HARTINFO_DATAACCESS_LENGTH 1
276 #define DMI_HARTINFO_DATAACCESS (0x1 << DMI_HARTINFO_DATAACCESS_OFFSET)
277 /*
278 * If \Fdataaccess is 0: Number of CSR registers dedicated to
279 * shadowing the {\tt data} registers.
280 *
281 * If \Fdataaccess is 1: Number of 32-bit words in the memory map
282 * dedicated to shadowing the {\tt data} registers.
283 */
284 #define DMI_HARTINFO_DATASIZE_OFFSET 12
285 #define DMI_HARTINFO_DATASIZE_LENGTH 4
286 #define DMI_HARTINFO_DATASIZE (0xf << DMI_HARTINFO_DATASIZE_OFFSET)
287 /*
288 * If \Fdataaccess is 0: The number of the first CSR dedicated to
289 * shadowing the {\tt data} registers.
290 *
291 * If \Fdataaccess is 1: Signed address of RAM where the {\tt data}
292 * registers are shadowed.
293 */
294 #define DMI_HARTINFO_DATAADDR_OFFSET 0
295 #define DMI_HARTINFO_DATAADDR_LENGTH 12
296 #define DMI_HARTINFO_DATAADDR (0xfff << DMI_HARTINFO_DATAADDR_OFFSET)
297 #define DMI_HALTSUM 0x02
298 #define DMI_HALTSUM_HALT1023_992_OFFSET 31
299 #define DMI_HALTSUM_HALT1023_992_LENGTH 1
300 #define DMI_HALTSUM_HALT1023_992 (0x1 << DMI_HALTSUM_HALT1023_992_OFFSET)
301 #define DMI_HALTSUM_HALT991_960_OFFSET 30
302 #define DMI_HALTSUM_HALT991_960_LENGTH 1
303 #define DMI_HALTSUM_HALT991_960 (0x1 << DMI_HALTSUM_HALT991_960_OFFSET)
304 #define DMI_HALTSUM_HALT959_928_OFFSET 29
305 #define DMI_HALTSUM_HALT959_928_LENGTH 1
306 #define DMI_HALTSUM_HALT959_928 (0x1 << DMI_HALTSUM_HALT959_928_OFFSET)
307 #define DMI_HALTSUM_HALT927_896_OFFSET 28
308 #define DMI_HALTSUM_HALT927_896_LENGTH 1
309 #define DMI_HALTSUM_HALT927_896 (0x1 << DMI_HALTSUM_HALT927_896_OFFSET)
310 #define DMI_HALTSUM_HALT895_864_OFFSET 27
311 #define DMI_HALTSUM_HALT895_864_LENGTH 1
312 #define DMI_HALTSUM_HALT895_864 (0x1 << DMI_HALTSUM_HALT895_864_OFFSET)
313 #define DMI_HALTSUM_HALT863_832_OFFSET 26
314 #define DMI_HALTSUM_HALT863_832_LENGTH 1
315 #define DMI_HALTSUM_HALT863_832 (0x1 << DMI_HALTSUM_HALT863_832_OFFSET)
316 #define DMI_HALTSUM_HALT831_800_OFFSET 25
317 #define DMI_HALTSUM_HALT831_800_LENGTH 1
318 #define DMI_HALTSUM_HALT831_800 (0x1 << DMI_HALTSUM_HALT831_800_OFFSET)
319 #define DMI_HALTSUM_HALT799_768_OFFSET 24
320 #define DMI_HALTSUM_HALT799_768_LENGTH 1
321 #define DMI_HALTSUM_HALT799_768 (0x1 << DMI_HALTSUM_HALT799_768_OFFSET)
322 #define DMI_HALTSUM_HALT767_736_OFFSET 23
323 #define DMI_HALTSUM_HALT767_736_LENGTH 1
324 #define DMI_HALTSUM_HALT767_736 (0x1 << DMI_HALTSUM_HALT767_736_OFFSET)
325 #define DMI_HALTSUM_HALT735_704_OFFSET 22
326 #define DMI_HALTSUM_HALT735_704_LENGTH 1
327 #define DMI_HALTSUM_HALT735_704 (0x1 << DMI_HALTSUM_HALT735_704_OFFSET)
328 #define DMI_HALTSUM_HALT703_672_OFFSET 21
329 #define DMI_HALTSUM_HALT703_672_LENGTH 1
330 #define DMI_HALTSUM_HALT703_672 (0x1 << DMI_HALTSUM_HALT703_672_OFFSET)
331 #define DMI_HALTSUM_HALT671_640_OFFSET 20
332 #define DMI_HALTSUM_HALT671_640_LENGTH 1
333 #define DMI_HALTSUM_HALT671_640 (0x1 << DMI_HALTSUM_HALT671_640_OFFSET)
334 #define DMI_HALTSUM_HALT639_608_OFFSET 19
335 #define DMI_HALTSUM_HALT639_608_LENGTH 1
336 #define DMI_HALTSUM_HALT639_608 (0x1 << DMI_HALTSUM_HALT639_608_OFFSET)
337 #define DMI_HALTSUM_HALT607_576_OFFSET 18
338 #define DMI_HALTSUM_HALT607_576_LENGTH 1
339 #define DMI_HALTSUM_HALT607_576 (0x1 << DMI_HALTSUM_HALT607_576_OFFSET)
340 #define DMI_HALTSUM_HALT575_544_OFFSET 17
341 #define DMI_HALTSUM_HALT575_544_LENGTH 1
342 #define DMI_HALTSUM_HALT575_544 (0x1 << DMI_HALTSUM_HALT575_544_OFFSET)
343 #define DMI_HALTSUM_HALT543_512_OFFSET 16
344 #define DMI_HALTSUM_HALT543_512_LENGTH 1
345 #define DMI_HALTSUM_HALT543_512 (0x1 << DMI_HALTSUM_HALT543_512_OFFSET)
346 #define DMI_HALTSUM_HALT511_480_OFFSET 15
347 #define DMI_HALTSUM_HALT511_480_LENGTH 1
348 #define DMI_HALTSUM_HALT511_480 (0x1 << DMI_HALTSUM_HALT511_480_OFFSET)
349 #define DMI_HALTSUM_HALT479_448_OFFSET 14
350 #define DMI_HALTSUM_HALT479_448_LENGTH 1
351 #define DMI_HALTSUM_HALT479_448 (0x1 << DMI_HALTSUM_HALT479_448_OFFSET)
352 #define DMI_HALTSUM_HALT447_416_OFFSET 13
353 #define DMI_HALTSUM_HALT447_416_LENGTH 1
354 #define DMI_HALTSUM_HALT447_416 (0x1 << DMI_HALTSUM_HALT447_416_OFFSET)
355 #define DMI_HALTSUM_HALT415_384_OFFSET 12
356 #define DMI_HALTSUM_HALT415_384_LENGTH 1
357 #define DMI_HALTSUM_HALT415_384 (0x1 << DMI_HALTSUM_HALT415_384_OFFSET)
358 #define DMI_HALTSUM_HALT383_352_OFFSET 11
359 #define DMI_HALTSUM_HALT383_352_LENGTH 1
360 #define DMI_HALTSUM_HALT383_352 (0x1 << DMI_HALTSUM_HALT383_352_OFFSET)
361 #define DMI_HALTSUM_HALT351_320_OFFSET 10
362 #define DMI_HALTSUM_HALT351_320_LENGTH 1
363 #define DMI_HALTSUM_HALT351_320 (0x1 << DMI_HALTSUM_HALT351_320_OFFSET)
364 #define DMI_HALTSUM_HALT319_288_OFFSET 9
365 #define DMI_HALTSUM_HALT319_288_LENGTH 1
366 #define DMI_HALTSUM_HALT319_288 (0x1 << DMI_HALTSUM_HALT319_288_OFFSET)
367 #define DMI_HALTSUM_HALT287_256_OFFSET 8
368 #define DMI_HALTSUM_HALT287_256_LENGTH 1
369 #define DMI_HALTSUM_HALT287_256 (0x1 << DMI_HALTSUM_HALT287_256_OFFSET)
370 #define DMI_HALTSUM_HALT255_224_OFFSET 7
371 #define DMI_HALTSUM_HALT255_224_LENGTH 1
372 #define DMI_HALTSUM_HALT255_224 (0x1 << DMI_HALTSUM_HALT255_224_OFFSET)
373 #define DMI_HALTSUM_HALT223_192_OFFSET 6
374 #define DMI_HALTSUM_HALT223_192_LENGTH 1
375 #define DMI_HALTSUM_HALT223_192 (0x1 << DMI_HALTSUM_HALT223_192_OFFSET)
376 #define DMI_HALTSUM_HALT191_160_OFFSET 5
377 #define DMI_HALTSUM_HALT191_160_LENGTH 1
378 #define DMI_HALTSUM_HALT191_160 (0x1 << DMI_HALTSUM_HALT191_160_OFFSET)
379 #define DMI_HALTSUM_HALT159_128_OFFSET 4
380 #define DMI_HALTSUM_HALT159_128_LENGTH 1
381 #define DMI_HALTSUM_HALT159_128 (0x1 << DMI_HALTSUM_HALT159_128_OFFSET)
382 #define DMI_HALTSUM_HALT127_96_OFFSET 3
383 #define DMI_HALTSUM_HALT127_96_LENGTH 1
384 #define DMI_HALTSUM_HALT127_96 (0x1 << DMI_HALTSUM_HALT127_96_OFFSET)
385 #define DMI_HALTSUM_HALT95_64_OFFSET 2
386 #define DMI_HALTSUM_HALT95_64_LENGTH 1
387 #define DMI_HALTSUM_HALT95_64 (0x1 << DMI_HALTSUM_HALT95_64_OFFSET)
388 #define DMI_HALTSUM_HALT63_32_OFFSET 1
389 #define DMI_HALTSUM_HALT63_32_LENGTH 1
390 #define DMI_HALTSUM_HALT63_32 (0x1 << DMI_HALTSUM_HALT63_32_OFFSET)
391 #define DMI_HALTSUM_HALT31_0_OFFSET 0
392 #define DMI_HALTSUM_HALT31_0_LENGTH 1
393 #define DMI_HALTSUM_HALT31_0 (0x1 << DMI_HALTSUM_HALT31_0_OFFSET)
394 #define DMI_SBCS 0x03
395 /*
396 * When a 1 is written here, triggers a read at the address in {\tt
397 * sbaddress} using the access size set by \Fsbaccess.
398 */
399 #define DMI_SBCS_SBSINGLEREAD_OFFSET 20
400 #define DMI_SBCS_SBSINGLEREAD_LENGTH 1
401 #define DMI_SBCS_SBSINGLEREAD (0x1 << DMI_SBCS_SBSINGLEREAD_OFFSET)
402 /*
403 * Select the access size to use for system bus accesses triggered by
404 * writes to the {\tt sbaddress} registers or \Rsbdatazero.
405 *
406 * 0: 8-bit
407 *
408 * 1: 16-bit
409 *
410 * 2: 32-bit
411 *
412 * 3: 64-bit
413 *
414 * 4: 128-bit
415 *
416 * If an unsupported system bus access size is written here,
417 * the DM may not
418 * perform the access, or may perform the access with any access size
419 */
420 #define DMI_SBCS_SBACCESS_OFFSET 17
421 #define DMI_SBCS_SBACCESS_LENGTH 3
422 #define DMI_SBCS_SBACCESS (0x7 << DMI_SBCS_SBACCESS_OFFSET)
423 /*
424 * When 1, the internal address value (used by the system bus master)
425 * is incremented by the access size (in bytes) selected in \Fsbaccess
426 * after every system bus access.
427 */
428 #define DMI_SBCS_SBAUTOINCREMENT_OFFSET 16
429 #define DMI_SBCS_SBAUTOINCREMENT_LENGTH 1
430 #define DMI_SBCS_SBAUTOINCREMENT (0x1 << DMI_SBCS_SBAUTOINCREMENT_OFFSET)
431 /*
432 * When 1, every read from \Rsbdatazero automatically triggers a system
433 * bus read at the new address.
434 */
435 #define DMI_SBCS_SBAUTOREAD_OFFSET 15
436 #define DMI_SBCS_SBAUTOREAD_LENGTH 1
437 #define DMI_SBCS_SBAUTOREAD (0x1 << DMI_SBCS_SBAUTOREAD_OFFSET)
438 /*
439 * When the debug module's system bus
440 * master causes a bus error, this field gets set.
441 * It remains set until 0 is written to any bit in this field. Until
442 * that happens, the system bus master is busy and no more accesses can be
443 * initiated by the debug module.
444 *
445 * 0: There was no bus error.
446 *
447 * 1: There was a timeout.
448 *
449 * 2: A bad address was accessed.
450 *
451 * 3: There was some other error (eg. alignment).
452 *
453 * 4: The system bus master was busy when a one of the {\tt sbaddress} or
454 * {\tt sbdata} registers was written.
455 */
456 #define DMI_SBCS_SBERROR_OFFSET 12
457 #define DMI_SBCS_SBERROR_LENGTH 3
458 #define DMI_SBCS_SBERROR (0x7 << DMI_SBCS_SBERROR_OFFSET)
459 /*
460 * Width of system bus addresses in bits. (0 indicates there is no bus
461 * access support.)
462 */
463 #define DMI_SBCS_SBASIZE_OFFSET 5
464 #define DMI_SBCS_SBASIZE_LENGTH 7
465 #define DMI_SBCS_SBASIZE (0x7f << DMI_SBCS_SBASIZE_OFFSET)
466 /*
467 * 1 when 128-bit system bus accesses are supported.
468 */
469 #define DMI_SBCS_SBACCESS128_OFFSET 4
470 #define DMI_SBCS_SBACCESS128_LENGTH 1
471 #define DMI_SBCS_SBACCESS128 (0x1 << DMI_SBCS_SBACCESS128_OFFSET)
472 /*
473 * 1 when 64-bit system bus accesses are supported.
474 */
475 #define DMI_SBCS_SBACCESS64_OFFSET 3
476 #define DMI_SBCS_SBACCESS64_LENGTH 1
477 #define DMI_SBCS_SBACCESS64 (0x1 << DMI_SBCS_SBACCESS64_OFFSET)
478 /*
479 * 1 when 32-bit system bus accesses are supported.
480 */
481 #define DMI_SBCS_SBACCESS32_OFFSET 2
482 #define DMI_SBCS_SBACCESS32_LENGTH 1
483 #define DMI_SBCS_SBACCESS32 (0x1 << DMI_SBCS_SBACCESS32_OFFSET)
484 /*
485 * 1 when 16-bit system bus accesses are supported.
486 */
487 #define DMI_SBCS_SBACCESS16_OFFSET 1
488 #define DMI_SBCS_SBACCESS16_LENGTH 1
489 #define DMI_SBCS_SBACCESS16 (0x1 << DMI_SBCS_SBACCESS16_OFFSET)
490 /*
491 * 1 when 8-bit system bus accesses are supported.
492 */
493 #define DMI_SBCS_SBACCESS8_OFFSET 0
494 #define DMI_SBCS_SBACCESS8_LENGTH 1
495 #define DMI_SBCS_SBACCESS8 (0x1 << DMI_SBCS_SBACCESS8_OFFSET)
496 #define DMI_SBADDRESS0 0x04
497 /*
498 * Accesses bits 31:0 of the internal address.
499 */
500 #define DMI_SBADDRESS0_ADDRESS_OFFSET 0
501 #define DMI_SBADDRESS0_ADDRESS_LENGTH 32
502 #define DMI_SBADDRESS0_ADDRESS (0xffffffff << DMI_SBADDRESS0_ADDRESS_OFFSET)
503 #define DMI_SBADDRESS1 0x05
504 /*
505 * Accesses bits 63:32 of the internal address (if the system address
506 * bus is that wide).
507 */
508 #define DMI_SBADDRESS1_ADDRESS_OFFSET 0
509 #define DMI_SBADDRESS1_ADDRESS_LENGTH 32
510 #define DMI_SBADDRESS1_ADDRESS (0xffffffff << DMI_SBADDRESS1_ADDRESS_OFFSET)
511 #define DMI_SBADDRESS2 0x06
512 /*
513 * The same as \Fbusy in \Rsbaddresszero.
514 */
515 #define DMI_SBADDRESS2_BUSY_OFFSET 31
516 #define DMI_SBADDRESS2_BUSY_LENGTH 1
517 #define DMI_SBADDRESS2_BUSY (0x1 << DMI_SBADDRESS2_BUSY_OFFSET)
518 /*
519 * Accesses bits 91:61 of the internal address (if the system address
520 * bus is that wide).
521 */
522 #define DMI_SBADDRESS2_ADDRESS_OFFSET 0
523 #define DMI_SBADDRESS2_ADDRESS_LENGTH 31
524 #define DMI_SBADDRESS2_ADDRESS (0x7fffffff << DMI_SBADDRESS2_ADDRESS_OFFSET)
525 #define DMI_SBDATA0 0x07
526 /*
527 * Accesses bits 31:0 of the internal data.
528 */
529 #define DMI_SBDATA0_DATA_OFFSET 0
530 #define DMI_SBDATA0_DATA_LENGTH 32
531 #define DMI_SBDATA0_DATA (0xffffffff << DMI_SBDATA0_DATA_OFFSET)
532 #define DMI_SBDATA1 0x08
533 /*
534 * Accesses bits 63:32 of the internal data (if the system bus is
535 * that wide).
536 */
537 #define DMI_SBDATA1_DATA_OFFSET 0
538 #define DMI_SBDATA1_DATA_LENGTH 32
539 #define DMI_SBDATA1_DATA (0xffffffff << DMI_SBDATA1_DATA_OFFSET)
540 #define DMI_SBDATA2 0x09
541 /*
542 * Accesses bits 95:64 of the internal data (if the system bus is
543 * that wide).
544 */
545 #define DMI_SBDATA2_DATA_OFFSET 0
546 #define DMI_SBDATA2_DATA_LENGTH 32
547 #define DMI_SBDATA2_DATA (0xffffffff << DMI_SBDATA2_DATA_OFFSET)
548 #define DMI_SBDATA3 0x0a
549 /*
550 * Accesses bits 127:96 of the internal data (if the system bus is
551 * that wide).
552 */
553 #define DMI_SBDATA3_DATA_OFFSET 0
554 #define DMI_SBDATA3_DATA_LENGTH 32
555 #define DMI_SBDATA3_DATA (0xffffffff << DMI_SBDATA3_DATA_OFFSET)
556 #define DMI_AUTHDATA0 0x0b
557 #define DMI_AUTHDATA0_DATA_OFFSET 0
558 #define DMI_AUTHDATA0_DATA_LENGTH 32
559 #define DMI_AUTHDATA0_DATA (0xffffffff << DMI_AUTHDATA0_DATA_OFFSET)
560 #define DMI_AUTHDATA1 0x0c
561 #define DMI_AUTHDATA1_DATA_OFFSET 0
562 #define DMI_AUTHDATA1_DATA_LENGTH 32
563 #define DMI_AUTHDATA1_DATA (0xffffffff << DMI_AUTHDATA1_DATA_OFFSET)
564 #define DMI_ABSTRACTCS 0x0e
565 #define DMI_ABSTRACTCS_AUTOEXEC7_OFFSET 15
566 #define DMI_ABSTRACTCS_AUTOEXEC7_LENGTH 1
567 #define DMI_ABSTRACTCS_AUTOEXEC7 (0x1 << DMI_ABSTRACTCS_AUTOEXEC7_OFFSET)
568 #define DMI_ABSTRACTCS_AUTOEXEC6_OFFSET 14
569 #define DMI_ABSTRACTCS_AUTOEXEC6_LENGTH 1
570 #define DMI_ABSTRACTCS_AUTOEXEC6 (0x1 << DMI_ABSTRACTCS_AUTOEXEC6_OFFSET)
571 #define DMI_ABSTRACTCS_AUTOEXEC5_OFFSET 13
572 #define DMI_ABSTRACTCS_AUTOEXEC5_LENGTH 1
573 #define DMI_ABSTRACTCS_AUTOEXEC5 (0x1 << DMI_ABSTRACTCS_AUTOEXEC5_OFFSET)
574 #define DMI_ABSTRACTCS_AUTOEXEC4_OFFSET 12
575 #define DMI_ABSTRACTCS_AUTOEXEC4_LENGTH 1
576 #define DMI_ABSTRACTCS_AUTOEXEC4 (0x1 << DMI_ABSTRACTCS_AUTOEXEC4_OFFSET)
577 #define DMI_ABSTRACTCS_AUTOEXEC3_OFFSET 11
578 #define DMI_ABSTRACTCS_AUTOEXEC3_LENGTH 1
579 #define DMI_ABSTRACTCS_AUTOEXEC3 (0x1 << DMI_ABSTRACTCS_AUTOEXEC3_OFFSET)
580 #define DMI_ABSTRACTCS_AUTOEXEC2_OFFSET 10
581 #define DMI_ABSTRACTCS_AUTOEXEC2_LENGTH 1
582 #define DMI_ABSTRACTCS_AUTOEXEC2 (0x1 << DMI_ABSTRACTCS_AUTOEXEC2_OFFSET)
583 #define DMI_ABSTRACTCS_AUTOEXEC1_OFFSET 9
584 #define DMI_ABSTRACTCS_AUTOEXEC1_LENGTH 1
585 #define DMI_ABSTRACTCS_AUTOEXEC1 (0x1 << DMI_ABSTRACTCS_AUTOEXEC1_OFFSET)
586 /*
587 * When 1, accesses to \Rdatazero cause the command in \Rcommand to be
588 * executed again.
589 *
590 * The same is true for other other autoexec bits: When 1, accesses to
591 * {\tt data}N cause the command in \Rcommand to be executed again.
592 */
593 #define DMI_ABSTRACTCS_AUTOEXEC0_OFFSET 8
594 #define DMI_ABSTRACTCS_AUTOEXEC0_LENGTH 1
595 #define DMI_ABSTRACTCS_AUTOEXEC0 (0x1 << DMI_ABSTRACTCS_AUTOEXEC0_OFFSET)
596 /*
597 * Gets set if an abstract command fails. No abstract command is
598 * started until the value is reset to 0.
599 *
600 * 0 (none): No error.
601 *
602 * 1 (busy): An abstract command was executing while \Rcommand or one
603 * of the {\tt data} registers was accessed.
604 *
605 * 2 (not supported): The requested command is not supported. A
606 * command that is not supported while the hart is running may be
607 * supported when it is halted.
608 *
609 * 3 (exception): An exception occurred while executing the command
610 * (eg. while executing the Program Buffer).
611 *
612 * 4 (halt/resume): An abstract command couldn't execute because the
613 * hart wasn't in the expected state (running/halted).
614 *
615 * 7 (other): The command failed for another reason.
616 */
617 #define DMI_ABSTRACTCS_CMDERR_OFFSET 5
618 #define DMI_ABSTRACTCS_CMDERR_LENGTH 3
619 #define DMI_ABSTRACTCS_CMDERR (0x7 << DMI_ABSTRACTCS_CMDERR_OFFSET)
620 /*
621 * 1: An abstract command is currently being executed.
622 *
623 * This bit is set as soon as \Rcommand is written, and isn't cleared
624 * until that command has completed.
625 */
626 #define DMI_ABSTRACTCS_BUSY_OFFSET 4
627 #define DMI_ABSTRACTCS_BUSY_LENGTH 1
628 #define DMI_ABSTRACTCS_BUSY (0x1 << DMI_ABSTRACTCS_BUSY_OFFSET)
629 /*
630 * Number of {\tt data} registers that are implemented as part of the
631 * abstract command interface. If it's 0 then no abstract interface is
632 * implemented at all.
633 */
634 #define DMI_ABSTRACTCS_DATACOUNT_OFFSET 0
635 #define DMI_ABSTRACTCS_DATACOUNT_LENGTH 4
636 #define DMI_ABSTRACTCS_DATACOUNT (0xf << DMI_ABSTRACTCS_DATACOUNT_OFFSET)
637 #define DMI_COMMAND 0x0f
638 #define DMI_COMMAND_COMMAND_OFFSET 0
639 #define DMI_COMMAND_COMMAND_LENGTH 32
640 #define DMI_COMMAND_COMMAND (0xffffffff << DMI_COMMAND_COMMAND_OFFSET)
641 #define DMI_DATA0 0x10
642 #define DMI_DATA0_DATA_OFFSET 0
643 #define DMI_DATA0_DATA_LENGTH 32
644 #define DMI_DATA0_DATA (0xffffffff << DMI_DATA0_DATA_OFFSET)
645 #define DMI_DATA1 0x11
646 #define DMI_DATA2 0x12
647 #define DMI_DATA3 0x13
648 #define DMI_DATA4 0x14
649 #define DMI_DATA5 0x15
650 #define DMI_DATA6 0x16
651 #define DMI_DATA7 0x17
652 #define DMI_DATA8 0x18
653 #define DMI_DATA9 0x19
654 #define DMI_DATA10 0x1a
655 #define DMI_DATA11 0x1b
656 #define DMI_SERDATA 0x1c
657 #define DMI_SERDATA_DATA_OFFSET 0
658 #define DMI_SERDATA_DATA_LENGTH 32
659 #define DMI_SERDATA_DATA (0xffffffff << DMI_SERDATA_DATA_OFFSET)
660 #define DMI_SERSTATUS 0x1d
661 /*
662 * Number of supported serial ports.
663 */
664 #define DMI_SERSTATUS_SERIALCOUNT_OFFSET 28
665 #define DMI_SERSTATUS_SERIALCOUNT_LENGTH 4
666 #define DMI_SERSTATUS_SERIALCOUNT (0xf << DMI_SERSTATUS_SERIALCOUNT_OFFSET)
667 /*
668 * Select which serial port is accessed by \Rserdata.
669 */
670 #define DMI_SERSTATUS_SERIAL_OFFSET 16
671 #define DMI_SERSTATUS_SERIAL_LENGTH 3
672 #define DMI_SERSTATUS_SERIAL (0x7 << DMI_SERSTATUS_SERIAL_OFFSET)
673 #define DMI_SERSTATUS_VALID7_OFFSET 15
674 #define DMI_SERSTATUS_VALID7_LENGTH 1
675 #define DMI_SERSTATUS_VALID7 (0x1 << DMI_SERSTATUS_VALID7_OFFSET)
676 #define DMI_SERSTATUS_FULL_OVERFLOW7_OFFSET 14
677 #define DMI_SERSTATUS_FULL_OVERFLOW7_LENGTH 1
678 #define DMI_SERSTATUS_FULL_OVERFLOW7 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW7_OFFSET)
679 #define DMI_SERSTATUS_VALID6_OFFSET 13
680 #define DMI_SERSTATUS_VALID6_LENGTH 1
681 #define DMI_SERSTATUS_VALID6 (0x1 << DMI_SERSTATUS_VALID6_OFFSET)
682 #define DMI_SERSTATUS_FULL_OVERFLOW6_OFFSET 12
683 #define DMI_SERSTATUS_FULL_OVERFLOW6_LENGTH 1
684 #define DMI_SERSTATUS_FULL_OVERFLOW6 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW6_OFFSET)
685 #define DMI_SERSTATUS_VALID5_OFFSET 11
686 #define DMI_SERSTATUS_VALID5_LENGTH 1
687 #define DMI_SERSTATUS_VALID5 (0x1 << DMI_SERSTATUS_VALID5_OFFSET)
688 #define DMI_SERSTATUS_FULL_OVERFLOW5_OFFSET 10
689 #define DMI_SERSTATUS_FULL_OVERFLOW5_LENGTH 1
690 #define DMI_SERSTATUS_FULL_OVERFLOW5 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW5_OFFSET)
691 #define DMI_SERSTATUS_VALID4_OFFSET 9
692 #define DMI_SERSTATUS_VALID4_LENGTH 1
693 #define DMI_SERSTATUS_VALID4 (0x1 << DMI_SERSTATUS_VALID4_OFFSET)
694 #define DMI_SERSTATUS_FULL_OVERFLOW4_OFFSET 8
695 #define DMI_SERSTATUS_FULL_OVERFLOW4_LENGTH 1
696 #define DMI_SERSTATUS_FULL_OVERFLOW4 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW4_OFFSET)
697 #define DMI_SERSTATUS_VALID3_OFFSET 7
698 #define DMI_SERSTATUS_VALID3_LENGTH 1
699 #define DMI_SERSTATUS_VALID3 (0x1 << DMI_SERSTATUS_VALID3_OFFSET)
700 #define DMI_SERSTATUS_FULL_OVERFLOW3_OFFSET 6
701 #define DMI_SERSTATUS_FULL_OVERFLOW3_LENGTH 1
702 #define DMI_SERSTATUS_FULL_OVERFLOW3 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW3_OFFSET)
703 #define DMI_SERSTATUS_VALID2_OFFSET 5
704 #define DMI_SERSTATUS_VALID2_LENGTH 1
705 #define DMI_SERSTATUS_VALID2 (0x1 << DMI_SERSTATUS_VALID2_OFFSET)
706 #define DMI_SERSTATUS_FULL_OVERFLOW2_OFFSET 4
707 #define DMI_SERSTATUS_FULL_OVERFLOW2_LENGTH 1
708 #define DMI_SERSTATUS_FULL_OVERFLOW2 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW2_OFFSET)
709 #define DMI_SERSTATUS_VALID1_OFFSET 3
710 #define DMI_SERSTATUS_VALID1_LENGTH 1
711 #define DMI_SERSTATUS_VALID1 (0x1 << DMI_SERSTATUS_VALID1_OFFSET)
712 #define DMI_SERSTATUS_FULL_OVERFLOW1_OFFSET 2
713 #define DMI_SERSTATUS_FULL_OVERFLOW1_LENGTH 1
714 #define DMI_SERSTATUS_FULL_OVERFLOW1 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW1_OFFSET)
715 /*
716 * 1 when the core-to-debugger queue for serial port 0 is not empty.
717 */
718 #define DMI_SERSTATUS_VALID0_OFFSET 1
719 #define DMI_SERSTATUS_VALID0_LENGTH 1
720 #define DMI_SERSTATUS_VALID0 (0x1 << DMI_SERSTATUS_VALID0_OFFSET)
721 /*
722 * 1 when the debugger-to-core queue for serial port 0 is either full,
723 * or has overflowed. Overflow state is sticky, and can be reset by
724 * writing 0 to this bit.
725 */
726 #define DMI_SERSTATUS_FULL_OVERFLOW0_OFFSET 0
727 #define DMI_SERSTATUS_FULL_OVERFLOW0_LENGTH 1
728 #define DMI_SERSTATUS_FULL_OVERFLOW0 (0x1 << DMI_SERSTATUS_FULL_OVERFLOW0_OFFSET)
729 #define DMI_ACCESSCS 0x1f
730 /*
731 * Size of the Program Buffer, in 32-bit words. Valid sizes are 0 - 12.
732 *
733 * A debugger must not access any Instruction Buffer locations that
734 * fall outside the range specified here.
735 *
736 * TODO: Explain what can be done with each size of the buffer, to suggest
737 * why you would want more or less words.
738 */
739 #define DMI_ACCESSCS_PROGSIZE_OFFSET 0
740 #define DMI_ACCESSCS_PROGSIZE_LENGTH 4
741 #define DMI_ACCESSCS_PROGSIZE (0xf << DMI_ACCESSCS_PROGSIZE_OFFSET)
742 #define DMI_IBUF0 0x20
743 #define DMI_IBUF0_DATA_OFFSET 0
744 #define DMI_IBUF0_DATA_LENGTH 32
745 #define DMI_IBUF0_DATA (0xffffffff << DMI_IBUF0_DATA_OFFSET)
746 #define DMI_IBUF1 0x21
747 #define DMI_IBUF2 0x22
748 #define DMI_IBUF3 0x23
749 #define DMI_IBUF4 0x24
750 #define DMI_IBUF5 0x25
751 #define DMI_IBUF6 0x26
752 #define DMI_IBUF7 0x27
753 #define DMI_IBUF8 0x28
754 #define DMI_IBUF9 0x29
755 #define DMI_IBUF10 0x2a
756 #define DMI_IBUF11 0x2b
757 #define SERINFO 0x110
758 /*
759 * Like \Fserialzero.
760 */
761 #define SERINFO_SERIAL7_OFFSET 7
762 #define SERINFO_SERIAL7_LENGTH 1
763 #define SERINFO_SERIAL7 (0x1 << SERINFO_SERIAL7_OFFSET)
764 /*
765 * Like \Fserialzero.
766 */
767 #define SERINFO_SERIAL6_OFFSET 6
768 #define SERINFO_SERIAL6_LENGTH 1
769 #define SERINFO_SERIAL6 (0x1 << SERINFO_SERIAL6_OFFSET)
770 /*
771 * Like \Fserialzero.
772 */
773 #define SERINFO_SERIAL5_OFFSET 5
774 #define SERINFO_SERIAL5_LENGTH 1
775 #define SERINFO_SERIAL5 (0x1 << SERINFO_SERIAL5_OFFSET)
776 /*
777 * Like \Fserialzero.
778 */
779 #define SERINFO_SERIAL4_OFFSET 4
780 #define SERINFO_SERIAL4_LENGTH 1
781 #define SERINFO_SERIAL4 (0x1 << SERINFO_SERIAL4_OFFSET)
782 /*
783 * Like \Fserialzero.
784 */
785 #define SERINFO_SERIAL3_OFFSET 3
786 #define SERINFO_SERIAL3_LENGTH 1
787 #define SERINFO_SERIAL3 (0x1 << SERINFO_SERIAL3_OFFSET)
788 /*
789 * Like \Fserialzero.
790 */
791 #define SERINFO_SERIAL2_OFFSET 2
792 #define SERINFO_SERIAL2_LENGTH 1
793 #define SERINFO_SERIAL2 (0x1 << SERINFO_SERIAL2_OFFSET)
794 /*
795 * Like \Fserialzero.
796 */
797 #define SERINFO_SERIAL1_OFFSET 1
798 #define SERINFO_SERIAL1_LENGTH 1
799 #define SERINFO_SERIAL1 (0x1 << SERINFO_SERIAL1_OFFSET)
800 /*
801 * 1 means serial interface 0 is supported.
802 */
803 #define SERINFO_SERIAL0_OFFSET 0
804 #define SERINFO_SERIAL0_LENGTH 1
805 #define SERINFO_SERIAL0 (0x1 << SERINFO_SERIAL0_OFFSET)
806 #define SERSEND0 0x200
807 #define SERRECV0 0x204
808 #define SERSTAT0 0x208
809 /*
810 * Send ready. 1 when the core-to-debugger queue is not full. 0
811 * otherwise.
812 */
813 #define SERSTAT0_SENDR_OFFSET 1
814 #define SERSTAT0_SENDR_LENGTH 1
815 #define SERSTAT0_SENDR (0x1 << SERSTAT0_SENDR_OFFSET)
816 /*
817 * Receive ready. 1 when the debugger-to-core queue is not empty. 0
818 * otherwise.
819 */
820 #define SERSTAT0_RECVR_OFFSET 0
821 #define SERSTAT0_RECVR_LENGTH 1
822 #define SERSTAT0_RECVR (0x1 << SERSTAT0_RECVR_OFFSET)
823 #define SERSEND1 0x20c
824 #define SERRECV1 0x210
825 #define SERSTAT1 0x214
826 #define SERSEND2 0x218
827 #define SERRECV2 0x21c
828 #define SERSTAT2 0x220
829 #define SERSEND3 0x224
830 #define SERRECV3 0x228
831 #define SERSTAT3 0x22c
832 #define SERSEND4 0x230
833 #define SERRECV4 0x234
834 #define SERSTAT4 0x238
835 #define SERSEND5 0x23c
836 #define SERRECV5 0x240
837 #define SERSTAT5 0x244
838 #define SERSEND6 0x248
839 #define SERRECV6 0x24c
840 #define SERSTAT6 0x250
841 #define SERSEND7 0x254
842 #define SERRECV7 0x258
843 #define SERSTAT7 0x25c
844 #define CSR_TSELECT 0x7a0
845 #define CSR_TSELECT_INDEX_OFFSET 0
846 #define CSR_TSELECT_INDEX_LENGTH XLEN
847 #define CSR_TSELECT_INDEX (((1L<<XLEN)-1) << CSR_TSELECT_INDEX_OFFSET)
848 #define CSR_TDATA1 0x7a1
849 /*
850 * 0: There is no trigger at this \Rtselect.
851 *
852 * 1: The trigger is a legacy SiFive address match trigger. These
853 * should not be implemented and aren't further documented here.
854 *
855 * 2: The trigger is an address/data match trigger.
856 *
857 * 3: The trigger is an instruction count trigger.
858 *
859 * 15: This trigger exists (so enumeration shouldn't terminate), but
860 * is not currently available.
861 *
862 * Other values are reserved for future use.
863 */
864 #define CSR_TDATA1_TYPE_OFFSET XLEN-4
865 #define CSR_TDATA1_TYPE_LENGTH 4
866 #define CSR_TDATA1_TYPE (0xfL << CSR_TDATA1_TYPE_OFFSET)
867 /*
868 * 0: Both Debug and M Mode can write the {\tt tdata} registers at the
869 * selected \Rtselect.
870 *
871 * 1: Only Debug Mode can write the {\tt tdata} registers at the
872 * selected \Rtselect. Writes from other modes are ignored.
873 *
874 * This bit is only writable from Debug Mode.
875 */
876 #define CSR_TDATA1_DMODE_OFFSET XLEN-5
877 #define CSR_TDATA1_DMODE_LENGTH 1
878 #define CSR_TDATA1_DMODE (0x1L << CSR_TDATA1_DMODE_OFFSET)
879 /*
880 * Trigger-specific data.
881 */
882 #define CSR_TDATA1_DATA_OFFSET 0
883 #define CSR_TDATA1_DATA_LENGTH XLEN - 5
884 #define CSR_TDATA1_DATA (((1L<<XLEN - 5)-1) << CSR_TDATA1_DATA_OFFSET)
885 #define CSR_TDATA2 0x7a2
886 #define CSR_TDATA2_DATA_OFFSET 0
887 #define CSR_TDATA2_DATA_LENGTH XLEN
888 #define CSR_TDATA2_DATA (((1L<<XLEN)-1) << CSR_TDATA2_DATA_OFFSET)
889 #define CSR_TDATA3 0x7a3
890 #define CSR_TDATA3_DATA_OFFSET 0
891 #define CSR_TDATA3_DATA_LENGTH XLEN
892 #define CSR_TDATA3_DATA (((1L<<XLEN)-1) << CSR_TDATA3_DATA_OFFSET)
893 #define CSR_MCONTROL 0x7a1
894 #define CSR_MCONTROL_TYPE_OFFSET XLEN-4
895 #define CSR_MCONTROL_TYPE_LENGTH 4
896 #define CSR_MCONTROL_TYPE (0xfL << CSR_MCONTROL_TYPE_OFFSET)
897 #define CSR_MCONTROL_DMODE_OFFSET XLEN-5
898 #define CSR_MCONTROL_DMODE_LENGTH 1
899 #define CSR_MCONTROL_DMODE (0x1L << CSR_MCONTROL_DMODE_OFFSET)
900 /*
901 * Specifies the largest naturally aligned powers-of-two (NAPOT) range
902 * supported by the hardware. The value is the logarithm base 2 of the
903 * number of bytes in that range. A value of 0 indicates that only
904 * exact value matches are supported (one byte range). A value of 63
905 * corresponds to the maximum NAPOT range, which is $2^{63}$ bytes in
906 * size.
907 */
908 #define CSR_MCONTROL_MASKMAX_OFFSET XLEN-11
909 #define CSR_MCONTROL_MASKMAX_LENGTH 6
910 #define CSR_MCONTROL_MASKMAX (0x3fL << CSR_MCONTROL_MASKMAX_OFFSET)
911 /*
912 * 0: Perform a match on the address.
913 *
914 * 1: Perform a match on the data value loaded/stored, or the
915 * instruction executed.
916 */
917 #define CSR_MCONTROL_SELECT_OFFSET 19
918 #define CSR_MCONTROL_SELECT_LENGTH 1
919 #define CSR_MCONTROL_SELECT (0x1L << CSR_MCONTROL_SELECT_OFFSET)
920 /*
921 * 0: The action for this trigger will be taken just before the
922 * instruction that triggered it is executed, but after all preceding
923 * instructions are are committed.
924 *
925 * 1: The action for this trigger will be taken after the instruction
926 * that triggered it is executed. It should be taken before the next
927 * instruction is executed, but it is better to implement triggers and
928 * not implement that suggestion than to not implement them at all.
929 *
930 * Most hardware will only implement one timing or the other, possibly
931 * dependent on \Fselect, \Fexecute, \Fload, and \Fstore. This bit
932 * primarily exists for the hardware to communicate to the debugger
933 * what will happen. Hardware may implement the bit fully writable, in
934 * which case the debugger has a little more control.
935 *
936 * Data load triggers with \Ftiming of 0 will result in the same load
937 * happening again when the debugger lets the core run. For data load
938 * triggers debuggers must first attempt to set the breakpoint with
939 * \Ftiming of 1.
940 *
941 * A chain of triggers that don't all have the same \Ftiming value
942 * will never fire (unless consecutive instructions match the
943 * appropriate triggers).
944 */
945 #define CSR_MCONTROL_TIMING_OFFSET 18
946 #define CSR_MCONTROL_TIMING_LENGTH 1
947 #define CSR_MCONTROL_TIMING (0x1L << CSR_MCONTROL_TIMING_OFFSET)
948 /*
949 * Determines what happens when this trigger matches.
950 *
951 * 0: Raise a breakpoint exception. (Used when software wants to use
952 * the trigger module without an external debugger attached.)
953 *
954 * 1: Enter Debug Mode. (Only supported when \Fdmode is 1.)
955 *
956 * 2: Start tracing.
957 *
958 * 3: Stop tracing.
959 *
960 * 4: Emit trace data for this match. If it is a data access match,
961 * emit appropriate Load/Store Address/Data. If it is an instruction
962 * execution, emit its PC.
963 *
964 * Other values are reserved for future use.
965 */
966 #define CSR_MCONTROL_ACTION_OFFSET 12
967 #define CSR_MCONTROL_ACTION_LENGTH 6
968 #define CSR_MCONTROL_ACTION (0x3fL << CSR_MCONTROL_ACTION_OFFSET)
969 /*
970 * 0: When this trigger matches, the configured action is taken.
971 *
972 * 1: While this trigger does not match, it prevents the trigger with
973 * the next index from matching.
974 */
975 #define CSR_MCONTROL_CHAIN_OFFSET 11
976 #define CSR_MCONTROL_CHAIN_LENGTH 1
977 #define CSR_MCONTROL_CHAIN (0x1L << CSR_MCONTROL_CHAIN_OFFSET)
978 /*
979 * 0: Matches when the value equals \Rtdatatwo.
980 *
981 * 1: Matches when the top M bits of the value match the top M bits of
982 * \Rtdatatwo. M is XLEN-1 minus the index of the least-significant
983 * bit containing 0 in \Rtdatatwo.
984 *
985 * 2: Matches when the value is greater than or equal to \Rtdatatwo.
986 *
987 * 3: Matches when the value is less than \Rtdatatwo.
988 *
989 * 4: Matches when the lower half of the value equals the lower half
990 * of \Rtdatatwo after the lower half of the value is ANDed with the
991 * upper half of \Rtdatatwo.
992 *
993 * 5: Matches when the upper half of the value equals the lower half
994 * of \Rtdatatwo after the upper half of the value is ANDed with the
995 * upper half of \Rtdatatwo.
996 *
997 * Other values are reserved for future use.
998 */
999 #define CSR_MCONTROL_MATCH_OFFSET 7
1000 #define CSR_MCONTROL_MATCH_LENGTH 4
1001 #define CSR_MCONTROL_MATCH (0xfL << CSR_MCONTROL_MATCH_OFFSET)
1002 /*
1003 * When set, enable this trigger in M mode.
1004 */
1005 #define CSR_MCONTROL_M_OFFSET 6
1006 #define CSR_MCONTROL_M_LENGTH 1
1007 #define CSR_MCONTROL_M (0x1L << CSR_MCONTROL_M_OFFSET)
1008 /*
1009 * When set, enable this trigger in H mode.
1010 */
1011 #define CSR_MCONTROL_H_OFFSET 5
1012 #define CSR_MCONTROL_H_LENGTH 1
1013 #define CSR_MCONTROL_H (0x1L << CSR_MCONTROL_H_OFFSET)
1014 /*
1015 * When set, enable this trigger in S mode.
1016 */
1017 #define CSR_MCONTROL_S_OFFSET 4
1018 #define CSR_MCONTROL_S_LENGTH 1
1019 #define CSR_MCONTROL_S (0x1L << CSR_MCONTROL_S_OFFSET)
1020 /*
1021 * When set, enable this trigger in U mode.
1022 */
1023 #define CSR_MCONTROL_U_OFFSET 3
1024 #define CSR_MCONTROL_U_LENGTH 1
1025 #define CSR_MCONTROL_U (0x1L << CSR_MCONTROL_U_OFFSET)
1026 /*
1027 * When set, the trigger fires on the address or opcode of an
1028 * instruction that is executed.
1029 */
1030 #define CSR_MCONTROL_EXECUTE_OFFSET 2
1031 #define CSR_MCONTROL_EXECUTE_LENGTH 1
1032 #define CSR_MCONTROL_EXECUTE (0x1L << CSR_MCONTROL_EXECUTE_OFFSET)
1033 /*
1034 * When set, the trigger fires on the address or data of a store.
1035 */
1036 #define CSR_MCONTROL_STORE_OFFSET 1
1037 #define CSR_MCONTROL_STORE_LENGTH 1
1038 #define CSR_MCONTROL_STORE (0x1L << CSR_MCONTROL_STORE_OFFSET)
1039 /*
1040 * When set, the trigger fires on the address or data of a load.
1041 */
1042 #define CSR_MCONTROL_LOAD_OFFSET 0
1043 #define CSR_MCONTROL_LOAD_LENGTH 1
1044 #define CSR_MCONTROL_LOAD (0x1L << CSR_MCONTROL_LOAD_OFFSET)
1045 #define CSR_ICOUNT 0x7a1
1046 #define CSR_ICOUNT_TYPE_OFFSET XLEN-4
1047 #define CSR_ICOUNT_TYPE_LENGTH 4
1048 #define CSR_ICOUNT_TYPE (0xfL << CSR_ICOUNT_TYPE_OFFSET)
1049 #define CSR_ICOUNT_DMODE_OFFSET XLEN-5
1050 #define CSR_ICOUNT_DMODE_LENGTH 1
1051 #define CSR_ICOUNT_DMODE (0x1L << CSR_ICOUNT_DMODE_OFFSET)
1052 /*
1053 * When count is decremented to 0, the trigger fires. Instead of
1054 * changing \Fcount from 1 to 0, it is also acceptable for hardware to
1055 * clear \Fm, \Fh, \Fs, and \Fu. This allows \Fcount to be hard-wired
1056 * to 1 if this register just exists for single step.
1057 */
1058 #define CSR_ICOUNT_COUNT_OFFSET 10
1059 #define CSR_ICOUNT_COUNT_LENGTH 14
1060 #define CSR_ICOUNT_COUNT (0x3fffL << CSR_ICOUNT_COUNT_OFFSET)
1061 /*
1062 * When set, every instruction completed in M mode decrements \Fcount
1063 * by 1.
1064 */
1065 #define CSR_ICOUNT_M_OFFSET 9
1066 #define CSR_ICOUNT_M_LENGTH 1
1067 #define CSR_ICOUNT_M (0x1L << CSR_ICOUNT_M_OFFSET)
1068 /*
1069 * When set, every instruction completed in H mode decrements \Fcount
1070 * by 1.
1071 */
1072 #define CSR_ICOUNT_H_OFFSET 8
1073 #define CSR_ICOUNT_H_LENGTH 1
1074 #define CSR_ICOUNT_H (0x1L << CSR_ICOUNT_H_OFFSET)
1075 /*
1076 * When set, every instruction completed in S mode decrements \Fcount
1077 * by 1.
1078 */
1079 #define CSR_ICOUNT_S_OFFSET 7
1080 #define CSR_ICOUNT_S_LENGTH 1
1081 #define CSR_ICOUNT_S (0x1L << CSR_ICOUNT_S_OFFSET)
1082 /*
1083 * When set, every instruction completed in U mode decrements \Fcount
1084 * by 1.
1085 */
1086 #define CSR_ICOUNT_U_OFFSET 6
1087 #define CSR_ICOUNT_U_LENGTH 1
1088 #define CSR_ICOUNT_U (0x1L << CSR_ICOUNT_U_OFFSET)
1089 /*
1090 * Determines what happens when this trigger matches.
1091 *
1092 * 0: Raise a debug exception. (Used when software wants to use the
1093 * trigger module without an external debugger attached.)
1094 *
1095 * 1: Enter Debug Mode. (Only supported when \Fdmode is 1.)
1096 *
1097 * 2: Start tracing.
1098 *
1099 * 3: Stop tracing.
1100 *
1101 * 4: Emit trace data for this match. If it is a data access match,
1102 * emit appropriate Load/Store Address/Data. If it is an instruction
1103 * execution, emit its PC.
1104 *
1105 * Other values are reserved for future use.
1106 */
1107 #define CSR_ICOUNT_ACTION_OFFSET 0
1108 #define CSR_ICOUNT_ACTION_LENGTH 6
1109 #define CSR_ICOUNT_ACTION (0x3fL << CSR_ICOUNT_ACTION_OFFSET)
1110 #define DTM_IDCODE 0x01
1111 /*
1112 * Identifies the release version of this part.
1113 */
1114 #define DTM_IDCODE_VERSION_OFFSET 28
1115 #define DTM_IDCODE_VERSION_LENGTH 4
1116 #define DTM_IDCODE_VERSION (0xf << DTM_IDCODE_VERSION_OFFSET)
1117 /*
1118 * Identifies the designer's part number of this part.
1119 */
1120 #define DTM_IDCODE_PARTNUMBER_OFFSET 12
1121 #define DTM_IDCODE_PARTNUMBER_LENGTH 16
1122 #define DTM_IDCODE_PARTNUMBER (0xffff << DTM_IDCODE_PARTNUMBER_OFFSET)
1123 /*
1124 * Identifies the designer/manufacturer of this part. Bits 6:0 must be
1125 * bits 6:0 of the designer/manufacturer's Identification Code as
1126 * assigned by JEDEC Standard JEP106. Bits 10:7 contain the modulo-16
1127 * count of the number of continuation characters (0x7f) in that same
1128 * Identification Code.
1129 */
1130 #define DTM_IDCODE_MANUFID_OFFSET 1
1131 #define DTM_IDCODE_MANUFID_LENGTH 11
1132 #define DTM_IDCODE_MANUFID (0x7ff << DTM_IDCODE_MANUFID_OFFSET)
1133 #define DTM_IDCODE_1_OFFSET 0
1134 #define DTM_IDCODE_1_LENGTH 1
1135 #define DTM_IDCODE_1 (0x1 << DTM_IDCODE_1_OFFSET)
1136 #define DTM_SAMPLE 0x02
1137 #define DTM_PRELOAD 0x03
1138 #define DTM_EXTEST 0x04
1139 #define DTM_CLAMP 0x05
1140 #define DTM_CLAMP__HOLD 0x06
1141 #define DTM_CLAMP__RELEASE 0x07
1142 #define DTM_HIGHZ 0x08
1143 #define DTM_IC__RESET 0x09
1144 #define DTM_TMP__STATUS 0x0a
1145 #define DTM_INIT__SETUP 0x0b
1146 #define DTM_INIT__SETUP__CLAMP 0x0c
1147 #define DTM_INIT__RUN 0x0d
1148 #define DTM_DTMCONTROL 0x10
1149 /*
1150 * Writing 1 to this bit resets the DMI controller, clearing any
1151 * sticky error state.
1152 */
1153 #define DTM_DTMCONTROL_DMIRESET_OFFSET 16
1154 #define DTM_DTMCONTROL_DMIRESET_LENGTH 1
1155 #define DTM_DTMCONTROL_DMIRESET (0x1 << DTM_DTMCONTROL_DMIRESET_OFFSET)
1156 /*
1157 * This is the minimum number of cycles a debugger should spend in
1158 * Run-Test/Idle after every DMI scan to avoid a 'busy'
1159 * return code (\Fdmistat of 3). A debugger must still
1160 * check \Fdmistat when necessary.
1161 *
1162 * 0: It is not necessary to enter Run-Test/Idle at all.
1163 *
1164 * 1: Enter Run-Test/Idle and leave it immediately.
1165 *
1166 * 2: Enter Run-Test/Idle and stay there for 1 cycle before leaving.
1167 *
1168 * And so on.
1169 */
1170 #define DTM_DTMCONTROL_IDLE_OFFSET 12
1171 #define DTM_DTMCONTROL_IDLE_LENGTH 3
1172 #define DTM_DTMCONTROL_IDLE (0x7 << DTM_DTMCONTROL_IDLE_OFFSET)
1173 /*
1174 * 0: No error.
1175 *
1176 * 1: Reserved. Interpret the same as 2.
1177 *
1178 * 2: An operation failed (resulted in \Fop of 2).
1179 *
1180 * 3: An operation was attempted while a DMI access was still in
1181 * progress (resulted in \Fop of 3).
1182 */
1183 #define DTM_DTMCONTROL_DMISTAT_OFFSET 10
1184 #define DTM_DTMCONTROL_DMISTAT_LENGTH 2
1185 #define DTM_DTMCONTROL_DMISTAT (0x3 << DTM_DTMCONTROL_DMISTAT_OFFSET)
1186 /*
1187 * The size of \Faddress in \Rdmi.
1188 */
1189 #define DTM_DTMCONTROL_ABITS_OFFSET 4
1190 #define DTM_DTMCONTROL_ABITS_LENGTH 6
1191 #define DTM_DTMCONTROL_ABITS (0x3f << DTM_DTMCONTROL_ABITS_OFFSET)
1192 /*
1193 * 0: Version described in spec version 0.11.
1194 *
1195 * 1: Version described in spec version 0.12 (and later?), which
1196 * reduces the DMI data width to 32 bits.
1197 *
1198 * Other values are reserved for future use.
1199 */
1200 #define DTM_DTMCONTROL_VERSION_OFFSET 0
1201 #define DTM_DTMCONTROL_VERSION_LENGTH 4
1202 #define DTM_DTMCONTROL_VERSION (0xf << DTM_DTMCONTROL_VERSION_OFFSET)
1203 #define DTM_DMI 0x11
1204 /*
1205 * Address used for DMI access. In Update-DR this value is used
1206 * to access the DM over the DMI.
1207 */
1208 #define DTM_DMI_ADDRESS_OFFSET 34
1209 #define DTM_DMI_ADDRESS_LENGTH abits
1210 #define DTM_DMI_ADDRESS (((1L<<abits)-1) << DTM_DMI_ADDRESS_OFFSET)
1211 /*
1212 * The data to send to the DM over the DMI during Update-DR, and
1213 * the data returned from the DM as a result of the previous operation.
1214 */
1215 #define DTM_DMI_DATA_OFFSET 2
1216 #define DTM_DMI_DATA_LENGTH 32
1217 #define DTM_DMI_DATA (0xffffffffL << DTM_DMI_DATA_OFFSET)
1218 /*
1219 * When the debugger writes this field, it has the following meaning:
1220 *
1221 * 0: Ignore \Fdata. (nop)
1222 *
1223 * 1: Read from \Faddress. (read)
1224 *
1225 * 2: Write \Fdata to \Faddress. (write)
1226 *
1227 * 3: Reserved.
1228 *
1229 * When the debugger reads this field, it means the following:
1230 *
1231 * 0: The previous operation completed successfully.
1232 *
1233 * 1: Reserved.
1234 *
1235 * 2: The previous operation returned a non-zero value in \Fop.
1236 * The data scanned into \Rdmi in this access will be ignored.
1237 * This status is sticky and can be cleared by writing \Fdmireset
1238 * in \Rdtmcontrol.
1239 *
1240 * (This indicates that the DM itself responded with an error, e.g.
1241 * in the System Bus and Serial Port overflow/underflow cases.
1242 * Generally this means that for this type of DM access, the DTM should
1243 * allow more time between Update-DR and Capture-DR. The most portable way
1244 * to achieve this is to spend more TCK ticks in Run-Test/Idle state
1245 * for similar operations.)
1246 *
1247 * 3: The previous DMI request is still in progress. The data scanned
1248 * into \Rdmi in this access will be ignored. This status is sticky
1249 * and can be cleared by writing \Fdmireset in \Rdtmcontrol. If a
1250 * debugger sees this status, it needs to give the target more TCK
1251 * edges between Update-DR and Capture-DR. The simplest way
1252 * to do that is to add extra transitions in Run-Test/Idle.
1253 *
1254 * (The DTM, DM, and/or component may be in different clock domains,
1255 * so synchronization may be required. Some relatively fixed number of
1256 * TCK ticks may be needed for the request to reach the DM, complete,
1257 * and for the response to be synchronized back into the TCK domain.
1258 * This status is intended to cover these cases, and is orthogonal to
1259 * the causes for case 2.)
1260 */
1261 #define DTM_DMI_OP_OFFSET 0
1262 #define DTM_DMI_OP_LENGTH 2
1263 #define DTM_DMI_OP (0x3L << DTM_DMI_OP_OFFSET)
1264 #define SHORTNAME 0x123
1265 /*
1266 * Description of what this field is used for.
1267 */
1268 #define SHORTNAME_FIELD_OFFSET 0
1269 #define SHORTNAME_FIELD_LENGTH 8
1270 #define SHORTNAME_FIELD (0xff << SHORTNAME_FIELD_OFFSET)
1271 #define TRACE 0x728
1272 /*
1273 * 1 if the trace buffer has wrapped since the last time \Fdiscard was
1274 * written. 0 otherwise.
1275 */
1276 #define TRACE_WRAPPED_OFFSET 24
1277 #define TRACE_WRAPPED_LENGTH 1
1278 #define TRACE_WRAPPED (0x1 << TRACE_WRAPPED_OFFSET)
1279 /*
1280 * Emit Timestamp trace sequences.
1281 */
1282 #define TRACE_EMITTIMESTAMP_OFFSET 23
1283 #define TRACE_EMITTIMESTAMP_LENGTH 1
1284 #define TRACE_EMITTIMESTAMP (0x1 << TRACE_EMITTIMESTAMP_OFFSET)
1285 /*
1286 * Emit Store Data trace sequences.
1287 */
1288 #define TRACE_EMITSTOREDATA_OFFSET 22
1289 #define TRACE_EMITSTOREDATA_LENGTH 1
1290 #define TRACE_EMITSTOREDATA (0x1 << TRACE_EMITSTOREDATA_OFFSET)
1291 /*
1292 * Emit Load Data trace sequences.
1293 */
1294 #define TRACE_EMITLOADDATA_OFFSET 21
1295 #define TRACE_EMITLOADDATA_LENGTH 1
1296 #define TRACE_EMITLOADDATA (0x1 << TRACE_EMITLOADDATA_OFFSET)
1297 /*
1298 * Emit Store Address trace sequences.
1299 */
1300 #define TRACE_EMITSTOREADDR_OFFSET 20
1301 #define TRACE_EMITSTOREADDR_LENGTH 1
1302 #define TRACE_EMITSTOREADDR (0x1 << TRACE_EMITSTOREADDR_OFFSET)
1303 /*
1304 * Emit Load Address trace sequences.
1305 */
1306 #define TRACE_EMITLOADADDR_OFFSET 19
1307 #define TRACE_EMITLOADADDR_LENGTH 1
1308 #define TRACE_EMITLOADADDR (0x1 << TRACE_EMITLOADADDR_OFFSET)
1309 /*
1310 * Emit Privilege Level trace sequences.
1311 */
1312 #define TRACE_EMITPRIV_OFFSET 18
1313 #define TRACE_EMITPRIV_LENGTH 1
1314 #define TRACE_EMITPRIV (0x1 << TRACE_EMITPRIV_OFFSET)
1315 /*
1316 * Emit Branch Taken and Branch Not Taken trace sequences.
1317 */
1318 #define TRACE_EMITBRANCH_OFFSET 17
1319 #define TRACE_EMITBRANCH_LENGTH 1
1320 #define TRACE_EMITBRANCH (0x1 << TRACE_EMITBRANCH_OFFSET)
1321 /*
1322 * Emit PC trace sequences.
1323 */
1324 #define TRACE_EMITPC_OFFSET 16
1325 #define TRACE_EMITPC_LENGTH 1
1326 #define TRACE_EMITPC (0x1 << TRACE_EMITPC_OFFSET)
1327 /*
1328 * Determine what happens when the trace buffer is full. 0 means wrap
1329 * and overwrite. 1 means turn off trace until \Fdiscard is written as 1.
1330 * 2 means cause a trace full exception. 3 is reserved for future use.
1331 */
1332 #define TRACE_FULLACTION_OFFSET 8
1333 #define TRACE_FULLACTION_LENGTH 2
1334 #define TRACE_FULLACTION (0x3 << TRACE_FULLACTION_OFFSET)
1335 /*
1336 * 0: Trace to a dedicated on-core RAM (which is not further defined in
1337 * this spec).
1338 *
1339 * 1: Trace to RAM on the system bus.
1340 *
1341 * 2: Send trace data to a dedicated off-chip interface (which is not
1342 * defined in this spec). This does not affect execution speed.
1343 *
1344 * 3: Reserved for future use.
1345 *
1346 * Options 0 and 1 slow down execution (eg. because of system bus
1347 * contention).
1348 */
1349 #define TRACE_DESTINATION_OFFSET 4
1350 #define TRACE_DESTINATION_LENGTH 2
1351 #define TRACE_DESTINATION (0x3 << TRACE_DESTINATION_OFFSET)
1352 /*
1353 * When 1, the trace logic may stall processor execution to ensure it
1354 * can emit all the trace sequences required. When 0 individual trace
1355 * sequences may be dropped.
1356 */
1357 #define TRACE_STALL_OFFSET 2
1358 #define TRACE_STALL_LENGTH 1
1359 #define TRACE_STALL (0x1 << TRACE_STALL_OFFSET)
1360 /*
1361 * Writing 1 to this bit tells the trace logic that any trace
1362 * collected is no longer required. When tracing to RAM, it resets the
1363 * trace write pointer to the start of the memory, as well as
1364 * \Fwrapped.
1365 */
1366 #define TRACE_DISCARD_OFFSET 1
1367 #define TRACE_DISCARD_LENGTH 1
1368 #define TRACE_DISCARD (0x1 << TRACE_DISCARD_OFFSET)
1369 #define TRACE_SUPPORTED_OFFSET 0
1370 #define TRACE_SUPPORTED_LENGTH 1
1371 #define TRACE_SUPPORTED (0x1 << TRACE_SUPPORTED_OFFSET)
1372 #define TBUFSTART 0x729
1373 #define TBUFEND 0x72a
1374 #define TBUFWRITE 0x72b