This is an automated email from Gerrit.

Kevin Yang ([email protected]) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/5831

-- gerrit

commit 1bdae36d714999a683d76931d326b3a337442786
Author: Kevin Yang <[email protected]>
Date:   Wed Sep 2 20:15:31 2020 -0700

    target/aarch64: Use apnum setting
    
    Change aarch64 to use ap-num setting if provided. Fall back to original
    behavior of using first AP when ap-num is invalid.
    
    Change-Id: I0d3624f75c86ba5fd5a322ac60856dbbb6e71eaf
    Signed-off-by: Kevin Yang <[email protected]>

diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index e6b1cc0..c98c132 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -2255,11 +2255,15 @@ static int aarch64_examine_first(struct target *target)
        uint32_t tmp0, tmp1, tmp2, tmp3;
        debug = ttypr = cpuid = 0;
 
-       /* Search for the APB-AB - it is needed for access to debug registers */
-       retval = dap_find_ap(swjdp, AP_TYPE_APB_AP, &armv8->debug_ap);
-       if (retval != ERROR_OK) {
-               LOG_ERROR("Could not find APB-AP for debug access");
-               return retval;
+       if (armv8->apsel == DP_APSEL_INVALID) {
+               /* Search for the APB-AB */
+               retval = dap_find_ap(swjdp, AP_TYPE_APB_AP, &armv8->debug_ap);
+               if (retval != ERROR_OK) {
+                       LOG_ERROR("Could not find APB-AP for debug access");
+                       return retval;
+               }
+       } else {
+               armv8->debug_ap = dap_ap(swjdp, armv8->apsel);
        }
 
        retval = mem_ap_init(armv8->debug_ap);
@@ -2400,13 +2404,14 @@ static int aarch64_init_target(struct command_context 
*cmd_ctx,
 }
 
 static int aarch64_init_arch_info(struct target *target,
-       struct aarch64_common *aarch64, struct adiv5_dap *dap)
+       struct aarch64_common *aarch64, struct adiv5_dap *dap, int apsel)
 {
        struct armv8_common *armv8 = &aarch64->armv8_common;
 
        /* Setup struct aarch64_common */
        aarch64->common_magic = AARCH64_COMMON_MAGIC;
        armv8->arm.dap = dap;
+       armv8->apsel = apsel;
 
        /* register arch-specific functions */
        armv8->examine_debug_reason = NULL;
@@ -2435,7 +2440,8 @@ static int aarch64_target_create(struct target *target, 
Jim_Interp *interp)
                return ERROR_FAIL;
        }
 
-       return aarch64_init_arch_info(target, aarch64, pc->adiv5_config.dap);
+       return aarch64_init_arch_info(target, aarch64, pc->adiv5_config.dap,
+               pc->adiv5_config.ap_num);
 }
 
 static void aarch64_deinit_target(struct target *target)
diff --git a/src/target/armv8.h b/src/target/armv8.h
index 978b2ad..e8c1b4f 100644
--- a/src/target/armv8.h
+++ b/src/target/armv8.h
@@ -197,6 +197,7 @@ struct armv8_common {
        /* Core Debug Unit */
        struct arm_dpm dpm;
        uint32_t debug_base;
+       int apsel;
        struct adiv5_ap *debug_ap;
 
        const uint32_t *opcodes;

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to