home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Network / LinkSYS / lne2000.exe / SCOUNIX / INIT < prev    next >
Text File  |  1995-11-03  |  48KB  |  1,611 lines

  1. :
  2. #               (C) 1989-1990 The Santa Cruz Operation, Inc.  All Rights
  3. #               Reserved.  The user has unlimited right to use, modify
  4. #               and incorporate this code into other products provided
  5. #               it is used with SCO products and the user includes
  6. #               this notice and the associated copyright notices with
  7. #               any such application.
  8. # This script is for installing an LLI driver using netconfig
  9. #
  10. # The name it is called with will cause different operation.
  11. # e3A0 e3A1 e3A2 e3A3           == 3Com501 boards 0 - 3
  12. # e3B0 .....     e3B3           == 3Com503 boards 0 - 3
  13. # e3C0 .....     e3C3           == 3Com523 boards 0 - 3
  14. # wdn0 .....     wdn3           == Western Digital boards 0 - 3
  15. # nat0 .....     nat3           == National NE2000 boards 0 - 3
  16. # wdt0 .....     wdt3           == Western Digital 8013 boards 0 - 3
  17. # son0 .....     son3           == Sonic boards 0 - 3
  18. # d22e0.....     d22e3          == D-Link DE-220 boards 0 - 3
  19. # exos0 ....     exos3          == Excelan 205T boards 0 - 3
  20. # tok0 tok1                     == Token Ring Adapter 0, 1
  21. # hpi0 hpi1 hpi2 hpi3           == HP ThinLAN/EtherTwist ISA LAN Adapters 0 - 3
  22. # hpe0 hpe1 hpe2 hpe3           == HP EtherTwist EISA Slave LAN Adapters 0 - 3
  23. # i3B0 ....      i3B3           == Interlan ES3210 boards 0 - 3
  24. # i6E0                          == Interlan NI6510 board 0
  25. #
  26. LIB=/usr/lib/lli
  27. CONF=/etc/conf
  28. PATH=/bin:/usr/bin:/etc/:$CONF/bin:$LIB
  29. #
  30. # Set possible return codes for this script
  31. #
  32. OK=0;   FAIL=1; RELINK=2;
  33.  
  34. BRAM="0"
  35. ERAM="0"
  36.  
  37. #
  38. # Prompt the user for a hex value, it must be within a given range
  39. # Usage:
  40. #       prompt_range "Message" default min max [step]
  41. #
  42. prompt_range() {
  43.         mesg=$1
  44.         default=$2
  45.         range_min=$3 range_max=$4
  46.         step="1"
  47.         if [ $# -eq 5 ]
  48.         then
  49.                 step=$5
  50.         fi
  51.  
  52.         while :
  53.         do
  54.                 echo "${mesg} (${range_min}..${range_max}) [${default}] or 'q' to quit: \c"
  55.                 read result
  56.                 case $result in
  57.                 Q|q)
  58.                         return $FAIL
  59.                         ;;
  60.                 "")
  61.                         result=$default
  62.                         ;;
  63.                 esac
  64.  
  65.                 hc $result $range_min $range_max $step
  66.                 case $? in
  67.                 0) return $OK;;
  68.                 1) cleanup $FAIL;;
  69.                 2) cleanup $FAIL;;
  70.                 esac
  71.         done
  72. }
  73.  
  74. #
  75. # Prompt the user to make a selection a list of values
  76. # Usage:
  77. #       prompt_select "Message" default "value_list"
  78. prompt_select() {
  79.         mesg=$1
  80.         default=$2
  81.         values=$3
  82.  
  83.         while :
  84.         do
  85.                 if [ "$default" = "" ]
  86.                 then
  87.                         echo "${mesg} (${values}) or 'q' to quit: \c"
  88.                 else
  89.                         echo "${mesg} (${values}) [${default}] or 'q' to quit: \c"
  90.                 fi
  91.                 read result
  92.                 case $result in
  93.                 Q|q)
  94.                         return $FAIL
  95.                         ;;
  96.                 "")
  97.                         result=$default
  98.                         ;;
  99.                 esac
  100.  
  101.                 for i in $values
  102.                 do
  103.                         if [ "$i" = "$result" ]
  104.                         then
  105.                                 return $OK
  106.                         fi
  107.                 done
  108.                 echo "Illegal value, must be one of (${values})"
  109.         done
  110. }
  111.  
  112. #
  113. # prompt the user to answer a yes no question or 'q' to quit
  114. # Usage:
  115. #       prompt_yn "Message" default
  116. prompt_yn() {
  117.         mesg=$1
  118.         default=$2
  119.  
  120.         while :
  121.         do
  122.                 echo "${mesg} (y/n) [${default}] or 'q' to quit: \c"
  123.                 read result
  124.  
  125.                 case $result in
  126.                 q|Q) return $FAIL;;
  127.                 y|Y) result="Y"; return $OK;;
  128.                 n|N) result="N"; return $OK;;
  129.                 "") result=`echo $default | tr "yn" "YN"`; return $OK;;
  130.                 esac
  131.  
  132.                 echo "Illegal value, please type 'y' 'n' or 'q'"
  133.         done
  134. }
  135.  
  136. #
  137. # Fake up an mdevice and an sdevice for idcheck
  138. #
  139. makedevs() {
  140.         dir=`pwd`
  141.         rm -fr /tmp/dev$$
  142.         mkdir /tmp/dev$$
  143.         cd /etc/conf/cf.d
  144.         cp mdevice /tmp/dev$$
  145.         cd ../sdevice.d
  146.         cat * > /tmp/dev$$/sdevice
  147.         cd $dir
  148. }
  149.  
  150. cleanup() {
  151.         cd /
  152.         rm -fr /tmp/dev$$
  153.         rm -fr /tmp/$base
  154.         exit $1
  155. }
  156.  
  157. # Removes the given interrupt vector for the $clash device.
  158. rmvector() {
  159.         clash=$1
  160.         vec=$2
  161.  
  162.         cd $confdir
  163.         echo "\nRemoving interrupt vector $vec for the $clash device ..."
  164.  
  165.         [ "$vec" = "2" ] && vec=9
  166.         major=`./configure -j $clash` && {
  167.                 # remove device but leave it required
  168.                 if [ "$major" != "0" ]
  169.                 then
  170.                         ./configure -d -c -m $major -v $vec -Y >> conflog 2>&1 || {
  171.                                 cd $currdir
  172.                                 cleanup $FAIL
  173.                         }
  174.                 else
  175.                         sed -e "s/Y/N/" ../sdevice.d/$clash > /tmp/bog$$
  176.                         mv /tmp/bog$$ ../sdevice.d/$clash
  177.                 fi
  178.                 # remove required setting if no more left
  179.                 if grep "Y" ../sdevice.d/$clash > /dev/null 2>&1
  180.                 then
  181.                         true
  182.                 elif [ "$major" != "0" ]
  183.                 then
  184.                         ./configure -d -c -m $major -v $vec -R -Y >> conflog 2>&1 || {
  185.                                 cd $currdir
  186.                                 cleanup $FAIL
  187.                         }
  188.                 fi
  189.         }
  190.         cd $currdir
  191.         return $OK
  192. }
  193.  
  194. # On unix, we must check the files in sdevice.d.
  195. # Sets the variable $clash to the driver code name if there is a driver that
  196. # has already been allocated the given vector. Uses awk.
  197. dointclash() {
  198.         driver=$1
  199.         vec=$2
  200.  
  201.         [ "$vec" = "2" ] && vec=9
  202.         cd $confdir/../sdevice.d
  203.         clash=`cat * | awk '{ if ( $6 == intr && $2 == "Y" ) exit } \
  204.                         END { print $1 }' intr=$vec`
  205.  
  206.         cd $currdir
  207.  
  208.         [ "$clash" = "" -o "$clash" = "$driver" ] && return $FAIL
  209.         # found a clash
  210.         return $OK
  211. }
  212.  
  213. checkvec() {
  214.         driver=$1
  215.         vector=$2
  216.         clash=
  217.  
  218.         currdir=`pwd`
  219.  
  220.         while dointclash $driver $vector
  221.         do
  222.                 prompt_select "Interrupt vector $vector is already in use for the $clash device.\n\n\
  223. The alternatives available to you are:\n\n\
  224. \t1. Continue the installation and remove vector $vector for the $clash device.\n\
  225. \t2. Select a different interrupt vector.\n\n\
  226. Select an option" 1 "1 2" || {
  227.                         cleanup $FAIL
  228.                 }
  229.                 case $result in
  230.                 1)      rmvector $clash $vector || {
  231.                                 echo "Failed to remove vector $vector"
  232.                                 cleanup $FAIL
  233.                         }
  234.                         makedevs
  235.                         return $OK
  236.                         ;;
  237.                 2)      return $FAIL
  238.                         ;;
  239.                 esac
  240.         done
  241.         return $OK
  242. }
  243.  
  244. doaddrclash() {
  245.         driver=$1
  246.         addr1=$2
  247.         addr2=$3
  248.  
  249.         cd $confdir
  250.         clash=`../bin/idcheck -ar -l $addr1 -u $addr2 -i /tmp/dev$$`
  251.         cd $currdir
  252.  
  253.         [ "$clash" = "" -o "$clash" = "$driver" ] && return $FAIL
  254.         # found a clash
  255.         return $OK
  256. }
  257.  
  258. # Removes the $clash device.
  259. rmaddr() {
  260.         clash=$1
  261.  
  262.         cd $confdir
  263.         echo "\nRemoving the $clash device ..."
  264.  
  265.         major=`./configure -j $clash` && {
  266.                 # remove device but leave it required
  267.                 if [ "$major" != "0" ]
  268.                 then
  269.                         ./configure -d -c -m $major -Y >> conflog 2>&1 || {
  270.                                 cd $currdir
  271.                                 cleanup $FAIL
  272.                         }
  273.                 else
  274.                         sed -e "s/Y/N/" ../sdevice.d/$clash > /tmp/bog$$
  275.                         mv /tmp/bog$$ ../sdevice.d/$clash
  276.                 fi
  277.                 # remove required setting if no more left
  278.                 if grep "Y" ../sdevice.d/$clash > /dev/null 2>&1
  279.                 then
  280.                         true
  281.                 elif [ "$major" != "0" ]
  282.                 then
  283.                         ./configure -d -c -m $major -R -Y >> conflog 2>&1 || {
  284.                                 cd $currdir
  285.                                 cleanup $FAIL
  286.                         }
  287.                 fi
  288.         }
  289.         cd $currdir
  290.         return $OK
  291. }
  292.  
  293. checkaddr() {
  294.         driver=$1
  295.         addr1=$2
  296.         addr2=$3
  297.         clash=
  298.  
  299.         currdir=`pwd`
  300.  
  301.         while doaddrclash $driver $addr1 $addr2
  302.         do
  303.                 if [ "$clash" = "ad" ]
  304.                 then
  305.                         echo "\n\nWARNING: Do not remove the $clash device \c"
  306.                         echo "if you are using an Adaptec disk controller"
  307.                 fi
  308.                 prompt_select "Addresses $addr1-$addr2 are already in use by the $clash device.\n\n\
  309. The alternatives available to you are:\n\n\
  310. \t1. Continue the installation and remove the $clash device.\n\
  311. \t2. Select a different address.\n\n\
  312. Select an option" 1 "1 2" || {
  313.                         cleanup $FAIL
  314.                 }
  315.                 case $result in
  316.                 1)      rmaddr $clash || {
  317.                                 echo "Failed to remove $clash device"
  318.                                 cleanup $FAIL
  319.                         }
  320.                         makedevs
  321.                         return $OK
  322.                         ;;
  323.                 2)      return $FAIL
  324.                         ;;
  325.                 esac
  326.         done
  327.         return $OK
  328. }
  329.  
  330. doramclash() {
  331.         driver=$1
  332.         addr1=$2
  333.         addr2=$3
  334.  
  335.         cd $confdir
  336.         clash=`../bin/idcheck -cr -l $addr1 -u $addr2 -i /tmp/dev$$`
  337.         cd $currdir
  338.  
  339.         [ "$clash" = "" -o "$clash" = "$driver" ] && return $FAIL
  340.         # found a clash
  341.         return $OK
  342. }
  343.  
  344. checkram() {
  345.         driver=$1
  346.         addr1=$2
  347.         addr2=$3
  348.         clash=
  349.  
  350.         currdir=`pwd`
  351.  
  352.         while doramclash $driver $addr1 $addr2
  353.         do
  354.                 prompt_yn "
  355. Ram addresses $addr1-$addr2 is already in use for the $clash device.
  356. You must choose a unique address for this device to work.
  357. Do you wish to choose another address now?" y || cleanup $FAIL
  358.                 if [ "$result" = "Y" ]
  359.                 then
  360.                         return $FAIL
  361.                 else
  362.                         cleanup $FAIL
  363.                 fi
  364.         done
  365.         return $OK
  366. }
  367.  
  368. # On unix, we must check the lines in mdevice file.
  369. # Sets the variable $clash to the driver code name if there is a driver that
  370. # has already been allocated the given channel. Uses awk.
  371. dodmaclash() {
  372.         driver=$1
  373.         chan=$2
  374.         clash=
  375.  
  376.         # -1 is never a clash
  377.         [ "$chan" = "-1" ] && return $FAIL
  378.  
  379.         cd $confdir
  380.         clash=`awk '{ if ( $9 == dma ) print $1 }' dma=$chan mdevice`
  381.  
  382.         [ "$clash" = "" ] && {
  383.                 cd $currdir
  384.                 return $FAIL
  385.         }
  386.  
  387.         cat ../sdevice.d/$clash | awk '{ if ( $2 == "Y" ) exit 1 }' || return $OK
  388.  
  389.         if [ "$rel" = "3.2.0" -o "$rel" = "3.2.1" -o "$rel" = "3.2.2" ]
  390.         then
  391.                 prompt_yn "
  392. DMA channel ${chan} is already in use by the $clash device.  However, the
  393. $clash device is not currently configured into the kernel.  Do you wish to
  394. remove DMA channel ${chan} from the $clash device?" y || cleanup $FAIL
  395.                 if [ "$result" = "Y" ]
  396.                 then
  397.                         sed -e "/^$clash        .*[0-9]$/{" \
  398.                                 -e 's/[0-9]$/-1/p' \
  399.                                 -e '}' mdevice > /tmp/bog$$
  400.                         mv /tmp/bog$$ mdevice
  401.                         cd $currdir
  402.                         return $FAIL
  403.                 else
  404.                         cd $currdir
  405.                         return $OK
  406.                 fi
  407.         fi
  408.  
  409.         # Should be release >3.2.2, clash driver not installed if we get here.
  410.         cd $currdir
  411.         return $FAIL
  412. }
  413.  
  414. #
  415. # Check if there is a clash of DMA channels
  416. #
  417. checkdma() {
  418.         driver=$1
  419.         channel=$2
  420.         clash=
  421.  
  422.         currdir=`pwd`
  423.  
  424.         while dodmaclash $driver $channel
  425.         do
  426.                 prompt_yn "
  427. DMA channel ${channel} is already in use by the $clash device.
  428. You must choose a unique channel for this device to work.
  429. Do you wish to choose another channel now?" y || cleanup $FAIL
  430.                 if [ "$result" = "Y" ]
  431.                 then
  432.                         return $FAIL
  433.                 else
  434.                         cleanup $FAIL
  435.                 fi
  436.         done
  437.         return $OK
  438. }
  439.  
  440. check_args() {
  441.         name=$1
  442.         bd=$2
  443.  
  444.         case $name in
  445.         e3A) echo "Configuring 3Com501 board $bd";
  446.                 PREFIX="e3c";
  447.                 MAX_BD=3;
  448.                 ;;
  449.         e3B) echo "Configuring 3Com503 board $bd";
  450.                 PREFIX="e503";
  451.                 MAX_BD=3;
  452.                 ;;
  453.         e3C) echo "Configuring 3Com523 board $bd";
  454.                 PREFIX="emc";
  455.                 MAX_BD=3;
  456.                 ;;
  457.         e3D) echo "Configuring 3Com507 board $bd";
  458.                 PREFIX="e3d";
  459.                 MAX_BD=3;
  460.                 ;;
  461.         wdn) echo "Configuring Western Digital 8003/8013 board $bd";
  462.                 PREFIX="wdn";
  463.                 MAX_BD=3;
  464.                 ;;
  465.         wdt) echo "Configuring WD8013 board $bd";
  466.                 PREFIX="wdt";
  467.                 MAX_BD=3;
  468.                 ;;
  469.         nat) echo "Configuring National Semiconductor NE2000 board $bd";
  470.                 PREFIX="nat";
  471.                 MAX_BD=3;
  472.                 ;;
  473.         son) echo "Configuring National Semiconductor Sonic board $bd";
  474.                 PREFIX="son";
  475.                 MAX_BD=3;
  476.                 ;;
  477.        d22e) echo "Configuring Linksys ETHER16 Ethernet board $bd";
  478.                 PREFIX="d22e";
  479.                 MAX_BD=3;
  480.                 ;;
  481.        d51e) echo "Configuring D-Link DFE-510 Ethernet board $bd";
  482.                 PREFIX="d51e";
  483.                 MAX_BD=3;
  484.                 ;;
  485.         tok) echo "Configuring IBM Token Ring Adapter $bd";
  486.                 PREFIX="tok";
  487.                 MAX_BD=1;
  488.                 ;;
  489.         exos) echo "Configuring Excelan 205 Ethernet Adapter $bd";
  490.                 PREFIX="exos";
  491.                 MAX_BD=3;
  492.                 ;;
  493.         hpi) echo "Configuring HP ISA LAN adapter $bd";
  494.                 PREFIX="hpi";
  495.                 MAX_BD=3;
  496.                 ;;
  497.         hpe) echo "Configuring HP EISA Slave LAN adapter $bd";
  498.                 PREFIX="hpe";
  499.                 MAX_BD=3;
  500.                 ;;
  501.         i3B) echo "Configuring Racal InterLan ES 3210 board $bd";
  502.                 PREFIX="i3B";
  503.                 MAX_BD=3;
  504.                 ;;
  505.         i6E) echo "Configuring Racal InterLan NL 6510 board $bd";
  506.                 PREFIX="i6E";
  507.                 MAX_BD=0;
  508.                 ;;
  509.         *) echo "ERROR: Unknown LLI driver being configured ($name$bd)";
  510.                 cleanup $FAIL;
  511.                 ;;
  512.         esac
  513.  
  514.         if [ $bd -gt $MAX_BD ]
  515.         then
  516.                 echo "ERROR: Only boards 0..$MAX_BD are supported by this driver";
  517.                 cleanup $FAIL
  518.         fi
  519.         echo
  520. }
  521.  
  522. #
  523. # function to produce the info for the System file for the 3C501 & 3C503
  524. # boards
  525. #
  526. system_e3A() {
  527.         bd=$1
  528.  
  529.         case $bd in
  530.         0) IRQ=3; BIO=300;;
  531.         1) IRQ=2; BIO=310;;
  532.         2) IRQ=5; BIO=330;;
  533.         3) IRQ=7; BIO=350;;
  534.         esac
  535.  
  536.         while :
  537.         do
  538.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5 6 7" || cleanup $FAIL
  539.                 irq=$result
  540.                 checkvec $name$bd $irq && break
  541.         done
  542.         IRQ=$irq
  543.  
  544.         while :
  545.         do
  546.                 prompt_range "Enter I/O base address" $BIO "100" "3f0" "10" || cleanup $FAIL
  547.                 bio=$result
  548.                 EIO=`ha $bio 0f`
  549.                 checkaddr $name$bd $bio $EIO && break
  550.         done
  551.         BIO=$bio
  552.  
  553.         NMINORS="1"
  554.  
  555.         # up the 2k block buffers, this driver uses more than most drivers.
  556.         awk '/^NBLK2048/ {
  557.                 NEW=$2+8
  558.                 printf "%s\t%s\n",$1,NEW
  559.                 next
  560.         }
  561.         { print } ' < /etc/conf/cf.d/stune > /tmp/bog$$
  562.         mv /tmp/bog$$ /etc/conf/cf.d/stune
  563. }
  564.  
  565. #
  566. # function to produce the info for the System file for the 3C501 & 3C503
  567. # boards
  568. #
  569. system_e3B() {
  570.         bd=$1
  571.  
  572.         case $bd in
  573.         0) IRQ=3; BIO=300;;
  574.         1) IRQ=2; BIO=310;;
  575.         2) IRQ=5; BIO=330;;
  576.         3) IRQ=4; BIO=350;;
  577.         esac
  578.  
  579.         while :
  580.         do
  581.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5" || cleanup $FAIL
  582.                 irq=$result
  583.                 checkvec $name$bd $irq && break
  584.         done
  585.         IRQ=$irq
  586.  
  587.         while :
  588.         do
  589.                 prompt_select "Enter I/O base address" $BIO "250 280 2A0 2E0 300 310 330 350" || cleanup $FAIL
  590.                 bio=$result
  591.                 EIO=`ha $bio 0f`
  592.                 checkaddr $name$bd $bio $EIO && break
  593.         done
  594.         BIO=$bio
  595.  
  596.         NMINORS="1"
  597.  
  598.         # set the thick/thin thing
  599.         prompt_yn "Does this 503 board use thick (AUI) ethernet?" "n" || cleanup $FAIL
  600.         thick=0
  601.         [ "$result" = "Y" ] && thick=1
  602.  
  603.         currdir=`pwd`
  604.         cd /etc/conf/pack.d/e3B0
  605.         sed -e "s/fine XCVR$bd.*/fine XCVR$bd   $thick/" < space.c > /tmp/bog$$
  606.         mv /tmp/bog$$ space.c
  607.         cd $currdir
  608. }
  609.  
  610. #
  611. # function to produce the info for the System file for the NE2000
  612. # boards
  613. #
  614. system_nat() {
  615.         bd=$1
  616.  
  617.         case $bd in
  618.         0) IRQ=3; BIO=300;;
  619.         1) IRQ=2; BIO=320;;
  620.         2) IRQ=5; BIO=340;;
  621.         3) IRQ=4; BIO=360;;
  622.         esac
  623.  
  624.         while :
  625.         do
  626.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5" || cleanup $FAIL
  627.                 irq=$result
  628.                 checkvec $name$bd $irq && break
  629.         done
  630.         IRQ=$irq
  631.  
  632.         while :
  633.         do
  634.                 prompt_select "Enter I/O base address" $BIO "300 320 340 360" || cleanup $FAIL
  635.                 bio=$result
  636.                 EIO=`ha $bio 1f`
  637.                 checkaddr $name$bd $bio $EIO && break
  638.         done
  639.         BIO=$bio
  640.  
  641.         NMINORS="1"
  642.  
  643. }
  644.  
  645. #
  646. # function to produce the info for the System file for the SONIC
  647. # boards
  648. #
  649. system_son() {
  650.         bd=$1
  651.  
  652.         case $bd in
  653.         0) IRQ=9;  BIO=2000;;
  654.         1) IRQ=10; BIO=3000;;
  655.         2) IRQ=11; BIO=4000;;
  656.         3) IRQ=15; BIO=5000;;
  657.         esac
  658.  
  659.         while :
  660.         do
  661.                 prompt_select "Enter IRQ" $IRQ "9 10 11 15" || cleanup $FAIL
  662.                 irq=$result
  663.                 checkvec $name$bd $irq && break
  664.         done
  665.         IRQ=$irq
  666.  
  667.         while :
  668.         do
  669.                 prompt_range "Enter I/O base address" $BIO "1000" "7000" "1000 " || cleanup $FAIL
  670.                 bio=$result
  671.                 EIO=`ha $bio 1f`
  672.                 checkaddr $name$bd $bio $EIO && break
  673.         done
  674.         BIO=$bio
  675.  
  676.         NMINORS="1"
  677.  
  678. }
  679.  
  680. #
  681. # system_d51e()
  682. system_d51e() {
  683.         BIO=0
  684.         EIO=0
  685.         IRQ=0
  686.         NMINORS="1"
  687. }
  688.  
  689. #
  690. # function to produce the info for the System file for the DE-220
  691. # boards
  692. #
  693. system_d22e() {
  694.  
  695.         MediaType=3
  696.  
  697.         echo ""
  698.         echo "NOTE:"
  699.         echo "  If the board of ETHER16 is a non-plug and play card,"
  700.         echo "  please use setup program in DOS to change I/O base address,"
  701.         echo "  and IRQ number if conflict."
  702.         echo ""
  703.         echo ""
  704.         echo "Please choose the media mode that you want....................."
  705.         echo ""
  706.         echo "  0. Twisted pair connection."
  707.         echo "  1. BNC connection."
  708.         echo "  2. AUI connection."
  709.         echo "  3. Automatic detection between TP BNC and AUI."
  710.         echo "  4. Use EEPROM setting."
  711.         echo ""
  712.         prompt_select " Enter number of media mode selection" $MediaType "0 1 2 3 4" || cleanup $FAIL
  713.         MediaType=$result
  714.         echo ""
  715.         case $MediaType in
  716.         0) MediaTypeTXT="MEDIA_UTP";
  717.            echo " Media mode : Twisted pair. ";
  718.            ;;
  719.         1) MediaTypeTXT="MEDIA_BNC";
  720.            echo " Media mode : BNC.";
  721.            ;;
  722.         2) MediaTypeTXT="MEDIA_AUI";
  723.            echo " Media mode : AUI.";
  724.            ;;
  725.         3) MediaTypeTXT="MEDIA_AUTO";
  726.            echo " Media mode : Automatic detection between TP BNC and AUI.";
  727.            ;;
  728.         4) MediaTypeTXT="MEDIA_DEFAULT";
  729.            echo " Media mode : Use EEPROM setting";
  730.            ;;
  731.         esac
  732.  
  733.         ed -s /etc/conf/pack.d/d22e0/space.c << TOAST > /dev/null
  734. /#define ND22E_MediaType_$bd/
  735. d
  736. i
  737. #define ND22E_MediaType_$bd     $MediaTypeTXT
  738. .
  739. w
  740. q
  741. TOAST
  742.  
  743.         BIO=0
  744.         EIO=0
  745.         IRQ=0
  746.         NMINORS="1"
  747.  
  748. }
  749.  
  750. #
  751. # function to produce the info for the System file for the WD1013
  752. # boards
  753. #
  754. system_wdt() {
  755.         bd=$1
  756.  
  757.         ucbase="wdt"
  758.         case $bd in
  759.         0) IRQ=3; BIO=300; BRAM=c0000;;
  760.         1) IRQ=4; BIO=320; BRAM=c8000;;
  761.         2) IRQ=5; BIO=340; BRAM=d0000;;
  762.         3) IRQ=9; BIO=360; BRAM=d8000;;
  763.         esac
  764.  
  765.         while :
  766.         do
  767.                 prompt_select "Enter IRQ" $IRQ "3 4 5 7 9 10 11 15" || cleanup $FAIL
  768.                 irq=$result
  769.                 checkvec $name$bd $irq && break
  770.         done
  771.         IRQ=$irq
  772.  
  773.         while :
  774.         do
  775.                 prompt_range "Enter I/O base address" $BIO "200" "3e0" "20" || cleanup $FAIL
  776.                 bio=$result
  777.                 EIO=`ha $bio 1f`
  778.                 checkaddr $name$bd $bio $EIO && break
  779.         done
  780.         BIO=$bio
  781.  
  782.         while :
  783.         do
  784.                 prompt_range "Enter RAM base address" $BRAM "80000" "f0c000" "2000" || cleanup $FAIL
  785.                 bram=$result
  786.                 ERAM=`ha $bram 3fff`
  787.                 checkram $name$bd $bram $ERAM && break
  788.         done
  789.         BRAM=$bram
  790.  
  791.         NMINORS="1"
  792.  
  793. }
  794.  
  795.  
  796. #
  797. # function to produce the information for the System file for the 3C523
  798. #
  799. system_e3C() {
  800.         bd=$1
  801.  
  802.         case $bd in
  803.         0) IRQ=3; BIO=300; BRAM=c0000;;
  804.         1) IRQ=7; BIO=1300; BRAM=c8000;;
  805.         2) IRQ=9; BIO=2300; BRAM=d0000;;
  806.         3) IRQ=12; BIO=3300; BRAM=d8000;;
  807.         esac
  808.  
  809.         while :
  810.         do
  811.                 prompt_select "Enter IRQ" $IRQ "3 7 9 12" || cleanup $FAIL
  812.                 irq=$result
  813.                 checkvec $name$bd $irq && break
  814.         done
  815.         IRQ=$irq
  816.  
  817.         while :
  818.         do
  819.                 prompt_range "Enter I/O base address" $BIO "300" "3300" "1000" || cleanup $FAIL
  820.                 bio=$result
  821.                 EIO=`ha $bio 8`
  822.                 checkaddr $name$bd $bio $EIO && break
  823.         done
  824.         BIO=$bio
  825.  
  826.         while :
  827.         do
  828.                 prompt_range "Enter RAM base address" $BRAM "c0000" "d8000" "8000" || cleanup $FAIL
  829.                 bram=$result
  830.                 ERAM=`ha $bram 5fff`
  831.                 checkram $name$bd $bram $ERAM && break
  832.         done
  833.         BRAM=$bram
  834.  
  835.         NMINORS="1"
  836. }
  837.  
  838. #
  839. # function to produce the information for the System file for the 3C507
  840. # board
  841. #
  842. system_e3D() {
  843.         bd=$1
  844.  
  845.         case $bd in
  846.         0) IRQ=3; BIO=300; BRAM=c0000;;
  847.         1) IRQ=9; BIO=310; BRAM=d0000;;
  848.         2) IRQ=5; BIO=320; BRAM=c8000;;
  849.         3) IRQ=7; BIO=330; BRAM=d8000;;
  850.         esac
  851.  
  852.         while :
  853.         do
  854.                 prompt_select "Enter IRQ" $IRQ "3 5 7 9 10 11 12 15" || cleanup $FAIL
  855.                 irq=$result
  856.                 checkvec $name$bd $irq && break
  857.         done
  858.         IRQ=$irq
  859.  
  860.         while :
  861.         do
  862.                 prompt_select "Enter I/O base address" $BIO "200 210 220 230 240 250 260 280 290 2a0 2b0 2c0 2d0 2e0 300 310 320 330 340 350 360 380 390 3a0 3e0" || cleanup $FAIL
  863.                 bio=$result
  864.                 EIO=`ha $bio f`
  865.                 checkaddr $name$bd $bio $EIO && break
  866.         done
  867.         BIO=$bio
  868.  
  869.         while :
  870.         do
  871.                 prompt_select "Enter RAM base address" $BRAM "c0000 c8000 d0000 d8000 f00000 f20000 f40000 f60000 f80000" || cleanup $FAIL
  872.                 bram=$result
  873.  
  874.                 case $bram in
  875.                 c[08]000|d0000) sizelist="16 32 48 64";;
  876.                 d8000)          sizelist="16 32";;
  877.                 *)              sizelist="64";;
  878.                 esac
  879.                 prompt_select "Enter RAM Size in k" 64 "$sizelist" || cleanup $FAIL
  880.                 case $result in
  881.                 16) size=3fff ;;
  882.                 32) size=7fff ;;
  883.                 48) size=bfff ;;
  884.                 64) size=ffff ;;
  885.                 esac
  886.                 ERAM=`ha $bram $size`
  887.                 checkram $name$bd $bram $ERAM && break
  888.         done
  889.         BRAM=$bram
  890.  
  891.         NMINORS="32"
  892. }
  893.  
  894. #
  895. # function to produce the information for the space.c file for the token ring
  896. #
  897. space_token() {
  898.  
  899.         # Set whether Netbeui is above us or not
  900.         nbe=0
  901.         [ "$name_above" = "nbe" ] && nbe=1
  902.  
  903.         currdir=`pwd`
  904.         cd /etc/conf/pack.d/tok0
  905.         sed -e "s/fine TOK$bd.*/fine TOK$bd     $nbe/" < space.c > /tmp/bog$$
  906.         cp /tmp/bog$$ space.c
  907.         rm -r /tmp/bog$$
  908.         cd $currdir
  909. }
  910.  
  911. #
  912. # function to remove address conflicts in the sio driver
  913. #
  914. sio_conflict() {
  915.         currdir=`pwd`
  916.         cd /etc/conf/pack.d/sio
  917.         if [ "$type" = "386GT" -a "$base" = "tok0" ]
  918.         then
  919.                 # get rid of sio access to 0x2f0 (Global Interrupt enable) on AT
  920.                 grep "ibm COM3" space.c > /dev/null && {
  921.                         echo "Removing ibm COM3 from link kit..."
  922.                         [ ! -f space.c.rls ] && cp space.c space.c.rls
  923.                         sed -e /"ibm COM3/s/^{/\/* LLI {/p" space.c > /tmp/bog$$
  924.                         mv /tmp/bog$$ space.c > /dev/null 2>&1
  925.                 }
  926.         fi
  927.         grep "(sd)0x$BIO" space.c > /dev/null && {
  928.                 echo "Removing serial cards using base address 0x$BIO from link kit..."
  929.                 [ ! -f space.c.rls ] && cp space.c space.c.rls
  930.                 sed -e /"(sd)0x$BIO,/s/^{/\/* LLI {/p" space.c > /tmp/bog$$
  931.                 mv /tmp/bog$$ space.c > /dev/null 2>&1
  932.         }
  933.         cd $currdir
  934. }
  935.  
  936. #
  937. # determine release, and AT or MCA bus - set rel and type variables accordingly.
  938. #
  939. os_type() {
  940.         rel=`sed -n 's/^#rel=\(.*\).$/\1/p' /etc/perms/rts`
  941.         if [ "$rel" = "3.2.0" -o "$rel" = "3.2.1" -o "$rel" = "3.2.2" ]
  942.         then
  943.                 type=`sed -n 's/^#typ=\(.*\)$/\1/p' /etc/perms/inst`
  944.         else
  945.                 # 3.2.4 - one release supports AT, MCA, and EISA.
  946.                 uname -X | grep "BusType = MCA" >/dev/null 2>&1
  947.                 if [ $? -eq 0 ]
  948.                 then
  949.                         type=386MC
  950.                 else
  951.                         type=386GT
  952.                 fi
  953.         fi
  954. }
  955.  
  956. #
  957. # function to produce the information for the System file for the token ring
  958. #
  959. # BRAM/ERAM indicate ROM address switch settings; BSHRAM/ESHRAM indicate
  960. # shared memory settings.  We assume they're using 16K of SHRAM on the adapter.
  961. #
  962. system_tok() {
  963.         bd=$1
  964.  
  965.         case $bd in
  966.         0) IRQ=2; BIO=a20; BRAM=cc000; BSHRAM=d8000;;
  967.         1) IRQ=3; BIO=a24; BRAM=dc000; BSHRAM=d4000;;
  968.         esac
  969.  
  970.         while :
  971.         do
  972.                 prompt_select "Enter IRQ" $IRQ "2 3 6 7" || cleanup $FAIL
  973.                 irq=$result
  974.                 checkvec $name$bd $irq && break
  975.         done
  976.         IRQ=$irq
  977.  
  978.         EIO=`ha $BIO 3`
  979.  
  980.         while :
  981.         do
  982.                 prompt_range "Enter ROM base address" $BRAM "c0000" "de000" "2000" || cleanup $FAIL
  983.                 brom=$result
  984.                 ERAM=`ha $brom 1fff`
  985.                 checkram $name$bd $brom $ERAM && break
  986.         done
  987.         BRAM=$brom
  988.  
  989.         # Microchannel tok adapters have a configurable shared RAM address.
  990.         if [ "$type" = "386GT" ]
  991.         then
  992.                 ESHRAM=`ha $BSHRAM 3fff`
  993.                 doramclash $name$bd $BSHRAM $ESHRAM && {
  994.                         echo "The RAM addresses required for $name$bd are in use by the $clash device"
  995.                         echo "You must remove $clash before installing $name$bd"
  996.                         cleanup $FAIL
  997.                 }
  998.         else
  999.                 prompt_range "Enter RAM base address" $BSHRAM "c0000" "dc000" "4000" || cleanup $FAIL
  1000.                 BSHRAM=$result
  1001.                 ESHRAM=`ha $BSHRAM 3fff`
  1002.                 doramclash $name$bd $BSHRAM $ESHRAM && {
  1003.                         echo "The RAM addresses required for $name$bd are in use by the $clash device"
  1004.                         echo "You must remove $clash before installing $name$bd"
  1005.                         cleanup $FAIL
  1006.                 }
  1007.         fi
  1008.  
  1009.         if [ ! -x /usr/lib/token ]
  1010.         then
  1011.                 mkdir /usr/lib/token
  1012.         fi
  1013.  
  1014.         prompt_yn "Restrict broadcasts to the local ring" "y" || cleanup $FAIL
  1015.         if [ "$result" = "Y" ]
  1016.         then
  1017.                 touch /usr/lib/token/noroute$bd
  1018.         else
  1019.                 rm -f /usr/lib/token/noroute$bd
  1020.         fi
  1021.  
  1022.         NMINORS="1"
  1023.  
  1024.         space_token
  1025. }
  1026.  
  1027. #
  1028. # function to produce the information for the System file for the Excelan
  1029. #
  1030. system_exos() {
  1031.         bd=$1
  1032.  
  1033.         case $bd in
  1034.         0) IRQ=2; BIO=310; BRAM=d0000;;
  1035.         1) IRQ=3; BIO=300; BRAM=d4000;;
  1036.         2) IRQ=5; BIO=320; BRAM=d8000;;
  1037.         3) IRQ=7; BIO=330; BRAM=dc000;;
  1038.         esac
  1039.  
  1040.         while :
  1041.         do
  1042.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5 6 7" || cleanup $FAIL
  1043.                 irq=$result
  1044.                 checkvec $name$bd $irq && break
  1045.         done
  1046.         IRQ=$irq
  1047.  
  1048.         while :
  1049.         do
  1050.                 prompt_range "Enter I/O base address" $BIO "300" "330" "10" || cleanup $FAIL
  1051.                 bio=$result
  1052.                 EIO=`ha $bio 7`
  1053.                 checkaddr $name$bd $bio $EIO && break
  1054.         done
  1055.         BIO=$bio
  1056.  
  1057.         while :
  1058.         do
  1059.                 prompt_range "Enter RAM base address" $BRAM "a0000" "f0000" "4000" || cleanup $FAIL
  1060.                 bram=$result
  1061.                 ERAM=`ha $bram 3fff`
  1062.                 checkram $name$bd $bram $ERAM && break
  1063.         done
  1064.         BRAM=$bram
  1065.  
  1066.         NMINORS="32"
  1067. }
  1068.  
  1069. #
  1070. # function to produce the information for the System file for the western
  1071. # digital board
  1072. #
  1073. system_wdn() {
  1074.         bd=$1
  1075.  
  1076.         case $bd in
  1077.         0) IRQ=3; BIO=240; BRAM=d0000;;
  1078.         1) IRQ=2; BIO=380; BRAM=d2000;;
  1079.         2) IRQ=5; BIO=260; BRAM=d4000;;
  1080.         3) IRQ=7; BIO=340; BRAM=d6000;;
  1081.         esac
  1082.  
  1083.         if [ "$type" = "386MC" ]
  1084.         then
  1085.                 prompt_yn "\nAre you installing an Elite series (WD8013EP/A, WD8013WP/A, or\nWD8013EW/A) Western Digital card?" "n" || cleanup $FAIL
  1086.                 if [ "$result" = "Y" ]
  1087.                 then
  1088.                         elite="Y"
  1089.                         case $bd in
  1090.                         0) IRQ=3; BIO=800; BRAM=d0000;;
  1091.                         1) IRQ=4; BIO=1800; BRAM=d2000;;
  1092.                         2) IRQ=10; BIO=2800; BRAM=d4000;;
  1093.                         3) IRQ=15; BIO=3800; BRAM=d6000;;
  1094.                         esac
  1095.                 fi
  1096.         fi
  1097.  
  1098.         while :
  1099.         do
  1100.                 if [ "$type" = "386MC" -a "$elite" = "Y" ]
  1101.                 then
  1102.                         # WD8013EP/A allows IRQ 14, WD8013WP/A allows IRQ 15
  1103.                         prompt_select "Enter IRQ" $IRQ "3 4 10 14 15" || cleanup $FAIL
  1104.                 else
  1105.                         prompt_select "Enter IRQ" $IRQ "2 3 4 5 7 10 11 15" || cleanup $FAIL
  1106.                 fi
  1107.                 irq=$result
  1108.                 checkvec $name$bd $irq && break
  1109.         done
  1110.         IRQ=$irq
  1111.  
  1112.         while :
  1113.         do
  1114.                 if [ "$type" = "386MC" -a "$elite" = "Y" ]
  1115.                 then
  1116.                         prompt_range "Enter I/O base address" $BIO "800" "f800" "1000" || cleanup $FAIL
  1117.                 else
  1118.                         prompt_range "Enter I/O base address" $BIO "200" "3e0" "20" || cleanup $FAIL
  1119.                 fi
  1120.                 bio=$result
  1121.                 EIO=`ha $bio 1f`
  1122.                 checkaddr $name$bd $bio $EIO && break
  1123.         done
  1124.         BIO=$bio
  1125.  
  1126.         while :
  1127.         do
  1128.                 if [ "$type" = "386MC" -a "$elite" = "Y" ]
  1129.                 then
  1130.                         prompt_range "Enter RAM base address" $BRAM "c0000" "fde000" "2000" || cleanup $FAIL
  1131.                 else
  1132.                         prompt_range "Enter RAM base address" $BRAM "80000" "f0c000" "2000" || cleanup $FAIL
  1133.                 fi
  1134.                 bram=$result
  1135.                 if [ "$type" = "386GT" -o "$elite" = "Y" ]
  1136.                 then
  1137.                         prompt_select "Enter RAM Size in k" 8 "8 16" || cleanup $FAIL
  1138.                         case $result in
  1139.                                 8)  size=1fff ;;
  1140.                                 16) size=3fff ;;
  1141.                         esac
  1142.                 else
  1143.                         size=3fff
  1144.                 fi
  1145.                 ERAM=`ha $bram $size`
  1146.                 checkram $name$bd $bram $ERAM || continue
  1147.                 hc $bram 100000 f0c000 2000 > /dev/null 2>& 1 && {
  1148.                         echo "Warning: this address may not be valid if your network adapter"
  1149.                         echo "is not a Western Digital 16-Bit Elite adapter"
  1150.                         echo "Shared memory addresses above 1 Meg are supported by 16-bit Elite adapters only."
  1151.                 }
  1152.                 break
  1153.         done
  1154.         BRAM=$bram
  1155.  
  1156.         NMINORS="32"
  1157.  
  1158.         [ "$rel" = "3.2.1" -o "$rel" = "3.2.0" ] && {
  1159.                 if [ "$type" = "386GT" ]
  1160.                 then
  1161.                         grep "int arch =" /etc/conf/pack.d/wdn0/space.c >/dev/null 2>&1 || {
  1162.                         echo "int arch = 1;" >> /etc/conf/pack.d/wdn0/space.c
  1163.                         }
  1164.                 elif [ "$type" = "386MC" ]
  1165.                 then
  1166.                         grep "int arch =" /etc/conf/pack.d/wdn0/space.c >/dev/null 2>&1 || {
  1167.                         echo "int arch = 2;" >> /etc/conf/pack.d/wdn0/space.c
  1168.                         }
  1169.                 fi
  1170.         }
  1171. }
  1172.  
  1173.  
  1174. #
  1175. # function to produce info for the System file for HP EISA Slave LAN adapters
  1176. #
  1177. system_hpe() {
  1178.         bd=$1
  1179.  
  1180.         case ${bd} in
  1181.         0) IRQ=5 ; DMA=3;;
  1182.         1) IRQ=7 ; DMA=2;;
  1183.         2) IRQ=10; DMA=6;;
  1184.         3) IRQ=11; DMA=5;;
  1185.         esac
  1186.  
  1187.         while :
  1188.         do
  1189.                 prompt_select "Enter DMA channel" $DMA "1 2 3 5 6" || cleanup $FAIL
  1190.                 dma=$result
  1191.                 checkdma $name$bd $dma && break
  1192.         done
  1193.         DMACHAN=$dma
  1194.  
  1195.         while :
  1196.         do
  1197.                 prompt_select "Enter IRQ" $IRQ "3 4 5 7 10 11 12" || cleanup $FAIL
  1198.                 irq=$result
  1199.                 checkvec $name$bd $irq && break
  1200.         done
  1201.         IRQ=$irq
  1202.  
  1203.         while :
  1204.         do
  1205.                 prompt_select "Enter slot number" "" "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" || cleanup $FAIL
  1206.                 SLOT=$result
  1207.                 case $result in
  1208.                  0) bio=0C00; EIO=0CFF;;
  1209.                  1) bio=1C00; EIO=1CFF;;
  1210.                  2) bio=2C00; EIO=2CFF;;
  1211.                  3) bio=3C00; EIO=3CFF;;
  1212.                  4) bio=4C00; EIO=4CFF;;
  1213.                  5) bio=5C00; EIO=5CFF;;
  1214.                  6) bio=6C00; EIO=6CFF;;
  1215.                  7) bio=7C00; EIO=7CFF;;
  1216.                  8) bio=8C00; EIO=8CFF;;
  1217.                  9) bio=9C00; EIO=9CFF;;
  1218.                 10) bio=AC00; EIO=ACFF;;
  1219.                 11) bio=BC00; EIO=BCFF;;
  1220.                 12) bio=CC00; EIO=CCFF;;
  1221.                 13) bio=DC00; EIO=DCFF;;
  1222.                 14) bio=EC00; EIO=ECFF;;
  1223.                 15) bio=FC00; EIO=DCFF;;
  1224.                 *) cleanup $FAIL
  1225.                 esac
  1226.                 checkaddr $name$bd $bio $EIO && break
  1227.         done
  1228.         BIO=$bio
  1229.  
  1230. BRAM="0"
  1231. ERAM="0"
  1232. NMINORS="1"
  1233. }
  1234.  
  1235. #
  1236. # function to produce the info for the System file for the HP ISA LAN adapters
  1237. #
  1238. system_hpi() {
  1239.         bd=$1
  1240.  
  1241.         case ${bd} in
  1242.         0) IRQ=2  ; BIO=300;;
  1243.         1) IRQ=3  ; BIO=240;;
  1244.         2) IRQ=5  ; BIO=280;;
  1245.         3) IRQ=7  ; BIO=2C0;;
  1246.         esac
  1247.  
  1248.         while :
  1249.         do
  1250.                 echo "IRQs 10 and 11 are only valid for 16-bit adapters."
  1251.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5 7 10 11" || cleanup $FAIL
  1252.                 irq=$result
  1253.                 checkvec $name$bd $irq && break
  1254.         done
  1255.         IRQ=$irq
  1256.         while :
  1257.         do
  1258.                 prompt_select "Enter I/O base address" $BIO "200 240 280 2C0 300 320 340" || cleanup $FAIL
  1259.                 bio=$result
  1260.                 case $result in
  1261.                 200) EIO=21F ;;
  1262.                 240) EIO=25F ;;
  1263.                 280) EIO=29F ;;
  1264.                 2C0) EIO=2DF ;;
  1265.                 300) EIO=31F ;;
  1266.                 320) EIO=33F ;;
  1267.                 340) EIO=35F ;;
  1268.                 *) cleanup $FAIL
  1269.                 esac
  1270.                 checkaddr $name$bd $bio $EIO && break
  1271.         done
  1272.         BIO=$bio
  1273.         BRAM="0"
  1274.         ERAM="0"
  1275.         NMINORS="1"
  1276. }
  1277.  
  1278. #
  1279. # Edits the major number into the space.c file for Racal InterLan drivers
  1280. #
  1281. space_inn() {
  1282.  
  1283.         spacef=${CONF:-/etc/conf}/pack.d/${drv}0/space.c
  1284.         currdir=`pwd`
  1285.         if [ "$installed" = "TRUE" ]
  1286.         then
  1287.                 cd $CONF/cf.d
  1288.                 maj=`./configure -j $base`
  1289.                 if [ $? -ne 0 -o "$maj" = "" ]
  1290.                 then
  1291.                         maj=`./configure -j NEXTMAJOR`
  1292.                 fi
  1293.                 cd $currdir
  1294.         else                    # get the next major number
  1295.                 cd $CONF/cf.d
  1296.                 maj=`./configure -j NEXTMAJOR`
  1297.                 cd $currdir
  1298.         fi
  1299.                 str="${ucbase}major${bd}"
  1300.         sed "s/$str/$maj/" $spacef >/tmp/bog$$
  1301.         cp /tmp/bog$$ $spacef
  1302.         rm -f /tmp/bog$$
  1303. }
  1304.  
  1305. #
  1306. # function to produce the information for the System file for the Racal InterLan
  1307. # ES-3210 board.
  1308. #
  1309. system_i3B() {
  1310.         ucbase="I3B"
  1311.         bd=$1
  1312.         spacef=${CONF:-/etc/conf}/pack.d/${drv}0/space.c
  1313.  
  1314.         # BIO represents EISA slot number here
  1315.         case $bd in
  1316.         0) IRQ=9; BIO=1; BRAM=d0000; DMA=NONE;;
  1317.         1) IRQ=10; BIO=2; BRAM=d4000; DMA=NONE;;
  1318.         2) IRQ=11; BIO=4; BRAM=d8000; DMA=NONE;;
  1319.         3) IRQ=12; BIO=5; BRAM=dc000; DMA=NONE;;
  1320.         esac
  1321.  
  1322.         while :
  1323.         do
  1324.                 prompt_select "Enter IRQ" $IRQ "3 4 5 6 7 9 10 11 12 14 15" || cleanup $FAIL
  1325.                 irq=$result
  1326.                 checkvec $name$bd $irq && break
  1327.         done
  1328.         IRQ=$irq
  1329.  
  1330.         while :
  1331.         do
  1332.                 prompt_range "Enter slot number" $BIO "1" "15" "1" || cleanup $FAIL
  1333.                 bio=`expr $result * 1000`
  1334.                 EIO=`ha $bio fff`
  1335.                 checkaddr $name$bd $bio $EIO && break
  1336.         done
  1337.         BIO=$bio
  1338.  
  1339.         while :
  1340.         do
  1341.                 prompt_range "Enter RAM base address" $BRAM "c0000" "3fffc000" "4000" || cleanup $FAIL
  1342.                 bram=$result
  1343.                 ERAM=`ha $bram 3fff`
  1344.                 checkram $name$bd $bram $ERAM || continue
  1345.                 break
  1346.         done
  1347.         BRAM=$bram
  1348.  
  1349.         while :
  1350.         do
  1351.                 prompt_select "Enter DMA" $DMA "NONE 0 1 2 3 5 6 7" || cleanup $FAIL
  1352.                 if [ "$result" = "NONE" ]
  1353.                 then
  1354.                         dma=-1
  1355.                 else
  1356.                         dma=$result
  1357.                 fi
  1358.                 checkdma $name$bd $dma && break
  1359.         done
  1360.         DMACHAN=$dma
  1361. #
  1362. # Setup space.c.
  1363. # Get the media type (thick or thin and edit it into space.c
  1364. #
  1365.         prompt_yn "Does this ES-3210 board use thick (AUI) ethernet?" "n" || cleanup $FAIL
  1366.         if [ "$result" = "Y" ]
  1367.         then
  1368.                 netyp="THIK"
  1369.         else
  1370.                 netyp="THIN"
  1371.         fi
  1372.         if [ $bd -eq 0 ]
  1373.         then
  1374.                 str="THIKTHIN"
  1375.         else
  1376.                 str="THIKTHIN${bd}"
  1377.         fi
  1378.         a=`grep -n "^#define[   ]${str}[        ]" $spacef`
  1379.         b=`expr "$a" : '.*G1_\(....\)'`
  1380.         if [ "$b" != "$netyp" ]
  1381.         then
  1382.                 c=`expr "$a" : '\(.*:\)' | sed 's/://'`
  1383.                 sed "${c}s/G1_$b/G1_$netyp/" $spacef >/tmp/bog$$
  1384.                 cp /tmp/bog$$ $spacef
  1385.                 rm /tmp/bog$$
  1386.         fi
  1387.         space_inn               # Edit major number it into space.c
  1388.         NMINORS="1"
  1389. }
  1390.  
  1391. #
  1392. # function to produce the information for the System file for the Racal InterLan
  1393. # NI-6510 board.
  1394. #
  1395. system_i6E() {
  1396.         ucbase="I6E"
  1397.         bd=$1
  1398.         spacef=${CONF:-/etc/conf}/pack.d/${drv}0/space.c
  1399.         BRAM=0
  1400.  
  1401.         case $bd in
  1402.         0) IRQ=9; BIO=360; DMA=3;;
  1403.         1) IRQ=12; BIO=340; DMA=5;;
  1404.         esac
  1405.  
  1406.         while :
  1407.         do
  1408.                 prompt_select "Enter IRQ" $IRQ "5 9 12 15" || cleanup $FAIL
  1409.                 irq=$result
  1410.                 checkvec $name$bd $irq && break
  1411.         done
  1412.         IRQ=$irq
  1413.  
  1414.         while :
  1415.         do
  1416.                 prompt_range "Enter I/O base address" $BIO "300" "360" "20" || cleanup $FAIL
  1417.                 bio=$result
  1418.                 EIO=`ha $bio f`
  1419.                 checkaddr $name$bd $bio $EIO && break
  1420.         done
  1421.         BIO=$bio
  1422.  
  1423.         while :
  1424.         do
  1425.                 prompt_select "Enter DMA" $DMA "0 3 5 6" || cleanup $FAIL
  1426.                 dma=$result
  1427.                 checkdma $name$bd $dma && break
  1428.         done
  1429.         DMACHAN=$dma
  1430.         space_inn               # Edit major number it into space.c
  1431.         NMINORS="1"
  1432. }
  1433.  
  1434. create_scripts()
  1435. {
  1436.         if [ $bd -ne $MAX_BD ]
  1437.         then
  1438.                 currdir=`pwd`
  1439.                 netconfigdir=/usr/lib/netconfig
  1440.                 cd $netconfigdir/info
  1441.                 newboard=`expr $bd + 1`
  1442.                 newfile=${drv}${newboard}
  1443.                 cp ${drv}0 $newfile
  1444.                 sed -e '/^NAME=.*'"[^0]"'/s/0\"/'$newboard'\"/p' $newfile > /tmp/bog$$
  1445.                 sed -e '/^DESCRIPTION=.*'"[^0]"'/s/0\"/'$newboard'\"/p' /tmp/bog$$ > $newfile
  1446.                 rm -r /tmp/bog$$
  1447.                 chown bin $newfile
  1448.                 chgrp bin $newfile
  1449.                 chmod 750 $newfile
  1450.  
  1451.                 cd $netconfigdir/init
  1452.                 ln $base ${drv}`expr $bd + 1` > /dev/null 2>&1
  1453.  
  1454.                 cd $netconfigdir/remove
  1455.                 ln $base ${drv}`expr $bd + 1` > /dev/null 2>&1
  1456.                 cd $currdir
  1457.         fi
  1458. }
  1459.  
  1460. # main()
  1461. #
  1462.  
  1463. #
  1464. # get the name of the init script being run, since one script
  1465. # is used for multiple drivers; get the number at the end of the
  1466. # script's name
  1467. #
  1468.  
  1469. if [ $# -gt 1 ]
  1470. then
  1471.         name_below=$1; if_below=$2
  1472.         name_above=$3; if_above=$4
  1473.         configure=$5
  1474. fi
  1475.  
  1476. base=`basename $0`
  1477. drv=`echo $base | sed -e 's/[0-9]*$//`
  1478. bd=`expr $base : '.*\(.\)'`
  1479. chains=/usr/lib/lli/chains
  1480. chain=$base:$name_above
  1481. confdir=/etc/conf/cf.d
  1482.  
  1483. makedevs
  1484. check_args $drv $bd
  1485.  
  1486. #
  1487. # Check and manage our internal chains file.
  1488. # This file allows coexistent mkdev and netconfig calls.
  1489. #
  1490. # chain already installed
  1491. grep $chain $chains > /dev/null 2>& 1 && {
  1492.         echo $chain >> $chains
  1493.         cleanup $OK
  1494. }
  1495. # this board already installed
  1496. grep $base: $chains > /dev/null 2>& 1 && {
  1497.         echo $base already configured.
  1498.         echo $chain >> $chains
  1499.         [ "$drv" = "tok" -a "$name_above" = "nbe" ] && {
  1500.                 space_token
  1501.         }
  1502.         echo "NODE=/etc/conf/node.d/$base" >/tmp/$base.src
  1503.         chmod 777 /tmp/$base.src
  1504.         cleanup $OK
  1505. }
  1506. #
  1507. # Now check that if we are not board zero that board zero is installed
  1508. #
  1509. [ "$bd" -ne "0" ] && {
  1510.         grep ${drv}0 $chains > /dev/null 2>& 1 || {
  1511.                 echo "${drv}0 not configured, you must configure it first"
  1512.                 cleanup $FAIL
  1513.         }
  1514. }
  1515.  
  1516. #
  1517. # check to see if the driver is already in the kernel link-kit so we can
  1518. # either add it or update it later on
  1519. #
  1520. idcheck -p $base -i /tmp/dev$$
  1521. if [ $? -gt 16 ]
  1522. then
  1523.         installed="TRUE"
  1524. else
  1525.         installed="FALSE"
  1526. fi
  1527.  
  1528. if [ "$bd" = "0" ]
  1529. then
  1530.         echo "Installing the $drv driver into the link kit"
  1531.         cd /usr/lib/lli/$drv
  1532.         if [ "$installed" = "TRUE" ]
  1533.         then
  1534.                 idinstall -u -e -k $base
  1535.         else
  1536.                 idinstall -a -e -k $base
  1537.         fi
  1538.         makedevs
  1539. else
  1540.         idcheck -p ${drv}0 -i /tmp/dev$$
  1541.         if [ $? -le 16 ]
  1542.         then
  1543.                 echo "${drv}0 must be configured before attempting to configure $drv"
  1544.                 cleanup 1
  1545.         fi
  1546. fi
  1547.  
  1548. #
  1549. # create the temporary directory for installing the driver
  1550. #
  1551. cd /tmp; rm -rf $base
  1552. mkdir $base; cd $base
  1553.  
  1554. DMACHAN="-1"
  1555.  
  1556. #
  1557. # set rel, type variables.
  1558. #
  1559. os_type
  1560.  
  1561. #
  1562. # Do special board dependent processing
  1563. #
  1564. system_$drv $bd
  1565.  
  1566. echo
  1567. if [ "$IRQ" = "2" ]
  1568. then
  1569.         IRQ=9
  1570. fi
  1571.  
  1572. echo "$base\tY\t$NMINORS\t0\t0\t$IRQ\t$BIO\t$EIO\t$BRAM\t$ERAM" >./System
  1573.  
  1574. #
  1575. # All the drivers support more than one board.  In fact all the code to
  1576. # support all the boards is in the Driver.o for the board for the 1st board
  1577. # (eg the e3A0 driver acually contains enough code for the e3A1, e3A2 & e3A3
  1578. # boards).  As we need a Driver.o to be associated with 2nd, 3rd or 4th board
  1579. # we install a dummy Driver.o, and a Master and Node which will actually cause
  1580. # calls into the base driver.
  1581. #
  1582. if [ $bd -gt 0 ]
  1583. then
  1584.         echo "$base     -       iScH    $PREFIX$bd      0       0       1       256     $DMACHAN" >./Master
  1585.         echo "clone     $base   c       $base" >./Node
  1586.  
  1587.         if [ "$installed" = "TRUE" ]
  1588.         then
  1589.                 idinstall -u -m -s -n -e -k $base
  1590.         else
  1591.                 cp $LIB/Driver.o .
  1592.                 idinstall -a -e -k $base
  1593.         fi
  1594. else
  1595.         echo "$base     I       iScH    $PREFIX 0       0       1       256     $DMACHAN" >./Master
  1596.         idinstall -u -m -s -e -k $base
  1597. fi
  1598. # we successfully installed this driver, add it to the chains file
  1599. echo $chain >> $chains
  1600.  
  1601. # create next set of info, init, and remove files
  1602. create_scripts
  1603.  
  1604. # delete any potential BASE I/O address conflicts with the sio driver
  1605. [ "$rel" = "3.2.0" -o "$rel" = "3.2.1" -o "$rel" = "3.2.2" ] && sio_conflict
  1606.  
  1607. echo "NODE=/etc/conf/node.d/$base" >/tmp/$base.src
  1608. chmod 777 /tmp/$base.src
  1609.  
  1610. cleanup $RELINK
  1611.