This is an automated email from Gerrit.

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

-- gerrit

commit d3dc4cba6e3c2f8be50511c4f4bdb2b5c3cb75f4
Author: Alexandre Becoulet <[email protected]>
Date:   Wed Apr 3 16:02:04 2013 +0200

    topic: arm_adi_v5: handle ROM tables hierarchy in the 
dap_lookup_cs_component function
    
    The ARM Debug interface v5 specification states that all ROM tables
    must be scanned to discover all the debug components. Only the root
    table is taken into account with the current code. This prevent
    OpenOCD to discover the ARM cores present in the Xilinx Zynq 7020.
    This patch makes OpenOCD work with the Zynq.
    
    Change-Id: I9d440d309adb6b6d3364b791ebcd40670806f613
    Signed-off-by: Alexandre Becoulet <[email protected]>

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 28f4318..41471bc 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1285,8 +1285,8 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
                        uint32_t dbgbase, uint8_t type, uint32_t *addr)
 {
        uint32_t ap_old;
-       uint32_t romentry, entry_offset = 0, component_base, devtype;
-       int retval = ERROR_FAIL;
+       uint32_t romentry, entry_offset = 0, component_base, devtype, cid1;
+       int found = ERROR_FAIL;
 
        if (ap >= 256)
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -1295,8 +1295,8 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
        dap_ap_select(dap, ap);
 
        do {
-               retval = mem_ap_read_atomic_u32(dap, (dbgbase&0xFFFFF000) |
-                                               entry_offset, &romentry);
+               int retval = mem_ap_read_atomic_u32(dap, (dbgbase&0xFFFFF000) |
+                                                   entry_offset, &romentry);
                if (retval != ERROR_OK)
                        return retval;
 
@@ -1304,6 +1304,24 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int 
ap,
                        + (romentry & 0xFFFFF000);
 
                if (romentry & 0x1) {
+                       /* read component ID register */
+                       retval = mem_ap_read_atomic_u32(dap,
+                                       (component_base & 0xfffff000) | 0xff4,
+                                       &cid1);
+
+                       if (retval != ERROR_OK)
+                               return retval;
+
+                       /* check for child table */
+                       if ((cid1 & 0xf0) == 0x10) {
+                               if (dap_lookup_cs_component(dap, ap, 
component_base, type, addr) == ERROR_OK) {
+                                       found = ERROR_OK;
+                                       break;
+                               }
+                               continue;
+                       }
+
+                       /* read MEMTYPE register */
                        retval = mem_ap_read_atomic_u32(dap,
                                        (component_base & 0xfffff000) | 0xfcc,
                                        &devtype);
@@ -1311,7 +1329,7 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
                                return retval;
                        if ((devtype & 0xff) == type) {
                                *addr = component_base;
-                               retval = ERROR_OK;
+                               found = ERROR_OK;
                                break;
                        }
                }
@@ -1320,7 +1338,7 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
 
        dap_ap_select(dap, ap_old);
 
-       return retval;
+       return found;
 }
 
 static int dap_info_command(struct command_context *cmd_ctx,

-- 

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to