aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2022-01-23 01:25:45 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2022-06-24 21:39:16 +0000
commit1842cf69a92d07866ebefee3bc7090a58782b059 (patch)
treeab787f7e42cdf5be3fe46efb316591357ec11a52 /src/target
parent9f0ac0e6bba85ca8afc99b77ce4ec2df96dba2bb (diff)
downloadriscv-openocd-1842cf69a92d07866ebefee3bc7090a58782b059.zip
riscv-openocd-1842cf69a92d07866ebefee3bc7090a58782b059.tar.gz
riscv-openocd-1842cf69a92d07866ebefee3bc7090a58782b059.tar.bz2
adiv6: stay in same AP during dap_lookup_cs_component()
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
Diffstat (limited to 'src/target')
-rw-r--r--src/target/arm_adi_v5.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 84518b0..01adbef 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -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;