aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcgsfv <cgsfv@users.noreply.github.com>2024-02-13 18:00:52 -0800
committercgsfv <cgsfv@users.noreply.github.com>2024-02-13 18:00:52 -0800
commitae537889851b0bb03bd61f79b08c74df172c5ec1 (patch)
tree9284142d4154e2026c6811a4e613f1f0a32d3e74
parent87331a82a29a5aeb222543b6876e0208be70ea41 (diff)
downloadriscv-openocd-ae537889851b0bb03bd61f79b08c74df172c5ec1.zip
riscv-openocd-ae537889851b0bb03bd61f79b08c74df172c5ec1.tar.gz
riscv-openocd-ae537889851b0bb03bd61f79b08c74df172c5ec1.tar.bz2
Added more handling of unexamined harts
-rw-r--r--src/target/riscv/riscv.c19
-rw-r--r--src/target/target.c2
2 files changed, 15 insertions, 6 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 97de017..3f35a4f 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -534,6 +534,10 @@ static void riscv_deinit_target(struct target *target)
{
LOG_TARGET_DEBUG(target, "riscv_deinit_target()");
+ /* No need to deinit a target that has not been examined */
+ if (!target->examined)
+ return;
+
struct riscv_info *info = target->arch_info;
struct target_type *tt = get_target_type(target);
if (!tt)
@@ -1920,19 +1924,22 @@ int riscv_halt(struct target *target)
LOG_TARGET_DEBUG(target, "halting all harts");
+ /* Only halt a hart if it has been examined (was available) */
int result = ERROR_OK;
if (target->smp) {
struct target_list *tlist;
foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
- if (halt_prep(t) != ERROR_OK)
- result = ERROR_FAIL;
+ if (t->examined) {
+ if (halt_prep(t) != ERROR_OK)
+ result = ERROR_FAIL;
+ }
}
foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
struct riscv_info *i = riscv_info(t);
- if (i->prepped) {
+ if (t->examined && i->prepped) {
if (halt_go(t) != ERROR_OK)
result = ERROR_FAIL;
}
@@ -1940,8 +1947,10 @@ int riscv_halt(struct target *target)
foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
- if (halt_finish(t) != ERROR_OK)
- return ERROR_FAIL;
+ if (t->examined) {
+ if (halt_finish(t) != ERROR_OK)
+ return ERROR_FAIL;
+ }
}
} else {
diff --git a/src/target/target.c b/src/target/target.c
index 630e47e..74d1a8a 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2978,7 +2978,7 @@ static int handle_target(void *priv)
* schedule for now+polling_interval, the next poll won't
* actually happen until a polling_interval later. */
bool poll_needed = timeval_ms() + polling_interval / 2 >= target->backoff.next_attempt;
- if (!target->tap->enabled || power_dropout || srst_asserted || !poll_needed)
+ if (!target->examined || !target->tap->enabled || power_dropout || srst_asserted || !poll_needed)
continue;
/* polling may fail silently until the target has been examined */