|
84 | 84 | /* |
85 | 85 | * 0: Version described in spec version 0.11. |
86 | 86 | * |
87 | | -* 1: Version described in spec version 0.12 (and later?), which |
| 87 | +* 1: Version described in spec version 0.13 (and later?), which |
88 | 88 | * reduces the DMI data width to 32 bits. |
89 | 89 | * |
90 | 90 | * Other values are reserved for future use. |
|
110 | 110 | /* |
111 | 111 | * When the debugger writes this field, it has the following meaning: |
112 | 112 | * |
113 | | -* 0: Ignore \Fdata. (nop) |
| 113 | +* 0: Ignore \Fdata and \Faddress. (nop) |
| 114 | +* |
| 115 | +* Don't send anything over the DMI during Update-DR. |
| 116 | +* This operation should never result in a busy or error response. |
| 117 | +* The address and data reported in the following Capture-DR |
| 118 | +* are undefined. |
114 | 119 | * |
115 | 120 | * 1: Read from \Faddress. (read) |
116 | 121 | * |
|
151 | 156 | /* |
152 | 157 | * 0: There is no external debug support. |
153 | 158 | * |
154 | | -* 1: External debug support exists as it is described in this document. |
155 | | -* |
156 | | -* Other values are reserved for future standards. |
| 159 | +* 4: External debug support exists as it is described in this document. |
157 | 160 | */ |
158 | | -#define CSR_DCSR_XDEBUGVER_OFFSET 30 |
159 | | -#define CSR_DCSR_XDEBUGVER_LENGTH 2 |
160 | | -#define CSR_DCSR_XDEBUGVER (0x3 << CSR_DCSR_XDEBUGVER_OFFSET) |
| 161 | +#define CSR_DCSR_XDEBUGVER_OFFSET 28 |
| 162 | +#define CSR_DCSR_XDEBUGVER_LENGTH 4 |
| 163 | +#define CSR_DCSR_XDEBUGVER (0xf << CSR_DCSR_XDEBUGVER_OFFSET) |
161 | 164 | /* |
162 | 165 | * When 1, {\tt ebreak} instructions in Machine Mode enter Debug Mode. |
163 | 166 | */ |
|
230 | 233 | #define CSR_DCSR_CAUSE (0x7 << CSR_DCSR_CAUSE_OFFSET) |
231 | 234 | /* |
232 | 235 | * When set and not in Debug Mode, the hart will only execute a single |
233 | | -* instruction, and then enter Debug Mode. Interrupts are disabled |
234 | | -* when this bit is set. |
| 236 | +* instruction and then enter Debug Mode. |
| 237 | +* Interrupts are disabled when this bit is set. |
| 238 | +* If the instruction does not complete due to an exception, |
| 239 | +* the hart will immediately enter Debug Mode before executing |
| 240 | +* the trap handler, with appropriate exception registers set. |
235 | 241 | */ |
236 | 242 | #define CSR_DCSR_STEP_OFFSET 2 |
237 | 243 | #define CSR_DCSR_STEP_LENGTH 1 |
|
255 | 261 | #define CSR_DPC_DPC (((1L<<XLEN)-1) << CSR_DPC_DPC_OFFSET) |
256 | 262 | #define CSR_DSCRATCH0 0x7b2 |
257 | 263 | #define CSR_DSCRATCH1 0x7b3 |
258 | | -#define CSR_PRIV virtual |
259 | | -/* |
260 | | -* Contains the privilege level the hart was operating in when Debug |
261 | | -* Mode was entered. The encoding is described in Table |
262 | | -* \ref{tab:privlevel}. A user can write this value to change the |
263 | | -* hart's privilege level when exiting Debug Mode. |
264 | | - */ |
265 | | -#define CSR_PRIV_PRV_OFFSET 0 |
266 | | -#define CSR_PRIV_PRV_LENGTH 2 |
267 | | -#define CSR_PRIV_PRV (0x3 << CSR_PRIV_PRV_OFFSET) |
268 | 264 | #define CSR_TSELECT 0x7a0 |
269 | 265 | #define CSR_TSELECT_INDEX_OFFSET 0 |
270 | 266 | #define CSR_TSELECT_INDEX_LENGTH XLEN |
|
485 | 481 | #define CSR_ICOUNT_COUNT_LENGTH 14 |
486 | 482 | #define CSR_ICOUNT_COUNT (0x3fffL << CSR_ICOUNT_COUNT_OFFSET) |
487 | 483 | /* |
488 | | -* When set, every instruction completed in M mode decrements \Fcount |
| 484 | +* When set, every instruction completed or exception taken in M mode decrements \Fcount |
489 | 485 | * by 1. |
490 | 486 | */ |
491 | 487 | #define CSR_ICOUNT_M_OFFSET 9 |
492 | 488 | #define CSR_ICOUNT_M_LENGTH 1 |
493 | 489 | #define CSR_ICOUNT_M (0x1L << CSR_ICOUNT_M_OFFSET) |
494 | 490 | /* |
495 | | -* When set, every instruction completed in H mode decrements \Fcount |
| 491 | +* When set, every instruction completed or exception taken in in H mode decrements \Fcount |
496 | 492 | * by 1. |
497 | 493 | */ |
498 | 494 | #define CSR_ICOUNT_H_OFFSET 8 |
499 | 495 | #define CSR_ICOUNT_H_LENGTH 1 |
500 | 496 | #define CSR_ICOUNT_H (0x1L << CSR_ICOUNT_H_OFFSET) |
501 | 497 | /* |
502 | | -* When set, every instruction completed in S mode decrements \Fcount |
| 498 | +* When set, every instruction completed or exception taken in S mode decrements \Fcount |
503 | 499 | * by 1. |
504 | 500 | */ |
505 | 501 | #define CSR_ICOUNT_S_OFFSET 7 |
506 | 502 | #define CSR_ICOUNT_S_LENGTH 1 |
507 | 503 | #define CSR_ICOUNT_S (0x1L << CSR_ICOUNT_S_OFFSET) |
508 | 504 | /* |
509 | | -* When set, every instruction completed in U mode decrements \Fcount |
| 505 | +* When set, every instruction completed or exception taken in U mode decrements \Fcount |
510 | 506 | * by 1. |
511 | 507 | */ |
512 | 508 | #define CSR_ICOUNT_U_OFFSET 6 |
|
619 | 615 | #define DMI_DMSTATUS_CFGSTRVALID_LENGTH 1 |
620 | 616 | #define DMI_DMSTATUS_CFGSTRVALID (0x1 << DMI_DMSTATUS_CFGSTRVALID_OFFSET) |
621 | 617 | /* |
622 | | -* Reserved for future use. Reads as 0. |
623 | | - */ |
624 | | -#define DMI_DMSTATUS_VERSIONHI_OFFSET 2 |
625 | | -#define DMI_DMSTATUS_VERSIONHI_LENGTH 2 |
626 | | -#define DMI_DMSTATUS_VERSIONHI (0x3 << DMI_DMSTATUS_VERSIONHI_OFFSET) |
627 | | -/* |
628 | | -* 00: There is no Debug Module present. |
| 618 | +* 0: There is no Debug Module present. |
629 | 619 | * |
630 | | -* 01: There is a Debug Module and it conforms to version 0.11 of this |
| 620 | +* 1: There is a Debug Module and it conforms to version 0.11 of this |
631 | 621 | * specification. |
632 | 622 | * |
633 | | -* 10: There is a Debug Module and it conforms to version 0.13 of this |
| 623 | +* 2: There is a Debug Module and it conforms to version 0.13 of this |
634 | 624 | * specification. |
635 | | -* |
636 | | -* 11: Reserved for future use. |
637 | 625 | */ |
638 | | -#define DMI_DMSTATUS_VERSIONLO_OFFSET 0 |
639 | | -#define DMI_DMSTATUS_VERSIONLO_LENGTH 2 |
640 | | -#define DMI_DMSTATUS_VERSIONLO (0x3 << DMI_DMSTATUS_VERSIONLO_OFFSET) |
| 626 | +#define DMI_DMSTATUS_VERSION_OFFSET 0 |
| 627 | +#define DMI_DMSTATUS_VERSION_LENGTH 4 |
| 628 | +#define DMI_DMSTATUS_VERSION (0xf << DMI_DMSTATUS_VERSION_OFFSET) |
641 | 629 | #define DMI_DMCONTROL 0x10 |
642 | 630 | /* |
643 | | -* Halt request signal for all currently selected harts. When set to 1, the |
644 | | -* hart will halt if it is not currently halted. |
| 631 | +* Halt request signal for all currently selected harts. When set to |
| 632 | +* 1, each selected hart will halt if it is not currently halted. |
| 633 | +* |
| 634 | +* Writing 1 or 0 has no effect on a hart which is already halted, but |
| 635 | +* the bit should be cleared to 0 before the hart is resumed. |
645 | 636 | * Setting both \Fhaltreq and \Fresumereq leads to undefined behavior. |
646 | 637 | * |
647 | 638 | * Writes apply to the new value of \Fhartsel and \Fhasel. |
|
651 | 642 | #define DMI_DMCONTROL_HALTREQ (0x1 << DMI_DMCONTROL_HALTREQ_OFFSET) |
652 | 643 | /* |
653 | 644 | * Resume request signal for all currently selected harts. When set to 1, |
654 | | -* the hart will resume if it is currently halted. |
| 645 | +* each selected hart will resume if it is currently halted. |
655 | 646 | * Setting both \Fhaltreq and \Fresumereq leads to undefined behavior. |
656 | 647 | * |
657 | 648 | * Writes apply to the new value of \Fhartsel and \Fhasel. |
|
698 | 689 | #define DMI_DMCONTROL_HARTSEL (0x3ff << DMI_DMCONTROL_HARTSEL_OFFSET) |
699 | 690 | /* |
700 | 691 | * This bit controls the reset signal from the DM to the rest of the |
701 | | -* system. To perform a reset the debugger writes 1, and then writes 0 |
702 | | -* to deassert the reset. |
| 692 | +* system. To perform a system reset the debugger writes 1, |
| 693 | +* and then writes 0 |
| 694 | +* to deassert the reset. This bit must not reset the Debug Module |
| 695 | +* registers. What it does reset is platform-specific (it may |
| 696 | +* reset nothing). |
703 | 697 | */ |
704 | 698 | #define DMI_DMCONTROL_NDMRESET_OFFSET 1 |
705 | 699 | #define DMI_DMCONTROL_NDMRESET_LENGTH 1 |
|
717 | 711 | * Debug Module after power up, including the platform's system reset |
718 | 712 | * or Debug Transport reset signals. |
719 | 713 | * |
720 | | -* A debugger should pulse this bit low to ensure that the Debug |
721 | | -* Module is fully reset and ready to use. |
| 714 | +* A debugger may pulse this bit low to get the debug module into a |
| 715 | +* known state. |
722 | 716 | * |
723 | 717 | * Implementations may use this bit to aid debugging, for example by |
724 | 718 | * preventing the Debug Module from being power gated while debugging |
|
899 | 893 | * |
900 | 894 | * 0 (none): No error. |
901 | 895 | * |
902 | | -* 1 (busy): An abstract command was executing while \Rcommand or one |
903 | | -* of the {\tt data} registers was accessed. |
| 896 | +* 1 (busy): An abstract command was executing while \Rcommand, |
| 897 | +* \Rabstractcs, \Rabstractauto was written, or when one |
| 898 | +* of the {\tt data} or {\tt progbuf} registers was read or written. |
904 | 899 | * |
905 | 900 | * 2 (not supported): The requested command is not supported. A |
906 | 901 | * command that is not supported while the hart is running may be |
|
919 | 914 | #define DMI_ABSTRACTCS_CMDERR (0x7 << DMI_ABSTRACTCS_CMDERR_OFFSET) |
920 | 915 | /* |
921 | 916 | * Number of {\tt data} registers that are implemented as part of the |
922 | | -* abstract command interface. Valid sizes are 0 - 8. |
| 917 | +* abstract command interface. Valid sizes are 0 - 12. |
923 | 918 | */ |
924 | 919 | #define DMI_ABSTRACTCS_DATACOUNT_OFFSET 0 |
925 | 920 | #define DMI_ABSTRACTCS_DATACOUNT_LENGTH 5 |
|
1138 | 1133 | * |
1139 | 1134 | * 3: There was some other error (eg. alignment). |
1140 | 1135 | * |
1141 | | -* 4: The system bus master was busy when a one of the |
| 1136 | +* 4: The system bus master was busy when one of the |
1142 | 1137 | * {\tt sbaddress} or {\tt sbdata} registers was written, |
1143 | 1138 | * or the {\tt sbdata} register was read when it had |
1144 | 1139 | * stale data. |
|
1396 | 1391 | #define AC_ACCESS_REGISTER_WRITE_LENGTH 1 |
1397 | 1392 | #define AC_ACCESS_REGISTER_WRITE (0x1 << AC_ACCESS_REGISTER_WRITE_OFFSET) |
1398 | 1393 | /* |
1399 | | -* Number of the register to access, as described in Table~\ref{tab:regno}. |
| 1394 | +* Number of the register to access, as described in |
| 1395 | +* Table~\ref{tab:regno}. |
| 1396 | +* \Rdpc may be used as an alias for PC if this command is |
| 1397 | +* supported on a non-halted hart. |
1400 | 1398 | */ |
1401 | 1399 | #define AC_ACCESS_REGISTER_REGNO_OFFSET 0 |
1402 | 1400 | #define AC_ACCESS_REGISTER_REGNO_LENGTH 16 |
|
1408 | 1406 | #define AC_QUICK_ACCESS_CMDTYPE_OFFSET 24 |
1409 | 1407 | #define AC_QUICK_ACCESS_CMDTYPE_LENGTH 8 |
1410 | 1408 | #define AC_QUICK_ACCESS_CMDTYPE (0xff << AC_QUICK_ACCESS_CMDTYPE_OFFSET) |
| 1409 | +#define VIRT_PRIV virtual |
| 1410 | +/* |
| 1411 | +* Contains the privilege level the hart was operating in when Debug |
| 1412 | +* Mode was entered. The encoding is described in Table |
| 1413 | +* \ref{tab:privlevel}. A user can write this value to change the |
| 1414 | +* hart's privilege level when exiting Debug Mode. |
| 1415 | + */ |
| 1416 | +#define VIRT_PRIV_PRV_OFFSET 0 |
| 1417 | +#define VIRT_PRIV_PRV_LENGTH 2 |
| 1418 | +#define VIRT_PRIV_PRV (0x3 << VIRT_PRIV_PRV_OFFSET) |
0 commit comments