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