Fix ArmProcessor ErrorInformation types
ErrorInformation currently has 2 supported formats according to the
libcper schema, cacheError and tlbError. Remove "unknown" microarch
types as we need correctly formatted output only.
Add a property name to identify which ErrorInformation type has been
detected in the cper record
Tested:
Used cper-convert to-json to convert a known good cper to json
Used cper-convert to-cper to convert same json to cper
json was generated again and validated against schema
Change-Id: I510f2ae7fef195721b618065c6ef643ab1191b76
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/sections/cper-section-arm.c b/sections/cper-section-arm.c
index b0b14d1..d172a99 100644
--- a/sections/cper-section-arm.c
+++ b/sections/cper-section-arm.c
@@ -196,12 +196,7 @@
break;
default:
- //Unknown/microarch, so can't be made readable. Simply dump as a uint64 data object.
- error_subinfo = json_object_new_object();
- json_object_object_add(
- error_subinfo, "data",
- json_object_new_uint64(
- error_info->ErrorInformation.Value));
+ //Unknown/microarch, will not support.
break;
}
json_object_object_add(error_info_ir, "errorInformation",
@@ -224,6 +219,8 @@
EFI_ARM_ERROR_INFORMATION_ENTRY *error_info)
{
json_object *cache_tlb_error_ir = json_object_new_object();
+ json_object *cache_tlb_prop = json_object_new_object();
+ char *cache_tlb_propname;
//Validation bitfield.
json_object *validation =
@@ -249,12 +246,14 @@
ARM_CACHE_BUS_OPERATION_TYPES_KEYS,
ARM_CACHE_BUS_OPERATION_TYPES_VALUES,
"Unknown (Reserved)");
+ cache_tlb_propname = "cacheError";
} else {
//TLB operation.
operation = integer_to_readable_pair(
cache_tlb_error->Operation, 9,
ARM_TLB_OPERATION_TYPES_KEYS,
ARM_TLB_OPERATION_TYPES_VALUES, "Unknown (Reserved)");
+ cache_tlb_propname = "tlbError";
}
json_object_object_add(cache_tlb_error_ir, "operation", operation);
@@ -274,7 +273,10 @@
json_object_object_add(
cache_tlb_error_ir, "restartablePC",
json_object_new_boolean(cache_tlb_error->RestartablePC));
- return cache_tlb_error_ir;
+
+ json_object_object_add(cache_tlb_prop, cache_tlb_propname,
+ cache_tlb_error_ir);
+ return cache_tlb_prop;
}
//Converts a single ARM bus error information structure into JSON IR format.
@@ -594,11 +596,21 @@
//Error information.
json_object *error_info_information =
json_object_object_get(error_info, "errorInformation");
+ json_object *error_info_prop = NULL;
+
switch (error_info_cper.Type) {
case ARM_ERROR_INFORMATION_TYPE_CACHE:
- case ARM_ERROR_INFORMATION_TYPE_TLB:
+ error_info_prop = json_object_object_get(error_info_information,
+ "cacheError");
ir_arm_error_cache_tlb_info_to_cper(
- error_info_information,
+ error_info_prop,
+ &error_info_cper.ErrorInformation.CacheError);
+ break;
+ case ARM_ERROR_INFORMATION_TYPE_TLB:
+ error_info_prop = json_object_object_get(error_info_information,
+ "tlbError");
+ ir_arm_error_cache_tlb_info_to_cper(
+ error_info_prop,
&error_info_cper.ErrorInformation.CacheError);
break;
@@ -610,8 +622,6 @@
default:
//Unknown error information type.
- error_info_cper.ErrorInformation.Value = json_object_get_uint64(
- json_object_object_get(error_info_information, "data"));
break;
}