cper-section-memory: Fix validation dependency for Extended field bits
Fixed incorrect dependency between validation bits 16, 17, and 18 for
the Extended field. Previously, cardSmbiosHandle (validation bit 16)
and moduleSmbiosHandle (validation bit 17) were incorrectly made
dependent on the Extended field validation (bit 18), but these are
independent components.
Validation bit 18 controls the Extended field containing row address
bits 16 and 17, while validation bits 16 and 17 control SMBIOS handle
fields. These SMBIOS handle fields are independent components that
should be validated separately from the Extended field's row address
bits.
Tested: Added memory-validation-bits unit test
Change-Id: I9461c71bf0b782bda74ed24c95b63c080f913b19
Signed-off-by: Peter Benitez <pbenitez@nvidia.com>
diff --git a/examples/memory-validation-bits.cperhex b/examples/memory-validation-bits.cperhex
new file mode 100644
index 0000000..686006d
--- /dev/null
+++ b/examples/memory-validation-bits.cperhex
@@ -0,0 +1,10 @@
+435045520000ffffffff0100000000000300000018010000190001001701
+329900000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000
+000000000000020000000000000004000000000000000000000000000000
+0000000000000000c80000005000000000000100030000001411bca5646f
+de4eb8633e83ed7c83b14a334fcc63c5eb118f889f7ac76c6f0c00000000
+0000000000000000000000000000000000000000fecb0200000000000000
+000000000000000000800000000000f0ffffffffffff0000000000000000
+0000000000000000aa000000000000000000000000000000000000000000
+00000300000000000e00
\ No newline at end of file
diff --git a/examples/memory-validation-bits.json b/examples/memory-validation-bits.json
new file mode 100644
index 0000000..e845f29
--- /dev/null
+++ b/examples/memory-validation-bits.json
@@ -0,0 +1,83 @@
+{
+ "header": {
+ "revision": {
+ "major": 0,
+ "minor": 0
+ },
+ "sectionCount": 1,
+ "severity": {
+ "code": 0,
+ "name": "Recoverable"
+ },
+ "recordLength": 280,
+ "timestamp": "9932-01-17T01:00:19+00:00",
+ "timestampIsPrecise": false,
+ "platformID": "00000000-0000-0000-0000-000000000000",
+ "creatorID": "00000000-0000-0000-0000-000000000000",
+ "notificationType": {
+ "guid": "00000000-0000-0000-0000-000000000000",
+ "type": "Unknown"
+ },
+ "recordID": 2,
+ "flags": {
+ "value": 4,
+ "name": "HW_ERROR_FLAGS_SIMULATED"
+ },
+ "persistenceInfo": 0
+ },
+ "sectionDescriptors": [
+ {
+ "sectionOffset": 200,
+ "sectionLength": 80,
+ "revision": {
+ "major": 0,
+ "minor": 0
+ },
+ "flags": {
+ "primary": true,
+ "containmentWarning": true,
+ "reset": false,
+ "errorThresholdExceeded": false,
+ "resourceNotAccessible": false,
+ "latentError": false,
+ "propagated": false,
+ "overflow": false
+ },
+ "sectionType": {
+ "data": "a5bc1114-6f64-4ede-b863-3e83ed7c83b1",
+ "type": "Platform Memory"
+ },
+ "fruID": "cc4f334a-c563-11eb-8f88-9f7ac76c6f0c",
+ "severity": {
+ "code": 0,
+ "name": "Recoverable"
+ }
+ }
+ ],
+ "sections": [
+ {
+ "message": "A Multi-bit ECC Memory Error occurred at address 0x0000000080000000 at node 0",
+ "Memory": {
+ "bank": {
+ "value": 0
+ },
+ "memoryErrorType": {
+ "value": 3,
+ "name": "Multi-bit ECC"
+ },
+ "moduleSmbiosHandle": 14,
+ "physicalAddress": 2147483648,
+ "physicalAddressHex": "0x0000000080000000",
+ "physicalAddressMask": 18446744073709547520,
+ "node": 0,
+ "card": 0,
+ "moduleRank": 0,
+ "device": 0,
+ "row": 0,
+ "column": 0,
+ "requestorID": 170,
+ "rankNumber": 0
+ }
+ }
+ ]
+}
diff --git a/sections/cper-section-memory.c b/sections/cper-section-memory.c
index 95eac67..a3b76b6 100644
--- a/sections/cper-section-memory.c
+++ b/sections/cper-section-memory.c
@@ -82,7 +82,6 @@
*desc_string);
}
//"Extended" row/column indication field + misc.
- // Review this
if (isvalid_prop_to_ir(&ui64Type, 18)) {
json_object *extended = json_object_new_object();
json_object_object_add(
@@ -99,20 +98,17 @@
5));
}
json_object_object_add(section_ir, "extended", extended);
+ }
- //bit 16 and 17 are valid only if extended is valid
- if (isvalid_prop_to_ir(&ui64Type, 16)) {
- json_object_object_add(
- section_ir, "cardSmbiosHandle",
- json_object_new_uint64(
- memory_error->CardHandle));
- }
- if (isvalid_prop_to_ir(&ui64Type, 17)) {
- json_object_object_add(
- section_ir, "moduleSmbiosHandle",
- json_object_new_uint64(
- memory_error->ModuleHandle));
- }
+ if (isvalid_prop_to_ir(&ui64Type, 16)) {
+ json_object_object_add(
+ section_ir, "cardSmbiosHandle",
+ json_object_new_uint64(memory_error->CardHandle));
+ }
+ if (isvalid_prop_to_ir(&ui64Type, 17)) {
+ json_object_object_add(
+ section_ir, "moduleSmbiosHandle",
+ json_object_new_uint64(memory_error->ModuleHandle));
}
//Miscellaneous numeric fields.
diff --git a/tests/ir-tests.c b/tests/ir-tests.c
index ad4ae3b..b9235ef 100644
--- a/tests/ir-tests.c
+++ b/tests/ir-tests.c
@@ -650,6 +650,12 @@
cper_example_section_ir_test("nvidia_cmet_info");
}
+//Memory section test for validation bits.
+void MemoryValidationBitsSectionTests_IRValid()
+{
+ cper_example_section_ir_test("memory-validation-bits");
+}
+
//Unknown section tests.
void UnknownSectionTests_IRValid(void)
{
@@ -717,6 +723,7 @@
NVIDIASectionTests_IRValid();
NVIDIASectionTests_BinaryEqual();
NVIDIACMETSectionTests_IRValid();
+ MemoryValidationBitsSectionTests_IRValid();
UnknownSectionTests_IRValid();
UnknownSectionTests_BinaryEqual();
CompileTimeAssertions_TwoWayConversion();