xref: /openbmc/openpower-occ-control/occ_device.cpp (revision 94df8c9015798764d40665bb363bdbf27510f285)
1 #include "occ_device.hpp"
2 
3 #include "occ_status.hpp"
4 
5 #include <iostream>
6 
7 namespace open_power
8 {
9 namespace occ
10 {
11 
12 fs::path Device::bindPath = fs::path(OCC_HWMON_PATH) / "bind";
13 fs::path Device::unBindPath = fs::path(OCC_HWMON_PATH) / "unbind";
14 
15 bool 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 
31 void Device::throttleProcTempCallback(bool error)
32 {
33     statusObject.throttleProcTemp(error);
34 }
35 
36 void Device::throttleProcPowerCallback(bool error)
37 {
38     statusObject.throttleProcPower(error);
39 }
40 
41 void Device::throttleMemTempCallback(bool error)
42 {
43     statusObject.throttleMemTemp(error);
44 }
45 
46 } // namespace occ
47 } // namespace open_power
48