summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2021-08-26 23:18:00 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2021-08-27 19:05:02 +0300
commit6f106a0a4ce15fe0678d4ffefd572e6978c72597 (patch)
treed98626c9763ad9048ac9bfd8269e12eced18d496 /meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig
parentae908254d22318b9e27acf6e5e28d1a4ab5e2195 (diff)
downloadopenbmc-6f106a0a4ce15fe0678d4ffefd572e6978c72597.tar.xz
Update to internal 0.70
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch749
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch160
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch86
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch161
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch44
5 files changed, 594 insertions, 606 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch
index 9cf4653d6..93bbb7494 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch
@@ -1,7 +1,7 @@
-From 72c273ae74bb6add062b89f59ebeee4d4eb7e523 Mon Sep 17 00:00:00 2001
+From 501003876765f51799152bace657d97b7fa2b60e Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Fri, 4 Sep 2020 19:24:25 +0800
-Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable
+Subject: [PATCH 1/5] Define Redfish interface "/Registries/Bios" and enable
Attributes property
1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry
@@ -227,25 +227,25 @@ Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
redfish-core/include/redfish.hpp | 2 +
- .../include/registries/bios_registry.hpp | 31 ++
- redfish-core/lib/bios.hpp | 501 ++++++++++++++++++
- redfish-core/lib/message_registries.hpp | 9 +-
- 4 files changed, 542 insertions(+), 1 deletion(-)
+ .../include/registries/bios_registry.hpp | 31 +
+ redfish-core/lib/bios.hpp | 528 ++++++++++++++++++
+ redfish-core/lib/message_registries.hpp | 6 +
+ 4 files changed, 567 insertions(+)
create mode 100644 redfish-core/include/registries/bios_registry.hpp
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index db58d60..298ebb8 100644
+index c15062d..3388498 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
-@@ -156,6 +156,8 @@ class RedfishService
- nodes.emplace_back(std::make_unique<SystemActionsReset>(app));
- nodes.emplace_back(std::make_unique<SystemResetActionInfo>(app));
- nodes.emplace_back(std::make_unique<BiosService>(app));
-+ nodes.emplace_back(std::make_unique<BiosSettings>(app));
-+ nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app));
- nodes.emplace_back(std::make_unique<BiosReset>(app));
+@@ -152,6 +152,8 @@ class RedfishService
+ requestRoutesSystemActionsReset(app);
+ requestRoutesSystemResetActionInfo(app);
+ requestRoutesBiosService(app);
++ requestRoutesBiosSettings(app);
++ requestRoutesBiosAttributeRegistry(app);
+ requestRoutesBiosReset(app);
+
#ifdef BMCWEB_ENABLE_VM_NBDPROXY
- nodes.emplace_back(std::make_unique<VirtualMedia>(app));
diff --git a/redfish-core/include/registries/bios_registry.hpp b/redfish-core/include/registries/bios_registry.hpp
new file mode 100644
index 0000000..88ef782
@@ -285,12 +285,12 @@ index 0000000..88ef782
+} // namespace redfish::message_registries::bios
\ No newline at end of file
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 0917cc7..cb2b74d 100644
+index 604b8e7..c1a5c56 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -3,8 +3,140 @@
- #include "node.hpp"
-
+ #include <app.hpp>
+ #include <registries/privilege_registry.hpp>
#include <utils/fw_utils.hpp>
+
namespace redfish
@@ -429,420 +429,435 @@ index 0917cc7..cb2b74d 100644
/**
* BiosService class supports handle get method for bios.
*/
-@@ -33,6 +165,375 @@ class BiosService : public Node
- // Get the ActiveSoftwareImage and SoftwareImages
- fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose,
- "", true);
-+ asyncResp->res.jsonValue["@Redfish.Settings"] = {
-+ {"@odata.type", "#Settings.v1_3_0.Settings"},
-+ {"SettingsObject",
-+ {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}};
-+ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry";
-+ asyncResp->res.jsonValue["Attributes"] = {};
-+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec,
-+ const GetObjectType& getObjectType) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
-+ << ec;
-+ messages::internalError(asyncResp->res);
-+
-+ return;
-+ }
-+ const std::string& service = getObjectType.begin()->first;
+@@ -29,8 +161,404 @@ inline void requestRoutesBiosService(App& app)
+ // Get the ActiveSoftwareImage and SoftwareImages
+ fw_util::populateFirmwareInformation(
+ asyncResp, fw_util::biosPurpose, "", true);
++ asyncResp->res.jsonValue["@Redfish.Settings"] = {
++ {"@odata.type", "#Settings.v1_3_0.Settings"},
++ {"SettingsObject",
++ {{"@odata.id",
++ "/redfish/v1/Systems/system/Bios/Settings"}}}};
++ asyncResp->res.jsonValue["AttributeRegistry"] =
++ "BiosAttributeRegistry";
++ asyncResp->res.jsonValue["Attributes"] = {};
+
+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](
-+ const boost::system::error_code ec,
-+ const std::variant<BiosBaseTableType>& retBiosTable) {
++ [asyncResp](const boost::system::error_code ec,
++ const GetObjectType& getObjectType) {
+ if (ec)
+ {
-+ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: "
-+ << ec;
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+ const BiosBaseTableType* baseBiosTable =
-+ std::get_if<BiosBaseTableType>(&retBiosTable);
-+ nlohmann::json& attributesJson =
-+ asyncResp->res.jsonValue["Attributes"];
-+ if (baseBiosTable == nullptr)
-+ {
-+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr ";
++ BMCWEB_LOG_ERROR
++ << "ObjectMapper::GetObject call failed: "
++ << ec;
+ messages::internalError(asyncResp->res);
++
+ return;
+ }
-+ for (const BiosBaseTableItemType& item : *baseBiosTable)
-+ {
-+ const std::string& key = item.first;
-+ const std::string& itemType =
-+ std::get<biosBaseAttrType>(item.second);
-+ std::string attrType =
-+ mapAttrTypeToRedfish(itemType);
-+ if (attrType == "String")
-+ {
-+ const std::string* currValue =
-+ std::get_if<std::string>(
-+ &std::get<biosBaseCurrValue>(
-+ item.second));
-+ attributesJson.emplace(key, currValue != nullptr
-+ ? *currValue
-+ : "");
-+ }
-+ else if (attrType == "Integer")
-+ {
-+ const int64_t* currValue = std::get_if<int64_t>(
-+ &std::get<biosBaseCurrValue>(item.second));
-+ attributesJson.emplace(
-+ key, currValue != nullptr ? *currValue : 0);
-+ }
-+ else
-+ {
-+ BMCWEB_LOG_ERROR
-+ << "Unsupported attribute type.";
-+ messages::internalError(asyncResp->res);
-+ }
-+ }
++ const std::string& service =
++ getObjectType.begin()->first;
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](const boost::system::error_code ec,
++ const std::variant<BiosBaseTableType>&
++ retBiosTable) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR
++ << "getBiosAttributes DBUS error: "
++ << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ const BiosBaseTableType* baseBiosTable =
++ std::get_if<BiosBaseTableType>(
++ &retBiosTable);
++ nlohmann::json& attributesJson =
++ asyncResp->res.jsonValue["Attributes"];
++ if (baseBiosTable == nullptr)
++ {
++ BMCWEB_LOG_ERROR
++ << "baseBiosTable == nullptr ";
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ for (const BiosBaseTableItemType& item :
++ *baseBiosTable)
++ {
++ const std::string& key = item.first;
++ const std::string& itemType =
++ std::get<biosBaseAttrType>(item.second);
++ std::string attrType =
++ mapAttrTypeToRedfish(itemType);
++ if (attrType == "String")
++ {
++ const std::string* currValue =
++ std::get_if<std::string>(
++ &std::get<biosBaseCurrValue>(
++ item.second));
++ attributesJson.emplace(
++ key, currValue != nullptr
++ ? *currValue
++ : "");
++ }
++ else if (attrType == "Integer")
++ {
++ const int64_t* currValue =
++ std::get_if<int64_t>(
++ &std::get<biosBaseCurrValue>(
++ item.second));
++ attributesJson.emplace(
++ key, currValue != nullptr
++ ? *currValue
++ : 0);
++ }
++ else
++ {
++ BMCWEB_LOG_ERROR
++ << "Unsupported attribute type.";
++ messages::internalError(asyncResp->res);
++ }
++ }
++ },
++ service, "/xyz/openbmc_project/bios_config/manager",
++ "org.freedesktop.DBus.Properties", "Get",
++ "xyz.openbmc_project.BIOSConfig.Manager",
++ "BaseBIOSTable");
+ },
-+ service, "/xyz/openbmc_project/bios_config/manager",
-+ "org.freedesktop.DBus.Properties", "Get",
-+ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable");
-+ },
-+ "xyz.openbmc_project.ObjectMapper",
-+ "/xyz/openbmc_project/object_mapper",
-+ "xyz.openbmc_project.ObjectMapper", "GetObject",
-+ "/xyz/openbmc_project/bios_config/manager",
-+ std::array<const char*, 0>());
-+ }
-+};
++ "xyz.openbmc_project.ObjectMapper",
++ "/xyz/openbmc_project/object_mapper",
++ "xyz.openbmc_project.ObjectMapper", "GetObject",
++ "/xyz/openbmc_project/bios_config/manager",
++ std::array<const char*, 0>());
+ });
+ }
+
+/**
+ * BiosSettings class supports handle GET/PATCH method for
+ * BIOS configuration pending settings.
+ */
-+class BiosSettings : public Node
++inline void requestRoutesBiosSettings(App& app)
+{
-+ public:
-+ BiosSettings(App& app) :
-+ Node(app, "/redfish/v1/Systems/system/Bios/Settings")
-+ {
-+ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}};
-+ }
-+
-+ private:
-+ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-+ const crow::Request&, const std::vector<std::string>&) override
-+ {
-+ asyncResp->res.jsonValue["@odata.id"] =
-+ "/redfish/v1/Systems/system/Bios/Settings";
-+ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios";
-+ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1";
-+ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1";
-+ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry";
-+ asyncResp->res.jsonValue["Attributes"] = {};
-+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec,
-+ const GetObjectType& getObjectType) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
-+ << ec;
-+ messages::internalError(asyncResp->res);
-+
-+ return;
-+ }
-+ std::string service = getObjectType.begin()->first;
++ BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Settings")
++ .privileges(redfish::privileges::getBios)
++ .methods(boost::beast::http::verb::get)(
++ [](const crow::Request&,
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
++ asyncResp->res.jsonValue["@odata.id"] =
++ asyncResp->res.jsonValue["@odata.id"] =
++ "/redfish/v1/Systems/system/Bios/Settings";
++ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios";
++ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1";
++ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1";
++ asyncResp->res.jsonValue["AttributeRegistry"] =
++ "BiosAttributeRegistry";
++ asyncResp->res.jsonValue["Attributes"] = {};
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
-+ const std::variant<PendingAttributesType>&
-+ retPendingAttributes) {
++ const GetObjectType& getObjectType) {
+ if (ec)
+ {
-+ BMCWEB_LOG_ERROR << "getBiosSettings DBUS error: "
-+ << ec;
-+ messages::resourceNotFound(asyncResp->res,
-+ "Systems/system/Bios",
-+ "Settings");
-+ return;
-+ }
-+ const PendingAttributesType* pendingAttributes =
-+ std::get_if<PendingAttributesType>(
-+ &retPendingAttributes);
-+ nlohmann::json& attributesJson =
-+ asyncResp->res.jsonValue["Attributes"];
-+ if (pendingAttributes == nullptr)
-+ {
-+ BMCWEB_LOG_ERROR << "pendingAttributes == nullptr ";
++ BMCWEB_LOG_ERROR
++ << "ObjectMapper::GetObject call failed: "
++ << ec;
+ messages::internalError(asyncResp->res);
++
+ return;
+ }
-+ for (const PendingAttributesItemType& item :
-+ *pendingAttributes)
-+ {
-+ const std::string& key = item.first;
-+ const std::string& itemType =
-+ std::get<pendingAttrType>(item.second);
-+ std::string attrType =
-+ mapAttrTypeToRedfish(itemType);
-+ if (attrType == "String")
-+ {
-+ const std::string* currValue =
-+ std::get_if<std::string>(
-+ &std::get<pendingAttrValue>(
-+ item.second));
-+ attributesJson.emplace(key, currValue != nullptr
-+ ? *currValue
-+ : "");
-+ }
-+ else if (attrType == "Integer")
-+ {
-+ const int64_t* currValue = std::get_if<int64_t>(
-+ &std::get<pendingAttrValue>(item.second));
-+ attributesJson.emplace(
-+ key, currValue != nullptr ? *currValue : 0);
-+ }
-+ else
-+ {
-+ BMCWEB_LOG_ERROR
-+ << "Unsupported attribute type.";
-+ messages::internalError(asyncResp->res);
-+ }
-+ }
++ std::string service = getObjectType.begin()->first;
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](
++ const boost::system::error_code ec,
++ const std::variant<PendingAttributesType>&
++ retPendingAttributes) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR
++ << "getBiosSettings DBUS error: " << ec;
++ messages::resourceNotFound(
++ asyncResp->res, "Systems/system/Bios",
++ "Settings");
++ return;
++ }
++ const PendingAttributesType* pendingAttributes =
++ std::get_if<PendingAttributesType>(
++ &retPendingAttributes);
++ nlohmann::json& attributesJson =
++ asyncResp->res.jsonValue["Attributes"];
++ if (pendingAttributes == nullptr)
++ {
++ BMCWEB_LOG_ERROR
++ << "pendingAttributes == nullptr ";
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ for (const PendingAttributesItemType& item :
++ *pendingAttributes)
++ {
++ const std::string& key = item.first;
++ const std::string& itemType =
++ std::get<pendingAttrType>(item.second);
++ std::string attrType =
++ mapAttrTypeToRedfish(itemType);
++ if (attrType == "String")
++ {
++ const std::string* currValue =
++ std::get_if<std::string>(
++ &std::get<pendingAttrValue>(
++ item.second));
++ attributesJson.emplace(
++ key, currValue != nullptr
++ ? *currValue
++ : "");
++ }
++ else if (attrType == "Integer")
++ {
++ const int64_t* currValue =
++ std::get_if<int64_t>(
++ &std::get<pendingAttrValue>(
++ item.second));
++ attributesJson.emplace(
++ key, currValue != nullptr
++ ? *currValue
++ : 0);
++ }
++ else
++ {
++ BMCWEB_LOG_ERROR
++ << "Unsupported attribute type.";
++ messages::internalError(asyncResp->res);
++ }
++ }
++ },
++ service, "/xyz/openbmc_project/bios_config/manager",
++ "org.freedesktop.DBus.Properties", "Get",
++ "xyz.openbmc_project.BIOSConfig.Manager",
++ "PendingAttributes");
+ },
-+ service, "/xyz/openbmc_project/bios_config/manager",
-+ "org.freedesktop.DBus.Properties", "Get",
-+ "xyz.openbmc_project.BIOSConfig.Manager",
-+ "PendingAttributes");
-+ },
-+ "xyz.openbmc_project.ObjectMapper",
-+ "/xyz/openbmc_project/object_mapper",
-+ "xyz.openbmc_project.ObjectMapper", "GetObject",
-+ "/xyz/openbmc_project/bios_config/manager",
-+ std::array<const char*, 0>());
-+ }
-+};
++ "xyz.openbmc_project.ObjectMapper",
++ "/xyz/openbmc_project/object_mapper",
++ "xyz.openbmc_project.ObjectMapper", "GetObject",
++ "/xyz/openbmc_project/bios_config/manager",
++ std::array<const char*, 0>());
++ });
++}
+/**
+ * BiosAttributeRegistry class supports handle get method for BIOS attribute
+ * registry.
+ */
-+class BiosAttributeRegistry : public Node
++inline void requestRoutesBiosAttributeRegistry(App& app)
+{
-+ public:
-+ BiosAttributeRegistry(App& app) :
-+ Node(app, "/redfish/v1/Registries/BiosAttributeRegistry/"
-+ "BiosAttributeRegistry")
-+ {
-+ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}};
-+ }
-+
-+ private:
-+ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-+ const crow::Request&, const std::vector<std::string>&) override
-+ {
-+ asyncResp->res.jsonValue["@odata.id"] =
-+ "/redfish/v1/Registries/BiosAttributeRegistry/"
-+ "BiosAttributeRegistry";
-+ asyncResp->res.jsonValue["@odata.type"] =
-+ "#AttributeRegistry.v1_3_2.AttributeRegistry";
-+ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry";
-+ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry";
-+ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0";
-+ asyncResp->res.jsonValue["Language"] = "en";
-+ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC";
-+ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] =
-+ nlohmann::json::array();
++ BMCWEB_ROUTE(
++ app,
++ "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry/")
++ .privileges(redfish::privileges::getBios)
++ .methods(
++ boost::beast::http::verb::
++ get)([](const crow::Request&,
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
++ asyncResp->res.jsonValue["@odata.id"] =
++ "/redfish/v1/Registries/BiosAttributeRegistry/"
++ "BiosAttributeRegistry";
++ asyncResp->res.jsonValue["@odata.type"] =
++ "#AttributeRegistry.v1_3_2.AttributeRegistry";
++ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry";
++ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry";
++ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0";
++ asyncResp->res.jsonValue["Language"] = "en";
++ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC";
++ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] =
++ nlohmann::json::array();
+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec,
-+ const GetObjectType& getObjectType) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
-+ << ec;
-+ messages::internalError(asyncResp->res);
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](const boost::system::error_code ec,
++ const GetObjectType& getObjectType) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR
++ << "ObjectMapper::GetObject call failed: " << ec;
++ messages::internalError(asyncResp->res);
+
-+ return;
-+ }
-+ std::string service = getObjectType.begin()->first;
++ return;
++ }
++ std::string service = getObjectType.begin()->first;
+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](
-+ const boost::system::error_code ec,
-+ const std::variant<BiosBaseTableType>& retBiosTable) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR
-+ << "getBiosAttributeRegistry DBUS error: "
-+ << ec;
-+ messages::resourceNotFound(
-+ asyncResp->res, "Registries/Bios", "Bios");
-+ return;
-+ }
-+ const BiosBaseTableType* baseBiosTable =
-+ std::get_if<BiosBaseTableType>(&retBiosTable);
-+ nlohmann::json& attributeArray =
-+ asyncResp->res
-+ .jsonValue["RegistryEntries"]["Attributes"];
-+ nlohmann::json optionsArray = nlohmann::json::array();
-+ if (baseBiosTable == nullptr)
-+ {
-+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr ";
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+ for (const BiosBaseTableItemType& item : *baseBiosTable)
-+ {
-+ const std::string& itemType =
-+ std::get<biosBaseAttrType>(item.second);
-+ std::string attrType =
-+ mapAttrTypeToRedfish(itemType);
-+ if (attrType == "UNKNOWN")
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](const boost::system::error_code ec,
++ const std::variant<BiosBaseTableType>&
++ retBiosTable) {
++ if (ec)
+ {
-+ BMCWEB_LOG_ERROR << "attrType == UNKNOWN";
-+ messages::internalError(asyncResp->res);
++ BMCWEB_LOG_ERROR
++ << "getBiosAttributeRegistry DBUS error: "
++ << ec;
++ messages::resourceNotFound(
++ asyncResp->res, "Registries/Bios", "Bios");
+ return;
+ }
-+ nlohmann::json attributeItem;
-+ attributeItem["AttributeName"] = item.first;
-+ attributeItem["Type"] = attrType;
-+ attributeItem["ReadOnly"] =
-+ std::get<biosBaseReadonlyStatus>(item.second);
-+ attributeItem["DisplayName"] =
-+ std::get<biosBaseDisplayName>(item.second);
-+ attributeItem["HelpText"] =
-+ std::get<biosBaseDescription>(item.second);
-+ attributeItem["MenuPath"] =
-+ std::get<biosBaseMenuPath>(item.second);
-+
-+ if (attrType == "String")
-+ {
-+ const std::string* currValue =
-+ std::get_if<std::string>(
-+ &std::get<biosBaseCurrValue>(
-+ item.second));
-+ const std::string* defValue =
-+ std::get_if<std::string>(
-+ &std::get<biosBaseDefaultValue>(
-+ item.second));
-+ attributeItem["CurrentValue"] =
-+ currValue != nullptr ? *currValue : "";
-+ attributeItem["DefaultValue"] =
-+ defValue != nullptr ? *defValue : "";
-+ }
-+ else if (attrType == "Integer")
-+ {
-+ const int64_t* currValue = std::get_if<int64_t>(
-+ &std::get<biosBaseCurrValue>(item.second));
-+ const int64_t* defValue = std::get_if<int64_t>(
-+ &std::get<biosBaseDefaultValue>(
-+ item.second));
-+ attributeItem["CurrentValue"] =
-+ currValue != nullptr ? *currValue : 0;
-+ attributeItem["DefaultValue"] =
-+ defValue != nullptr ? *defValue : 0;
-+ }
-+ else
++ const BiosBaseTableType* baseBiosTable =
++ std::get_if<BiosBaseTableType>(&retBiosTable);
++ nlohmann::json& attributeArray =
++ asyncResp->res
++ .jsonValue["RegistryEntries"]["Attributes"];
++ nlohmann::json optionsArray =
++ nlohmann::json::array();
++ if (baseBiosTable == nullptr)
+ {
-+ BMCWEB_LOG_ERROR
-+ << "Unsupported attribute type.";
++ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr ";
+ messages::internalError(asyncResp->res);
+ return;
+ }
-+
-+ const std::vector<OptionsItemType>& optionsVector =
-+ std::get<biosBaseOptions>(item.second);
-+ for (const OptionsItemType& optItem : optionsVector)
++ for (const BiosBaseTableItemType& item :
++ *baseBiosTable)
+ {
-+ nlohmann::json optItemJson;
-+ const std::string& strOptItemType =
-+ std::get<optItemType>(optItem);
-+ std::string optItemTypeRedfish =
-+ mapBoundTypeToRedfish(strOptItemType);
-+ if (optItemTypeRedfish == "UNKNOWN")
++ const std::string& itemType =
++ std::get<biosBaseAttrType>(item.second);
++ std::string attrType =
++ mapAttrTypeToRedfish(itemType);
++ if (attrType == "UNKNOWN")
+ {
-+ BMCWEB_LOG_ERROR
-+ << "optItemTypeRedfish == UNKNOWN";
++ BMCWEB_LOG_ERROR << "attrType == UNKNOWN";
+ messages::internalError(asyncResp->res);
+ return;
+ }
-+ if (optItemTypeRedfish == "OneOf")
++ nlohmann::json attributeItem;
++ attributeItem["AttributeName"] = item.first;
++ attributeItem["Type"] = attrType;
++ attributeItem["ReadOnly"] =
++ std::get<biosBaseReadonlyStatus>(
++ item.second);
++ attributeItem["DisplayName"] =
++ std::get<biosBaseDisplayName>(item.second);
++ attributeItem["HelpText"] =
++ std::get<biosBaseDescription>(item.second);
++ attributeItem["MenuPath"] =
++ std::get<biosBaseMenuPath>(item.second);
++
++ if (attrType == "String")
+ {
+ const std::string* currValue =
+ std::get_if<std::string>(
-+ &std::get<optItemValue>(optItem));
-+ optItemJson[optItemTypeRedfish] =
++ &std::get<biosBaseCurrValue>(
++ item.second));
++ const std::string* defValue =
++ std::get_if<std::string>(
++ &std::get<biosBaseDefaultValue>(
++ item.second));
++ attributeItem["CurrentValue"] =
+ currValue != nullptr ? *currValue : "";
++ attributeItem["DefaultValue"] =
++ defValue != nullptr ? *defValue : "";
+ }
-+ else
++ else if (attrType == "Integer")
+ {
+ const int64_t* currValue =
+ std::get_if<int64_t>(
-+ &std::get<optItemValue>(optItem));
-+ optItemJson[optItemTypeRedfish] =
++ &std::get<biosBaseCurrValue>(
++ item.second));
++ const int64_t* defValue =
++ std::get_if<int64_t>(
++ &std::get<biosBaseDefaultValue>(
++ item.second));
++ attributeItem["CurrentValue"] =
+ currValue != nullptr ? *currValue : 0;
++ attributeItem["DefaultValue"] =
++ defValue != nullptr ? *defValue : 0;
++ }
++ else
++ {
++ BMCWEB_LOG_ERROR
++ << "Unsupported attribute type.";
++ messages::internalError(asyncResp->res);
++ return;
+ }
+
-+ optionsArray.push_back(optItemJson);
-+ }
++ const std::vector<OptionsItemType>&
++ optionsVector =
++ std::get<biosBaseOptions>(item.second);
++ for (const OptionsItemType& optItem :
++ optionsVector)
++ {
++ nlohmann::json optItemJson;
++ const std::string& strOptItemType =
++ std::get<optItemType>(optItem);
++ std::string optItemTypeRedfish =
++ mapBoundTypeToRedfish(strOptItemType);
++ if (optItemTypeRedfish == "UNKNOWN")
++ {
++ BMCWEB_LOG_ERROR
++ << "optItemTypeRedfish == UNKNOWN";
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ if (optItemTypeRedfish == "OneOf")
++ {
++ const std::string* currValue =
++ std::get_if<std::string>(
++ &std::get<optItemValue>(
++ optItem));
++ optItemJson[optItemTypeRedfish] =
++ currValue != nullptr ? *currValue
++ : "";
++ }
++ else
++ {
++ const int64_t* currValue =
++ std::get_if<int64_t>(
++ &std::get<optItemValue>(
++ optItem));
++ optItemJson[optItemTypeRedfish] =
++ currValue != nullptr ? *currValue
++ : 0;
++ }
+
-+ attributeItem["Value"] = optionsArray;
-+ attributeArray.push_back(attributeItem);
-+ }
-+ },
-+ service, "/xyz/openbmc_project/bios_config/manager",
-+ "org.freedesktop.DBus.Properties", "Get",
-+ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable");
-+ },
-+ "xyz.openbmc_project.ObjectMapper",
-+ "/xyz/openbmc_project/object_mapper",
-+ "xyz.openbmc_project.ObjectMapper", "GetObject",
-+ "/xyz/openbmc_project/bios_config/manager",
-+ std::array<const char*, 0>());
- }
- };
++ optionsArray.push_back(optItemJson);
++ }
++
++ attributeItem["Value"] = optionsArray;
++ attributeArray.push_back(attributeItem);
++ }
++ },
++ service, "/xyz/openbmc_project/bios_config/manager",
++ "org.freedesktop.DBus.Properties", "Get",
++ "xyz.openbmc_project.BIOSConfig.Manager",
++ "BaseBIOSTable");
++ },
++ "xyz.openbmc_project.ObjectMapper",
++ "/xyz/openbmc_project/object_mapper",
++ "xyz.openbmc_project.ObjectMapper", "GetObject",
++ "/xyz/openbmc_project/bios_config/manager",
++ std::array<const char*, 0>());
++ });
++}
/**
+ * BiosReset class supports handle POST method for Reset bios.
+ * The class retrieves and sends data directly to D-Bus.
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
-index 455bf70..7afbfc2 100644
+index e3bd5bf..f1f130a 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
-@@ -18,6 +18,7 @@
- #include "node.hpp"
+@@ -17,6 +17,7 @@
+
#include "registries.hpp"
#include "registries/base_message_registry.hpp"
+#include "registries/bios_registry.hpp"
#include "registries/openbmc_message_registry.hpp"
#include "registries/resource_event_message_registry.hpp"
#include "registries/task_event_message_registry.hpp"
-@@ -56,11 +57,12 @@ class MessageRegistryFileCollection : public Node
- {"@odata.id", "/redfish/v1/Registries"},
- {"Name", "MessageRegistryFile Collection"},
- {"Description", "Collection of MessageRegistryFiles"},
-- {"Members@odata.count", 4},
-+ {"Members@odata.count", 5},
- {"Members",
- {{{"@odata.id", "/redfish/v1/Registries/Base"}},
- {{"@odata.id", "/redfish/v1/Registries/TaskEvent"}},
- {{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}},
-+ {{"@odata.id", "/redfish/v1/Registries/BiosAttributeRegistry"}},
- {{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}}}};
- }
- };
-@@ -116,6 +118,11 @@ class MessageRegistryFile : public Node
- header = &message_registries::resource_event::header;
- url = message_registries::resource_event::url;
- }
-+ else if (registry == "BiosAttributeRegistry")
-+ {
-+ header = &message_registries::bios::header;
-+ dmtf.clear();
-+ }
- else
- {
- messages::resourceNotFound(
+@@ -87,6 +88,11 @@ inline void requestRoutesMessageRegistryFile(App& app)
+ header = &message_registries::resource_event::header;
+ url = message_registries::resource_event::url;
+ }
++ else if (registry == "BiosAttributeRegistry")
++ {
++ header = &message_registries::bios::header;
++ dmtf.clear();
++ }
+ else
+ {
+ messages::resourceNotFound(
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch
index 21a21e8db..099e6ddf5 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch
@@ -1,7 +1,7 @@
-From 9c498d683be59ce25dd0124ba7ec5e026c59bbbf Mon Sep 17 00:00:00 2001
-From: Kuiying Wang <kuiying.wang@intel.com>
-Date: Wed, 23 Dec 2020 16:50:45 +0800
-Subject: [PATCH] BaseBiosTable: Add support for PATCH operation
+From ffa924ef204930a5bb442bf654eac02543acfb8f Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 30 Jun 2021 15:18:46 +0000
+Subject: [PATCH 2/5] BaseBiosTable: Add support for PATCH operation
This commit brings in support for PATCH operation of the
bios variables that updates the BaseBiosTable.
@@ -25,12 +25,13 @@ This makes use of the "Set" of "PendingAttributes" in the
backend and that updates the BaseBiosTable.
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
+Change-Id: I12e78e5ac623c264c7a3e1dd5198aca67172736d
---
- redfish-core/lib/bios.hpp | 93 ++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 92 insertions(+), 1 deletion(-)
+ redfish-core/lib/bios.hpp | 95 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 95 insertions(+)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index cb2b74d..860a643 100644
+index c1a5c56..14d2171 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus)
@@ -63,88 +64,83 @@ index cb2b74d..860a643 100644
static std::string mapBoundTypeToRedfish(const std::string_view typeDbus)
{
std::string ret;
-@@ -260,7 +283,9 @@ class BiosSettings : public Node
- BiosSettings(App& app) :
- Node(app, "/redfish/v1/Systems/system/Bios/Settings")
- {
-- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}};
-+ entityPrivileges = {
-+ {boost::beast::http::verb::get, {{"Login"}}},
-+ {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}};
- }
-
- private:
-@@ -356,6 +381,72 @@ class BiosSettings : public Node
- "/xyz/openbmc_project/bios_config/manager",
- std::array<const char*, 0>());
- }
-+
-+ void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-+ const crow::Request& req,
-+ const std::vector<std::string>&) override
-+ {
-+ nlohmann::json inpJson;
+@@ -370,6 +393,78 @@ inline void requestRoutesBiosSettings(App& app)
+ "/xyz/openbmc_project/bios_config/manager",
+ std::array<const char*, 0>());
+ });
+
-+ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson))
-+ {
-+ return;
-+ }
++ BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Settings")
++ .privileges({{"ConfigureComponents"}})
++ .methods(boost::beast::http::verb::patch)(
++ [](const crow::Request& req,
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
++ nlohmann::json inpJson;
+
-+ for (auto& attrInfo : inpJson)
-+ {
-+ std::optional<std::string> attrName;
-+ std::optional<std::string> attrType;
-+ std::optional<std::string> attrValue;
-+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeName",
-+ attrName))
-+ {
-+ messages::propertyMissing(asyncResp->res, "AttributeName");
-+ return;
-+ }
-+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeType",
-+ attrType))
-+ {
-+ messages::propertyMissing(asyncResp->res, "AttributeType");
-+ return;
-+ }
-+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeValue",
-+ attrValue))
-+ {
-+ messages::propertyMissing(asyncResp->res, "AttributeValue");
-+ return;
-+ }
-+ std::string biosAttrType = mapRedfishToAttrType(*attrType);
++ if (!redfish::json_util::readJson(req, asyncResp->res, "data",
++ inpJson))
++ {
++ return;
++ }
+
-+ if (biosAttrType == "UNKNOWN")
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid attribute type";
-+ messages::propertyValueNotInList(asyncResp->res,
-+ "AttributeType", *attrType);
-+ return;
-+ }
-+
-+ PendingAttributesType pendingAttributes;
-+ pendingAttributes.emplace_back(std::make_pair(
-+ *attrName, std::make_tuple(biosAttrType, *attrValue)));
++ for (auto& attrInfo : inpJson)
++ {
++ std::optional<std::string> attrName;
++ std::optional<std::string> attrType;
++ std::optional<std::string> attrValue;
++ if (!json_util::getValueFromJsonObject(
++ attrInfo, "AttributeName", attrName))
++ {
++ messages::propertyMissing(asyncResp->res,
++ "AttributeName");
++ return;
++ }
++ if (!json_util::getValueFromJsonObject(
++ attrInfo, "AttributeType", attrType))
++ {
++ messages::propertyMissing(asyncResp->res,
++ "AttributeType");
++ return;
++ }
++ if (!json_util::getValueFromJsonObject(
++ attrInfo, "AttributeValue", attrValue))
++ {
++ messages::propertyMissing(asyncResp->res,
++ "AttributeValue");
++ return;
++ }
++ std::string biosAttrType = mapRedfishToAttrType(*attrType);
+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec) {
-+ if (ec)
++ if (biosAttrType == "UNKNOWN")
+ {
-+ BMCWEB_LOG_ERROR << "doPatch resp_handler got error "
-+ << ec;
-+ messages::internalError(asyncResp->res);
++ BMCWEB_LOG_ERROR << "Invalid attribute type";
++ messages::propertyValueNotInList(
++ asyncResp->res, "AttributeType", *attrType);
+ return;
+ }
-+ },
-+ "xyz.openbmc_project.BIOSConfigManager",
-+ "/xyz/openbmc_project/bios_config/manager",
-+ "org.freedesktop.DBus.Properties", "Set",
-+ "xyz.openbmc_project.BIOSConfig.Manager", "PendingAttributes",
-+ std::variant<PendingAttributesType>(pendingAttributes));
-+ }
-+ }
- };
++
++ PendingAttributesType pendingAttributes;
++ pendingAttributes.emplace_back(std::make_pair(
++ *attrName, std::make_tuple(biosAttrType, *attrValue)));
++
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](const boost::system::error_code ec) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR
++ << "doPatch resp_handler got error " << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ },
++ "xyz.openbmc_project.BIOSConfigManager",
++ "/xyz/openbmc_project/bios_config/manager",
++ "org.freedesktop.DBus.Properties", "Set",
++ "xyz.openbmc_project.BIOSConfig.Manager",
++ "PendingAttributes",
++ std::variant<PendingAttributesType>(pendingAttributes));
++ }
++ });
+ }
/**
* BiosAttributeRegistry class supports handle get method for BIOS attribute
--
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch
index 5a24996a0..028d09e74 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch
@@ -1,7 +1,7 @@
-From 4e85ce8a5f34038c289504855d21ebfa3d6b94f0 Mon Sep 17 00:00:00 2001
-From: Kuiying Wang <kuiying.wang@intel.com>
-Date: Wed, 23 Dec 2020 22:47:56 +0800
-Subject: [PATCH] Add support to ResetBios action
+From 02e44acef17a2b0681fe019e090d09015f9412e0 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 30 Jun 2021 15:27:16 +0000
+Subject: [PATCH 3/5] Add support to ResetBios action
Tested:
@@ -11,50 +11,48 @@ POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios
Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
- redfish-core/lib/bios.hpp | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
+ redfish-core/lib/bios.hpp | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 860a643..1eb7bef 100644
+index 14d2171..49c0fd0 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
-@@ -638,7 +638,7 @@ class BiosReset : public Node
- Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/")
- {
- entityPrivileges = {
-- {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
-+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
- }
-
- private:
-@@ -649,19 +649,24 @@ class BiosReset : public Node
- void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const crow::Request&, const std::vector<std::string>&) override
- {
-+ std::string resetFlag =
-+ "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults";
-
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
- if (ec)
- {
-- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec;
-+ BMCWEB_LOG_ERROR << "doPost bios reset got error " << ec;
- messages::internalError(asyncResp->res);
- return;
- }
-+ BMCWEB_LOG_DEBUG << "bios reset action is done";
- },
-- "org.open_power.Software.Host.Updater",
-- "/xyz/openbmc_project/software",
-- "xyz.openbmc_project.Common.FactoryReset", "Reset");
-+ "xyz.openbmc_project.BIOSConfigManager",
-+ "/xyz/openbmc_project/bios_config/manager",
-+ "org.freedesktop.DBus.Properties", "Set",
-+ "xyz.openbmc_project.BIOSConfig.Manager", "ResetBIOSSettings",
-+ std::variant<std::string>(resetFlag));
- }
- };
+@@ -665,24 +665,28 @@ inline void requestRoutesBiosAttributeRegistry(App& app)
+ inline void requestRoutesBiosReset(App& app)
+ {
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/")
+- // Incorrect Privilege; Should be ConfigureComponents
+- //.privileges(redfish::privileges::postBios)
+- .privileges({{"ConfigureManager"}})
++ .privileges(redfish::privileges::postBios)
+ .methods(boost::beast::http::verb::post)(
+ [](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
++ std::string resetFlag = "xyz.openbmc_project.BIOSConfig."
++ "Manager.ResetFlag.FactoryDefaults";
++
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec) {
+ if (ec)
+ {
+- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec;
++ BMCWEB_LOG_ERROR << "doPost bios reset got error "
++ << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ },
+- "org.open_power.Software.Host.Updater",
+- "/xyz/openbmc_project/software",
+- "xyz.openbmc_project.Common.FactoryReset", "Reset");
++ "xyz.openbmc_project.BIOSConfigManager",
++ "/xyz/openbmc_project/bios_config/manager",
++ "org.freedesktop.DBus.Properties", "Set",
++ "xyz.openbmc_project.BIOSConfig.Manager",
++ "ResetBIOSSettings", std::variant<std::string>(resetFlag));
+ });
+ }
} // namespace redfish
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
index e87995aca..9a2fada9e 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
@@ -1,7 +1,7 @@
-From 0ce94f6caf5d76d7f1abc71f6f8f7dc320517984 Mon Sep 17 00:00:00 2001
-From: Kuiying Wang <kuiying.wang@intel.com>
-Date: Wed, 23 Dec 2020 14:41:23 +0800
-Subject: [PATCH] Add support to ChangePassword action
+From 34f8680b21a134e2133bdcf41e1e83e4b4a05d28 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 30 Jun 2021 15:37:47 +0000
+Subject: [PATCH 4/5] Add support to ChangePassword action
Tested:
@@ -32,108 +32,85 @@ root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData
Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
- redfish-core/include/redfish.hpp | 1 +
- redfish-core/lib/bios.hpp | 70 ++++++++++++++++++++++++++++++++
- 2 files changed, 71 insertions(+)
+ redfish-core/lib/bios.hpp | 58 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
-diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 298ebb8..4418c3d 100644
---- a/redfish-core/include/redfish.hpp
-+++ b/redfish-core/include/redfish.hpp
-@@ -159,6 +159,7 @@ class RedfishService
- nodes.emplace_back(std::make_unique<BiosSettings>(app));
- nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app));
- nodes.emplace_back(std::make_unique<BiosReset>(app));
-+ nodes.emplace_back(std::make_unique<BiosChangePassword>(app));
- #ifdef BMCWEB_ENABLE_VM_NBDPROXY
- nodes.emplace_back(std::make_unique<VirtualMedia>(app));
- nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app));
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 1eb7bef..12ec472 100644
+index 49c0fd0..0250c59 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
-@@ -184,6 +184,9 @@ class BiosService : public Node
- asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = {
- {"target",
- "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}};
-+ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = {
-+ {"target",
-+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword"}};
+@@ -180,6 +180,9 @@ inline void requestRoutesBiosService(App& app)
+ asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = {
+ {"target",
+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}};
++ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = {
++ {"target", "/redfish/v1/Systems/system/Bios/Actions/"
++ "Bios.ChangePassword"}};
+
+ // Get the ActiveSoftwareImage and SoftwareImages
+ fw_util::populateFirmwareInformation(
+@@ -283,6 +286,61 @@ inline void requestRoutesBiosService(App& app)
+ });
+ }
- // Get the ActiveSoftwareImage and SoftwareImages
- fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose,
-@@ -669,4 +672,71 @@ class BiosReset : public Node
- std::variant<std::string>(resetFlag));
- }
- };
-+
+/**
+ * BiosChangePassword class supports handle POST method for change bios
+ * password. The class retrieves and sends data directly to D-Bus.
+ */
-+class BiosChangePassword : public Node
++inline void requestRoutesBiosChangePassword(App& app)
+{
-+ public:
-+ BiosChangePassword(App& app) :
-+ Node(app,
-+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/")
-+ {
-+ entityPrivileges = {
-+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
-+ }
-+
-+ private:
-+ /**
-+ * Function handles POST method request.
-+ * Analyzes POST body message before sends Reset request data to D-Bus.
-+ */
-+ void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-+ const crow::Request& req,
-+ const std::vector<std::string>&) override
-+ {
-+ std::string currentPassword, newPassword, userName;
-+ if (!json_util::readJson(req, asyncResp->res, "NewPassword",
-+ newPassword, "OldPassword", currentPassword,
-+ "PasswordName", userName))
-+ {
-+ return;
-+ }
-+ if (currentPassword.empty())
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "OldPassword");
-+ return;
-+ }
-+ if (newPassword.empty())
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "NewPassword");
-+ return;
-+ }
-+ if (userName.empty())
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "PasswordName");
-+ return;
-+ }
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec) {
-+ if (ec)
++ BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/")
++ .privileges({{"ConfigureComponents"}})
++ .methods(boost::beast::http::verb::post)(
++ [](const crow::Request& req,
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
++ std::string currentPassword, newPassword, userName;
++ if (!json_util::readJson(req, asyncResp->res, "NewPassword",
++ newPassword, "OldPassword",
++ currentPassword, "PasswordName",
++ userName))
++ {
++ return;
++ }
++ if (currentPassword.empty())
++ {
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "OldPassword");
++ return;
++ }
++ if (newPassword.empty())
++ {
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "NewPassword");
++ return;
++ }
++ if (userName.empty())
+ {
-+ BMCWEB_LOG_CRITICAL
-+ << "Failed in doPost(BiosChangePassword) " << ec;
-+ messages::internalError(asyncResp->res);
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "PasswordName");
+ return;
+ }
-+ },
-+ "xyz.openbmc_project.BIOSConfigPassword",
-+ "/xyz/openbmc_project/bios_config/password",
-+ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword",
-+ userName, currentPassword, newPassword);
-+ }
-+};
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](const boost::system::error_code ec) {
++ if (ec)
++ {
++ BMCWEB_LOG_CRITICAL
++ << "Failed in doPost(BiosChangePassword) "
++ << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ },
++ "xyz.openbmc_project.BIOSConfigPassword",
++ "/xyz/openbmc_project/bios_config/password",
++ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword",
++ userName, currentPassword, newPassword);
++ });
++}
+
- } // namespace redfish
+ /**
+ * BiosSettings class supports handle GET/PATCH method for
+ * BIOS configuration pending settings.
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch
index 75a78abb4..26393bfee 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch
@@ -1,7 +1,7 @@
-From fedcdb7887b4d934ee763d75f7988825300c5cef Mon Sep 17 00:00:00 2001
-From: Ayushi Smriti <smriti.ayushi@intel.com>
-Date: Thu, 6 May 2021 11:56:38 +0530
-Subject: [PATCH] Fix:remove bios user pwd change option via Redfish
+From edc6925e8c0d9f60da1f70c524261efaf05b2710 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 30 Jun 2021 15:42:06 +0000
+Subject: [PATCH 5/5] Fix:remove bios user pwd change option via Redfish
BMC should not provide user bios setup password change option via
Redfish as per bios security requirements. Only Admin BIOS setup
@@ -15,30 +15,32 @@ https://<ip>/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword
error occurs for UserPassword parameter and allows for AdminPassword.
Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
+Change-Id: I169cc6a4f786625d9e8b8dfe56816d52b1740f4c
---
- redfish-core/lib/bios.hpp | 9 +++++++++
- 1 file changed, 9 insertions(+)
+ redfish-core/lib/bios.hpp | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 12ec472..0416934 100644
+index 0250c59..360a749 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
-@@ -722,6 +722,15 @@ class BiosChangePassword : public Node
- "PasswordName");
- return;
- }
+@@ -323,6 +323,16 @@ inline void requestRoutesBiosChangePassword(App& app)
+ asyncResp->res, "ChangePassword", "PasswordName");
+ return;
+ }
+
-+ // In Intel BIOS, we are not supporting user password in BIOS setup
-+ if (userName == "UserPassword")
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "PasswordName");
-+ return;
-+ }
++ // In Intel BIOS, we are not supporting user password in BIOS
++ // setup
++ if (userName == "UserPassword")
++ {
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "PasswordName");
++ return;
++ }
+
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
- if (ec)
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec) {
+ if (ec)
--
2.17.1