BIOS: Implement HelpText and DisplayName properties
Introduce HelpText and DisplayName fields in the PLDM BIOS JSONs, these should
be parsed and passed to the D-Bus APIs that populates the BIOS table.
https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml#L68
Also, they have the same names in the Redfish schema.
https://redfish.dmtf.org/schemas/v1/AttributeRegistry.v1_3_3.json
Tested: test with JSON
https://gist.github.com/lxwinspur/2afffff2e445fddf90dfed6eceef4014
busctl get-property xyz.openbmc_project.BIOSConfigManager
/xyz/openbmc_project/bios_config/manager
xyz.openbmc_project.BIOSConfig.Manager BaseBIOSTable
a{s(sbsssvva(sv))} 5
"CodeUpdatePolicy"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration"
true "CodeUpdatePolicy DisplayName" "CodeUpdatePolicy HelpText" "" s
"Concurrent" s "Concurrent" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "Concurrent"
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "Disruptive"
"Led"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Enumeration"
false "Led DisplayName" "Led HelpText" "" s "Off" s "Off" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "On"
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf" s "Off"
"Model"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"
false "Model DisplayName" "Model HelpText" "" s "powersupply0" s "FP5280G2" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength" x 1
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength" x 100
"OUTLET"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer"
false "OUTLET DisplayName" "OUTLET HelpText" "" x 9127925392260618112 x 0 3
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound" x 0
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound" x 68002
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement" x 1
"str_example3"
"xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"
true "str_example3 DisplayName" "str_example3 HelpText" "" s "ef" s "ef" 2
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength" x 1
"xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength" x 100
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I4e0e28a6fbaeb409b4d57dfcb54d79aee1c5b211
diff --git a/libpldmresponder/bios_attribute.cpp b/libpldmresponder/bios_attribute.cpp
index c519cb7..d090a28 100644
--- a/libpldmresponder/bios_attribute.cpp
+++ b/libpldmresponder/bios_attribute.cpp
@@ -18,7 +18,8 @@
BIOSAttribute::BIOSAttribute(const Json& entry,
DBusHandler* const dbusHandler) :
name(entry.at("attribute_name")),
- readOnly(false), dbusHandler(dbusHandler)
+ readOnly(false), displayName(entry.at("displayName")),
+ helpText(entry.at("helpText")), dbusHandler(dbusHandler)
{
try
{
diff --git a/libpldmresponder/bios_attribute.hpp b/libpldmresponder/bios_attribute.hpp
index b812844..d712429 100644
--- a/libpldmresponder/bios_attribute.hpp
+++ b/libpldmresponder/bios_attribute.hpp
@@ -91,6 +91,10 @@
/** Weather this attribute is read-only */
bool readOnly;
+ const std::string displayName;
+
+ const std::string helpText;
+
protected:
/** @brief dbus backend, nullopt if this attribute is read-only*/
std::optional<DBusMapping> dBusMap;
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index ae05652..5497ac6 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -269,6 +269,10 @@
{
readonlyStatus =
biosAttributes[attrHandle % biosAttributes.size()]->readOnly;
+ description =
+ biosAttributes[attrHandle % biosAttributes.size()]->helpText;
+ displayName =
+ biosAttributes[attrHandle % biosAttributes.size()]->displayName;
}
switch (attrType)