Add CXL component GUIDs, b64 dumps for unknown.
diff --git a/sections/cper-section-arm.c b/sections/cper-section-arm.c
index b8def2b..58e97bf 100644
--- a/sections/cper-section-arm.c
+++ b/sections/cper-section-arm.c
@@ -7,6 +7,7 @@
#include <stdio.h>
#include "json.h"
+#include "b64.h"
#include "../edk/Cper.h"
#include "../cper-utils.h"
#include "cper-section-arm.h"
@@ -72,7 +73,12 @@
//Is there any vendor-specific information following?
if (cur_pos < section + record->SectionLength)
{
- //todo: b64 and tag on vendor-specific binary info.
+ json_object* vendor_specific = json_object_new_object();
+ char* encoded = b64_encode((unsigned char*)cur_pos, section + record->SectionLength - cur_pos);
+ json_object_object_add(vendor_specific, "data", json_object_new_string(encoded));
+ free(encoded);
+
+ json_object_object_add(section_ir, "vendorSpecificInfo", vendor_specific);
}
return section_ir;
@@ -291,9 +297,11 @@
register_array = cper_arm_misc_register_array_to_ir((EFI_ARM_MISC_CONTEXT_REGISTER*)cur_pos);
break;
default:
- //Unknown register array type.
- //todo: Format raw binary data and add instead of blank.
+ //Unknown register array type, add as base64 data instead.
register_array = json_object_new_object();
+ char* encoded = b64_encode((unsigned char*)cur_pos, header->RegisterArraySize);
+ json_object_object_add(register_array, "data", json_object_new_string(encoded));
+ free(encoded);
break;
}
diff --git a/sections/cper-section-cxl-component.c b/sections/cper-section-cxl-component.c
new file mode 100644
index 0000000..ab3b34f
--- /dev/null
+++ b/sections/cper-section-cxl-component.c
@@ -0,0 +1,23 @@
+/**
+ * Describes functions for converting CXL component error CPER sections from binary and JSON format
+ * into an intermediate format.
+ *
+ * Author: Lawrence.Tang@arm.com
+ **/
+#include <stdio.h>
+#include "json.h"
+#include "../edk/Cper.h"
+#include "../cper-utils.h"
+#include "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, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+{
+ //The length of the structure (bytes).
+ EFI_CXL_COMPONENT_EVENT_HEADER* cxl_error = (EFI_CXL_COMPONENT_EVENT_HEADER*)section;
+ json_object* section_ir = json_object_new_object();
+
+ //todo: Figure out structure for CXL Component Event log (UEFI spec is a bit vague)
+
+ return section_ir;
+}
\ No newline at end of file
diff --git a/sections/cper-section-cxl-component.h b/sections/cper-section-cxl-component.h
new file mode 100644
index 0000000..17dcedf
--- /dev/null
+++ b/sections/cper-section-cxl-component.h
@@ -0,0 +1,35 @@
+#ifndef CPER_SECTION_CXL_COMPONENT_H
+#define CPER_SECTION_CXL_COMPONENT_H
+
+#include "json.h"
+#include "../edk/Cper.h"
+
+///
+/// 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;
+} EFI_CXL_DEVICE_ID_INFO;
+
+typedef struct {
+ UINT32 Length;
+ UINT64 ValidBits;
+ EFI_CXL_DEVICE_ID_INFO DeviceId;
+ UINT64 DeviceSerial;
+} EFI_CXL_COMPONENT_EVENT_HEADER;
+
+typedef struct {
+ //todo: What is the structure for this? The UEFI spec is a bit vague.
+} EFI_CXL_COMPONENT_COMMON_RECORD_HEAD;
+
+json_object* cper_section_cxl_component_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor);
+
+#endif
\ No newline at end of file
diff --git a/sections/cper-section-dmar-iommu.c b/sections/cper-section-dmar-iommu.c
index 14d66a3..1f479aa 100644
--- a/sections/cper-section-dmar-iommu.c
+++ b/sections/cper-section-dmar-iommu.c
@@ -6,6 +6,7 @@
**/
#include <stdio.h>
#include "json.h"
+#include "b64.h"
#include "../edk/Cper.h"
#include "../cper-utils.h"
#include "cper-section-dmar-iommu.h"
@@ -26,8 +27,10 @@
//IOMMU event log entry.
//todo: implement as specified in the IOMMU specification
- //Device table entry.
- //todo: dump as b64
+ //Device table entry (as base64).
+ char* encoded = b64_encode((unsigned char*)iommu_error->DeviceTableEntry, 32);
+ json_object_object_add(section_ir, "deviceTableEntry", json_object_new_string(encoded));
+ free(encoded);
//Page table entries.
json_object_object_add(section_ir, "pageTableEntry_Level6", json_object_new_uint64(iommu_error->PteL6));
diff --git a/sections/cper-section-ia32x64.c b/sections/cper-section-ia32x64.c
index bfe7d6e..5dbad18 100644
--- a/sections/cper-section-ia32x64.c
+++ b/sections/cper-section-ia32x64.c
@@ -7,6 +7,7 @@
#include <stdio.h>
#include "json.h"
+#include "b64.h"
#include "../edk/Cper.h"
#include "../cper-utils.h"
#include "cper-section-ia32x64.h"
@@ -248,9 +249,14 @@
}
else
{
- //No parseable data, just shift the head to the next item.
- //todo: Dump the unparseable data into JSON IR anyway
+ //No parseable data, just dump as base64 and shift the head to the next item.
*cur_pos = (void*)(context_info + 1);
+
+ char* encoded = b64_encode((unsigned char*)cur_pos, context_info->ArraySize);
+ register_array = json_object_new_object();
+ json_object_object_add(register_array, "data", json_object_new_string(encoded));
+ free(encoded);
+
*cur_pos = (void*)(((char*)*cur_pos) + context_info->ArraySize);
}
json_object_object_add(context_info_ir, "registerArray", register_array);
diff --git a/sections/cper-section-pci-dev.h b/sections/cper-section-pci-dev.h
index 43d36ea..02c6b4f 100644
--- a/sections/cper-section-pci-dev.h
+++ b/sections/cper-section-pci-dev.h
@@ -11,14 +11,14 @@
/// PCI/PCI-X Device Error Section
///
typedef struct {
- UINT64 VendorId : 2;
- UINT64 DeviceId : 2;
- UINT64 ClassCode : 3;
- UINT64 FunctionNumber : 1;
- UINT64 DeviceNumber : 1;
- UINT64 BusNumber : 1;
- UINT64 SegmentNumber : 1;
- UINT64 Reserved : 5;
+ 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 {