summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaptor Engineering Development Team <support@raptorengineering.com>2018-05-13 00:28:33 -0500
committerRaptor Engineering Development Team <support@raptorengineering.com>2018-05-13 01:26:48 -0500
commitffcd544e567b522a7e1b3c71bd80a22ee10f1581 (patch)
treea5bd0ce238c650388b9e03a23da2951efb82cbd8
parent62cfef7ce356c3f29af949a5a195697381583fae (diff)
downloadtalos-openbmc-ffcd544e567b522a7e1b3c71bd80a22ee10f1581.tar.gz
talos-openbmc-ffcd544e567b522a7e1b3c71bd80a22ee10f1581.zip
Attempt to detect host power down if watchdog fails
-rwxr-xr-xmeta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh18
1 files changed, 18 insertions, 0 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 1a7b19b14..f378b566b 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
@@ -70,6 +70,11 @@ if [ "$1" == "watchdog" ]; then
while [ 1 == 1 ]; do
sleep 5
+ if [ ! -e /run/openbmc/host@0-ipl-complete ]; then
+ echo "Exiting due to missing IPL complete flag file"
+ exit 0
+ fi
+
OCC_FAULT=0
if [ ! -e /sys/bus/platform/drivers/occ/sbefifo1-dev0/occ1-dev0/occ_error ]; then
OCC_FAULT=1
@@ -95,22 +100,35 @@ 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 'false'
+
# Give enough time for the OCC control service to attempt unload before forcible unbind
sleep 5
+
# Unbind all OCC drivers
echo occ1-dev0 > /sys/bus/platform/drivers/occ-hwmon/unbind || true
echo occ2-dev0 > /sys/bus/platform/drivers/occ-hwmon/unbind || true
echo sbefifo1-dev0 > /sys/bus/platform/drivers/occ/unbind || true
echo sbefifo2-dev0 > /sys/bus/platform/drivers/occ/unbind || true
+
# Wait 10 seconds for OCC to figure out something has happened / bus contention to stop
sleep 10
+
+ # Make sure system hasn't gone down in the interim
+ if [ ! -e /run/openbmc/host@0-ipl-complete ]; then
+ echo "Exiting due to missing IPL complete flag file"
+ exit 0
+ fi
+
openpower-proc-control scanFSI
+
# Re-enable 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 'true'
+
# Give the OCC service time to start
sleep 5
+
# Restart fan controller
systemctl restart phosphor-fan-control@0.service
fi
OpenPOWER on IntegriCloud