i.pcicconf revision 7c478bd95313f5f23a4c958a745db2134aa03244
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#!/bin/sh
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Common Development and Distribution License, Version 1.0 only
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# (the "License"). You may not use this file except in compliance
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
59927d313a821b7f3822314ed16fc0a44c128431Yuri Pankov# CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
904e51f67bfac9f3ec88d9254757474c448808ebJack Meng# ident "%Z%%M% %I% %E% SMI"
59927d313a821b7f3822314ed16fc0a44c128431Yuri Pankov#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Copyright (c) 1993-1997,2001 by Sun Microsystems, Inc.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# SUNWpcmci i.pcicconf script
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewhile read src dest
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ "`basename $src`" = "pcic.conf" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TMP=/tmp/SUNWpcmci.pcic.$$
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # strip out all the old cruft in pcic.conf and add any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # user-supplied lines to the new pcic.conf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # be careful about the egrep [ ] regexp - it should be
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # [<SAPCE><TAB>]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -f $dest ] && egrep -s 'res-*=|ioaddr=|the "smi" prop' $dest
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_CMT1="with the pcmcia\/pcic enumerator and the PCI devices"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_CMT2="there is not much need for this file other than to"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_CMT3="get the correct interrupt priorities"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_CMT4="force attach driver to support hotplug activity"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte egrep -iv 'Copyright|All |ident |interrupt-priorities=|ddi-forceattach=' $dest | \
1a1a84a324206b6b1f5f704ab166c4ebf78aed76Peter Dunlap egrep -v "$OLD_CMT1|$OLD_CMT2|$OLD_CMT3|$OLD_CMT4" | \
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap egrep -v '^[ ]*$|^[ ]*#[ ]*$|^[ ]*;[ ]*$' | \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nawk '{print "# "$0}' > $TMP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PCIC_WCL="`cat $TMP | wc -l`"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ "$PCIC_WCL" -gt 0 ]
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap then
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap PCIC_WCL="`expr $PCIC_WCL`"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ( cat $src
59927d313a821b7f3822314ed16fc0a44c128431Yuri Pankov echo '#'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "# The following $PCIC_WCL lines were\c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo ' extracted from your old /kernel/drv/pcic.conf'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo '# file. Please edit your new pcic.conf file\c'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo ' if necessary to include some or'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo '# all of these lines.'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo '#'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo '# ======== start of extracted lines from\c'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo ' old /kernel/drv/pcic.conf ========'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cat $TMP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo '# ========= end of extracted lines from\c'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo ' old /kernel/drv/pcic.conf =========' ) >$dest
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm -f $TMP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ ! -f $dest ]
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap then
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap cp $src $dest
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap fi
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap fi
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap else
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap if [ ! -f $dest ]
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap then
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap cp $src $dest
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap fi
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap fi
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlapdone
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexit 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte