bios: Initialise the bios attributes from bios-settings-manager
The bios-settings-manager is persisting the current value for the PLDM
BIOS attributes. The PLDM daemon will lookup the bios-settings-manager
for the current value and create the BIOS attribute value table.
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Change-Id: I6a7a9ff9c3766189e6a64ab88c5c5e438881151f
diff --git a/libpldmresponder/bios_string_attribute.cpp b/libpldmresponder/bios_string_attribute.cpp
index 41538b6..4f9bc4f 100644
--- a/libpldmresponder/bios_string_attribute.cpp
+++ b/libpldmresponder/bios_string_attribute.cpp
@@ -90,9 +90,9 @@
}
}
-void BIOSStringAttribute::constructEntry(const BIOSStringTable& stringTable,
- Table& attrTable,
- Table& attrValueTable)
+void BIOSStringAttribute::constructEntry(
+ const BIOSStringTable& stringTable, Table& attrTable, Table& attrValueTable,
+ std::optional<std::variant<int64_t, std::string>> optAttributeValue)
{
pldm_bios_table_attr_entry_string_info info = {
stringTable.findHandle(name), readOnly,
@@ -105,7 +105,25 @@
table::attribute::constructStringEntry(attrTable, &info);
auto [attrHandle, attrType, _] =
table::attribute::decodeHeader(attrTableEntry);
- auto currStr = getAttrValue();
+
+ std::string currStr{};
+ if (optAttributeValue.has_value())
+ {
+ auto attributeValue = optAttributeValue.value();
+ if (attributeValue.index() == 1)
+ {
+ currStr = std::get<std::string>(attributeValue);
+ }
+ else
+ {
+ currStr = getAttrValue();
+ }
+ }
+ else
+ {
+ currStr = getAttrValue();
+ }
+
table::attribute_value::constructStringEntry(attrValueTable, attrHandle,
attrType, currStr);
}