diff options
Diffstat (limited to 'kernel/xpp/utils/waitfor_xpds')
-rwxr-xr-x | kernel/xpp/utils/waitfor_xpds | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/kernel/xpp/utils/waitfor_xpds b/kernel/xpp/utils/waitfor_xpds new file mode 100755 index 0000000..ebac3a0 --- /dev/null +++ b/kernel/xpp/utils/waitfor_xpds @@ -0,0 +1,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 |