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_config.hpp b/libpldmresponder/bios_config.hpp
index 8782640..b10ca78 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -48,6 +48,9 @@
MenuPath, CurrentValue, DefaultValue, Option>;
using BaseBIOSTable = std::map<AttributeName, BIOSTableObj>;
+using PendingObj = std::tuple<AttributeType, CurrentValue>;
+using PendingAttributes = std::map<AttributeName, PendingObj>;
+
/** @class BIOSConfig
* @brief Manager BIOS Attributes
*/
@@ -220,6 +223,23 @@
/** @brief Update the BaseBIOSTable property of the D-Bus interface
*/
void updateBaseBIOSTableProperty();
+
+ /** @brief Listen the PendingAttributes property of the D-Bus interface and
+ * update BaseBIOSTable
+ */
+ void listenPendingAttributes();
+
+ /** @brief Find attribute handle from bios attribute table
+ * @param[in] attrName - attribute name
+ * @return attribute handle
+ */
+ uint16_t findAttrHandle(const std::string& attrName);
+
+ /** @brief Listen the PendingAttributes property of the D-Bus interface
+ * and update BaseBIOSTable
+ * @param[in] msg - Data associated with subscribed signal
+ */
+ void constructPendingAttribute(const PendingAttributes& pendingAttributes);
};
} // namespace bios