Include hex decode for human readable fields
Hexadecimal decode for some fields like deviceAddress
make sense to be represented in hex over decimal to make
scripting and human-usability easier.
Change-Id: I7d0d100162bc681c3c6885ca01ed23020c3b5063
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/sections/cper-section-memory.c b/sections/cper-section-memory.c
index 68e63af..4aeae43 100644
--- a/sections/cper-section-memory.c
+++ b/sections/cper-section-memory.c
@@ -70,6 +70,13 @@
json_object_object_add(
section_ir, "physicalAddress",
json_object_new_uint64(memory_error->PhysicalAddress));
+
+ char hexstring_buf[EFI_UINT64_HEX_STRING_LEN];
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%016llX",
+ memory_error->PhysicalAddress);
+ json_object_object_add(section_ir, "physicalAddressHex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(
section_ir, "physicalAddressMask",
json_object_new_uint64(memory_error->PhysicalAddressMask));
@@ -167,6 +174,13 @@
json_object_object_add(
section_ir, "physicalAddress",
json_object_new_uint64(memory_error->PhysicalAddress));
+
+ char hexstring_buf[EFI_UINT64_HEX_STRING_LEN];
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%016llX",
+ memory_error->PhysicalAddress);
+ json_object_object_add(section_ir, "physicalAddressHex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(
section_ir, "physicalAddressMask",
json_object_new_uint64(memory_error->PhysicalAddressMask));
diff --git a/sections/cper-section-pci-bus.c b/sections/cper-section-pci-bus.c
index 154c1cf..ab6e921 100644
--- a/sections/cper-section-pci-bus.c
+++ b/sections/cper-section-pci-bus.c
@@ -52,10 +52,23 @@
json_object_object_add(
section_ir, "busCommandType",
json_object_new_string(command_type == 0 ? "PCI" : "PCI-X"));
+
json_object_object_add(section_ir, "busRequestorID",
json_object_new_uint64(bus_error->RequestorId));
+
+ char hexstring_buf[EFI_UINT64_HEX_STRING_LEN];
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%016llX",
+ bus_error->RequestorId);
+ json_object_object_add(section_ir, "busRequestorIDHex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(section_ir, "busCompleterID",
json_object_new_uint64(bus_error->ResponderId));
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%016llX",
+ bus_error->ResponderId);
+ json_object_object_add(section_ir, "busCompleterIDHex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(section_ir, "targetID",
json_object_new_uint64(bus_error->TargetId));
diff --git a/sections/cper-section-pcie.c b/sections/cper-section-pcie.c
index 41cebb3..ae91cc1 100644
--- a/sections/cper-section-pcie.c
+++ b/sections/cper-section-pcie.c
@@ -71,6 +71,13 @@
json_object_object_add(
device_id, "deviceID",
json_object_new_uint64(pcie_error->DevBridge.DeviceId));
+
+ char hexstring_buf[EFI_UINT64_HEX_STRING_LEN];
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%0X",
+ pcie_error->DevBridge.DeviceId);
+ json_object_object_add(device_id, "deviceIDHex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(device_id, "classCode",
json_object_new_uint64(class_id));
json_object_object_add(
@@ -154,6 +161,13 @@
json_object_object_add(
aer_capability_ir, "uncorrectable_error_status",
json_object_new_uint64(aer_decode->uncorrectable_error_status));
+
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%08" PRIX32,
+ aer_decode->uncorrectable_error_status);
+ json_object_object_add(aer_capability_ir,
+ "uncorrectable_error_status_hex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(
aer_capability_ir, "uncorrectable_error_mask",
json_object_new_uint64(aer_decode->uncorrectable_error_mask));
@@ -164,6 +178,13 @@
json_object_object_add(
aer_capability_ir, "correctable_error_status",
json_object_new_uint64(aer_decode->correctable_error_status));
+
+ snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%08" PRIX32,
+ aer_decode->correctable_error_status);
+ json_object_object_add(aer_capability_ir,
+ "correctable_error_status_hex",
+ json_object_new_string(hexstring_buf));
+
json_object_object_add(
aer_capability_ir, "correctable_error_mask",
json_object_new_uint64(aer_decode->correctable_error_mask));