aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2018-04-09 15:12:51 -0700
committerTim Newsome <tim@sifive.com>2018-04-09 15:13:24 -0700
commit1fda89c3cef918a87d2b3bcd1f3158c011ef107e (patch)
tree0977d0d1449fa92c3b3e79453fc386034594b483 /src
parent238b1e9f06709ce993f3057b7be54311485b5467 (diff)
downloadriscv-openocd-1fda89c3cef918a87d2b3bcd1f3158c011ef107e.zip
riscv-openocd-1fda89c3cef918a87d2b3bcd1f3158c011ef107e.tar.gz
riscv-openocd-1fda89c3cef918a87d2b3bcd1f3158c011ef107e.tar.bz2
Only write hartsel if we're changing it.
DebugBreakpoint went from 2.94s to 2.74s. Change-Id: Ia3ab857aea89fb83f0bcdd9a6bb69f256bde13dd
Diffstat (limited to 'src')
-rw-r--r--src/target/riscv/riscv-013.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index d9e2907..4d23cd6 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -144,6 +144,8 @@ typedef struct {
bool was_reset;
/* Targets that are connected to this DM. */
struct list_head target_list;
+ /* The currently selected hartid on this DM. */
+ int current_hartid;
} dm013_info_t;
typedef struct {
@@ -243,6 +245,7 @@ static dm013_info_t *get_dm(struct target *target)
if (!dm) {
dm = calloc(1, sizeof(dm013_info_t));
dm->abs_chain_position = abs_chain_position;
+ dm->current_hartid = -1;
INIT_LIST_HEAD(&dm->target_list);
list_add(&dm->list, &dm_list);
}
@@ -1137,8 +1140,6 @@ static int register_read(struct target *target, uint64_t *value, uint32_t number
struct reg *reg = &target->reg_cache->reg_list[number];
if (reg && reg->valid) {
*value = buf_get_u64(reg->value, 0, reg->size);
- LOG_INFO(">>> cache hit on %s: 0x%" PRIx64,
- gdb_regno_name(number), *value);
return ERROR_OK;
}
}
@@ -2700,10 +2701,19 @@ static void riscv013_select_current_hart(struct target *target)
{
RISCV_INFO(r);
+ dm013_info_t *dm = get_dm(target);
+ if (r->current_hartid == dm->current_hartid) {
+ LOG_DEBUG(">>> nothing to be done");
+ return;
+ }
+
+ LOG_DEBUG(">>> change it");
+
uint32_t dmcontrol;
dmi_read(target, &dmcontrol, DMI_DMCONTROL);
dmcontrol = set_field(dmcontrol, hartsel_mask(target), r->current_hartid);
dmi_write(target, DMI_DMCONTROL, dmcontrol);
+ dm->current_hartid = r->current_hartid;
}
static int riscv013_halt_current_hart(struct target *target)