12800cd8eSLawrence Tang #ifndef CPER_SECTION_ARM_H
22800cd8eSLawrence Tang #define CPER_SECTION_ARM_H
32800cd8eSLawrence Tang 
45202bbb4SLawrence Tang #include <json.h>
52800cd8eSLawrence Tang #include "../edk/Cper.h"
62800cd8eSLawrence Tang 
7f8fc7052SJohn Chung #define ARM_ERROR_VALID_BITFIELD_NAMES                                         \
8f8fc7052SJohn Chung 	(const char *[])                                                       \
9f8fc7052SJohn Chung 	{                                                                      \
10f8fc7052SJohn Chung 		"mpidrValid", "errorAffinityLevelValid", "runningStateValid",  \
11f8fc7052SJohn Chung 			"vendorSpecificInfoValid"                              \
12f8fc7052SJohn Chung 	}
13f8fc7052SJohn Chung #define ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES                              \
14f8fc7052SJohn Chung 	(const char *[])                                                       \
15f8fc7052SJohn Chung 	{                                                                      \
16f8fc7052SJohn Chung 		"multipleErrorValid", "flagsValid", "errorInformationValid",   \
17f8fc7052SJohn Chung 			"virtualFaultAddressValid",                            \
18f8fc7052SJohn Chung 			"physicalFaultAddressValid"                            \
19f8fc7052SJohn Chung 	}
20f8fc7052SJohn Chung #define ARM_ERROR_INFO_ENTRY_FLAGS_NAMES                                       \
21f8fc7052SJohn Chung 	(const char *[])                                                       \
22f8fc7052SJohn Chung 	{                                                                      \
23f8fc7052SJohn Chung 		"firstErrorCaptured", "lastErrorCaptured", "propagated",       \
24f8fc7052SJohn Chung 			"overflow"                                             \
25f8fc7052SJohn Chung 	}
26f8fc7052SJohn Chung #define ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES                               \
27f8fc7052SJohn Chung 	(const char *[])                                                       \
28f8fc7052SJohn Chung 	{                                                                      \
29f8fc7052SJohn Chung 		"transactionTypeValid", "operationValid", "levelValid",        \
30f8fc7052SJohn Chung 			"processorContextCorruptValid", "correctedValid",      \
31f8fc7052SJohn Chung 			"precisePCValid", "restartablePCValid"                 \
32f8fc7052SJohn Chung 	}
33f8fc7052SJohn Chung #define ARM_BUS_ERROR_VALID_BITFIELD_NAMES                                     \
34f8fc7052SJohn Chung 	(const char *[])                                                       \
35f8fc7052SJohn Chung 	{                                                                      \
36f8fc7052SJohn Chung 		"transactionTypeValid", "operationValid", "levelValid",        \
37f8fc7052SJohn Chung 			"processorContextCorruptValid", "correctedValid",      \
38f8fc7052SJohn Chung 			"precisePCValid", "restartablePCValid",                \
39f8fc7052SJohn Chung 			"participationTypeValid", "timedOutValid",             \
40f8fc7052SJohn Chung 			"addressSpaceValid", "memoryAttributesValid",          \
41f8fc7052SJohn Chung 			"accessModeValid"                                      \
42f8fc7052SJohn Chung 	}
43f8fc7052SJohn Chung #define ARM_ERROR_TRANSACTION_TYPES_KEYS                                       \
44f8fc7052SJohn Chung 	(int[])                                                                \
45f8fc7052SJohn Chung 	{                                                                      \
46f8fc7052SJohn Chung 		0, 1, 2                                                        \
47f8fc7052SJohn Chung 	}
48f8fc7052SJohn Chung #define ARM_ERROR_TRANSACTION_TYPES_VALUES                                     \
49f8fc7052SJohn Chung 	(const char *[])                                                       \
50f8fc7052SJohn Chung 	{                                                                      \
51f8fc7052SJohn Chung 		"Instruction", "Data Access", "Generic"                        \
52f8fc7052SJohn Chung 	}
53f8fc7052SJohn Chung #define ARM_ERROR_INFO_ENTRY_INFO_TYPES_KEYS                                   \
54f8fc7052SJohn Chung 	(int[])                                                                \
55f8fc7052SJohn Chung 	{                                                                      \
56f8fc7052SJohn Chung 		0, 1, 2, 3                                                     \
57f8fc7052SJohn Chung 	}
58f8fc7052SJohn Chung #define ARM_ERROR_INFO_ENTRY_INFO_TYPES_VALUES                                 \
59f8fc7052SJohn Chung 	(const char *[])                                                       \
60f8fc7052SJohn Chung 	{                                                                      \
61f8fc7052SJohn Chung 		"Cache Error", "TLB Error", "Bus Error",                       \
62f8fc7052SJohn Chung 			"Micro-Architectural Error"                            \
63f8fc7052SJohn Chung 	}
64f8fc7052SJohn Chung #define ARM_CACHE_BUS_OPERATION_TYPES_KEYS                                     \
65f8fc7052SJohn Chung 	(int[])                                                                \
66f8fc7052SJohn Chung 	{                                                                      \
67f8fc7052SJohn Chung 		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10                               \
68f8fc7052SJohn Chung 	}
69f8fc7052SJohn Chung #define ARM_CACHE_BUS_OPERATION_TYPES_VALUES                                   \
70f8fc7052SJohn Chung 	(const char *[])                                                       \
71f8fc7052SJohn Chung 	{                                                                      \
72f8fc7052SJohn Chung 		"Generic Error", "Generic Read", "Generic Write", "Data Read", \
73f8fc7052SJohn Chung 			"Data Write", "Instruction Fetch", "Prefetch",         \
74f8fc7052SJohn Chung 			"Eviction", "Snooping", "Snooped", "Management"        \
75f8fc7052SJohn Chung 	}
76f8fc7052SJohn Chung #define ARM_TLB_OPERATION_TYPES_KEYS                                           \
77f8fc7052SJohn Chung 	(int[])                                                                \
78f8fc7052SJohn Chung 	{                                                                      \
79f8fc7052SJohn Chung 		0, 1, 2, 3, 4, 5, 6, 7, 8                                      \
80f8fc7052SJohn Chung 	}
81f8fc7052SJohn Chung #define ARM_TLB_OPERATION_TYPES_VALUES                                         \
82f8fc7052SJohn Chung 	(const char *[])                                                       \
83f8fc7052SJohn Chung 	{                                                                      \
84f8fc7052SJohn Chung 		"Generic Error", "Generic Read", "Generic Write", "Data Read", \
85f8fc7052SJohn Chung 			"Data Write", "Instruction Fetch", "Prefetch",         \
86f8fc7052SJohn Chung 			"Local Management Operation",                          \
87f8fc7052SJohn Chung 			"External Management Operation"                        \
88f8fc7052SJohn Chung 	}
89f8fc7052SJohn Chung #define ARM_BUS_PARTICIPATION_TYPES_KEYS                                       \
90f8fc7052SJohn Chung 	(int[])                                                                \
91f8fc7052SJohn Chung 	{                                                                      \
92f8fc7052SJohn Chung 		0, 1, 2, 3                                                     \
93f8fc7052SJohn Chung 	}
94f8fc7052SJohn Chung #define ARM_BUS_PARTICIPATION_TYPES_VALUES                                     \
95f8fc7052SJohn Chung 	(const char *[])                                                       \
96f8fc7052SJohn Chung 	{                                                                      \
97f8fc7052SJohn Chung 		"Local Processor Originated Request",                          \
98f8fc7052SJohn Chung 			"Local Processor Responded to Request",                \
99f8fc7052SJohn Chung 			"Local Processor Observed", "Generic"                  \
100f8fc7052SJohn Chung 	}
101f8fc7052SJohn Chung #define ARM_BUS_ADDRESS_SPACE_TYPES_KEYS                                       \
102f8fc7052SJohn Chung 	(int[])                                                                \
103f8fc7052SJohn Chung 	{                                                                      \
104f8fc7052SJohn Chung 		0, 1, 3                                                        \
105f8fc7052SJohn Chung 	}
106f8fc7052SJohn Chung #define ARM_BUS_ADDRESS_SPACE_TYPES_VALUES                                     \
107f8fc7052SJohn Chung 	(const char *[])                                                       \
108f8fc7052SJohn Chung 	{                                                                      \
109f8fc7052SJohn Chung 		"External Memory Access", "Internal Memory Access",            \
110f8fc7052SJohn Chung 			"Device Memory Access"                                 \
111f8fc7052SJohn Chung 	}
112f8fc7052SJohn Chung #define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_KEYS                         \
113f8fc7052SJohn Chung 	(int[])                                                                \
114f8fc7052SJohn Chung 	{                                                                      \
115f8fc7052SJohn Chung 		0, 1, 2, 3, 4, 5, 6, 7, 8                                      \
116f8fc7052SJohn Chung 	}
117f8fc7052SJohn Chung #define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_VALUES                       \
118f8fc7052SJohn Chung 	(const char *[])                                                       \
119f8fc7052SJohn Chung 	{                                                                      \
120f8fc7052SJohn Chung 		"AArch32 General Purpose Registers",                           \
121f8fc7052SJohn Chung 			"AArch32 EL1 Context Registers",                       \
122f8fc7052SJohn Chung 			"AArch32 EL2 Context Registers",                       \
123f8fc7052SJohn Chung 			"AArch32 Secure Context Registers",                    \
124f8fc7052SJohn Chung 			"AArch64 General Purpose Registers",                   \
125f8fc7052SJohn Chung 			"AArch64 EL1 Context Registers",                       \
126f8fc7052SJohn Chung 			"AArch64 EL2 Context Registers",                       \
127f8fc7052SJohn Chung 			"AArch64 EL3 Context Registers",                       \
128f8fc7052SJohn Chung 			"Miscellaneous System Register Structure"              \
129f8fc7052SJohn Chung 	}
130f8fc7052SJohn Chung #define ARM_AARCH32_GPR_NAMES                                                  \
131f8fc7052SJohn Chung 	(const char *[])                                                       \
132f8fc7052SJohn Chung 	{                                                                      \
133f8fc7052SJohn Chung 		"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",    \
134f8fc7052SJohn Chung 			"r10", "r11", "r12", "r13_sp", "r14_lr", "r15_pc"      \
135f8fc7052SJohn Chung 	}
136f8fc7052SJohn Chung #define ARM_AARCH32_EL1_REGISTER_NAMES                                         \
137f8fc7052SJohn Chung 	(const char *[])                                                       \
138f8fc7052SJohn Chung 	{                                                                      \
139f8fc7052SJohn Chung 		"dfar", "dfsr", "ifar", "isr", "mair0", "mair1", "midr",       \
140f8fc7052SJohn Chung 			"mpidr", "nmrr", "prrr", "sctlr_ns", "spsr",           \
141f8fc7052SJohn Chung 			"spsr_abt", "spsr_fiq", "spsr_irq", "spsr_svc",        \
142f8fc7052SJohn Chung 			"spsr_und", "tpidrprw", "tpidruro", "tpidrurw",        \
143f8fc7052SJohn Chung 			"ttbcr", "ttbr0", "ttbr1", "dacr"                      \
144f8fc7052SJohn Chung 	}
145f8fc7052SJohn Chung #define ARM_AARCH32_EL2_REGISTER_NAMES                                         \
146f8fc7052SJohn Chung 	(const char *[])                                                       \
147f8fc7052SJohn Chung 	{                                                                      \
148f8fc7052SJohn Chung 		"elr_hyp", "hamair0", "hamair1", "hcr", "hcr2", "hdfar",       \
149f8fc7052SJohn Chung 			"hifar", "hpfar", "hsr", "htcr", "htpidr", "httbr",    \
150f8fc7052SJohn Chung 			"spsr_hyp", "vtcr", "vttbr", "dacr32_el2"              \
151f8fc7052SJohn Chung 	}
152f8fc7052SJohn Chung #define ARM_AARCH32_SECURE_REGISTER_NAMES                                      \
153f8fc7052SJohn Chung 	(const char *[])                                                       \
154f8fc7052SJohn Chung 	{                                                                      \
155f8fc7052SJohn Chung 		"sctlr_s", "spsr_mon"                                          \
156f8fc7052SJohn Chung 	}
157f8fc7052SJohn Chung #define ARM_AARCH64_GPR_NAMES                                                  \
158f8fc7052SJohn Chung 	(const char *[])                                                       \
159f8fc7052SJohn Chung 	{                                                                      \
160f8fc7052SJohn Chung 		"x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9",    \
161f8fc7052SJohn Chung 			"x10", "x11", "x12", "x13", "x14", "x15", "x16",       \
162f8fc7052SJohn Chung 			"x17", "x18", "x19", "x20", "x21", "x22", "x23",       \
163f8fc7052SJohn Chung 			"x24", "x25", "x26", "x27", "x28", "x29", "x30", "sp"  \
164f8fc7052SJohn Chung 	}
165f8fc7052SJohn Chung #define ARM_AARCH64_EL1_REGISTER_NAMES                                         \
166f8fc7052SJohn Chung 	(const char *[])                                                       \
167f8fc7052SJohn Chung 	{                                                                      \
168f8fc7052SJohn Chung 		"elr_el1", "esr_el1", "far_el1", "isr_el1", "mair_el1",        \
169f8fc7052SJohn Chung 			"midr_el1", "mpidr_el1", "sctlr_el1", "sp_el0",        \
170f8fc7052SJohn Chung 			"sp_el1", "spsr_el1", "tcr_el1", "tpidr_el0",          \
171f8fc7052SJohn Chung 			"tpidr_el1", "tpidrro_el0", "ttbr0_el1", "ttbr1_el1"   \
172f8fc7052SJohn Chung 	}
173f8fc7052SJohn Chung #define ARM_AARCH64_EL2_REGISTER_NAMES                                         \
174f8fc7052SJohn Chung 	(const char *[])                                                       \
175f8fc7052SJohn Chung 	{                                                                      \
176f8fc7052SJohn Chung 		"elr_el2", "esr_el2", "far_el2", "hacr_el2", "hcr_el2",        \
177f8fc7052SJohn Chung 			"hpfar_el2", "mair_el2", "sctlr_el2", "sp_el2",        \
178f8fc7052SJohn Chung 			"spsr_el2", "tcr_el2", "tpidr_el2", "ttbr0_el2",       \
179f8fc7052SJohn Chung 			"vtcr_el2", "vttbr_el2"                                \
180f8fc7052SJohn Chung 	}
181f8fc7052SJohn Chung #define ARM_AARCH64_EL3_REGISTER_NAMES                                         \
182f8fc7052SJohn Chung 	(const char *[])                                                       \
183f8fc7052SJohn Chung 	{                                                                      \
184f8fc7052SJohn Chung 		"elr_el3", "esr_el3", "far_el3", "mair_el3", "sctlr_el3",      \
185f8fc7052SJohn Chung 			"sp_el3", "spsr_el3", "tcr_el3", "tpidr_el3",          \
186f8fc7052SJohn Chung 			"ttbr0_el3"                                            \
187f8fc7052SJohn Chung 	}
1882800cd8eSLawrence Tang 
1894dbe3d72SLawrence Tang ///
1904dbe3d72SLawrence Tang /// ARM Processor Error Record
1914dbe3d72SLawrence Tang ///
1924dbe3d72SLawrence Tang typedef struct {
1934dbe3d72SLawrence Tang 	UINT32 ValidFields;
1944dbe3d72SLawrence Tang 	UINT16 ErrInfoNum;
1954dbe3d72SLawrence Tang 	UINT16 ContextInfoNum;
1964dbe3d72SLawrence Tang 	UINT32 SectionLength;
1974dbe3d72SLawrence Tang 	UINT32 ErrorAffinityLevel;
1984dbe3d72SLawrence Tang 	UINT64 MPIDR_EL1;
1994dbe3d72SLawrence Tang 	UINT64 MIDR_EL1;
2004dbe3d72SLawrence Tang 	UINT32 RunningState;
2014dbe3d72SLawrence Tang 	UINT32 PsciState;
202efe17e2cSLawrence Tang } __attribute__((packed, aligned(1))) EFI_ARM_ERROR_RECORD;
2034dbe3d72SLawrence Tang 
2044dbe3d72SLawrence Tang ///
2054dbe3d72SLawrence Tang /// ARM Processor Error Information Structure
2064dbe3d72SLawrence Tang ///
20771570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_CACHE     0
20871570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_TLB	     1
20971570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_BUS	     2
21071570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_MICROARCH 3
21171570a2aSLawrence Tang 
2124dbe3d72SLawrence Tang typedef struct {
2134dbe3d72SLawrence Tang 	UINT64 ValidationBits : 16;
2144dbe3d72SLawrence Tang 	UINT64 TransactionType : 2;
2154dbe3d72SLawrence Tang 	UINT64 Operation : 4;
2164dbe3d72SLawrence Tang 	UINT64 Level : 3;
2174dbe3d72SLawrence Tang 	UINT64 ProcessorContextCorrupt : 1;
2184dbe3d72SLawrence Tang 	UINT64 Corrected : 1;
2194dbe3d72SLawrence Tang 	UINT64 PrecisePC : 1;
2204dbe3d72SLawrence Tang 	UINT64 RestartablePC : 1;
2214dbe3d72SLawrence Tang 	UINT64 Reserved : 34;
2224dbe3d72SLawrence Tang } EFI_ARM_CACHE_ERROR_STRUCTURE;
2234dbe3d72SLawrence Tang 
2244dbe3d72SLawrence Tang typedef struct {
2254dbe3d72SLawrence Tang 	UINT64 ValidationBits : 16;
2264dbe3d72SLawrence Tang 	UINT64 TransactionType : 2;
2274dbe3d72SLawrence Tang 	UINT64 Operation : 4;
2284dbe3d72SLawrence Tang 	UINT64 Level : 3;
2294dbe3d72SLawrence Tang 	UINT64 ProcessorContextCorrupt : 1;
2304dbe3d72SLawrence Tang 	UINT64 Corrected : 1;
2314dbe3d72SLawrence Tang 	UINT64 PrecisePC : 1;
2324dbe3d72SLawrence Tang 	UINT64 RestartablePC : 1;
2334dbe3d72SLawrence Tang 	UINT64 Reserved : 34;
2344dbe3d72SLawrence Tang } EFI_ARM_TLB_ERROR_STRUCTURE;
2354dbe3d72SLawrence Tang 
2364dbe3d72SLawrence Tang typedef struct {
2374dbe3d72SLawrence Tang 	UINT64 ValidationBits : 16;
2384dbe3d72SLawrence Tang 	UINT64 TransactionType : 2;
2394dbe3d72SLawrence Tang 	UINT64 Operation : 4;
2404dbe3d72SLawrence Tang 	UINT64 Level : 3;
2414dbe3d72SLawrence Tang 	UINT64 ProcessorContextCorrupt : 1;
2424dbe3d72SLawrence Tang 	UINT64 Corrected : 1;
2434dbe3d72SLawrence Tang 	UINT64 PrecisePC : 1;
2444dbe3d72SLawrence Tang 	UINT64 RestartablePC : 1;
2454dbe3d72SLawrence Tang 	UINT64 ParticipationType : 2;
2464dbe3d72SLawrence Tang 	UINT64 TimeOut : 1;
2474dbe3d72SLawrence Tang 	UINT64 AddressSpace : 2;
2484dbe3d72SLawrence Tang 	UINT64 MemoryAddressAttributes : 8;
2494dbe3d72SLawrence Tang 	UINT64 AccessMode : 1;
2504dbe3d72SLawrence Tang 	UINT64 Reserved : 19;
2514dbe3d72SLawrence Tang } EFI_ARM_BUS_ERROR_STRUCTURE;
2524dbe3d72SLawrence Tang 
2534dbe3d72SLawrence Tang typedef union {
254*0b9c9402SJohn Chung 	UINT64 Value;
2554dbe3d72SLawrence Tang 	EFI_ARM_CACHE_ERROR_STRUCTURE CacheError;
2564dbe3d72SLawrence Tang 	EFI_ARM_TLB_ERROR_STRUCTURE TlbError;
2574dbe3d72SLawrence Tang 	EFI_ARM_BUS_ERROR_STRUCTURE BusError;
2584dbe3d72SLawrence Tang } EFI_ARM_ERROR_INFORMATION_STRUCTURE;
2594dbe3d72SLawrence Tang 
2604dbe3d72SLawrence Tang typedef struct {
2614dbe3d72SLawrence Tang 	UINT8 Version;
2624dbe3d72SLawrence Tang 	UINT8 Length;
2634dbe3d72SLawrence Tang 	UINT16 ValidationBits;
2644dbe3d72SLawrence Tang 	UINT8 Type;
2654dbe3d72SLawrence Tang 	UINT16 MultipleError;
2664dbe3d72SLawrence Tang 	UINT8 Flags;
2674dbe3d72SLawrence Tang 	EFI_ARM_ERROR_INFORMATION_STRUCTURE ErrorInformation;
2684dbe3d72SLawrence Tang 	UINT64 VirtualFaultAddress;
2694dbe3d72SLawrence Tang 	UINT64 PhysicalFaultAddress;
27071570a2aSLawrence Tang } __attribute__((packed, aligned(1))) EFI_ARM_ERROR_INFORMATION_ENTRY;
2714dbe3d72SLawrence Tang 
2724dbe3d72SLawrence Tang ///
2734dbe3d72SLawrence Tang /// ARM Processor Context Information Structure
2744dbe3d72SLawrence Tang ///
2754dbe3d72SLawrence Tang typedef struct {
2764dbe3d72SLawrence Tang 	UINT16 Version;
2774dbe3d72SLawrence Tang 	UINT16 RegisterContextType;
2784dbe3d72SLawrence Tang 	UINT32 RegisterArraySize;
279efe17e2cSLawrence Tang } __attribute__((packed, aligned(1))) EFI_ARM_CONTEXT_INFORMATION_HEADER;
2804dbe3d72SLawrence Tang 
2814dbe3d72SLawrence Tang ///
2824dbe3d72SLawrence Tang /// ARM Processor Context Register Types
2834dbe3d72SLawrence Tang ///
2844dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_GPR    0
2854dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_EL1    1
2864dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_EL2    2
2874dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE 3
2884dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_GPR    4
2894dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL1    5
2904dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL2    6
2914dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL3    7
2924dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_MISC	    8
2934dbe3d72SLawrence Tang 
2944dbe3d72SLawrence Tang typedef struct {
2954dbe3d72SLawrence Tang 	UINT32 R0;
2964dbe3d72SLawrence Tang 	UINT32 R1;
2974dbe3d72SLawrence Tang 	UINT32 R2;
2984dbe3d72SLawrence Tang 	UINT32 R3;
2994dbe3d72SLawrence Tang 	UINT32 R4;
3004dbe3d72SLawrence Tang 	UINT32 R5;
3014dbe3d72SLawrence Tang 	UINT32 R6;
3024dbe3d72SLawrence Tang 	UINT32 R7;
3034dbe3d72SLawrence Tang 	UINT32 R8;
3044dbe3d72SLawrence Tang 	UINT32 R9;
3054dbe3d72SLawrence Tang 	UINT32 R10;
3064dbe3d72SLawrence Tang 	UINT32 R11;
3074dbe3d72SLawrence Tang 	UINT32 R12;
3084dbe3d72SLawrence Tang 	UINT32 R13_sp;
3094dbe3d72SLawrence Tang 	UINT32 R14_lr;
3104dbe3d72SLawrence Tang 	UINT32 R15_pc;
3114dbe3d72SLawrence Tang } EFI_ARM_V8_AARCH32_GPR;
3124dbe3d72SLawrence Tang 
3134dbe3d72SLawrence Tang typedef struct {
3144dbe3d72SLawrence Tang 	UINT32 Dfar;
3154dbe3d72SLawrence Tang 	UINT32 Dfsr;
3164dbe3d72SLawrence Tang 	UINT32 Ifar;
3174dbe3d72SLawrence Tang 	UINT32 Isr;
3184dbe3d72SLawrence Tang 	UINT32 Mair0;
3194dbe3d72SLawrence Tang 	UINT32 Mair1;
3204dbe3d72SLawrence Tang 	UINT32 Midr;
3214dbe3d72SLawrence Tang 	UINT32 Mpidr;
3224dbe3d72SLawrence Tang 	UINT32 Nmrr;
3234dbe3d72SLawrence Tang 	UINT32 Prrr;
3244dbe3d72SLawrence Tang 	UINT32 Sctlr_Ns;
3254dbe3d72SLawrence Tang 	UINT32 Spsr;
3264dbe3d72SLawrence Tang 	UINT32 Spsr_Abt;
3274dbe3d72SLawrence Tang 	UINT32 Spsr_Fiq;
3284dbe3d72SLawrence Tang 	UINT32 Spsr_Irq;
3294dbe3d72SLawrence Tang 	UINT32 Spsr_Svc;
3304dbe3d72SLawrence Tang 	UINT32 Spsr_Und;
3314dbe3d72SLawrence Tang 	UINT32 Tpidrprw;
3324dbe3d72SLawrence Tang 	UINT32 Tpidruro;
3334dbe3d72SLawrence Tang 	UINT32 Tpidrurw;
3344dbe3d72SLawrence Tang 	UINT32 Ttbcr;
3354dbe3d72SLawrence Tang 	UINT32 Ttbr0;
3364dbe3d72SLawrence Tang 	UINT32 Ttbr1;
3374dbe3d72SLawrence Tang 	UINT32 Dacr;
3384dbe3d72SLawrence Tang } EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS;
3394dbe3d72SLawrence Tang 
3404dbe3d72SLawrence Tang typedef struct {
3414dbe3d72SLawrence Tang 	UINT32 Elr_Hyp;
3424dbe3d72SLawrence Tang 	UINT32 Hamair0;
3434dbe3d72SLawrence Tang 	UINT32 Hamair1;
3444dbe3d72SLawrence Tang 	UINT32 Hcr;
3454dbe3d72SLawrence Tang 	UINT32 Hcr2;
3464dbe3d72SLawrence Tang 	UINT32 Hdfar;
3474dbe3d72SLawrence Tang 	UINT32 Hifar;
3484dbe3d72SLawrence Tang 	UINT32 Hpfar;
3494dbe3d72SLawrence Tang 	UINT32 Hsr;
3504dbe3d72SLawrence Tang 	UINT32 Htcr;
3514dbe3d72SLawrence Tang 	UINT32 Htpidr;
3524dbe3d72SLawrence Tang 	UINT32 Httbr;
3534dbe3d72SLawrence Tang 	UINT32 Spsr_Hyp;
3544dbe3d72SLawrence Tang 	UINT32 Vtcr;
3554dbe3d72SLawrence Tang 	UINT32 Vttbr;
3564dbe3d72SLawrence Tang 	UINT32 Dacr32_El2;
3574dbe3d72SLawrence Tang } EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS;
3584dbe3d72SLawrence Tang 
3594dbe3d72SLawrence Tang typedef struct {
3604dbe3d72SLawrence Tang 	UINT32 Sctlr_S;
3614dbe3d72SLawrence Tang 	UINT32 Spsr_Mon;
3624dbe3d72SLawrence Tang } EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS;
3634dbe3d72SLawrence Tang 
3644dbe3d72SLawrence Tang typedef struct {
3654dbe3d72SLawrence Tang 	UINT64 X0;
3664dbe3d72SLawrence Tang 	UINT64 X1;
3674dbe3d72SLawrence Tang 	UINT64 X2;
3684dbe3d72SLawrence Tang 	UINT64 X3;
3694dbe3d72SLawrence Tang 	UINT64 X4;
3704dbe3d72SLawrence Tang 	UINT64 X5;
3714dbe3d72SLawrence Tang 	UINT64 X6;
3724dbe3d72SLawrence Tang 	UINT64 X7;
3734dbe3d72SLawrence Tang 	UINT64 X8;
3744dbe3d72SLawrence Tang 	UINT64 X9;
3754dbe3d72SLawrence Tang 	UINT64 X10;
3764dbe3d72SLawrence Tang 	UINT64 X11;
3774dbe3d72SLawrence Tang 	UINT64 X12;
3784dbe3d72SLawrence Tang 	UINT64 X13;
3794dbe3d72SLawrence Tang 	UINT64 X14;
3804dbe3d72SLawrence Tang 	UINT64 X15;
3814dbe3d72SLawrence Tang 	UINT64 X16;
3824dbe3d72SLawrence Tang 	UINT64 X17;
3834dbe3d72SLawrence Tang 	UINT64 X18;
3844dbe3d72SLawrence Tang 	UINT64 X19;
3854dbe3d72SLawrence Tang 	UINT64 X20;
3864dbe3d72SLawrence Tang 	UINT64 X21;
3874dbe3d72SLawrence Tang 	UINT64 X22;
3884dbe3d72SLawrence Tang 	UINT64 X23;
3894dbe3d72SLawrence Tang 	UINT64 X24;
3904dbe3d72SLawrence Tang 	UINT64 X25;
3914dbe3d72SLawrence Tang 	UINT64 X26;
3924dbe3d72SLawrence Tang 	UINT64 X27;
3934dbe3d72SLawrence Tang 	UINT64 X28;
3944dbe3d72SLawrence Tang 	UINT64 X29;
3954dbe3d72SLawrence Tang 	UINT64 X30;
3964dbe3d72SLawrence Tang 	UINT64 Sp;
3974dbe3d72SLawrence Tang } EFI_ARM_V8_AARCH64_GPR;
3984dbe3d72SLawrence Tang 
3994dbe3d72SLawrence Tang typedef struct {
4004dbe3d72SLawrence Tang 	UINT64 Elr_El1;
4014dbe3d72SLawrence Tang 	UINT64 Esr_El1;
4024dbe3d72SLawrence Tang 	UINT64 Far_El1;
4034dbe3d72SLawrence Tang 	UINT64 Isr_El1;
4044dbe3d72SLawrence Tang 	UINT64 Mair_El1;
4054dbe3d72SLawrence Tang 	UINT64 Midr_El1;
4064dbe3d72SLawrence Tang 	UINT64 Mpidr_El1;
4074dbe3d72SLawrence Tang 	UINT64 Sctlr_El1;
4084dbe3d72SLawrence Tang 	UINT64 Sp_El0;
4094dbe3d72SLawrence Tang 	UINT64 Sp_El1;
4104dbe3d72SLawrence Tang 	UINT64 Spsr_El1;
4114dbe3d72SLawrence Tang 	UINT64 Tcr_El1;
4124dbe3d72SLawrence Tang 	UINT64 Tpidr_El0;
4134dbe3d72SLawrence Tang 	UINT64 Tpidr_El1;
4144dbe3d72SLawrence Tang 	UINT64 Tpidrro_El0;
4154dbe3d72SLawrence Tang 	UINT64 Ttbr0_El1;
4164dbe3d72SLawrence Tang 	UINT64 Ttbr1_El1;
4174dbe3d72SLawrence Tang } EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS;
4184dbe3d72SLawrence Tang 
4194dbe3d72SLawrence Tang typedef struct {
4204dbe3d72SLawrence Tang 	UINT64 Elr_El2;
4214dbe3d72SLawrence Tang 	UINT64 Esr_El2;
4224dbe3d72SLawrence Tang 	UINT64 Far_El2;
4234dbe3d72SLawrence Tang 	UINT64 Hacr_El2;
4244dbe3d72SLawrence Tang 	UINT64 Hcr_El2;
4254dbe3d72SLawrence Tang 	UINT64 Hpfar_El2;
4264dbe3d72SLawrence Tang 	UINT64 Mair_El2;
4274dbe3d72SLawrence Tang 	UINT64 Sctlr_El2;
4284dbe3d72SLawrence Tang 	UINT64 Sp_El2;
4294dbe3d72SLawrence Tang 	UINT64 Spsr_El2;
4304dbe3d72SLawrence Tang 	UINT64 Tcr_El2;
4314dbe3d72SLawrence Tang 	UINT64 Tpidr_El2;
4324dbe3d72SLawrence Tang 	UINT64 Ttbr0_El2;
4334dbe3d72SLawrence Tang 	UINT64 Vtcr_El2;
4344dbe3d72SLawrence Tang 	UINT64 Vttbr_El2;
4354dbe3d72SLawrence Tang } EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS;
4364dbe3d72SLawrence Tang 
4374dbe3d72SLawrence Tang typedef struct {
4384dbe3d72SLawrence Tang 	UINT64 Elr_El3;
4394dbe3d72SLawrence Tang 	UINT64 Esr_El3;
4404dbe3d72SLawrence Tang 	UINT64 Far_El3;
4414dbe3d72SLawrence Tang 	UINT64 Mair_El3;
4424dbe3d72SLawrence Tang 	UINT64 Sctlr_El3;
4434dbe3d72SLawrence Tang 	UINT64 Sp_El3;
4444dbe3d72SLawrence Tang 	UINT64 Spsr_El3;
4454dbe3d72SLawrence Tang 	UINT64 Tcr_El3;
4464dbe3d72SLawrence Tang 	UINT64 Tpidr_El3;
4474dbe3d72SLawrence Tang 	UINT64 Ttbr0_El3;
4484dbe3d72SLawrence Tang } EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS;
4494dbe3d72SLawrence Tang 
4504dbe3d72SLawrence Tang typedef struct {
4514dbe3d72SLawrence Tang 	UINT64 MrsOp2 : 3;
4524dbe3d72SLawrence Tang 	UINT64 MrsCrm : 4;
4534dbe3d72SLawrence Tang 	UINT64 MrsCrn : 4;
4544dbe3d72SLawrence Tang 	UINT64 MrsOp1 : 3;
4554dbe3d72SLawrence Tang 	UINT64 MrsO0 : 1;
4564dbe3d72SLawrence Tang 	UINT64 Value : 64;
4574dbe3d72SLawrence Tang } EFI_ARM_MISC_CONTEXT_REGISTER;
4584dbe3d72SLawrence Tang 
459f8fc7052SJohn Chung json_object *cper_section_arm_to_ir(void *section);
4607cd13908SLawrence Tang void ir_section_arm_to_cper(json_object *section, FILE *out);
4612800cd8eSLawrence Tang 
4622800cd8eSLawrence Tang #endif
463