Remove validation bits
Discard invalid properties from json decode. JSON output should only
contain valid properties. This saves time in preventing post
processing of output for valid fields.
Ensure round trip validity with validation bits removed and required
properties populated.
Fix bugs in json decode.
Overhaul unit tests to use valijson. Add tests with static examples
to validate against schema. Use and nlohmann for better schema
validation over intrinsic libcper validation.
Example json output before:
{
"ValidationBits": {
"LevelValid": false,
"CorrectedValid": true
},
"Level": 1,
"Corrected": true
}
After:
{
"Corrected": true
}
Change-Id: I188bdc2827a57d938c22a431238fadfcdc939ab8
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/specification/json/sections/cper-ia32x64-processor.json b/specification/json/sections/cper-ia32x64-processor.json
index 3f41564..ecf203e 100644
--- a/specification/json/sections/cper-ia32x64-processor.json
+++ b/specification/json/sections/cper-ia32x64-processor.json
@@ -1,40 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
- "required": [
- "validationBits",
- "localAPICID",
- "cpuidInfo",
- "processorErrorInfo",
- "processorContextInfo"
- ],
+ "required": ["processorErrorInfoNum", "processorContextInfoNum"],
"additionalProperties": false,
"properties": {
- "validationBits": {
- "type": "object",
- "description": "Indicates which fields are valid in the section.",
- "required": [
- "localAPICIDValid",
- "cpuIDInfoValid",
- "processorErrorInfoNum",
- "processorContextInfoNum"
- ],
- "properties": {
- "localAPICIDValid": {
- "type": "boolean"
- },
- "cpuIDInfoValid": {
- "type": "boolean"
- },
- "processorErrorInfoNum": {
- "type": "integer",
- "minimum": 0
- },
- "processorContextInfoNum": {
- "type": "integer",
- "minimum": 0
- }
- }
+ "processorErrorInfoNum": {
+ "type": "integer",
+ "description": "This is the number of Error Information structures."
+ },
+ "processorContextInfoNum": {
+ "type": "integer",
+ "description": "This is the number of Context Information structures."
},
"localAPICID": {
"type": "integer",
@@ -64,15 +40,7 @@
"description": "Array of processor error information structure.",
"items": {
"type": "object",
- "required": [
- "type",
- "validationBits",
- "checkInfo",
- "targetAddressID",
- "requestorID",
- "responderID",
- "instructionPointer"
- ],
+ "required": ["type"],
"additionalProperties": false,
"properties": {
"type": {
@@ -87,92 +55,15 @@
}
}
},
- "validationBits": {
- "type": "object",
- "required": [
- "checkInfoValid",
- "targetAddressIDValid",
- "requestorIDValid",
- "responderIDValid",
- "instructionPointerValid"
- ],
- "additionalProperties": false,
- "properties": {
- "checkInfoValid": {
- "type": "boolean"
- },
- "targetAddressIDValid": {
- "type": "boolean"
- },
- "requestorIDValid": {
- "type": "boolean"
- },
- "responderIDValid": {
- "type": "boolean"
- },
- "instructionPointerValid": {
- "type": "boolean"
- }
- }
- },
"checkInfo": {
"type": "object",
"oneOf": [
{
"$id": "cper-json-checkinfo0",
"type": "object",
- "required": [
- "validationBits",
- "transactionType",
- "operation",
- "level",
- "processorContextCorrupt",
- "uncorrected",
- "preciseIP",
- "restartableIP",
- "overflow"
- ],
+ "required": [],
"additionalProperties": false,
"properties": {
- "validationBits": {
- "type": "object",
- "required": [
- "transactionTypeValid",
- "operationValid",
- "levelValid",
- "processorContextCorruptValid",
- "uncorrectedValid",
- "preciseIPValid",
- "restartableIPValid",
- "overflowValid"
- ],
- "properties": {
- "transactionTypeValid": {
- "type": "boolean"
- },
- "operationValid": {
- "type": "boolean"
- },
- "levelValid": {
- "type": "boolean"
- },
- "processorContextCorruptValid": {
- "type": "boolean"
- },
- "uncorrectedValid": {
- "type": "boolean"
- },
- "preciseIPValid": {
- "type": "boolean"
- },
- "restartableIPValid": {
- "type": "boolean"
- },
- "overflowValid": {
- "type": "boolean"
- }
- }
- },
"transactionType": {
"type": "object",
"$ref": "./common/cper-json-nvp.json"
@@ -205,73 +96,9 @@
{
"$id": "cper-json-checkinfo1",
"type": "object",
- "required": [
- "validationBits",
- "transactionType",
- "operation",
- "level",
- "processorContextCorrupt",
- "uncorrected",
- "preciseIP",
- "restartableIP",
- "overflow",
- "participationType",
- "timedOut",
- "addressSpace"
- ],
+ "required": [],
"additionalProperties": false,
"properties": {
- "validationBits": {
- "type": "object",
- "required": [
- "transactionTypeValid",
- "operationValid",
- "levelValid",
- "processorContextCorruptValid",
- "uncorrectedValid",
- "preciseIPValid",
- "restartableIPValid",
- "overflowValid",
- "participationTypeValid",
- "timedOutValid",
- "addressSpaceValid"
- ],
- "properties": {
- "transactionTypeValid": {
- "type": "boolean"
- },
- "operationValid": {
- "type": "boolean"
- },
- "levelValid": {
- "type": "boolean"
- },
- "processorContextCorruptValid": {
- "type": "boolean"
- },
- "uncorrectedValid": {
- "type": "boolean"
- },
- "preciseIPValid": {
- "type": "boolean"
- },
- "restartableIPValid": {
- "type": "boolean"
- },
- "overflowValid": {
- "type": "boolean"
- },
- "participationTypeValid": {
- "type": "boolean"
- },
- "timedOutValid": {
- "type": "boolean"
- },
- "addressSpaceValid": {
- "type": "boolean"
- }
- }
- },
"transactionType": {
"type": "object",
"$ref": "./common/cper-json-nvp.json"
@@ -318,37 +145,6 @@
"required": [],
"additionalProperties": false,
"properties": {
- "validationBits": {
- "type": "object",
- "required": [
- "errorTypeValid",
- "processorContextCorruptValid",
- "uncorrectedValid",
- "preciseIPValid",
- "restartableIPValid",
- "overflowValid"
- ],
- "properties": {
- "errorTypeValid": {
- "type": "boolean"
- },
- "processorContextCorruptValid": {
- "type": "boolean"
- },
- "uncorrectedValid": {
- "type": "boolean"
- },
- "preciseIPValid": {
- "type": "boolean"
- },
- "restartableIPValid": {
- "type": "boolean"
- },
- "overflowValid": {
- "type": "boolean"
- }
- }
- },
"errorType": {
"type": "object",
"$ref": "./common/cper-json-nvp.json"