Skip to content

Commit

Permalink
adiv5: add aditional ap type check to ensure the class matches
Browse files Browse the repository at this point in the history
  • Loading branch information
perigoso committed Aug 18, 2023
1 parent 58a3a2c commit 3aa045a
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions src/target/adiv5.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,32 +279,36 @@ static const char *adiv5_arm_ap_type_string(const uint8_t ap_type, const uint8_t
* table C1-2 "AP Identification types for an AP designed by Arm"
*/

switch (ap_type) {
case 0x1U:
return "AHB3-AP";
case 0x2U:
return "APB2/3-AP";
/* 0x3 is not defined */
case 0x4U:
return "AXI3/4-AP";
case 0x5U:
return "AHB5-AP";
case 0x6U:
return "APB4/5-AP";
case 0x7U:
return "AXI5-AP";
case 0x8U:
return "AHB5-AP";
case 0U:
/* Type 0 APs are determined by the class code */
if (ap_class == 0U)
return "JTAG-AP";
if (ap_class == 1U)
return "COM-AP";
/* fall through */
default:
return "Unknown";
/* All types except 0 are only valid for ap_class == 0x8 */
if (ap_class == 0x8U || ap_type == 0U) {
switch (ap_type) {
case 0U:
/* Type 0 APs are determined by the class code */
if (ap_class == 0U)
return "JTAG-AP";
if (ap_class == 1U)
return "COM-AP";
break;
case 0x1U:
return "AHB3-AP";
case 0x2U:
return "APB2/3-AP";
/* 0x3 is not defined */
case 0x4U:
return "AXI3/4-AP";
case 0x5U:
return "AHB5-AP";
case 0x6U:
return "APB4/5-AP";
case 0x7U:
return "AXI5-AP";
case 0x8U:
return "AHB5-AP";
default:
break;
}
}
return "Unknown";
}

static const char *adiv5_cid_class_string(const cid_class_e cid_class)
Expand Down

0 comments on commit 3aa045a

Please sign in to comment.