12800cd8eSLawrence Tang #ifndef CPER_SECTION_ARM_H
22800cd8eSLawrence Tang #define CPER_SECTION_ARM_H
32800cd8eSLawrence Tang 
42800cd8eSLawrence Tang #include "json.h"
52800cd8eSLawrence Tang #include "../edk/Cper.h"
62800cd8eSLawrence Tang 
77f21db6cSLawrence Tang #define ARM_ERROR_VALID_BITFIELD_NAMES (const char*[]) \
82800cd8eSLawrence Tang     {"mpidrValid", "errorAffinityLevelValid", "runningStateValid", "vendorSpecificInfoValid"}
97f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES (const char*[]) \
103d0e4f24SLawrence Tang     {"multipleErrorValid", "flagsValid", "errorInformationValid", "virtualFaultAddressValid", "physicalFaultAddressValid"}
117f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_FLAGS_NAMES (const char*[]) \
123d0e4f24SLawrence Tang     {"firstErrorCaptured", "lastErrorCaptured", "propagated", "overflow"}
137f21db6cSLawrence Tang #define ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES (const char*[]) \
147f21db6cSLawrence Tang     {"transactionTypeValid", "operationValid", "levelValid", "processorContextCorruptValid", "correctedValid", \
157f21db6cSLawrence Tang     "precisePCValid", "restartablePCValid"}
167f21db6cSLawrence Tang #define ARM_BUS_ERROR_VALID_BITFIELD_NAMES (const char*[]) \
177f21db6cSLawrence Tang     {"transactionTypeValid", "operationValid", "levelValid", "processorContextCorruptValid", "correctedValid", \
183636d3c2SLawrence Tang     "precisePCValid", "restartablePCValid", "participationTypeValid", "timedOutValid", "addressSpaceValid", \
197f21db6cSLawrence Tang     "memoryAttributesValid", "accessModeValid"}
207f21db6cSLawrence Tang #define ARM_ERROR_TRANSACTION_TYPES_KEYS (int []){0, 1, 2}
217f21db6cSLawrence Tang #define ARM_ERROR_TRANSACTION_TYPES_VALUES (const char*[]){"Instruction", "Data Access", "Generic"}
227f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_INFO_TYPES_KEYS (int []){0, 1, 2, 3}
237f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_INFO_TYPES_VALUES (const char*[]){"Cache Error", "TLB Error", \
243d0e4f24SLawrence Tang     "Bus Error", "Micro-Architectural Error"}
257f21db6cSLawrence Tang #define ARM_CACHE_BUS_OPERATION_TYPES_KEYS (int []){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
267f21db6cSLawrence Tang #define ARM_CACHE_BUS_OPERATION_TYPES_VALUES (const char*[]){"Generic Error", "Generic Read", "Generic Write", \
277f21db6cSLawrence Tang     "Data Read", "Data Write", "Instruction Fetch", "Prefetch", "Eviction", "Snooping", "Snooped", "Management"}
287f21db6cSLawrence Tang #define ARM_TLB_OPERATION_TYPES_KEYS (int []){0, 1, 2, 3, 4, 5, 6, 7, 8}
297f21db6cSLawrence Tang #define ARM_TLB_OPERATION_TYPES_VALUES (const char*[]){"Generic Error", "Generic Read", "Generic Write", \
307f21db6cSLawrence Tang     "Data Read", "Data Write", "Instruction Fetch", "Prefetch", "Local Management Operation", \
317f21db6cSLawrence Tang     "External Management Operation"}
327f21db6cSLawrence Tang #define ARM_BUS_PARTICIPATION_TYPES_KEYS (int []){0, 1, 2, 3}
337f21db6cSLawrence Tang #define ARM_BUS_PARTICIPATION_TYPES_VALUES (const char*[]){"Local Processor Originated Request", \
347f21db6cSLawrence Tang     "Local Processor Responded to Request", "Local Processor Observed", "Generic"}
357f21db6cSLawrence Tang #define ARM_BUS_ADDRESS_SPACE_TYPES_KEYS (int []){0, 1, 3}
367f21db6cSLawrence Tang #define ARM_BUS_ADDRESS_SPACE_TYPES_VALUES (const char*[]){"External Memory Access", "Internal Memory Access", \
377f21db6cSLawrence Tang     "Device Memory Access"}
387f21db6cSLawrence Tang #define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_KEYS (int []){0, 1, 2, 3, 4, 5, 6, 7, 8}
397f21db6cSLawrence Tang #define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_VALUES (const char*[]){"AArch32 General Purpose Registers", \
407f21db6cSLawrence Tang     "AArch32 EL1 Context Registers", "AArch32 EL2 Context Registers", "AArch32 Secure Context Registers" \
417f21db6cSLawrence Tang     "AArch64 General Purpose Registers", "AArch64 EL1 Context Registers", "AArch64 EL2 Context Registers" \
427f21db6cSLawrence Tang     "AArch64 EL3 Context Registers", "Miscellaneous System Register Structure"}
437f21db6cSLawrence Tang #define ARM_AARCH32_GPR_NAMES (const char*[]){"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
447f21db6cSLawrence Tang     "r10", "r11", "r12", "r13_sp", "r14_lr", "r15_pc"}
457f21db6cSLawrence Tang #define ARM_AARCH32_EL1_REGISTER_NAMES (const char*[]){"dfar", "dfsr", "ifar", "isr", "mair0", "mair1", "midr", \
467f21db6cSLawrence Tang     "mpidr", "nmrr", "prrr", "sctlr_ns", "spsr", "spsr_abt", "spsr_fiq", "spsr_irq", "spsr_svc", "spsr_und", \
477f21db6cSLawrence Tang     "tpidrprw", "tpidruro", "tpidrurw", "ttbcr", "ttbr0", "ttbr1", "dacr"}
487f21db6cSLawrence Tang #define ARM_AARCH32_EL2_REGISTER_NAMES (const char*[]){"elr_hyp", "hamair0", "hamair1", "hcr", "hcr2", "hdfar", \
497f21db6cSLawrence Tang     "hifar", "hpfar", "hsr", "htcr", "htpidr", "httbr", "spsr_hyp", "vtcr", "vttbr", "dacr32_el2"}
507f21db6cSLawrence Tang #define ARM_AARCH32_SECURE_REGISTER_NAMES (const char*[]){"sctlr_s", "spsr_mon"}
517f21db6cSLawrence Tang #define ARM_AARCH64_GPR_NAMES (const char*[]){"x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10" \
527f21db6cSLawrence Tang     "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26" \
537f21db6cSLawrence Tang     "x27", "x28", "x29", "x30", "sp"}
547f21db6cSLawrence Tang #define ARM_AARCH64_EL1_REGISTER_NAMES (const char*[]){"elr_el1", "esr_el1", "far_el1", "isr_el1", "mair_el1", \
557f21db6cSLawrence Tang     "midr_el1", "mpidr_el1", "sctlr_el1", "sp_el0", "sp_el1", "spsr_el1", "tcr_el1", "tpidr_el0", "tpidr_el1", \
567f21db6cSLawrence Tang     "tpidrro_el0", "ttbr0_el1", "ttbr1_el1"}
577f21db6cSLawrence Tang #define ARM_AARCH64_EL2_REGISTER_NAMES (const char*[]){"elr_el2", "esr_el2", "far_el2", "hacr_el2", "hcr_el2", \
587f21db6cSLawrence Tang     "hpfar_el2", "mair_el2", "sctlr_el2", "sp_el2", "spsr_el2", "tcr_el2", "tpidr_el2", "ttbr0_el2", "vtcr_el2", \
597f21db6cSLawrence Tang     "vttbr_el2"}
607f21db6cSLawrence Tang #define ARM_AARCH64_EL3_REGISTER_NAMES (const char*[]){"elr_el3", "esr_el3", "far_el3", "mair_el3", "sctlr_el3", \
617f21db6cSLawrence Tang     "sp_el3", "spsr_el3", "tcr_el3", "tpidr_el3", "ttbr0_el3"}
622800cd8eSLawrence Tang 
634dbe3d72SLawrence Tang ///
644dbe3d72SLawrence Tang /// ARM Processor Error Record
654dbe3d72SLawrence Tang ///
664dbe3d72SLawrence Tang typedef struct {
674dbe3d72SLawrence Tang   UINT32    ValidFields;
684dbe3d72SLawrence Tang   UINT16    ErrInfoNum;
694dbe3d72SLawrence Tang   UINT16    ContextInfoNum;
704dbe3d72SLawrence Tang   UINT32    SectionLength;
714dbe3d72SLawrence Tang   UINT32  ErrorAffinityLevel;
724dbe3d72SLawrence Tang   UINT64  MPIDR_EL1;
734dbe3d72SLawrence Tang   UINT64  MIDR_EL1;
744dbe3d72SLawrence Tang   UINT32 RunningState;
754dbe3d72SLawrence Tang   UINT32 PsciState;
764dbe3d72SLawrence Tang } EFI_ARM_ERROR_RECORD;
774dbe3d72SLawrence Tang 
784dbe3d72SLawrence Tang ///
794dbe3d72SLawrence Tang /// ARM Processor Error Information Structure
804dbe3d72SLawrence Tang ///
81*71570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_CACHE 0
82*71570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_TLB 1
83*71570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_BUS 2
84*71570a2aSLawrence Tang #define ARM_ERROR_INFORMATION_TYPE_MICROARCH 3
85*71570a2aSLawrence Tang 
864dbe3d72SLawrence Tang typedef struct {
874dbe3d72SLawrence Tang   UINT64 ValidationBits : 16;
884dbe3d72SLawrence Tang   UINT64 TransactionType : 2;
894dbe3d72SLawrence Tang   UINT64 Operation : 4;
904dbe3d72SLawrence Tang   UINT64 Level : 3;
914dbe3d72SLawrence Tang   UINT64 ProcessorContextCorrupt : 1;
924dbe3d72SLawrence Tang   UINT64 Corrected : 1;
934dbe3d72SLawrence Tang   UINT64 PrecisePC : 1;
944dbe3d72SLawrence Tang   UINT64 RestartablePC : 1;
954dbe3d72SLawrence Tang   UINT64 Reserved : 34;
964dbe3d72SLawrence Tang } EFI_ARM_CACHE_ERROR_STRUCTURE;
974dbe3d72SLawrence Tang 
984dbe3d72SLawrence Tang typedef struct {
994dbe3d72SLawrence Tang   UINT64 ValidationBits : 16;
1004dbe3d72SLawrence Tang   UINT64 TransactionType : 2;
1014dbe3d72SLawrence Tang   UINT64 Operation : 4;
1024dbe3d72SLawrence Tang   UINT64 Level : 3;
1034dbe3d72SLawrence Tang   UINT64 ProcessorContextCorrupt : 1;
1044dbe3d72SLawrence Tang   UINT64 Corrected : 1;
1054dbe3d72SLawrence Tang   UINT64 PrecisePC : 1;
1064dbe3d72SLawrence Tang   UINT64 RestartablePC : 1;
1074dbe3d72SLawrence Tang   UINT64 Reserved : 34;
1084dbe3d72SLawrence Tang } EFI_ARM_TLB_ERROR_STRUCTURE;
1094dbe3d72SLawrence Tang 
1104dbe3d72SLawrence Tang typedef struct {
1114dbe3d72SLawrence Tang   UINT64 ValidationBits : 16;
1124dbe3d72SLawrence Tang   UINT64 TransactionType : 2;
1134dbe3d72SLawrence Tang   UINT64 Operation : 4;
1144dbe3d72SLawrence Tang   UINT64 Level : 3;
1154dbe3d72SLawrence Tang   UINT64 ProcessorContextCorrupt : 1;
1164dbe3d72SLawrence Tang   UINT64 Corrected : 1;
1174dbe3d72SLawrence Tang   UINT64 PrecisePC : 1;
1184dbe3d72SLawrence Tang   UINT64 RestartablePC : 1;
1194dbe3d72SLawrence Tang   UINT64 ParticipationType : 2;
1204dbe3d72SLawrence Tang   UINT64 TimeOut : 1;
1214dbe3d72SLawrence Tang   UINT64 AddressSpace : 2;
1224dbe3d72SLawrence Tang   UINT64 MemoryAddressAttributes : 8;
1234dbe3d72SLawrence Tang   UINT64 AccessMode : 1;
1244dbe3d72SLawrence Tang   UINT64 Reserved : 19;
1254dbe3d72SLawrence Tang } EFI_ARM_BUS_ERROR_STRUCTURE;
1264dbe3d72SLawrence Tang 
1274dbe3d72SLawrence Tang typedef union {
1284dbe3d72SLawrence Tang   EFI_ARM_CACHE_ERROR_STRUCTURE CacheError;
1294dbe3d72SLawrence Tang   EFI_ARM_TLB_ERROR_STRUCTURE TlbError;
1304dbe3d72SLawrence Tang   EFI_ARM_BUS_ERROR_STRUCTURE BusError;
1314dbe3d72SLawrence Tang } EFI_ARM_ERROR_INFORMATION_STRUCTURE;
1324dbe3d72SLawrence Tang 
1334dbe3d72SLawrence Tang typedef struct {
1344dbe3d72SLawrence Tang   UINT8 Version;
1354dbe3d72SLawrence Tang   UINT8 Length;
1364dbe3d72SLawrence Tang   UINT16 ValidationBits;
1374dbe3d72SLawrence Tang   UINT8 Type;
1384dbe3d72SLawrence Tang   UINT16 MultipleError;
1394dbe3d72SLawrence Tang   UINT8 Flags;
1404dbe3d72SLawrence Tang   EFI_ARM_ERROR_INFORMATION_STRUCTURE ErrorInformation;
1414dbe3d72SLawrence Tang   UINT64 VirtualFaultAddress;
1424dbe3d72SLawrence Tang   UINT64 PhysicalFaultAddress;
143*71570a2aSLawrence Tang } __attribute__((packed, aligned(1))) EFI_ARM_ERROR_INFORMATION_ENTRY;
1444dbe3d72SLawrence Tang 
1454dbe3d72SLawrence Tang ///
1464dbe3d72SLawrence Tang /// ARM Processor Context Information Structure
1474dbe3d72SLawrence Tang ///
1484dbe3d72SLawrence Tang typedef struct {
1494dbe3d72SLawrence Tang   UINT16 Version;
1504dbe3d72SLawrence Tang   UINT16 RegisterContextType;
1514dbe3d72SLawrence Tang   UINT32 RegisterArraySize;
1524dbe3d72SLawrence Tang } EFI_ARM_CONTEXT_INFORMATION_HEADER;
1534dbe3d72SLawrence Tang 
1544dbe3d72SLawrence Tang ///
1554dbe3d72SLawrence Tang /// ARM Processor Context Register Types
1564dbe3d72SLawrence Tang ///
1574dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_GPR 0
1584dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_EL1 1
1594dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_EL2 2
1604dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE 3
1614dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_GPR 4
1624dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL1 5
1634dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL2 6
1644dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_AARCH64_EL3 7
1654dbe3d72SLawrence Tang #define EFI_ARM_CONTEXT_TYPE_MISC 8
1664dbe3d72SLawrence Tang 
1674dbe3d72SLawrence Tang typedef struct {
1684dbe3d72SLawrence Tang   UINT32 R0;
1694dbe3d72SLawrence Tang   UINT32 R1;
1704dbe3d72SLawrence Tang   UINT32 R2;
1714dbe3d72SLawrence Tang   UINT32 R3;
1724dbe3d72SLawrence Tang   UINT32 R4;
1734dbe3d72SLawrence Tang   UINT32 R5;
1744dbe3d72SLawrence Tang   UINT32 R6;
1754dbe3d72SLawrence Tang   UINT32 R7;
1764dbe3d72SLawrence Tang   UINT32 R8;
1774dbe3d72SLawrence Tang   UINT32 R9;
1784dbe3d72SLawrence Tang   UINT32 R10;
1794dbe3d72SLawrence Tang   UINT32 R11;
1804dbe3d72SLawrence Tang   UINT32 R12;
1814dbe3d72SLawrence Tang   UINT32 R13_sp;
1824dbe3d72SLawrence Tang   UINT32 R14_lr;
1834dbe3d72SLawrence Tang   UINT32 R15_pc;
1844dbe3d72SLawrence Tang } EFI_ARM_V8_AARCH32_GPR;
1854dbe3d72SLawrence Tang 
1864dbe3d72SLawrence Tang typedef struct {
1874dbe3d72SLawrence Tang   UINT32 Dfar;
1884dbe3d72SLawrence Tang   UINT32 Dfsr;
1894dbe3d72SLawrence Tang   UINT32 Ifar;
1904dbe3d72SLawrence Tang   UINT32 Isr;
1914dbe3d72SLawrence Tang   UINT32 Mair0;
1924dbe3d72SLawrence Tang   UINT32 Mair1;
1934dbe3d72SLawrence Tang   UINT32 Midr;
1944dbe3d72SLawrence Tang   UINT32 Mpidr;
1954dbe3d72SLawrence Tang   UINT32 Nmrr;
1964dbe3d72SLawrence Tang   UINT32 Prrr;
1974dbe3d72SLawrence Tang   UINT32 Sctlr_Ns;
1984dbe3d72SLawrence Tang   UINT32 Spsr;
1994dbe3d72SLawrence Tang   UINT32 Spsr_Abt;
2004dbe3d72SLawrence Tang   UINT32 Spsr_Fiq;
2014dbe3d72SLawrence Tang   UINT32 Spsr_Irq;
2024dbe3d72SLawrence Tang   UINT32 Spsr_Svc;
2034dbe3d72SLawrence Tang   UINT32 Spsr_Und;
2044dbe3d72SLawrence Tang   UINT32 Tpidrprw;
2054dbe3d72SLawrence Tang   UINT32 Tpidruro;
2064dbe3d72SLawrence Tang   UINT32 Tpidrurw;
2074dbe3d72SLawrence Tang   UINT32 Ttbcr;
2084dbe3d72SLawrence Tang   UINT32 Ttbr0;
2094dbe3d72SLawrence Tang   UINT32 Ttbr1;
2104dbe3d72SLawrence Tang   UINT32 Dacr;
2114dbe3d72SLawrence Tang } EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS;
2124dbe3d72SLawrence Tang 
2134dbe3d72SLawrence Tang typedef struct {
2144dbe3d72SLawrence Tang   UINT32 Elr_Hyp;
2154dbe3d72SLawrence Tang   UINT32 Hamair0;
2164dbe3d72SLawrence Tang   UINT32 Hamair1;
2174dbe3d72SLawrence Tang   UINT32 Hcr;
2184dbe3d72SLawrence Tang   UINT32 Hcr2;
2194dbe3d72SLawrence Tang   UINT32 Hdfar;
2204dbe3d72SLawrence Tang   UINT32 Hifar;
2214dbe3d72SLawrence Tang   UINT32 Hpfar;
2224dbe3d72SLawrence Tang   UINT32 Hsr;
2234dbe3d72SLawrence Tang   UINT32 Htcr;
2244dbe3d72SLawrence Tang   UINT32 Htpidr;
2254dbe3d72SLawrence Tang   UINT32 Httbr;
2264dbe3d72SLawrence Tang   UINT32 Spsr_Hyp;
2274dbe3d72SLawrence Tang   UINT32 Vtcr;
2284dbe3d72SLawrence Tang   UINT32 Vttbr;
2294dbe3d72SLawrence Tang   UINT32 Dacr32_El2;
2304dbe3d72SLawrence Tang } EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS;
2314dbe3d72SLawrence Tang 
2324dbe3d72SLawrence Tang typedef struct {
2334dbe3d72SLawrence Tang   UINT32 Sctlr_S;
2344dbe3d72SLawrence Tang   UINT32 Spsr_Mon;
2354dbe3d72SLawrence Tang } EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS;
2364dbe3d72SLawrence Tang 
2374dbe3d72SLawrence Tang typedef struct {
2384dbe3d72SLawrence Tang   UINT64 X0;
2394dbe3d72SLawrence Tang   UINT64 X1;
2404dbe3d72SLawrence Tang   UINT64 X2;
2414dbe3d72SLawrence Tang   UINT64 X3;
2424dbe3d72SLawrence Tang   UINT64 X4;
2434dbe3d72SLawrence Tang   UINT64 X5;
2444dbe3d72SLawrence Tang   UINT64 X6;
2454dbe3d72SLawrence Tang   UINT64 X7;
2464dbe3d72SLawrence Tang   UINT64 X8;
2474dbe3d72SLawrence Tang   UINT64 X9;
2484dbe3d72SLawrence Tang   UINT64 X10;
2494dbe3d72SLawrence Tang   UINT64 X11;
2504dbe3d72SLawrence Tang   UINT64 X12;
2514dbe3d72SLawrence Tang   UINT64 X13;
2524dbe3d72SLawrence Tang   UINT64 X14;
2534dbe3d72SLawrence Tang   UINT64 X15;
2544dbe3d72SLawrence Tang   UINT64 X16;
2554dbe3d72SLawrence Tang   UINT64 X17;
2564dbe3d72SLawrence Tang   UINT64 X18;
2574dbe3d72SLawrence Tang   UINT64 X19;
2584dbe3d72SLawrence Tang   UINT64 X20;
2594dbe3d72SLawrence Tang   UINT64 X21;
2604dbe3d72SLawrence Tang   UINT64 X22;
2614dbe3d72SLawrence Tang   UINT64 X23;
2624dbe3d72SLawrence Tang   UINT64 X24;
2634dbe3d72SLawrence Tang   UINT64 X25;
2644dbe3d72SLawrence Tang   UINT64 X26;
2654dbe3d72SLawrence Tang   UINT64 X27;
2664dbe3d72SLawrence Tang   UINT64 X28;
2674dbe3d72SLawrence Tang   UINT64 X29;
2684dbe3d72SLawrence Tang   UINT64 X30;
2694dbe3d72SLawrence Tang   UINT64 Sp;
2704dbe3d72SLawrence Tang } EFI_ARM_V8_AARCH64_GPR;
2714dbe3d72SLawrence Tang 
2724dbe3d72SLawrence Tang typedef struct {
2734dbe3d72SLawrence Tang   UINT64 Elr_El1;
2744dbe3d72SLawrence Tang   UINT64 Esr_El1;
2754dbe3d72SLawrence Tang   UINT64 Far_El1;
2764dbe3d72SLawrence Tang   UINT64 Isr_El1;
2774dbe3d72SLawrence Tang   UINT64 Mair_El1;
2784dbe3d72SLawrence Tang   UINT64 Midr_El1;
2794dbe3d72SLawrence Tang   UINT64 Mpidr_El1;
2804dbe3d72SLawrence Tang   UINT64 Sctlr_El1;
2814dbe3d72SLawrence Tang   UINT64 Sp_El0;
2824dbe3d72SLawrence Tang   UINT64 Sp_El1;
2834dbe3d72SLawrence Tang   UINT64 Spsr_El1;
2844dbe3d72SLawrence Tang   UINT64 Tcr_El1;
2854dbe3d72SLawrence Tang   UINT64 Tpidr_El0;
2864dbe3d72SLawrence Tang   UINT64 Tpidr_El1;
2874dbe3d72SLawrence Tang   UINT64 Tpidrro_El0;
2884dbe3d72SLawrence Tang   UINT64 Ttbr0_El1;
2894dbe3d72SLawrence Tang   UINT64 Ttbr1_El1;
2904dbe3d72SLawrence Tang } EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS;
2914dbe3d72SLawrence Tang 
2924dbe3d72SLawrence Tang typedef struct {
2934dbe3d72SLawrence Tang   UINT64 Elr_El2;
2944dbe3d72SLawrence Tang   UINT64 Esr_El2;
2954dbe3d72SLawrence Tang   UINT64 Far_El2;
2964dbe3d72SLawrence Tang   UINT64 Hacr_El2;
2974dbe3d72SLawrence Tang   UINT64 Hcr_El2;
2984dbe3d72SLawrence Tang   UINT64 Hpfar_El2;
2994dbe3d72SLawrence Tang   UINT64 Mair_El2;
3004dbe3d72SLawrence Tang   UINT64 Sctlr_El2;
3014dbe3d72SLawrence Tang   UINT64 Sp_El2;
3024dbe3d72SLawrence Tang   UINT64 Spsr_El2;
3034dbe3d72SLawrence Tang   UINT64 Tcr_El2;
3044dbe3d72SLawrence Tang   UINT64 Tpidr_El2;
3054dbe3d72SLawrence Tang   UINT64 Ttbr0_El2;
3064dbe3d72SLawrence Tang   UINT64 Vtcr_El2;
3074dbe3d72SLawrence Tang   UINT64 Vttbr_El2;
3084dbe3d72SLawrence Tang } EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS;
3094dbe3d72SLawrence Tang 
3104dbe3d72SLawrence Tang typedef struct {
3114dbe3d72SLawrence Tang   UINT64 Elr_El3;
3124dbe3d72SLawrence Tang   UINT64 Esr_El3;
3134dbe3d72SLawrence Tang   UINT64 Far_El3;
3144dbe3d72SLawrence Tang   UINT64 Mair_El3;
3154dbe3d72SLawrence Tang   UINT64 Sctlr_El3;
3164dbe3d72SLawrence Tang   UINT64 Sp_El3;
3174dbe3d72SLawrence Tang   UINT64 Spsr_El3;
3184dbe3d72SLawrence Tang   UINT64 Tcr_El3;
3194dbe3d72SLawrence Tang   UINT64 Tpidr_El3;
3204dbe3d72SLawrence Tang   UINT64 Ttbr0_El3;
3214dbe3d72SLawrence Tang } EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS;
3224dbe3d72SLawrence Tang 
3234dbe3d72SLawrence Tang typedef struct {
3244dbe3d72SLawrence Tang   UINT64 MrsOp2 : 3;
3254dbe3d72SLawrence Tang   UINT64 MrsCrm : 4;
3264dbe3d72SLawrence Tang   UINT64 MrsCrn : 4;
3274dbe3d72SLawrence Tang   UINT64 MrsOp1 : 3;
3284dbe3d72SLawrence Tang   UINT64 MrsO0 : 1;
3294dbe3d72SLawrence Tang   UINT64 Value : 64;
3304dbe3d72SLawrence Tang } EFI_ARM_MISC_CONTEXT_REGISTER;
3314dbe3d72SLawrence Tang 
3322800cd8eSLawrence Tang json_object* cper_section_arm_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor);
3337cd13908SLawrence Tang void ir_section_arm_to_cper(json_object* section, FILE* out);
3342800cd8eSLawrence Tang 
3352800cd8eSLawrence Tang #endif