blob: 362d5178b393b5ccf99f2550b5ca270de512a94e [file] [log] [blame]
Patrick Venturee6206562018-03-08 15:36:53 -08001#pragma once
2
Patrick Venture39199b42020-10-08 14:40:29 -07003#include "conf.hpp"
James Feist0c8223b2019-05-08 15:33:33 -07004#include "pid/ec/pid.hpp"
5
James Feist5ec20272019-07-10 11:59:57 -07006#include <phosphor-logging/log.hpp>
James Feist0c8223b2019-05-08 15:33:33 -07007#include <sdbusplus/bus.hpp>
Patrick Venturea83a3ec2020-08-04 09:52:05 -07008
Patrick Venture39199b42020-10-08 14:40:29 -07009#include <cstdint>
Patrick Venturea83a3ec2020-08-04 09:52:05 -070010#include <limits>
Patrick Venture39199b42020-10-08 14:40:29 -070011#include <map>
Patrick Ventureda064282018-06-12 19:33:47 -070012#include <string>
13
Patrick Venturea0764872020-08-08 07:48:43 -070014namespace pid_control
15{
16
Hao Jiangb228cea2021-02-20 11:53:09 -080017void tryRestartControlLoops(bool first = true);
James Feist1fe08952019-05-07 09:17:16 -070018
James Feist0c8223b2019-05-08 15:33:33 -070019/*
20 * Given a configuration structure, fill out the information we use within the
21 * PID loop.
22 */
23void initializePIDStruct(ec::pid_info_t* info, const ec::pidinfo& initial);
24
25void dumpPIDStruct(ec::pid_info_t* info);
26
James Feist0c8223b2019-05-08 15:33:33 -070027struct SensorThresholds
28{
29 double lowerThreshold = std::numeric_limits<double>::quiet_NaN();
30 double upperThreshold = std::numeric_limits<double>::quiet_NaN();
31};
32
33const std::string sensorintf = "xyz.openbmc_project.Sensor.Value";
34const std::string criticalThreshInf =
35 "xyz.openbmc_project.Sensor.Threshold.Critical";
36const std::string propertiesintf = "org.freedesktop.DBus.Properties";
37
James Feist0c8223b2019-05-08 15:33:33 -070038/*
39 * Given a path that optionally has a glob portion, fill it out.
40 */
41std::string FixupPath(std::string original);
Patrick Venturea0764872020-08-08 07:48:43 -070042
Patrick Venture39199b42020-10-08 14:40:29 -070043/*
44 * Dump active configuration.
45 */
46void debugPrint(const std::map<std::string, conf::SensorConfig>& sensorConfig,
47 const std::map<int64_t, conf::PIDConf>& zoneConfig,
48 const std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig);
49
Patrick Venturea0764872020-08-08 07:48:43 -070050} // namespace pid_control