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/generator/sections/gen-section-ccix-per.c b/generator/sections/gen-section-ccix-per.c
index 0784d34..e648cba 100644
--- a/generator/sections/gen-section-ccix-per.c
+++ b/generator/sections/gen-section-ccix-per.c
@@ -11,7 +11,8 @@
//Generates a single pseudo-random CCIX PER error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_ccix_per(void **location)
+size_t generate_section_ccix_per(void **location,
+ GEN_VALID_BITS_TEST_TYPE validBitsType)
{
//Create a random length for the CCIX PER log.
//The log attached here does not necessarily conform to the CCIX specification, and is simply random.
@@ -25,6 +26,11 @@
UINT32 *validation = (UINT32 *)(bytes + 4);
*validation &= 0x7; //Validation bits 3-63.
*(validation + 1) = 0; //Validation bits 3-63.
+ if (validBitsType == ALL_VALID) {
+ *validation = 0x7;
+ } else if (validBitsType == SOME_VALID) {
+ *validation = 0x5;
+ }
*(bytes + 13) &= 0x1F; //CCIX port ID bits 5-7.
UINT16 *reserved = (UINT16 *)(bytes + 14);
*reserved = 0; //Reserved bytes 14-15.