Enhance system VPD map
This commit enhances system VPD map to incorporate useful
information about each critical keywords like the default
keyword value, if the keyword is restorable or not, if the
keyword is resettable at manufacturing or not, if a PEL
required or not when failed to restore the keywords.
Tested the following,
1. system VPD restore on cache via parser
2. system VPD restore on hardware via vpd-manager
3. system VPD restore via vpd-tool
4. system VPD reset via vpd-tool
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: I29ae6016f6d84342a8ad91ba72617a45121cf8a6
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index 805eee2..28ff9b1 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -842,8 +842,10 @@
if (it != vpdMap.end())
{
const auto& kwdListForRecord = systemRecKwdPair.second;
- for (const auto& keyword : kwdListForRecord)
+ for (const auto& keywordInfo : kwdListForRecord)
{
+ const auto keyword = get<0>(keywordInfo);
+
DbusPropertyMap& kwdValMap = it->second;
auto iterator = kwdValMap.find(keyword);
@@ -856,23 +858,13 @@
const string& busValue = readBusProperty(
objectPath, ipzVpdInf + recordName, keyword);
- std::string defaultValue{' '};
+ const auto& defaultValue = get<1>(keywordInfo);
+ Binary busDataInBinary(busValue.begin(), busValue.end());
+ Binary kwdDataInBinary(kwdValue.begin(), kwdValue.end());
- // Explicit check for D0 is required as this keyword will
- // never be blank and 0x00 should be treated as no value in
- // this case.
- if (recordName == "UTIL" && keyword == "D0")
+ if (busDataInBinary != defaultValue)
{
- // default value of kwd D0 is 0x00. This kwd will never
- // be blank.
- defaultValue = '\0';
- }
-
- if (busValue.find_first_not_of(defaultValue) !=
- string::npos)
- {
- if (kwdValue.find_first_not_of(defaultValue) !=
- string::npos)
+ if (kwdDataInBinary != defaultValue)
{
// both the data are present, check for mismatch
if (busValue != kwdValue)
@@ -917,26 +909,16 @@
}
}
- // If cache data is not blank, then irrespective of
- // hardware data(blank or other than cache), copy the
+ // If cache data is not default, then irrespective of
+ // hardware data(default or other than cache), copy the
// cache data to vpd map as we don't need to change the
// cache data in either case in the process of
// restoring system vpd.
- Binary busData(busValue.begin(), busValue.end());
kwdValue = busValue;
}
- else if (kwdValue.find_first_not_of(defaultValue) ==
- string::npos)
+ else if (kwdDataInBinary == defaultValue &&
+ get<2>(keywordInfo)) // Check isPELRequired is true
{
- if (recordName == "VSYS" && keyword == "FV")
- {
- // Continue to the next keyword without logging +PEL
- // for VSYS FV(stores min version of BMC firmware).
- // Reason:There is a requirement to support blank FV
- // so that customer can use the system without
- // upgrading BMC to the minimum required version.
- continue;
- }
string errMsg = "VPD is blank on both cache and "
"hardware for record: ";
errMsg += (*it).first;