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 23 # 24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 # SUNWagp postinstall script 28 29 PATH=/usr/bin:/usr/sbin:${PATH} 30 export PATH 31 BRALIAS="\ 32 \"pci8086,7124\" \ 33 \"pci8086,7122\" \ 34 \"pci8086,7120\" \ 35 \"pci1022,7454\" \ 36 \"pci8086,3580\" \ 37 \"pci8086,3575\" \ 38 \"pci8086,2560\" \ 39 \"pci8086,2570\" \ 40 \"pci8086,2580\" \ 41 \"pci8086,2590\" \ 42 \"pci8086,2770\" \ 43 \"pci8086,27a0\" \ 44 \"pci8086,2970\" \ 45 \"pci8086,2980\" \ 46 \"pci8086,2990\" \ 47 \"pci8086,29a0\" \ 48 \"pci8086,29b0\" \ 49 \"pci8086,29c0\" \ 50 \"pci8086,29d0\" \ 51 \"pci8086,2a00\" \ 52 \"pci8086,2a10\" \ 53 \"pci8086,2a40\" \ 54 \"pci8086,2e00\" \ 55 \"pci8086,2e10\" \ 56 \"pci8086,2e20\" \ 57 \"pci8086,1130\" \ 58 " 59 CPUGART='"pci1022,1103"' 60 DRVPERM='* 0644 root sys' 61 62 # Function: check_add_drv() 63 # 64 # This function will check if the module has an entry in etc/name_to_major 65 # If not simply calls add_drv with the arguments given. If there is 66 # such an entry in name_to_major file, it adds entries in driver_aliases 67 # and minor_perm if necessary. 68 # The syntax of this function is the same as add_drv. 69 70 check_add_drv() 71 { 72 alias="" 73 ADD_ALIAS=0 74 ADD_MINOR=0 75 OPTIND=1 76 77 cmd="add_drv" 78 79 while getopts i:b:m: opt 80 do 81 case $opt in 82 i ) ADD_ALIAS=1 83 alias=$OPTARG 84 cmd=$cmd" -i '$alias'" 85 ;; 86 m ) ADD_MINOR=1 87 minor=$OPTARG 88 cmd=$cmd" -m '$minor'" 89 ;; 90 b) BASEDIR=$OPTARG 91 cmd=$cmd" -b $BASEDIR" 92 ;; 93 \?) echo "check_add_drv can not handle this option" 94 return 95 ;; 96 esac 97 done 98 shift `/usr/bin/expr $OPTIND - 1` 99 100 drvname=$1 101 102 cmd=$cmd" "$drvname 103 104 /usr/bin/grep "^$drvname[ ]" $BASEDIR/etc/name_to_major > /dev/null 2>&1 105 106 if [ $? -ne 0 ] 107 then 108 eval $cmd 109 else 110 # entry already in name_to_major, add alias, minorperm 111 # if necessary 112 if [ $ADD_ALIAS = 1 ] 113 then 114 for i in $alias 115 do 116 /usr/bin/egrep "$i" $BASEDIR/etc/driver_aliases>/dev/null 2>&1 117 if [ $? -ne 0 ] 118 then 119 echo "$drvname $i" >> $BASEDIR/etc/driver_aliases 120 else 121 /usr/bin/egrep "^$drvname[ ]+$i" $BASEDIR/etc/driver_aliases>/dev/null 2>&1 122 if [ $? -ne 0 ] 123 then 124 return 1 125 fi 126 fi 127 done 128 fi 129 130 if [ $ADD_MINOR = 1 ] 131 then 132 /usr/bin/grep "^$drvname:" $BASEDIR/etc/minor_perm > /dev/null 2>&1 133 if [ $? -ne 0 ] 134 then 135 minorentry="$drvname:$minor" 136 echo $minorentry >> $BASEDIR/etc/minor_perm 137 fi 138 fi 139 fi 140 141 } 142 143 EXIT=0 144 145 if [ "${BASEDIR:=/}" = "/" ] 146 then 147 ADD_DRV="check_add_drv" 148 else 149 ADD_DRV="check_add_drv -b ${BASEDIR}" 150 fi 151 152 ${ADD_DRV} -m "${DRVPERM}" -i "${BRALIAS}" agptarget || EXIT=1 153 154 # amd64_gart is only needed in AMD64 system 155 ${ADD_DRV} -m "${DRVPERM}" -i "${CPUGART}" amd64_gart || EXIT=1 156 157 ${ADD_DRV} -m "${DRVPERM}" agpgart || EXIT=1 158 159 exit ${EXIT} 160