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