Fix: Ignore reverting for validation unsecure mode

Ignore reverting executed manufacturing command behavior when
in validation unsecure mode. In that mode, just preserve the
set value as such till BMC is rebooted.

Tested:
1. Verified by setting a FAN to 100 % PWM and it stays even after 15
minutes as expected.

Change-Id: I426f69d129dab0b04571afd4fde043119bc5e26b
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index d8b49dc..f2f8a58 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -176,6 +176,14 @@
 
 void Manufacturing::revertTimerHandler()
 {
+
+#ifdef BMC_VALIDATION_UNSECURE_FEATURE
+    if (mtm.getMfgMode() == SpecialMode::valUnsecure)
+    {
+        // Don't revert the behaviour for validation unsecure mode.
+        return;
+    }
+#endif
     if (revertFanPWM)
     {
         revertFanPWM = false;
@@ -762,8 +770,8 @@
         case makeCmdKey(ipmi::netFnApp, ipmi::app::cmdMasterWriteRead):
             if (request->payload.size() > 4)
             {
-                // Allow write data count > 1, only if it is in MFG mode
-                if (!mtm.isMfgMode())
+                // Allow write data count > 1 only in Special mode
+                if (mtm.getMfgMode() == SpecialMode::none)
                 {
                     return ipmi::ccInsufficientPrivilege;
                 }
@@ -781,8 +789,8 @@
                         ipmi::intel::general::cmdGetManufacturingData):
         case makeCmdKey(ipmi::netFnStorage, ipmi::storage::cmdWriteFruData):
 
-            // Check for MTM mode
-            if (!mtm.isMfgMode())
+            // Check for Special mode
+            if (mtm.getMfgMode() == SpecialMode::none)
             {
                 return ipmi::ccInvalidCommand;
             }
@@ -917,10 +925,10 @@
     }
 
     // Allow single byte write as it is offset byte to read the data, rest allow
-    // only in MFG mode.
+    // only in Special mode.
     if (writeCount > 1)
     {
-        if (!mtm.isMfgMode())
+        if (mtm.getMfgMode() == SpecialMode::none)
         {
             return ipmi::responseInsufficientPrivilege();
         }
@@ -961,7 +969,7 @@
     std::vector<uint8_t> writeData = {0x60, 0x1};
     std::vector<uint8_t> readBuf(0);
 
-    if (!mtm.isMfgMode())
+    if (mtm.getMfgMode() == SpecialMode::none)
     {
         return ipmi::responseInsufficientPrivilege();
     }