Upstream a whole host of RISC-V changes.
[openocd.git] / src / target / riscv / debug_defines.h
1 /*
2 * This file is auto-generated by running 'make debug_defines.h' in
3 * https://github.com/riscv/riscv-debug-spec/ (63c985f)
4 * License: Creative Commons Attribution 4.0 International Public License (CC BY 4.0)
5 */
6
7 #define DTM_IDCODE 0x01
8 /*
9 * Identifies the release version of this part.
10 */
11 #define DTM_IDCODE_VERSION_OFFSET 28
12 #define DTM_IDCODE_VERSION_LENGTH 4
13 #define DTM_IDCODE_VERSION (0xfU << DTM_IDCODE_VERSION_OFFSET)
14 /*
15 * Identifies the designer's part number of this part.
16 */
17 #define DTM_IDCODE_PARTNUMBER_OFFSET 12
18 #define DTM_IDCODE_PARTNUMBER_LENGTH 16
19 #define DTM_IDCODE_PARTNUMBER (0xffffU << DTM_IDCODE_PARTNUMBER_OFFSET)
20 /*
21 * Identifies the designer/manufacturer of this part. Bits 6:0 must be
22 * bits 6:0 of the designer/manufacturer's Identification Code as
23 * assigned by JEDEC Standard JEP106. Bits 10:7 contain the modulo-16
24 * count of the number of continuation characters (0x7f) in that same
25 * Identification Code.
26 */
27 #define DTM_IDCODE_MANUFID_OFFSET 1
28 #define DTM_IDCODE_MANUFID_LENGTH 11
29 #define DTM_IDCODE_MANUFID (0x7ffU << DTM_IDCODE_MANUFID_OFFSET)
30 #define DTM_IDCODE_1_OFFSET 0
31 #define DTM_IDCODE_1_LENGTH 1
32 #define DTM_IDCODE_1 (0x1U << DTM_IDCODE_1_OFFSET)
33 #define DTM_DTMCS 0x10
34 /*
35 * Writing 1 to this bit does a hard reset of the DTM,
36 * causing the DTM to forget about any outstanding DMI transactions, and
37 * returning all registers and internal state to their reset value.
38 * In general this should only be used when the Debugger has
39 * reason to expect that the outstanding DMI transaction will never
40 * complete (e.g. a reset condition caused an inflight DMI transaction to
41 * be cancelled).
42 */
43 #define DTM_DTMCS_DMIHARDRESET_OFFSET 17
44 #define DTM_DTMCS_DMIHARDRESET_LENGTH 1
45 #define DTM_DTMCS_DMIHARDRESET (0x1U << DTM_DTMCS_DMIHARDRESET_OFFSET)
46 /*
47 * Writing 1 to this bit clears the sticky error state, but does
48 * not affect outstanding DMI transactions.
49 */
50 #define DTM_DTMCS_DMIRESET_OFFSET 16
51 #define DTM_DTMCS_DMIRESET_LENGTH 1
52 #define DTM_DTMCS_DMIRESET (0x1U << DTM_DTMCS_DMIRESET_OFFSET)
53 /*
54 * This is a hint to the debugger of the minimum number of
55 * cycles a debugger should spend in
56 * Run-Test/Idle after every DMI scan to avoid a `busy'
57 * return code (\FdtmDtmcsDmistat of 3). A debugger must still
58 * check \FdtmDtmcsDmistat when necessary.
59 *
60 * 0: It is not necessary to enter Run-Test/Idle at all.
61 *
62 * 1: Enter Run-Test/Idle and leave it immediately.
63 *
64 * 2: Enter Run-Test/Idle and stay there for 1 cycle before leaving.
65 *
66 * And so on.
67 */
68 #define DTM_DTMCS_IDLE_OFFSET 12
69 #define DTM_DTMCS_IDLE_LENGTH 3
70 #define DTM_DTMCS_IDLE (0x7U << DTM_DTMCS_IDLE_OFFSET)
71 /*
72 * 0: No error.
73 *
74 * 1: Reserved. Interpret the same as 2.
75 *
76 * 2: An operation failed (resulted in \FdtmDmiOp of 2).
77 *
78 * 3: An operation was attempted while a DMI access was still in
79 * progress (resulted in \FdtmDmiOp of 3).
80 */
81 #define DTM_DTMCS_DMISTAT_OFFSET 10
82 #define DTM_DTMCS_DMISTAT_LENGTH 2
83 #define DTM_DTMCS_DMISTAT (0x3U << DTM_DTMCS_DMISTAT_OFFSET)
84 /*
85 * The size of \FdmSbaddressZeroAddress in \RdtmDmi.
86 */
87 #define DTM_DTMCS_ABITS_OFFSET 4
88 #define DTM_DTMCS_ABITS_LENGTH 6
89 #define DTM_DTMCS_ABITS (0x3fU << DTM_DTMCS_ABITS_OFFSET)
90 /*
91 * 0: Version described in spec version 0.11.
92 *
93 * 1: Version described in spec versions 0.13 and 1.0.
94 *
95 * 15: Version not described in any available version of this spec.
96 */
97 #define DTM_DTMCS_VERSION_OFFSET 0
98 #define DTM_DTMCS_VERSION_LENGTH 4
99 #define DTM_DTMCS_VERSION (0xfU << DTM_DTMCS_VERSION_OFFSET)
100 #define DTM_DMI 0x11
101 /*
102 * Address used for DMI access. In Update-DR this value is used
103 * to access the DM over the DMI.
104 */
105 #define DTM_DMI_ADDRESS_OFFSET 34
106 #define DTM_DMI_ADDRESS_LENGTH abits
107 #define DTM_DMI_ADDRESS (((1L << abits) - 1) << DTM_DMI_ADDRESS_OFFSET)
108 /*
109 * The data to send to the DM over the DMI during Update-DR, and
110 * the data returned from the DM as a result of the previous operation.
111 */
112 #define DTM_DMI_DATA_OFFSET 2
113 #define DTM_DMI_DATA_LENGTH 32
114 #define DTM_DMI_DATA (0xffffffffULL << DTM_DMI_DATA_OFFSET)
115 /*
116 * When the debugger writes this field, it has the following meaning:
117 *
118 * 0: Ignore \FdmSbdataZeroData and \FdmSbaddressZeroAddress. (nop)
119 *
120 * Don't send anything over the DMI during Update-DR.
121 * This operation should never result in a busy or error response.
122 * The address and data reported in the following Capture-DR
123 * are undefined.
124 *
125 * 1: Read from \FdmSbaddressZeroAddress. (read)
126 *
127 * 2: Write \FdmSbdataZeroData to \FdmSbaddressZeroAddress. (write)
128 *
129 * 3: Reserved.
130 *
131 * When the debugger reads this field, it means the following:
132 *
133 * 0: The previous operation completed successfully.
134 *
135 * 1: Reserved.
136 *
137 * 2: A previous operation failed. The data scanned into \RdtmDmi in
138 * this access will be ignored. This status is sticky and can be
139 * cleared by writing \FdtmDtmcsDmireset in \RdtmDtmcs.
140 *
141 * This indicates that the DM itself responded with an error.
142 * There are no specified cases in which the DM would
143 * respond with an error, and DMI is not required to support
144 * returning errors.
145 *
146 * 3: An operation was attempted while a DMI request is still in
147 * progress. The data scanned into \RdtmDmi in this access will be
148 * ignored. This status is sticky and can be cleared by writing
149 * \FdtmDtmcsDmireset in \RdtmDtmcs. If a debugger sees this status, it
150 * needs to give the target more TCK edges between Update-DR and
151 * Capture-DR. The simplest way to do that is to add extra transitions
152 * in Run-Test/Idle.
153 */
154 #define DTM_DMI_OP_OFFSET 0
155 #define DTM_DMI_OP_LENGTH 2
156 #define DTM_DMI_OP (0x3ULL << DTM_DMI_OP_OFFSET)
157 #define CSR_DCSR 0x7b0
158 /*
159 * 0: There is no debug support.
160 *
161 * 4: Debug support exists as it is described in this document.
162 *
163 * 15: There is debug support, but it does not conform to any
164 * available version of this spec.
165 */
166 #define CSR_DCSR_DEBUGVER_OFFSET 28
167 #define CSR_DCSR_DEBUGVER_LENGTH 4
168 #define CSR_DCSR_DEBUGVER (0xfU << CSR_DCSR_DEBUGVER_OFFSET)
169 /*
170 * 0: {\tt ebreak} instructions in VS-mode behave as described in the
171 * Privileged Spec.
172 *
173 * 1: {\tt ebreak} instructions in VS-mode enter Debug Mode.
174 *
175 * This bit is hardwired to 0 if the hart does not support virtualization mode.
176 */
177 #define CSR_DCSR_EBREAKVS_OFFSET 17
178 #define CSR_DCSR_EBREAKVS_LENGTH 1
179 #define CSR_DCSR_EBREAKVS (0x1U << CSR_DCSR_EBREAKVS_OFFSET)
180 /*
181 * 0: {\tt ebreak} instructions in VU-mode behave as described in the
182 * Privileged Spec.
183 *
184 * 1: {\tt ebreak} instructions in VU-mode enter Debug Mode.
185 *
186 * This bit is hardwired to 0 if the hart does not support virtualization mode.
187 */
188 #define CSR_DCSR_EBREAKVU_OFFSET 16
189 #define CSR_DCSR_EBREAKVU_LENGTH 1
190 #define CSR_DCSR_EBREAKVU (0x1U << CSR_DCSR_EBREAKVU_OFFSET)
191 /*
192 * 0: {\tt ebreak} instructions in M-mode behave as described in the
193 * Privileged Spec.
194 *
195 * 1: {\tt ebreak} instructions in M-mode enter Debug Mode.
196 */
197 #define CSR_DCSR_EBREAKM_OFFSET 15
198 #define CSR_DCSR_EBREAKM_LENGTH 1
199 #define CSR_DCSR_EBREAKM (0x1U << CSR_DCSR_EBREAKM_OFFSET)
200 /*
201 * 0: {\tt ebreak} instructions in S-mode behave as described in the
202 * Privileged Spec.
203 *
204 * 1: {\tt ebreak} instructions in S-mode enter Debug Mode.
205 *
206 * This bit is hardwired to 0 if the hart does not support S-mode.
207 */
208 #define CSR_DCSR_EBREAKS_OFFSET 13
209 #define CSR_DCSR_EBREAKS_LENGTH 1
210 #define CSR_DCSR_EBREAKS (0x1U << CSR_DCSR_EBREAKS_OFFSET)
211 /*
212 * 0: {\tt ebreak} instructions in U-mode behave as described in the
213 * Privileged Spec.
214 *
215 * 1: {\tt ebreak} instructions in U-mode enter Debug Mode.
216 *
217 * This bit is hardwired to 0 if the hart does not support U-mode.
218 */
219 #define CSR_DCSR_EBREAKU_OFFSET 12
220 #define CSR_DCSR_EBREAKU_LENGTH 1
221 #define CSR_DCSR_EBREAKU (0x1U << CSR_DCSR_EBREAKU_OFFSET)
222 /*
223 * 0: Interrupts (including NMI) are disabled during single stepping.
224 *
225 * 1: Interrupts (including NMI) are enabled during single stepping.
226 *
227 * Implementations may hard wire this bit to 0.
228 * In that case interrupt behavior can be emulated by the debugger.
229 *
230 * The debugger must not change the value of this bit while the hart
231 * is running.
232 */
233 #define CSR_DCSR_STEPIE_OFFSET 11
234 #define CSR_DCSR_STEPIE_LENGTH 1
235 #define CSR_DCSR_STEPIE (0x1U << CSR_DCSR_STEPIE_OFFSET)
236 /*
237 * 0: Increment counters as usual.
238 *
239 * 1: Don't increment any hart-local counters while in Debug Mode or
240 * on {\tt ebreak} instructions that cause entry into Debug Mode.
241 * These counters include the {\tt instret} CSR. On single-hart cores
242 * {\tt cycle} should be stopped, but on multi-hart cores it must keep
243 * incrementing.
244 *
245 * An implementation may hardwire this bit to 0 or 1.
246 */
247 #define CSR_DCSR_STOPCOUNT_OFFSET 10
248 #define CSR_DCSR_STOPCOUNT_LENGTH 1
249 #define CSR_DCSR_STOPCOUNT (0x1U << CSR_DCSR_STOPCOUNT_OFFSET)
250 /*
251 * 0: Increment timers as usual.
252 *
253 * 1: Don't increment any hart-local timers while in Debug Mode.
254 *
255 * An implementation may hardwire this bit to 0 or 1.
256 */
257 #define CSR_DCSR_STOPTIME_OFFSET 9
258 #define CSR_DCSR_STOPTIME_LENGTH 1
259 #define CSR_DCSR_STOPTIME (0x1U << CSR_DCSR_STOPTIME_OFFSET)
260 /*
261 * Explains why Debug Mode was entered.
262 *
263 * When there are multiple reasons to enter Debug Mode in a single
264 * cycle, hardware should set \FcsrDcsrCause to the cause with the highest
265 * priority.
266 *
267 * 1: An {\tt ebreak} instruction was executed. (priority 3)
268 *
269 * 2: The Trigger Module caused a breakpoint exception. (priority 4)
270 *
271 * 3: The debugger requested entry to Debug Mode using \FdmDmcontrolHaltreq.
272 * (priority 1)
273 *
274 * 4: The hart single stepped because \FcsrDcsrStep was set. (priority 0, lowest)
275 *
276 * 5: The hart halted directly out of reset due to \Fresethaltreq. It
277 * is also acceptable to report 3 when this happens. (priority 2)
278 *
279 * 6: The hart halted because it's part of a halt group. (priority 5,
280 * highest) Harts may report 3 for this cause instead.
281 *
282 * Other values are reserved for future use.
283 */
284 #define CSR_DCSR_CAUSE_OFFSET 6
285 #define CSR_DCSR_CAUSE_LENGTH 3
286 #define CSR_DCSR_CAUSE (0x7U << CSR_DCSR_CAUSE_OFFSET)
287 /*
288 * Extends the prv field with the virtualization mode the hart was operating
289 * in when Debug Mode was entered. The encoding is described in Table
290 * \ref{tab:privlevel}.
291 * A debugger can change this value to change the hart's virtualization mode
292 * when exiting Debug Mode.
293 * This bit is hardwired to 0 on harts that do not support virtualization mode.
294 */
295 #define CSR_DCSR_V_OFFSET 5
296 #define CSR_DCSR_V_LENGTH 1
297 #define CSR_DCSR_V (0x1U << CSR_DCSR_V_OFFSET)
298 /*
299 * 0: \FcsrMstatusMprv in \Rmstatus is ignored in Debug Mode.
300 *
301 * 1: \FcsrMstatusMprv in \Rmstatus takes effect in Debug Mode.
302 *
303 * Implementing this bit is optional. It may be tied to either 0 or 1.
304 */
305 #define CSR_DCSR_MPRVEN_OFFSET 4
306 #define CSR_DCSR_MPRVEN_LENGTH 1
307 #define CSR_DCSR_MPRVEN (0x1U << CSR_DCSR_MPRVEN_OFFSET)
308 /*
309 * When set, there is a Non-Maskable-Interrupt (NMI) pending for the hart.
310 *
311 * Since an NMI can indicate a hardware error condition,
312 * reliable debugging may no longer be possible once this bit becomes set.
313 * This is implementation-dependent.
314 */
315 #define CSR_DCSR_NMIP_OFFSET 3
316 #define CSR_DCSR_NMIP_LENGTH 1
317 #define CSR_DCSR_NMIP (0x1U << CSR_DCSR_NMIP_OFFSET)
318 /*
319 * When set and not in Debug Mode, the hart will only execute a single
320 * instruction and then enter Debug Mode. See Section~\ref{stepBit}
321 * for details.
322 *
323 * The debugger must not change the value of this bit while the hart
324 * is running.
325 */
326 #define CSR_DCSR_STEP_OFFSET 2
327 #define CSR_DCSR_STEP_LENGTH 1
328 #define CSR_DCSR_STEP (0x1U << CSR_DCSR_STEP_OFFSET)
329 /*
330 * Contains the privilege level the hart was operating in when Debug
331 * Mode was entered. The encoding is described in Table
332 * \ref{tab:privlevel}. A debugger can change this value to change
333 * the hart's privilege level when exiting Debug Mode.
334 *
335 * Not all privilege levels are supported on all harts. If the
336 * encoding written is not supported or the debugger is not allowed to
337 * change to it, the hart may change to any supported privilege level.
338 */
339 #define CSR_DCSR_PRV_OFFSET 0
340 #define CSR_DCSR_PRV_LENGTH 2
341 #define CSR_DCSR_PRV (0x3U << CSR_DCSR_PRV_OFFSET)
342 #define CSR_DPC 0x7b1
343 #define CSR_DPC_DPC_OFFSET 0
344 #define CSR_DPC_DPC_LENGTH DXLEN
345 #define CSR_DPC_DPC (((1L << DXLEN) - 1) << CSR_DPC_DPC_OFFSET)
346 #define CSR_DSCRATCH0 0x7b2
347 #define CSR_DSCRATCH1 0x7b3
348 #define CSR_TSELECT 0x7a0
349 #define CSR_TSELECT_INDEX_OFFSET 0
350 #define CSR_TSELECT_INDEX_LENGTH XLEN
351 #define CSR_TSELECT_INDEX (((1L << XLEN) - 1) << CSR_TSELECT_INDEX_OFFSET)
352 #define CSR_TDATA1 0x7a1
353 /*
354 * 0: There is no trigger at this \RcsrTselect.
355 *
356 * 1: The trigger is a legacy SiFive address match trigger. These
357 * should not be implemented and aren't further documented here.
358 *
359 * 2: The trigger is an address/data match trigger. The remaining bits
360 * in this register act as described in \RcsrMcontrol.
361 *
362 * 3: The trigger is an instruction count trigger. The remaining bits
363 * in this register act as described in \RcsrIcount.
364 *
365 * 4: The trigger is an interrupt trigger. The remaining bits
366 * in this register act as described in \RcsrItrigger.
367 *
368 * 5: The trigger is an exception trigger. The remaining bits
369 * in this register act as described in \RcsrEtrigger.
370 *
371 * 6: The trigger is an address/data match trigger. The remaining bits
372 * in this register act as described in \RcsrMcontrolSix. This is similar
373 * to a type 2 trigger, but provides additional functionality and
374 * should be used instead of type 2 in newer implementations.
375 *
376 * 7: The trigger is a trigger source external to the TM. The
377 * remaining bits in this register act as described in \RcsrTmexttrigger.
378 *
379 * 12--14: These trigger types are available for non-standard use.
380 *
381 * 15: This trigger exists (so enumeration shouldn't terminate), but
382 * is not currently available.
383 *
384 * Other values are reserved for future use.
385 */
386 #define CSR_TDATA1_TYPE_OFFSET (XLEN-4)
387 #define CSR_TDATA1_TYPE_LENGTH 4
388 #define CSR_TDATA1_TYPE (0xfULL << CSR_TDATA1_TYPE_OFFSET)
389 /*
390 * If \FcsrTdataOneType is 0, then this bit is hard-wired to 0.
391 *
392 * 0: Both Debug and M-mode can write the {\tt tdata} registers at the
393 * selected \RcsrTselect.
394 *
395 * 1: Only Debug Mode can write the {\tt tdata} registers at the
396 * selected \RcsrTselect. Writes from other modes are ignored.
397 *
398 * This bit is only writable from Debug Mode.
399 * In ordinary use, external debuggers will always set this bit when
400 * configuring a trigger.
401 * When clearing this bit, debuggers should also clear the action field
402 * (whose location depends on \FcsrTdataOneType).
403 */
404 #define CSR_TDATA1_DMODE_OFFSET (XLEN-5)
405 #define CSR_TDATA1_DMODE_LENGTH 1
406 #define CSR_TDATA1_DMODE (0x1ULL << CSR_TDATA1_DMODE_OFFSET)
407 /*
408 * If \FcsrTdataOneType is 0, then this field is hard-wired to 0.
409 *
410 * Trigger-specific data.
411 */
412 #define CSR_TDATA1_DATA_OFFSET 0
413 #define CSR_TDATA1_DATA_LENGTH (XLEN - 5)
414 #define CSR_TDATA1_DATA (((1L << XLEN - 5) - 1) << CSR_TDATA1_DATA_OFFSET)
415 #define CSR_TDATA2 0x7a2
416 #define CSR_TDATA2_DATA_OFFSET 0
417 #define CSR_TDATA2_DATA_LENGTH XLEN
418 #define CSR_TDATA2_DATA (((1L << XLEN) - 1) << CSR_TDATA2_DATA_OFFSET)
419 #define CSR_TDATA3 0x7a3
420 #define CSR_TDATA3_DATA_OFFSET 0
421 #define CSR_TDATA3_DATA_LENGTH XLEN
422 #define CSR_TDATA3_DATA (((1L << XLEN) - 1) << CSR_TDATA3_DATA_OFFSET)
423 #define CSR_TINFO 0x7a4
424 /*
425 * One bit for each possible \FcsrTdataOneType enumerated in \RcsrTdataOne. Bit N
426 * corresponds to type N. If the bit is set, then that type is
427 * supported by the currently selected trigger.
428 *
429 * If the currently selected trigger doesn't exist, this field
430 * contains 1.
431 */
432 #define CSR_TINFO_INFO_OFFSET 0
433 #define CSR_TINFO_INFO_LENGTH 16
434 #define CSR_TINFO_INFO (0xffffULL << CSR_TINFO_INFO_OFFSET)
435 #define CSR_TCONTROL 0x7a5
436 /*
437 * \RcsrHcontext enable.
438 *
439 * 0: \RcsrHcontext is set to 0 and writes are ignored.
440 *
441 * 1: \RcsrHcontext may be written and read.
442 */
443 #define CSR_TCONTROL_HCXE_OFFSET 9
444 #define CSR_TCONTROL_HCXE_LENGTH 1
445 #define CSR_TCONTROL_HCXE (0x1ULL << CSR_TCONTROL_HCXE_OFFSET)
446 /*
447 * \RcsrScontext enable.
448 *
449 * 0: \RcsrScontext is set to 0 and writes are ignored.
450 *
451 * 1: \RcsrScontext may be written and read.
452 *
453 * Enabling \RcsrScontext can be a security risk in a
454 * virtualized system with a hypervisor that does not swap \RcsrScontext.
455 */
456 #define CSR_TCONTROL_SCXE_OFFSET 8
457 #define CSR_TCONTROL_SCXE_LENGTH 1
458 #define CSR_TCONTROL_SCXE (0x1ULL << CSR_TCONTROL_SCXE_OFFSET)
459 /*
460 * M-mode previous trigger enable field.
461 *
462 * \FcsrTcontrolMpte and \FcsrTcontrolMte provide one solution to a problem
463 * regarding triggers with action=0 firing in M-mode trap handlers. See
464 * Section~\ref{sec:mmtrigger} for more details.
465 *
466 * When a trap into M-mode is taken, \FcsrTcontrolMpte is set to the value of
467 * \FcsrTcontrolMte.
468 */
469 #define CSR_TCONTROL_MPTE_OFFSET 7
470 #define CSR_TCONTROL_MPTE_LENGTH 1
471 #define CSR_TCONTROL_MPTE (0x1ULL << CSR_TCONTROL_MPTE_OFFSET)
472 /*
473 * M-mode trigger enable field.
474 *
475 * 0: Triggers with action=0 do not match/fire while the hart is in M-mode.
476 *
477 * 1: Triggers do match/fire while the hart is in M-mode.
478 *
479 * When a trap into M-mode is taken, \FcsrTcontrolMte is set to 0. When {\tt
480 * mret} is executed, \FcsrTcontrolMte is set to the value of \FcsrTcontrolMpte.
481 */
482 #define CSR_TCONTROL_MTE_OFFSET 3
483 #define CSR_TCONTROL_MTE_LENGTH 1
484 #define CSR_TCONTROL_MTE (0x1ULL << CSR_TCONTROL_MTE_OFFSET)
485 #define CSR_HCONTEXT 0x6a8
486 /*
487 * Hypervisor mode software can write a context number to this register,
488 * which can be used to set triggers that only fire in that specific
489 * context.
490 *
491 * An implementation may tie any number of upper bits in this field to
492 * 0. If the H extension is not implemented, it's recommended to implement
493 * no more than 6 bits on RV32 and 13 on RV64 (as visible through the
494 * \RcsrMcontext register). If the H extension is implemented,
495 * it's recommended to implement no more than 7 bits on RV32
496 * and 14 on RV64.
497 */
498 #define CSR_HCONTEXT_HCONTEXT_OFFSET 0
499 #define CSR_HCONTEXT_HCONTEXT_LENGTH XLEN
500 #define CSR_HCONTEXT_HCONTEXT (((1L << XLEN) - 1) << CSR_HCONTEXT_HCONTEXT_OFFSET)
501 #define CSR_SCONTEXT 0x5a8
502 /*
503 * Supervisor mode software can write a context number to this
504 * register, which can be used to set triggers that only fire in that
505 * specific context.
506 *
507 * An implementation may tie any number of high bits in this field to
508 * 0. It's recommended to implement no more than 16 bits on RV32, and
509 * 34 on RV64.
510 */
511 #define CSR_SCONTEXT_DATA_OFFSET 0
512 #define CSR_SCONTEXT_DATA_LENGTH XLEN
513 #define CSR_SCONTEXT_DATA (((1L << XLEN) - 1) << CSR_SCONTEXT_DATA_OFFSET)
514 #define CSR_MCONTEXT 0x7a8
515 #define CSR_MSCONTEXT 0x7aa
516 #define CSR_MCONTROL 0x7a1
517 #define CSR_MCONTROL_TYPE_OFFSET (XLEN-4)
518 #define CSR_MCONTROL_TYPE_LENGTH 4
519 #define CSR_MCONTROL_TYPE (0xfULL << CSR_MCONTROL_TYPE_OFFSET)
520 #define CSR_MCONTROL_DMODE_OFFSET (XLEN-5)
521 #define CSR_MCONTROL_DMODE_LENGTH 1
522 #define CSR_MCONTROL_DMODE (0x1ULL << CSR_MCONTROL_DMODE_OFFSET)
523 /*
524 * Specifies the largest naturally aligned powers-of-two (NAPOT) range
525 * supported by the hardware when \FcsrMcontrolMatch is 1. The value is the
526 * logarithm base 2 of the number of bytes in that range.
527 * A value of 0 indicates \FcsrMcontrolMatch 1 is not supported.
528 * A value of 63 corresponds to the maximum NAPOT range, which is
529 * $2^{63}$ bytes in size.
530 */
531 #define CSR_MCONTROL_MASKMAX_OFFSET (XLEN-11)
532 #define CSR_MCONTROL_MASKMAX_LENGTH 6
533 #define CSR_MCONTROL_MASKMAX (0x3fULL << CSR_MCONTROL_MASKMAX_OFFSET)
534 /*
535 * This field only exists when XLEN is at least 64.
536 * It contains the 2 high bits of the access size. The low bits
537 * come from \FcsrMcontrolSizelo. See \FcsrMcontrolSizelo for how this
538 * is used.
539 */
540 #define CSR_MCONTROL_SIZEHI_OFFSET 21
541 #define CSR_MCONTROL_SIZEHI_LENGTH 2
542 #define CSR_MCONTROL_SIZEHI (0x3ULL << CSR_MCONTROL_SIZEHI_OFFSET)
543 /*
544 * If this bit is implemented then it must become set when this
545 * trigger fires and may become set when this trigger matches.
546 * The trigger's user can set or clear it at any
547 * time. It is used to determine which
548 * trigger(s) matched. If the bit is not implemented, it is always 0
549 * and writing it has no effect.
550 */
551 #define CSR_MCONTROL_HIT_OFFSET 20
552 #define CSR_MCONTROL_HIT_LENGTH 1
553 #define CSR_MCONTROL_HIT (0x1ULL << CSR_MCONTROL_HIT_OFFSET)
554 /*
555 * This bit determines the contents of the XLEN-bit compare values.
556 *
557 * 0: There is at least one compare value and it contains the lowest
558 * virtual address of the access.
559 * It is recommended that there are additional compare values for
560 * the other accessed virtual addresses.
561 * (E.g. on a 32-bit read from 0x4000, the lowest address is 0x4000
562 * and the other addresses are 0x4001, 0x4002, and 0x4003.)
563 *
564 * 1: There is exactly one compare value and it contains the data
565 * value loaded or stored, or the instruction executed.
566 * Any bits beyond the size of the data access will contain 0.
567 */
568 #define CSR_MCONTROL_SELECT_OFFSET 19
569 #define CSR_MCONTROL_SELECT_LENGTH 1
570 #define CSR_MCONTROL_SELECT (0x1ULL << CSR_MCONTROL_SELECT_OFFSET)
571 /*
572 * 0: The action for this trigger will be taken just before the
573 * instruction that triggered it is committed, but after all preceding
574 * instructions are committed. \Rxepc or \RcsrDpc (depending
575 * on \FcsrMcontrolAction) must be set to the virtual address of the
576 * instruction that matched.
577 *
578 * If this is combined with \FcsrMcontrolLoad and
579 * \FcsrMcontrolSelect=1 then a memory access will be
580 * performed (including any side effects of performing such an access) even
581 * though the load will not update its destination register. Debuggers
582 * should consider this when setting such breakpoints on, for example,
583 * memory-mapped I/O addresses.
584 *
585 * 1: The action for this trigger will be taken after the instruction
586 * that triggered it is committed. It should be taken before the next
587 * instruction is committed, but it is better to implement triggers imprecisely
588 * than to not implement them at all. \Rxepc or
589 * \RcsrDpc (depending on \FcsrMcontrolAction) must be set to
590 * the virtual address of the next instruction that must be executed to
591 * preserve the program flow.
592 *
593 * Most hardware will only implement one timing or the other, possibly
594 * dependent on \FcsrMcontrolSelect, \FcsrMcontrolExecute,
595 * \FcsrMcontrolLoad, and \FcsrMcontrolStore. This bit
596 * primarily exists for the hardware to communicate to the debugger
597 * what will happen. Hardware may implement the bit fully writable, in
598 * which case the debugger has a little more control.
599 *
600 * Data load triggers with \FcsrMcontrolTiming of 0 will result in the same load
601 * happening again when the debugger lets the hart run. For data load
602 * triggers, debuggers must first attempt to set the breakpoint with
603 * \FcsrMcontrolTiming of 1.
604 *
605 * If a trigger with \FcsrMcontrolTiming of 0 matches, it is
606 * implementation-dependent whether that prevents a trigger with
607 * \FcsrMcontrolTiming of 1 matching as well.
608 */
609 #define CSR_MCONTROL_TIMING_OFFSET 18
610 #define CSR_MCONTROL_TIMING_LENGTH 1
611 #define CSR_MCONTROL_TIMING (0x1ULL << CSR_MCONTROL_TIMING_OFFSET)
612 /*
613 * This field contains the 2 low bits of the access size. The high bits come
614 * from \FcsrMcontrolSizehi. The combined value is interpreted as follows:
615 *
616 * 0: The trigger will attempt to match against an access of any size.
617 * The behavior is only well-defined if $|select|=0$, or if the access
618 * size is XLEN.
619 *
620 * 1: The trigger will only match against 8-bit memory accesses.
621 *
622 * 2: The trigger will only match against 16-bit memory accesses or
623 * execution of 16-bit instructions.
624 *
625 * 3: The trigger will only match against 32-bit memory accesses or
626 * execution of 32-bit instructions.
627 *
628 * 4: The trigger will only match against execution of 48-bit instructions.
629 *
630 * 5: The trigger will only match against 64-bit memory accesses or
631 * execution of 64-bit instructions.
632 *
633 * 6: The trigger will only match against execution of 80-bit instructions.
634 *
635 * 7: The trigger will only match against execution of 96-bit instructions.
636 *
637 * 8: The trigger will only match against execution of 112-bit instructions.
638 *
639 * 9: The trigger will only match against 128-bit memory accesses or
640 * execution of 128-bit instructions.
641 *
642 * An implementation must support the value of 0, but all other values
643 * are optional. When an implementation supports address triggers
644 * (\FcsrMcontrolSelect=0), it is recommended that those triggers
645 * support every access size that the hart supports, as well as for
646 * every instruction size that the hart supports.
647 *
648 * Implementations such as RV32D or RV64V are able to perform loads
649 * and stores that are wider than XLEN. Custom extensions may also
650 * support instructions that are wider than XLEN. Because
651 * \RcsrTdataTwo is of size XLEN, there is a known limitation that
652 * data value triggers (\FcsrMcontrolSelect=1) can only be supported
653 * for access sizes up to XLEN bits. When an implementation supports
654 * data value triggers (\FcsrMcontrolSelect=1), it is recommended
655 * that those triggers support every access size up to XLEN that the
656 * hart supports, as well as for every instruction length up to XLEN
657 * that the hart supports.
658 */
659 #define CSR_MCONTROL_SIZELO_OFFSET 16
660 #define CSR_MCONTROL_SIZELO_LENGTH 2
661 #define CSR_MCONTROL_SIZELO (0x3ULL << CSR_MCONTROL_SIZELO_OFFSET)
662 /*
663 * The action to take when the trigger fires. The values are explained
664 * in Table~\ref{tab:action}.
665 */
666 #define CSR_MCONTROL_ACTION_OFFSET 12
667 #define CSR_MCONTROL_ACTION_LENGTH 4
668 #define CSR_MCONTROL_ACTION (0xfULL << CSR_MCONTROL_ACTION_OFFSET)
669 /*
670 * 0: When this trigger matches, the configured action is taken.
671 *
672 * 1: While this trigger does not match, it prevents the trigger with
673 * the next index from matching.
674 *
675 * A trigger chain starts on the first trigger with $|chain|=1$ after
676 * a trigger with $|chain|=0$, or simply on the first trigger if that
677 * has $|chain|=1$. It ends on the first trigger after that which has
678 * $|chain|=0$. This final trigger is part of the chain. The action
679 * on all but the final trigger is ignored. The action on that final
680 * trigger will be taken if and only if all the triggers in the chain
681 * match at the same time.
682 *
683 * Debuggers should not terminate a chain with a trigger with a
684 * different type. It is undefined when exactly such a chain fires.
685 *
686 * Because \FcsrMcontrolChain affects the next trigger, hardware must zero it in
687 * writes to \RcsrMcontrol that set \FcsrTdataOneDmode to 0 if the next trigger has
688 * \FcsrTdataOneDmode of 1.
689 * In addition hardware should ignore writes to \RcsrMcontrol that set
690 * \FcsrTdataOneDmode to 1 if the previous trigger has both \FcsrTdataOneDmode of 0 and
691 * \FcsrMcontrolChain of 1. Debuggers must avoid the latter case by checking
692 * \FcsrMcontrolChain on the previous trigger if they're writing \RcsrMcontrol.
693 *
694 * Implementations that wish to limit the maximum length of a trigger
695 * chain (eg. to meet timing requirements) may do so by zeroing
696 * \FcsrMcontrolChain in writes to \RcsrMcontrol that would make the chain too long.
697 */
698 #define CSR_MCONTROL_CHAIN_OFFSET 11
699 #define CSR_MCONTROL_CHAIN_LENGTH 1
700 #define CSR_MCONTROL_CHAIN (0x1ULL << CSR_MCONTROL_CHAIN_OFFSET)
701 /*
702 * 0: Matches when any compare value equals \RcsrTdataTwo.
703 *
704 * 1: Matches when the top $M$ bits of any compare value match the top
705 * $M$ bits of \RcsrTdataTwo.
706 * $M$ is $|XLEN|-1$ minus the index of the least-significant
707 * bit containing 0 in \RcsrTdataTwo. Debuggers should only write values
708 * to \RcsrTdataTwo such that $M + $\FcsrMcontrolMaskmax$ \geq |XLEN|$
709 * and $M\gt0$ , otherwise it's undefined on what conditions the
710 * trigger will match.
711 *
712 * 2: Matches when any compare value is greater than (unsigned) or
713 * equal to \RcsrTdataTwo.
714 *
715 * 3: Matches when any compare value is less than (unsigned)
716 * \RcsrTdataTwo.
717 *
718 * 4: Matches when $\frac{|XLEN|}{2}-1$:$0$ of any compare value
719 * equals $\frac{|XLEN|}{2}-1$:$0$ of \RcsrTdataTwo after
720 * $\frac{|XLEN|}{2}-1$:$0$ of the compare value is ANDed with
721 * $|XLEN|-1$:$\frac{|XLEN|}{2}$ of \RcsrTdataTwo.
722 *
723 * 5: Matches when $|XLEN|-1$:$\frac{|XLEN|}{2}$ of any compare
724 * value equals $\frac{|XLEN|}{2}-1$:$0$ of \RcsrTdataTwo after
725 * $|XLEN|-1$:$\frac{|XLEN|}{2}$ of the compare value is ANDed with
726 * $|XLEN|-1$:$\frac{|XLEN|}{2}$ of \RcsrTdataTwo.
727 *
728 * 8: Matches when \FcsrMcontrolMatch$=0$ would not match.
729 *
730 * 9: Matches when \FcsrMcontrolMatch$=1$ would not match.
731 *
732 * 12: Matches when \FcsrMcontrolMatch$=4$ would not match.
733 *
734 * 13: Matches when \FcsrMcontrolMatch$=5$ would not match.
735 *
736 * Other values are reserved for future use.
737 *
738 * All comparisons only look at the lower XLEN (in the current mode)
739 * bits of the compare values and of \RcsrTdataTwo.
740 * When \FcsrMcontrolSelect=1 and access size is N, this is further
741 * reduced, and comparisons only look at the lower N bits of the
742 * compare values and of \RcsrTdataTwo.
743 */
744 #define CSR_MCONTROL_MATCH_OFFSET 7
745 #define CSR_MCONTROL_MATCH_LENGTH 4
746 #define CSR_MCONTROL_MATCH (0xfULL << CSR_MCONTROL_MATCH_OFFSET)
747 /*
748 * When set, enable this trigger in M-mode.
749 */
750 #define CSR_MCONTROL_M_OFFSET 6
751 #define CSR_MCONTROL_M_LENGTH 1
752 #define CSR_MCONTROL_M (0x1ULL << CSR_MCONTROL_M_OFFSET)
753 /*
754 * When set, enable this trigger in S/HS-mode.
755 * This bit is hard-wired to 0 if the hart does not support
756 * S-mode.
757 */
758 #define CSR_MCONTROL_S_OFFSET 4
759 #define CSR_MCONTROL_S_LENGTH 1
760 #define CSR_MCONTROL_S (0x1ULL << CSR_MCONTROL_S_OFFSET)
761 /*
762 * When set, enable this trigger in U-mode.
763 * This bit is hard-wired to 0 if the hart does not support
764 * U-mode.
765 */
766 #define CSR_MCONTROL_U_OFFSET 3
767 #define CSR_MCONTROL_U_LENGTH 1
768 #define CSR_MCONTROL_U (0x1ULL << CSR_MCONTROL_U_OFFSET)
769 /*
770 * When set, the trigger fires on the virtual address or opcode of an
771 * instruction that is executed.
772 */
773 #define CSR_MCONTROL_EXECUTE_OFFSET 2
774 #define CSR_MCONTROL_EXECUTE_LENGTH 1
775 #define CSR_MCONTROL_EXECUTE (0x1ULL << CSR_MCONTROL_EXECUTE_OFFSET)
776 /*
777 * When set, the trigger fires on the virtual address or data of any
778 * store.
779 */
780 #define CSR_MCONTROL_STORE_OFFSET 1
781 #define CSR_MCONTROL_STORE_LENGTH 1
782 #define CSR_MCONTROL_STORE (0x1ULL << CSR_MCONTROL_STORE_OFFSET)
783 /*
784 * When set, the trigger fires on the virtual address or data of any
785 * load.
786 */
787 #define CSR_MCONTROL_LOAD_OFFSET 0
788 #define CSR_MCONTROL_LOAD_LENGTH 1
789 #define CSR_MCONTROL_LOAD (0x1ULL << CSR_MCONTROL_LOAD_OFFSET)
790 #define CSR_MCONTROL6 0x7a1
791 #define CSR_MCONTROL6_TYPE_OFFSET (XLEN-4)
792 #define CSR_MCONTROL6_TYPE_LENGTH 4
793 #define CSR_MCONTROL6_TYPE (0xfULL << CSR_MCONTROL6_TYPE_OFFSET)
794 #define CSR_MCONTROL6_DMODE_OFFSET (XLEN-5)
795 #define CSR_MCONTROL6_DMODE_LENGTH 1
796 #define CSR_MCONTROL6_DMODE (0x1ULL << CSR_MCONTROL6_DMODE_OFFSET)
797 /*
798 * When set, enable this trigger in VS-mode.
799 * This bit is hard-wired to 0 if the hart does not support
800 * virtualization mode.
801 */
802 #define CSR_MCONTROL6_VS_OFFSET 24
803 #define CSR_MCONTROL6_VS_LENGTH 1
804 #define CSR_MCONTROL6_VS (0x1ULL << CSR_MCONTROL6_VS_OFFSET)
805 /*
806 * When set, enable this trigger in VU-mode.
807 * This bit is hard-wired to 0 if the hart does not support
808 * virtualization mode.
809 */
810 #define CSR_MCONTROL6_VU_OFFSET 23
811 #define CSR_MCONTROL6_VU_LENGTH 1
812 #define CSR_MCONTROL6_VU (0x1ULL << CSR_MCONTROL6_VU_OFFSET)
813 /*
814 * If this bit is implemented, the hardware sets it when this
815 * trigger matches. The trigger's user can set or clear it at any
816 * time. It is used to determine which
817 * trigger(s) matched. If the bit is not implemented, it is always 0
818 * and writing it has no effect.
819 */
820 #define CSR_MCONTROL6_HIT_OFFSET 22
821 #define CSR_MCONTROL6_HIT_LENGTH 1
822 #define CSR_MCONTROL6_HIT (0x1ULL << CSR_MCONTROL6_HIT_OFFSET)
823 /*
824 * This bit determines the contents of the XLEN-bit compare values.
825 *
826 * 0: There is at least one compare value and it contains the lowest
827 * virtual address of the access.
828 * In addition, it is recommended that there are additional compare
829 * values for the other accessed virtual addresses match.
830 * (E.g. on a 32-bit read from 0x4000, the lowest address is 0x4000
831 * and the other addresses are 0x4001, 0x4002, and 0x4003.)
832 *
833 * 1: There is exactly one compare value and it contains the data
834 * value loaded or stored, or the instruction executed.
835 * Any bits beyond the size of the data access will contain 0.
836 */
837 #define CSR_MCONTROL6_SELECT_OFFSET 21
838 #define CSR_MCONTROL6_SELECT_LENGTH 1
839 #define CSR_MCONTROL6_SELECT (0x1ULL << CSR_MCONTROL6_SELECT_OFFSET)
840 /*
841 * 0: The action for this trigger will be taken just before the
842 * instruction that triggered it is committed, but after all preceding
843 * instructions are committed. \Rxepc or \RcsrDpc (depending
844 * on \FcsrMcontrolSixAction) must be set to the virtual address of the
845 * instruction that matched.
846 *
847 * If this is combined with \FcsrMcontrolSixLoad and
848 * \FcsrMcontrolSixSelect=1 then a memory access will be
849 * performed (including any side effects of performing such an access) even
850 * though the load will not update its destination register. Debuggers
851 * should consider this when setting such breakpoints on, for example,
852 * memory-mapped I/O addresses.
853 *
854 * 1: The action for this trigger will be taken after the instruction
855 * that triggered it is committed. It should be taken before the next
856 * instruction is committed, but it is better to implement triggers imprecisely
857 * than to not implement them at all. \Rxepc or
858 * \RcsrDpc (depending on \FcsrMcontrolSixAction) must be set to
859 * the virtual address of the next instruction that must be executed to
860 * preserve the program flow.
861 *
862 * Most hardware will only implement one timing or the other, possibly
863 * dependent on \FcsrMcontrolSixSelect, \FcsrMcontrolSixExecute,
864 * \FcsrMcontrolSixLoad, and \FcsrMcontrolSixStore. This bit
865 * primarily exists for the hardware to communicate to the debugger
866 * what will happen. Hardware may implement the bit fully writable, in
867 * which case the debugger has a little more control.
868 *
869 * Data load triggers with \FcsrMcontrolSixTiming of 0 will result in the same load
870 * happening again when the debugger lets the hart run. For data load
871 * triggers, debuggers must first attempt to set the breakpoint with
872 * \FcsrMcontrolSixTiming of 1.
873 *
874 * If a trigger with \FcsrMcontrolSixTiming of 0 matches, it is
875 * implementation-dependent whether that prevents a trigger with
876 * \FcsrMcontrolSixTiming of 1 matching as well.
877 */
878 #define CSR_MCONTROL6_TIMING_OFFSET 20
879 #define CSR_MCONTROL6_TIMING_LENGTH 1
880 #define CSR_MCONTROL6_TIMING (0x1ULL << CSR_MCONTROL6_TIMING_OFFSET)
881 /*
882 * 0: The trigger will attempt to match against an access of any size.
883 * The behavior is only well-defined if $|select|=0$, or if the access
884 * size is XLEN.
885 *
886 * 1: The trigger will only match against 8-bit memory accesses.
887 *
888 * 2: The trigger will only match against 16-bit memory accesses or
889 * execution of 16-bit instructions.
890 *
891 * 3: The trigger will only match against 32-bit memory accesses or
892 * execution of 32-bit instructions.
893 *
894 * 4: The trigger will only match against execution of 48-bit instructions.
895 *
896 * 5: The trigger will only match against 64-bit memory accesses or
897 * execution of 64-bit instructions.
898 *
899 * 6: The trigger will only match against execution of 80-bit instructions.
900 *
901 * 7: The trigger will only match against execution of 96-bit instructions.
902 *
903 * 8: The trigger will only match against execution of 112-bit instructions.
904 *
905 * 9: The trigger will only match against 128-bit memory accesses or
906 * execution of 128-bit instructions.
907 *
908 * An implementation must support the value of 0, but all other values
909 * are optional. When an implementation supports address triggers
910 * (\FcsrMcontrolSixSelect=0), it is recommended that those triggers
911 * support every access size that the hart supports, as well as for
912 * every instruction size that the hart supports.
913 *
914 * Implementations such as RV32D or RV64V are able to perform loads
915 * and stores that are wider than XLEN. Custom extensions may also
916 * support instructions that are wider than XLEN. Because
917 * \RcsrTdataTwo is of size XLEN, there is a known limitation that
918 * data value triggers (\FcsrMcontrolSixSelect=1) can only be supported
919 * for access sizes up to XLEN bits. When an implementation supports
920 * data value triggers (\FcsrMcontrolSixSelect=1), it is recommended
921 * that those triggers support every access size up to XLEN that the
922 * hart supports, as well as for every instruction length up to XLEN
923 * that the hart supports.
924 */
925 #define CSR_MCONTROL6_SIZE_OFFSET 16
926 #define CSR_MCONTROL6_SIZE_LENGTH 4
927 #define CSR_MCONTROL6_SIZE (0xfULL << CSR_MCONTROL6_SIZE_OFFSET)
928 /*
929 * The action to take when the trigger fires. The values are explained
930 * in Table~\ref{tab:action}.
931 */
932 #define CSR_MCONTROL6_ACTION_OFFSET 12
933 #define CSR_MCONTROL6_ACTION_LENGTH 4
934 #define CSR_MCONTROL6_ACTION (0xfULL << CSR_MCONTROL6_ACTION_OFFSET)
935 /*
936 * 0: When this trigger matches, the configured action is taken.
937 *
938 * 1: While this trigger does not match, it prevents the trigger with
939 * the next index from matching.
940 *
941 * A trigger chain starts on the first trigger with $|chain|=1$ after
942 * a trigger with $|chain|=0$, or simply on the first trigger if that
943 * has $|chain|=1$. It ends on the first trigger after that which has
944 * $|chain|=0$. This final trigger is part of the chain. The action
945 * on all but the final trigger is ignored. The action on that final
946 * trigger will be taken if and only if all the triggers in the chain
947 * match at the same time.
948 *
949 * Debuggers should not terminate a chain with a trigger with a
950 * different type. It is undefined when exactly such a chain fires.
951 *
952 * Because \FcsrMcontrolSixChain affects the next trigger, hardware must zero it in
953 * writes to \RcsrMcontrolSix that set \FcsrTdataOneDmode to 0 if the next trigger has
954 * \FcsrTdataOneDmode of 1.
955 * In addition hardware should ignore writes to \RcsrMcontrolSix that set
956 * \FcsrTdataOneDmode to 1 if the previous trigger has both \FcsrTdataOneDmode of 0 and
957 * \FcsrMcontrolSixChain of 1. Debuggers must avoid the latter case by checking
958 * \FcsrMcontrolSixChain on the previous trigger if they're writing \RcsrMcontrolSix.
959 *
960 * Implementations that wish to limit the maximum length of a trigger
961 * chain (eg. to meet timing requirements) may do so by zeroing
962 * \FcsrMcontrolSixChain in writes to \RcsrMcontrolSix that would make the chain too long.
963 */
964 #define CSR_MCONTROL6_CHAIN_OFFSET 11
965 #define CSR_MCONTROL6_CHAIN_LENGTH 1
966 #define CSR_MCONTROL6_CHAIN (0x1ULL << CSR_MCONTROL6_CHAIN_OFFSET)
967 /*
968 * 0: Matches when any compare value equals \RcsrTdataTwo.
969 *
970 * 1: Matches when the top $M$ bits of any compare value match the top
971 * $M$ bits of \RcsrTdataTwo.
972 * $M$ is $|XLEN|-1$ minus the index of the least-significant bit
973 * containing 0 in \RcsrTdataTwo.
974 * \RcsrTdataTwo is WARL and bit $|maskmax6|-1$ will be set to 0 if no
975 * less significant bits are written with 0.
976 * Legal values for \RcsrTdataTwo require $M + |maskmax6| \geq |XLEN|$ and $M\gt0$.
977 * See above for how to determine maskmax6.
978 *
979 * 2: Matches when any compare value is greater than (unsigned) or
980 * equal to \RcsrTdataTwo.
981 *
982 * 3: Matches when any compare value is less than (unsigned)
983 * \RcsrTdataTwo.
984 *
985 * 4: Matches when $\frac{|XLEN|}{2}-1$:$0$ of any compare value
986 * equals $\frac{|XLEN|}{2}-1$:$0$ of \RcsrTdataTwo after
987 * $\frac{|XLEN|}{2}-1$:$0$ of the compare value is ANDed with
988 * $|XLEN|-1$:$\frac{|XLEN|}{2}$ of \RcsrTdataTwo.
989 *
990 * 5: Matches when $|XLEN|-1$:$\frac{|XLEN|}{2}$ of any compare
991 * value equals $\frac{|XLEN|}{2}-1$:$0$ of \RcsrTdataTwo after
992 * $|XLEN|-1$:$\frac{|XLEN|}{2}$ of the compare value is ANDed with
993 * $|XLEN|-1$:$\frac{|XLEN|}{2}$ of \RcsrTdataTwo.
994 *
995 * 8: Matches when \FcsrMcontrolSixMatch$=0$ would not match.
996 *
997 * 9: Matches when \FcsrMcontrolSixMatch$=1$ would not match.
998 *
999 * 12: Matches when \FcsrMcontrolSixMatch$=4$ would not match.
1000 *
1001 * 13: Matches when \FcsrMcontrolSixMatch$=5$ would not match.
1002 *
1003 * Other values are reserved for future use.
1004 *
1005 * All comparisons only look at the lower XLEN (in the current mode)
1006 * bits of the compare values and of \RcsrTdataTwo.
1007 * When \FcsrMcontrolSelect=1 and access size is N, this is further
1008 * reduced, and comparisons only look at the lower N bits of the
1009 * compare values and of \RcsrTdataTwo.
1010 */
1011 #define CSR_MCONTROL6_MATCH_OFFSET 7
1012 #define CSR_MCONTROL6_MATCH_LENGTH 4
1013 #define CSR_MCONTROL6_MATCH (0xfULL << CSR_MCONTROL6_MATCH_OFFSET)
1014 /*
1015 * When set, enable this trigger in M-mode.
1016 */
1017 #define CSR_MCONTROL6_M_OFFSET 6
1018 #define CSR_MCONTROL6_M_LENGTH 1
1019 #define CSR_MCONTROL6_M (0x1ULL << CSR_MCONTROL6_M_OFFSET)
1020 /*
1021 * When set, enable this trigger in S/HS-mode.
1022 * This bit is hard-wired to 0 if the hart does not support
1023 * S-mode.
1024 */
1025 #define CSR_MCONTROL6_S_OFFSET 4
1026 #define CSR_MCONTROL6_S_LENGTH 1
1027 #define CSR_MCONTROL6_S (0x1ULL << CSR_MCONTROL6_S_OFFSET)
1028 /*
1029 * When set, enable this trigger in U-mode.
1030 * This bit is hard-wired to 0 if the hart does not support
1031 * U-mode.
1032 */
1033 #define CSR_MCONTROL6_U_OFFSET 3
1034 #define CSR_MCONTROL6_U_LENGTH 1
1035 #define CSR_MCONTROL6_U (0x1ULL << CSR_MCONTROL6_U_OFFSET)
1036 /*
1037 * When set, the trigger fires on the virtual address or opcode of an
1038 * instruction that is executed.
1039 */
1040 #define CSR_MCONTROL6_EXECUTE_OFFSET 2
1041 #define CSR_MCONTROL6_EXECUTE_LENGTH 1
1042 #define CSR_MCONTROL6_EXECUTE (0x1ULL << CSR_MCONTROL6_EXECUTE_OFFSET)
1043 /*
1044 * When set, the trigger fires on the virtual address or data of any
1045 * store.
1046 */
1047 #define CSR_MCONTROL6_STORE_OFFSET 1
1048 #define CSR_MCONTROL6_STORE_LENGTH 1
1049 #define CSR_MCONTROL6_STORE (0x1ULL << CSR_MCONTROL6_STORE_OFFSET)
1050 /*
1051 * When set, the trigger fires on the virtual address or data of any
1052 * load.
1053 */
1054 #define CSR_MCONTROL6_LOAD_OFFSET 0
1055 #define CSR_MCONTROL6_LOAD_LENGTH 1
1056 #define CSR_MCONTROL6_LOAD (0x1ULL << CSR_MCONTROL6_LOAD_OFFSET)
1057 #define CSR_ICOUNT 0x7a1
1058 #define CSR_ICOUNT_TYPE_OFFSET (XLEN-4)
1059 #define CSR_ICOUNT_TYPE_LENGTH 4
1060 #define CSR_ICOUNT_TYPE (0xfULL << CSR_ICOUNT_TYPE_OFFSET)
1061 #define CSR_ICOUNT_DMODE_OFFSET (XLEN-5)
1062 #define CSR_ICOUNT_DMODE_LENGTH 1
1063 #define CSR_ICOUNT_DMODE (0x1ULL << CSR_ICOUNT_DMODE_OFFSET)
1064 /*
1065 * When set, enable this trigger in VS-mode.
1066 * This bit is hard-wired to 0 if the hart does not support
1067 * virtualization mode.
1068 */
1069 #define CSR_ICOUNT_VS_OFFSET 26
1070 #define CSR_ICOUNT_VS_LENGTH 1
1071 #define CSR_ICOUNT_VS (0x1ULL << CSR_ICOUNT_VS_OFFSET)
1072 /*
1073 * When set, enable this trigger in VU-mode.
1074 * This bit is hard-wired to 0 if the hart does not support
1075 * virtualization mode.
1076 */
1077 #define CSR_ICOUNT_VU_OFFSET 25
1078 #define CSR_ICOUNT_VU_LENGTH 1
1079 #define CSR_ICOUNT_VU (0x1ULL << CSR_ICOUNT_VU_OFFSET)
1080 /*
1081 * If this bit is implemented, the hardware sets it when this
1082 * trigger matches. The trigger's user can set or clear it at any
1083 * time. It is used to determine which
1084 * trigger(s) matched. If the bit is not implemented, it is always 0
1085 * and writing it has no effect.
1086 */
1087 #define CSR_ICOUNT_HIT_OFFSET 24
1088 #define CSR_ICOUNT_HIT_LENGTH 1
1089 #define CSR_ICOUNT_HIT (0x1ULL << CSR_ICOUNT_HIT_OFFSET)
1090 /*
1091 * When count is decremented to 0, the trigger fires. Instead of
1092 * changing \FcsrIcountCount from 1 to 0, it is also acceptable for hardware to
1093 * clear \FcsrIcountM, \FcsrIcountS, \FcsrIcountU, \FcsrIcountVs, and
1094 * \FcsrIcountVu. This allows \FcsrIcountCount to be hard-wired
1095 * to 1 if this register just exists for single step.
1096 */
1097 #define CSR_ICOUNT_COUNT_OFFSET 10
1098 #define CSR_ICOUNT_COUNT_LENGTH 14
1099 #define CSR_ICOUNT_COUNT (0x3fffULL << CSR_ICOUNT_COUNT_OFFSET)
1100 /*
1101 * When set, enable this trigger in M-mode.
1102 */
1103 #define CSR_ICOUNT_M_OFFSET 9
1104 #define CSR_ICOUNT_M_LENGTH 1
1105 #define CSR_ICOUNT_M (0x1ULL << CSR_ICOUNT_M_OFFSET)
1106 /*
1107 * This bit becomes set when \FcsrIcountCount is decremented from 1
1108 * to 0. It is cleared when the trigger fires.
1109 */
1110 #define CSR_ICOUNT_PENDING_OFFSET 8
1111 #define CSR_ICOUNT_PENDING_LENGTH 1
1112 #define CSR_ICOUNT_PENDING (0x1ULL << CSR_ICOUNT_PENDING_OFFSET)
1113 /*
1114 * When set, enable this trigger in S/HS-mode.
1115 * This bit is hard-wired to 0 if the hart does not support
1116 * S-mode.
1117 */
1118 #define CSR_ICOUNT_S_OFFSET 7
1119 #define CSR_ICOUNT_S_LENGTH 1
1120 #define CSR_ICOUNT_S (0x1ULL << CSR_ICOUNT_S_OFFSET)
1121 /*
1122 * When set, enable this trigger in U-mode.
1123 * This bit is hard-wired to 0 if the hart does not support
1124 * U-mode.
1125 */
1126 #define CSR_ICOUNT_U_OFFSET 6
1127 #define CSR_ICOUNT_U_LENGTH 1
1128 #define CSR_ICOUNT_U (0x1ULL << CSR_ICOUNT_U_OFFSET)
1129 /*
1130 * The action to take when the trigger fires. The values are explained
1131 * in Table~\ref{tab:action}.
1132 */
1133 #define CSR_ICOUNT_ACTION_OFFSET 0
1134 #define CSR_ICOUNT_ACTION_LENGTH 6
1135 #define CSR_ICOUNT_ACTION (0x3fULL << CSR_ICOUNT_ACTION_OFFSET)
1136 #define CSR_ITRIGGER 0x7a1
1137 #define CSR_ITRIGGER_TYPE_OFFSET (XLEN-4)
1138 #define CSR_ITRIGGER_TYPE_LENGTH 4
1139 #define CSR_ITRIGGER_TYPE (0xfULL << CSR_ITRIGGER_TYPE_OFFSET)
1140 #define CSR_ITRIGGER_DMODE_OFFSET (XLEN-5)
1141 #define CSR_ITRIGGER_DMODE_LENGTH 1
1142 #define CSR_ITRIGGER_DMODE (0x1ULL << CSR_ITRIGGER_DMODE_OFFSET)
1143 /*
1144 * If this bit is implemented, the hardware sets it when this
1145 * trigger matches. The trigger's user can set or clear it at any
1146 * time. It is used to determine which
1147 * trigger(s) matched. If the bit is not implemented, it is always 0
1148 * and writing it has no effect.
1149 */
1150 #define CSR_ITRIGGER_HIT_OFFSET (XLEN-6)
1151 #define CSR_ITRIGGER_HIT_LENGTH 1
1152 #define CSR_ITRIGGER_HIT (0x1ULL << CSR_ITRIGGER_HIT_OFFSET)
1153 /*
1154 * When set, enable this trigger for interrupts that are taken from VS
1155 * mode.
1156 * This bit is hard-wired to 0 if the hart does not support
1157 * virtualization mode.
1158 */
1159 #define CSR_ITRIGGER_VS_OFFSET 12
1160 #define CSR_ITRIGGER_VS_LENGTH 1
1161 #define CSR_ITRIGGER_VS (0x1ULL << CSR_ITRIGGER_VS_OFFSET)
1162 /*
1163 * When set, enable this trigger for interrupts that are taken from VU
1164 * mode.
1165 * This bit is hard-wired to 0 if the hart does not support
1166 * virtualization mode.
1167 */
1168 #define CSR_ITRIGGER_VU_OFFSET 11
1169 #define CSR_ITRIGGER_VU_LENGTH 1
1170 #define CSR_ITRIGGER_VU (0x1ULL << CSR_ITRIGGER_VU_OFFSET)
1171 /*
1172 * When set, enable this trigger for interrupts that are taken from M
1173 * mode.
1174 */
1175 #define CSR_ITRIGGER_M_OFFSET 9
1176 #define CSR_ITRIGGER_M_LENGTH 1
1177 #define CSR_ITRIGGER_M (0x1ULL << CSR_ITRIGGER_M_OFFSET)
1178 /*
1179 * When set, enable this trigger for interrupts that are taken from S/HS
1180 * mode.
1181 * This bit is hard-wired to 0 if the hart does not support
1182 * S-mode.
1183 */
1184 #define CSR_ITRIGGER_S_OFFSET 7
1185 #define CSR_ITRIGGER_S_LENGTH 1
1186 #define CSR_ITRIGGER_S (0x1ULL << CSR_ITRIGGER_S_OFFSET)
1187 /*
1188 * When set, enable this trigger for interrupts that are taken from U
1189 * mode.
1190 * This bit is hard-wired to 0 if the hart does not support
1191 * U-mode.
1192 */
1193 #define CSR_ITRIGGER_U_OFFSET 6
1194 #define CSR_ITRIGGER_U_LENGTH 1
1195 #define CSR_ITRIGGER_U (0x1ULL << CSR_ITRIGGER_U_OFFSET)
1196 /*
1197 * The action to take when the trigger fires. The values are explained
1198 * in Table~\ref{tab:action}.
1199 */
1200 #define CSR_ITRIGGER_ACTION_OFFSET 0
1201 #define CSR_ITRIGGER_ACTION_LENGTH 6
1202 #define CSR_ITRIGGER_ACTION (0x3fULL << CSR_ITRIGGER_ACTION_OFFSET)
1203 #define CSR_ETRIGGER 0x7a1
1204 #define CSR_ETRIGGER_TYPE_OFFSET (XLEN-4)
1205 #define CSR_ETRIGGER_TYPE_LENGTH 4
1206 #define CSR_ETRIGGER_TYPE (0xfULL << CSR_ETRIGGER_TYPE_OFFSET)
1207 #define CSR_ETRIGGER_DMODE_OFFSET (XLEN-5)
1208 #define CSR_ETRIGGER_DMODE_LENGTH 1
1209 #define CSR_ETRIGGER_DMODE (0x1ULL << CSR_ETRIGGER_DMODE_OFFSET)
1210 /*
1211 * If this bit is implemented, the hardware sets it when this
1212 * trigger matches. The trigger's user can set or clear it at any
1213 * time. It is used to determine which
1214 * trigger(s) matched. If the bit is not implemented, it is always 0
1215 * and writing it has no effect.
1216 */
1217 #define CSR_ETRIGGER_HIT_OFFSET (XLEN-6)
1218 #define CSR_ETRIGGER_HIT_LENGTH 1
1219 #define CSR_ETRIGGER_HIT (0x1ULL << CSR_ETRIGGER_HIT_OFFSET)
1220 /*
1221 * When set, enable this trigger for exceptions that are taken from VS
1222 * mode.
1223 * This bit is hard-wired to 0 if the hart does not support
1224 * virtualization mode.
1225 */
1226 #define CSR_ETRIGGER_VS_OFFSET 12
1227 #define CSR_ETRIGGER_VS_LENGTH 1
1228 #define CSR_ETRIGGER_VS (0x1ULL << CSR_ETRIGGER_VS_OFFSET)
1229 /*
1230 * When set, enable this trigger for exceptions that are taken from VU
1231 * mode.
1232 * This bit is hard-wired to 0 if the hart does not support
1233 * virtualization mode.
1234 */
1235 #define CSR_ETRIGGER_VU_OFFSET 11
1236 #define CSR_ETRIGGER_VU_LENGTH 1
1237 #define CSR_ETRIGGER_VU (0x1ULL << CSR_ETRIGGER_VU_OFFSET)
1238 /*
1239 * When set, non-maskable interrupts cause this
1240 * trigger to fire, regardless of the values of \FcsrEtriggerM, \FcsrEtriggerS, and \FcsrEtriggerU.
1241 */
1242 #define CSR_ETRIGGER_NMI_OFFSET 10
1243 #define CSR_ETRIGGER_NMI_LENGTH 1
1244 #define CSR_ETRIGGER_NMI (0x1ULL << CSR_ETRIGGER_NMI_OFFSET)
1245 /*
1246 * When set, enable this trigger for exceptions that are taken from M
1247 * mode.
1248 */
1249 #define CSR_ETRIGGER_M_OFFSET 9
1250 #define CSR_ETRIGGER_M_LENGTH 1
1251 #define CSR_ETRIGGER_M (0x1ULL << CSR_ETRIGGER_M_OFFSET)
1252 /*
1253 * When set, enable this trigger for exceptions that are taken from S/HS
1254 * mode.
1255 * This bit is hard-wired to 0 if the hart does not support
1256 * S-mode.
1257 */
1258 #define CSR_ETRIGGER_S_OFFSET 7
1259 #define CSR_ETRIGGER_S_LENGTH 1
1260 #define CSR_ETRIGGER_S (0x1ULL << CSR_ETRIGGER_S_OFFSET)
1261 /*
1262 * When set, enable this trigger for exceptions that are taken from U
1263 * mode.
1264 * This bit is hard-wired to 0 if the hart does not support
1265 * U-mode.
1266 */
1267 #define CSR_ETRIGGER_U_OFFSET 6
1268 #define CSR_ETRIGGER_U_LENGTH 1
1269 #define CSR_ETRIGGER_U (0x1ULL << CSR_ETRIGGER_U_OFFSET)
1270 /*
1271 * The action to take when the trigger fires. The values are explained
1272 * in Table~\ref{tab:action}.
1273 */
1274 #define CSR_ETRIGGER_ACTION_OFFSET 0
1275 #define CSR_ETRIGGER_ACTION_LENGTH 6
1276 #define CSR_ETRIGGER_ACTION (0x3fULL << CSR_ETRIGGER_ACTION_OFFSET)
1277 #define CSR_TMEXTTRIGGER 0x7a1
1278 #define CSR_TMEXTTRIGGER_TYPE_OFFSET (XLEN-4)
1279 #define CSR_TMEXTTRIGGER_TYPE_LENGTH 4
1280 #define CSR_TMEXTTRIGGER_TYPE (0xfULL << CSR_TMEXTTRIGGER_TYPE_OFFSET)
1281 #define CSR_TMEXTTRIGGER_DMODE_OFFSET (XLEN-5)
1282 #define CSR_TMEXTTRIGGER_DMODE_LENGTH 1
1283 #define CSR_TMEXTTRIGGER_DMODE (0x1ULL << CSR_TMEXTTRIGGER_DMODE_OFFSET)
1284 /*
1285 * If this bit is implemented, the hardware sets it when this
1286 * trigger matches. The trigger's user can set or clear it at any
1287 * time. It is used to determine which
1288 * trigger(s) matched. If the bit is not implemented, it is always 0
1289 * and writing it has no effect.
1290 */
1291 #define CSR_TMEXTTRIGGER_HIT_OFFSET (XLEN-6)
1292 #define CSR_TMEXTTRIGGER_HIT_LENGTH 1
1293 #define CSR_TMEXTTRIGGER_HIT (0x1ULL << CSR_TMEXTTRIGGER_HIT_OFFSET)
1294 /*
1295 * This optional bit, when set, causes this trigger to fire whenever an attached
1296 * interrupt controller signals a trigger.
1297 */
1298 #define CSR_TMEXTTRIGGER_INTCTL_OFFSET 22
1299 #define CSR_TMEXTTRIGGER_INTCTL_LENGTH 1
1300 #define CSR_TMEXTTRIGGER_INTCTL (0x1ULL << CSR_TMEXTTRIGGER_INTCTL_OFFSET)
1301 /*
1302 * Selects any combination of up to 16 external debug trigger inputs
1303 * that cause this trigger to fire.
1304 */
1305 #define CSR_TMEXTTRIGGER_SELECT_OFFSET 6
1306 #define CSR_TMEXTTRIGGER_SELECT_LENGTH 16
1307 #define CSR_TMEXTTRIGGER_SELECT (0xffffULL << CSR_TMEXTTRIGGER_SELECT_OFFSET)
1308 /*
1309 * The action to take when the trigger fires. The values are explained
1310 * in Table~\ref{tab:action}.
1311 */
1312 #define CSR_TMEXTTRIGGER_ACTION_OFFSET 0
1313 #define CSR_TMEXTTRIGGER_ACTION_LENGTH 6
1314 #define CSR_TMEXTTRIGGER_ACTION (0x3fULL << CSR_TMEXTTRIGGER_ACTION_OFFSET)
1315 #define CSR_TEXTRA32 0x7a3
1316 /*
1317 * Data used together with \FcsrTextraThirtytwoMhselect.
1318 */
1319 #define CSR_TEXTRA32_MHVALUE_OFFSET 26
1320 #define CSR_TEXTRA32_MHVALUE_LENGTH 6
1321 #define CSR_TEXTRA32_MHVALUE (0x3fU << CSR_TEXTRA32_MHVALUE_OFFSET)
1322 /*
1323 * 0: Ignore \FcsrTextraThirtytwoMhvalue.
1324 *
1325 * 4: This trigger will only match if the low bits of
1326 * \RcsrMcontext/\RcsrHcontext equal \FcsrTextraThirtytwoMhvalue.
1327 *
1328 * 1, 5: This trigger will only match if the low bits of
1329 * \RcsrMcontext/\RcsrHcontext equal \{\FcsrTextraThirtytwoMhvalue, mhselect[2]\}.
1330 *
1331 * 2, 6: This trigger will only match if VMID in hgatp equals the lower VMIDMAX
1332 * (defined in the Privileged Spec) bits of \{\FcsrTextraThirtytwoMhvalue, mhselect[2]\}.
1333 *
1334 * 3, 7: Reserved.
1335 *
1336 * If the H extension is not supported, the only legal values are 0 and 4.
1337 */
1338 #define CSR_TEXTRA32_MHSELECT_OFFSET 23
1339 #define CSR_TEXTRA32_MHSELECT_LENGTH 3
1340 #define CSR_TEXTRA32_MHSELECT (0x7U << CSR_TEXTRA32_MHSELECT_OFFSET)
1341 /*
1342 * When the least significant bit of this field is 1, it causes bits 7:0
1343 * in the comparison to be ignored, when \FcsrTextraThirtytwoSselect=1.
1344 * When the next most significant bit of this field is 1, it causes bits 15:8
1345 * to be ignored in the comparison, when \FcsrTextraThirtytwoSselect=1.
1346 */
1347 #define CSR_TEXTRA32_SBYTEMASK_OFFSET 18
1348 #define CSR_TEXTRA32_SBYTEMASK_LENGTH 2
1349 #define CSR_TEXTRA32_SBYTEMASK (0x3U << CSR_TEXTRA32_SBYTEMASK_OFFSET)
1350 /*
1351 * Data used together with \FcsrTextraThirtytwoSselect.
1352 *
1353 * This field should be tied to 0 when S-mode is not supported.
1354 */
1355 #define CSR_TEXTRA32_SVALUE_OFFSET 2
1356 #define CSR_TEXTRA32_SVALUE_LENGTH 16
1357 #define CSR_TEXTRA32_SVALUE (0xffffU << CSR_TEXTRA32_SVALUE_OFFSET)
1358 /*
1359 * 0: Ignore \FcsrTextraThirtytwoSvalue.
1360 *
1361 * 1: This trigger will only match if the low bits of
1362 * \RcsrScontext equal \FcsrTextraThirtytwoSvalue.
1363 *
1364 * 2: This trigger will only match if the currently active ASID
1365 * value, from either \Rsatp or \Rvsatp,
1366 * equals the lower ASIDMAX (defined in the Privileged Spec) bits of
1367 * \FcsrTextraThirtytwoSvalue.
1368 *
1369 * This field should be tied to 0 when S-mode is not supported.
1370 */
1371 #define CSR_TEXTRA32_SSELECT_OFFSET 0
1372 #define CSR_TEXTRA32_SSELECT_LENGTH 2
1373 #define CSR_TEXTRA32_SSELECT (0x3U << CSR_TEXTRA32_SSELECT_OFFSET)
1374 #define CSR_TEXTRA64 0x7a3
1375 #define CSR_TEXTRA64_MHVALUE_OFFSET 51
1376 #define CSR_TEXTRA64_MHVALUE_LENGTH 13
1377 #define CSR_TEXTRA64_MHVALUE (0x1fffULL << CSR_TEXTRA64_MHVALUE_OFFSET)
1378 #define CSR_TEXTRA64_MHSELECT_OFFSET 48
1379 #define CSR_TEXTRA64_MHSELECT_LENGTH 3
1380 #define CSR_TEXTRA64_MHSELECT (0x7ULL << CSR_TEXTRA64_MHSELECT_OFFSET)
1381 /*
1382 * When the least significant bit of this field is 1, it causes bits 7:0
1383 * in the comparison to be ignored, when \FcsrTextraSixtyfourSselect=1.
1384 * Likewise, the second bit controls the comparison of bits 15:8,
1385 * third bit controls the comparison of bits 23:16,
1386 * fourth bit controls the comparison of bits 31:24, and
1387 * fifth bit controls the comparison of bits 33:32.
1388 */
1389 #define CSR_TEXTRA64_SBYTEMASK_OFFSET 36
1390 #define CSR_TEXTRA64_SBYTEMASK_LENGTH 5
1391 #define CSR_TEXTRA64_SBYTEMASK (0x1fULL << CSR_TEXTRA64_SBYTEMASK_OFFSET)
1392 #define CSR_TEXTRA64_SVALUE_OFFSET 2
1393 #define CSR_TEXTRA64_SVALUE_LENGTH 34
1394 #define CSR_TEXTRA64_SVALUE (0x3ffffffffULL << CSR_TEXTRA64_SVALUE_OFFSET)
1395 #define CSR_TEXTRA64_SSELECT_OFFSET 0
1396 #define CSR_TEXTRA64_SSELECT_LENGTH 2
1397 #define CSR_TEXTRA64_SSELECT (0x3ULL << CSR_TEXTRA64_SSELECT_OFFSET)
1398 #define DM_DMSTATUS 0x11
1399 /*
1400 * 0: Unimplemented, or \FdmDmcontrolNdmreset is zero and no ndmreset is currently
1401 * in progress.
1402 *
1403 * 1: \FdmDmcontrolNdmreset is currently nonzero, or there is an ndmreset in progress.
1404 */
1405 #define DM_DMSTATUS_NDMRESETPENDING_OFFSET 24
1406 #define DM_DMSTATUS_NDMRESETPENDING_LENGTH 1
1407 #define DM_DMSTATUS_NDMRESETPENDING (0x1U << DM_DMSTATUS_NDMRESETPENDING_OFFSET)
1408 /*
1409 * 0: The per-hart {\tt unavail} bits reflect the current state of the hart.
1410 *
1411 * 1: The per-hart {\tt unavail} bits are sticky. Once they are set, they will
1412 * not clear until the debugger acknowledges them using \FdmDmcontrolAckunavail.
1413 */
1414 #define DM_DMSTATUS_STICKYUNAVAIL_OFFSET 23
1415 #define DM_DMSTATUS_STICKYUNAVAIL_LENGTH 1
1416 #define DM_DMSTATUS_STICKYUNAVAIL (0x1U << DM_DMSTATUS_STICKYUNAVAIL_OFFSET)
1417 /*
1418 * If 1, then there is an implicit {\tt ebreak} instruction at the
1419 * non-existent word immediately after the Program Buffer. This saves
1420 * the debugger from having to write the {\tt ebreak} itself, and
1421 * allows the Program Buffer to be one word smaller.
1422 *
1423 * This must be 1 when \FdmAbstractcsProgbufsize is 1.
1424 */
1425 #define DM_DMSTATUS_IMPEBREAK_OFFSET 22
1426 #define DM_DMSTATUS_IMPEBREAK_LENGTH 1
1427 #define DM_DMSTATUS_IMPEBREAK (0x1U << DM_DMSTATUS_IMPEBREAK_OFFSET)
1428 /*
1429 * This field is 1 when all currently selected harts have been reset
1430 * and reset has not been acknowledged for any of them.
1431 */
1432 #define DM_DMSTATUS_ALLHAVERESET_OFFSET 19
1433 #define DM_DMSTATUS_ALLHAVERESET_LENGTH 1
1434 #define DM_DMSTATUS_ALLHAVERESET (0x1U << DM_DMSTATUS_ALLHAVERESET_OFFSET)
1435 /*
1436 * This field is 1 when at least one currently selected hart has been
1437 * reset and reset has not been acknowledged for that hart.
1438 */
1439 #define DM_DMSTATUS_ANYHAVERESET_OFFSET 18
1440 #define DM_DMSTATUS_ANYHAVERESET_LENGTH 1
1441 #define DM_DMSTATUS_ANYHAVERESET (0x1U << DM_DMSTATUS_ANYHAVERESET_OFFSET)
1442 /*
1443 * This field is 1 when all currently selected harts have acknowledged
1444 * their last resume request.
1445 */
1446 #define DM_DMSTATUS_ALLRESUMEACK_OFFSET 17
1447 #define DM_DMSTATUS_ALLRESUMEACK_LENGTH 1
1448 #define DM_DMSTATUS_ALLRESUMEACK (0x1U << DM_DMSTATUS_ALLRESUMEACK_OFFSET)
1449 /*
1450 * This field is 1 when any currently selected hart has acknowledged
1451 * its last resume request.
1452 */
1453 #define DM_DMSTATUS_ANYRESUMEACK_OFFSET 16
1454 #define DM_DMSTATUS_ANYRESUMEACK_LENGTH 1
1455 #define DM_DMSTATUS_ANYRESUMEACK (0x1U << DM_DMSTATUS_ANYRESUMEACK_OFFSET)
1456 /*
1457 * This field is 1 when all currently selected harts do not exist in
1458 * this hardware platform.
1459 */
1460 #define DM_DMSTATUS_ALLNONEXISTENT_OFFSET 15
1461 #define DM_DMSTATUS_ALLNONEXISTENT_LENGTH 1
1462 #define DM_DMSTATUS_ALLNONEXISTENT (0x1U << DM_DMSTATUS_ALLNONEXISTENT_OFFSET)
1463 /*
1464 * This field is 1 when any currently selected hart does not exist in
1465 * this hardware platform.
1466 */
1467 #define DM_DMSTATUS_ANYNONEXISTENT_OFFSET 14
1468 #define DM_DMSTATUS_ANYNONEXISTENT_LENGTH 1
1469 #define DM_DMSTATUS_ANYNONEXISTENT (0x1U << DM_DMSTATUS_ANYNONEXISTENT_OFFSET)
1470 /*
1471 * This field is 1 when all currently selected harts are
1472 * unavailable, or (if \FdmDmstatusStickyunavail is 1) were
1473 * unavailable without that being acknowledged.
1474 */
1475 #define DM_DMSTATUS_ALLUNAVAIL_OFFSET 13
1476 #define DM_DMSTATUS_ALLUNAVAIL_LENGTH 1
1477 #define DM_DMSTATUS_ALLUNAVAIL (0x1U << DM_DMSTATUS_ALLUNAVAIL_OFFSET)
1478 /*
1479 * This field is 1 when any currently selected hart is unavailable,
1480 * or (if \FdmDmstatusStickyunavail is 1) was unavailable without
1481 * that being acknowledged.
1482 */
1483 #define DM_DMSTATUS_ANYUNAVAIL_OFFSET 12
1484 #define DM_DMSTATUS_ANYUNAVAIL_LENGTH 1
1485 #define DM_DMSTATUS_ANYUNAVAIL (0x1U << DM_DMSTATUS_ANYUNAVAIL_OFFSET)
1486 /*
1487 * This field is 1 when all currently selected harts are running.
1488 */
1489 #define DM_DMSTATUS_ALLRUNNING_OFFSET 11
1490 #define DM_DMSTATUS_ALLRUNNING_LENGTH 1
1491 #define DM_DMSTATUS_ALLRUNNING (0x1U << DM_DMSTATUS_ALLRUNNING_OFFSET)
1492 /*
1493 * This field is 1 when any currently selected hart is running.
1494 */
1495 #define DM_DMSTATUS_ANYRUNNING_OFFSET 10
1496 #define DM_DMSTATUS_ANYRUNNING_LENGTH 1
1497 #define DM_DMSTATUS_ANYRUNNING (0x1U << DM_DMSTATUS_ANYRUNNING_OFFSET)
1498 /*
1499 * This field is 1 when all currently selected harts are halted.
1500 */
1501 #define DM_DMSTATUS_ALLHALTED_OFFSET 9
1502 #define DM_DMSTATUS_ALLHALTED_LENGTH 1
1503 #define DM_DMSTATUS_ALLHALTED (0x1U << DM_DMSTATUS_ALLHALTED_OFFSET)
1504 /*
1505 * This field is 1 when any currently selected hart is halted.
1506 */
1507 #define DM_DMSTATUS_ANYHALTED_OFFSET 8
1508 #define DM_DMSTATUS_ANYHALTED_LENGTH 1
1509 #define DM_DMSTATUS_ANYHALTED (0x1U << DM_DMSTATUS_ANYHALTED_OFFSET)
1510 /*
1511 * 0: Authentication is required before using the DM.
1512 *
1513 * 1: The authentication check has passed.
1514 *
1515 * On components that don't implement authentication, this bit must be
1516 * preset as 1.
1517 */
1518 #define DM_DMSTATUS_AUTHENTICATED_OFFSET 7
1519 #define DM_DMSTATUS_AUTHENTICATED_LENGTH 1
1520 #define DM_DMSTATUS_AUTHENTICATED (0x1U << DM_DMSTATUS_AUTHENTICATED_OFFSET)
1521 /*
1522 * 0: The authentication module is ready to process the next
1523 * read/write to \RdmAuthdata.
1524 *
1525 * 1: The authentication module is busy. Accessing \RdmAuthdata results
1526 * in unspecified behavior.
1527 *
1528 * \FdmDmstatusAuthbusy only becomes set in immediate response to an access to
1529 * \RdmAuthdata.
1530 */
1531 #define DM_DMSTATUS_AUTHBUSY_OFFSET 6
1532 #define DM_DMSTATUS_AUTHBUSY_LENGTH 1
1533 #define DM_DMSTATUS_AUTHBUSY (0x1U << DM_DMSTATUS_AUTHBUSY_OFFSET)
1534 /*
1535 * 1 if this Debug Module supports halt-on-reset functionality
1536 * controllable by the \FdmDmcontrolSetresethaltreq and \FdmDmcontrolClrresethaltreq bits.
1537 * 0 otherwise.
1538 */
1539 #define DM_DMSTATUS_HASRESETHALTREQ_OFFSET 5
1540 #define DM_DMSTATUS_HASRESETHALTREQ_LENGTH 1
1541 #define DM_DMSTATUS_HASRESETHALTREQ (0x1U << DM_DMSTATUS_HASRESETHALTREQ_OFFSET)
1542 /*
1543 * 0: \RdmConfstrptrZero--\RdmConfstrptrThree hold information which
1544 * is not relevant to the configuration string.
1545 *
1546 * 1: \RdmConfstrptrZero--\RdmConfstrptrThree hold the address of the
1547 * configuration string.
1548 */
1549 #define DM_DMSTATUS_CONFSTRPTRVALID_OFFSET 4
1550 #define DM_DMSTATUS_CONFSTRPTRVALID_LENGTH 1
1551 #define DM_DMSTATUS_CONFSTRPTRVALID (0x1U << DM_DMSTATUS_CONFSTRPTRVALID_OFFSET)
1552 /*
1553 * 0: There is no Debug Module present.
1554 *
1555 * 1: There is a Debug Module and it conforms to version 0.11 of this
1556 * specification.
1557 *
1558 * 2: There is a Debug Module and it conforms to version 0.13 of this
1559 * specification.
1560 *
1561 * 3: There is a Debug Module and it conforms to version 1.0 of this
1562 * specification.
1563 *
1564 * 15: There is a Debug Module but it does not conform to any
1565 * available version of this spec.
1566 */
1567 #define DM_DMSTATUS_VERSION_OFFSET 0
1568 #define DM_DMSTATUS_VERSION_LENGTH 4
1569 #define DM_DMSTATUS_VERSION (0xfU << DM_DMSTATUS_VERSION_OFFSET)
1570 #define DM_DMCONTROL 0x10
1571 /*
1572 * Writing 0 clears the halt request bit for all currently selected
1573 * harts. This may cancel outstanding halt requests for those harts.
1574 *
1575 * Writing 1 sets the halt request bit for all currently selected
1576 * harts. Running harts will halt whenever their halt request bit is
1577 * set.
1578 *
1579 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1580 */
1581 #define DM_DMCONTROL_HALTREQ_OFFSET 31
1582 #define DM_DMCONTROL_HALTREQ_LENGTH 1
1583 #define DM_DMCONTROL_HALTREQ (0x1U << DM_DMCONTROL_HALTREQ_OFFSET)
1584 /*
1585 * Writing 1 causes the currently selected harts to resume once, if
1586 * they are halted when the write occurs. It also clears the resume
1587 * ack bit for those harts.
1588 *
1589 * \FdmDmcontrolResumereq is ignored if \FdmDmcontrolHaltreq is set.
1590 *
1591 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1592 */
1593 #define DM_DMCONTROL_RESUMEREQ_OFFSET 30
1594 #define DM_DMCONTROL_RESUMEREQ_LENGTH 1
1595 #define DM_DMCONTROL_RESUMEREQ (0x1U << DM_DMCONTROL_RESUMEREQ_OFFSET)
1596 /*
1597 * This optional field writes the reset bit for all the currently
1598 * selected harts. To perform a reset the debugger writes 1, and then
1599 * writes 0 to deassert the reset signal.
1600 *
1601 * While this bit is 1, the debugger must not change which harts are
1602 * selected.
1603 *
1604 * If this feature is not implemented, the bit always stays 0, so
1605 * after writing 1 the debugger can read the register back to see if
1606 * the feature is supported.
1607 *
1608 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1609 */
1610 #define DM_DMCONTROL_HARTRESET_OFFSET 29
1611 #define DM_DMCONTROL_HARTRESET_LENGTH 1
1612 #define DM_DMCONTROL_HARTRESET (0x1U << DM_DMCONTROL_HARTRESET_OFFSET)
1613 /*
1614 * 0: No effect.
1615 *
1616 * 1: Clears {\tt havereset} for any selected harts.
1617 *
1618 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1619 */
1620 #define DM_DMCONTROL_ACKHAVERESET_OFFSET 28
1621 #define DM_DMCONTROL_ACKHAVERESET_LENGTH 1
1622 #define DM_DMCONTROL_ACKHAVERESET (0x1U << DM_DMCONTROL_ACKHAVERESET_OFFSET)
1623 /*
1624 * 0: No effect.
1625 *
1626 * 1: Clears {\tt unavail} for any selected harts.
1627 *
1628 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1629 */
1630 #define DM_DMCONTROL_ACKUNAVAIL_OFFSET 27
1631 #define DM_DMCONTROL_ACKUNAVAIL_LENGTH 1
1632 #define DM_DMCONTROL_ACKUNAVAIL (0x1U << DM_DMCONTROL_ACKUNAVAIL_OFFSET)
1633 /*
1634 * Selects the definition of currently selected harts.
1635 *
1636 * 0: There is a single currently selected hart, that is selected by \Fhartsel.
1637 *
1638 * 1: There may be multiple currently selected harts -- the hart
1639 * selected by \Fhartsel, plus those selected by the hart array mask
1640 * register.
1641 *
1642 * An implementation which does not implement the hart array mask register
1643 * must tie this field to 0. A debugger which wishes to use the hart array
1644 * mask register feature should set this bit and read back to see if the functionality
1645 * is supported.
1646 */
1647 #define DM_DMCONTROL_HASEL_OFFSET 26
1648 #define DM_DMCONTROL_HASEL_LENGTH 1
1649 #define DM_DMCONTROL_HASEL (0x1U << DM_DMCONTROL_HASEL_OFFSET)
1650 /*
1651 * The low 10 bits of \Fhartsel: the DM-specific index of the hart to
1652 * select. This hart is always part of the currently selected harts.
1653 */
1654 #define DM_DMCONTROL_HARTSELLO_OFFSET 16
1655 #define DM_DMCONTROL_HARTSELLO_LENGTH 10
1656 #define DM_DMCONTROL_HARTSELLO (0x3ffU << DM_DMCONTROL_HARTSELLO_OFFSET)
1657 /*
1658 * The high 10 bits of \Fhartsel: the DM-specific index of the hart to
1659 * select. This hart is always part of the currently selected harts.
1660 */
1661 #define DM_DMCONTROL_HARTSELHI_OFFSET 6
1662 #define DM_DMCONTROL_HARTSELHI_LENGTH 10
1663 #define DM_DMCONTROL_HARTSELHI (0x3ffU << DM_DMCONTROL_HARTSELHI_OFFSET)
1664 /*
1665 * This optional field sets \Fkeepalive for all currently selected
1666 * harts, unless \FdmDmcontrolClrkeepalive is simultaneously set to
1667 * 1.
1668 *
1669 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1670 */
1671 #define DM_DMCONTROL_SETKEEPALIVE_OFFSET 5
1672 #define DM_DMCONTROL_SETKEEPALIVE_LENGTH 1
1673 #define DM_DMCONTROL_SETKEEPALIVE (0x1U << DM_DMCONTROL_SETKEEPALIVE_OFFSET)
1674 /*
1675 * This optional field clears \Fkeepalive for all currently selected
1676 * harts.
1677 *
1678 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1679 */
1680 #define DM_DMCONTROL_CLRKEEPALIVE_OFFSET 4
1681 #define DM_DMCONTROL_CLRKEEPALIVE_LENGTH 1
1682 #define DM_DMCONTROL_CLRKEEPALIVE (0x1U << DM_DMCONTROL_CLRKEEPALIVE_OFFSET)
1683 /*
1684 * This optional field writes the halt-on-reset request bit for all
1685 * currently selected harts, unless \FdmDmcontrolClrresethaltreq is
1686 * simultaneously set to 1.
1687 * When set to 1, each selected hart will halt upon the next deassertion
1688 * of its reset. The halt-on-reset request bit is not automatically
1689 * cleared. The debugger must write to \FdmDmcontrolClrresethaltreq to clear it.
1690 *
1691 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1692 *
1693 * If \FdmDmstatusHasresethaltreq is 0, this field is not implemented.
1694 */
1695 #define DM_DMCONTROL_SETRESETHALTREQ_OFFSET 3
1696 #define DM_DMCONTROL_SETRESETHALTREQ_LENGTH 1
1697 #define DM_DMCONTROL_SETRESETHALTREQ (0x1U << DM_DMCONTROL_SETRESETHALTREQ_OFFSET)
1698 /*
1699 * This optional field clears the halt-on-reset request bit for all
1700 * currently selected harts.
1701 *
1702 * Writes apply to the new value of \Fhartsel and \FdmDmcontrolHasel.
1703 */
1704 #define DM_DMCONTROL_CLRRESETHALTREQ_OFFSET 2
1705 #define DM_DMCONTROL_CLRRESETHALTREQ_LENGTH 1
1706 #define DM_DMCONTROL_CLRRESETHALTREQ (0x1U << DM_DMCONTROL_CLRRESETHALTREQ_OFFSET)
1707 /*
1708 * This bit controls the reset signal from the DM to the rest of the
1709 * hardware platform. The signal should reset every part of the hardware platform, including
1710 * every hart, except for the DM and any logic required to access the
1711 * DM.
1712 * To perform a hardware platform reset the debugger writes 1,
1713 * and then writes 0
1714 * to deassert the reset.
1715 */
1716 #define DM_DMCONTROL_NDMRESET_OFFSET 1
1717 #define DM_DMCONTROL_NDMRESET_LENGTH 1
1718 #define DM_DMCONTROL_NDMRESET (0x1U << DM_DMCONTROL_NDMRESET_OFFSET)
1719 /*
1720 * This bit serves as a reset signal for the Debug Module itself.
1721 * After changing the value of this bit, the debugger must poll
1722 * \RdmDmcontrol until \FdmDmcontrolDmactive has taken the requested value
1723 * before performing any action that assumes the requested \FdmDmcontrolDmactive
1724 * state change has completed. Hardware may
1725 * take an arbitrarily long time to complete activation or deactivation and will
1726 * indicate completion by setting \FdmDmcontrolDmactive to the requested value.
1727 *
1728 * 0: The module's state, including authentication mechanism,
1729 * takes its reset values (the \FdmDmcontrolDmactive bit is the only bit which can
1730 * be written to something other than its reset value). Any accesses
1731 * to the module may fail. Specifically, \FdmDmstatusVersion might not return
1732 * correct data.
1733 *
1734 * 1: The module functions normally.
1735 *
1736 * No other mechanism should exist that may result in resetting the
1737 * Debug Module after power up.
1738 *
1739 * To place the Debug Module into a known state, a debugger may write 0 to \FdmDmcontrolDmactive,
1740 * poll until \FdmDmcontrolDmactive is observed 0, write 1 to \FdmDmcontrolDmactive, and
1741 * poll until \FdmDmcontrolDmactive is observed 1.
1742 *
1743 * Implementations may pay attention to this bit to further aid
1744 * debugging, for example by preventing the Debug Module from being
1745 * power gated while debugging is active.
1746 */
1747 #define DM_DMCONTROL_DMACTIVE_OFFSET 0
1748 #define DM_DMCONTROL_DMACTIVE_LENGTH 1
1749 #define DM_DMCONTROL_DMACTIVE (0x1U << DM_DMCONTROL_DMACTIVE_OFFSET)
1750 #define DM_HARTINFO 0x12
1751 /*
1752 * Number of {\tt dscratch} registers available for the debugger
1753 * to use during program buffer execution, starting from \RcsrDscratchZero.
1754 * The debugger can make no assumptions about the contents of these
1755 * registers between commands.
1756 */
1757 #define DM_HARTINFO_NSCRATCH_OFFSET 20
1758 #define DM_HARTINFO_NSCRATCH_LENGTH 4
1759 #define DM_HARTINFO_NSCRATCH (0xfU << DM_HARTINFO_NSCRATCH_OFFSET)
1760 /*
1761 * 0: The {\tt data} registers are shadowed in the hart by CSRs.
1762 * Each CSR is DXLEN bits in size, and corresponds
1763 * to a single argument, per Table~\ref{tab:datareg}.
1764 *
1765 * 1: The {\tt data} registers are shadowed in the hart's memory map.
1766 * Each register takes up 4 bytes in the memory map.
1767 */
1768 #define DM_HARTINFO_DATAACCESS_OFFSET 16
1769 #define DM_HARTINFO_DATAACCESS_LENGTH 1
1770 #define DM_HARTINFO_DATAACCESS (0x1U << DM_HARTINFO_DATAACCESS_OFFSET)
1771 /*
1772 * If \FdmHartinfoDataaccess is 0: Number of CSRs dedicated to
1773 * shadowing the {\tt data} registers.
1774 *
1775 * If \FdmHartinfoDataaccess is 1: Number of 32-bit words in the memory map
1776 * dedicated to shadowing the {\tt data} registers.
1777 *
1778 * Since there are at most 12 {\tt data} registers, the value in this
1779 * register must be 12 or smaller.
1780 */
1781 #define DM_HARTINFO_DATASIZE_OFFSET 12
1782 #define DM_HARTINFO_DATASIZE_LENGTH 4
1783 #define DM_HARTINFO_DATASIZE (0xfU << DM_HARTINFO_DATASIZE_OFFSET)
1784 /*
1785 * If \FdmHartinfoDataaccess is 0: The number of the first CSR dedicated to
1786 * shadowing the {\tt data} registers.
1787 *
1788 * If \FdmHartinfoDataaccess is 1: Address of RAM where the data
1789 * registers are shadowed. This address is sign extended giving a
1790 * range of -2048 to 2047, easily addressed with a load or store using
1791 * \Xzero as the address register.
1792 */
1793 #define DM_HARTINFO_DATAADDR_OFFSET 0
1794 #define DM_HARTINFO_DATAADDR_LENGTH 12
1795 #define DM_HARTINFO_DATAADDR (0xfffU << DM_HARTINFO_DATAADDR_OFFSET)
1796 #define DM_HAWINDOWSEL 0x14
1797 /*
1798 * The high bits of this field may be tied to 0, depending on how large
1799 * the array mask register is. E.g.\ on a hardware platform with 48 harts only bit 0
1800 * of this field may actually be writable.
1801 */
1802 #define DM_HAWINDOWSEL_HAWINDOWSEL_OFFSET 0
1803 #define DM_HAWINDOWSEL_HAWINDOWSEL_LENGTH 15
1804 #define DM_HAWINDOWSEL_HAWINDOWSEL (0x7fffU << DM_HAWINDOWSEL_HAWINDOWSEL_OFFSET)
1805 #define DM_HAWINDOW 0x15
1806 #define DM_HAWINDOW_MASKDATA_OFFSET 0
1807 #define DM_HAWINDOW_MASKDATA_LENGTH 32
1808 #define DM_HAWINDOW_MASKDATA (0xffffffffU << DM_HAWINDOW_MASKDATA_OFFSET)
1809 #define DM_ABSTRACTCS 0x16
1810 /*
1811 * Size of the Program Buffer, in 32-bit words. Valid sizes are 0 - 16.
1812 */
1813 #define DM_ABSTRACTCS_PROGBUFSIZE_OFFSET 24
1814 #define DM_ABSTRACTCS_PROGBUFSIZE_LENGTH 5
1815 #define DM_ABSTRACTCS_PROGBUFSIZE (0x1fU << DM_ABSTRACTCS_PROGBUFSIZE_OFFSET)
1816 /*
1817 * 1: An abstract command is currently being executed.
1818 *
1819 * This bit is set as soon as \RdmCommand is written, and is
1820 * not cleared until that command has completed.
1821 */
1822 #define DM_ABSTRACTCS_BUSY_OFFSET 12
1823 #define DM_ABSTRACTCS_BUSY_LENGTH 1
1824 #define DM_ABSTRACTCS_BUSY (0x1U << DM_ABSTRACTCS_BUSY_OFFSET)
1825 /*
1826 * This optional bit controls whether program buffer and abstract
1827 * memory accesses are performed with the exact and full set of
1828 * permission checks that apply based on the current architectural
1829 * state of the hart performing the access, or with a relaxed set of
1830 * permission checks (e.g. PMP restrictions are ignored). The
1831 * details of the latter are implementation-specific. When set to 0,
1832 * full permissions apply; when set to 1, relaxed permissions apply.
1833 */
1834 #define DM_ABSTRACTCS_RELAXEDPRIV_OFFSET 11
1835 #define DM_ABSTRACTCS_RELAXEDPRIV_LENGTH 1
1836 #define DM_ABSTRACTCS_RELAXEDPRIV (0x1U << DM_ABSTRACTCS_RELAXEDPRIV_OFFSET)
1837 /*
1838 * Gets set if an abstract command fails. The bits in this field remain set until
1839 * they are cleared by writing 1 to them. No abstract command is
1840 * started until the value is reset to 0.
1841 *
1842 * This field only contains a valid value if \FdmAbstractcsBusy is 0.
1843 *
1844 * 0 (none): No error.
1845 *
1846 * 1 (busy): An abstract command was executing while \RdmCommand,
1847 * \RdmAbstractcs, or \RdmAbstractauto was written, or when one
1848 * of the {\tt data} or {\tt progbuf} registers was read or written.
1849 * This status is only written if \FdmAbstractcsCmderr contains 0.
1850 *
1851 * 2 (not supported): The command in \RdmCommand is not supported. It
1852 * may be supported with different options set, but it will not be
1853 * supported at a later time when the hart or system state are
1854 * different.
1855 *
1856 * 3 (exception): An exception occurred while executing the command
1857 * (e.g.\ while executing the Program Buffer).
1858 *
1859 * 4 (halt/resume): The abstract command couldn't execute because the
1860 * hart wasn't in the required state (running/halted), or unavailable.
1861 *
1862 * 5 (bus): The abstract command failed due to a bus error (e.g.\
1863 * alignment, access size, or timeout).
1864 *
1865 * 6: Reserved for future use.
1866 *
1867 * 7 (other): The command failed for another reason.
1868 */
1869 #define DM_ABSTRACTCS_CMDERR_OFFSET 8
1870 #define DM_ABSTRACTCS_CMDERR_LENGTH 3
1871 #define DM_ABSTRACTCS_CMDERR (0x7U << DM_ABSTRACTCS_CMDERR_OFFSET)
1872 /*
1873 * Number of {\tt data} registers that are implemented as part of the
1874 * abstract command interface. Valid sizes are 1 -- 12.
1875 */
1876 #define DM_ABSTRACTCS_DATACOUNT_OFFSET 0
1877 #define DM_ABSTRACTCS_DATACOUNT_LENGTH 4
1878 #define DM_ABSTRACTCS_DATACOUNT (0xfU << DM_ABSTRACTCS_DATACOUNT_OFFSET)
1879 #define DM_COMMAND 0x17
1880 /*
1881 * The type determines the overall functionality of this
1882 * abstract command.
1883 */
1884 #define DM_COMMAND_CMDTYPE_OFFSET 24
1885 #define DM_COMMAND_CMDTYPE_LENGTH 8
1886 #define DM_COMMAND_CMDTYPE (0xffU << DM_COMMAND_CMDTYPE_OFFSET)
1887 /*
1888 * This field is interpreted in a command-specific manner,
1889 * described for each abstract command.
1890 */
1891 #define DM_COMMAND_CONTROL_OFFSET 0
1892 #define DM_COMMAND_CONTROL_LENGTH 24
1893 #define DM_COMMAND_CONTROL (0xffffffU << DM_COMMAND_CONTROL_OFFSET)
1894 #define DM_ABSTRACTAUTO 0x18
1895 /*
1896 * When a bit in this field is 1, read or write accesses to the
1897 * corresponding {\tt progbuf} word cause the command in \RdmCommand to
1898 * be executed again.
1899 */
1900 #define DM_ABSTRACTAUTO_AUTOEXECPROGBUF_OFFSET 16
1901 #define DM_ABSTRACTAUTO_AUTOEXECPROGBUF_LENGTH 16
1902 #define DM_ABSTRACTAUTO_AUTOEXECPROGBUF (0xffffU << DM_ABSTRACTAUTO_AUTOEXECPROGBUF_OFFSET)
1903 /*
1904 * When a bit in this field is 1, read or write accesses to the
1905 * corresponding {\tt data} word cause the command in \RdmCommand to be
1906 * executed again.
1907 */
1908 #define DM_ABSTRACTAUTO_AUTOEXECDATA_OFFSET 0
1909 #define DM_ABSTRACTAUTO_AUTOEXECDATA_LENGTH 12
1910 #define DM_ABSTRACTAUTO_AUTOEXECDATA (0xfffU << DM_ABSTRACTAUTO_AUTOEXECDATA_OFFSET)
1911 #define DM_CONFSTRPTR0 0x19
1912 #define DM_CONFSTRPTR0_ADDR_OFFSET 0
1913 #define DM_CONFSTRPTR0_ADDR_LENGTH 32
1914 #define DM_CONFSTRPTR0_ADDR (0xffffffffU << DM_CONFSTRPTR0_ADDR_OFFSET)
1915 #define DM_CONFSTRPTR1 0x1a
1916 #define DM_CONFSTRPTR1_ADDR_OFFSET 0
1917 #define DM_CONFSTRPTR1_ADDR_LENGTH 32
1918 #define DM_CONFSTRPTR1_ADDR (0xffffffffU << DM_CONFSTRPTR1_ADDR_OFFSET)
1919 #define DM_CONFSTRPTR2 0x1b
1920 #define DM_CONFSTRPTR2_ADDR_OFFSET 0
1921 #define DM_CONFSTRPTR2_ADDR_LENGTH 32
1922 #define DM_CONFSTRPTR2_ADDR (0xffffffffU << DM_CONFSTRPTR2_ADDR_OFFSET)
1923 #define DM_CONFSTRPTR3 0x1c
1924 #define DM_CONFSTRPTR3_ADDR_OFFSET 0
1925 #define DM_CONFSTRPTR3_ADDR_LENGTH 32
1926 #define DM_CONFSTRPTR3_ADDR (0xffffffffU << DM_CONFSTRPTR3_ADDR_OFFSET)
1927 #define DM_NEXTDM 0x1d
1928 #define DM_NEXTDM_ADDR_OFFSET 0
1929 #define DM_NEXTDM_ADDR_LENGTH 32
1930 #define DM_NEXTDM_ADDR (0xffffffffU << DM_NEXTDM_ADDR_OFFSET)
1931 #define DM_DATA0 0x04
1932 #define DM_DATA0_DATA_OFFSET 0
1933 #define DM_DATA0_DATA_LENGTH 32
1934 #define DM_DATA0_DATA (0xffffffffU << DM_DATA0_DATA_OFFSET)
1935 #define DM_DATA1 0x05
1936 #define DM_DATA2 0x06
1937 #define DM_DATA3 0x07
1938 #define DM_DATA4 0x08
1939 #define DM_DATA5 0x09
1940 #define DM_DATA6 0x0a
1941 #define DM_DATA7 0x0b
1942 #define DM_DATA8 0x0c
1943 #define DM_DATA9 0x0d
1944 #define DM_DATA10 0x0e
1945 #define DM_DATA11 0x0f
1946 #define DM_PROGBUF0 0x20
1947 #define DM_PROGBUF0_DATA_OFFSET 0
1948 #define DM_PROGBUF0_DATA_LENGTH 32
1949 #define DM_PROGBUF0_DATA (0xffffffffU << DM_PROGBUF0_DATA_OFFSET)
1950 #define DM_PROGBUF1 0x21
1951 #define DM_PROGBUF2 0x22
1952 #define DM_PROGBUF3 0x23
1953 #define DM_PROGBUF4 0x24
1954 #define DM_PROGBUF5 0x25
1955 #define DM_PROGBUF6 0x26
1956 #define DM_PROGBUF7 0x27
1957 #define DM_PROGBUF8 0x28
1958 #define DM_PROGBUF9 0x29
1959 #define DM_PROGBUF10 0x2a
1960 #define DM_PROGBUF11 0x2b
1961 #define DM_PROGBUF12 0x2c
1962 #define DM_PROGBUF13 0x2d
1963 #define DM_PROGBUF14 0x2e
1964 #define DM_PROGBUF15 0x2f
1965 #define DM_AUTHDATA 0x30
1966 #define DM_AUTHDATA_DATA_OFFSET 0
1967 #define DM_AUTHDATA_DATA_LENGTH 32
1968 #define DM_AUTHDATA_DATA (0xffffffffU << DM_AUTHDATA_DATA_OFFSET)
1969 #define DM_DMCS2 0x32
1970 /*
1971 * 0: The remaining fields in this register configure halt groups.
1972 *
1973 * 1: The remaining fields in this register configure resume groups.
1974 */
1975 #define DM_DMCS2_GROUPTYPE_OFFSET 11
1976 #define DM_DMCS2_GROUPTYPE_LENGTH 1
1977 #define DM_DMCS2_GROUPTYPE (0x1U << DM_DMCS2_GROUPTYPE_OFFSET)
1978 /*
1979 * This field contains the currently selected DM external trigger.
1980 *
1981 * If a non-existent trigger value is written here, the hardware will
1982 * change it to a valid one or 0 if no DM external triggers exist.
1983 */
1984 #define DM_DMCS2_DMEXTTRIGGER_OFFSET 7
1985 #define DM_DMCS2_DMEXTTRIGGER_LENGTH 4
1986 #define DM_DMCS2_DMEXTTRIGGER (0xfU << DM_DMCS2_DMEXTTRIGGER_OFFSET)
1987 /*
1988 * When \FdmDmcsTwoHgselect is 0, contains the group of the hart
1989 * specified by \Fhartsel.
1990 *
1991 * When \FdmDmcsTwoHgselect is 1, contains the group of the DM external
1992 * trigger selected by \FdmDmcsTwoDmexttrigger.
1993 *
1994 * Writes only have an effect if \FdmDmcsTwoHgwrite is also written 1.
1995 *
1996 * Group numbers are contiguous starting at 0, with the highest number
1997 * being implementation-dependent, and possibly different between
1998 * different group types. Debuggers should read back this field after
1999 * writing to confirm they are using a hart group that is supported.
2000 *
2001 * If groups aren't implemented, then this entire field is 0.
2002 */
2003 #define DM_DMCS2_GROUP_OFFSET 2
2004 #define DM_DMCS2_GROUP_LENGTH 5
2005 #define DM_DMCS2_GROUP (0x1fU << DM_DMCS2_GROUP_OFFSET)
2006 /*
2007 * When 1 is written and \FdmDmcsTwoHgselect is 0, for every selected
2008 * hart the DM will change its group to the value written to \FdmDmcsTwoGroup,
2009 * if the hardware supports that group for that hart.
2010 * Implementations may also change the group of a minimal set of
2011 * unselected harts in the same way, if that is necessary due to
2012 * a hardware limitation.
2013 *
2014 * When 1 is written and \FdmDmcsTwoHgselect is 1, the DM will change
2015 * the group of the DM external trigger selected by \FdmDmcsTwoDmexttrigger
2016 * to the value written to \FdmDmcsTwoGroup, if the hardware supports
2017 * that group for that trigger.
2018 *
2019 * Writing 0 has no effect.
2020 */
2021 #define DM_DMCS2_HGWRITE_OFFSET 1
2022 #define DM_DMCS2_HGWRITE_LENGTH 1
2023 #define DM_DMCS2_HGWRITE (0x1U << DM_DMCS2_HGWRITE_OFFSET)
2024 /*
2025 * 0: Operate on harts.
2026 *
2027 * 1: Operate on DM external triggers.
2028 *
2029 * If there are no DM external triggers, this field must be tied to 0.
2030 */
2031 #define DM_DMCS2_HGSELECT_OFFSET 0
2032 #define DM_DMCS2_HGSELECT_LENGTH 1
2033 #define DM_DMCS2_HGSELECT (0x1U << DM_DMCS2_HGSELECT_OFFSET)
2034 #define DM_HALTSUM0 0x40
2035 #define DM_HALTSUM0_HALTSUM0_OFFSET 0
2036 #define DM_HALTSUM0_HALTSUM0_LENGTH 32
2037 #define DM_HALTSUM0_HALTSUM0 (0xffffffffU << DM_HALTSUM0_HALTSUM0_OFFSET)
2038 #define DM_HALTSUM1 0x13
2039 #define DM_HALTSUM1_HALTSUM1_OFFSET 0
2040 #define DM_HALTSUM1_HALTSUM1_LENGTH 32
2041 #define DM_HALTSUM1_HALTSUM1 (0xffffffffU << DM_HALTSUM1_HALTSUM1_OFFSET)
2042 #define DM_HALTSUM2 0x34
2043 #define DM_HALTSUM2_HALTSUM2_OFFSET 0
2044 #define DM_HALTSUM2_HALTSUM2_LENGTH 32
2045 #define DM_HALTSUM2_HALTSUM2 (0xffffffffU << DM_HALTSUM2_HALTSUM2_OFFSET)
2046 #define DM_HALTSUM3 0x35
2047 #define DM_HALTSUM3_HALTSUM3_OFFSET 0
2048 #define DM_HALTSUM3_HALTSUM3_LENGTH 32
2049 #define DM_HALTSUM3_HALTSUM3 (0xffffffffU << DM_HALTSUM3_HALTSUM3_OFFSET)
2050 #define DM_SBCS 0x38
2051 /*
2052 * 0: The System Bus interface conforms to mainline drafts of this
2053 * spec older than 1 January, 2018.
2054 *
2055 * 1: The System Bus interface conforms to this version of the spec.
2056 *
2057 * Other values are reserved for future versions.
2058 */
2059 #define DM_SBCS_SBVERSION_OFFSET 29
2060 #define DM_SBCS_SBVERSION_LENGTH 3
2061 #define DM_SBCS_SBVERSION (0x7U << DM_SBCS_SBVERSION_OFFSET)
2062 /*
2063 * Set when the debugger attempts to read data while a read is in
2064 * progress, or when the debugger initiates a new access while one is
2065 * already in progress (while \FdmSbcsSbbusy is set). It remains set until
2066 * it's explicitly cleared by the debugger.
2067 *
2068 * While this field is set, no more system bus accesses can be
2069 * initiated by the Debug Module.
2070 */
2071 #define DM_SBCS_SBBUSYERROR_OFFSET 22
2072 #define DM_SBCS_SBBUSYERROR_LENGTH 1
2073 #define DM_SBCS_SBBUSYERROR (0x1U << DM_SBCS_SBBUSYERROR_OFFSET)
2074 /*
2075 * When 1, indicates the system bus master is busy. (Whether the
2076 * system bus itself is busy is related, but not the same thing.) This
2077 * bit goes high immediately when a read or write is requested for any
2078 * reason, and does not go low until the access is fully completed.
2079 *
2080 * Writes to \RdmSbcs while \FdmSbcsSbbusy is high result in undefined
2081 * behavior. A debugger must not write to \RdmSbcs until it reads
2082 * \FdmSbcsSbbusy as 0.
2083 */
2084 #define DM_SBCS_SBBUSY_OFFSET 21
2085 #define DM_SBCS_SBBUSY_LENGTH 1
2086 #define DM_SBCS_SBBUSY (0x1U << DM_SBCS_SBBUSY_OFFSET)
2087 /*
2088 * When 1, every write to \RdmSbaddressZero automatically triggers a
2089 * system bus read at the new address.
2090 */
2091 #define DM_SBCS_SBREADONADDR_OFFSET 20
2092 #define DM_SBCS_SBREADONADDR_LENGTH 1
2093 #define DM_SBCS_SBREADONADDR (0x1U << DM_SBCS_SBREADONADDR_OFFSET)
2094 /*
2095 * Select the access size to use for system bus accesses.
2096 *
2097 * 0: 8-bit
2098 *
2099 * 1: 16-bit
2100 *
2101 * 2: 32-bit
2102 *
2103 * 3: 64-bit
2104 *
2105 * 4: 128-bit
2106 *
2107 * If \FdmSbcsSbaccess has an unsupported value when the DM starts a bus
2108 * access, the access is not performed and \FdmSbcsSberror is set to 4.
2109 */
2110 #define DM_SBCS_SBACCESS_OFFSET 17
2111 #define DM_SBCS_SBACCESS_LENGTH 3
2112 #define DM_SBCS_SBACCESS (0x7U << DM_SBCS_SBACCESS_OFFSET)
2113 /*
2114 * When 1, {\tt sbaddress} is incremented by the access size (in
2115 * bytes) selected in \FdmSbcsSbaccess after every system bus access.
2116 */
2117 #define DM_SBCS_SBAUTOINCREMENT_OFFSET 16
2118 #define DM_SBCS_SBAUTOINCREMENT_LENGTH 1
2119 #define DM_SBCS_SBAUTOINCREMENT (0x1U << DM_SBCS_SBAUTOINCREMENT_OFFSET)
2120 /*
2121 * When 1, every read from \RdmSbdataZero automatically triggers a
2122 * system bus read at the (possibly auto-incremented) address.
2123 */
2124 #define DM_SBCS_SBREADONDATA_OFFSET 15
2125 #define DM_SBCS_SBREADONDATA_LENGTH 1
2126 #define DM_SBCS_SBREADONDATA (0x1U << DM_SBCS_SBREADONDATA_OFFSET)
2127 /*
2128 * When the Debug Module's system bus
2129 * master encounters an error, this field gets set. The bits in this
2130 * field remain set until they are cleared by writing 1 to them.
2131 * While this field is non-zero, no more system bus accesses can be
2132 * initiated by the Debug Module.
2133 *
2134 * An implementation may report ``Other'' (7) for any error condition.
2135 *
2136 * 0: There was no bus error.
2137 *
2138 * 1: There was a timeout.
2139 *
2140 * 2: A bad address was accessed.
2141 *
2142 * 3: There was an alignment error.
2143 *
2144 * 4: An access of unsupported size was requested.
2145 *
2146 * 7: Other.
2147 */
2148 #define DM_SBCS_SBERROR_OFFSET 12
2149 #define DM_SBCS_SBERROR_LENGTH 3
2150 #define DM_SBCS_SBERROR (0x7U << DM_SBCS_SBERROR_OFFSET)
2151 /*
2152 * Width of system bus addresses in bits. (0 indicates there is no bus
2153 * access support.)
2154 */
2155 #define DM_SBCS_SBASIZE_OFFSET 5
2156 #define DM_SBCS_SBASIZE_LENGTH 7
2157 #define DM_SBCS_SBASIZE (0x7fU << DM_SBCS_SBASIZE_OFFSET)
2158 /*
2159 * 1 when 128-bit system bus accesses are supported.
2160 */
2161 #define DM_SBCS_SBACCESS128_OFFSET 4
2162 #define DM_SBCS_SBACCESS128_LENGTH 1
2163 #define DM_SBCS_SBACCESS128 (0x1U << DM_SBCS_SBACCESS128_OFFSET)
2164 /*
2165 * 1 when 64-bit system bus accesses are supported.
2166 */
2167 #define DM_SBCS_SBACCESS64_OFFSET 3
2168 #define DM_SBCS_SBACCESS64_LENGTH 1
2169 #define DM_SBCS_SBACCESS64 (0x1U << DM_SBCS_SBACCESS64_OFFSET)
2170 /*
2171 * 1 when 32-bit system bus accesses are supported.
2172 */
2173 #define DM_SBCS_SBACCESS32_OFFSET 2
2174 #define DM_SBCS_SBACCESS32_LENGTH 1
2175 #define DM_SBCS_SBACCESS32 (0x1U << DM_SBCS_SBACCESS32_OFFSET)
2176 /*
2177 * 1 when 16-bit system bus accesses are supported.
2178 */
2179 #define DM_SBCS_SBACCESS16_OFFSET 1
2180 #define DM_SBCS_SBACCESS16_LENGTH 1
2181 #define DM_SBCS_SBACCESS16 (0x1U << DM_SBCS_SBACCESS16_OFFSET)
2182 /*
2183 * 1 when 8-bit system bus accesses are supported.
2184 */
2185 #define DM_SBCS_SBACCESS8_OFFSET 0
2186 #define DM_SBCS_SBACCESS8_LENGTH 1
2187 #define DM_SBCS_SBACCESS8 (0x1U << DM_SBCS_SBACCESS8_OFFSET)
2188 #define DM_SBADDRESS0 0x39
2189 /*
2190 * Accesses bits 31:0 of the physical address in {\tt sbaddress}.
2191 */
2192 #define DM_SBADDRESS0_ADDRESS_OFFSET 0
2193 #define DM_SBADDRESS0_ADDRESS_LENGTH 32
2194 #define DM_SBADDRESS0_ADDRESS (0xffffffffU << DM_SBADDRESS0_ADDRESS_OFFSET)
2195 #define DM_SBADDRESS1 0x3a
2196 /*
2197 * Accesses bits 63:32 of the physical address in {\tt sbaddress} (if
2198 * the system address bus is that wide).
2199 */
2200 #define DM_SBADDRESS1_ADDRESS_OFFSET 0
2201 #define DM_SBADDRESS1_ADDRESS_LENGTH 32
2202 #define DM_SBADDRESS1_ADDRESS (0xffffffffU << DM_SBADDRESS1_ADDRESS_OFFSET)
2203 #define DM_SBADDRESS2 0x3b
2204 /*
2205 * Accesses bits 95:64 of the physical address in {\tt sbaddress} (if
2206 * the system address bus is that wide).
2207 */
2208 #define DM_SBADDRESS2_ADDRESS_OFFSET 0
2209 #define DM_SBADDRESS2_ADDRESS_LENGTH 32
2210 #define DM_SBADDRESS2_ADDRESS (0xffffffffU << DM_SBADDRESS2_ADDRESS_OFFSET)
2211 #define DM_SBADDRESS3 0x37
2212 /*
2213 * Accesses bits 127:96 of the physical address in {\tt sbaddress} (if
2214 * the system address bus is that wide).
2215 */
2216 #define DM_SBADDRESS3_ADDRESS_OFFSET 0
2217 #define DM_SBADDRESS3_ADDRESS_LENGTH 32
2218 #define DM_SBADDRESS3_ADDRESS (0xffffffffU << DM_SBADDRESS3_ADDRESS_OFFSET)
2219 #define DM_SBDATA0 0x3c
2220 /*
2221 * Accesses bits 31:0 of {\tt sbdata}.
2222 */
2223 #define DM_SBDATA0_DATA_OFFSET 0
2224 #define DM_SBDATA0_DATA_LENGTH 32
2225 #define DM_SBDATA0_DATA (0xffffffffU << DM_SBDATA0_DATA_OFFSET)
2226 #define DM_SBDATA1 0x3d
2227 /*
2228 * Accesses bits 63:32 of {\tt sbdata} (if the system bus is that
2229 * wide).
2230 */
2231 #define DM_SBDATA1_DATA_OFFSET 0
2232 #define DM_SBDATA1_DATA_LENGTH 32
2233 #define DM_SBDATA1_DATA (0xffffffffU << DM_SBDATA1_DATA_OFFSET)
2234 #define DM_SBDATA2 0x3e
2235 /*
2236 * Accesses bits 95:64 of {\tt sbdata} (if the system bus is that
2237 * wide).
2238 */
2239 #define DM_SBDATA2_DATA_OFFSET 0
2240 #define DM_SBDATA2_DATA_LENGTH 32
2241 #define DM_SBDATA2_DATA (0xffffffffU << DM_SBDATA2_DATA_OFFSET)
2242 #define DM_SBDATA3 0x3f
2243 /*
2244 * Accesses bits 127:96 of {\tt sbdata} (if the system bus is that
2245 * wide).
2246 */
2247 #define DM_SBDATA3_DATA_OFFSET 0
2248 #define DM_SBDATA3_DATA_LENGTH 32
2249 #define DM_SBDATA3_DATA (0xffffffffU << DM_SBDATA3_DATA_OFFSET)
2250 #define DM_CUSTOM 0x1f
2251 #define DM_CUSTOM0 0x70
2252 #define DM_CUSTOM1 0x71
2253 #define DM_CUSTOM2 0x72
2254 #define DM_CUSTOM3 0x73
2255 #define DM_CUSTOM4 0x74
2256 #define DM_CUSTOM5 0x75
2257 #define DM_CUSTOM6 0x76
2258 #define DM_CUSTOM7 0x77
2259 #define DM_CUSTOM8 0x78
2260 #define DM_CUSTOM9 0x79
2261 #define DM_CUSTOM10 0x7a
2262 #define DM_CUSTOM11 0x7b
2263 #define DM_CUSTOM12 0x7c
2264 #define DM_CUSTOM13 0x7d
2265 #define DM_CUSTOM14 0x7e
2266 #define DM_CUSTOM15 0x7f
2267 #define SHORTNAME 0x123
2268 /*
2269 * Description of what this field is used for.
2270 */
2271 #define SHORTNAME_FIELD_OFFSET 0
2272 #define SHORTNAME_FIELD_LENGTH 8
2273 #define SHORTNAME_FIELD (0xffU << SHORTNAME_FIELD_OFFSET)
2274 /*
2275 * This is 0 to indicate Access Register Command.
2276 */
2277 #define AC_ACCESS_REGISTER_CMDTYPE_OFFSET 24
2278 #define AC_ACCESS_REGISTER_CMDTYPE_LENGTH 8
2279 #define AC_ACCESS_REGISTER_CMDTYPE (0xffU << AC_ACCESS_REGISTER_CMDTYPE_OFFSET)
2280 /*
2281 * 2: Access the lowest 32 bits of the register.
2282 *
2283 * 3: Access the lowest 64 bits of the register.
2284 *
2285 * 4: Access the lowest 128 bits of the register.
2286 *
2287 * If \FacAccessregisterAarsize specifies a size larger than the register's actual size,
2288 * then the access must fail. If a register is accessible, then reads of \FacAccessregisterAarsize
2289 * less than or equal to the register's actual size must be supported.
2290 *
2291 * This field controls the Argument Width as referenced in
2292 * Table~\ref{tab:datareg}.
2293 */
2294 #define AC_ACCESS_REGISTER_AARSIZE_OFFSET 20
2295 #define AC_ACCESS_REGISTER_AARSIZE_LENGTH 3
2296 #define AC_ACCESS_REGISTER_AARSIZE (0x7U << AC_ACCESS_REGISTER_AARSIZE_OFFSET)
2297 /*
2298 * 0: No effect. This variant must be supported.
2299 *
2300 * 1: After a successful register access, \FacAccessregisterRegno is
2301 * incremented. Incrementing past the highest supported value
2302 * causes \FacAccessregisterRegno to become \unspecified. Supporting
2303 * this variant is optional. It is undefined whether the increment
2304 * happens when \FacAccessregisterTransfer is 0.
2305 */
2306 #define AC_ACCESS_REGISTER_AARPOSTINCREMENT_OFFSET 19
2307 #define AC_ACCESS_REGISTER_AARPOSTINCREMENT_LENGTH 1
2308 #define AC_ACCESS_REGISTER_AARPOSTINCREMENT (0x1U << AC_ACCESS_REGISTER_AARPOSTINCREMENT_OFFSET)
2309 /*
2310 * 0: No effect. This variant must be supported, and is the only
2311 * supported one if \FdmAbstractcsProgbufsize is 0.
2312 *
2313 * 1: Execute the program in the Program Buffer exactly once after
2314 * performing the transfer, if any. Supporting this variant is
2315 * optional.
2316 */
2317 #define AC_ACCESS_REGISTER_POSTEXEC_OFFSET 18
2318 #define AC_ACCESS_REGISTER_POSTEXEC_LENGTH 1
2319 #define AC_ACCESS_REGISTER_POSTEXEC (0x1U << AC_ACCESS_REGISTER_POSTEXEC_OFFSET)
2320 /*
2321 * 0: Don't do the operation specified by \FacAccessregisterWrite.
2322 *
2323 * 1: Do the operation specified by \FacAccessregisterWrite.
2324 *
2325 * This bit can be used to just execute the Program Buffer without
2326 * having to worry about placing valid values into \FacAccessregisterAarsize or \FacAccessregisterRegno.
2327 */
2328 #define AC_ACCESS_REGISTER_TRANSFER_OFFSET 17
2329 #define AC_ACCESS_REGISTER_TRANSFER_LENGTH 1
2330 #define AC_ACCESS_REGISTER_TRANSFER (0x1U << AC_ACCESS_REGISTER_TRANSFER_OFFSET)
2331 /*
2332 * When \FacAccessregisterTransfer is set:
2333 * 0: Copy data from the specified register into {\tt arg0} portion
2334 * of {\tt data}.
2335 *
2336 * 1: Copy data from {\tt arg0} portion of {\tt data} into the
2337 * specified register.
2338 */
2339 #define AC_ACCESS_REGISTER_WRITE_OFFSET 16
2340 #define AC_ACCESS_REGISTER_WRITE_LENGTH 1
2341 #define AC_ACCESS_REGISTER_WRITE (0x1U << AC_ACCESS_REGISTER_WRITE_OFFSET)
2342 /*
2343 * Number of the register to access, as described in
2344 * Table~\ref{tab:regno}.
2345 * \RcsrDpc may be used as an alias for PC if this command is
2346 * supported on a non-halted hart.
2347 */
2348 #define AC_ACCESS_REGISTER_REGNO_OFFSET 0
2349 #define AC_ACCESS_REGISTER_REGNO_LENGTH 16
2350 #define AC_ACCESS_REGISTER_REGNO (0xffffU << AC_ACCESS_REGISTER_REGNO_OFFSET)
2351 /*
2352 * This is 1 to indicate Quick Access command.
2353 */
2354 #define AC_QUICK_ACCESS_CMDTYPE_OFFSET 24
2355 #define AC_QUICK_ACCESS_CMDTYPE_LENGTH 8
2356 #define AC_QUICK_ACCESS_CMDTYPE (0xffU << AC_QUICK_ACCESS_CMDTYPE_OFFSET)
2357 /*
2358 * This is 2 to indicate Access Memory Command.
2359 */
2360 #define AC_ACCESS_MEMORY_CMDTYPE_OFFSET 24
2361 #define AC_ACCESS_MEMORY_CMDTYPE_LENGTH 8
2362 #define AC_ACCESS_MEMORY_CMDTYPE (0xffU << AC_ACCESS_MEMORY_CMDTYPE_OFFSET)
2363 /*
2364 * An implementation does not have to implement both virtual and
2365 * physical accesses, but it must fail accesses that it doesn't
2366 * support.
2367 *
2368 * 0: Addresses are physical (to the hart they are performed on).
2369 *
2370 * 1: Addresses are virtual, and translated the way they would be from
2371 * M-mode, with \FcsrMstatusMprv set.
2372 *
2373 * Debug Modules on systems without address translation (i.e. virtual addresses equal physical)
2374 * may optionally allow \FacAccessmemoryAamvirtual set to 1, which would produce the same result as
2375 * that same abstract command with \FacAccessmemoryAamvirtual cleared.
2376 */
2377 #define AC_ACCESS_MEMORY_AAMVIRTUAL_OFFSET 23
2378 #define AC_ACCESS_MEMORY_AAMVIRTUAL_LENGTH 1
2379 #define AC_ACCESS_MEMORY_AAMVIRTUAL (0x1U << AC_ACCESS_MEMORY_AAMVIRTUAL_OFFSET)
2380 /*
2381 * 0: Access the lowest 8 bits of the memory location.
2382 *
2383 * 1: Access the lowest 16 bits of the memory location.
2384 *
2385 * 2: Access the lowest 32 bits of the memory location.
2386 *
2387 * 3: Access the lowest 64 bits of the memory location.
2388 *
2389 * 4: Access the lowest 128 bits of the memory location.
2390 */
2391 #define AC_ACCESS_MEMORY_AAMSIZE_OFFSET 20
2392 #define AC_ACCESS_MEMORY_AAMSIZE_LENGTH 3
2393 #define AC_ACCESS_MEMORY_AAMSIZE (0x7U << AC_ACCESS_MEMORY_AAMSIZE_OFFSET)
2394 /*
2395 * After a memory access has completed, if this bit is 1, increment
2396 * {\tt arg1} (which contains the address used) by the number of bytes
2397 * encoded in \FacAccessmemoryAamsize.
2398 *
2399 * Supporting this variant is optional, but highly recommended for
2400 * performance reasons.
2401 */
2402 #define AC_ACCESS_MEMORY_AAMPOSTINCREMENT_OFFSET 19
2403 #define AC_ACCESS_MEMORY_AAMPOSTINCREMENT_LENGTH 1
2404 #define AC_ACCESS_MEMORY_AAMPOSTINCREMENT (0x1U << AC_ACCESS_MEMORY_AAMPOSTINCREMENT_OFFSET)
2405 /*
2406 * 0: Copy data from the memory location specified in {\tt arg1} into
2407 * the low bits of {\tt arg0}. Any remaining bits of {\tt arg0} now
2408 * have an undefined value.
2409 *
2410 * 1: Copy data from the low bits of {\tt arg0} into the memory
2411 * location specified in {\tt arg1}.
2412 */
2413 #define AC_ACCESS_MEMORY_WRITE_OFFSET 16
2414 #define AC_ACCESS_MEMORY_WRITE_LENGTH 1
2415 #define AC_ACCESS_MEMORY_WRITE (0x1U << AC_ACCESS_MEMORY_WRITE_OFFSET)
2416 /*
2417 * These bits are reserved for target-specific uses.
2418 */
2419 #define AC_ACCESS_MEMORY_TARGET_SPECIFIC_OFFSET 14
2420 #define AC_ACCESS_MEMORY_TARGET_SPECIFIC_LENGTH 2
2421 #define AC_ACCESS_MEMORY_TARGET_SPECIFIC (0x3U << AC_ACCESS_MEMORY_TARGET_SPECIFIC_OFFSET)
2422 #define VIRT_PRIV virtual
2423 /*
2424 * Contains the virtualization mode the hart was operating in when Debug
2425 * Mode was entered. The encoding is described in Table \ref{tab:privlevel},
2426 * and matches the virtualization mode encoding from the Privileged Spec.
2427 * A user can write this value to change the hart's virtualization mode
2428 * when exiting Debug Mode.
2429 */
2430 #define VIRT_PRIV_V_OFFSET 2
2431 #define VIRT_PRIV_V_LENGTH 1
2432 #define VIRT_PRIV_V (0x1U << VIRT_PRIV_V_OFFSET)
2433 /*
2434 * Contains the privilege level the hart was operating in when Debug
2435 * Mode was entered. The encoding is described in Table
2436 * \ref{tab:privlevel}, and matches the privilege level encoding from
2437 * the Privileged Spec. A user can write this
2438 * value to change the hart's privilege level when exiting Debug Mode.
2439 */
2440 #define VIRT_PRIV_PRV_OFFSET 0
2441 #define VIRT_PRIV_PRV_LENGTH 2
2442 #define VIRT_PRIV_PRV (0x3U << VIRT_PRIV_PRV_OFFSET)
2443 #define DMI_SERCS 0x34
2444 /*
2445 * Number of supported serial ports.
2446 */
2447 #define DMI_SERCS_SERIALCOUNT_OFFSET 28
2448 #define DMI_SERCS_SERIALCOUNT_LENGTH 4
2449 #define DMI_SERCS_SERIALCOUNT (0xfU << DMI_SERCS_SERIALCOUNT_OFFSET)
2450 /*
2451 * Select which serial port is accessed by \RdmiSerrx and \RdmiSertx.
2452 */
2453 #define DMI_SERCS_SERIAL_OFFSET 24
2454 #define DMI_SERCS_SERIAL_LENGTH 3
2455 #define DMI_SERCS_SERIAL (0x7U << DMI_SERCS_SERIAL_OFFSET)
2456 #define DMI_SERCS_ERROR7_OFFSET 23
2457 #define DMI_SERCS_ERROR7_LENGTH 1
2458 #define DMI_SERCS_ERROR7 (0x1U << DMI_SERCS_ERROR7_OFFSET)
2459 #define DMI_SERCS_VALID7_OFFSET 22
2460 #define DMI_SERCS_VALID7_LENGTH 1
2461 #define DMI_SERCS_VALID7 (0x1U << DMI_SERCS_VALID7_OFFSET)
2462 #define DMI_SERCS_FULL7_OFFSET 21
2463 #define DMI_SERCS_FULL7_LENGTH 1
2464 #define DMI_SERCS_FULL7 (0x1U << DMI_SERCS_FULL7_OFFSET)
2465 #define DMI_SERCS_ERROR6_OFFSET 20
2466 #define DMI_SERCS_ERROR6_LENGTH 1
2467 #define DMI_SERCS_ERROR6 (0x1U << DMI_SERCS_ERROR6_OFFSET)
2468 #define DMI_SERCS_VALID6_OFFSET 19
2469 #define DMI_SERCS_VALID6_LENGTH 1
2470 #define DMI_SERCS_VALID6 (0x1U << DMI_SERCS_VALID6_OFFSET)
2471 #define DMI_SERCS_FULL6_OFFSET 18
2472 #define DMI_SERCS_FULL6_LENGTH 1
2473 #define DMI_SERCS_FULL6 (0x1U << DMI_SERCS_FULL6_OFFSET)
2474 #define DMI_SERCS_ERROR5_OFFSET 17
2475 #define DMI_SERCS_ERROR5_LENGTH 1
2476 #define DMI_SERCS_ERROR5 (0x1U << DMI_SERCS_ERROR5_OFFSET)
2477 #define DMI_SERCS_VALID5_OFFSET 16
2478 #define DMI_SERCS_VALID5_LENGTH 1
2479 #define DMI_SERCS_VALID5 (0x1U << DMI_SERCS_VALID5_OFFSET)
2480 #define DMI_SERCS_FULL5_OFFSET 15
2481 #define DMI_SERCS_FULL5_LENGTH 1
2482 #define DMI_SERCS_FULL5 (0x1U << DMI_SERCS_FULL5_OFFSET)
2483 #define DMI_SERCS_ERROR4_OFFSET 14
2484 #define DMI_SERCS_ERROR4_LENGTH 1
2485 #define DMI_SERCS_ERROR4 (0x1U << DMI_SERCS_ERROR4_OFFSET)
2486 #define DMI_SERCS_VALID4_OFFSET 13
2487 #define DMI_SERCS_VALID4_LENGTH 1
2488 #define DMI_SERCS_VALID4 (0x1U << DMI_SERCS_VALID4_OFFSET)
2489 #define DMI_SERCS_FULL4_OFFSET 12
2490 #define DMI_SERCS_FULL4_LENGTH 1
2491 #define DMI_SERCS_FULL4 (0x1U << DMI_SERCS_FULL4_OFFSET)
2492 #define DMI_SERCS_ERROR3_OFFSET 11
2493 #define DMI_SERCS_ERROR3_LENGTH 1
2494 #define DMI_SERCS_ERROR3 (0x1U << DMI_SERCS_ERROR3_OFFSET)
2495 #define DMI_SERCS_VALID3_OFFSET 10
2496 #define DMI_SERCS_VALID3_LENGTH 1
2497 #define DMI_SERCS_VALID3 (0x1U << DMI_SERCS_VALID3_OFFSET)
2498 #define DMI_SERCS_FULL3_OFFSET 9
2499 #define DMI_SERCS_FULL3_LENGTH 1
2500 #define DMI_SERCS_FULL3 (0x1U << DMI_SERCS_FULL3_OFFSET)
2501 #define DMI_SERCS_ERROR2_OFFSET 8
2502 #define DMI_SERCS_ERROR2_LENGTH 1
2503 #define DMI_SERCS_ERROR2 (0x1U << DMI_SERCS_ERROR2_OFFSET)
2504 #define DMI_SERCS_VALID2_OFFSET 7
2505 #define DMI_SERCS_VALID2_LENGTH 1
2506 #define DMI_SERCS_VALID2 (0x1U << DMI_SERCS_VALID2_OFFSET)
2507 #define DMI_SERCS_FULL2_OFFSET 6
2508 #define DMI_SERCS_FULL2_LENGTH 1
2509 #define DMI_SERCS_FULL2 (0x1U << DMI_SERCS_FULL2_OFFSET)
2510 #define DMI_SERCS_ERROR1_OFFSET 5
2511 #define DMI_SERCS_ERROR1_LENGTH 1
2512 #define DMI_SERCS_ERROR1 (0x1U << DMI_SERCS_ERROR1_OFFSET)
2513 #define DMI_SERCS_VALID1_OFFSET 4
2514 #define DMI_SERCS_VALID1_LENGTH 1
2515 #define DMI_SERCS_VALID1 (0x1U << DMI_SERCS_VALID1_OFFSET)
2516 #define DMI_SERCS_FULL1_OFFSET 3
2517 #define DMI_SERCS_FULL1_LENGTH 1
2518 #define DMI_SERCS_FULL1 (0x1U << DMI_SERCS_FULL1_OFFSET)
2519 /*
2520 * 1 when the debugger-to-core queue for serial port 0 has
2521 * over or underflowed. This bit will remain set until it is reset by
2522 * writing 1 to this bit.
2523 */
2524 #define DMI_SERCS_ERROR0_OFFSET 2
2525 #define DMI_SERCS_ERROR0_LENGTH 1
2526 #define DMI_SERCS_ERROR0 (0x1U << DMI_SERCS_ERROR0_OFFSET)
2527 /*
2528 * 1 when the core-to-debugger queue for serial port 0 is not empty.
2529 */
2530 #define DMI_SERCS_VALID0_OFFSET 1
2531 #define DMI_SERCS_VALID0_LENGTH 1
2532 #define DMI_SERCS_VALID0 (0x1U << DMI_SERCS_VALID0_OFFSET)
2533 /*
2534 * 1 when the debugger-to-core queue for serial port 0 is full.
2535 */
2536 #define DMI_SERCS_FULL0_OFFSET 0
2537 #define DMI_SERCS_FULL0_LENGTH 1
2538 #define DMI_SERCS_FULL0 (0x1U << DMI_SERCS_FULL0_OFFSET)
2539 #define DMI_SERTX 0x35
2540 #define DMI_SERTX_DATA_OFFSET 0
2541 #define DMI_SERTX_DATA_LENGTH 32
2542 #define DMI_SERTX_DATA (0xffffffffU << DMI_SERTX_DATA_OFFSET)
2543 #define DMI_SERRX 0x36
2544 #define DMI_SERRX_DATA_OFFSET 0
2545 #define DMI_SERRX_DATA_LENGTH 32
2546 #define DMI_SERRX_DATA (0xffffffffU << DMI_SERRX_DATA_OFFSET)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)