diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index 0a986f5..65bea78 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -39,6 +39,7 @@
 std::unique_ptr<boost::asio::steady_timer> pfrObjTimer = nullptr;
 std::vector<std::unique_ptr<PfrVersion>> pfrVersionObjects;
 std::unique_ptr<PfrConfig> pfrConfigObject;
+std::unique_ptr<PfrPostcode> pfrPostcodeObject;
 
 // List holds <ObjPath> <ImageType> <VersionPurpose>
 static std::vector<std::tuple<std::string, ImageType, std::string>>
@@ -689,6 +690,16 @@
             std::get<2>(entry)));
     }
 
+    if (pfr::pfrConfigObject)
+    {
+        pfr::pfrConfigObject->updateProvisioningStatus();
+        if (pfr::pfrConfigObject->getPfrProvisioned())
+        {
+            pfr::pfrPostcodeObject =
+                std::make_unique<pfr::PfrPostcode>(server, conn);
+        }
+    }
+
     conn->request_name("xyz.openbmc_project.PFR.Manager");
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Intel PFR service started successfully");
diff --git a/service/src/pfr_mgr.cpp b/service/src/pfr_mgr.cpp
index 2fc73fd..fc69fea 100644
--- a/service/src/pfr_mgr.cpp
+++ b/service/src/pfr_mgr.cpp
@@ -213,4 +213,83 @@
     return;
 }
 
+static constexpr const char* postcodeStrProp = "PlatformState";
+static constexpr const char* postcodeStrDefault = "Unknown";
+static constexpr const char* postcodeDataProp = "Data";
+static constexpr const char* postcodeIface =
+    "xyz.openbmc_project.State.Boot.Platform";
+
+PfrPostcode::PfrPostcode(sdbusplus::asio::object_server& srv_,
+                         std::shared_ptr<sdbusplus::asio::connection>& conn_) :
+    server(srv_),
+    conn(conn_)
+{
+    if (getPlatformState(postcode) < 0)
+    {
+        postcode = 0;
+    }
+
+    pfrPostcodeIface =
+        server.add_interface("/xyz/openbmc_project/pfr", postcodeIface);
+
+    if (pfrPostcodeIface != nullptr)
+    {
+        pfrPostcodeIface->register_property(
+            postcodeDataProp, postcode,
+            // Override set
+            [this](const uint8_t req, uint8_t& propertyValue) {
+                if (internalSet)
+                {
+                    if (req != propertyValue)
+                    {
+                        postcode = req;
+                        propertyValue = req;
+                        return 1;
+                    }
+                }
+                return 0;
+            },
+            [this](uint8_t& propertyValue) {
+                updatePostcode();
+                propertyValue = postcode;
+                return propertyValue;
+            });
+
+        pfrPostcodeIface->register_property(postcodeStrProp,
+                                            std::string(postcodeStrDefault));
+
+        pfrPostcodeIface->initialize();
+        auto it = postcodeMap.find(postcode);
+        if (it != postcodeMap.end())
+        {
+            pfrPostcodeIface->set_property(postcodeStrProp, it->second);
+        }
+    }
+}
+
+void PfrPostcode::updatePostcode()
+{
+    if (pfrPostcodeIface && pfrPostcodeIface->is_initialized())
+    {
+        if (getPlatformState(postcode) < 0)
+        {
+            postcode = 0;
+        }
+
+        internalSet = true;
+        pfrPostcodeIface->set_property(postcodeDataProp, postcode);
+        auto it = postcodeMap.find(postcode);
+        if (it == postcodeMap.end())
+        {
+            pfrPostcodeIface->set_property(postcodeStrProp, postcodeStrDefault);
+        }
+        else
+        {
+            pfrPostcodeIface->set_property(postcodeStrProp, it->second);
+        }
+        internalSet = false;
+    }
+    return;
+}
+
 } // namespace pfr
