target/riscv: Reset DTM when it reports an error.

The error state is sticky, so this has to be done to recover.

Change-Id: I589f3cdab0f2351fd25f89951830cbc16c39bd93
Signed-off-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
Tim Newsome 2023-05-09 11:13:29 -07:00
parent c8e7e3535c
commit 1c5cf8023c
1 changed files with 3 additions and 0 deletions

View File

@ -590,6 +590,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
break;
} else {
LOG_ERROR("failed %s at 0x%x, status=%d", op_name, address, status);
dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
return ERROR_FAIL;
}
if (time(NULL) - start > timeout_sec)
@ -598,6 +599,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
if (status != DMI_STATUS_SUCCESS) {
LOG_ERROR("Failed %s at 0x%x; status=%d", op_name, address, status);
dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
return ERROR_FAIL;
}
@ -622,6 +624,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
LOG_ERROR("Failed %s (NOP) at 0x%x; status=%d", op_name, address,
status);
}
dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
return ERROR_FAIL;
}
if (time(NULL) - start > timeout_sec)