arm_adi_v5: add arm SoC-600 part numbers
[openocd.git] / src / target / arm_adi_v5.c
index f9f4254e818c19c73e805af35024967fbca338de..66d084952d5fa3ae9a36127e58133bf804541792 100644 (file)
@@ -1115,12 +1115,12 @@ static int dap_read_part_id(struct adiv5_ap *ap, target_addr_t component_base, u
 
 #define ANY_ID 0x1000
 
-static const struct {
+static const struct dap_part_nums {
        uint16_t designer_id;
        uint16_t part_num;
        const char *type;
        const char *full;
-} dap_partnums[] = {
+} dap_part_nums[] = {
        { ARM_ID, 0x000, "Cortex-M3 SCS",              "(System Control Space)", },
        { ARM_ID, 0x001, "Cortex-M3 ITM",              "(Instrumentation Trace Module)", },
        { ARM_ID, 0x002, "Cortex-M3 DWT",              "(Data Watchpoint and Trace)", },
@@ -1131,6 +1131,7 @@ static const struct {
        { ARM_ID, 0x00c, "Cortex-M4 SCS",              "(System Control Space)", },
        { ARM_ID, 0x00d, "CoreSight ETM11",            "(Embedded Trace)", },
        { ARM_ID, 0x00e, "Cortex-M7 FPB",              "(Flash Patch and Breakpoint)", },
+       { ARM_ID, 0x193, "SoC-600 TSGEN",              "(Timestamp Generator)", },
        { ARM_ID, 0x470, "Cortex-M1 ROM",              "(ROM Table)", },
        { ARM_ID, 0x471, "Cortex-M0 ROM",              "(ROM Table)", },
        { ARM_ID, 0x490, "Cortex-A15 GIC",             "(Generic Interrupt Controller)", },
@@ -1192,6 +1193,19 @@ static const struct {
        { ARM_ID, 0x9d7, "Cortex-A57 PMU",             "(Performance Monitor Unit)", },
        { ARM_ID, 0x9d8, "Cortex-A72 PMU",             "(Performance Monitor Unit)", },
        { ARM_ID, 0x9da, "Cortex-A35 PMU/CTI/ETM",     "(Performance Monitor Unit/Cross Trigger/ETM)", },
+       { ARM_ID, 0x9e2, "SoC-600 APB-AP",             "(APB4 Memory Access Port)", },
+       { ARM_ID, 0x9e3, "SoC-600 AHB-AP",             "(AHB5 Memory Access Port)", },
+       { ARM_ID, 0x9e4, "SoC-600 AXI-AP",             "(AXI Memory Access Port)", },
+       { ARM_ID, 0x9e5, "SoC-600 APv1 Adapter",       "(Access Port v1 Adapter)", },
+       { ARM_ID, 0x9e6, "SoC-600 JTAG-AP",            "(JTAG Access Port)", },
+       { ARM_ID, 0x9e7, "SoC-600 TPIU",               "(Trace Port Interface Unit)", },
+       { ARM_ID, 0x9e8, "SoC-600 TMC ETR/ETS",        "(Embedded Trace Router/Streamer)", },
+       { ARM_ID, 0x9e9, "SoC-600 TMC ETB",            "(Embedded Trace Buffer)", },
+       { ARM_ID, 0x9ea, "SoC-600 TMC ETF",            "(Embedded Trace FIFO)", },
+       { ARM_ID, 0x9eb, "SoC-600 ATB Funnel",         "(Trace Funnel)", },
+       { ARM_ID, 0x9ec, "SoC-600 ATB Replicator",     "(Trace Replicator)", },
+       { ARM_ID, 0x9ed, "SoC-600 CTI",                "(Cross Trigger)", },
+       { ARM_ID, 0x9ee, "SoC-600 CATU",               "(Address Translation Unit)", },
        { ARM_ID, 0xc05, "Cortex-A5 Debug",            "(Debug Unit)", },
        { ARM_ID, 0xc07, "Cortex-A7 Debug",            "(Debug Unit)", },
        { ARM_ID, 0xc08, "Cortex-A8 Debug",            "(Debug Unit)", },
@@ -1227,6 +1241,22 @@ static const struct {
        { ANY_ID, 0x343, "TI DAPCTL",                  "", }, /* from OMAP3 memmap */
 };
 
+static const struct dap_part_nums *pidr_to_part_num(unsigned int designer_id, unsigned int part_num)
+{
+       static const struct dap_part_nums unknown = {
+               .type = "Unrecognized",
+               .full = "",
+       };
+
+       for (unsigned int i = 0; i < ARRAY_SIZE(dap_part_nums); i++) {
+               if (dap_part_nums[i].designer_id != designer_id && dap_part_nums[i].designer_id != ANY_ID)
+                       continue;
+               if (dap_part_nums[i].part_num == part_num)
+                       return &dap_part_nums[i];
+       }
+       return &unknown;
+}
+
 static int dap_devtype_display(struct command_invocation *cmd, uint32_t devtype)
 {
        const char *major = "Reserved", *subtype = "Reserved";
@@ -1408,41 +1438,24 @@ static int dap_rom_display(struct command_invocation *cmd,
 
        command_print(cmd, "\t\tPeripheral ID 0x%010" PRIx64, pid);
 
-       uint8_t class = (cid & ARM_CS_CIDR_CLASS_MASK) >> ARM_CS_CIDR_CLASS_SHIFT;
-       uint16_t part_num = ARM_CS_PIDR_PART(pid);
-       uint16_t designer_id = ARM_CS_PIDR_DESIGNER(pid);
+       const unsigned int class = (cid & ARM_CS_CIDR_CLASS_MASK) >> ARM_CS_CIDR_CLASS_SHIFT;
+       const unsigned int part_num = ARM_CS_PIDR_PART(pid);
+       unsigned int designer_id = ARM_CS_PIDR_DESIGNER(pid);
 
        if (pid & ARM_CS_PIDR_JEDEC) {
                /* JEP106 code */
-               command_print(cmd, "\t\tDesigner is 0x%03" PRIx16 ", %s",
+               command_print(cmd, "\t\tDesigner is 0x%03x, %s",
                                designer_id, jep106_manufacturer(designer_id));
        } else {
                /* Legacy ASCII ID, clear invalid bits */
                designer_id &= 0x7f;
-               command_print(cmd, "\t\tDesigner ASCII code 0x%02" PRIx16 ", %s",
+               command_print(cmd, "\t\tDesigner ASCII code 0x%02x, %s",
                                designer_id, designer_id == 0x41 ? "ARM" : "<unknown>");
        }
 
-       /* default values to be overwritten upon finding a match */
-       const char *type = "Unrecognized";
-       const char *full = "";
-
-       /* search dap_partnums[] array for a match */
-       for (unsigned entry = 0; entry < ARRAY_SIZE(dap_partnums); entry++) {
-
-               if ((dap_partnums[entry].designer_id != designer_id) && (dap_partnums[entry].designer_id != ANY_ID))
-                       continue;
-
-               if (dap_partnums[entry].part_num != part_num)
-                       continue;
-
-               type = dap_partnums[entry].type;
-               full = dap_partnums[entry].full;
-               break;
-       }
-
-       command_print(cmd, "\t\tPart is 0x%" PRIx16", %s %s", part_num, type, full);
-       command_print(cmd, "\t\tComponent class is 0x%" PRIx8 ", %s", class, class_description[class]);
+       const struct dap_part_nums *partnum = pidr_to_part_num(designer_id, part_num);
+       command_print(cmd, "\t\tPart is 0x%03x, %s %s", part_num, partnum->type, partnum->full);
+       command_print(cmd, "\t\tComponent class is 0x%x, %s", class, class_description[class]);
 
        if (class == ARM_CS_CLASS_0X1_ROM_TABLE) {
                uint32_t memtype;

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)