This is an automated email from Gerrit.

Florian Fainelli (f.faine...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6360

-- gerrit

commit a00f4a1449c3fc98384d1102db1dbbeccb7e3a90
Author: Florian Fainelli <f.faine...@gmail.com>
Date:   Tue Jul 6 20:32:08 2021 -0700

    arm_adi_v5: Recurse looking up a CS if we have a nested ROM
    
    Similar to the previous commit which fixed the "dap info" displaying of
    nested ROMs, when we encounter a device type of 0 in the Class 9 ROMs,
    we need to continue and recurse until we can look up the desired DAP CS
    with the expected type (0x15).
    
    Towards that goal, move the reading of the device type a bit earlier so
    we can key both the class type (1 or 9) and the device type to trigger a
    nested ROM parsing if needed.
    
    This fixes the inability to debug, e.g.: Cortex-A76 CPUs since we were
    not able to look up the CPU CS before.
    
    Change-Id: I8efacf8b776d276e39cdbfaa64d66cf8d02aca05
    Signed-off-by: Florian Fainelli <f.faine...@gmail.com>

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index f0412c4..3cefc5d 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -990,13 +990,21 @@ int dap_lookup_cs_component(struct adiv5_ap *ap,
 
                if (romentry & 0x1) {
                        uint32_t c_cid1;
+                       uint8_t class;
                        retval = mem_ap_read_atomic_u32(ap, component_base | 
0xff4, &c_cid1);
                        if (retval != ERROR_OK) {
                                LOG_ERROR("Can't read component with base 
address " TARGET_ADDR_FMT
                                          ", the corresponding core might be 
turned off", component_base);
                                return retval;
                        }
-                       if (((c_cid1 >> 4) & 0x0f) == 1) {
+
+                       retval = mem_ap_read_atomic_u32(ap, component_base | 
0xfcc, &devtype);
+                       if (retval != ERROR_OK)
+                               return retval;
+
+                       class = (c_cid1 >> 4) & 0x0f;
+                       /* Parse class 0x1 ROM or class 0x9 ROM with devtype = 
0 */
+                       if (class == 1 || (class == 9 && devtype == 0)) {
                                retval = dap_lookup_cs_component(ap, 
component_base,
                                                        type, addr, idx);
                                if (retval == ERROR_OK)
@@ -1005,9 +1013,6 @@ int dap_lookup_cs_component(struct adiv5_ap *ap,
                                        return retval;
                        }
 
-                       retval = mem_ap_read_atomic_u32(ap, component_base | 
0xfcc, &devtype);
-                       if (retval != ERROR_OK)
-                               return retval;
                        if ((devtype & 0xff) == type) {
                                if (!*idx) {
                                        *addr = component_base;

-- 

Reply via email to