summaryrefslogtreecommitdiffstats
path: root/occ_device.hpp
diff options
context:
space:
mode:
authorEddie James <eajames@us.ibm.com>2017-09-14 13:17:17 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-12-12 04:48:00 +0000
commit482e31ff8e43e0fefbd697b1985795c4d35eec74 (patch)
tree9db1fcac3446e4d6221b8609e92f68a57d4bb0a0 /occ_device.hpp
parent30417a15fa35e26d5127f12e0a85c3fe74eff0d0 (diff)
downloadopenpower-occ-control-482e31ff8e43e0fefbd697b1985795c4d35eec74.tar.gz
openpower-occ-control-482e31ff8e43e0fefbd697b1985795c4d35eec74.zip
Add watches for throttling reported by the OCC
Add Error objects to watch the sysfs entries provided by the OCC hwmon driver that report various types of throttling. Also needed to add a boolean input to the Error callback interface. Resolves openbmc/openbmc#1821 Change-Id: I4425770a92ace0f73024b3dc4c577ce46957a62a Signed-off-by: Eddie James <eajames@us.ibm.com>
Diffstat (limited to 'occ_device.hpp')
-rw-r--r--occ_device.hpp58
1 files changed, 56 insertions, 2 deletions
diff --git a/occ_device.hpp b/occ_device.hpp
index 7ffb0ef..fd30641 100644
--- a/occ_device.hpp
+++ b/occ_device.hpp
@@ -13,6 +13,7 @@ namespace occ
{
class Manager;
+class Status;
namespace fs = std::experimental::filesystem;
/** @class Device
@@ -38,18 +39,38 @@ class Device
Device(EventPtr& event,
const std::string& name,
const Manager& manager,
- std::function<void()> callBack = nullptr) :
+ Status& status,
+ std::function<void(bool)> callBack = nullptr) :
#ifdef I2C_OCC
config(name),
#else
config(name + '-' + "dev0"),
#endif
errorFile(fs::path(config) / "occ_error"),
+ statusObject(status),
error(event, errorFile, callBack),
presence(event,
fs::path(config) / "occs_present",
manager,
- callBack)
+ callBack),
+ throttleProcTemp(
+ event,
+ fs::path(config) / "occ_dvfs_ot",
+ std::bind(std::mem_fn(&Device::throttleProcTempCallback),
+ this,
+ std::placeholders::_1)),
+ throttleProcPower(
+ event,
+ fs::path(config) / "occ_dvfs_power",
+ std::bind(std::mem_fn(&Device::throttleProcPowerCallback),
+ this,
+ std::placeholders::_1)),
+ throttleMemTemp(
+ event,
+ fs::path(config) / "occ_mem_throttle",
+ std::bind(std::mem_fn(&Device::throttleMemTempCallback),
+ this,
+ std::placeholders::_1))
{
// Nothing to do here
}
@@ -89,6 +110,9 @@ class Device
presence.addWatch();
}
+ throttleProcTemp.addWatch();
+ throttleProcPower.addWatch();
+ throttleMemTemp.addWatch();
error.addWatch();
}
@@ -98,6 +122,10 @@ class Device
// we can always safely remove watch even if we don't add it
presence.removeWatch();
error.removeWatch();
+ error.removeWatch();
+ throttleMemTemp.removeWatch();
+ throttleProcPower.removeWatch();
+ throttleProcTemp.removeWatch();
}
private:
@@ -118,12 +146,20 @@ class Device
*/
static fs::path unBindPath;
+ /** Store the associated Status instance */
+ Status& statusObject;
+
/** Abstraction of error monitoring */
Error error;
/** Abstraction of OCC presence monitoring */
Presence presence;
+ /** Error instances for watching for throttling events */
+ Error throttleProcTemp;
+ Error throttleProcPower;
+ Error throttleMemTemp;
+
/** @brief file writer to achieve bind and unbind
*
* @param[in] filename - Name of file to be written
@@ -141,6 +177,24 @@ class Device
/** @brief Returns if device represents the master OCC */
bool master() const;
+
+ /** @brief callback for the proc temp throttle event
+ *
+ * @param[in] error - True if an error is reported, false otherwise
+ */
+ void throttleProcTempCallback(bool error);
+
+ /** @brief callback for the proc power throttle event
+ *
+ * @param[in] error - True if an error is reported, false otherwise
+ */
+ void throttleProcPowerCallback(bool error);
+
+ /** @brief callback for the proc temp throttle event
+ *
+ * @param[in] error - True if an error is reported, false otherwise
+ */
+ void throttleMemTempCallback(bool error);
};
} // namespace occ
OpenPOWER on IntegriCloud