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_integer_attribute.cpp b/libpldmresponder/bios_integer_attribute.cpp
index 4a23ace..9753ef8 100644
--- a/libpldmresponder/bios_integer_attribute.cpp
+++ b/libpldmresponder/bios_integer_attribute.cpp
@@ -98,9 +98,9 @@
throw std::invalid_argument("dbus type error");
}
-void BIOSIntegerAttribute::constructEntry(const BIOSStringTable& stringTable,
- Table& attrTable,
- Table& attrValueTable)
+void BIOSIntegerAttribute::constructEntry(
+ const BIOSStringTable& stringTable, Table& attrTable, Table& attrValueTable,
+ std::optional<std::variant<int64_t, std::string>> optAttributeValue)
{
pldm_bios_table_attr_entry_integer_info info = {
@@ -115,7 +115,24 @@
auto [attrHandle, attrType, _] =
table::attribute::decodeHeader(attrTableEntry);
- auto currentValue = getAttrValue();
+ int64_t currentValue{};
+ if (optAttributeValue.has_value())
+ {
+ auto attributeValue = optAttributeValue.value();
+ if (attributeValue.index() == 0)
+ {
+ currentValue = std::get<int64_t>(attributeValue);
+ }
+ else
+ {
+ currentValue = getAttrValue();
+ }
+ }
+ else
+ {
+ currentValue = getAttrValue();
+ }
+
table::attribute_value::constructIntegerEntry(attrValueTable, attrHandle,
attrType, currentValue);
}