summaryrefslogtreecommitdiffstats
path: root/meta-openpower/recipes-phosphor/occ
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openpower/recipes-phosphor/occ')
-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