adiv6: stay in same AP during dap_lookup_cs_component() 26/6826/3
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 23 Jan 2022 00:25:45 +0000 (01:25 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 24 Jun 2022 21:39:16 +0000 (21:39 +0000)
Configuration file can specify, as target's debug AP, an AP that
contains a ROM table that points, in turn, to other APs.
Current code in cortex_a and aarch64 is not able to handle a
return from dap_lookup_cs_component() that points to another AP.

While it could be interesting to specify 'root' as target's debug
AP, drop any found value if it's not in the starting AP.

Change-Id: Id206e4fa7a29e9402c8e2393026817b410bbb8bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6826
Tested-by: jenkins
src/target/arm_adi_v5.c

index 84518b0a10199e856ddcb73a204fe0d12e2e7c8c..01adbeff76b739e0dcedf105f8dde8a129bf4dce 100644 (file)
@@ -2124,6 +2124,7 @@ struct dap_lookup_data {
        unsigned int type;
        /* output */
        uint64_t component_base;
+       uint64_t ap_num;
 };
 
 static int dap_lookup_cs_component_cs_component(int retval,
@@ -2152,6 +2153,7 @@ static int dap_lookup_cs_component_cs_component(int retval,
 
        /* Found! */
        lookup->component_base = v->component_base;
+       lookup->ap_num = v->ap->ap_num;
        return CORESIGHT_COMPONENT_FOUND;
 }
 
@@ -2172,6 +2174,11 @@ int dap_lookup_cs_component(struct adiv5_ap *ap, uint8_t type,
 
        int retval = rtp_ap(&dap_lookup_cs_component_ops, ap, 0);
        if (retval == CORESIGHT_COMPONENT_FOUND) {
+               if (lookup.ap_num != ap->ap_num) {
+                       /* TODO: handle search from root ROM table */
+                       LOG_DEBUG("CS lookup ended in AP # 0x%" PRIx64 ". Ignore it", lookup.ap_num);
+                       return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
+               }
                LOG_DEBUG("CS lookup found at 0x%" PRIx64, lookup.component_base);
                *addr = lookup.component_base;
                return ERROR_OK;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)