summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaptor Engineering Development Team <support@raptorengineering.com>2018-01-22 00:51:36 -0600
committerRaptor Engineering Development Team <support@raptorengineering.com>2018-01-22 01:01:51 -0600
commitf0cfc21adc3b9ee7c4510df528b4a05dc77e3045 (patch)
tree271c61062efb9f859139228991940249cc31119d
parent5773eedf5b68897d3fb155d77de0fc9c8f168cb4 (diff)
downloadtalos-openbmc-f0cfc21adc3b9ee7c4510df528b4a05dc77e3045.tar.gz
talos-openbmc-f0cfc21adc3b9ee7c4510df528b4a05dc77e3045.zip
Recover from loss of either OCC
This fixes a corner case where the second OCC could drop off the bus undetected
-rwxr-xr-xmeta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh42
1 files changed, 39 insertions, 3 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
index 9e4c4bec2..6a511c132 100755
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
+++ b/meta-openbmc-machines/meta-openpower/common/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