summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-09-04 15:06:20 +0530
committerVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-09-26 16:21:16 +0530
commitb57f151092ae04ca2849851ac406624b87666e8c (patch)
treee7a4732bc88a0a265bdff7df215af5f91f778d66
parente2fb55664195a6d8379f7b07e147c3a184e23687 (diff)
downloadopenpower-occ-control-b57f151092ae04ca2849851ac406624b87666e8c.tar.gz
openpower-occ-control-b57f151092ae04ca2849851ac406624b87666e8c.zip
Set OccActive property on application start
Host sends OCC active status command just once as part of power on operation and when that is sent, occ control application binds the device. As part of bind, a sysfs file gets created that would be used to communicate the occ error status back to user. If occ control application terminates and restarts, then it needs some way to set OccActive property and this commit adds that support. Solution is to check if the device is already bound by checking the presence of the OCC_HWMON_PATH/occ<number>-dev0 and set the property if found Fixes openbmc/openbmc#2238 Change-Id: I920b52e3970cc91af50b5bc68ead44c66eab8944 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
-rw-r--r--occ_device.hpp14
-rw-r--r--occ_manager.hpp2
-rw-r--r--occ_status.hpp11
3 files changed, 24 insertions, 3 deletions
diff --git a/occ_device.hpp b/occ_device.hpp
index a2b4e85..3f7dff4 100644
--- a/occ_device.hpp
+++ b/occ_device.hpp
@@ -6,7 +6,6 @@
#include "occ_errors.hpp"
#include "config.h"
-
namespace open_power
{
namespace occ
@@ -61,6 +60,19 @@ class Device
return write(unBindPath, config);
}
+ /** @brief Returns if device is already bound.
+ *
+ * On device bind, a soft link by the name $config
+ * gets created in OCC_HWMON_PATH and gets removed
+ * on unbind
+ *
+ * @return true if bound, else false
+ */
+ inline bool bound() const
+ {
+ return fs::exists(OCC_HWMON_PATH + config);
+ }
+
/** @brief Starts to monitor for errors */
inline void addErrorWatch()
{
diff --git a/occ_manager.hpp b/occ_manager.hpp
index 7bb1042..0d32241 100644
--- a/occ_manager.hpp
+++ b/occ_manager.hpp
@@ -48,6 +48,7 @@ struct Manager
// I2C OCC status objects are initialized directly
initStatusObjects();
#else
+
// Check if CPU inventory exists already.
auto occs = open_power::occ::finder::get(bus);
if (occs.empty())
@@ -75,6 +76,7 @@ struct Manager
#endif
}
+
private:
/** @brief Callback that responds to cpu creation in the inventory -
* by creating the needed objects.
diff --git a/occ_status.hpp b/occ_status.hpp
index c097908..a334a2b 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -55,7 +55,7 @@ class Status : public Interface
EventPtr& event,
const char* path,
std::function<void(bool)> callBack = nullptr)
- : Interface(bus, path),
+ : Interface(bus, path, true),
bus(bus),
path(path),
callBack(callBack),
@@ -78,7 +78,14 @@ class Status : public Interface
std::bind(std::mem_fn(&Status::hostControlEvent),
this, std::placeholders::_1))
{
- // Nothing to do here
+ // Check to see if we have OCC already bound. If so, just set it
+ if (device.bound())
+ {
+ this->occActive(true);
+ }
+
+ // Announce that we are ready
+ this->emit_object_added();
}
/** @brief Since we are overriding the setter-occActive but not the
OpenPOWER on IntegriCloud