This is an automated email from Gerrit.

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

-- gerrit

commit f97e0c76ab748e9c2c334899eb22c46cce8d55d0
Author: Zane Leung <[email protected]>
Date:   Mon Jun 29 16:13:41 2026 +0200

    riscv: move dbus_busy_delay to struct riscv_dtm
    
    Move the field
    riscv011_info_t::dbus_busy_delay
    
    as
    struct riscv_dtm::dbus_busy_delay
    
    Change-Id: I4baaf0b38446b88010951fc3049a21cb8fe18bb9
    Signed-off-by: Zane Leung <[email protected]>
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c
index 28d9ee0b12..8c51aae07b 100644
--- a/src/target/riscv/riscv-011.c
+++ b/src/target/riscv/riscv-011.c
@@ -184,11 +184,6 @@ typedef struct {
 
        struct memory_cache_line dram_cache[DRAM_CACHE_SIZE];
 
-       /* This value is incremented every time a dbus access comes back as 
"busy".
-        * It's used to determine how many run-test/idle cycles to feed the 
target
-        * in between accesses. */
-       unsigned int dbus_busy_delay;
-
        /* This value is incremented every time we read the debug interrupt as
         * high.  It's used to add extra run-test/idle cycles after setting 
debug
         * interrupt high, so ideally we never have to perform a whole extra 
scan
@@ -332,9 +327,9 @@ static void increase_dbus_busy_delay(struct target *target)
        riscv011_info_t *info = get_info(target);
        struct riscv_dtm *dtm = target_to_dtm(target);
 
-       info->dbus_busy_delay += info->dbus_busy_delay / 10 + 1;
+       dtm->dbus_busy_delay += dtm->dbus_busy_delay / 10 + 1;
        LOG_DEBUG("dtmcontrol_idle=%d, dbus_busy_delay=%d, 
interrupt_high_delay=%d",
-                       dtm->idle, info->dbus_busy_delay,
+                       dtm->idle, dtm->dbus_busy_delay,
                        info->interrupt_high_delay);
 
        dtmcs_scan(target->tap, DTMCONTROL_DBUS_RESET, NULL /* discard value 
*/);
@@ -347,7 +342,7 @@ static void increase_interrupt_high_delay(struct target 
*target)
 
        info->interrupt_high_delay += info->interrupt_high_delay / 10 + 1;
        LOG_DEBUG("dtmcontrol_idle=%d, dbus_busy_delay=%d, 
interrupt_high_delay=%d",
-                       dtm->idle, info->dbus_busy_delay,
+                       dtm->idle, dtm->dbus_busy_delay,
                        info->interrupt_high_delay);
 }
 
@@ -362,7 +357,7 @@ static void add_dbus_scan(const struct target *target, 
struct scan_field *field,
        if (r->reset_delays_wait >= 0) {
                r->reset_delays_wait--;
                if (r->reset_delays_wait < 0) {
-                       info->dbus_busy_delay = 0;
+                       dtm->dbus_busy_delay = 0;
                        info->interrupt_high_delay = 0;
                }
        }
@@ -377,7 +372,7 @@ static void add_dbus_scan(const struct target *target, 
struct scan_field *field,
 
        jtag_add_dr_scan(target->tap, 1, field, TAP_IDLE);
 
-       int idle_count = dtm->idle + info->dbus_busy_delay;
+       int idle_count = dtm->idle + dtm->dbus_busy_delay;
        if (data & DMCONTROL_INTERRUPT)
                idle_count += info->interrupt_high_delay;
 
@@ -419,7 +414,6 @@ static void dump_field(const struct scan_field *field)
 static dbus_status_t dbus_scan(struct target *target, uint16_t *address_in,
                uint64_t *data_in, dbus_op_t op, uint16_t address_out, uint64_t 
data_out)
 {
-       riscv011_info_t *info = get_info(target);
        struct riscv_dtm *dtm = target_to_dtm(target);
        uint8_t in[8] = {0};
        uint8_t out[8] = {0};
@@ -443,7 +437,7 @@ static dbus_status_t dbus_scan(struct target *target, 
uint16_t *address_in,
        /* Assume dbus is already selected. */
        jtag_add_dr_scan(target->tap, 1, &field, TAP_IDLE);
 
-       int idle_count = dtm->idle + info->dbus_busy_delay;
+       int idle_count = dtm->idle + dtm->dbus_busy_delay;
 
        if (idle_count)
                jtag_add_runtest(idle_count, TAP_IDLE);
diff --git a/src/target/riscv/riscv_dtm.h b/src/target/riscv/riscv_dtm.h
index 0191f8556c..c08d0686f1 100644
--- a/src/target/riscv/riscv_dtm.h
+++ b/src/target/riscv/riscv_dtm.h
@@ -13,6 +13,11 @@ struct riscv_dtm {
        /* Number of run-test/idle cycles the target requests we do after each 
dbus
         * access. */
        unsigned int idle;
+
+       /* This value is incremented every time a dbus access comes back as 
"busy".
+        * It's used to determine how many run-test/idle cycles to feed the 
target
+        * in between accesses. */
+       unsigned int dbus_busy_delay;
 };
 
 struct riscv_dtm *target_to_dtm(const struct target *target);

-- 

Reply via email to