This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6785

-- gerrit

commit b7873b747e361fee9f89e0b5d739db6fc6a91a58
Author: Tim Newsome <t...@sifive.com>
Date:   Thu Dec 16 12:54:35 2021 +0100

    target/riscv: revive 'riscv resume_order'
    
    This functionality was lost in [1], which was merged as commit
    615709d14049 ("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 <t...@sifive.com>
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 00d030543..843d9a548 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -1470,14 +1470,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) {
@@ -1487,7 +1489,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;
diff --git a/src/target/smp.h b/src/target/smp.h
index 46fc55f75..490a49310 100644
--- a/src/target/smp.h
+++ b/src/target/smp.h
@@ -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,

-- 

Reply via email to