summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch
blob: 028d09e746ccb03717f8b804f2e5a2f1747ec97d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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:

Bios reset flag can be modified throw redfish
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 | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 14d2171..49c0fd0 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -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