c9ec02dbbf7c8b2f7324d2abb6172341d13705fd
[openocd.git] / src / target / aarch64.h
1 /***************************************************************************
2 * Copyright (C) 2015 by David Ung *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 ***************************************************************************/
18
19 #ifndef OPENOCD_TARGET_AARCH64_H
20 #define OPENOCD_TARGET_AARCH64_H
21
22 #include "armv8.h"
23
24 #define AARCH64_COMMON_MAGIC 0x411fc082
25
26 #define CPUDBG_CPUID 0xD00
27 #define CPUDBG_CTYPR 0xD04
28 #define CPUDBG_TTYPR 0xD0C
29 #define ID_AA64PFR0_EL1 0xD20
30 #define ID_AA64DFR0_EL1 0xD28
31 #define CPUDBG_LOCKACCESS 0xFB0
32 #define CPUDBG_LOCKSTATUS 0xFB4
33
34 #define BRP_NORMAL 0
35 #define BRP_CONTEXT 1
36
37 #define AARCH64_PADDRDBG_CPU_SHIFT 13
38
39 struct aarch64_brp {
40 int used;
41 int type;
42 target_addr_t value;
43 uint32_t control;
44 uint8_t BRPn;
45 };
46
47 struct aarch64_common {
48 int common_magic;
49
50 /* Context information */
51 uint32_t system_control_reg;
52 uint32_t system_control_reg_curr;
53
54 /* Breakpoint register pairs */
55 int brp_num_context;
56 int brp_num;
57 int brp_num_available;
58 struct aarch64_brp *brp_list;
59
60 struct armv8_common armv8_common;
61 };
62
63 static inline struct aarch64_common *
64 target_to_aarch64(struct target *target)
65 {
66 return container_of(target->arch_info, struct aarch64_common, armv8_common.arm);
67 }
68
69 #endif /* OPENOCD_TARGET_AARCH64_H */