Change include style to use system includes
The libcper header files in `libcper` are installed to
`usr/include/libcper`. Use that system includes in `libcper` source
instead of using the project includes.
Change-Id: I596edc2c754dae4829844f535a1e34caa246fb43
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
diff --git a/sections/cper-section-ampere.c b/sections/cper-section-ampere.c
index 9fa5a8b..7604dc0 100644
--- a/sections/cper-section-ampere.c
+++ b/sections/cper-section-ampere.c
@@ -1,8 +1,8 @@
#include <stdio.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-ampere.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-ampere.h>
//Converts the given processor-generic CPER section into JSON IR.
json_object *cper_section_ampere_to_ir(void *section)
diff --git a/sections/cper-section-ampere.h b/sections/cper-section-ampere.h
deleted file mode 100644
index 978f6db..0000000
--- a/sections/cper-section-ampere.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef CPER_SECTION_AMPERE_H
-#define CPER_SECTION_AMPERE_H
-
-#include <json.h>
-#include "Cper.h"
-
-json_object *cper_section_ampere_to_ir(void *section);
-void ir_section_ampere_to_cper(json_object *section, FILE *out);
-
-#endif
diff --git a/sections/cper-section-arm.c b/sections/cper-section-arm.c
index db0f54c..119b30a 100644
--- a/sections/cper-section-arm.c
+++ b/sections/cper-section-arm.c
@@ -7,10 +7,10 @@
#include <stdio.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-arm.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-arm.h>
//Private pre-definitions.
json_object *
diff --git a/sections/cper-section-arm.h b/sections/cper-section-arm.h
deleted file mode 100644
index 8601992..0000000
--- a/sections/cper-section-arm.h
+++ /dev/null
@@ -1,470 +0,0 @@
-#ifndef CPER_SECTION_ARM_H
-#define CPER_SECTION_ARM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define ARM_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "mpidrValid", "errorAffinityLevelValid", "runningStateValid", \
- "vendorSpecificInfoValid" \
- }
-#define ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "multipleErrorValid", "flagsValid", "errorInformationValid", \
- "virtualFaultAddressValid", \
- "physicalFaultAddressValid" \
- }
-#define ARM_ERROR_INFO_ENTRY_FLAGS_NAMES \
- (const char *[]) \
- { \
- "firstErrorCaptured", "lastErrorCaptured", "propagated", \
- "overflow" \
- }
-#define ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "transactionTypeValid", "operationValid", "levelValid", \
- "processorContextCorruptValid", "correctedValid", \
- "precisePCValid", "restartablePCValid" \
- }
-#define ARM_BUS_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "transactionTypeValid", "operationValid", "levelValid", \
- "processorContextCorruptValid", "correctedValid", \
- "precisePCValid", "restartablePCValid", \
- "participationTypeValid", "timedOutValid", \
- "addressSpaceValid", "memoryAttributesValid", \
- "accessModeValid" \
- }
-#define ARM_ERROR_TRANSACTION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2 \
- }
-#define ARM_ERROR_TRANSACTION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Instruction", "Data Access", "Generic" \
- }
-#define ARM_ERROR_INFO_ENTRY_INFO_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3 \
- }
-#define ARM_ERROR_INFO_ENTRY_INFO_TYPES_VALUES \
- (const char *[]) \
- { \
- "Cache Error", "TLB Error", "Bus Error", \
- "Micro-Architectural Error" \
- }
-#define ARM_CACHE_BUS_OPERATION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 \
- }
-#define ARM_CACHE_BUS_OPERATION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Generic Error", "Generic Read", "Generic Write", "Data Read", \
- "Data Write", "Instruction Fetch", "Prefetch", \
- "Eviction", "Snooping", "Snooped", "Management" \
- }
-#define ARM_TLB_OPERATION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7, 8 \
- }
-#define ARM_TLB_OPERATION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Generic Error", "Generic Read", "Generic Write", "Data Read", \
- "Data Write", "Instruction Fetch", "Prefetch", \
- "Local Management Operation", \
- "External Management Operation" \
- }
-#define ARM_BUS_PARTICIPATION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3 \
- }
-#define ARM_BUS_PARTICIPATION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Local Processor Originated Request", \
- "Local Processor Responded to Request", \
- "Local Processor Observed", "Generic" \
- }
-#define ARM_BUS_ADDRESS_SPACE_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 3 \
- }
-#define ARM_BUS_ADDRESS_SPACE_TYPES_VALUES \
- (const char *[]) \
- { \
- "External Memory Access", "Internal Memory Access", \
- "Device Memory Access" \
- }
-#define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7, 8 \
- }
-#define ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_VALUES \
- (const char *[]) \
- { \
- "AArch32 General Purpose Registers", \
- "AArch32 EL1 Context Registers", \
- "AArch32 EL2 Context Registers", \
- "AArch32 Secure Context Registers", \
- "AArch64 General Purpose Registers", \
- "AArch64 EL1 Context Registers", \
- "AArch64 EL2 Context Registers", \
- "AArch64 EL3 Context Registers", \
- "Miscellaneous System Register Structure" \
- }
-#define ARM_AARCH32_GPR_NAMES \
- (const char *[]) \
- { \
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
- "r10", "r11", "r12", "r13_sp", "r14_lr", "r15_pc" \
- }
-#define ARM_AARCH32_EL1_REGISTER_NAMES \
- (const char *[]) \
- { \
- "dfar", "dfsr", "ifar", "isr", "mair0", "mair1", "midr", \
- "mpidr", "nmrr", "prrr", "sctlr_ns", "spsr", \
- "spsr_abt", "spsr_fiq", "spsr_irq", "spsr_svc", \
- "spsr_und", "tpidrprw", "tpidruro", "tpidrurw", \
- "ttbcr", "ttbr0", "ttbr1", "dacr" \
- }
-#define ARM_AARCH32_EL2_REGISTER_NAMES \
- (const char *[]) \
- { \
- "elr_hyp", "hamair0", "hamair1", "hcr", "hcr2", "hdfar", \
- "hifar", "hpfar", "hsr", "htcr", "htpidr", "httbr", \
- "spsr_hyp", "vtcr", "vttbr", "dacr32_el2" \
- }
-#define ARM_AARCH32_SECURE_REGISTER_NAMES \
- (const char *[]) \
- { \
- "sctlr_s", "spsr_mon" \
- }
-#define ARM_AARCH64_GPR_NAMES \
- (const char *[]) \
- { \
- "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", \
- "x10", "x11", "x12", "x13", "x14", "x15", "x16", \
- "x17", "x18", "x19", "x20", "x21", "x22", "x23", \
- "x24", "x25", "x26", "x27", "x28", "x29", "x30", "sp" \
- }
-#define ARM_AARCH64_EL1_REGISTER_NAMES \
- (const char *[]) \
- { \
- "elr_el1", "esr_el1", "far_el1", "isr_el1", "mair_el1", \
- "midr_el1", "mpidr_el1", "sctlr_el1", "sp_el0", \
- "sp_el1", "spsr_el1", "tcr_el1", "tpidr_el0", \
- "tpidr_el1", "tpidrro_el0", "ttbr0_el1", "ttbr1_el1" \
- }
-#define ARM_AARCH64_EL2_REGISTER_NAMES \
- (const char *[]) \
- { \
- "elr_el2", "esr_el2", "far_el2", "hacr_el2", "hcr_el2", \
- "hpfar_el2", "mair_el2", "sctlr_el2", "sp_el2", \
- "spsr_el2", "tcr_el2", "tpidr_el2", "ttbr0_el2", \
- "vtcr_el2", "vttbr_el2" \
- }
-#define ARM_AARCH64_EL3_REGISTER_NAMES \
- (const char *[]) \
- { \
- "elr_el3", "esr_el3", "far_el3", "mair_el3", "sctlr_el3", \
- "sp_el3", "spsr_el3", "tcr_el3", "tpidr_el3", \
- "ttbr0_el3" \
- }
-
-///
-/// ARM Processor Error Record
-///
-typedef struct {
- UINT32 ValidFields;
- UINT16 ErrInfoNum;
- UINT16 ContextInfoNum;
- UINT32 SectionLength;
- UINT32 ErrorAffinityLevel;
- UINT64 MPIDR_EL1;
- UINT64 MIDR_EL1;
- UINT32 RunningState;
- UINT32 PsciState;
-} __attribute__((packed, aligned(1))) EFI_ARM_ERROR_RECORD;
-
-///
-/// ARM Processor Error Information Structure
-///
-#define ARM_ERROR_INFORMATION_TYPE_CACHE 0
-#define ARM_ERROR_INFORMATION_TYPE_TLB 1
-#define ARM_ERROR_INFORMATION_TYPE_BUS 2
-#define ARM_ERROR_INFORMATION_TYPE_MICROARCH 3
-
-typedef struct {
- UINT64 ValidationBits : 16;
- UINT64 TransactionType : 2;
- UINT64 Operation : 4;
- UINT64 Level : 3;
- UINT64 ProcessorContextCorrupt : 1;
- UINT64 Corrected : 1;
- UINT64 PrecisePC : 1;
- UINT64 RestartablePC : 1;
- UINT64 Reserved : 34;
-} EFI_ARM_CACHE_ERROR_STRUCTURE;
-
-typedef struct {
- UINT64 ValidationBits : 16;
- UINT64 TransactionType : 2;
- UINT64 Operation : 4;
- UINT64 Level : 3;
- UINT64 ProcessorContextCorrupt : 1;
- UINT64 Corrected : 1;
- UINT64 PrecisePC : 1;
- UINT64 RestartablePC : 1;
- UINT64 Reserved : 34;
-} EFI_ARM_TLB_ERROR_STRUCTURE;
-
-typedef struct {
- UINT64 ValidationBits : 16;
- UINT64 TransactionType : 2;
- UINT64 Operation : 4;
- UINT64 Level : 3;
- UINT64 ProcessorContextCorrupt : 1;
- UINT64 Corrected : 1;
- UINT64 PrecisePC : 1;
- UINT64 RestartablePC : 1;
- UINT64 ParticipationType : 2;
- UINT64 TimeOut : 1;
- UINT64 AddressSpace : 2;
- UINT64 MemoryAddressAttributes : 8;
- UINT64 AccessMode : 1;
- UINT64 Reserved : 19;
-} EFI_ARM_BUS_ERROR_STRUCTURE;
-
-typedef union {
- UINT64 Value;
- EFI_ARM_CACHE_ERROR_STRUCTURE CacheError;
- EFI_ARM_TLB_ERROR_STRUCTURE TlbError;
- EFI_ARM_BUS_ERROR_STRUCTURE BusError;
-} EFI_ARM_ERROR_INFORMATION_STRUCTURE;
-
-typedef struct {
- UINT8 Version;
- UINT8 Length;
- UINT16 ValidationBits;
- UINT8 Type;
- UINT16 MultipleError;
- UINT8 Flags;
- EFI_ARM_ERROR_INFORMATION_STRUCTURE ErrorInformation;
- UINT64 VirtualFaultAddress;
- UINT64 PhysicalFaultAddress;
-} __attribute__((packed, aligned(1))) EFI_ARM_ERROR_INFORMATION_ENTRY;
-
-///
-/// ARM Processor Context Information Structure
-///
-typedef struct {
- UINT16 Version;
- UINT16 RegisterContextType;
- UINT32 RegisterArraySize;
-} __attribute__((packed, aligned(1))) EFI_ARM_CONTEXT_INFORMATION_HEADER;
-
-///
-/// ARM Processor Context Register Types
-///
-#define EFI_ARM_CONTEXT_TYPE_AARCH32_GPR 0
-#define EFI_ARM_CONTEXT_TYPE_AARCH32_EL1 1
-#define EFI_ARM_CONTEXT_TYPE_AARCH32_EL2 2
-#define EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE 3
-#define EFI_ARM_CONTEXT_TYPE_AARCH64_GPR 4
-#define EFI_ARM_CONTEXT_TYPE_AARCH64_EL1 5
-#define EFI_ARM_CONTEXT_TYPE_AARCH64_EL2 6
-#define EFI_ARM_CONTEXT_TYPE_AARCH64_EL3 7
-#define EFI_ARM_CONTEXT_TYPE_MISC 8
-
-typedef struct {
- UINT32 R0;
- UINT32 R1;
- UINT32 R2;
- UINT32 R3;
- UINT32 R4;
- UINT32 R5;
- UINT32 R6;
- UINT32 R7;
- UINT32 R8;
- UINT32 R9;
- UINT32 R10;
- UINT32 R11;
- UINT32 R12;
- UINT32 R13_sp;
- UINT32 R14_lr;
- UINT32 R15_pc;
-} EFI_ARM_V8_AARCH32_GPR;
-
-typedef struct {
- UINT32 Dfar;
- UINT32 Dfsr;
- UINT32 Ifar;
- UINT32 Isr;
- UINT32 Mair0;
- UINT32 Mair1;
- UINT32 Midr;
- UINT32 Mpidr;
- UINT32 Nmrr;
- UINT32 Prrr;
- UINT32 Sctlr_Ns;
- UINT32 Spsr;
- UINT32 Spsr_Abt;
- UINT32 Spsr_Fiq;
- UINT32 Spsr_Irq;
- UINT32 Spsr_Svc;
- UINT32 Spsr_Und;
- UINT32 Tpidrprw;
- UINT32 Tpidruro;
- UINT32 Tpidrurw;
- UINT32 Ttbcr;
- UINT32 Ttbr0;
- UINT32 Ttbr1;
- UINT32 Dacr;
-} EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS;
-
-typedef struct {
- UINT32 Elr_Hyp;
- UINT32 Hamair0;
- UINT32 Hamair1;
- UINT32 Hcr;
- UINT32 Hcr2;
- UINT32 Hdfar;
- UINT32 Hifar;
- UINT32 Hpfar;
- UINT32 Hsr;
- UINT32 Htcr;
- UINT32 Htpidr;
- UINT32 Httbr;
- UINT32 Spsr_Hyp;
- UINT32 Vtcr;
- UINT32 Vttbr;
- UINT32 Dacr32_El2;
-} EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS;
-
-typedef struct {
- UINT32 Sctlr_S;
- UINT32 Spsr_Mon;
-} EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS;
-
-typedef struct {
- UINT64 X0;
- UINT64 X1;
- UINT64 X2;
- UINT64 X3;
- UINT64 X4;
- UINT64 X5;
- UINT64 X6;
- UINT64 X7;
- UINT64 X8;
- UINT64 X9;
- UINT64 X10;
- UINT64 X11;
- UINT64 X12;
- UINT64 X13;
- UINT64 X14;
- UINT64 X15;
- UINT64 X16;
- UINT64 X17;
- UINT64 X18;
- UINT64 X19;
- UINT64 X20;
- UINT64 X21;
- UINT64 X22;
- UINT64 X23;
- UINT64 X24;
- UINT64 X25;
- UINT64 X26;
- UINT64 X27;
- UINT64 X28;
- UINT64 X29;
- UINT64 X30;
- UINT64 Sp;
-} EFI_ARM_V8_AARCH64_GPR;
-
-typedef struct {
- UINT64 Elr_El1;
- UINT64 Esr_El1;
- UINT64 Far_El1;
- UINT64 Isr_El1;
- UINT64 Mair_El1;
- UINT64 Midr_El1;
- UINT64 Mpidr_El1;
- UINT64 Sctlr_El1;
- UINT64 Sp_El0;
- UINT64 Sp_El1;
- UINT64 Spsr_El1;
- UINT64 Tcr_El1;
- UINT64 Tpidr_El0;
- UINT64 Tpidr_El1;
- UINT64 Tpidrro_El0;
- UINT64 Ttbr0_El1;
- UINT64 Ttbr1_El1;
-} EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS;
-
-typedef struct {
- UINT64 Elr_El2;
- UINT64 Esr_El2;
- UINT64 Far_El2;
- UINT64 Hacr_El2;
- UINT64 Hcr_El2;
- UINT64 Hpfar_El2;
- UINT64 Mair_El2;
- UINT64 Sctlr_El2;
- UINT64 Sp_El2;
- UINT64 Spsr_El2;
- UINT64 Tcr_El2;
- UINT64 Tpidr_El2;
- UINT64 Ttbr0_El2;
- UINT64 Vtcr_El2;
- UINT64 Vttbr_El2;
-} EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS;
-
-typedef struct {
- UINT64 Elr_El3;
- UINT64 Esr_El3;
- UINT64 Far_El3;
- UINT64 Mair_El3;
- UINT64 Sctlr_El3;
- UINT64 Sp_El3;
- UINT64 Spsr_El3;
- UINT64 Tcr_El3;
- UINT64 Tpidr_El3;
- UINT64 Ttbr0_El3;
-} EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS;
-
-typedef struct {
- UINT64 MrsOp2 : 3;
- UINT64 MrsCrm : 4;
- UINT64 MrsCrn : 4;
- UINT64 MrsOp1 : 3;
- UINT64 MrsO0 : 1;
- UINT64 Value : 64;
-} EFI_ARM_MISC_CONTEXT_REGISTER;
-
-json_object *cper_section_arm_to_ir(void *section);
-void ir_section_arm_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-ccix-per.c b/sections/cper-section-ccix-per.c
index 6e3fa96..9081fe2 100644
--- a/sections/cper-section-ccix-per.c
+++ b/sections/cper-section-ccix-per.c
@@ -7,10 +7,10 @@
#include <stdio.h>
#include <string.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-ccix-per.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-ccix-per.h>
//Converts a single CCIX PER log CPER section into JSON IR.
json_object *cper_section_ccix_per_to_ir(void *section)
diff --git a/sections/cper-section-ccix-per.h b/sections/cper-section-ccix-per.h
deleted file mode 100644
index c8bfbb0..0000000
--- a/sections/cper-section-ccix-per.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef CPER_SECTION_CCIX_PER_H
-#define CPER_SECTION_CCIX_PER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define CCIX_PER_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "ccixSourceIDValid", "ccixPortIDValid", "ccixPERLogValid" \
- }
-
-///
-/// CCIX PER Log Error Section
-///
-typedef struct {
- UINT32 Length;
- UINT64 ValidBits;
- UINT8 CcixSourceId;
- UINT8 CcixPortId;
- UINT16 Reserved;
-} __attribute__((packed, aligned(1))) EFI_CCIX_PER_LOG_DATA;
-
-json_object *cper_section_ccix_per_to_ir(void *section);
-void ir_section_ccix_per_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-cxl-component.c b/sections/cper-section-cxl-component.c
index d085189..a5c6846 100644
--- a/sections/cper-section-cxl-component.c
+++ b/sections/cper-section-cxl-component.c
@@ -6,10 +6,10 @@
**/
#include <stdio.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-cxl-component.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-cxl-component.h>
//Converts a single CXL component error CPER section into JSON IR.
json_object *cper_section_cxl_component_to_ir(void *section)
diff --git a/sections/cper-section-cxl-component.h b/sections/cper-section-cxl-component.h
deleted file mode 100644
index 56b092c..0000000
--- a/sections/cper-section-cxl-component.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef CPER_SECTION_CXL_COMPONENT_H
-#define CPER_SECTION_CXL_COMPONENT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "deviceIDValid", "deviceSerialValid", \
- "cxlComponentEventLogValid" \
- }
-
-///
-/// CXL Generic Component Error Section
-///
-typedef struct {
- UINT64 VendorId : 16;
- UINT64 DeviceId : 16;
- UINT64 FunctionNumber : 8;
- UINT64 DeviceNumber : 8;
- UINT64 BusNumber : 8;
- UINT64 SegmentNumber : 16;
- UINT64 Resv1 : 3;
- UINT64 SlotNumber : 13;
- UINT64 Resv2 : 8;
-} __attribute__((packed, aligned(1))) EFI_CXL_DEVICE_ID_INFO;
-
-typedef struct {
- UINT32 Length;
- UINT64 ValidBits;
- EFI_CXL_DEVICE_ID_INFO DeviceId;
- UINT64 DeviceSerial;
-} __attribute__((packed, aligned(1))) EFI_CXL_COMPONENT_EVENT_HEADER;
-
-json_object *cper_section_cxl_component_to_ir(void *section);
-void ir_section_cxl_component_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-cxl-protocol.c b/sections/cper-section-cxl-protocol.c
index fa01a8a..141f26b 100644
--- a/sections/cper-section-cxl-protocol.c
+++ b/sections/cper-section-cxl-protocol.c
@@ -6,10 +6,10 @@
**/
#include <stdio.h>
#include <string.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-cxl-protocol.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-cxl-protocol.h>
//Converts a single CXL protocol error CPER section into JSON IR.
json_object *cper_section_cxl_protocol_to_ir(void *section)
diff --git a/sections/cper-section-cxl-protocol.h b/sections/cper-section-cxl-protocol.h
deleted file mode 100644
index 71166a2..0000000
--- a/sections/cper-section-cxl-protocol.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef CPER_SECTION_CXL_PROTOCOL_H
-#define CPER_SECTION_CXL_PROTOCOL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "cxlAgentTypeValid", "cxlAgentAddressValid", "deviceIDValid", \
- "deviceSerialValid", "capabilityStructureValid", \
- "cxlDVSECValid", "cxlErrorLogValid" \
- }
-#define CXL_PROTOCOL_ERROR_AGENT_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1 \
- }
-#define CXL_PROTOCOL_ERROR_AGENT_TYPES_VALUES \
- (const char *[]) \
- { \
- "CXL 1.1 Device", "CXL 1.1 Host Downstream Port" \
- }
-#define CXL_PROTOCOL_ERROR_DEVICE_AGENT 0
-#define CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT 1
-
-///
-/// CXL Protocol Error Section
-///
-typedef struct {
- UINT64 VendorId : 16;
- UINT64 DeviceId : 16;
- UINT64 SubsystemVendorId : 16;
- UINT64 SubsystemDeviceId : 16;
- UINT64 ClassCode : 16;
- UINT64 Reserved1 : 3;
- UINT64 SlotNumber : 13;
- UINT64 Reserved2 : 32;
-} EFI_CXL_DEVICE_ID;
-
-typedef struct {
- UINT64 FunctionNumber : 8;
- UINT64 DeviceNumber : 8;
- UINT64 BusNumber : 8;
- UINT64 SegmentNumber : 16;
- UINT64 Reserved : 24;
-} EFI_CXL_DEVICE_AGENT_ADDRESS;
-
-typedef union {
- EFI_CXL_DEVICE_AGENT_ADDRESS
- DeviceAddress; //Active when the agent is a CXL1.1 device in CxlAgentType.
- UINT64 PortRcrbBaseAddress; //Active when the agent is a CXL1.1 host downstream port in CxlAgentType.
-} EFI_CXL_AGENT_ADDRESS;
-
-typedef struct {
- UINT64 ValidBits;
- UINT64 CxlAgentType;
- EFI_CXL_AGENT_ADDRESS CxlAgentAddress;
- EFI_CXL_DEVICE_ID DeviceId;
- UINT64 DeviceSerial;
- EFI_PCIE_ERROR_DATA_CAPABILITY CapabilityStructure;
- UINT16 CxlDvsecLength;
- UINT16 CxlErrorLogLength;
- UINT32 Reserved;
-} __attribute__((packed, aligned(1))) EFI_CXL_PROTOCOL_ERROR_DATA;
-
-json_object *cper_section_cxl_protocol_to_ir(void *section);
-void ir_section_cxl_protocol_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-dmar-generic.c b/sections/cper-section-dmar-generic.c
index 6a28d88..9e5f06a 100644
--- a/sections/cper-section-dmar-generic.c
+++ b/sections/cper-section-dmar-generic.c
@@ -6,9 +6,9 @@
**/
#include <stdio.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-dmar-generic.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-dmar-generic.h>
//Converts a single generic DMAr CPER section into JSON IR.
json_object *cper_section_dmar_generic_to_ir(void *section)
diff --git a/sections/cper-section-dmar-generic.h b/sections/cper-section-dmar-generic.h
deleted file mode 100644
index e305c86..0000000
--- a/sections/cper-section-dmar-generic.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef CPER_SECTION_DMAR_GENERIC_H
-#define CPER_SECTION_DMAR_GENERIC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_KEYS \
- (int[]) \
- { \
- 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB \
- }
-#define DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_VALUES \
- (const char *[]) \
- { \
- "DMT Entry Missing", "DMT Entry Invalid", "DMT Access Error", \
- "DMT Reserved Bit Invalid", \
- "DMA Address Out of Bounds", "Invalid Read/Write", \
- "Invalid Device Request", "ATT Access Error", \
- "ATT Reserved Bit Invalid", "Illegal Command", \
- "Command Buffer Access Error" \
- }
-#define DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_DESCRIPTIONS \
- (const char *[]) \
- { \
- "Domain mapping table entry is not present.", \
- "Invalid domain mapping table entry.", \
- "DMAr unit's attempt to access the domain mapping table resulted in an error.", \
- "Reserved bit set to non-zero value in the domain mapping table.", \
- "DMA request to access an address beyond the device address width.", \
- "Invalid read or write access.", \
- "Invalid device request.", \
- "DMAr unit's attempt to access the address translation table resulted in an error.", \
- "Reserved bit set to non-zero value in the address translation table.", \
- "Illegal command error.", \
- "DMAr unit's attempt to access the command buffer resulted in an error." \
- }
-#define DMAR_GENERIC_ERROR_ACCESS_TYPES_KEYS \
- (int[]) \
- { \
- 0x0, 0x1 \
- }
-#define DMAR_GENERIC_ERROR_ACCESS_TYPES_VALUES \
- (const char *[]) \
- { \
- "DMA Write", "DMA Read" \
- }
-#define DMAR_GENERIC_ERROR_ADDRESS_TYPES_KEYS \
- (int[]) \
- { \
- 0x0, 0x1 \
- }
-#define DMAR_GENERIC_ERROR_ADDRESS_TYPES_VALUES \
- (const char *[]) \
- { \
- "Untranslated Request", "Translation Request" \
- }
-#define DMAR_GENERIC_ERROR_ARCH_TYPES_KEYS \
- (int[]) \
- { \
- 0x0, 0x1 \
- }
-#define DMAR_GENERIC_ERROR_ARCH_TYPES_VALUES \
- (const char *[]) \
- { \
- "VT-d", "IOMMU" \
- }
-
-json_object *cper_section_dmar_generic_to_ir(void *section);
-void ir_section_dmar_generic_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-dmar-iommu.c b/sections/cper-section-dmar-iommu.c
index 3606021..1f08376 100644
--- a/sections/cper-section-dmar-iommu.c
+++ b/sections/cper-section-dmar-iommu.c
@@ -7,10 +7,10 @@
#include <stdio.h>
#include <string.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-dmar-iommu.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-dmar-iommu.h>
//Converts a single IOMMU specific DMAr CPER section into JSON IR.
json_object *cper_section_dmar_iommu_to_ir(void *section)
diff --git a/sections/cper-section-dmar-iommu.h b/sections/cper-section-dmar-iommu.h
deleted file mode 100644
index 24204b7..0000000
--- a/sections/cper-section-dmar-iommu.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef CPER_SECTION_DMAR_IOMMU_H
-#define CPER_SECTION_DMAR_IOMMU_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-json_object *cper_section_dmar_iommu_to_ir(void *section);
-void ir_section_dmar_iommu_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-dmar-vtd.c b/sections/cper-section-dmar-vtd.c
index 88a4835..5c0016b 100644
--- a/sections/cper-section-dmar-vtd.c
+++ b/sections/cper-section-dmar-vtd.c
@@ -7,10 +7,10 @@
#include <stdio.h>
#include <string.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-dmar-vtd.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-dmar-vtd.h>
//Converts a single VT-d specific DMAr CPER section into JSON IR.
json_object *cper_section_dmar_vtd_to_ir(void *section)
diff --git a/sections/cper-section-dmar-vtd.h b/sections/cper-section-dmar-vtd.h
deleted file mode 100644
index 1d1e91e..0000000
--- a/sections/cper-section-dmar-vtd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef CPER_SECTION_DMAR_VTD_H
-#define CPER_SECTION_DMAR_VTD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define VTD_FAULT_RECORD_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1 \
- }
-#define VTD_FAULT_RECORD_TYPES_VALUES \
- (const char *[]) \
- { \
- "Write Request", "Read/AtomicOp Request" \
- }
-
-typedef struct {
- UINT64 Resv1 : 12;
- UINT64 FaultInformation : 52;
- UINT64 SourceIdentifier : 16;
- UINT64 Resv2 : 13;
- UINT64 PrivelegeModeRequested : 1;
- UINT64 ExecutePermissionRequested : 1;
- UINT64 PasidPresent : 1;
- UINT64 FaultReason : 8;
- UINT64 PasidValue : 20;
- UINT64 AddressType : 2;
- UINT64 Type : 1;
- UINT64 Resv3 : 1;
-} EFI_VTD_FAULT_RECORD;
-
-json_object *cper_section_dmar_vtd_to_ir(void *section);
-void ir_section_dmar_vtd_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-firmware.c b/sections/cper-section-firmware.c
index 3f17fe7..7316295 100644
--- a/sections/cper-section-firmware.c
+++ b/sections/cper-section-firmware.c
@@ -6,9 +6,9 @@
**/
#include <stdio.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-firmware.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-firmware.h>
//Converts a single firmware CPER section into JSON IR.
json_object *cper_section_firmware_to_ir(void *section)
diff --git a/sections/cper-section-firmware.h b/sections/cper-section-firmware.h
deleted file mode 100644
index c37ee1f..0000000
--- a/sections/cper-section-firmware.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef CPER_SECTION_FIRMWARE_H
-#define CPER_SECTION_FIRMWARE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define FIRMWARE_ERROR_RECORD_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2 \
- }
-#define FIRMWARE_ERROR_RECORD_TYPES_VALUES \
- (const char *[]) \
- { \
- "IPF SAL Error Record", \
- "SOC Firmware Error Record (Type1 Legacy)", \
- "SOC Firmware Error Record (Type2)" \
- }
-
-json_object *cper_section_firmware_to_ir(void *section);
-void ir_section_firmware_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-generic.c b/sections/cper-section-generic.c
index b803bc1..ebbd628 100644
--- a/sections/cper-section-generic.c
+++ b/sections/cper-section-generic.c
@@ -8,9 +8,9 @@
#include <stdio.h>
#include <string.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-generic.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-generic.h>
//Converts the given processor-generic CPER section into JSON IR.
json_object *cper_section_generic_to_ir(void *section)
diff --git a/sections/cper-section-generic.h b/sections/cper-section-generic.h
deleted file mode 100644
index 26fec69..0000000
--- a/sections/cper-section-generic.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef CPER_SECTION_GENERIC_H
-#define CPER_SECTION_GENERIC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define GENERIC_PROC_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2 \
- }
-#define GENERIC_PROC_TYPES_VALUES \
- (const char *[]) \
- { \
- "IA32/X64", "IA64", "ARM" \
- }
-#define GENERIC_ISA_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4 \
- }
-#define GENERIC_ISA_TYPES_VALUES \
- (const char *[]) \
- { \
- "IA32", "IA64", "X64", "ARM A32/T32", "ARM A64" \
- }
-#define GENERIC_ERROR_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 4, 8 \
- }
-#define GENERIC_ERROR_TYPES_VALUES \
- (const char *[]) \
- { \
- "Unknown", "Cache Error", "TLB Error", "Bus Error", \
- "Micro-Architectural Error" \
- }
-#define GENERIC_OPERATION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3 \
- }
-#define GENERIC_OPERATION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Unknown or Generic", "Data Read", "Data Write", \
- "Instruction Execution" \
- }
-#define GENERIC_VALIDATION_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "processorTypeValid", "processorISAValid", \
- "processorErrorTypeValid", "operationValid", \
- "flagsValid", "levelValid", "cpuVersionValid", \
- "cpuBrandInfoValid", "cpuIDValid", \
- "targetAddressValid", "requestorIDValid", \
- "responderIDValid", "instructionIPValid" \
- }
-#define GENERIC_FLAGS_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "restartable", "preciseIP", "overflow", "corrected" \
- }
-
-json_object *cper_section_generic_to_ir(void *section);
-void ir_section_generic_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-ia32x64.c b/sections/cper-section-ia32x64.c
index 2762867..bdeb4fa 100644
--- a/sections/cper-section-ia32x64.c
+++ b/sections/cper-section-ia32x64.c
@@ -7,10 +7,10 @@
#include <stdio.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-ia32x64.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-ia32x64.h>
//Private pre-definitions.
json_object *cper_ia32x64_processor_error_info_to_ir(
diff --git a/sections/cper-section-ia32x64.h b/sections/cper-section-ia32x64.h
deleted file mode 100644
index b087099..0000000
--- a/sections/cper-section-ia32x64.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef CPER_SECTION_IA32X64_H
-#define CPER_SECTION_IA32X64_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "checkInfoValid", "targetAddressIDValid", "requestorIDValid", \
- "responderIDValid", "instructionPointerValid" \
- }
-#define IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "transactionTypeValid", "operationValid", "levelValid", \
- "processorContextCorruptValid", "uncorrectedValid", \
- "preciseIPValid", "restartableIPValid", \
- "overflowValid", "participationTypeValid", \
- "timedOutValid", "addressSpaceValid" \
- }
-#define IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "errorTypeValid", "processorContextCorruptValid", \
- "uncorrectedValid", "preciseIPValid", \
- "restartableIPValid", "overflowValid" \
- }
-#define IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2 \
- }
-#define IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Instruction", "Data Access", "Generic" \
- }
-#define IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7, 8 \
- }
-#define IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Generic Error", "Generic Read", "Generic Write", "Data Read", \
- "Data Write", "Instruction Fetch", "Prefetch", \
- "Eviction", "Snoop" \
- }
-#define IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3 \
- }
-#define IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_VALUES \
- (const char *[]) \
- { \
- "Local processor originated request", \
- "Local processor responded to request", \
- "Local processor observed", "Generic" \
- }
-#define IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3 \
- }
-#define IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_VALUES \
- (const char *[]) \
- { \
- "Memory Access", "Reserved", "I/O", "Other Transaction" \
- }
-#define IA32X64_MS_CHECK_INFO_ERROR_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5 \
- }
-#define IA32X64_MS_CHECK_INFO_ERROR_TYPES_VALUES \
- (const char *[]) \
- { \
- "No Error", "Unclassified", "Microcode ROM Parity Error", \
- "External Error", "FRC Error", "Internal Unclassified" \
- }
-#define IA32X64_REGISTER_CONTEXT_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7 \
- }
-#define IA32X64_REGISTER_CONTEXT_TYPES_VALUES \
- (const char *[]) \
- { \
- "Unclassified Data", "MSR Registers", \
- "32-bit Mode Execution Context", \
- "64-bit Mode Execution Context", "FXSave Context", \
- "32-bit Mode Debug Registers", \
- "64-bit Mode Debug Registers", \
- "Memory Mapper Registers" \
- }
-
-typedef struct {
- UINT64 Eax;
- UINT64 Ebx;
- UINT64 Ecx;
- UINT64 Edx;
- UINT64 Reserved[2];
-} EFI_IA32_X64_CPU_ID;
-
-json_object *cper_section_ia32x64_to_ir(void *section);
-void ir_section_ia32x64_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-ipf.c b/sections/cper-section-ipf.c
index 3c47504..a8a4e8f 100644
--- a/sections/cper-section-ipf.c
+++ b/sections/cper-section-ipf.c
@@ -6,9 +6,9 @@
**/
#include <stdio.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-ipf.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-ipf.h>
json_object *cper_ipf_mod_error_read_array(EFI_IPF_MOD_ERROR_INFO **cur_error,
int num_to_read);
diff --git a/sections/cper-section-ipf.h b/sections/cper-section-ipf.h
deleted file mode 100644
index 02cc025..0000000
--- a/sections/cper-section-ipf.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef CPER_SECTION_IPF_H
-#define CPER_SECTION_IPF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define IPF_MOD_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "checkInfoValid", "requestorIdentifierValid", \
- "responderIdentifierValid", "targetIdentifierValid", \
- "preciseIPValid" \
- }
-#define IPF_PSI_STATIC_INFO_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "minstateValid", "brValid", "crValid", "arValid", "rrValid", \
- "frValid" \
- }
-
-///
-/// IPF Error Record Section
-/// Defined as according to B.2.3 of the ItaniumTM Processor Family System Abstraction Layer (SAL) Specification.
-///
-typedef struct {
- UINT64 ProcErrorMapValid : 1;
- UINT64 ProcStateParameterValid : 1;
- UINT64 ProcCrLidValid : 1;
- UINT64 PsiStaticStructValid : 1;
- UINT64 CacheCheckNum : 4;
- UINT64 TlbCheckNum : 4;
- UINT64 BusCheckNum : 4;
- UINT64 RegFileCheckNum : 4;
- UINT64 MsCheckNum : 4;
- UINT64 CpuIdInfoValid : 1;
- UINT64 Reserved : 39;
-} EPI_IPF_ERROR_VALID_BITS;
-
-typedef struct {
- EPI_IPF_ERROR_VALID_BITS ValidBits;
- UINT64 ProcErrorMap;
- UINT64 ProcStateParameter;
- UINT64 ProcCrLid;
-} EFI_IPF_ERROR_INFO_HEADER;
-
-typedef struct {
- UINT64 ValidBits;
- UINT64 ModCheckInfo;
- UINT64 ModTargetId;
- UINT64 ModRequestorId; //NOTE: The Intel Itanium specification contains a typo which makes the order
- UINT64 ModResponderId; // of these two fields undefined. This is a best guess and could be wrong.
- UINT64 ModPreciseIp;
-} EFI_IPF_MOD_ERROR_INFO;
-
-typedef struct {
- UINT8 CpuIdInfo[40];
- UINT8 Reserved1[8];
-} EFI_IPF_CPU_INFO;
-
-typedef struct {
- UINT64 ValidBits;
- UINT8 MinimalSaveStateInfo[1024];
- UINT64 Brs[8];
- UINT64 Crs[128];
- UINT64 Ars[128];
- UINT64 Rrs[8];
- UINT64 Frs[256];
-} EFI_IPF_PSI_STATIC;
-
-json_object *cper_section_ipf_to_ir(void *section);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-memory.c b/sections/cper-section-memory.c
index 073041d..68e63af 100644
--- a/sections/cper-section-memory.c
+++ b/sections/cper-section-memory.c
@@ -6,9 +6,9 @@
**/
#include <stdio.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-memory.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-memory.h>
//Converts a single memory error CPER section into JSON IR.
json_object *cper_section_platform_memory_to_ir(void *section)
diff --git a/sections/cper-section-memory.h b/sections/cper-section-memory.h
deleted file mode 100644
index ed2bc70..0000000
--- a/sections/cper-section-memory.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef CPER_SECTION_MEMORY_H
-#define CPER_SECTION_MEMORY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define MEMORY_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "errorStatusValid", "physicalAddressValid", \
- "physicalAddressMaskValid", "nodeValid", "cardValid", \
- "moduleValid", "bankValid", "deviceValid", "rowValid", \
- "columnValid", "bitPositionValid", \
- "platformRequestorIDValid", \
- "platformResponderIDValid", \
- "memoryPlatformTargetValid", "memoryErrorTypeValid", \
- "rankNumberValid", "cardHandleValid", \
- "moduleHandleValid", "extendedRowBitsValid", \
- "bankGroupValid", "bankAddressValid", \
- "chipIdentificationValid" \
- }
-#define MEMORY_ERROR_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 \
- }
-#define MEMORY_ERROR_TYPES_VALUES \
- (const char *[]) \
- { \
- "Unknown", "No Error", "Single-bit ECC", "Multi-bit ECC", \
- "Single-symbol ChipKill ECC", \
- "Multi-symbol ChipKill ECC", "Master Abort", \
- "Target Abort", "Parity Error", "Watchdog Timeout", \
- "Invalid Address", "Mirror Broken", "Memory Sparing", \
- "Scrub Corrected Error", "Scrub Uncorrected Error", \
- "Physical Memory Map-out Event" \
- }
-#define MEMORY_ERROR_2_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "errorStatusValid", "physicalAddressValid", \
- "physicalAddressMaskValid", "nodeValid", "cardValid", \
- "moduleValid", "bankValid", "deviceValid", "rowValid", \
- "columnValid", "rankValid", "bitPositionValid", \
- "chipIDValid", "memoryErrorTypeValid", "statusValid", \
- "requestorIDValid", "responderIDValid", \
- "targetIDValid", "cardHandleValid", \
- "moduleHandleValid", "bankGroupValid", \
- "bankAddressValid" \
- }
-
-json_object *cper_section_platform_memory_to_ir(void *section);
-json_object *cper_section_platform_memory2_to_ir(void *section);
-void ir_section_memory_to_cper(json_object *section, FILE *out);
-void ir_section_memory2_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-nvidia.c b/sections/cper-section-nvidia.c
index 259eef1..d5587c5 100644
--- a/sections/cper-section-nvidia.c
+++ b/sections/cper-section-nvidia.c
@@ -7,9 +7,9 @@
#include <stddef.h>
#include <string.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-nvidia.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-nvidia.h>
//Converts a single NVIDIA CPER section into JSON IR.
json_object *cper_section_nvidia_to_ir(void *section)
diff --git a/sections/cper-section-nvidia.h b/sections/cper-section-nvidia.h
deleted file mode 100644
index c3b9deb..0000000
--- a/sections/cper-section-nvidia.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef CPER_SECTION_NVIDIA_H
-#define CPER_SECTION_NVIDIA_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-json_object *cper_section_nvidia_to_ir(void *section);
-void ir_section_nvidia_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-pci-bus.c b/sections/cper-section-pci-bus.c
index a4fc3c8..154c1cf 100644
--- a/sections/cper-section-pci-bus.c
+++ b/sections/cper-section-pci-bus.c
@@ -7,9 +7,9 @@
#include <stdio.h>
#include <string.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-pci-bus.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-pci-bus.h>
//Converts a single PCI/PCI-X bus CPER section into JSON IR.
json_object *cper_section_pci_bus_to_ir(void *section)
diff --git a/sections/cper-section-pci-bus.h b/sections/cper-section-pci-bus.h
deleted file mode 100644
index 69e2522..0000000
--- a/sections/cper-section-pci-bus.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef CPER_SECTION_PCI_BUS_H
-#define CPER_SECTION_PCI_BUS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define PCI_BUS_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "errorStatusValid", "errorTypeValid", "busIDValid", \
- "busAddressValid", "busDataValid", "commandValid", \
- "requestorIDValid", "completerIDValid", \
- "targetIDValid" \
- }
-#define PCI_BUS_ERROR_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 2, 3, 4, 5, 6, 7 \
- }
-#define PCI_BUS_ERROR_TYPES_VALUES \
- (const char *[]) \
- { \
- "Unknown/OEM Specific Error", "Data Parity Error", \
- "System Error", "Master Abort", \
- "Bus Timeout/No Device Present (No DEVSEL#)", \
- "Master Data Parity Error", "Address Parity Error", \
- "Command Parity Error" \
- }
-
-json_object *cper_section_pci_bus_to_ir(void *section);
-void ir_section_pci_bus_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-pci-dev.c b/sections/cper-section-pci-dev.c
index 5245e3f..ccf9f0c 100644
--- a/sections/cper-section-pci-dev.c
+++ b/sections/cper-section-pci-dev.c
@@ -6,9 +6,9 @@
**/
#include <stdio.h>
#include <json.h>
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-pci-dev.h"
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-pci-dev.h>
//Converts a single PCI/PCI-X device CPER section into JSON IR.
json_object *cper_section_pci_dev_to_ir(void *section)
diff --git a/sections/cper-section-pci-dev.h b/sections/cper-section-pci-dev.h
deleted file mode 100644
index 3ceba5a..0000000
--- a/sections/cper-section-pci-dev.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef CPER_SECTION_PCI_DEV_H
-#define CPER_SECTION_PCI_DEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define PCI_DEV_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "errorStatusValid", "idInfoValid", "memoryNumberValid", \
- "ioNumberValid", "registerDataPairsValid" \
- }
-
-///
-/// PCI/PCI-X Device Error Section
-///
-typedef struct {
- UINT64 VendorId : 16;
- UINT64 DeviceId : 16;
- UINT64 ClassCode : 24;
- UINT64 FunctionNumber : 8;
- UINT64 DeviceNumber : 8;
- UINT64 BusNumber : 8;
- UINT64 SegmentNumber : 8;
- UINT64 Reserved : 40;
-} EFI_PCI_PCIX_DEVICE_ID_INFO;
-
-typedef struct {
- UINT64 ValidFields;
- EFI_GENERIC_ERROR_STATUS ErrorStatus;
- EFI_PCI_PCIX_DEVICE_ID_INFO IdInfo;
- UINT32 MemoryNumber;
- UINT32 IoNumber;
-} __attribute__((packed, aligned(1))) EFI_PCI_PCIX_DEVICE_ERROR_DATA;
-
-json_object *cper_section_pci_dev_to_ir(void *section);
-void ir_section_pci_dev_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section-pcie.c b/sections/cper-section-pcie.c
index fa6b0b2..ecf6d52 100644
--- a/sections/cper-section-pcie.c
+++ b/sections/cper-section-pcie.c
@@ -7,10 +7,10 @@
#include <stdio.h>
#include <string.h>
#include <json.h>
-#include "base64.h"
-#include "Cper.h"
-#include "../cper-utils.h"
-#include "cper-section-pcie.h"
+#include <libcper/base64.h>
+#include <libcper/Cper.h>
+#include <libcper/cper-utils.h>
+#include <libcper/sections/cper-section-pcie.h>
//Converts a single PCIe CPER section into JSON IR.
json_object *cper_section_pcie_to_ir(void *section)
diff --git a/sections/cper-section-pcie.h b/sections/cper-section-pcie.h
deleted file mode 100644
index 1a2d729..0000000
--- a/sections/cper-section-pcie.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef CPER_SECTION_PCIE_H
-#define CPER_SECTION_PCIE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include "Cper.h"
-
-#define PCIE_ERROR_VALID_BITFIELD_NAMES \
- (const char *[]) \
- { \
- "portTypeValid", "versionValid", "commandStatusValid", \
- "deviceIDValid", "deviceSerialNumberValid", \
- "bridgeControlStatusValid", \
- "capabilityStructureStatusValid", "aerInfoValid" \
- }
-#define PCIE_ERROR_PORT_TYPES_KEYS \
- (int[]) \
- { \
- 0, 1, 4, 5, 6, 7, 8, 9, 10 \
- }
-#define PCIE_ERROR_PORT_TYPES_VALUES \
- (const char *[]) \
- { \
- "PCI Express End Point", "Legacy PCI End Point Device", \
- "Root Port", "Upstream Switch Port", \
- "Downstream Switch Port", \
- "PCI Express to PCI/PCI-X Bridge", \
- "PCI/PCI-X Bridge to PCI Express Bridge", \
- "Root Complex Integrated Endpoint Device", \
- "Root Complex Event Collector" \
- }
-
-json_object *cper_section_pcie_to_ir(void *section);
-void ir_section_pcie_to_cper(json_object *section, FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sections/cper-section.c b/sections/cper-section.c
index 11832c8..f027c2d 100644
--- a/sections/cper-section.c
+++ b/sections/cper-section.c
@@ -3,25 +3,25 @@
*
* Author: Lawrence.Tang@arm.com
**/
-#include "Cper.h"
-#include "cper-section.h"
-#include "cper-section-arm.h"
-#include "cper-section-generic.h"
-#include "cper-section-ia32x64.h"
-#include "cper-section-ipf.h"
-#include "cper-section-memory.h"
-#include "cper-section-pcie.h"
-#include "cper-section-firmware.h"
-#include "cper-section-pci-bus.h"
-#include "cper-section-pci-dev.h"
-#include "cper-section-dmar-generic.h"
-#include "cper-section-dmar-vtd.h"
-#include "cper-section-dmar-iommu.h"
-#include "cper-section-ccix-per.h"
-#include "cper-section-cxl-protocol.h"
-#include "cper-section-cxl-component.h"
-#include "cper-section-nvidia.h"
-#include "cper-section-ampere.h"
+#include <libcper/Cper.h>
+#include <libcper/sections/cper-section.h>
+#include <libcper/sections/cper-section-arm.h>
+#include <libcper/sections/cper-section-generic.h>
+#include <libcper/sections/cper-section-ia32x64.h>
+#include <libcper/sections/cper-section-ipf.h>
+#include <libcper/sections/cper-section-memory.h>
+#include <libcper/sections/cper-section-pcie.h>
+#include <libcper/sections/cper-section-firmware.h>
+#include <libcper/sections/cper-section-pci-bus.h>
+#include <libcper/sections/cper-section-pci-dev.h>
+#include <libcper/sections/cper-section-dmar-generic.h>
+#include <libcper/sections/cper-section-dmar-vtd.h>
+#include <libcper/sections/cper-section-dmar-iommu.h>
+#include <libcper/sections/cper-section-ccix-per.h>
+#include <libcper/sections/cper-section-cxl-protocol.h>
+#include <libcper/sections/cper-section-cxl-component.h>
+#include <libcper/sections/cper-section-nvidia.h>
+#include <libcper/sections/cper-section-ampere.h>
//Definitions of all sections available to the CPER parser.
CPER_SECTION_DEFINITION section_definitions[] = {
diff --git a/sections/cper-section.h b/sections/cper-section.h
deleted file mode 100644
index dec0b1b..0000000
--- a/sections/cper-section.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef CPER_SECTION_H
-#define CPER_SECTION_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <json.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "Cper.h"
-
-//Definition structure for a single CPER section type.
-typedef struct {
- EFI_GUID *Guid;
- const char *ReadableName;
- const char *ShortName;
- json_object *(*ToIR)(void *);
- void (*ToCPER)(json_object *, FILE *);
-} CPER_SECTION_DEFINITION;
-
-extern CPER_SECTION_DEFINITION section_definitions[];
-extern const size_t section_definitions_len;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif