target/riscv: revive 'riscv resume_order'

This functionality was lost in [1], which was merged as commit
615709d140 ("Upstream a whole host of RISC-V changes.").
Now it works as expected again.

Add convenience macro foreach_smp_target_direction().

Link: [1] https://github.com/riscv/riscv-openocd/pull/567
Change-Id: I1545fa6b45b8a07e27c8ff9dcdcfa2fc4f950cd1
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6785
Tested-by: jenkins
This commit is contained in:
Tim Newsome 2021-12-16 12:54:35 +01:00 committed by Antonio Borneo
parent a11fe473ea
commit 49c40a7529
2 changed files with 9 additions and 3 deletions

View File

@ -1472,14 +1472,16 @@ int riscv_resume(
int result = ERROR_OK;
if (target->smp && !single_hart) {
struct target_list *tlist;
foreach_smp_target(tlist, target->smp_targets) {
foreach_smp_target_direction(resume_order == RO_NORMAL,
tlist, target->smp_targets) {
struct target *t = tlist->target;
if (resume_prep(t, current, address, handle_breakpoints,
debug_execution) != ERROR_OK)
result = ERROR_FAIL;
}
foreach_smp_target(tlist, target->smp_targets) {
foreach_smp_target_direction(resume_order == RO_NORMAL,
tlist, target->smp_targets) {
struct target *t = tlist->target;
riscv_info_t *i = riscv_info(t);
if (i->prepped) {
@ -1489,7 +1491,8 @@ int riscv_resume(
}
}
foreach_smp_target(tlist, target->smp_targets) {
foreach_smp_target_direction(resume_order == RO_NORMAL,
tlist, target->smp_targets) {
struct target *t = tlist->target;
if (resume_finish(t) != ERROR_OK)
return ERROR_FAIL;

View File

@ -25,6 +25,9 @@
#define foreach_smp_target(pos, head) \
list_for_each_entry(pos, head, lh)
#define foreach_smp_target_direction(forward, pos, head) \
list_for_each_entry_direction(forward, pos, head, lh)
extern const struct command_registration smp_command_handlers[];
int gdb_read_smp_packet(struct connection *connection,