From ffcd544e567b522a7e1b3c71bd80a22ee10f1581 Mon Sep 17 00:00:00 2001 From: Raptor Engineering Development Team Date: Sun, 13 May 2018 00:28:33 -0500 Subject: Attempt to detect host power down if watchdog fails --- .../occ/openpower-occ-control/occ-active.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- cgit v1.2.1