This is an automated email from Gerrit.

"liangzhen <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/9359

-- gerrit

commit 71acc85b3b1cf5f214f51b183d4e4c5a7d213e9a
Author: liangzhen <[email protected]>
Date:   Sun Jan 4 11:28:32 2026 +0800

    target: add reset examined entries to the riscv target
    
    On riscv targets, this used to reset the examined flag
    for riscv debug module.
    
    Change-Id: Ieb046a2a068586d57422c75c07bbdc368064e517
    Signed-off-by: liangzhen <[email protected]>

diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 6fa5e025be..219fffd661 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2170,6 +2170,16 @@ static int examine(struct target *target)
        return ERROR_OK;
 }
 
+static int reset_examined(struct target *target)
+{
+       dm013_info_t *dm = get_dm(target);
+       if (!dm)
+               return ERROR_FAIL;
+
+       dm->was_examined = false;
+       return ERROR_OK;
+}
+
 static int riscv013_authdata_read(struct target *target, uint32_t *value, 
unsigned int index)
 {
        if (index > 0) {
@@ -5095,6 +5105,7 @@ struct target_type riscv013_target = {
        .init_target = init_target,
        .deinit_target = deinit_target,
        .examine = examine,
+       .reset_examied = reset_examied,
 
        .poll = &riscv_openocd_poll,
        .halt = &riscv_halt,
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 8054a1c9b7..f7ad4d902e 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -2509,6 +2509,18 @@ examine_fail:
        return examine_status;
 }
 
+static int riscv_reset_examined(struct target *target)
+{
+       struct target_type *tt = get_target_type(target);
+       if (!tt)
+               return ERROR_FAIL;
+
+       if (tt->reset_examined)
+               return tt->reset_examined(target);
+
+       return ERROR_OK;
+}
+
 static int oldriscv_poll(struct target *target)
 {
        struct target_type *tt = get_target_type(target);
@@ -5897,6 +5909,7 @@ struct target_type riscv_target = {
        .init_target = riscv_init_target,
        .deinit_target = riscv_deinit_target,
        .examine = riscv_examine,
+       .reset_examined = riscv_reset_examined,
 
        /* poll current target status */
        .poll = old_or_new_riscv_poll,
diff --git a/src/target/target.c b/src/target/target.c
index ababa57fbd..616820448f 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -663,6 +663,8 @@ static int no_mmu(struct target *target, bool *enabled)
 static inline void target_reset_examined(struct target *target)
 {
        target->examined = false;
+       if (target->type->reset_examined)
+               target->type->reset_examined(target);
 }
 
 static int default_examine(struct target *target)
diff --git a/src/target/target_type.h b/src/target/target_type.h
index ccbe03a476..1356502498 100644
--- a/src/target/target_type.h
+++ b/src/target/target_type.h
@@ -217,6 +217,9 @@ struct target_type {
         */
        int (*examine)(struct target *target);
 
+       /* Reset the examined flag for the given target. */
+       int (*reset_examined)(struct target *target);
+
        /* Set up structures for target.
         *
         * It is illegal to talk to the target at this stage as this fn is 
invoked

-- 

Reply via email to