Fix power restore policy input parameter check

This changes the power restore policy command to return invalid
parameter for any unsupported policy option (greater than 0x03).

Tested:
ipmitool raw 0 6 0
 07
ipmitool chassis status
Power Restore Policy : always-off
ipmitool raw 0 6 1
 07
ipmitool chassis status
Power Restore Policy : previous
ipmitool raw 0 6 2
 07
ipmitool chassis status
Power Restore Policy : always-on
ipmitool raw 0 6 3
 07
ipmitool chassis status
Power Restore Policy : always-on
ipmitool raw 0 6 4
Unable to send RAW command (channel=0x0 netfn=0x0 lun=0x0 cmd=0x6 rsp=0xcc): Invalid data field in request

Change-Id: Ie78e00753f6dfd8b7bccce38c239a8103b6cc3fd
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 1738ccc..0f2d10c 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -781,8 +781,6 @@
 
 static constexpr uint8_t noChange = 0x03;
 static constexpr uint8_t allSupport = 0x01 | 0x02 | 0x04;
-static constexpr uint8_t policyBitMask = 0x07;
-static constexpr uint8_t setPolicyReqLen = 1;
 
 /* helper function for Get Chassis Status Command
  */
@@ -1703,26 +1701,27 @@
     }
 }
 
-ipmi::RspType<uint8_t>
+ipmi::RspType<uint3_t, // policy support
+              uint5_t  // reserved
+              >
     ipmiChassisSetPowerRestorePolicy(boost::asio::yield_context yield,
-                                     uint8_t policy)
+                                     uint3_t policy, uint5_t reserved)
 {
-    constexpr uint8_t ccParamNotSupported = 0x80;
     power_policy::DbusValue value =
         power_policy::RestorePolicy::Policy::AlwaysOff;
 
-    if (policy & ~power_policy::policyBitMask)
+    if (reserved || (policy > power_policy::noChange))
     {
         phosphor::logging::log<level::ERR>(
             "Reserved request parameter",
             entry("REQ=0x%x", static_cast<int>(policy)));
-        return ipmi::response(ccParamNotSupported);
+        return ipmi::responseInvalidFieldRequest();
     }
 
     if (policy == power_policy::noChange)
     {
         // just return the supported policy
-        return ipmi::responseSuccess(power_policy::allSupport);
+        return ipmi::responseSuccess(power_policy::allSupport, reserved);
     }
 
     for (auto const& it : power_policy::dbusToIpmi)
@@ -1765,7 +1764,7 @@
         return ipmi::responseUnspecifiedError();
     }
 
-    return ipmi::responseSuccess(power_policy::allSupport);
+    return ipmi::responseSuccess(power_policy::allSupport, reserved);
 }
 
 void register_netfn_chassis_functions()