blob: b100d469d4460e898ad2630c9bfb282d8e915227 [file] [log] [blame]
Edward A. James636577f2017-10-06 10:53:55 -05001#include <iostream>
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +05302#include "occ_device.hpp"
Eddie James482e31f2017-09-14 13:17:17 -05003#include "occ_status.hpp"
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +05304
5namespace open_power
6{
7namespace occ
8{
9
10fs::path Device::bindPath = fs::path(OCC_HWMON_PATH) / "bind";
11fs::path Device::unBindPath = fs::path(OCC_HWMON_PATH) / "unbind";
12
Edward A. James636577f2017-10-06 10:53:55 -050013bool Device::master() const
14{
15 int master;
16 auto masterFile = fs::path(DEV_PATH) / config / "occ_master";
17 std::ifstream file(masterFile, std::ios::in);
18
19 if (!file)
20 {
21 return false;
22 }
23
24 file >> master;
25 file.close();
26 return (master != 0);
27}
28
Eddie James482e31f2017-09-14 13:17:17 -050029void Device::throttleProcTempCallback(bool error)
30{
31 statusObject.throttleProcTemp(error);
32}
33
34void Device::throttleProcPowerCallback(bool error)
35{
36 statusObject.throttleProcPower(error);
37}
38
39void Device::throttleMemTempCallback(bool error)
40{
41 statusObject.throttleMemTemp(error);
42}
43
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +053044} // namespace occ
45} // namespace open_power