Add pfr postcode feature

Add PfrPostcode object to read platformState mailbox register.
Add dbus object to PFR manager service so current platform state
value can be read by interested application like Redfish.
PfrPostcode object is added only when system is pfr provisioned.

Tested:
Manually verified dbus object properties as below -

busctl introspect xyz.openbmc_project.PFR.Manager /xyz/openbmc_project/pfr
NAME                                    TYPE      SIGNATURE  RESULT/VALUE  FLAGS
xyz.openbmc_project.State.Boot.Platform interface -          -                  -
.Data                                   property  y          14                 emits-change writable
.PlatformState                          property  s          "T0 boot complete" emits-change

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: I3f3581af23c2656523ee975b2aab9ba15078c934
diff --git a/libpfr/inc/pfr.hpp b/libpfr/inc/pfr.hpp
index 6dbf455..fb42b23 100644
--- a/libpfr/inc/pfr.hpp
+++ b/libpfr/inc/pfr.hpp
@@ -51,6 +51,7 @@
 std::string getFirmwareVersion(const ImageType& imgType);
 int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned,
                           bool& ufmSupport);
+int getPlatformState(uint8_t& state);
 int readCpldReg(const ActionType& action, uint8_t& value);
 std::string readCPLDVersion();
 int setBMCBootCheckpoint(const uint8_t checkPoint);
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 77320fa..0402641 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -485,6 +485,24 @@
     }
 }
 
+int getPlatformState(uint8_t& state)
+{
+    try
+    {
+        I2CFile cpldDev(i2cBusNumber, i2cSlaveAddress, O_RDWR | O_CLOEXEC);
+        state = cpldDev.i2cReadByteData(platformState);
+
+        return 0;
+    }
+    catch (const std::exception& e)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Exception caught in getPlatformState.",
+            phosphor::logging::entry("MSG=%s", e.what()));
+        return -1;
+    }
+}
+
 int readCpldReg(const ActionType& action, uint8_t& value)
 {
     uint8_t cpldReg;