diff options
Diffstat (limited to 'meta-quanta/meta-gbs/recipes-phosphor/fans')
4 files changed, 646 insertions, 153 deletions
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch deleted file mode 100644 index 050c8b43c..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch +++ /dev/null @@ -1,117 +0,0 @@ -From c9b6d4589620275a625121b0ea9f4cc4c93b608a Mon Sep 17 00:00:00 2001 -From: Ian Goegebuer <goegebuer@google.com> -Date: Tue, 10 Nov 2020 14:20:47 -0800 -Subject: [PATCH] pid/zone: Add the ability to dynamically set the failSafe - percent - -This change advertises the failSafe percent as a FanSpeed interface -added to the the FanCtrl object generated by the config.json file. - -The target method added in this case sets the failSafePerecent -out of 255 with 255 being 100% and 0 being 0%. - -Example: -`busctl set-property xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone1 xyz.openbmc_project.Control.FanSpeed Target t 178` -Sets the failSafePercent to 69.8% or ~70% -`busctl set-property xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone1 xyz.openbmc_project.Control.FanSpeed Target t 250` -Sets the failSafePercent to 98% - -Signed-off-by: Ian Goegebuer <goegebuer@google.com> -Change-Id: Ief538d865dc1c654427ed9792496ab368e8803e2 ---- - pid/zone.cpp | 11 +++++++++++ - pid/zone.hpp | 11 +++++++++-- - pid/zone_interface.hpp | 1 + - 3 files changed, 21 insertions(+), 2 deletions(-) - -diff --git a/pid/zone.cpp b/pid/zone.cpp -index 441031a..24f6e84 100644 ---- a/pid/zone.cpp -+++ b/pid/zone.cpp -@@ -120,6 +120,11 @@ double DbusPidZone::getFailSafePercent(void) const - return _failSafePercent; - } - -+void DbusPidZone::setFailSafePercent(double newFailSafe) -+{ -+ _failSafePercent = newFailSafe; -+} -+ - double DbusPidZone::getMinThermalSetpoint(void) const - { - return _minThermalOutputSetPt; -@@ -459,4 +464,10 @@ bool DbusPidZone::failSafe() const - return getFailSafeMode(); - } - -+uint64_t DbusPidZone::target(uint64_t value) -+{ -+ setFailSafePercent(((double)value / 255) * 100.0); -+ return ModeObject::target(value); -+} -+ - } // namespace pid_control -diff --git a/pid/zone.hpp b/pid/zone.hpp -index 3bea9c2..c0d1d22 100644 ---- a/pid/zone.hpp -+++ b/pid/zone.hpp -@@ -10,6 +10,7 @@ - - #include <sdbusplus/bus.hpp> - #include <sdbusplus/server.hpp> -+#include <xyz/openbmc_project/Control/FanSpeed/server.hpp> - #include <xyz/openbmc_project/Control/Mode/server.hpp> - - #include <fstream> -@@ -22,7 +23,9 @@ - template <typename... T> - using ServerObject = typename sdbusplus::server::object::object<T...>; - using ModeInterface = sdbusplus::xyz::openbmc_project::Control::server::Mode; --using ModeObject = ServerObject<ModeInterface>; -+using FanSpeedInterface = -+ sdbusplus::xyz::openbmc_project::Control::server::FanSpeed; -+using ModeObject = ServerObject<ModeInterface, FanSpeedInterface>; - - namespace pid_control - { -@@ -63,6 +66,7 @@ class DbusPidZone : public ZoneInterface, public ModeObject - void clearSetPoints(void) override; - void clearRPMCeilings(void) override; - double getFailSafePercent(void) const override; -+ void setFailSafePercent(double) override; - double getMinThermalSetpoint(void) const; - - Sensor* getSensor(const std::string& name) override; -@@ -88,6 +92,9 @@ class DbusPidZone : public ZoneInterface, public ModeObject - /* Method for reading whether in fail-safe mode over dbus */ - bool failSafe() const override; - -+ /* Method for setting the failSafePercent over dbus */ -+ uint64_t target(uint64_t value) override; -+ - private: - std::ofstream _log; - -@@ -95,7 +102,7 @@ class DbusPidZone : public ZoneInterface, public ModeObject - double _maximumSetPoint = 0; - bool _manualMode = false; - const double _minThermalOutputSetPt; -- const double _failSafePercent; -+ double _failSafePercent; - - std::set<std::string> _failSafeSensors; - -diff --git a/pid/zone_interface.hpp b/pid/zone_interface.hpp -index a024c0e..9ea89c1 100644 ---- a/pid/zone_interface.hpp -+++ b/pid/zone_interface.hpp -@@ -70,6 +70,7 @@ class ZoneInterface - * fail safe. - */ - virtual double getFailSafePercent() const = 0; -+ virtual void setFailSafePercent(double newFailSafe) = 0; - - /** Return if the zone is set to manual mode. false equates to automatic - * mode (the default). --- -2.29.2.222.g5d2a92d10f8-goog diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in index 21ba368df..2c921a7f8 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in @@ -73,8 +73,8 @@ }, { "name": "cputemp", - "type": "margin", - "readPath": "/xyz/openbmc_project/extsensors/margin/cputemp", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/cputemp", "writePath": "", "min": 0, "max": 0, @@ -82,9 +82,9 @@ "timeout": 0 }, { - "name": "zone0_vr", - "type": "margin", - "readPath": "/xyz/openbmc_project/extsensors/margin/zone0_vr", + "name": "vddcr_cpu", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/vddcr_cpu", "writePath": "", "min": 0, "max": 0, @@ -92,9 +92,49 @@ "timeout": 0 }, { - "name": "nvme", - "type": "margin", - "readPath": "/xyz/openbmc_project/extsensors/margin/nvme", + "name": "vddcr_soc", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/vddcr_soc", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "vddio_abcd", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/vddio_abcd", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "vddio_efgh", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/vddio_efgh", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "p12v_mobo", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/p12v_mobo", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "powerseq_temp", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/powerseq_temp", "writePath": "", "min": 0, "max": 0, @@ -103,8 +143,168 @@ }, { "name": "p12v_fan", - "type": "margin", - "readPath": "/xyz/openbmc_project/extsensors/margin/p12v_fan", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/p12v_fan", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme0", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme0", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme1", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme1", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme2", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme2", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme3", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme3", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme4", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme4", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme5", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme5", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme6", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme6", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme7", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme7", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme8", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme8", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme9", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme9", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme10", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme10", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme11", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme11", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme12", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme12", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme13", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme13", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme14", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme14", + "writePath": "", + "min": 0, + "max": 0, + "ignoreDbusMinMax": true, + "timeout": 0 + }, + { + "name": "nvme15", + "type": "temp", + "readPath": "/xyz/openbmc_project/sensors/temperature/nvme15", "writePath": "", "min": 0, "max": 0, @@ -162,15 +362,15 @@ }, { "name": "cputemp", - "type": "margin", + "type": "temp", "inputs": [ "cputemp" ], - "setpoint": 10.0, + "setpoint": 80.0, "pid": { "samplePeriod": 1.0, - "proportionalCoeff": 714.0, - "integralCoeff": 9.0, + "proportionalCoeff": -714.0, + "integralCoeff": -9.0, "feedFwdOffsetCoeff": 0.0, "feedFwdGainCoeff": 0.0, "integralLimit_min": 2679.0, @@ -185,15 +385,20 @@ }, { "name": "zone0_vr", - "type": "margin", + "type": "temp", "inputs": [ - "zone0_vr" + "vddcr_cpu", + "vddcr_soc", + "vddio_abcd", + "vddio_efgh", + "p12v_mobo", + "powerseq_temp" ], - "setpoint": 10.0, + "setpoint": 90.0, "pid": { "samplePeriod": 1.0, - "proportionalCoeff": 536.0, - "integralCoeff": 9.0, + "proportionalCoeff": -536.0, + "integralCoeff": -9.0, "feedFwdOffsetCoeff": 0.0, "feedFwdGainCoeff": 0.0, "integralLimit_min": 2679.0, @@ -346,16 +551,16 @@ } }, { - "name": "nvme", - "type": "margin", + "name": "p12v_fan", + "type": "temp", "inputs": [ - "nvme" + "p12v_fan" ], - "setpoint": 10.0, + "setpoint": 90.0, "pid": { "samplePeriod": 1.0, - "proportionalCoeff": 1250.0, - "integralCoeff": 12.0, + "proportionalCoeff": -268.0, + "integralCoeff": -4.0, "feedFwdOffsetCoeff": 0.0, "feedFwdGainCoeff": 0.0, "integralLimit_min": 2679.0, @@ -369,16 +574,361 @@ } }, { - "name": "p12v_fan", - "type": "margin", + "name": "nvme0", + "type": "temp", "inputs": [ - "p12v_fan" + "nvme0" ], - "setpoint": 10.0, + "setpoint": @WCTemp00@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme1", + "type": "temp", + "inputs": [ + "nvme1" + ], + "setpoint": @WCTemp01@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme2", + "type": "temp", + "inputs": [ + "nvme2" + ], + "setpoint": @WCTemp02@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme3", + "type": "temp", + "inputs": [ + "nvme3" + ], + "setpoint": @WCTemp03@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme4", + "type": "temp", + "inputs": [ + "nvme4" + ], + "setpoint": @WCTemp04@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme5", + "type": "temp", + "inputs": [ + "nvme5" + ], + "setpoint": @WCTemp05@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme6", + "type": "temp", + "inputs": [ + "nvme6" + ], + "setpoint": @WCTemp06@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme7", + "type": "temp", + "inputs": [ + "nvme7" + ], + "setpoint": @WCTemp07@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme8", + "type": "temp", + "inputs": [ + "nvme8" + ], + "setpoint": @WCTemp08@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme9", + "type": "temp", + "inputs": [ + "nvme9" + ], + "setpoint": @WCTemp09@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme10", + "type": "temp", + "inputs": [ + "nvme10" + ], + "setpoint": @WCTemp10@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme11", + "type": "temp", + "inputs": [ + "nvme11" + ], + "setpoint": @WCTemp11@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme12", + "type": "temp", + "inputs": [ + "nvme12" + ], + "setpoint": @WCTemp12@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme13", + "type": "temp", + "inputs": [ + "nvme13" + ], + "setpoint": @WCTemp13@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme14", + "type": "temp", + "inputs": [ + "nvme14" + ], + "setpoint": @WCTemp14@, + "pid": { + "samplePeriod": 1.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, + "feedFwdOffsetCoeff": 0.0, + "feedFwdGainCoeff": 0.0, + "integralLimit_min": 2679.0, + "integralLimit_max": 18000.0, + "outLim_min": 2679.0, + "outLim_max": 18000.0, + "slewNeg": 0.0, + "slewPos": 0.0, + "positiveHysteresis": 0.0, + "negativeHysteresis": 0.0 + } + }, + { + "name": "nvme15", + "type": "temp", + "inputs": [ + "nvme15" + ], + "setpoint": @WCTemp15@, "pid": { "samplePeriod": 1.0, - "proportionalCoeff": 268.0, - "integralCoeff": 4.0, + "proportionalCoeff": -1250.0, + "integralCoeff": -12.0, "feedFwdOffsetCoeff": 0.0, "feedFwdGainCoeff": 0.0, "integralLimit_min": 2679.0, diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh index 9617d0da4..5ceac7ea5 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh @@ -15,13 +15,74 @@ mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan2 Fan_0_To_4_Hwmon="$(ls /sys/devices/platform/ahb/ahb\:*/*pwm-fan-controller/hwmon/)" if [[ "$Fan_0_To_4_Hwmon" != "" ]]; then - sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" $TEMP_FILE + sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" $TEMP_FILE fi +presentGpio=() +presentState=() +gpioPath="/sys/class/gpio/gpio" +if [[ -f "/etc/nvme/nvme_config.json" ]]; then + presentGpio=($(cat /etc/nvme/nvme_config.json | grep NVMeDrivePresentPin \ + | awk '{print $2}' | cut -d "," -f 0)) +fi + +nvmePath="/xyz/openbmc_project/sensors/temperature/nvme" +nvmeInventoryPath="/xyz/openbmc_project/inventory/system/chassis/motherboard/nvme" +# Get and Set WCTEMP +for ((i = 0; i < 16; i++)); do + name="@WCTemp$(printf "%02d" $i)@" + wcTemp=72000 + + if [[ -d "${gpioPath}${presentGpio[i]}" ]] && + [[ "$(cat ${gpioPath}${presentGpio[i]}/value)" == "0" ]]; then + presentState[i]="true" + else + presentState[i]="false" + fi + + if [[ "${presentState[i]}" == "true" ]]; then + actualWCTemp=0 + for ((j = 0; j < 3; j++)); do + actualWCTemp="$( + busctl get-property xyz.openbmc_project.nvme.manager \ + ${nvmePath}${i} \ + xyz.openbmc_project.Sensor.Threshold.Critical \ + CriticalHigh | awk '{print $2}' + )" + if [[ "${actualWCTemp}" -ne 0 ]]; then + break + fi + + echo "${nvmePath}${i} WCTemp was read to be 0, retrying after 1 sec sleep" + sleep 1 + done + + if [[ "${actualWCTemp}" -ne 0 ]]; then + wcTemp="$(echo "${actualWCTemp} -7" | awk '{printf $1 + $2}')" + else + echo "${nvmePath}${i} WCTemp was read to be 0, using default WCTemp: ${wcTemp}" + fi + fi + + sed -i "s/$name/${wcTemp}/g" "$TEMP_FILE" + + if [[ "${presentState[i]}" == "false" ]]; then + sensorPath="${nvmePath}${i}" + pathLine=$(grep -nw "$sensorPath" "$TEMP_FILE" | awk -F ':' '{print $1}') + sed -i "$TEMP_FILE" -re "$((pathLine - 3)),$((pathLine + 6))d" + if [ $i -eq 15 ]; then + sed -i "$((pathLine - 4))s/,//" "$TEMP_FILE" + fi + + listLine=$(grep -n "\"name\": \"nvme${i}\"" "$TEMP_FILE" | awk -F ':' '{print $1}') + sed -i "$TEMP_FILE" -re "$((listLine - 1)),$((listLine + 21))d" + if [ $i -eq 15 ]; then + sed -i "$((listLine - 2))s/,//" "$TEMP_FILE" + fi + fi +done + # Use shell parameter expansion to trim the ".in" suffix mv "$TEMP_FILE" "${FAN_TABLE_FILE_IN%".in"}" -# start read margin temp wait -/usr/bin/read-margin-temp-wait.sh & - exit 0 diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend index 7acd44c70..e617f8679 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -2,7 +2,6 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:" SRC_URI_append_gbs = " file://config.json.in \ file://fan-table-init.sh \ file://phosphor-pid-control.service \ - file://0001-Advertise-failSafePercent-on-dbus.patch \ " FILES_${PN}_append_gbs = " ${datadir}/swampd/config.json.in" |