#!/bin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # PATH=/usr/bin:/usr/sbin:$PATH; export PATH PREFIX=/tmp/mpt.conf.$$ add_comment_for_vhci_class() { if grep "^# The mpt driver, as a pHCI driver" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # The mpt driver, as a pHCI driver, must specify the vHCI class it # belongs to(scsi_vhci). # EOF } add_comment_for_sata_mpxio() { if grep "^# SATA mpxio supported" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # SATA mpxio supported # # To disable SATA mpxio, set # disable-sata-mpxio="yes"; # When mpxio-disable="yes" is set, the disable-sata-mpxio property # takes no effect # EOF } add_comment_for_mpxio_disable() { if grep "^# Global mpxio-disable property:" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # I/O multipathing feature (MPxIO) can be enabled or disabled using # mpxio-disable property. Setting mpxio-disable="no" will activate # I/O multipathing; setting mpxio-disable="yes" disables the feature. # # Global mpxio-disable property: # # To globally enable MPxIO on all mpt controllers set: # mpxio-disable="no"; # # To globally disable MPxIO on all mpt controllers set: # mpxio-disable="yes"; # # You can also enable or disable MPxIO on a per HBA basis. # Per HBA settings override the global setting for the specified HBAs. # To disable MPxIO on a controller whose parent is /pci@7c0/pci@0/pci@9 # and the unit-address is "0" set: # name="mpt" parent="/pci@7c0/pci@0/pci@9" unit-address="0" mpxio-disable="yes"; # EOF } add_comment_for_tape_property() { if grep "^# The property tape" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # The property tape is only used for X86 # EOF } update_mptconf() { NEWHDR1=$PREFIX.hdr1 NEWHDR2=$PREFIX.hdr2 TMPFILE=$PREFIX.tmp # replace old copyright with new one HEADER="^#.* Copyright.*Sun Microsystems.*$" if grep "$HEADER" $1 > $NEWHDR1 2>/dev/null; then # replace / by \/ sed "s/\\//\\\\\\//g" $NEWHDR1 > $NEWHDR2 2>/dev/null if sed "s/$HEADER/`cat $NEWHDR2`/" $2 > $TMPFILE 2>/dev/null then cp $TMPFILE $2 fi fi if [ "$ARCH" = "i386" ]; then # remove useless property flow_control and queue # check the property named tape and that the property is # only used on i386 platform sed -e '/^# config file for x86 mpt SCSI HBA driver$/d' \ -e '/^flow_control="dmult" queue="qsort" tape="sctp";$/d' \ -e '/^# x86 only$/d' $2 > $TMPFILE cp $TMPFILE $2 grep 'tape="sctp"' $2 > /dev/null 2>&1 if [ $? != 0 ] ; then add_comment_for_tape_property $2 echo 'tape="sctp";' >> $2 fi fi add_comment_for_vhci_class $2 # check for property named ddi-vhci-class grep '^ddi-vhci-class' $2 > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'ddi-vhci-class="scsi_vhci";' >> $2 fi add_comment_for_mpxio_disable $2 # check for property named mpxio-disable grep '^mpxio-disable' $2 > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'mpxio-disable="yes";' >> $2 fi add_comment_for_sata_mpxio $2 grep "^disable-sata-mpxio" $2 > /dev/null 2>&1 if [ $? != 0 ] ; then # check for property mpxio-disable value. If the mpxio was # already enabled at upgrade, disable the sata mpxio to avoid # regression grep '^mpxio-disable="no"' $2 > /dev/null 2>&1 if [ $? = 0 ] ; then echo 'disable-sata-mpxio="yes";' >> $2 else echo 'disable-sata-mpxio="no";' >> $2 fi fi rm -f $NEWHDR1 $NEWHDR2 $TMPFILE } if read src dest; then if [ ! -f $dest ]; then cp $src $dest if [ "$ARCH" = "i386" ]; then # add property tape for i386 platform add_comment_for_tape_property $dest echo 'tape="sctp";' >> $dest fi else # upgrading solaris update_mptconf $src $dest fi fi exit 0