|
|
|
@@ -173,12 +173,6 @@
|
|
|
|
|
#define CSR_DCSR_EBREAKM_LENGTH 1
|
|
|
|
|
#define CSR_DCSR_EBREAKM (0x1U << CSR_DCSR_EBREAKM_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* When 1, {\tt ebreak} instructions in Hypervisor Mode enter Debug Mode.
|
|
|
|
|
*/
|
|
|
|
|
#define CSR_DCSR_EBREAKH_OFFSET 14
|
|
|
|
|
#define CSR_DCSR_EBREAKH_LENGTH 1
|
|
|
|
|
#define CSR_DCSR_EBREAKH (0x1U << CSR_DCSR_EBREAKH_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* When 1, {\tt ebreak} instructions in Supervisor Mode enter Debug Mode.
|
|
|
|
|
*/
|
|
|
|
|
#define CSR_DCSR_EBREAKS_OFFSET 13
|
|
|
|
@@ -207,9 +201,10 @@
|
|
|
|
|
/*
|
|
|
|
|
* 0: Increment counters as usual.
|
|
|
|
|
*
|
|
|
|
|
* 1: Don't increment any counters while in Debug Mode. This includes
|
|
|
|
|
* the {\tt cycle} and {\tt instret} CSRs. This is preferred for most
|
|
|
|
|
* debugging scenarios.
|
|
|
|
|
* 1: Don't increment any counters while in Debug Mode or on {\tt
|
|
|
|
|
* ebreak} instructions that cause entry into Debug Mode. These
|
|
|
|
|
* counters include the {\tt cycle} and {\tt instret} CSRs. This is
|
|
|
|
|
* preferred for most debugging scenarios.
|
|
|
|
|
*
|
|
|
|
|
* An implementation may choose not to support writing to this bit.
|
|
|
|
|
* The debugger must read back the value it writes to check whether
|
|
|
|
@@ -312,9 +307,9 @@
|
|
|
|
|
*
|
|
|
|
|
* This bit is only writable from Debug Mode.
|
|
|
|
|
*/
|
|
|
|
|
#define CSR_TDATA1_HMODE_OFFSET XLEN-5
|
|
|
|
|
#define CSR_TDATA1_HMODE_LENGTH 1
|
|
|
|
|
#define CSR_TDATA1_HMODE (0x1ULL << CSR_TDATA1_HMODE_OFFSET)
|
|
|
|
|
#define CSR_TDATA1_DMODE_OFFSET XLEN-5
|
|
|
|
|
#define CSR_TDATA1_DMODE_LENGTH 1
|
|
|
|
|
#define CSR_TDATA1_DMODE (0x1ULL << CSR_TDATA1_DMODE_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* Trigger-specific data.
|
|
|
|
|
*/
|
|
|
|
@@ -390,7 +385,7 @@
|
|
|
|
|
* 0: Raise a breakpoint exception. (Used when software wants to use
|
|
|
|
|
* the trigger module without an external debugger attached.)
|
|
|
|
|
*
|
|
|
|
|
* 1: Enter Debug Mode. (Only supported when \Fhmode is 1.)
|
|
|
|
|
* 1: Enter Debug Mode. (Only supported when \Fdmode is 1.)
|
|
|
|
|
*
|
|
|
|
|
* 2: Start tracing.
|
|
|
|
|
*
|
|
|
|
@@ -532,7 +527,7 @@
|
|
|
|
|
* 0: Raise a breakpoint exception. (Used when software wants to use the
|
|
|
|
|
* trigger module without an external debugger attached.)
|
|
|
|
|
*
|
|
|
|
|
* 1: Enter Debug Mode. (Only supported when \Fhmode is 1.)
|
|
|
|
|
* 1: Enter Debug Mode. (Only supported when \Fdmode is 1.)
|
|
|
|
|
*
|
|
|
|
|
* 2: Start tracing.
|
|
|
|
|
*
|
|
|
|
@@ -549,6 +544,30 @@
|
|
|
|
|
#define CSR_ICOUNT_ACTION (0x3fULL << CSR_ICOUNT_ACTION_OFFSET)
|
|
|
|
|
#define DMI_DMSTATUS 0x11
|
|
|
|
|
/*
|
|
|
|
|
* If 1, then there is an implicit {\tt ebreak} instruction at the
|
|
|
|
|
* non-existent word immediately after the Program Buffer. This saves
|
|
|
|
|
* the debugger from having to write the {\tt ebreak} itself, and
|
|
|
|
|
* allows the Program Buffer to be one word smaller.
|
|
|
|
|
*
|
|
|
|
|
* This must be 1 when \Fprogbufsize is 1.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_DMSTATUS_IMPEBREAK_OFFSET 22
|
|
|
|
|
#define DMI_DMSTATUS_IMPEBREAK_LENGTH 1
|
|
|
|
|
#define DMI_DMSTATUS_IMPEBREAK (0x1U << DMI_DMSTATUS_IMPEBREAK_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* Gets set if the Debug Module was accessed incorrectly.
|
|
|
|
|
*
|
|
|
|
|
* 0 (none): No error.
|
|
|
|
|
*
|
|
|
|
|
* 1 (badaddr): There was an access to an unimplemented Debug Module
|
|
|
|
|
* address.
|
|
|
|
|
*
|
|
|
|
|
* 7 (other): An access failed for another reason.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_DMSTATUS_DMERR_OFFSET 18
|
|
|
|
|
#define DMI_DMSTATUS_DMERR_LENGTH 3
|
|
|
|
|
#define DMI_DMSTATUS_DMERR (0x7U << DMI_DMSTATUS_DMERR_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* This field is 1 when all currently selected harts have acknowledged the previous \Fresumereq.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_DMSTATUS_ALLRESUMEACK_OFFSET 17
|
|
|
|
@@ -629,6 +648,13 @@
|
|
|
|
|
#define DMI_DMSTATUS_AUTHBUSY_OFFSET 6
|
|
|
|
|
#define DMI_DMSTATUS_AUTHBUSY_LENGTH 1
|
|
|
|
|
#define DMI_DMSTATUS_AUTHBUSY (0x1U << DMI_DMSTATUS_AUTHBUSY_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* 0: \Rdevtreeaddrzero--\Rdevtreeaddrthree hold information which
|
|
|
|
|
* is not relevant to the Device Tree.
|
|
|
|
|
*
|
|
|
|
|
* 1: \Rdevtreeaddrzero--\Rdevtreeaddrthree registers hold the address of the
|
|
|
|
|
* Device Tree.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_DMSTATUS_DEVTREEVALID_OFFSET 4
|
|
|
|
|
#define DMI_DMSTATUS_DEVTREEVALID_LENGTH 1
|
|
|
|
|
#define DMI_DMSTATUS_DEVTREEVALID (0x1U << DMI_DMSTATUS_DEVTREEVALID_OFFSET)
|
|
|
|
@@ -654,7 +680,6 @@
|
|
|
|
|
*
|
|
|
|
|
* Writing 1 or 0 has no effect on a hart which is already halted, but
|
|
|
|
|
* the bit should be cleared to 0 before the hart is resumed.
|
|
|
|
|
* Setting both \Fhaltreq and \Fresumereq leads to undefined behavior.
|
|
|
|
|
*
|
|
|
|
|
* Writes apply to the new value of \Fhartsel and \Fhasel.
|
|
|
|
|
*/
|
|
|
|
@@ -664,7 +689,8 @@
|
|
|
|
|
/*
|
|
|
|
|
* Resume request signal for all currently selected harts. When set to 1,
|
|
|
|
|
* each selected hart will resume if it is currently halted.
|
|
|
|
|
* Setting both \Fhaltreq and \Fresumereq leads to undefined behavior.
|
|
|
|
|
*
|
|
|
|
|
* This bit is ignored while \Fhaltreq is set.
|
|
|
|
|
*
|
|
|
|
|
* Writes apply to the new value of \Fhartsel and \Fhasel.
|
|
|
|
|
*/
|
|
|
|
@@ -710,11 +736,12 @@
|
|
|
|
|
#define DMI_DMCONTROL_HARTSEL (0x3ffU << DMI_DMCONTROL_HARTSEL_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* This bit controls the reset signal from the DM to the rest of the
|
|
|
|
|
* system. To perform a system reset the debugger writes 1,
|
|
|
|
|
* system. The signal should reset every part of the system, including
|
|
|
|
|
* every hart, except for the DM and any logic required to access the
|
|
|
|
|
* DM.
|
|
|
|
|
* To perform a system reset the debugger writes 1,
|
|
|
|
|
* and then writes 0
|
|
|
|
|
* to deassert the reset. This bit must not reset the Debug Module
|
|
|
|
|
* registers. What it does reset is platform-specific (it may
|
|
|
|
|
* reset nothing).
|
|
|
|
|
* to deassert the reset.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_DMCONTROL_NDMRESET_OFFSET 1
|
|
|
|
|
#define DMI_DMCONTROL_NDMRESET_LENGTH 1
|
|
|
|
@@ -778,7 +805,7 @@
|
|
|
|
|
* shadowing the {\tt data} registers.
|
|
|
|
|
*
|
|
|
|
|
* If \Fdataaccess is 1: Signed address of RAM where the {\tt data}
|
|
|
|
|
* registers are shadowed.
|
|
|
|
|
* registers are shadowed, to be used to access relative to \Rzero.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_HARTINFO_DATAADDR_OFFSET 0
|
|
|
|
|
#define DMI_HARTINFO_DATAADDR_LENGTH 12
|
|
|
|
@@ -891,13 +918,10 @@
|
|
|
|
|
#define DMI_ABSTRACTCS 0x16
|
|
|
|
|
/*
|
|
|
|
|
* Size of the Program Buffer, in 32-bit words. Valid sizes are 0 - 16.
|
|
|
|
|
*
|
|
|
|
|
* TODO: Explain what can be done with each size of the buffer, to suggest
|
|
|
|
|
* why you would want more or less words.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_ABSTRACTCS_PROGSIZE_OFFSET 24
|
|
|
|
|
#define DMI_ABSTRACTCS_PROGSIZE_LENGTH 5
|
|
|
|
|
#define DMI_ABSTRACTCS_PROGSIZE (0x1fU << DMI_ABSTRACTCS_PROGSIZE_OFFSET)
|
|
|
|
|
#define DMI_ABSTRACTCS_PROGBUFSIZE_OFFSET 24
|
|
|
|
|
#define DMI_ABSTRACTCS_PROGBUFSIZE_LENGTH 5
|
|
|
|
|
#define DMI_ABSTRACTCS_PROGBUFSIZE (0x1fU << DMI_ABSTRACTCS_PROGBUFSIZE_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* 1: An abstract command is currently being executed.
|
|
|
|
|
*
|
|
|
|
@@ -1013,24 +1037,22 @@
|
|
|
|
|
*
|
|
|
|
|
* 4: 128-bit
|
|
|
|
|
*
|
|
|
|
|
* If an unsupported system bus access size is written here,
|
|
|
|
|
* the DM may not perform the access, or may perform the access
|
|
|
|
|
* with any access size.
|
|
|
|
|
* If an unsupported system bus access size is written here, the DM
|
|
|
|
|
* does not perform the access and sberror is set to 3.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBCS_SBACCESS_OFFSET 17
|
|
|
|
|
#define DMI_SBCS_SBACCESS_LENGTH 3
|
|
|
|
|
#define DMI_SBCS_SBACCESS (0x7U << DMI_SBCS_SBACCESS_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* When 1, the internal address value (used by the system bus master)
|
|
|
|
|
* is incremented by the access size (in bytes) selected in \Fsbaccess
|
|
|
|
|
* after every system bus access.
|
|
|
|
|
* When 1, {\tt sbaddress} is incremented by the access size (in
|
|
|
|
|
* bytes) selected in \Fsbaccess after every system bus access.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBCS_SBAUTOINCREMENT_OFFSET 16
|
|
|
|
|
#define DMI_SBCS_SBAUTOINCREMENT_LENGTH 1
|
|
|
|
|
#define DMI_SBCS_SBAUTOINCREMENT (0x1U << DMI_SBCS_SBAUTOINCREMENT_OFFSET)
|
|
|
|
|
/*
|
|
|
|
|
* When 1, every read from \Rsbdatazero automatically triggers a system
|
|
|
|
|
* bus read at the new address.
|
|
|
|
|
* When 1, every read from \Rsbdatazero automatically triggers a
|
|
|
|
|
* system bus read at the (possibly auto-incremented) address.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBCS_SBAUTOREAD_OFFSET 15
|
|
|
|
|
#define DMI_SBCS_SBAUTOREAD_LENGTH 1
|
|
|
|
@@ -1052,8 +1074,7 @@
|
|
|
|
|
*
|
|
|
|
|
* 4: The system bus master was busy when one of the
|
|
|
|
|
* {\tt sbaddress} or {\tt sbdata} registers was written,
|
|
|
|
|
* or the {\tt sbdata} register was read when it had
|
|
|
|
|
* stale data.
|
|
|
|
|
* or \Rsbdatazero was read when it had stale data.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBCS_SBERROR_OFFSET 12
|
|
|
|
|
#define DMI_SBCS_SBERROR_LENGTH 3
|
|
|
|
@@ -1097,54 +1118,54 @@
|
|
|
|
|
#define DMI_SBCS_SBACCESS8 (0x1U << DMI_SBCS_SBACCESS8_OFFSET)
|
|
|
|
|
#define DMI_SBADDRESS0 0x39
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 31:0 of the internal address.
|
|
|
|
|
* Accesses bits 31:0 of the physical address in {\tt sbaddress}.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBADDRESS0_ADDRESS_OFFSET 0
|
|
|
|
|
#define DMI_SBADDRESS0_ADDRESS_LENGTH 32
|
|
|
|
|
#define DMI_SBADDRESS0_ADDRESS (0xffffffffU << DMI_SBADDRESS0_ADDRESS_OFFSET)
|
|
|
|
|
#define DMI_SBADDRESS1 0x3a
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 63:32 of the internal address (if the system address
|
|
|
|
|
* bus is that wide).
|
|
|
|
|
* Accesses bits 63:32 of the physical address in {\tt sbaddress} (if
|
|
|
|
|
* the system address bus is that wide).
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBADDRESS1_ADDRESS_OFFSET 0
|
|
|
|
|
#define DMI_SBADDRESS1_ADDRESS_LENGTH 32
|
|
|
|
|
#define DMI_SBADDRESS1_ADDRESS (0xffffffffU << DMI_SBADDRESS1_ADDRESS_OFFSET)
|
|
|
|
|
#define DMI_SBADDRESS2 0x3b
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 95:64 of the internal address (if the system address
|
|
|
|
|
* bus is that wide).
|
|
|
|
|
* Accesses bits 95:64 of the physical address in {\tt sbaddress} (if
|
|
|
|
|
* the system address bus is that wide).
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBADDRESS2_ADDRESS_OFFSET 0
|
|
|
|
|
#define DMI_SBADDRESS2_ADDRESS_LENGTH 32
|
|
|
|
|
#define DMI_SBADDRESS2_ADDRESS (0xffffffffU << DMI_SBADDRESS2_ADDRESS_OFFSET)
|
|
|
|
|
#define DMI_SBDATA0 0x3c
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 31:0 of the internal data.
|
|
|
|
|
* Accesses bits 31:0 of {\tt sbdata}.
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBDATA0_DATA_OFFSET 0
|
|
|
|
|
#define DMI_SBDATA0_DATA_LENGTH 32
|
|
|
|
|
#define DMI_SBDATA0_DATA (0xffffffffU << DMI_SBDATA0_DATA_OFFSET)
|
|
|
|
|
#define DMI_SBDATA1 0x3d
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 63:32 of the internal data (if the system bus is
|
|
|
|
|
* that wide).
|
|
|
|
|
* Accesses bits 63:32 of {\tt sbdata} (if the system bus is that
|
|
|
|
|
* wide).
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBDATA1_DATA_OFFSET 0
|
|
|
|
|
#define DMI_SBDATA1_DATA_LENGTH 32
|
|
|
|
|
#define DMI_SBDATA1_DATA (0xffffffffU << DMI_SBDATA1_DATA_OFFSET)
|
|
|
|
|
#define DMI_SBDATA2 0x3e
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 95:64 of the internal data (if the system bus is
|
|
|
|
|
* that wide).
|
|
|
|
|
* Accesses bits 95:64 of {\tt sbdata} (if the system bus is that
|
|
|
|
|
* wide).
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBDATA2_DATA_OFFSET 0
|
|
|
|
|
#define DMI_SBDATA2_DATA_LENGTH 32
|
|
|
|
|
#define DMI_SBDATA2_DATA (0xffffffffU << DMI_SBDATA2_DATA_OFFSET)
|
|
|
|
|
#define DMI_SBDATA3 0x3f
|
|
|
|
|
/*
|
|
|
|
|
* Accesses bits 127:96 of the internal data (if the system bus is
|
|
|
|
|
* that wide).
|
|
|
|
|
* Accesses bits 127:96 of {\tt sbdata} (if the system bus is that
|
|
|
|
|
* wide).
|
|
|
|
|
*/
|
|
|
|
|
#define DMI_SBDATA3_DATA_OFFSET 0
|
|
|
|
|
#define DMI_SBDATA3_DATA_LENGTH 32
|
|
|
|
@@ -1188,6 +1209,9 @@
|
|
|
|
|
* 0: Don't do the operation specified by \Fwrite.
|
|
|
|
|
*
|
|
|
|
|
* 1: Do the operation specified by \Fwrite.
|
|
|
|
|
*
|
|
|
|
|
* This bit can be used to just execute the Program Buffer without
|
|
|
|
|
* having to worry about placing valid values into \Fsize or \Fregno.
|
|
|
|
|
*/
|
|
|
|
|
#define AC_ACCESS_REGISTER_TRANSFER_OFFSET 17
|
|
|
|
|
#define AC_ACCESS_REGISTER_TRANSFER_LENGTH 1
|
|
|
|
@@ -1223,8 +1247,9 @@
|
|
|
|
|
/*
|
|
|
|
|
* Contains the privilege level the hart was operating in when Debug
|
|
|
|
|
* Mode was entered. The encoding is described in Table
|
|
|
|
|
* \ref{tab:privlevel}. A user can write this value to change the
|
|
|
|
|
* hart's privilege level when exiting Debug Mode.
|
|
|
|
|
* \ref{tab:privlevel}, and matches the privilege level encoding from
|
|
|
|
|
* the RISC-V Privileged ISA Specification. A user can write this
|
|
|
|
|
* value to change the hart's privilege level when exiting Debug Mode.
|
|
|
|
|
*/
|
|
|
|
|
#define VIRT_PRIV_PRV_OFFSET 0
|
|
|
|
|
#define VIRT_PRIV_PRV_LENGTH 2
|
|
|
|
|