Revert clearing PDRs if host power is off
Code was added to clear the PDRs when the host was powered off, but the
next power on occ-control never saw the OCC StateSensor updates.
This change will be reverted to resolve this issue.
Tested on multiple machines with multiple reboots and guarded procs
Change-Id: Ibea28ede25c81f22e4e9fe2574c1668c4a81352c
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/pldm.hpp b/pldm.hpp
index f67a36b..3f0c844 100644
--- a/pldm.hpp
+++ b/pldm.hpp
@@ -70,6 +70,12 @@
MatchRules::interface("xyz.openbmc_project.PLDM.Event"),
std::bind(std::mem_fn(&Interface::sensorEvent), this,
std::placeholders::_1)),
+ hostStateSignal(
+ open_power::occ::utils::getBus(),
+ MatchRules::propertiesChanged("/xyz/openbmc_project/state/host0",
+ "xyz.openbmc_project.State.Host"),
+ std::bind(std::mem_fn(&Interface::hostStateEvent), this,
+ std::placeholders::_1)),
sdpEvent(sdeventplus::Event::get_default()),
pldmRspTimer(
sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>(
@@ -168,6 +174,9 @@
*/
sdbusplus::bus::match_t pldmEventSignal;
+ /** @brief Used to subscribe for host state change signal */
+ sdbusplus::bus::match_t hostStateSignal;
+
/** @brief PLDM Sensor ID to OCC Instance mapping
*/
SensorToInstance sensorToOCCInstance;
@@ -250,6 +259,14 @@
*/
void sensorEvent(sdbusplus::message::message& msg);
+ /** @brief When the host state changes and if the CurrentHostState is
+ * xyz.openbmc_project.State.Host.HostState.Off then
+ * the cache of OCC sensors and effecters mapping is cleared.
+ *
+ * @param[in] msg - data associated with the subscribed signal
+ */
+ void hostStateEvent(sdbusplus::message::message& msg);
+
/** @brief Called when it is determined that the Host is not running.
* The cache of OCC sensors and effecters mapping is cleared.
*/