From bf078825d137b0e1a1ec02ddd4e6d08670a6783c Mon Sep 17 00:00:00 2001 From: George Hung Date: Fri, 11 Jun 2021 13:23:25 +0800 Subject: meta-quanta: gbs: Modified pid sensor type from margin to temp - Remove read-margin-temp files and codes - Modified sensor type in pid json to temp setpoint set to target temp Kp set to Kp * scalar Ki set to Ki * scalar - Pre-detect nvme present status in fan-table-init.sh, and delete settings if nvme present is false. Signed-off-by: George Hung Change-Id: Iba4ac164a7a39ca1be109301402911d432294997 --- .../fans/phosphor-pid-control/config.json.in | 612 +++++++++++++++++++-- .../fans/phosphor-pid-control/fan-table-init.sh | 69 ++- 2 files changed, 646 insertions(+), 35 deletions(-) (limited to 'meta-quanta/meta-gbs/recipes-phosphor') 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 -- cgit v1.2.3