This is an automated email from Gerrit. "Daniel Goehring <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9259
-- gerrit commit 8b51fc44bfb7b67d40dfd6dcbd809158179ec9c1 Author: Daniel Goehring <[email protected]> Date: Mon Jul 14 21:06:48 2025 -0600 target/arm: add nested AP DAP 'info' cmd support Add nested AP support to the DAP 'info' command. Change-Id: Ie5f155cb2d1ebe28d0b25b471040866dea24dd05 Signed-off-by: Daniel Goehring <[email protected]> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index cb4a917136..663b18b116 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -2032,7 +2032,12 @@ static int rtp_rom_loop(enum coresight_access_mode mode, const struct rtp_ops *o /* Recurse */ if (mode == CS_ACCESS_AP) { - struct adiv5_ap *next_ap = dap_get_ap(ap->dap, component_base); + struct adiv5_ap *next_ap; + if (!ap->ap_gateway) + next_ap = dap_get_ap(ap->dap, component_base); + else + next_ap = dap_get_ap_gateway(ap->dap, component_base, ap->ap_gateway->ap_num); + if (!next_ap) { LOG_DEBUG("Wrong AP # 0x%" PRIx64, component_base); continue; @@ -2180,7 +2185,11 @@ static int dap_info_ap_header(struct adiv5_ap *ap, int depth, void *priv) return ERROR_FAIL; } - command_print(cmd, "%sAP # 0x%" PRIx64, (depth) ? "\t\t" : "", ap->ap_num); + if (!ap->ap_gateway) + command_print(cmd, "%sAP # 0x%" PRIx64, (depth) ? "\t\t" : "", ap->ap_num); + else + command_print(cmd, "%sAP # 0x%" PRIx64 ", GW # 0x%" PRIx64, (depth) ? "\t\t" : "", + ap->ap_num, ap->ap_gateway->ap_num); return ERROR_OK; } @@ -2206,7 +2215,11 @@ static int dap_info_mem_ap_header(int retval, struct adiv5_ap *ap, command_print(cmd, "\t\tAP ID register 0x%8.8" PRIx32, apid); if (apid == 0) { - command_print(cmd, "\t\tNo AP found at this AP#0x%" PRIx64, ap->ap_num); + if (!ap->ap_gateway) + command_print(cmd, "\t\tNo AP found at this AP#0x%" PRIx64, ap->ap_num); + else + command_print(cmd, "\t\tNo AP found at this AP#0x%" PRIx64 " GW#0x%" PRIx64, + ap->ap_num, ap->ap_gateway->ap_num); return ERROR_FAIL; } @@ -2665,11 +2678,14 @@ int adiv5_mem_ap_spot_init(struct adiv5_mem_ap_spot *p) COMMAND_HANDLER(handle_dap_info_command) { struct adiv5_dap *dap = adiv5_get_dap(CMD_DATA); + struct adiv5_ap *ap; uint64_t apsel; + uint64_t apsel_gateway = DP_APSEL_INVALID; switch (CMD_ARGC) { case 0: apsel = dap->apsel; + apsel_gateway = dap->apsel_gateway; break; case 1: if (!strcmp(CMD_ARGV[0], "root")) { @@ -2690,11 +2706,27 @@ COMMAND_HANDLER(handle_dap_info_command) return ERROR_COMMAND_ARGUMENT_INVALID; } break; + case 2: + COMMAND_PARSE_NUMBER(u64, CMD_ARGV[0], apsel); + if (!is_ap_num_valid(dap, apsel)) { + command_print(CMD, "Invalid AP number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } + COMMAND_PARSE_NUMBER(u64, CMD_ARGV[1], apsel_gateway); + if (!is_ap_num_valid(dap, apsel_gateway)) { + command_print(CMD, "Invalid AP_GATEWAY number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } + break; default: return ERROR_COMMAND_SYNTAX_ERROR; } - struct adiv5_ap *ap = dap_get_ap(dap, apsel); + if (apsel_gateway == DP_APSEL_INVALID) + ap = dap_get_ap(dap, apsel); + else + ap = dap_get_ap_gateway(dap, apsel, apsel_gateway); + if (!ap) { command_print(CMD, "Cannot get AP"); return ERROR_FAIL; @@ -3237,7 +3269,7 @@ const struct command_registration dap_instance_commands[] = { .mode = COMMAND_EXEC, .help = "display ROM table for specified MEM-AP (default currently selected AP) " "or the ADIv6 root ROM table", - .usage = "[ap_num | 'root']", + .usage = "[ap_num [ap_num_gateway] | 'root']", }, { .name = "apsel", --
