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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
From d5cfc5a0aaa50cc94054886e5cb7be25ef167c71 Mon Sep 17 00:00:00 2001
From: huanghe <he.huang@intel.com>
Date: Sat, 10 Oct 2020 14:40:00 +0800
Subject: [PATCH 7/7] Add set in progress paramter to set/get boot option
command
Signed-off-by: huanghe <he.huang@intel.com>
---
chassishandler.cpp | 34 ++++++++++++++++++++++++++++++++++
chassishandler.hpp | 3 +++
2 files changed, 37 insertions(+)
diff --git a/chassishandler.cpp b/chassishandler.cpp
index f043340..322aa9e 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1564,6 +1564,10 @@ static ipmi::Cc setBootMode(const Mode::Modes& mode)
return ipmi::ccSuccess;
}
+static constexpr uint8_t setComplete = 0x0;
+static constexpr uint8_t setInProgress = 0x1;
+static uint8_t transferStatus = setComplete;
+
/** @brief implements the Get Chassis system boot option
* @param bootOptionParameter - boot option parameter selector
* @param reserved1 - reserved bit
@@ -1598,6 +1602,14 @@ ipmi::RspType<ipmi::message::Payload>
IpmiValue bootOption = ipmiDefault;
+
+ if (static_cast<uint8_t>(bootOptionParameter) ==
+ static_cast<uint8_t>(BootOptionParameter::setInProgress))
+ {
+ response.pack(bootOptionParameter,reserved1,transferStatus);
+ return ipmi::responseSuccess(std::move(response));
+ }
+
/*
* Parameter #5 means boot flags. Please refer to 28.13 of ipmi doc.
* This is the only parameter used by petitboot.
@@ -1719,6 +1731,28 @@ ipmi::RspType<> ipmiChassisSetSysBootOptions(ipmi::Context::ptr ctx,
using namespace boot_options;
ipmi::Cc rc;
+ if (parameterSelector ==
+ static_cast<uint7_t>(BootOptionParameter::setInProgress))
+ {
+ uint2_t setInProgressFlag;
+ uint6_t rsvd;
+ if (data.unpack(setInProgressFlag,rsvd) != 0 ||
+ !data.fullyUnpacked())
+ {
+ return ipmi::responseReqDataLenInvalid();
+ }
+ if (rsvd)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+ if ((transferStatus == setInProgress) &&
+ ((uint8_t)setInProgressFlag != setComplete))
+ {
+ return ipmi::response(IPMI_CC_FAIL_SET_IN_PROGRESS);
+ }
+ transferStatus = (uint8_t)setInProgressFlag;
+ }
+
/* 000101
* Parameter #5 means boot flags. Please refer to 28.13 of ipmi doc.
* This is the only parameter used by petitboot.
diff --git a/chassishandler.hpp b/chassishandler.hpp
index 93de2c0..5976abc 100644
--- a/chassishandler.hpp
+++ b/chassishandler.hpp
@@ -25,6 +25,7 @@ enum ipmi_chassis_return_codes
{
IPMI_OK = 0x0,
IPMI_CC_PARM_NOT_SUPPORTED = 0x80,
+ IPMI_CC_FAIL_SET_IN_PROGRESS = 0x81,
};
// Generic completion codes,
@@ -46,6 +47,7 @@ enum ipmi_chassis_control_cmds : uint8_t
};
enum class BootOptionParameter : size_t
{
+ setInProgress= 0x0,
bootInfo = 0x4,
bootFlags = 0x5,
opalNetworkSettings = 0x61
@@ -53,6 +55,7 @@ enum class BootOptionParameter : size_t
enum class BootOptionResponseSize : size_t
{
+ setInProgress = 3,
bootFlags = 5,
opalNetworkSettings = 50
};
--
2.17.1
|