Update BIOS table type
The typedef used for BIOS table needs to be modified to match the
changes done in the structure of new BIOS table.
Also, monostate has been added to the variant to detect any type
change in future.
Change-Id: I6f250b84fdb82cd4a1c731265b25cfa908fc3beb
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/bios_handler.cpp b/vpd-manager/bios_handler.cpp
index 14e1095..7cc5aac 100644
--- a/vpd-manager/bios_handler.cpp
+++ b/vpd-manager/bios_handler.cpp
@@ -104,9 +104,11 @@
using BiosProperty = std::tuple<
std::string, bool, std::string, std::string, std::string,
std::variant<int64_t, std::string>, std::variant<int64_t, std::string>,
- std::vector<
- std::tuple<std::string, std::variant<int64_t, std::string>>>>;
- using BiosBaseTable = std::variant<std::map<std::string, BiosProperty>>;
+ std::vector<std::tuple<std::string, std::variant<int64_t, std::string>,
+ std::string>>>;
+
+ using BiosBaseTable =
+ std::variant<std::monostate, std::map<std::string, BiosProperty>>;
using BiosBaseTableType = std::map<std::string, BiosBaseTable>;
std::string object;
@@ -116,55 +118,71 @@
{
if (prop.first == "BaseBIOSTable")
{
- auto list = std::get<0>(prop.second);
- for (const auto& item : list)
+ if (auto list = std::get_if<std::map<std::string, BiosProperty>>(
+ &(prop.second)))
{
- std::string attributeName = std::get<0>(item);
- if (attributeName == "hb_memory_mirror_mode")
+ for (const auto& item : *list)
{
- auto attrValue = std::get<5>(std::get<1>(item));
- auto val = std::get_if<std::string>(&attrValue);
- if (val)
+ std::string attributeName = std::get<0>(item);
+ if (attributeName == "hb_memory_mirror_mode")
{
- saveAMMToVPD(*val);
+ auto attrValue = std::get<5>(std::get<1>(item));
+ auto val = std::get_if<std::string>(&attrValue);
+ if (val)
+ {
+ saveAMMToVPD(*val);
+ }
+ }
+ else if (attributeName == "hb_field_core_override")
+ {
+ auto attrValue = std::get<5>(std::get<1>(item));
+ auto val = std::get_if<int64_t>(&attrValue);
+ if (val)
+ {
+ saveFCOToVPD(*val);
+ }
+ }
+ else if (attributeName == "pvm_keep_and_clear")
+ {
+ auto attrValue = std::get<5>(std::get<1>(item));
+ auto val = std::get_if<std::string>(&attrValue);
+ if (val)
+ {
+ saveKeepAndClearToVPD(*val);
+ }
+ }
+ else if (attributeName == "pvm_create_default_lpar")
+ {
+ auto attrValue = std::get<5>(std::get<1>(item));
+ auto val = std::get_if<std::string>(&attrValue);
+ if (val)
+ {
+ saveCreateDefaultLparToVPD(*val);
+ }
+ }
+ else if (attributeName == "pvm_clear_nvram")
+ {
+ auto attrValue = std::get<5>(std::get<1>(item));
+ auto val = std::get_if<std::string>(&attrValue);
+ if (val)
+ {
+ saveClearNVRAMToVPD(*val);
+ }
}
}
- else if (attributeName == "hb_field_core_override")
- {
- auto attrValue = std::get<5>(std::get<1>(item));
- auto val = std::get_if<int64_t>(&attrValue);
- if (val)
- {
- saveFCOToVPD(*val);
- }
- }
- else if (attributeName == "pvm_keep_and_clear")
- {
- auto attrValue = std::get<5>(std::get<1>(item));
- auto val = std::get_if<std::string>(&attrValue);
- if (val)
- {
- saveKeepAndClearToVPD(*val);
- }
- }
- else if (attributeName == "pvm_create_default_lpar")
- {
- auto attrValue = std::get<5>(std::get<1>(item));
- auto val = std::get_if<std::string>(&attrValue);
- if (val)
- {
- saveCreateDefaultLparToVPD(*val);
- }
- }
- else if (attributeName == "pvm_clear_nvram")
- {
- auto attrValue = std::get<5>(std::get<1>(item));
- auto val = std::get_if<std::string>(&attrValue);
- if (val)
- {
- saveClearNVRAMToVPD(*val);
- }
- }
+ }
+ else
+ {
+ inventory::PelAdditionalData additionalData;
+ additionalData.emplace(
+ "DESCRIPTION",
+ "Invalid type received for BIOS base table property");
+
+ createPEL(additionalData, PelSeverity::ERROR,
+ errIntfForVPDDefault, nullptr);
+ std::cerr
+ << "Invalid type received for BIOS base table property"
+ << std::endl;
}
}
}