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