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 
7*7f21db6cSLawrence Tang #define ARM_ERROR_VALID_BITFIELD_NAMES (const char*[]) \
82800cd8eSLawrence Tang     {"mpidrValid", "errorAffinityLevelValid", "runningStateValid", "vendorSpecificInfoValid"}
9*7f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES (const char*[]) \
103d0e4f24SLawrence Tang     {"multipleErrorValid", "flagsValid", "errorInformationValid", "virtualFaultAddressValid", "physicalFaultAddressValid"}
11*7f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_FLAGS_NAMES (const char*[]) \
123d0e4f24SLawrence Tang     {"firstErrorCaptured", "lastErrorCaptured", "propagated", "overflow"}
13*7f21db6cSLawrence Tang #define ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES (const char*[]) \
14*7f21db6cSLawrence Tang     {"transactionTypeValid", "operationValid", "levelValid", "processorContextCorruptValid", "correctedValid", \
15*7f21db6cSLawrence Tang     "precisePCValid", "restartablePCValid"}
16*7f21db6cSLawrence Tang #define ARM_BUS_ERROR_VALID_BITFIELD_NAMES (const char*[]) \
17*7f21db6cSLawrence Tang     {"transactionTypeValid", "operationValid", "levelValid", "processorContextCorruptValid", "correctedValid", \
18*7f21db6cSLawrence Tang     "precisePCValid", "restartablePCValid", "participationTypeValid", "timeOutValid", "addressSpaceValid", \
19*7f21db6cSLawrence Tang     "memoryAttributesValid", "accessModeValid"}
20*7f21db6cSLawrence Tang #define ARM_ERROR_TRANSACTION_TYPES_KEYS (int []){0, 1, 2}
21*7f21db6cSLawrence Tang #define ARM_ERROR_TRANSACTION_TYPES_VALUES (const char*[]){"Instruction", "Data Access", "Generic"}
22*7f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_INFO_TYPES_KEYS (int []){0, 1, 2, 3}
23*7f21db6cSLawrence Tang #define ARM_ERROR_INFO_ENTRY_INFO_TYPES_VALUES (const char*[]){"Cache Error", "TLB Error", \
243d0e4f24SLawrence Tang     "Bus Error", "Micro-Architectural Error"}
25*7f21db6cSLawrence Tang #define ARM_CACHE_BUS_OPERATION_TYPES_KEYS (int []){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
26*7f21db6cSLawrence Tang #define ARM_CACHE_BUS_OPERATION_TYPES_VALUES (const char*[]){"Generic Error", "Generic Read", "Generic Write", \
27*7f21db6cSLawrence Tang     "Data Read", "Data Write", "Instruction Fetch", "Prefetch", "Eviction", "Snooping", "Snooped", "Management"}
28*7f21db6cSLawrence Tang #define ARM_TLB_OPERATION_TYPES_KEYS (int []){0, 1, 2, 3, 4, 5, 6, 7, 8}
29*7f21db6cSLawrence Tang #define ARM_TLB_OPERATION_TYPES_VALUES (const char*[]){"Generic Error", "Generic Read", "Generic Write", \
30*7f21db6cSLawrence Tang     "Data Read", "Data Write", "Instruction Fetch", "Prefetch", "Local Management Operation", \
31*7f21db6cSLawrence Tang     "External Management Operation"}
32*7f21db6cSLawrence Tang #define ARM_BUS_PARTICIPATION_TYPES_KEYS (int []){0, 1, 2, 3}
33*7f21db6cSLawrence Tang #define ARM_BUS_PARTICIPATION_TYPES_VALUES (const char*[]){"Local Processor Originated Request", \
34*7f21db6cSLawrence Tang     "Local Processor Responded to Request", "Local Processor Observed", "Generic"}
35*7f21db6cSLawrence Tang #define ARM_BUS_ADDRESS_SPACE_TYPES_KEYS (int []){0, 1, 3}
36*7f21db6cSLawrence Tang #define ARM_BUS_ADDRESS_SPACE_TYPES_VALUES (const char*[]){"External Memory Access", "Internal Memory Access", \
37*7f21db6cSLawrence Tang     "Device Memory Access"}
38*7f21db6cSLawrence Tang #define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_KEYS (int []){0, 1, 2, 3, 4, 5, 6, 7, 8}
39*7f21db6cSLawrence Tang #define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_VALUES (const char*[]){"AArch32 General Purpose Registers", \
40*7f21db6cSLawrence Tang     "AArch32 EL1 Context Registers", "AArch32 EL2 Context Registers", "AArch32 Secure Context Registers" \
41*7f21db6cSLawrence Tang     "AArch64 General Purpose Registers", "AArch64 EL1 Context Registers", "AArch64 EL2 Context Registers" \
42*7f21db6cSLawrence Tang     "AArch64 EL3 Context Registers", "Miscellaneous System Register Structure"}
43*7f21db6cSLawrence Tang #define ARM_AARCH32_GPR_NAMES (const char*[]){"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
44*7f21db6cSLawrence Tang     "r10", "r11", "r12", "r13_sp", "r14_lr", "r15_pc"}
45*7f21db6cSLawrence Tang #define ARM_AARCH32_EL1_REGISTER_NAMES (const char*[]){"dfar", "dfsr", "ifar", "isr", "mair0", "mair1", "midr", \
46*7f21db6cSLawrence Tang     "mpidr", "nmrr", "prrr", "sctlr_ns", "spsr", "spsr_abt", "spsr_fiq", "spsr_irq", "spsr_svc", "spsr_und", \
47*7f21db6cSLawrence Tang     "tpidrprw", "tpidruro", "tpidrurw", "ttbcr", "ttbr0", "ttbr1", "dacr"}
48*7f21db6cSLawrence Tang #define ARM_AARCH32_EL2_REGISTER_NAMES (const char*[]){"elr_hyp", "hamair0", "hamair1", "hcr", "hcr2", "hdfar", \
49*7f21db6cSLawrence Tang     "hifar", "hpfar", "hsr", "htcr", "htpidr", "httbr", "spsr_hyp", "vtcr", "vttbr", "dacr32_el2"}
50*7f21db6cSLawrence Tang #define ARM_AARCH32_SECURE_REGISTER_NAMES (const char*[]){"sctlr_s", "spsr_mon"}
51*7f21db6cSLawrence Tang #define ARM_AARCH64_GPR_NAMES (const char*[]){"x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10" \
52*7f21db6cSLawrence Tang     "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26" \
53*7f21db6cSLawrence Tang     "x27", "x28", "x29", "x30", "sp"}
54*7f21db6cSLawrence Tang #define ARM_AARCH64_EL1_REGISTER_NAMES (const char*[]){"elr_el1", "esr_el1", "far_el1", "isr_el1", "mair_el1", \
55*7f21db6cSLawrence Tang     "midr_el1", "mpidr_el1", "sctlr_el1", "sp_el0", "sp_el1", "spsr_el1", "tcr_el1", "tpidr_el0", "tpidr_el1", \
56*7f21db6cSLawrence Tang     "tpidrro_el0", "ttbr0_el1", "ttbr1_el1"}
57*7f21db6cSLawrence Tang #define ARM_AARCH64_EL2_REGISTER_NAMES (const char*[]){"elr_el2", "esr_el2", "far_el2", "hacr_el2", "hcr_el2", \
58*7f21db6cSLawrence Tang     "hpfar_el2", "mair_el2", "sctlr_el2", "sp_el2", "spsr_el2", "tcr_el2", "tpidr_el2", "ttbr0_el2", "vtcr_el2", \
59*7f21db6cSLawrence Tang     "vttbr_el2"}
60*7f21db6cSLawrence Tang #define ARM_AARCH64_EL3_REGISTER_NAMES (const char*[]){"elr_el3", "esr_el3", "far_el3", "mair_el3", "sctlr_el3", \
61*7f21db6cSLawrence Tang     "sp_el3", "spsr_el3", "tcr_el3", "tpidr_el3", "ttbr0_el3"}
622800cd8eSLawrence Tang 
632800cd8eSLawrence Tang json_object* cper_section_arm_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor);
642800cd8eSLawrence Tang 
652800cd8eSLawrence Tang #endif