diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-04-12 21:18:45 -0500 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-04-13 04:30:02 -0500 |
commit | 9469aa5e358cda4e421dbfb8c5325fdbfadd5f83 (patch) | |
tree | fdccd9c1ccc0c3ae09cc39774baa15e614d3f155 | |
parent | 22a1def1be010efe99466b4854fc27b34eed95a3 (diff) | |
download | talos-openbmc-9469aa5e358cda4e421dbfb8c5325fdbfadd5f83.tar.gz talos-openbmc-9469aa5e358cda4e421dbfb8c5325fdbfadd5f83.zip |
Restore OCC service to pristine upstream state
-rwxr-xr-x | meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh | 83 |
1 files changed, 2 insertions, 81 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 08d1813bd..a6097e527 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 @@ -5,8 +5,6 @@ if [ "$1" == "disable" ]; then value='false' elif [ "$1" == "enable" ]; then value='true' -elif [ "$1" == "watchdog" ]; then - value='true' else echo "Usage: occ-active.sh [argument]" echo " enable - set occ's to active state" @@ -14,86 +12,9 @@ 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 -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_error ]; then - OCC_FAULT=1 - else - STATUS=$(cat /sys/bus/platform/drivers/occ/sbefifo1-dev0/occ1-dev0/occ_error) - if [ $STATUS != 0 ]; then - OCC_FAULT=1 - fi - fi - if [ $CPU_COUNT -gt 1 ]; then - if [ ! -e /sys/bus/platform/drivers/occ/sbefifo2-dev0/occ2-dev0/occ_error ]; then - OCC_FAULT=1 - fi - else - if [ $STATUS != 0 ]; 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{} \ - busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \ - OccActive b 'false' - # Wait 10 seconds for OCC to figure out something has happened / bus contention to stop - sleep 10 - 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 - done -fi - + busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \ + OccActive b $value exit 0 |