From 513aba19302cc6ad7bdb33390622fd5821571e8f Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Sat, 21 Aug 2021 23:59:38 +0200 Subject: [PATCH] adiv6: read ROM Table address size Required for parsing ADIv6 ROM tables. Split from change https://review.openocd.org/6077/ Change-Id: I849543b7b4a4455b10bd9fc7da38a37849d71700 Signed-off-by: Kevin Burke Signed-off-by: Daniel Goehring Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/6458 Tested-by: jenkins --- src/target/arm_adi_v5.h | 3 +++ src/target/arm_dap.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index 7706fc935..4cba62ae1 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -395,6 +395,9 @@ struct adiv5_dap { /** Indicates ADI version (5, 6 or 0 for unknown) being used */ unsigned int adi_version; + + /* ADIv6 only field indicating ROM Table address size */ + unsigned int asize; }; /** diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c index 59d577e7f..d2e3f9997 100644 --- a/src/target/arm_dap.c +++ b/src/target/arm_dap.c @@ -140,6 +140,23 @@ static int dap_init_all(void) retval = dap->ops->connect(dap); if (retval != ERROR_OK) return retval; + + /* see if address size of ROM Table is greater than 32-bits */ + if (is_adiv6(dap)) { + uint32_t dpidr1; + + retval = dap->ops->queue_dp_read(dap, DP_DPIDR1, &dpidr1); + if (retval != ERROR_OK) { + LOG_ERROR("DAP read of DPIDR1 failed..."); + return retval; + } + retval = dap_run(dap); + if (retval != ERROR_OK) { + LOG_ERROR("DAP read of DPIDR1 failed..."); + return retval; + } + dap->asize = dpidr1 & DP_DPIDR1_ASIZE_MASK; + } } return ERROR_OK;