kprobes: Do not expose probe addresses to non-CAP_SYSLOG
[linux/fpc-iii.git] / samples / mic / mpssd / micctrl
blob030a60b0404632ed598e5f5b56267e2a6af4b25f
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0-only
3 # Intel MIC Platform Software Stack (MPSS)
5 # Copyright(c) 2013 Intel Corporation.
7 # Intel MIC User Space Tools.
9 # micctrl - Controls MIC boot/start/stop.
11 # chkconfig: 2345 95 05
12 # description: start MPSS stack processing.
14 ### BEGIN INIT INFO
15 # Provides: micctrl
16 ### END INIT INFO
18 # Source function library.
19 . /etc/init.d/functions
21 sysfs="/sys/class/mic"
23 _status()
25 f=$sysfs/$1
26 echo -e $1 state: "`cat $f/state`" shutdown_status: "`cat $f/shutdown_status`"
29 status()
31 if [ "`echo $1 | head -c3`" == "mic" ]; then
32 _status $1
33 return $?
35 for f in $sysfs/*
37 _status `basename $f`
38 RETVAL=$?
39 [ $RETVAL -ne 0 ] && return $RETVAL
40 done
41 return 0
44 _reset()
46 f=$sysfs/$1
47 echo reset > $f/state
50 reset()
52 if [ "`echo $1 | head -c3`" == "mic" ]; then
53 _reset $1
54 return $?
56 for f in $sysfs/*
58 _reset `basename $f`
59 RETVAL=$?
60 [ $RETVAL -ne 0 ] && return $RETVAL
61 done
62 return 0
65 _boot()
67 f=$sysfs/$1
68 echo "linux" > $f/bootmode
69 echo "mic/uos.img" > $f/firmware
70 echo "mic/$1.image" > $f/ramdisk
71 echo "boot" > $f/state
74 boot()
76 if [ "`echo $1 | head -c3`" == "mic" ]; then
77 _boot $1
78 return $?
80 for f in $sysfs/*
82 _boot `basename $f`
83 RETVAL=$?
84 [ $RETVAL -ne 0 ] && return $RETVAL
85 done
86 return 0
89 _shutdown()
91 f=$sysfs/$1
92 echo shutdown > $f/state
95 shutdown()
97 if [ "`echo $1 | head -c3`" == "mic" ]; then
98 _shutdown $1
99 return $?
101 for f in $sysfs/*
103 _shutdown `basename $f`
104 RETVAL=$?
105 [ $RETVAL -ne 0 ] && return $RETVAL
106 done
107 return 0
110 _wait()
112 f=$sysfs/$1
113 while [ "`cat $f/state`" != "offline" -a "`cat $f/state`" != "online" ]
115 sleep 1
116 echo -e "Waiting for $1 to go offline"
117 done
120 wait()
122 if [ "`echo $1 | head -c3`" == "mic" ]; then
123 _wait $1
124 return $?
126 # Wait for the cards to go offline
127 for f in $sysfs/*
129 _wait `basename $f`
130 RETVAL=$?
131 [ $RETVAL -ne 0 ] && return $RETVAL
132 done
133 return 0
136 if [ ! -d "$sysfs" ]; then
137 echo -e $"Module unloaded "
138 exit 3
141 case $1 in
143 status $2
146 reset $2
149 boot $2
152 shutdown $2
155 wait $2
158 echo $"Usage: $0 {-s (status) |-r (reset) |-b (boot) |-S (shutdown) |-w (wait)}"
159 exit 2
160 esac
162 exit $?