arm_coresight: add include file and use it
[openocd.git] / src / target / arm_coresight.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /*
4 * General info from:
5 * ARM CoreSight Architecture Specification v3.0 IHI0029E
6 */
7
8 #ifndef OPENOCD_TARGET_ARM_CORESIGHT_H
9 #define OPENOCD_TARGET_ARM_CORESIGHT_H
10
11 #include <stdbool.h>
12 #include <stdint.h>
13
14 #include <src/helper/bits.h>
15
16 #define ARM_CS_ALIGN (0x1000)
17
18 /* mandatory registers */
19 #define ARM_CS_PIDR0 (0xFE0)
20 #define ARM_CS_PIDR1 (0xFE4)
21 #define ARM_CS_PIDR2 (0xFE8)
22 #define ARM_CS_PIDR3 (0xFEC)
23 #define ARM_CS_PIDR4 (0xFD0)
24 #define ARM_CS_PIDR5 (0xFD4)
25 #define ARM_CS_PIDR6 (0xFD8)
26 #define ARM_CS_PIDR7 (0xFDC)
27
28 /*
29 * When PIDR bit JEDEC is zero, only the lowers 7 bits of DESIGNER are valid
30 * and represent a legacy ASCII Identity Code.
31 */
32 #define ARM_CS_PIDR_PART(pidr) ((pidr) & 0x0FFF)
33 #define ARM_CS_PIDR_DESIGNER(pidr) \
34 ({ \
35 typeof(pidr) _x = (pidr); \
36 ((_x >> 25) & 0x780) | ((_x >> 12) & 0x7F); \
37 })
38 #define ARM_CS_PIDR_JEDEC BIT(19)
39 #define ARM_CS_PIDR_SIZE(pidr) (((pidr) >> 36) & 0x000F)
40
41 #define ARM_CS_CIDR0 (0xFF0)
42 #define ARM_CS_CIDR1 (0xFF4)
43 #define ARM_CS_CIDR2 (0xFF8)
44 #define ARM_CS_CIDR3 (0xFFC)
45
46 #define ARM_CS_CIDR_CLASS_MASK (0x0000F000)
47 #define ARM_CS_CIDR_CLASS_SHIFT (12)
48 #define ARM_CS_CLASS_0X1_ROM_TABLE (0x1)
49 #define ARM_CS_CLASS_0X9_CS_COMPONENT (0x9)
50
51 #define ARM_CS_CIDR1_CLASS_MASK (0x000000F0)
52 #define ARM_CS_CIDR1_CLASS_SHIFT (4)
53
54 static inline bool is_valid_arm_cs_cidr(uint32_t cidr)
55 {
56 return (cidr & ~ARM_CS_CIDR_CLASS_MASK) == 0xB105000D;
57 }
58
59 /* Class 0x9 only registers */
60 #define ARM_CS_C9_DEVARCH (0xFBC)
61
62 #define ARM_CS_C9_DEVARCH_ARCHID_MASK (0x0000FFFF)
63 #define ARM_CS_C9_DEVARCH_ARCHID_SHIFT (0)
64 #define ARM_CS_C9_DEVARCH_REVISION_MASK (0x000F0000)
65 #define ARM_CS_C9_DEVARCH_REVISION_SHIFT (16)
66 #define ARM_CS_C9_DEVARCH_PRESENT BIT(20)
67 #define ARM_CS_C9_DEVARCH_ARCHITECT_MASK (0xFFE00000)
68 #define ARM_CS_C9_DEVARCH_ARCHITECT_SHIFT (21)
69
70 #define ARM_CS_C9_DEVID (0xFC8)
71
72 #define ARM_CS_C9_DEVID_FORMAT_MASK (0x0000000F)
73 #define ARM_CS_C9_DEVID_FORMAT_32BIT (0)
74 #define ARM_CS_C9_DEVID_FORMAT_64BIT (1)
75 #define ARM_CS_C9_DEVID_SYSMEM_MASK BIT(4)
76 #define ARM_CS_C9_DEVID_PRR_MASK BIT(5)
77 #define ARM_CS_C9_DEVID_CP_MASK BIT(5)
78
79 #define ARM_CS_C9_DEVTYPE (0xFCC)
80
81 #define ARM_CS_C9_DEVTYPE_MAJOR_MASK (0x0000000F)
82 #define ARM_CS_C9_DEVTYPE_MAJOR_SHIFT (0)
83 #define ARM_CS_C9_DEVTYPE_SUB_MASK (0x000000F0)
84 #define ARM_CS_C9_DEVTYPE_SUB_SHIFT (4)
85
86 #define ARM_CS_C9_DEVTYPE_MASK (0x000000FF)
87 #define ARM_CS_C9_DEVTYPE_CORE_DEBUG (0x00000015)
88
89 /* Class 0x1 only registers */
90 #define ARM_CS_C1_MEMTYPE ARM_CS_C9_DEVTYPE
91
92 #define ARM_CS_C1_MEMTYPE_SYSMEM_MASK BIT(0)
93
94 /* The coding of ROM entry present differs between Class 0x9 and Class 0x1,
95 * but we can simplify the whole management */
96 #define ARM_CS_ROMENTRY_PRESENT BIT(0)
97 #define ARM_CS_ROMENTRY_OFFSET_MASK (0xFFFFF000U)
98
99 #endif /* OPENOCD_TARGET_ARM_CORESIGHT_H */

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)