pfr-manager: add ufmSupport property to PFR.Attributes interface.
Add support to update the ufmSupport property in PFR.Attributes
interface.
Tested:
Command: busctl introspect xyz.openbmc_project.PFR.Manager /xyz/
openbmc_project/pfr
Response:
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
xyz.openbmc_project.PFR.Attributes interface - -
.UfmLocked property b false
.UfmProvisioned property b false
.UfmSupport property b true
Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
Change-Id: I76d9ce70e21c53b85959054155904760b5078782
diff --git a/libpfr/inc/pfr.hpp b/libpfr/inc/pfr.hpp
index 730e6eb..6ae6d60 100644
--- a/libpfr/inc/pfr.hpp
+++ b/libpfr/inc/pfr.hpp
@@ -42,7 +42,8 @@
std::string toHexString(const uint8_t val);
std::string getFirmwareVersion(const ImageType& imgType);
-int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned);
+int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned,
+ bool& ufmSupport);
int readCpldReg(const ActionType& action, uint8_t& value);
int setBMCBootCheckpoint(const uint8_t checkPoint);
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 536abe9..1058197 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -370,14 +370,17 @@
}
}
-int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned)
+int getProvisioningStatus(bool& ufmLocked, bool& ufmProvisioned,
+ bool& ufmSupport)
{
try
{
I2CFile cpldDev(i2cBusNumber, i2cSlaveAddress, O_RDWR | O_CLOEXEC);
uint8_t provStatus = cpldDev.i2cReadByteData(provisioningStatus);
+ uint8_t pfrRoT = cpldDev.i2cReadByteData(pfrROTId);
ufmLocked = (provStatus & ufmLockedMask);
ufmProvisioned = (provStatus & ufmProvisionedMask);
+ ufmSupport = (pfrRoT & pfrRoTValue);
return 0;
}
catch (const std::exception& e)
diff --git a/service/inc/pfr_mgr.hpp b/service/inc/pfr_mgr.hpp
index 13091d7..6f55eb9 100644
--- a/service/inc/pfr_mgr.hpp
+++ b/service/inc/pfr_mgr.hpp
@@ -37,6 +37,7 @@
static constexpr const char* versionStr = "Version";
static constexpr const char* ufmProvisionedStr = "UfmProvisioned";
static constexpr const char* ufmLockedStr = "UfmLocked";
+static constexpr const char* ufmSupportStr = "UfmSupport";
class PfrVersion
{
@@ -80,6 +81,7 @@
bool ufmProvisioned;
bool ufmLocked;
+ bool ufmSupport;
};
} // namespace pfr
diff --git a/service/src/pfr_mgr.cpp b/service/src/pfr_mgr.cpp
index 4d77c0e..479cf5f 100644
--- a/service/src/pfr_mgr.cpp
+++ b/service/src/pfr_mgr.cpp
@@ -116,7 +116,10 @@
pfrCfgIface = server.add_interface("/xyz/openbmc_project/pfr",
"xyz.openbmc_project.PFR.Attributes");
- getProvisioningStatus(ufmLocked, ufmProvisioned);
+ ufmLocked = false;
+ ufmProvisioned = false;
+ ufmSupport = false;
+ getProvisioningStatus(ufmLocked, ufmProvisioned, ufmSupport);
pfrCfgIface->register_property(ufmProvisionedStr, ufmProvisioned,
// Override set
@@ -148,6 +151,21 @@
return 0;
});
+ pfrCfgIface->register_property(ufmSupportStr, ufmSupport,
+ // Override set
+ [this](const bool req, bool propertyValue) {
+ if (internalSet)
+ {
+ if (req != propertyValue)
+ {
+ ufmSupport = req;
+ propertyValue = req;
+ return 1;
+ }
+ }
+ return 0;
+ });
+
pfrCfgIface->initialize();
associationIface =
@@ -163,10 +181,12 @@
{
bool lockVal = false;
bool provVal = false;
- getProvisioningStatus(lockVal, provVal);
+ bool supportVal = false;
+ getProvisioningStatus(lockVal, provVal, supportVal);
internalSet = true;
pfrCfgIface->set_property(ufmProvisionedStr, provVal);
pfrCfgIface->set_property(ufmLockedStr, lockVal);
+ pfrCfgIface->set_property(ufmSupportStr, supportVal);
internalSet = false;
}
return;