Fix issue on BaseBIOSTable updating
All attributes can be generated, but fail to
modify BaseBIOSTable property due to struct changed.
Tested:
oem command could change BaseBIOSTable correctly.
root@intel-obmc:~# ipmitool raw 0x30 0xd5 2 0 0
Jan 01 00:38:37 intel-obmc ipmid[199]: ipmiOEMSetPayload : Convert XML into native-dbus DONE
Jan 01 00:38:37 intel-obmc ipmid[199]: generateAttributesData
Jan 01 00:38:37 intel-obmc ipmid[199]: QuietBoot
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICEnable_0
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_0
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_1
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_2
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_3
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICEnable_1
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_4
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_5
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_6
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICPortEnable_7
Jan 01 00:38:37 intel-obmc ipmid[199]: IB1_PXE
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_8
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_9
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_10
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_11
Jan 01 00:38:37 intel-obmc ipmid[199]: IB2_PXE
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_12
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_13
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_14
Jan 01 00:38:37 intel-obmc ipmid[199]: OnboardNICIOMPortPXEEnable_15
Jan 01 00:38:37 intel-obmc ipmid[199]: Pci64BitResourceAllocation
root@intel-obmc:~# busctl call xyz.openbmc_project.BIOSConfigManager /xyz/openbmc_project/bios_config/manager org.freedesktop.DBus.Properties Get ss xyz.openbmc_project.BIOSConfig.Manager BaseBIOSTable --json=pretty |more
{
"type" : "v",
"data" : [
{
"type" : "a{s(sbsssvva(sv))}",
"data" : {
"ADDDCEn" : [
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String",
false,
"ADDDC Sparing",
"Enable/Disable Adaptive Double Device Data Correction Sparing.",
"./Advanced/Memory Configuration/Memory RAS and Performance Configuration/ADDDC Sparing",
{
"type" : "s",
"data" : "0x00"
},
{
"type" : "s",
"data" : "0x00"
},
[
[
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf",
{
"type" : "s",
"data" : "0x1"
}
],
[
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf",
{
"type" : "s",
"data" : "0x0"
}
]
]
],
"ADREn" : [
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String",
false,
"Enable ADR",
"Enables the detecting and enabling of ADR.",
"./Advanced/Memory Configuration/Enable ADR",
{
"type" : "s",
"data" : "0x01"
},
Change-Id: I8c0183c5738d008f617c4e6e1a44a53e3e8bde82
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
diff --git a/src/biosconfigcommands.cpp b/src/biosconfigcommands.cpp
index e6a6b16..217d2f6 100644
--- a/src/biosconfigcommands.cpp
+++ b/src/biosconfigcommands.cpp
@@ -71,12 +71,16 @@
description,menuPath,current,default,
array{struct{optionstring,optionvalue}}}}
*/
-std::map<std::string,
- std::tuple<std::string, bool, std::string, std::string, std::string,
- std::variant<int64_t, std::string>,
- std::variant<int64_t, std::string>,
- std::map<std::string, std::variant<int64_t, std::string>>>>
- AttributesData;
+using BiosBaseTableType =
+ std::map<std::string,
+ 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 OptionType =
+ std::vector<std::tuple<std::string, std::variant<int64_t, std::string>>>;
+BiosBaseTableType attributesData;
NVOOBdata gNVOOBdata;
@@ -123,7 +127,7 @@
ctx->bus->yield_method_call<>(
ctx->yield, ec, service, biosConfigBaseMgrPath,
"org.freedesktop.DBus.Properties", "Set", biosConfigIntf,
- "BaseBIOSTable", AttributesData);
+ "BaseBIOSTable", std::variant<BiosBaseTableType>(attributesData));
if (ec)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -271,7 +275,7 @@
{
std::string rootPath = "./" + std::string(menupath);
- std::map<std::string, std::variant<int64_t, std::string>> optionMap;
+ OptionType optionArray;
tinyxml2::XMLElement* pOptionsElement =
pKnobsElement->FirstChildElement("options");
nlohmann::json optionsArray = nlohmann::json::array();
@@ -281,24 +285,26 @@
pOptionsElement->FirstChildElement("option");
while (pOptionElement != nullptr)
{
- const std::string text = pOptionElement->Attribute("text");
+ const std::string optType =
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType."
+ "OneOf";
const std::string attrValue =
pOptionElement->Attribute("value");
- if (!text.empty() && !attrValue.empty())
+ if (!optType.empty() && !attrValue.empty())
{
- optionMap.emplace(std::make_pair(std::move(text),
- std::move(attrValue)));
+ optionArray.push_back(
+ std::make_pair(optType, attrValue));
}
pOptionElement =
pOptionElement->NextSiblingElement("option");
}
}
- AttributesData.emplace(std::make_pair(
- name,
- std::make_tuple(attrType, readOnlyStatus, dname, description,
- rootPath, curvalue, defaultvalue, optionMap)));
+ attributesData.emplace(std::make_pair(
+ name, std::make_tuple(attrType, readOnlyStatus, dname,
+ description, rootPath, curvalue,
+ defaultvalue, optionArray)));
}
pKnobsElement = pKnobsElement->NextSiblingElement("knob");
}