PFR: Setting BMC boot finished checkpoint

Adding support to monitor the StartupFinished systemd
signal and setting the "bmc boot finished" checkpoint
to cpld.

Tested:
Did BMC reset and cross verified bmc boot finished
check-point properly set or not.

Change-Id: I14e6aa8b364b28da6cd6b2473cde8502d1ebd77c
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 1ad98b2..2e87fa9 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -41,6 +41,7 @@
 static constexpr uint8_t majorErrorCode = 0x08;
 static constexpr uint8_t minorErrorCode = 0x09;
 static constexpr uint8_t provisioningStatus = 0x0A;
+static constexpr uint8_t bmcBootCheckpoint = 0x0F;
 static constexpr uint8_t pchActiveMajorVersion = 0x17;
 static constexpr uint8_t pchActiveMinorVersion = 0x18;
 static constexpr uint8_t bmcActiveMajorVersion = 0x19;
@@ -186,5 +187,22 @@
     }
 }
 
+int setBMCBootCheckpoint(const uint8_t checkPoint)
+{
+    try
+    {
+        I2CFile cpldDev(i2cBusNumber, i2cSlaveAddress, O_RDWR | O_CLOEXEC);
+        cpldDev.i2cWriteByteData(bmcBootCheckpoint, checkPoint);
+        return 0;
+    }
+    catch (const std::exception& e)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Exception caught in setBMCBootCheckout.",
+            phosphor::logging::entry("MSG=%s", e.what()));
+        return -1;
+    }
+}
+
 } // namespace pfr
 } // namespace intel