target/riscv: Don't resume unavailable harts.
Change-Id: I30a2e9ec6c1b99fb92ab1a160ddb63682167c6d8 Signed-off-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
parent
d3bffe3d86
commit
b1f3a75819
|
@ -85,7 +85,7 @@ static int breakpoint_add_internal(struct target *target,
|
||||||
reason = "resource not available";
|
reason = "resource not available";
|
||||||
goto fail;
|
goto fail;
|
||||||
case ERROR_TARGET_NOT_HALTED:
|
case ERROR_TARGET_NOT_HALTED:
|
||||||
reason = "target running";
|
reason = "target not halted";
|
||||||
goto fail;
|
goto fail;
|
||||||
default:
|
default:
|
||||||
reason = "unknown reason";
|
reason = "unknown reason";
|
||||||
|
@ -222,6 +222,8 @@ int breakpoint_add(struct target *target,
|
||||||
struct target_list *list_node;
|
struct target_list *list_node;
|
||||||
foreach_smp_target(list_node, target->smp_targets) {
|
foreach_smp_target(list_node, target->smp_targets) {
|
||||||
struct target *curr = list_node->target;
|
struct target *curr = list_node->target;
|
||||||
|
if (curr->state == TARGET_UNAVAILABLE)
|
||||||
|
continue;
|
||||||
int retval = breakpoint_add_internal(curr, address, length, type);
|
int retval = breakpoint_add_internal(curr, address, length, type);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -243,6 +245,8 @@ int context_breakpoint_add(struct target *target,
|
||||||
|
|
||||||
foreach_smp_target(head, target->smp_targets) {
|
foreach_smp_target(head, target->smp_targets) {
|
||||||
struct target *curr = head->target;
|
struct target *curr = head->target;
|
||||||
|
if (curr->state == TARGET_UNAVAILABLE)
|
||||||
|
continue;
|
||||||
int retval = context_breakpoint_add_internal(curr, asid, length, type);
|
int retval = context_breakpoint_add_internal(curr, asid, length, type);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -265,6 +269,8 @@ int hybrid_breakpoint_add(struct target *target,
|
||||||
|
|
||||||
foreach_smp_target(head, target->smp_targets) {
|
foreach_smp_target(head, target->smp_targets) {
|
||||||
struct target *curr = head->target;
|
struct target *curr = head->target;
|
||||||
|
if (curr->state == TARGET_UNAVAILABLE)
|
||||||
|
continue;
|
||||||
int retval = hybrid_breakpoint_add_internal(curr, address, asid, length, type);
|
int retval = hybrid_breakpoint_add_internal(curr, address, asid, length, type);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -441,7 +447,7 @@ int watchpoint_add_internal(struct target *target, target_addr_t address,
|
||||||
reason = "resource not available";
|
reason = "resource not available";
|
||||||
goto bye;
|
goto bye;
|
||||||
case ERROR_TARGET_NOT_HALTED:
|
case ERROR_TARGET_NOT_HALTED:
|
||||||
reason = "target running";
|
reason = "target not halted";
|
||||||
goto bye;
|
goto bye;
|
||||||
default:
|
default:
|
||||||
reason = "unrecognized error";
|
reason = "unrecognized error";
|
||||||
|
@ -473,6 +479,8 @@ int watchpoint_add(struct target *target, target_addr_t address,
|
||||||
|
|
||||||
foreach_smp_target(head, target->smp_targets) {
|
foreach_smp_target(head, target->smp_targets) {
|
||||||
struct target *curr = head->target;
|
struct target *curr = head->target;
|
||||||
|
if (curr->state == TARGET_UNAVAILABLE)
|
||||||
|
continue;
|
||||||
int retval = watchpoint_add_internal(curr, address, length, rw, value, mask);
|
int retval = watchpoint_add_internal(curr, address, length, rw, value, mask);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -1625,9 +1625,11 @@ int riscv_resume(
|
||||||
struct target_list *tlist;
|
struct target_list *tlist;
|
||||||
foreach_smp_target_direction(resume_order == RO_NORMAL, tlist, targets) {
|
foreach_smp_target_direction(resume_order == RO_NORMAL, tlist, targets) {
|
||||||
struct target *t = tlist->target;
|
struct target *t = tlist->target;
|
||||||
if (resume_prep(t, current, address, handle_breakpoints,
|
if (t->state != TARGET_UNAVAILABLE) {
|
||||||
debug_execution) != ERROR_OK)
|
if (resume_prep(t, current, address, handle_breakpoints,
|
||||||
result = ERROR_FAIL;
|
debug_execution) != ERROR_OK)
|
||||||
|
result = ERROR_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach_smp_target_direction(resume_order == RO_NORMAL, tlist, targets) {
|
foreach_smp_target_direction(resume_order == RO_NORMAL, tlist, targets) {
|
||||||
|
@ -1642,8 +1644,10 @@ int riscv_resume(
|
||||||
|
|
||||||
foreach_smp_target_direction(resume_order == RO_NORMAL, tlist, targets) {
|
foreach_smp_target_direction(resume_order == RO_NORMAL, tlist, targets) {
|
||||||
struct target *t = tlist->target;
|
struct target *t = tlist->target;
|
||||||
if (resume_finish(t, debug_execution) != ERROR_OK)
|
if (t->state != TARGET_UNAVAILABLE) {
|
||||||
result = ERROR_FAIL;
|
if (resume_finish(t, debug_execution) != ERROR_OK)
|
||||||
|
result = ERROR_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue