support runtime update of BIOS attributes
Register the BIOSConfig/PendingAttributes signal and when the out of band
redfish user updates the BIOS attributes, the pldm daemon should process and
check the PendingAttributes porperty, and then update the
BIOSConfig/BaseBIOSTable property and the BIOS table.
Tested: test JSON with
https://gist.github.com/lxwinspur/2afffff2e445fddf90dfed6eceef4014
Type.Enumeration:
~#: busctl set-property xyz.openbmc_project.BIOSConfigManager
/xyz/openbmc_project/bios_config/manager
xyz.openbmc_project.BIOSConfig.Manager PendingAttributes a\{s\(sv\)\} 1
"Led" "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration" s
"xyz.openbmc_project.Led.Physical.Action.On"
~#: pldmtool bios getbiostable -t 2
PLDM AttributeValueTable:
... ...
AttributeHandle: 3
AttributeType: BIOSEnumeration
NumberOfCurrentValues: 1
CurrentValueStringHandleIndex[0] = 0, StringHandle = On
... ...
Type.String
~#: busctl set-property xyz.openbmc_project.BIOSConfigManager
/xyz/openbmc_project/bios_config/manager
xyz.openbmc_project.BIOSConfig.Manager PendingAttributes a\{s\(sv\)\} 1
"Model" "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String" s
"testModel"
~#: pldmtool bios getbiostable -t 2
PLDM AttributeValueTable:
AttributeHandle: 0
AttributeType: BIOSString
CurrentStringLength: 10
CurrentString: testModel
... ...
Type.Integer
~#: busctl set-property xyz.openbmc_project.BIOSConfigManager
/xyz/openbmc_project/bios_config/manager
xyz.openbmc_project.BIOSConfig.Manager PendingAttributes a\{s\(sv\)\} 1
"OUTLET" "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer" x
1000
~#: pldmtool bios getbiostable -t 2
... ...
AttributeHandle: 2
AttributeType: BIOSInteger
CurrentValue: 1000
... ...
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I4d4d2941e6c9bfa7f6fccb664db1580f2ffc9c9f
diff --git a/libpldmresponder/bios_integer_attribute.cpp b/libpldmresponder/bios_integer_attribute.cpp
index d6d1214..a4bc14b 100644
--- a/libpldmresponder/bios_integer_attribute.cpp
+++ b/libpldmresponder/bios_integer_attribute.cpp
@@ -191,6 +191,21 @@
return PLDM_SUCCESS;
}
+void BIOSIntegerAttribute::generateAttributeEntry(
+ const std::variant<int64_t, std::string>& attributevalue,
+ Table& attrValueEntry)
+{
+ attrValueEntry.resize(sizeof(pldm_bios_attr_val_table_entry) +
+ sizeof(int64_t) - 1);
+
+ auto entry = reinterpret_cast<pldm_bios_attr_val_table_entry*>(
+ attrValueEntry.data());
+
+ int64_t value = std::get<int64_t>(attributevalue);
+ entry->attr_type = 3;
+ memcpy(entry->value, &value, sizeof(int64_t));
+}
+
} // namespace bios
} // namespace responder
} // namespace pldm