Softoff: Add config support for PDR entities
This commit introduces a config file for the soft power off
app. The config file specifies the order of remote PDRs to
be checked during the soft power off process.
Previously, the entity type was hardcoded in the codebase,
limiting scalability. With this change, the softoff app gains
flexibility for future expansions.
TESTED: By running 'obmcutil poweroff' with various remote
entities during boot-up.
Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
Change-Id: Ib8d2aba6a05fc4e9da4b042fd67890e6282ed784
diff --git a/softoff/softoff.hpp b/softoff/softoff.hpp
index edec74e..866784b 100644
--- a/softoff/softoff.hpp
+++ b/softoff/softoff.hpp
@@ -4,6 +4,7 @@
#include "common/transport.hpp"
#include "common/types.hpp"
+#include <nlohmann/json.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
#include <sdbusplus/server/object.hpp>
@@ -12,6 +13,7 @@
namespace pldm
{
+using Json = nlohmann::json;
/** @class SoftPowerOff
* @brief Responsible for coordinating Host SoftPowerOff operation
@@ -79,6 +81,12 @@
return timer.stop();
}
+ /** @brief method to parse the config Json file for softoff
+ *
+ * @return Json - Json object of
+ */
+ Json parseConfig();
+
/** @brief When host soft off completed, stop the timer and
* set the completed to true.
*
@@ -96,15 +104,25 @@
/** @brief Get effecterID from PDRs.
*
- * @return PLDM_SUCCESS or PLDM_ERROR
+ * @param[in] entityType - entity type of the entity hosting
+ * hosting softoff PDR
+ * @param[in] stateSetId - state set ID of the softoff PDR
+ *
+ * @return true or false
*/
- int getEffecterID();
+ bool getEffecterID(pldm::pdr::EntityType& entityType,
+ pldm::pdr::StateSetId& stateSetId);
/** @brief Get VMM/SystemFirmware Sensor info from PDRs.
*
+ * @param[in] entityType - entity type of the entity hosting
+ * hosting softoff PDR
+ * @param[in] stateSetId - state set ID of the softoff PDR
+ *
* @return PLDM_SUCCESS or PLDM_ERROR
*/
- int getSensorInfo();
+ int getSensorInfo(pldm::pdr::EntityType& entityType,
+ pldm::pdr::StateSetId& stateSetId);
/** @brief effecterID
*/
@@ -130,10 +148,6 @@
*/
bool responseReceived = false;
- /** @brief Is the Virtual Machine Manager/VMM state effecter available.
- */
- bool VMMPdrExist = true;
-
/* @brief sdbusplus handle */
sdbusplus::bus_t& bus;