Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve description of cmderr "busy" #1076

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions debug_module.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ While the reset is on-going, harts are either in the running state,
indicating it's possible to perform some abstract commands during this
time, or in the unavailable state, indicating it's not possible to
perform any abstract commands during this time. Once a hart's reset is
complete, `havereset` becomes set. When a hart comes out of reset and {dmcontrol-haltreq} or `resethaltreq`
complete, `havereset` becomes set. When a hart comes out of reset and {dmcontrol-haltreq} or `resethaltreq`
are set, the hart will immediately enter Debug Mode (halted state).
Otherwise, if the hart was initially running it will execute normally
(running state) and if the hart was initially halted it should now be
Expand Down Expand Up @@ -328,13 +328,17 @@ that case, the command will return "not supported".
====

Debuggers execute abstract commands by writing them to {dm-command}. They can
determine whether an abstract command is complete by reading {abstractcs-busy} in {dm-abstractcs}. If the debugger starts a new command while {abstractcs-busy} is set, {abstractcs-cmderr} becomes 1 (busy), the
currently executing command still gets to run to completion, but any
error generated by the currently executing command is lost. After
determine whether an abstract command is complete by reading {abstractcs-busy} in {dm-abstractcs}. After
completion, {abstractcs-cmderr} indicates whether the command was successful or not.
Commands may fail because a hart is not halted, not running,
unavailable, or because they encounter an error during execution.

If the debugger attempts to start a new command while {abstractcs-busy} is set,
the new command will not get started and the currently executing command still
gets to run to completion. After the command finishes, {abstractcs-cmderr}
will contain 1 (busy), and any error generated by the completed command will
be lost.

If the command takes arguments, the debugger must write them to the
`data` registers before writing to {dm-command}. If a command returns results, the
Debug Module must ensure they are placed in the `data` registers before {abstractcs-busy}
Expand Down Expand Up @@ -393,7 +397,7 @@ determines the kind of command. <<tab:cmdtype>> lists all commands.
.Meaning of {command-cmdtype}
[%autowidth,float="center",align="center",cols=">,<",options="header"]
|===
| {command-cmdtype} | Command
| {command-cmdtype} | Command
| 0 | <<ac-accessregister, Access Register Command>>
| 1 | <<ac-quickaccess, Quick Access>>
| 2 | <<ac-accessmemory, Access Memory Command>>
Expand Down Expand Up @@ -555,7 +559,7 @@ effects, use the following procedure:
.. Read {dm-dmcontrol} until {dmcontrol-dmactive} is high.
. Read {dm-dmstatus}, which contains {dmstatus-version}.

If it was necessary to clear {dmcontrol-ndmreset}, this might have the following
If it was necessary to clear {dmcontrol-ndmreset}, this might have the following
side effects:

. {dmcontrol-haltreq} is cleared, potentially preventing a halt request made by a previous debugger from taking effect.
Expand Down
14 changes: 5 additions & 9 deletions xml/dm_registers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,7 @@ same project unless stated otherwise.

<register name="Abstract Control and Status" short="abstractcs" address="0x16">
Writing this register while an abstract command is executing causes
{abstractcs-cmderr} to become 1 (busy) once the command completes
({abstractcs-busy} becomes 0).
{abstractcs-cmderr} to contain 1 (busy) once the command completes.

[NOTE]
====
Expand Down Expand Up @@ -527,7 +526,6 @@ same project unless stated otherwise.
An abstract command was executing while {dm-command},
{dm-abstractcs}, or {dm-abstractauto} was written, or when one
of the `data` or `progbuf` registers was read or written.
This status is only written if {abstractcs-cmderr} contains 0.
</value>

<value v="2" name="not supported">
Expand Down Expand Up @@ -572,8 +570,7 @@ same project unless stated otherwise.
executed.

Writing this register while an abstract command is executing causes
{abstractcs-cmderr} to become 1 (busy) once the command completes
(busy becomes 0).
{abstractcs-cmderr} to contain 1 (busy) once the command completes.

If {abstractcs-cmderr} is non-zero, writes to this register are ignored.

Expand Down Expand Up @@ -608,8 +605,7 @@ same project unless stated otherwise.

If this register is written while an abstract command is executing
then the write is ignored and
{abstractcs-cmderr} becomes 1 (busy) once the command completes
(busy becomes 0).
{abstractcs-cmderr} will contain 1 (busy) once the command completes.

<field name="autoexecprogbuf" bits="31:16" access="WARL" reset="0">
When a bit in this field is 1, read or write accesses to the
Expand Down Expand Up @@ -677,7 +673,7 @@ same project unless stated otherwise.
registers.

Accessing these registers while an abstract command is executing causes
{abstractcs-cmderr} to be set to 1 (busy) if it is 0.
{abstractcs-cmderr} to contain 1 (busy) once the command completes.

Attempts to write them while {abstractcs-busy} is set does not change their value.

Expand Down Expand Up @@ -712,7 +708,7 @@ same project unless stated otherwise.
implemented starting at {dm-progbuf0}, counting up.

Accessing these registers while an abstract command is executing causes
{abstractcs-cmderr} to be set to 1 (busy) if it is 0.
{abstractcs-cmderr} to contain 1 (busy) once the command completes.

Attempts to write them while {abstractcs-busy} is set does not change their value.

Expand Down