blob: b05dc095f2ff1caa7a0698e9bba38c2938003859 [file] [log] [blame]
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +05301#include "occ_device.hpp"
Gunnar Mills94df8c92018-09-14 14:50:03 -05002
Eddie James482e31f2017-09-14 13:17:17 -05003#include "occ_status.hpp"
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +05304
Gunnar Mills94df8c92018-09-14 14:50:03 -05005#include <iostream>
6
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +05307namespace open_power
8{
9namespace occ
10{
11
12fs::path Device::bindPath = fs::path(OCC_HWMON_PATH) / "bind";
13fs::path Device::unBindPath = fs::path(OCC_HWMON_PATH) / "unbind";
14
Edward A. James636577f2017-10-06 10:53:55 -050015bool Device::master() const
16{
17 int master;
18 auto masterFile = fs::path(DEV_PATH) / config / "occ_master";
19 std::ifstream file(masterFile, std::ios::in);
20
21 if (!file)
22 {
23 return false;
24 }
25
26 file >> master;
27 file.close();
28 return (master != 0);
29}
30
Eddie James482e31f2017-09-14 13:17:17 -050031void Device::throttleProcTempCallback(bool error)
32{
Gunnar Mills94df8c92018-09-14 14:50:03 -050033 statusObject.throttleProcTemp(error);
Eddie James482e31f2017-09-14 13:17:17 -050034}
35
36void Device::throttleProcPowerCallback(bool error)
37{
Gunnar Mills94df8c92018-09-14 14:50:03 -050038 statusObject.throttleProcPower(error);
Eddie James482e31f2017-09-14 13:17:17 -050039}
40
41void Device::throttleMemTempCallback(bool error)
42{
Gunnar Mills94df8c92018-09-14 14:50:03 -050043 statusObject.throttleMemTemp(error);
Eddie James482e31f2017-09-14 13:17:17 -050044}
45
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +053046} // namespace occ
47} // namespace open_power