]> git.gag.com Git - fw/openocd/commitdiff
adiv6: read ROM Table address size
authorKevin Burke <kevinb@os.amperecomputing.com>
Sat, 21 Aug 2021 21:59:38 +0000 (23:59 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 24 Jun 2022 21:35:08 +0000 (21:35 +0000)
Required for parsing ADIv6 ROM tables.

Split from change https://review.openocd.org/6077/

Change-Id: I849543b7b4a4455b10bd9fc7da38a37849d71700
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6458
Tested-by: jenkins
src/target/arm_adi_v5.h
src/target/arm_dap.c

index 7706fc935b31e56936f7a48e71bb01c989dc754a..4cba62ae18d8018014a0cb75338751b3d48915cc 100644 (file)
@@ -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;
 };
 
 /**
index 59d577e7f0407cfe2b8a45a80950ad3936dc723f..d2e3f99972ab6518d177f975ff61c9c401b0f5fa 100644 (file)
@@ -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;