blob: 9e4c4bec2ebc3add080520ffc48ecfec8e7aa140 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/sh
# set and unset occ active for all occ's in system
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"
echo " disable - set occ's to inactive state"
exit -1
fi
OCC_CONTROL_SERVICE="org.open_power.OCC.Control"
if [ "$value" == "true" ]; then
# 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 [ "$1" == "watchdog" ]; then
# Start watchdog
while [ 1 == 1 ]; do
sleep 5
if [ ! -e /sys/bus/platform/drivers/occ/sbefifo1-dev0/occ1-dev0/occ_status ]; 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'
# Restart fan controller
systemctl restart phosphor-fan-control@0.service
fi
done
fi
exit 0
|