From: Daniel Goehring Date: Tue, 4 Oct 2022 07:03:42 +0000 (-0700) Subject: target/adiv5: 64-bit TAR setup bugfix X-Git-Tag: v0.12.0-rc2~23 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=a69b382efd35f13e0f7e63194086a2f5ac24215b target/adiv5: 64-bit TAR setup bugfix For 64-bit TAR setup, if 'tar_valid == false' perform the upper 32-bit write even if the cached copy matches the upper TAR value to be written. Signed-off-by: Daniel Goehring Change-Id: I320377dc90a9d1d7b64cbb281b2527e56c7621ee Reviewed-on: https://review.openocd.org/c/openocd/+/7245 Reviewed-by: Tomas Vanek Reviewed-by: Antonio Borneo Tested-by: jenkins --- diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index c44642825e..da5da3197d 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -113,7 +113,7 @@ static int mem_ap_setup_tar(struct adiv5_ap *ap, target_addr_t tar) int retval = dap_queue_ap_write(ap, MEM_AP_REG_TAR(ap->dap), (uint32_t)(tar & 0xffffffffUL)); if (retval == ERROR_OK && is_64bit_ap(ap)) { /* See if bits 63:32 of tar is different from last setting */ - if ((ap->tar_value >> 32) != (tar >> 32)) + if (!ap->tar_valid || (ap->tar_value >> 32) != (tar >> 32)) retval = dap_queue_ap_write(ap, MEM_AP_REG_TAR64(ap->dap), (uint32_t)(tar >> 32)); } if (retval != ERROR_OK) {