summaryrefslogtreecommitdiffstats
path: root/meta-openpower
diff options
context:
space:
mode:
authorRaptor Engineering Development Team <support@raptorengineering.com>2018-01-22 00:51:36 -0600
committerTimothy Pearson <tpearson@raptorengineering.com>2019-04-25 08:01:52 +0000
commit62df87bf1e14729d1f6678c92543fadad840bbe3 (patch)
treeff240c609104f51f98be70dfe118ec2e851dd9e7 /meta-openpower
parente7670708696244c69cde1f5890580807c34fb248 (diff)
downloadtalos-openbmc-62df87bf1e14729d1f6678c92543fadad840bbe3.tar.gz
talos-openbmc-62df87bf1e14729d1f6678c92543fadad840bbe3.zip
Recover from loss of either OCC
This fixes a corner case where the second OCC could drop off the bus undetected
Diffstat (limited to 'meta-openpower')
-rwxr-xr-xmeta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh42
1 files changed, 39 insertions, 3 deletions
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
index 9e4c4bec2..6a511c132 100755
--- a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
@@ -14,25 +14,59 @@ else
exit -1
fi
+# Get CPU count
+CPU_COUNT=1
+STATUS_FLAGS=$(i2cget -y 12 0x31 0x7)
+if [ $? != 0 ]; then
+ STATUS_FLAGS=$(i2cget -y 12 0x31 0x7)
+fi
+if [ $? != 0 ]; then
+ STATUS_FLAGS=$(i2cget -y 12 0x31 0x7)
+fi
+CPU_PRESENT_FLAG_N=$(( ${STATUS_FLAGS} & 0x20 ))
+if [ $CPU_PRESENT_FLAG_N != 0 ]; then
+ CPU_COUNT=$(( ${CPU_COUNT} + 1 ))
+fi
+echo "Found $CPU_COUNT CPU(s)"
+
OCC_CONTROL_SERVICE="org.open_power.OCC.Control"
if [ "$value" == "true" ]; then
+ # Disable existing OCC service
+ busctl tree $OCC_CONTROL_SERVICE --list | grep occ | xargs -r -n1 -I{} \
+ busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \
+ OccActive b 'false'
+
# Rescan bus to find OCCs
openpower-proc-control scanFSI
- # Wait 5 seconds before restarting fan controller
- sleep 5
- systemctl restart phosphor-fan-control@0.service
fi
busctl tree $OCC_CONTROL_SERVICE --list | grep occ | xargs -r -n1 -I{} \
busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \
OccActive b $value
+if [ "$value" == "true" ]; then
+ # Wait 5 seconds before restarting fan controller
+ sleep 5
+ systemctl restart phosphor-fan-control@0.service
+fi
+
if [ "$1" == "watchdog" ]; then
# Start watchdog
while [ 1 == 1 ]; do
sleep 5
+
+ OCC_FAULT=0
if [ ! -e /sys/bus/platform/drivers/occ/sbefifo1-dev0/occ1-dev0/occ_status ]; then
+ OCC_FAULT=1
+ fi
+ if [ $CPU_COUNT -gt 1 ]; then
+ if [ ! -e /sys/bus/platform/drivers/occ/sbefifo2-dev0/occ2-dev0/occ_status ]; then
+ OCC_FAULT=1
+ fi
+ fi
+
+ if [ $OCC_FAULT != 0 ]; then
# OCC driver failed. Rescan bus to recover.
# Disable existing OCC service
busctl tree $OCC_CONTROL_SERVICE --list | grep occ | xargs -r -n1 -I{} \
@@ -45,6 +79,8 @@ if [ "$1" == "watchdog" ]; then
busctl tree $OCC_CONTROL_SERVICE --list | grep occ | xargs -r -n1 -I{} \
busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \
OccActive b 'true'
+ # Give the OCC service time to start
+ sleep 5
# Restart fan controller
systemctl restart phosphor-fan-control@0.service
fi
OpenPOWER on IntegriCloud