Added more handling of unexamined harts
This commit is contained in:
parent
87331a82a2
commit
ae53788985
|
@ -534,6 +534,10 @@ static void riscv_deinit_target(struct target *target)
|
||||||
{
|
{
|
||||||
LOG_TARGET_DEBUG(target, "riscv_deinit_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 riscv_info *info = target->arch_info;
|
||||||
struct target_type *tt = get_target_type(target);
|
struct target_type *tt = get_target_type(target);
|
||||||
if (!tt)
|
if (!tt)
|
||||||
|
@ -1920,19 +1924,22 @@ int riscv_halt(struct target *target)
|
||||||
|
|
||||||
LOG_TARGET_DEBUG(target, "halting all harts");
|
LOG_TARGET_DEBUG(target, "halting all harts");
|
||||||
|
|
||||||
|
/* Only halt a hart if it has been examined (was available) */
|
||||||
int result = ERROR_OK;
|
int result = ERROR_OK;
|
||||||
if (target->smp) {
|
if (target->smp) {
|
||||||
struct target_list *tlist;
|
struct target_list *tlist;
|
||||||
foreach_smp_target(tlist, target->smp_targets) {
|
foreach_smp_target(tlist, target->smp_targets) {
|
||||||
struct target *t = tlist->target;
|
struct target *t = tlist->target;
|
||||||
if (halt_prep(t) != ERROR_OK)
|
if (t->examined) {
|
||||||
result = ERROR_FAIL;
|
if (halt_prep(t) != ERROR_OK)
|
||||||
|
result = ERROR_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach_smp_target(tlist, target->smp_targets) {
|
foreach_smp_target(tlist, target->smp_targets) {
|
||||||
struct target *t = tlist->target;
|
struct target *t = tlist->target;
|
||||||
struct riscv_info *i = riscv_info(t);
|
struct riscv_info *i = riscv_info(t);
|
||||||
if (i->prepped) {
|
if (t->examined && i->prepped) {
|
||||||
if (halt_go(t) != ERROR_OK)
|
if (halt_go(t) != ERROR_OK)
|
||||||
result = ERROR_FAIL;
|
result = ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1940,8 +1947,10 @@ int riscv_halt(struct target *target)
|
||||||
|
|
||||||
foreach_smp_target(tlist, target->smp_targets) {
|
foreach_smp_target(tlist, target->smp_targets) {
|
||||||
struct target *t = tlist->target;
|
struct target *t = tlist->target;
|
||||||
if (halt_finish(t) != ERROR_OK)
|
if (t->examined) {
|
||||||
return ERROR_FAIL;
|
if (halt_finish(t) != ERROR_OK)
|
||||||
|
return ERROR_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2978,7 +2978,7 @@ static int handle_target(void *priv)
|
||||||
* schedule for now+polling_interval, the next poll won't
|
* schedule for now+polling_interval, the next poll won't
|
||||||
* actually happen until a polling_interval later. */
|
* actually happen until a polling_interval later. */
|
||||||
bool poll_needed = timeval_ms() + polling_interval / 2 >= target->backoff.next_attempt;
|
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;
|
continue;
|
||||||
|
|
||||||
/* polling may fail silently until the target has been examined */
|
/* polling may fail silently until the target has been examined */
|
||||||
|
|
Loading…
Reference in New Issue