aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2022-09-09 09:57:39 -0700
committerGitHub <noreply@github.com>2022-09-09 09:57:39 -0700
commit911d68ef25ab6996110cc618279b600fe82591e5 (patch)
treee39ac0dec8656608e5d4243d215a67e1aed0c244
parent04020c19d0a63039f446cd45106f38431aa6d7bd (diff)
downloadriscv-openocd-911d68ef25ab6996110cc618279b600fe82591e5.zip
riscv-openocd-911d68ef25ab6996110cc618279b600fe82591e5.tar.gz
riscv-openocd-911d68ef25ab6996110cc618279b600fe82591e5.tar.bz2
Don't read dmcontrol to set hartsel (#723)
* Don't read dmcontrol to set hartsel We already know what dmcontrol should be. This addresses a long-standing TODO. In a toy test, this reduced the number of scans by 10+%. (Most of those are probably in poll(), so don't actually affect perceived performance.) Change-Id: I18e5ca391f0f5fb35f30d44dfef834e5a66aee20 Signed-off-by: Tim Newsome <tim@sifive.com> * Make code easier to read Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com> Signed-off-by: Tim Newsome <tim@sifive.com> Signed-off-by: Tim Newsome <tim@sifive.com> Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
-rw-r--r--src/target/riscv/riscv-013.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 32b9cf7..24895e9 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -4110,10 +4110,7 @@ static int riscv013_select_current_hart(struct target *target)
if (r->current_hartid == dm->current_hartid)
return ERROR_OK;
- uint32_t dmcontrol;
- /* TODO: can't we just "dmcontrol = DMI_DMACTIVE"? */
- if (dmi_read(target, &dmcontrol, DM_DMCONTROL) != ERROR_OK)
- return ERROR_FAIL;
+ uint32_t dmcontrol = DM_DMCONTROL_DMACTIVE;
dmcontrol = set_hartsel(dmcontrol, r->current_hartid);
int result = dmi_write(target, DM_DMCONTROL, dmcontrol);
dm->current_hartid = r->current_hartid;