1 #!/bin/sh 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 # Use is subject to license terms. 24 # 25 #ident "%Z%%M% %I% %E% SMI" 26 # 27 28 29 PATH=/usr/bin:/usr/sbin:$PATH; export PATH 30 PREFIX=/tmp/mpt.conf.$$ 31 32 add_comment_for_vhci_class() 33 { 34 if grep "^# The mpt driver, as a pHCI driver" $1 > /dev/null 2>&1; then 35 return 36 fi 37 38 cat >> $1 << EOF 39 40 # 41 # The mpt driver, as a pHCI driver, must specify the vHCI class it 42 # belongs to(scsi_vhci). 43 # 44 EOF 45 } 46 47 add_comment_for_mpxio_disable() 48 { 49 50 if grep "^# Global mpxio-disable property:" $1 > /dev/null 2>&1; then 51 return 52 fi 53 54 cat >> $1 << EOF 55 56 # 57 # I/O multipathing feature (MPxIO) can be enabled or disabled using 58 # mpxio-disable property. Setting mpxio-disable="no" will activate 59 # I/O multipathing; setting mpxio-disable="yes" disables the feature. 60 # 61 # Global mpxio-disable property: 62 # 63 # To globally enable MPxIO on all mpt controllers set: 64 # mpxio-disable="no"; 65 # 66 # To globally disable MPxIO on all mpt controllers set: 67 # mpxio-disable="yes"; 68 # 69 # You can also enable or disable MPxIO on a per HBA basis. 70 # Per HBA settings override the global setting for the specified HBAs. 71 # To disable MPxIO on a controller whose parent is /pci@7c0/pci@0/pci@9 72 # and the unit-address is "0" set: 73 # name="mpt" parent="/pci@7c0/pci@0/pci@9" unit-address="0" mpxio-disable="yes"; 74 # 75 EOF 76 } 77 78 add_comment_for_tape_property() 79 { 80 81 if grep "^# The property tape" $1 > /dev/null 2>&1; then 82 return 83 fi 84 85 cat >> $1 << EOF 86 87 # 88 # The property tape is only used for X86 89 # 90 EOF 91 } 92 93 update_mptconf() 94 { 95 NEWHDR1=$PREFIX.hdr1 96 NEWHDR2=$PREFIX.hdr2 97 TMPFILE=$PREFIX.tmp 98 99 # replace old copyright with new one 100 HEADER="^#.* Copyright.*Sun Microsystems.*$" 101 if grep "$HEADER" $1 > $NEWHDR1 2>/dev/null; then 102 # replace / by \/ 103 sed "s/\\//\\\\\\//g" $NEWHDR1 > $NEWHDR2 2>/dev/null 104 if sed "s/$HEADER/`cat $NEWHDR2`/" $2 > $TMPFILE 2>/dev/null 105 then 106 cp $TMPFILE $2 107 fi 108 fi 109 110 if [ "$ARCH" = "i386" ]; then 111 # remove useless property flow_control and queue 112 # check the property named tape and that the property is 113 # only used on i386 platform 114 sed -e '/^# config file for x86 mpt SCSI HBA driver$/d' \ 115 -e '/^flow_control="dmult" queue="qsort" tape="sctp";$/d' \ 116 -e '/^# x86 only$/d' $2 > $TMPFILE 117 cp $TMPFILE $2 118 grep 'tape="sctp"' $2 > /dev/null 2>&1 119 if [ $? != 0 ] ; then 120 add_comment_for_tape_property $2 121 echo 'tape="sctp";' >> $2 122 fi 123 fi 124 125 add_comment_for_vhci_class $2 126 127 # check for property named ddi-vhci-class 128 grep '^ddi-vhci-class' $2 > /dev/null 2>&1 129 if [ $? != 0 ] ; then 130 echo 'ddi-vhci-class="scsi_vhci";' >> $2 131 fi 132 133 add_comment_for_mpxio_disable $2 134 135 # check for property named mpxio-disable 136 grep '^mpxio-disable' $2 > /dev/null 2>&1 137 if [ $? != 0 ] ; then 138 echo 'mpxio-disable="yes";' >> $2 139 fi 140 141 rm -f $NEWHDR1 $NEWHDR2 $TMPFILE 142 } 143 144 145 if read src dest; then 146 if [ ! -f $dest ]; then 147 cp $src $dest 148 if [ "$ARCH" = "i386" ]; then 149 # add property tape for i386 platform 150 add_comment_for_tape_property $dest 151 echo 'tape="sctp";' >> $dest 152 fi 153 else 154 # upgrading solaris 155 update_mptconf $src $dest 156 fi 157 158 fi 159 160 exit 0 161