summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0012-ipmi-set-get-boot-options.patch
blob: fb5dcee0981fe55f96050a9d17e09215b79b4dd0 (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
60
61
62
From 7b5c6a54c049a447b1fd3a42f9d63322dcee4dc7 Mon Sep 17 00:00:00 2001
From: Yong Li <yong.b.li@linux.intel.com>
Date: Sun, 16 Sep 2018 19:45:10 +0800
Subject: [PATCH] [ipmi] set/get boot options

1. fix issue for handling unsupported paramter
2. add support for floppy/USB boot

Change-Id: I2b888c1ad67fec7924dd5825f78622cd216a55f4
Signed-off-by: Jia, Chunhui <chunhui.jia@intel.com>
Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
---
 chassishandler.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/chassishandler.cpp b/chassishandler.cpp
index 666addb..77af2dc 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1244,7 +1244,8 @@ constexpr auto ipmiDefault = 0;
 std::map<IpmiValue, Source::Sources> sourceIpmiToDbus = {
     {0x01, Source::Sources::Network},
     {0x02, Source::Sources::Disk},
     {0x05, Source::Sources::ExternalMedia},
+    {0x0f, Source::Sources::RemovableMedia},
     {ipmiDefault, Source::Sources::Default}};
 
 std::map<IpmiValue, Mode::Modes> modeIpmiToDbus = {
@@ -1255,7 +1256,8 @@ std::map<IpmiValue, Mode::Modes> modeIpmiToDbus = {
 std::map<Source::Sources, IpmiValue> sourceDbusToIpmi = {
     {Source::Sources::Network, 0x01},
     {Source::Sources::Disk, 0x02},
     {Source::Sources::ExternalMedia, 0x05},
+    {Source::Sources::RemovableMedia, 0x0f},
     {Source::Sources::Default, ipmiDefault}};
 
 std::map<Mode::Modes, IpmiValue> modeDbusToIpmi = {
@@ -1533,7 +1535,7 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
                     setBootMode(Mode::Modes::Regular);
                 }
             }
-            if (modeIpmiToDbus.end() != modeItr)
+            else if (modeIpmiToDbus.end() != modeItr)
             {
                 rc = setBootMode(modeItr->second);
                 if (rc != IPMI_CC_OK)
@@ -1550,6 +1552,12 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
                     setBootSource(Source::Sources::Default);
                 }
             }
+            else
+            {
+                // if boot option is not in support list, return error
+                *data_len = 0;
+                return IPMI_CC_INVALID_FIELD_REQUEST;
+            }
         }
         catch (InternalFailure& e)
         {
-- 
2.7.4