summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2019-11-07 10:34:43 -0600
committerDaniel M Crowell <dcrowell@us.ibm.com>2019-11-18 09:53:55 -0600
commitd8decc681e7d44711350d4c1407b68a8a80678f7 (patch)
tree48b4ac886ebc4d458519b0dce0bf70d36ca22f3c
parent1cee7cd499df2521027dacef1f03375688db935c (diff)
downloadtalos-hostboot-d8decc681e7d44711350d4c1407b68a8a80678f7.tar.gz
talos-hostboot-d8decc681e7d44711350d4c1407b68a8a80678f7.zip
Add support for NULL char in vendor log
SMART is adding a NULL char to indicate the last entry added to the log. This is useful when the log wraps. A single NULL char indicates the log has wrapped. More than one NULL char in a row indicates the log has not wrapped. Display the log in chronological order. Change-Id: Ic0404b60ad617b7c0c6a09b710e54cb1736bd9d4 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86630 Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> Reviewed-by: TSUNG K YEUNG <tyeung@us.ibm.com> Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/usr/isteps/nvdimm/nvdimm.C53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/usr/isteps/nvdimm/nvdimm.C b/src/usr/isteps/nvdimm/nvdimm.C
index 9b55608fc..a359f3710 100644
--- a/src/usr/isteps/nvdimm/nvdimm.C
+++ b/src/usr/isteps/nvdimm/nvdimm.C
@@ -4410,8 +4410,57 @@ void nvdimmAddVendorLog( TARGETING::Target* i_nvdimm, errlHndl_t& io_err )
break;
}
- // Add NUL terminator to ascii data
- l_fullData.push_back(0x00);
+ // Find first NUL char in the vendor log data
+ bool l_foundNull = false;
+ uint32_t l_idx = 0;
+ for (l_idx = 0; l_idx < l_fullData.size(); l_idx++)
+ {
+ if (l_fullData[l_idx] == 0x00)
+ {
+ l_foundNull = true;
+ break;
+ }
+ }
+
+ // If NULL char not found
+ // then this is the old log format
+ if (l_foundNull == false)
+ {
+ // Add NUL terminator to ascii data
+ l_fullData.push_back(0x00);
+ }
+ // Else new log format
+ else
+ {
+ // If the next char is not NULL
+ // then the log has wrapped
+ // Re-arrange the data in chronological order
+ if (l_fullData[l_idx + 1] != 0x00)
+ {
+ // Save the data after the NULL char
+ // This is the start of the log
+ std::vector<uint8_t> l_tmpData;
+ l_tmpData.insert(l_tmpData.begin(),
+ l_fullData.begin() + l_idx + 1,
+ l_fullData.end());
+
+ // Erase this data from the vector
+ l_fullData.erase(l_fullData.begin() + l_idx + 1,
+ l_fullData.end());
+
+ // Place the saved data at the front
+ l_fullData.insert(l_fullData.begin(),
+ l_tmpData.begin(),
+ l_tmpData.end());
+ }
+ // Else log has not wrapped
+ else
+ {
+ // Erase the data at the end of the vector
+ l_fullData.erase(l_fullData.begin() + l_idx + 1,
+ l_fullData.end());
+ }
+ }
// Add vendor data to error log as string
const char* l_fullChar = reinterpret_cast<char*>(l_fullData.data());
OpenPOWER on IntegriCloud