Add set in progress paramter to set/get boot option command

Signed-off-by: huanghe <he.huang@intel.com>
Change-Id: Ib977e9c6a1b4ca6bbca9695c30fa90496cf211a6
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 3250b2c..5431e59 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1670,6 +1670,10 @@
     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
@@ -1704,6 +1708,13 @@
 
     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.
@@ -1825,6 +1836,28 @@
     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) &&
+            (static_cast<uint8_t>(setInProgressFlag) != setComplete))
+        {
+            return ipmi::response(IPMI_CC_FAIL_SET_IN_PROGRESS);
+        }
+        transferStatus = static_cast<uint8_t>(setInProgressFlag);
+        return ipmi::responseSuccess();
+    }
+
     /*  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 @@
 {
     IPMI_OK = 0x0,
     IPMI_CC_PARM_NOT_SUPPORTED = 0x80,
+    IPMI_CC_FAIL_SET_IN_PROGRESS = 0x81,
 };
 
 // Generic completion codes,
@@ -46,6 +47,7 @@
 };
 enum class BootOptionParameter : size_t
 {
+    setInProgress= 0x0,
     bootInfo = 0x4,
     bootFlags = 0x5,
     opalNetworkSettings = 0x61
@@ -53,6 +55,7 @@
 
 enum class BootOptionResponseSize : size_t
 {
+    setInProgress = 3,
     bootFlags = 5,
     opalNetworkSettings = 50
 };