xref: /openbmc/phosphor-power/phosphor-regulators/src/rail.cpp (revision 2ccf961732d4bbd3f6cf48e07848ee23816e53d6)
1779b9565SShawn McCarney /**
2779b9565SShawn McCarney  * Copyright © 2020 IBM Corporation
3779b9565SShawn McCarney  *
4779b9565SShawn McCarney  * Licensed under the Apache License, Version 2.0 (the "License");
5779b9565SShawn McCarney  * you may not use this file except in compliance with the License.
6779b9565SShawn McCarney  * You may obtain a copy of the License at
7779b9565SShawn McCarney  *
8779b9565SShawn McCarney  *     http://www.apache.org/licenses/LICENSE-2.0
9779b9565SShawn McCarney  *
10779b9565SShawn McCarney  * Unless required by applicable law or agreed to in writing, software
11779b9565SShawn McCarney  * distributed under the License is distributed on an "AS IS" BASIS,
12779b9565SShawn McCarney  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13779b9565SShawn McCarney  * See the License for the specific language governing permissions and
14779b9565SShawn McCarney  * limitations under the License.
15779b9565SShawn McCarney  */
16779b9565SShawn McCarney 
17779b9565SShawn McCarney #include "rail.hpp"
18779b9565SShawn McCarney 
19779b9565SShawn McCarney #include "chassis.hpp"
20779b9565SShawn McCarney #include "device.hpp"
21779b9565SShawn McCarney #include "system.hpp"
22779b9565SShawn McCarney 
23779b9565SShawn McCarney namespace phosphor::power::regulators
24779b9565SShawn McCarney {
25779b9565SShawn McCarney 
clearErrorHistory()26*2ccf9617SShawn McCarney void Rail::clearErrorHistory()
27*2ccf9617SShawn McCarney {
28*2ccf9617SShawn McCarney     // If sensor monitoring is defined for this rail, clear its error history
29*2ccf9617SShawn McCarney     if (sensorMonitoring)
30*2ccf9617SShawn McCarney     {
31*2ccf9617SShawn McCarney         sensorMonitoring->clearErrorHistory();
32*2ccf9617SShawn McCarney     }
33*2ccf9617SShawn McCarney }
34*2ccf9617SShawn McCarney 
configure(Services & services,System & system,Chassis & chassis,Device & device)3523243f84SBob King void Rail::configure(Services& services, System& system, Chassis& chassis,
3623243f84SBob King                      Device& device)
37779b9565SShawn McCarney {
38779b9565SShawn McCarney     // If configuration changes are defined for this rail, apply them
39779b9565SShawn McCarney     if (configuration)
40779b9565SShawn McCarney     {
4123243f84SBob King         configuration->execute(services, system, chassis, device, *this);
42779b9565SShawn McCarney     }
43779b9565SShawn McCarney }
44779b9565SShawn McCarney 
monitorSensors(Services & services,System & system,Chassis & chassis,Device & device)458a55292dSBob King void Rail::monitorSensors(Services& services, System& system, Chassis& chassis,
468a55292dSBob King                           Device& device)
477b743431SBob King {
487b743431SBob King     // If sensor monitoring is defined for this rail, read the sensors.
497b743431SBob King     if (sensorMonitoring)
507b743431SBob King     {
518a55292dSBob King         sensorMonitoring->execute(services, system, chassis, device, *this);
527b743431SBob King     }
537b743431SBob King }
547b743431SBob King 
55779b9565SShawn McCarney } // namespace phosphor::power::regulators
56