summaryrefslogtreecommitdiff
path: root/kernel/xpp/utils/waitfor_xpds
blob: ebac3a05ea925e72b23ec16f4346292bcf8dc613 (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

# waitfor_xpds: wait until all Astribanks were initialized

# Written by Oron Peled <oron@actcom.co.il>
# Copyright (C) 2008, Xorcom
#
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#


set -e

ab_list() {
	ab=`find /sys/bus/astribanks/devices/xbus-*/ -name waitfor_xpds 2> /dev/null || :`
	if [ "$ab" = "" ]; then
		ab=`find /proc/xpp/XBUS-[0-9]*/ -name waitfor_xpds 2> /dev/null || :`
		procfiles=1
	fi
	if [ "$ab" = "" ]; then
		echo 1>&2 "$0: No XBUSES to wait for. Aborting..."
		exit 1
	fi
	if [ -n "$procfiles" ]; then
		echo 1>&2 "$0: No /sys attributes, fallback to /proc interface..."
	fi
	echo $ab
}


while
	if ! ab=`ab_list`; then
		exit 1
	fi
	test "$oldab" != "$ab"
do
	oldab="$ab"
	echo 1>&2 "Waiting for XPDS"
	cat $ab
done