home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Network / LinkSYS / lne2000.exe / SCOUNIX / RECONF < prev    next >
Text File  |  1995-11-03  |  46KB  |  1,557 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. # Do not remove $base if called with an argument...
  139. #
  140. makedevs() {
  141.         dir=`pwd`
  142.         rm -fr /tmp/dev$$
  143.         mkdir /tmp/dev$$
  144.         cd /etc/conf/cf.d
  145.         cp mdevice /tmp/dev$$
  146.         cd ../sdevice.d
  147.         cat * > /tmp/dev$$/sdevice
  148.         [ $1 ] && {
  149.                 # remove driver being reconfigured from sdevice & mdevice files.
  150.                 sed -e "/^$base/d" < /tmp/dev$$/sdevice > /tmp/bog$$
  151.                 mv /tmp/bog$$ /tmp/dev$$/sdevice
  152.                 sed -e "/^$base/d" < /tmp/dev$$/mdevice > /tmp/bog$$
  153.                 mv /tmp/bog$$ /tmp/dev$$/mdevice
  154.         }
  155.         cd $dir
  156. }
  157.  
  158. cleanup() {
  159.         cd /
  160.         rm -fr /tmp/dev$$
  161.         rm -fr /tmp/$base
  162.         exit $1
  163. }
  164.  
  165. # Removes the given interrupt vector for the $clash device.
  166. rmvector() {
  167.         clash=$1
  168.         vec=$2
  169.  
  170.         cd $confdir
  171.         echo "\nRemoving interrupt vector $vec for the $clash device ..."
  172.  
  173.         [ "$vec" = "2" ] && vec=9
  174.         major=`./configure -j $clash` && {
  175.                 # remove device but leave it required
  176.                 ./configure -d -c -m $major -v $vec -Y >> conflog 2>&1 || {
  177.                         cd $currdir
  178.                         cleanup $FAIL
  179.                 }
  180.                 # remove required setting if no more left
  181.                 if grep "Y" ../sdevice.d/$clash > /dev/null 2>&1
  182.                 then
  183.                         true
  184.                 else
  185.                         ./configure -d -c -m $major -v $vec -R -Y >> conflog 2>&1 || {
  186.                                 cd $currdir
  187.                                 cleanup $FAIL
  188.                         }
  189.                 fi
  190.         }
  191.         cd $currdir
  192.         return $OK
  193. }
  194.  
  195. # On unix, we must check the files in sdevice.d.
  196. # Sets the variable $clash to the driver code name if there is a driver that
  197. # has already been allocated the given vector. Uses awk.
  198. dointclash() {
  199.         driver=$1
  200.         vec=$2
  201.  
  202.         [ "$vec" = "2" ] && vec=9
  203.         cd $confdir/../sdevice.d
  204.         clash=`cat * | awk '{ if ( $6 == intr && $2 == "Y" ) exit } \
  205.                         END { print $1 }' intr=$vec`
  206.  
  207.         cd $currdir
  208.  
  209.         [ "$clash" = "" -o "$clash" = "$driver" ] && return $FAIL
  210.         # found a clash
  211.         return $OK
  212. }
  213.  
  214. checkvec() {
  215.         driver=$1
  216.         vector=$2
  217.         clash=
  218.  
  219.         currdir=`pwd`
  220.         confdir=/etc/conf/cf.d
  221.  
  222.         while dointclash $driver $vector
  223.         do
  224.                 prompt_select "Interrupt vector $vector is already in use for the $clash device.\n\n\
  225. The alternatives available to you are:\n\n\
  226. \t1. Continue the installation and remove vector $vector for the $clash device.\n\
  227. \t2. Select a different interrupt vector.\n\n\
  228. Select an option" 1 "1 2" || {
  229.                         cleanup $FAIL
  230.                 }
  231.                 case $result in
  232.                 1)      rmvector $clash $vector || {
  233.                                 echo "Failed to remove vector $vector"
  234.                                 cleanup $FAIL
  235.                         }
  236.                         makedevs
  237.                         return $OK
  238.                         ;;
  239.                 2)      return $FAIL
  240.                         ;;
  241.                 esac
  242.         done
  243.         return $OK
  244. }
  245.  
  246. doaddrclash() {
  247.         driver=$1
  248.         addr1=$2
  249.         addr2=$3
  250.  
  251.         cd $confdir
  252.         clash=`../bin/idcheck -ar -l $addr1 -u $addr2 -i /tmp/dev$$`
  253.         cd $currdir
  254.  
  255.         [ "$clash" = "" -o "$clash" = "$driver" ] && return $FAIL
  256.         # found a clash
  257.         return $OK
  258. }
  259.  
  260. # Removes the $clash device.
  261. rmaddr() {
  262.         clash=$1
  263.  
  264.         cd $confdir
  265.         echo "\nRemoving the $clash device ..."
  266.  
  267.         major=`./configure -j $clash` && {
  268.                 # remove device but leave it required
  269.                 if [ "$major" != "0" ]
  270.                 then
  271.                         ./configure -d -c -m $major -Y >> conflog 2>&1 || {
  272.                                 cd $currdir
  273.                                 cleanup $FAIL
  274.                         }
  275.                 else
  276.                         sed -e "s/Y/N/" ../sdevice.d/$clash > /tmp/bog$$
  277.                         mv /tmp/bog$$ ../sdevice.d/$clash
  278.                 fi
  279.                 # remove required setting if no more left
  280.                 if grep "Y" ../sdevice.d/$clash > /dev/null 2>&1
  281.                 then
  282.                         true
  283.                 elif [ "$major" != "0" ]
  284.                 then
  285.                         ./configure -d -c -m $major -R -Y >> conflog 2>&1 || {
  286.                                 cd $currdir
  287.                                 cleanup $FAIL
  288.                         }
  289.                 fi
  290.         }
  291.         cd $currdir
  292.         return $OK
  293. }
  294.  
  295. checkaddr() {
  296.         driver=$1
  297.         addr1=$2
  298.         addr2=$3
  299.         clash=
  300.  
  301.         currdir=`pwd`
  302.         confdir=/etc/conf/cf.d
  303.  
  304.         while doaddrclash $driver $addr1 $addr2
  305.         do
  306.                 if [ "$clash" = "ad" ]
  307.                 then
  308.                         echo "\n\nWARNING: Do not remove the $clash device \c"
  309.                         echo "if you are using an Adaptec disk controller"
  310.                 fi
  311.                 prompt_select "Addresses $addr1-$addr2 are already in use by the $clash device.\n\n\
  312. The alternatives available to you are:\n\n\
  313. \t1. Continue the installation and remove the $clash device.\n\
  314. \t2. Select a different address.\n\n\
  315. Select an option" 1 "1 2" || {
  316.                         cleanup $FAIL
  317.                 }
  318.                 case $result in
  319.                 1)      rmaddr $clash || {
  320.                                 echo "Failed to remove $clash device"
  321.                                 cleanup $FAIL
  322.                         }
  323.                         makedevs
  324.                         return $OK
  325.                         ;;
  326.                 2)      return $FAIL
  327.                         ;;
  328.                 esac
  329.         done
  330.         return $OK
  331. }
  332.  
  333. doramclash() {
  334.         driver=$1
  335.         addr1=$2
  336.         addr2=$3
  337.  
  338.         cd $confdir
  339.         clash=`../bin/idcheck -cr -l $addr1 -u $addr2 -i /tmp/dev$$`
  340.         cd $currdir
  341.  
  342.         [ "$clash" = "" -o "$clash" = "$driver" ] && return $FAIL
  343.         # found a clash
  344.         return $OK
  345. }
  346.  
  347. checkram() {
  348.         driver=$1
  349.         addr1=$2
  350.         addr2=$3
  351.         clash=
  352.  
  353.         currdir=`pwd`
  354.         confdir=/etc/conf/cf.d
  355.  
  356.         while doramclash $driver $addr1 $addr2
  357.         do
  358.                 prompt_yn "
  359. Ram addresses $addr1-$addr2 is already in use for the $clash device.
  360. You must choose a unique address for this device to work.
  361. Do you wish to choose another address now?" y || cleanup $FAIL
  362.                 if [ "$result" = "Y" ]
  363.                 then
  364.                         return $FAIL
  365.                 else
  366.                         cleanup $FAIL
  367.                 fi
  368.         done
  369.         return $OK
  370. }
  371.  
  372. # On unix, we must check the lines in mdevice file.
  373. # Sets the variable $clash to the driver code name if there is a driver that
  374. # has already been allocated the given channel. Uses awk.
  375. dodmaclash() {
  376.         driver=$1
  377.         chan=$2
  378.         clash=
  379.  
  380.         # -1 is never a clash
  381.         [ "$chan" = "-1" ] && return $FAIL
  382.  
  383.         cd $confdir
  384.         clash=`awk '{ if ( $1 != driver && $9 == dma ) print $1 }' dma=$chan driver=$driver mdevice`
  385.  
  386.         [ "$clash" = "" ] && {
  387.                 cd $currdir
  388.                 return $FAIL
  389.         }
  390.  
  391.         cd ../sdevice.d
  392.         cat $clash | awk '{ if ( $2 == "Y" ) exit 1 }' || return $OK
  393.  
  394.         if [ "$rel" = "3.2.0" -o "$rel" = "3.2.1" -o "$rel" = "3.2.2" ]
  395.         then
  396.                 prompt_yn "
  397. DMA channel ${chan} is already in use by the $clash device.
  398. However, the $clash device is not currently configured into the kernel.
  399. Do you wish to remove DMA channel ${chan} from the $clash device?" y || cleanup $FAIL
  400.                 if [ "$result" = "Y" ]
  401.                 then
  402.                         sed -e "s/Y/N/" $clash > /tmp/bog$$
  403.                         mv /tmp/bog$$ $clash
  404.                         cd $currdir
  405.                         return $FAIL
  406.                 else
  407.                         cd $currdir
  408.                         return $FAIL
  409.                 fi
  410.         fi
  411.  
  412.         # Should be release >3.2.2, clash driver not installed if we get here.
  413.         cd $currdir
  414.         return $FAIL
  415. }
  416.  
  417. #
  418. # Check if there is a clash of DMA channels
  419. #
  420. checkdma() {
  421.         driver=$1
  422.         channel=$2
  423.         clash=
  424.  
  425.         currdir=`pwd`
  426.         confdir=/etc/conf/cf.d
  427.  
  428.         while dodmaclash $driver $channel
  429.         do
  430.                 prompt_yn "
  431. DMA channel ${channel} is already in use by the $clash device.
  432. You must choose a unique channel for this device to work.
  433. Do you wish to choose another channel now?" y || cleanup $FAIL
  434.                 if [ "$result" = "Y" ]
  435.                 then
  436.                         return $FAIL
  437.                 else
  438.                         cleanup $FAIL
  439.                 fi
  440.         done
  441.         return $OK
  442. }
  443.  
  444. check_args() {
  445.         name=$1
  446.         bd=$2
  447.  
  448.         case $name in
  449.         e3A) echo "Configuring 3Com501 board $bd";
  450.                 PREFIX="e3c";
  451.                 MAX_BD=3;
  452.                 ;;
  453.         e3B) echo "Configuring 3Com503 board $bd";
  454.                 PREFIX="e503";
  455.                 MAX_BD=3;
  456.                 ;;
  457.         e3C) echo "Configuring 3Com523 board $bd";
  458.                 PREFIX="emc";
  459.                 MAX_BD=3;
  460.                 ;;
  461.         e3D) echo "Configuring 3Com507 board $bd";
  462.                 PREFIX="e3d";
  463.                 MAX_BD=3;
  464.                 ;;
  465.         wdn) echo "Configuring Western Digital 8003/8013 board $bd";
  466.                 PREFIX="wdn";
  467.                 MAX_BD=3;
  468.                 ;;
  469.         wdt) echo "Configuring WD8013 board $bd";
  470.                 PREFIX="wdt";
  471.                 MAX_BD=3;
  472.                 ;;
  473.         nat) echo "Configuring National Semiconductor NE2000 board $bd";
  474.                 PREFIX="nat";
  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 information for the System file for the 3C523
  612. #
  613. system_e3C() {
  614.         bd=$1
  615.  
  616.         case $bd in
  617.         0) IRQ=3; BIO=300; BRAM=c0000;;
  618.         1) IRQ=7; BIO=1300; BRAM=c8000;;
  619.         2) IRQ=9; BIO=2300; BRAM=d0000;;
  620.         3) IRQ=12; BIO=3300; BRAM=d8000;;
  621.         esac
  622.  
  623.         while :
  624.         do
  625.                 prompt_select "Enter IRQ" $IRQ "3 7 9 12" || cleanup $FAIL
  626.                 irq=$result
  627.                 checkvec $name$bd $irq && break
  628.         done
  629.         IRQ=$irq
  630.  
  631.         while :
  632.         do
  633.                 prompt_range "Enter I/O base address" $BIO "300" "3300" "1000" || cleanup $FAIL
  634.                 bio=$result
  635.                 EIO=`ha $bio 8`
  636.                 checkaddr $name$bd $bio $EIO && break
  637.         done
  638.         BIO=$bio
  639.  
  640.         while :
  641.         do
  642.                 prompt_range "Enter RAM base address" $BRAM "c0000" "d8000" "8000" || cleanup $FAIL
  643.                 bram=$result
  644.                 ERAM=`ha $bram 5fff`
  645.                 checkram $name$bd $bram $ERAM && break
  646.         done
  647.         BRAM=$bram
  648.  
  649.         NMINORS="1"
  650. }
  651.  
  652. #
  653. # function to produce the information for the System file for the 3C507
  654. # board
  655. #
  656. system_e3D() {
  657.         bd=$1
  658.  
  659.         case $bd in
  660.         0) IRQ=3; BIO=300; BRAM=c0000;;
  661.         1) IRQ=9; BIO=310; BRAM=d0000;;
  662.         2) IRQ=5; BIO=320; BRAM=c8000;;
  663.         3) IRQ=7; BIO=330; BRAM=d8000;;
  664.         esac
  665.  
  666.         while :
  667.         do
  668.                 prompt_select "Enter IRQ" $IRQ "3 5 7 9 10 11 12 15" || cleanup $FAIL
  669.                 irq=$result
  670.                 checkvec $name$bd $irq && break
  671.         done
  672.         IRQ=$irq
  673.  
  674.         while :
  675.         do
  676.                 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
  677.                 bio=$result
  678.                 EIO=`ha $bio f`
  679.                 checkaddr $name$bd $bio $EIO && break
  680.         done
  681.         BIO=$bio
  682.  
  683.         while :
  684.         do
  685.                 prompt_select "Enter RAM base address" $BRAM "c0000 c8000 d0000 d8000 f00000 f20000 f40000 f60000 f80000" || cleanup $FAIL
  686.                 bram=$result
  687.  
  688.                 case $bram in
  689.                 c[08]000|d0000) sizelist="16 32 48 64";;
  690.                 d8000)          sizelist="16 32";;
  691.                 *)              sizelist="64";;
  692.                 esac
  693.                 prompt_select "Enter RAM Size in k" 64 "$sizelist" || cleanup $FAIL
  694.                 case $result in
  695.                 16) size=3fff ;;
  696.                 32) size=7fff ;;
  697.                 48) size=bfff ;;
  698.                 64) size=ffff ;;
  699.                 esac
  700.                 ERAM=`ha $bram $size`
  701.                 checkram $name$bd $bram $ERAM && break
  702.         done
  703.         BRAM=$bram
  704.  
  705.         NMINORS="32"
  706. }
  707.  
  708. #
  709. # function to produce the information for the space.c file for the token ring
  710. #
  711. space_token() {
  712.  
  713.         # Set whether Netbeui is above us or not
  714.         nbe=0
  715.         [ "$name_above" = "nbe" ] && nbe=1
  716.  
  717.         currdir=`pwd`
  718.         cd /etc/conf/pack.d/tok0
  719.         sed -e "s/fine TOK$bd.*/fine TOK$bd     $nbe/" < space.c > /tmp/bog$$
  720.         cp /tmp/bog$$ space.c
  721.         rm -r /tmp/bog$$
  722.         cd $currdir
  723. }
  724.  
  725. #
  726. # function to restore and remove address conflicts in the sio driver
  727. #
  728. sio_conflict() {
  729.         if [ "$BIO" = "$OBIO" ]
  730.         then
  731.                 return $OK
  732.         fi
  733.  
  734.         currdir=`pwd`
  735.         cd /etc/conf/pack.d/sio
  736.         grep "/* LLI {.*$OBIO" space.c > /dev/null && {
  737.                 echo "Restoring serial cards using base address 0x$OBIO into link kit..."
  738.                 sed -e /"LLI.*$OBIO,/s/^\/\* LLI //" space.c >/tmp/bog$$
  739.                 mv /tmp/bog$$ space.c
  740.         }
  741.         grep "(sd)0x$BIO" space.c > /dev/null && {
  742.                 echo "Removing serial cards using base address 0x$BIO from link kit..."
  743.                 [ ! -f space.c.rls ] && cp space.c space.c.rls
  744.                 sed -e /"(sd)0x$BIO,/s/^{/\/* LLI {/p" space.c >/tmp/bog$$
  745.                 mv /tmp/bog$$ space.c
  746.         }
  747.         cd $currdir
  748. }
  749.  
  750. # restorevector check for sio (vecs 3-4) and pa drivers (vec 7)
  751. # if these are being released by lli then let us restore them to sio or pa
  752. restorevector() {
  753.         currdir=`pwd`
  754.         cd /etc/conf/cf.d
  755.  
  756.         intvector=$1
  757.         test="0"
  758.         [ "$intvector" = "3" -o "$intvector" = "4" ] && {
  759.                 prompt_yn "Restore vector $intvector to sio driver" y
  760.                 [ "$result" = "Y" ] && {
  761.                         echo "Restoring vector $intvector to sio driver"
  762.                         siomajor=`./configure -j sio`
  763.                         ./configure -m $siomajor -c -v $intvector -a -Y
  764.                         return $OK
  765.                 }
  766.         }
  767.         [ "$intvector" = "7" ] && {
  768.                 prompt_yn "Restore vector $intvector to pa driver" y
  769.                 [ "$result" = "Y" ] && {
  770.                         echo "Restoring vector $intvector to pa driver"
  771.                         pamajor=`./configure -j pa`
  772.                         ./configure -m $pamajor -c -v $intvector -a -Y
  773.                         return $OK
  774.                 }
  775.         }
  776.         return $OK
  777. }
  778.  
  779. #
  780. # determine release, and AT or MCA bus - set rel and type variables accordingly.
  781. #
  782. os_type() {
  783.         rel=`sed -n 's/^#rel=\(.*\).$/\1/p' /etc/perms/rts`
  784.         if [ "$rel" = "3.2.0" -o "$rel" = "3.2.1" -o "$rel" = "3.2.2" ]
  785.         then
  786.                 type=`sed -n 's/^#typ=\(.*\)$/\1/p' /etc/perms/inst`
  787.         else
  788.                 # 3.2.4 - one release supports AT, MCA, and EISA.
  789.                 uname -X | grep "BusType = MCA" >/dev/null 2>&1
  790.                 if [ $? -eq 0 ]
  791.                 then
  792.                         type=386MC
  793.                 else
  794.                         type=386GT
  795.                 fi
  796.         fi
  797. }
  798.  
  799. #
  800. # function to produce the information for the System file for the token ring
  801. #
  802. # BRAM/ERAM indicate ROM address switch settings; BSHRAM/ESHRAM indicate
  803. # shared memory settings.  We assume they're using 16K of SHRAM on the adapter.
  804. #
  805. system_tok() {
  806.         bd=$1
  807.  
  808.         case $bd in
  809.         0) IRQ=2; BIO=a20; BRAM=cc000; BSHRAM=d8000;;
  810.         1) IRQ=3; BIO=a24; BRAM=dc000; BSHRAM=d4000;;
  811.         esac
  812.  
  813.         while :
  814.         do
  815.                 prompt_select "Enter IRQ" $IRQ "2 3 6 7" || cleanup $FAIL
  816.                 irq=$result
  817.                 checkvec $name$bd $irq && break
  818.         done
  819.         IRQ=$irq
  820.  
  821.         EIO=`ha $BIO 3`
  822.  
  823.         while :
  824.         do
  825.                 prompt_range "Enter ROM base address" $BRAM "c0000" "de000" "2000" || cleanup $FAIL
  826.                 brom=$result
  827.                 ERAM=`ha $brom 1fff`
  828.                 checkram $name$bd $brom $ERAM && break
  829.         done
  830.         BRAM=$brom
  831.  
  832.         # Microchannel tok adapters have a configurable shared RAM address.
  833.         if [ "$type" = "386GT" ]
  834.         then
  835.                 ESHRAM=`ha $BSHRAM 3fff`
  836.                 doramclash $name$bd $BSHRAM $ESHRAM && {
  837.                         echo "The RAM addresses required for $name$bd are in use by the $clash device"
  838.                         echo "You must remove $clash before installing $name$bd"
  839.                         cleanup $FAIL
  840.                 }
  841.         else
  842.                 prompt_range "Enter RAM base address" $BSHRAM "c0000" "dc000" "4000" || cleanup $FAIL
  843.                 BSHRAM=$result
  844.                 ESHRAM=`ha $BSHRAM 3fff`
  845.                 doramclash $name$bd $BSHRAM $ESHRAM && {
  846.                         echo "The RAM addresses required for $name$bd are in use by the $clash device"
  847.                         echo "You must remove $clash before installing $name$bd"
  848.                         cleanup $FAIL
  849.                 }
  850.         fi
  851.  
  852.         if [ ! -x /usr/lib/token ]
  853.         then
  854.                 mkdir /usr/lib/token
  855.         fi
  856.  
  857.         prompt_yn "Restrict broadcasts to the local ring" "y" || cleanup $FAIL
  858.         if [ "$result" = "Y" ]
  859.         then
  860.                 touch /usr/lib/token/noroute$bd
  861.         else
  862.                 rm -f /usr/lib/token/noroute$bd
  863.         fi
  864.  
  865.         NMINORS="1"
  866.  
  867.         space_token
  868. }
  869.  
  870. #
  871. # function to produce the information for the System file for the Excelan
  872. #
  873. system_exos() {
  874.         bd=$1
  875.  
  876.         case $bd in
  877.         0) IRQ=2; BIO=310; BRAM=d0000;;
  878.         1) IRQ=3; BIO=300; BRAM=d4000;;
  879.         2) IRQ=5; BIO=320; BRAM=d8000;;
  880.         3) IRQ=7; BIO=330; BRAM=dc000;;
  881.         esac
  882.  
  883.         while :
  884.         do
  885.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5 6 7" || cleanup $FAIL
  886.                 irq=$result
  887.                 checkvec $name$bd $irq && break
  888.         done
  889.         IRQ=$irq
  890.  
  891.         while :
  892.         do
  893.                 prompt_range "Enter I/O base address" $BIO "300" "330" "10" || cleanup $FAIL
  894.                 bio=$result
  895.                 EIO=`ha $bio 7`
  896.                 checkaddr $name$bd $bio $EIO && break
  897.         done
  898.         BIO=$bio
  899.  
  900.         while :
  901.         do
  902.                 prompt_range "Enter RAM base address" $BRAM "a0000" "f0000" "4000" || cleanup $FAIL
  903.                 bram=$result
  904.                 ERAM=`ha $bram 3fff`
  905.                 checkram $name$bd $bram $ERAM && break
  906.         done
  907.         BRAM=$bram
  908.  
  909.         NMINORS="32"
  910. }
  911.  
  912. #
  913. # function to produce the info for the System file for the NE2000
  914. # boards
  915. #
  916. system_nat() {
  917.         bd=$1
  918.  
  919.         case $bd in
  920.         0) IRQ=3; BIO=300;;
  921.         1) IRQ=2; BIO=320;;
  922.         2) IRQ=5; BIO=340;;
  923.         3) IRQ=4; BIO=360;;
  924.         esac
  925.  
  926.         while :
  927.         do
  928.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5" || cleanup $FAIL
  929.                 irq=$result
  930.                 checkvec $name$bd $irq && break
  931.         done
  932.         IRQ=$irq
  933.  
  934.         while :
  935.         do
  936.                 prompt_select "Enter I/O base address" $BIO "300 320 340 360" || cleanup $FAIL
  937.                 bio=$result
  938.                 EIO=`ha $bio 0f`
  939.                 checkaddr $name$bd $bio $EIO && break
  940.         done
  941.         BIO=$bio
  942.  
  943.         NMINORS="1"
  944.  
  945. }
  946.  
  947. #
  948. # function to produce the info for the System file for the SONIC
  949. # boards
  950. #
  951. system_son() {
  952.         bd=$1
  953.  
  954.         case $bd in
  955.         0) IRQ=9;  BIO=2000;;
  956.         1) IRQ=10; BIO=3000;;
  957.         2) IRQ=11; BIO=4000;;
  958.         3) IRQ=15; BIO=5000;;
  959.         esac
  960.  
  961.         while :
  962.         do
  963.                 prompt_select "Enter IRQ" $IRQ "9 10 11 15" || cleanup $FAIL
  964.                 irq=$result
  965.                 checkvec $name$bd $irq && break
  966.         done
  967.         IRQ=$irq
  968.  
  969.         while :
  970.         do
  971.                 prompt_select "Enter I/O base address" $BIO "2000 3000 4000 5000" || cleanup $FAIL
  972.                 bio=$result
  973.                 EIO=`ha $bio 0f`
  974.                 checkaddr $name$bd $bio $EIO && break
  975.         done
  976.         BIO=$bio
  977.  
  978.         NMINORS="1"
  979.  
  980. }
  981.  
  982. #
  983. # 7ystem_d51e()
  984. #
  985. system_d51e() {
  986.         BIO=0
  987.         EIO=0
  988.         IRQ=0
  989.         NMINORS="1"
  990. }
  991.  
  992. #
  993. # function to produce the info for the System file for the DE-220
  994. # boards
  995. #
  996. system_d22e() {
  997.  
  998.         MediaType=0
  999.  
  1000.         echo ""
  1001.         echo "NOTE:"
  1002.         echo "  If the board of ETHER16 is a non-plug and play card,"
  1003.         echo "  please use setup program in DOS to change I/O base address,"
  1004.         echo "  and IRQ number if conflict."
  1005.         echo ""
  1006.         echo ""
  1007.         echo "Please choose the media mode that you want....................."
  1008.         echo ""
  1009.         echo "  0. Twisted pair connection."
  1010.         echo "  1. BNC connection."
  1011.         echo "  2. AUI connection."
  1012.         echo "  3. Automatic detection between TP BNC and AUI."
  1013.         echo "  4. Use EEPROM setting."
  1014.         echo ""
  1015.         prompt_select " Enter number of media mode selection" $MediaType "0 1 2 3 4" || cleanup $FAIL
  1016.         MediaType=$result
  1017.         echo ""
  1018.         case $MediaType in
  1019.         0) MediaTypeTXT="MEDIA_UTP";
  1020.            echo " Media mode : Twisted pair. ";
  1021.            ;;
  1022.         1) MediaTypeTXT="MEDIA_BNC";
  1023.            echo " Media mode : BNC.";
  1024.            ;;
  1025.         2) MediaTypeTXT="MEDIA_AUI";
  1026.            echo " Media mode : AUI.";
  1027.            ;;
  1028.         3) MediaTypeTXT="MEDIA_AUTO";
  1029.            echo " Media mode : Automatic detection between TP BNC and AUI.";
  1030.            ;;
  1031.         4) MediaTypeTXT="MEDIA_DEFAULT";
  1032.            echo " Media mode : Use EEPROM setting";
  1033.            ;;
  1034.         esac
  1035.  
  1036.         ed -s /etc/conf/pack.d/d22e0/space.c << TOAST > /dev/null
  1037. /#define ND22E_MediaType_$bd/
  1038. d
  1039. i
  1040. #define ND22E_MediaType_$bd     $MediaTypeTXT
  1041. .
  1042. w
  1043. q
  1044. TOAST
  1045.  
  1046.         BIO=0
  1047.         EIO=0
  1048.         IRQ=0
  1049.         NMINORS="1"
  1050.  
  1051. }
  1052.  
  1053. #
  1054. # function to produce the info for the System file for the WD1013
  1055. # boards
  1056. #
  1057. system_wdt() {
  1058.         bd=$1
  1059.  
  1060.         case $bd in
  1061.         0) IRQ=3; BIO=300; BRAM=c0000;;
  1062.         1) IRQ=4; BIO=320; BRAM=c8000;;
  1063.         2) IRQ=5; BIO=340; BRAM=d0000;;
  1064.         3) IRQ=9; BIO=360; BRAM=d8000;;
  1065.         esac
  1066.  
  1067.         while :
  1068.         do
  1069.                 prompt_select "Enter IRQ" $IRQ "3 4 5 7 9 10 11 15" || cleanup $FAIL
  1070.                 irq=$result
  1071.                 checkvec $name$bd $irq && break
  1072.         done
  1073.         IRQ=$irq
  1074.  
  1075.         while :
  1076.         do
  1077.                 prompt_range "Enter I/O base address" $BIO "200" "3e0" "20" || cleanup $FAIL
  1078.                 bio=$result
  1079.                 EIO=`ha $bio 1f`
  1080.                 checkaddr $name$bd $bio $EIO && break
  1081.         done
  1082.         BIO=$bio
  1083.  
  1084.         while :
  1085.         do
  1086.                 prompt_range "Enter RAM base address" $BRAM "80000" "f0c000" "2000" || cleanup $FAIL
  1087.                 bram=$result
  1088.                 ERAM=`ha $bram 3fff`
  1089.                 checkram $name$bd $bram $ERAM && break
  1090.         done
  1091.         BRAM=$bram
  1092.  
  1093.         NMINORS="1"
  1094.  
  1095. }
  1096.  
  1097. #
  1098. # function to produce the information for the System file for the western
  1099. # digital board
  1100. #
  1101. system_wdn() {
  1102.         bd=$1
  1103.  
  1104.         case $bd in
  1105.         0) IRQ=3; BIO=240; BRAM=d0000;;
  1106.         1) IRQ=2; BIO=380; BRAM=d2000;;
  1107.         2) IRQ=5; BIO=260; BRAM=d4000;;
  1108.         3) IRQ=7; BIO=340; BRAM=d6000;;
  1109.         esac
  1110.  
  1111.         if [ "$type" = "386MC" ]
  1112.         then
  1113.                 prompt_yn "\nAre you reconfiguring an Elite series (WD8013EP/A, WD8013WP/A, or\nWD8013EW/A) Western Digital card?" "n" || cleanup $FAIL
  1114.                 if [ "$result" = "Y" ]
  1115.                 then
  1116.                         elite="Y"
  1117.                         case $bd in
  1118.                         0) IRQ=3; BIO=800; BRAM=d0000;;
  1119.                         1) IRQ=4; BIO=1800; BRAM=d2000;;
  1120.                         2) IRQ=10; BIO=2800; BRAM=d4000;;
  1121.                         3) IRQ=15; BIO=3800; BRAM=d6000;;
  1122.                         esac
  1123.                 fi
  1124.         fi
  1125.  
  1126.         while :
  1127.         do
  1128.                 if [ "$type" = "386MC" -a "$elite" = "Y" ]
  1129.                 then
  1130.                         # WD8013EP/A allows IRQ 14, WD8013WP/A allows IRQ 15
  1131.                         prompt_select "Enter IRQ" $IRQ "3 4 10 14 15" || cleanup $FAIL
  1132.                 else
  1133.                         prompt_select "Enter IRQ" $IRQ "2 3 4 5 7 10 11 15" || cleanup $FAIL
  1134.                 fi
  1135.                 irq=$result
  1136.                 checkvec $name$bd $irq && break
  1137.         done
  1138.         IRQ=$irq
  1139.  
  1140.         while :
  1141.         do
  1142.                 if [ "$type" = "386MC" -a "$elite" = "Y" ]
  1143.                 then
  1144.                         prompt_range "Enter I/O base address" $BIO "800" "f800" "1000" || cleanup $FAIL
  1145.                 else
  1146.                         prompt_range "Enter I/O base address" $BIO "200" "3e0" "20" || cleanup $FAIL
  1147.                 fi
  1148.                 bio=$result
  1149.                 EIO=`ha $bio 1f`
  1150.                 checkaddr $name$bd $bio $EIO && break
  1151.         done
  1152.         BIO=$bio
  1153.  
  1154.         while :
  1155.         do
  1156.                 if [ "$type" = "386MC" -a "$elite" = "Y" ]
  1157.                 then
  1158.                         prompt_range "Enter RAM base address" $BRAM "c0000" "fde000" "2000" || cleanup $FAIL
  1159.                 else
  1160.                         prompt_range "Enter RAM base address" $BRAM "80000" "f0c000" "2000" || cleanup $FAIL
  1161.                 fi
  1162.                 bram=$result
  1163.                 if [ "$type" = "386GT" -o "$elite" = "Y" ]
  1164.                 then
  1165.                         prompt_select "Enter RAM Size in k" 8 "8 16" || cleanup $FAIL
  1166.                         case $result in
  1167.                                 8)  size=1fff ;;
  1168.                                 16) size=3fff ;;
  1169.                         esac
  1170.                 else
  1171.                         size=3fff
  1172.                 fi
  1173.                 ERAM=`ha $bram $size`
  1174.                 checkram $name$bd $bram $ERAM || continue
  1175.                 hc $bram 100000 f0c000 2000 > /dev/null 2>& 1 && {
  1176.                         echo "Warning: this address may not be valid if your network adapter"
  1177.                         echo "is not a Western Digital 16-Bit Elite adapter"
  1178.                         echo "Shared memory addresses above 1 Meg are supported by 16-bit Elite adapters only."
  1179.                 }
  1180.                 break
  1181.         done
  1182.         BRAM=$bram
  1183.  
  1184.         NMINORS="32"
  1185.  
  1186.         [ "$rel" = "3.2.1" -o "$rel" = "3.2.0" ] && {
  1187.                 if [ "$type" = "386GT" ]
  1188.                 then
  1189.                         grep "int arch =" /etc/conf/pack.d/wdn0/space.c >/dev/null 2>&1 || {
  1190.                         echo "int arch = 1;" >> /etc/conf/pack.d/wdn0/space.c
  1191.                         }
  1192.                 elif [ "$type" = "386MC" ]
  1193.                 then
  1194.                         grep "int arch =" /etc/conf/pack.d/wdn0/space.c >/dev/null 2>&1 || {
  1195.                         echo "int arch = 2;" >> /etc/conf/pack.d/wdn0/space.c
  1196.                         }
  1197.                 fi
  1198.         }
  1199. }
  1200.  
  1201.  
  1202. #
  1203. # function to produce info for the System file for HP EISA Slave LAN adapters
  1204. #
  1205. system_hpe() {
  1206.         bd=$1
  1207.  
  1208.         case ${bd} in
  1209.         0) IRQ=5 ; DMA=3;;
  1210.         1) IRQ=7 ; DMA=2;;
  1211.         2) IRQ=10; DMA=6;;
  1212.         3) IRQ=11; DMA=5;;
  1213.         esac
  1214.  
  1215.         while :
  1216.         do
  1217.                 prompt_select "Enter DMA channel" $DMA "1 2 3 5 6" || cleanup $FAIL
  1218.                 dma=$result
  1219.                 checkdma $name$bd $dma && break
  1220.         done
  1221.         DMACHAN=$dma
  1222.  
  1223.         while :
  1224.         do
  1225.                 prompt_select "Enter IRQ" $IRQ "3 4 5 7 10 11 12" || cleanup $FAIL
  1226.                 irq=$result
  1227.                 checkvec $name$bd $irq && break
  1228.         done
  1229.         IRQ=$irq
  1230.  
  1231.         while :
  1232.         do
  1233.                 prompt_select "Enter slot number" "" "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" || cleanup $FAIL
  1234.                 SLOT=$result
  1235.                 case $result in
  1236.                  0) bio=0C00; EIO=0CFF;;
  1237.                  1) bio=1C00; EIO=1CFF;;
  1238.                  2) bio=2C00; EIO=2CFF;;
  1239.                  3) bio=3C00; EIO=3CFF;;
  1240.                  4) bio=4C00; EIO=4CFF;;
  1241.                  5) bio=5C00; EIO=5CFF;;
  1242.                  6) bio=6C00; EIO=6CFF;;
  1243.                  7) bio=7C00; EIO=7CFF;;
  1244.                  8) bio=8C00; EIO=8CFF;;
  1245.                  9) bio=9C00; EIO=9CFF;;
  1246.                 10) bio=AC00; EIO=ACFF;;
  1247.                 11) bio=BC00; EIO=BCFF;;
  1248.                 12) bio=CC00; EIO=CCFF;;
  1249.                 13) bio=DC00; EIO=DCFF;;
  1250.                 14) bio=EC00; EIO=ECFF;;
  1251.                 15) bio=FC00; EIO=DCFF;;
  1252.                 *) cleanup $FAIL
  1253.                 esac
  1254.                 checkaddr $name$bd $bio $EIO && break
  1255.         done
  1256.         BIO=$bio
  1257.  
  1258. BRAM="0"
  1259. ERAM="0"
  1260. NMINORS="1"
  1261. }
  1262.  
  1263. #
  1264. # function to produce the info for the System file for the HP ISA LAN adapters
  1265. #
  1266. system_hpi() {
  1267.         bd=$1
  1268.  
  1269.         case ${bd} in
  1270.         0) IRQ=2  ; BIO=300;;
  1271.         1) IRQ=3  ; BIO=240;;
  1272.         2) IRQ=5  ; BIO=280;;
  1273.         3) IRQ=7  ; BIO=2C0;;
  1274.         esac
  1275.  
  1276.         while :
  1277.         do
  1278.                 echo "IRQs 10 and 11 are only valid for 16-bit adapters."
  1279.                 prompt_select "Enter IRQ" $IRQ "2 3 4 5 7 10 11" || cleanup $FAIL
  1280.                 irq=$result
  1281.                 checkvec $name$bd $irq && break
  1282.         done
  1283.         IRQ=$irq
  1284.         while :
  1285.         do
  1286.                 prompt_select "Enter I/O base address" $BIO "200 240 280 2C0 300 320 340" || cleanup $FAIL
  1287.                 bio=$result
  1288.                 case $result in
  1289.                 200) EIO=21F ;;
  1290.                 240) EIO=25F ;;
  1291.                 280) EIO=29F ;;
  1292.                 2C0) EIO=2DF ;;
  1293.                 300) EIO=31F ;;
  1294.                 320) EIO=33F ;;
  1295.                 340) EIO=35F ;;
  1296.                 *) cleanup $FAIL
  1297.                 esac
  1298.                 checkaddr $name$bd $bio $EIO && break
  1299.         done
  1300.         BIO=$bio
  1301.         BRAM="0"
  1302.         ERAM="0"
  1303.         NMINORS="1"
  1304. }
  1305.  
  1306. #
  1307. # Edits the major number into the space.c file for Racal InterLan drivers
  1308. #
  1309. space_inn() {
  1310.  
  1311.         spacef=${CONF:-/etc/conf}/pack.d/${drv}0/space.c
  1312.         currdir=`pwd`
  1313.         cd $CONF/cf.d
  1314.         maj=`./configure -j $base`
  1315.         if [ $? -ne 0 -o "$maj" = "" ]
  1316.         then
  1317.                 maj=`./configure -j NEXTMAJOR`
  1318.         fi
  1319.         cd $currdir
  1320.  
  1321.         if [ "$bd" -eq 0 ]
  1322.         then
  1323.                 str="${ucbase}_MAJEDT"
  1324.         else
  1325.                 str="${ucbase}${bd}_MAJEDT"
  1326.         fi
  1327.         sed "s/$str/$maj/" $spacef >/tmp/bog$$
  1328.         cp /tmp/bog$$ $spacef
  1329.         rm -f /tmp/bog$$
  1330. }
  1331.  
  1332. #
  1333. # function to produce the information for the System file for the Racal InterLan
  1334. # ES-3210 board.
  1335. #
  1336. system_i3B() {
  1337.         ucbase="I3B"
  1338.         bd=$1
  1339.         spacef=${CONF:-/etc/conf}/pack.d/${drv}0/space.c
  1340.  
  1341.         case $bd in
  1342.         0) IRQ=9; BIO=1; BRAM=d0000; DMA=NONE;;
  1343.         1) IRQ=10; BIO=2; BRAM=d4000; DMA=NONE;;
  1344.         2) IRQ=11; BIO=4; BRAM=d8000; DMA=NONE;;
  1345.         3) IRQ=12; BIO=5; BRAM=dc000; DMA=NONE;;
  1346.         esac
  1347.  
  1348.         while :
  1349.         do
  1350.                 prompt_select "Enter IRQ" $IRQ "3 4 5 6 7 9 10 11 12 14 15" || cleanup $FAIL
  1351.                 irq=$result
  1352.                 checkvec $name$bd $irq && break
  1353.         done
  1354.         IRQ=$irq
  1355.  
  1356.         while :
  1357.         do
  1358.                 prompt_range "Enter slot number" $BIO "1" "15" "1" || cleanup $FAIL
  1359.                 bio=`expr $result * 1000`
  1360.                 EIO=`ha $bio fff`
  1361.                 checkaddr $name$bd $bio $EIO && break
  1362.         done
  1363.         BIO=$bio
  1364.  
  1365.         while :
  1366.         do
  1367.                 prompt_range "Enter RAM base address" $BRAM "c0000" "3fffc000" "4000" || cleanup $FAIL
  1368.                 bram=$result
  1369.                 ERAM=`ha $bram 3fff`
  1370.                 checkram $name$bd $bram $ERAM || continue
  1371.                 break
  1372.         done
  1373.         BRAM=$bram
  1374.  
  1375.         while :
  1376.         do
  1377.                 prompt_select "Enter DMA" $DMA "NONE 0 1 2 3 5 6 7" || cleanup $FAIL
  1378.                 if [ "$result" = "NONE" ]
  1379.                 then
  1380.                         dma=-1
  1381.                 else
  1382.                         dma=$result
  1383.                 fi
  1384.                 checkdma $name$bd $dma && break
  1385.         done
  1386.         DMACHAN=$dma
  1387. #
  1388. # Setup space.c.
  1389. # Get the media type (thick or thin) and edit it into space.c
  1390. #
  1391.         prompt_yn "Does this ES-3210 board use thick (AUI) ethernet?" "n" || cleanup $FAIL
  1392.         if [ "$result" = "Y" ]
  1393.         then
  1394.                 netyp="THIK"
  1395.         else
  1396.                 netyp="THIN"
  1397.         fi
  1398.         if [ $bd -eq 0 ]
  1399.         then
  1400.                 str="THIKTHIN"
  1401.         else
  1402.                 str="THIKTHIN${bd}"
  1403.         fi
  1404.         a=`grep -n "^#define[   ]${str}[        ]" $spacef`
  1405.         b=`expr "$a" : '.*G1_\(....\)'`
  1406.         if [ "$b" != "$netyp" ]
  1407.         then
  1408.                 c=`expr "$a" : '\(.*:\)' | sed 's/://'`
  1409.                 sed "${c}s/G1_$b/G1_$netyp/" $spacef >/tmp/bog$$
  1410.                 cp /tmp/bog$$ $spacef
  1411.                 rm /tmp/bog$$
  1412.         fi
  1413.         space_inn               # Edit major number it into space.c
  1414.         NMINORS="1"
  1415. }
  1416.  
  1417. #
  1418. # function to produce the information for the System file for the Racal InterLan
  1419. # NI-6510 board.
  1420. #
  1421. system_i6E() {
  1422.         ucbase="I6E"
  1423.         bd=$1
  1424.         spacef=${CONF:-/etc/conf}/pack.d/${drv}0/space.c
  1425.         BRAM=0
  1426.  
  1427.         case $bd in
  1428.         0) IRQ=9; BIO=360; DMA=3;;
  1429.         1) IRQ=12; BIO=340; DMA=5;;
  1430.         esac
  1431.  
  1432.         while :
  1433.         do
  1434.                 prompt_select "Enter IRQ" $IRQ "5 9 12 15" || cleanup $FAIL
  1435.                 irq=$result
  1436.                 checkvec $name$bd $irq && break
  1437.         done
  1438.         IRQ=$irq
  1439.  
  1440.         while :
  1441.         do
  1442.                 prompt_range "Enter I/O base address" $BIO "300" "360" "20" || cleanup $FAIL
  1443.                 bio=$result
  1444.                 EIO=`ha $bio f`
  1445.                 checkaddr $name$bd $bio $EIO && break
  1446.         done
  1447.         BIO=$bio
  1448.  
  1449.         while :
  1450.         do
  1451.                 prompt_select "Enter DMA" $DMA "0 3 5 6" || cleanup $FAIL
  1452.                 dma=$result
  1453.                 checkdma $name$bd $dma && break
  1454.         done
  1455.         DMACHAN=$dma
  1456.         space_inn               # Edit major number it into space.c
  1457.         NMINORS="1"
  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. if [ $# -gt 1 ]
  1469. then
  1470.         name_below=$1; if_below=$2
  1471.         name_above=$3; if_above=$4
  1472.         configure=$5
  1473. fi
  1474.  
  1475. base=`basename $0`
  1476. drv=`echo $base | sed -e 's/[0-9]*$//`
  1477. bd=`expr $base : '.*\(.\)'`
  1478.  
  1479. makedevs $OK
  1480. check_args $drv $bd
  1481.  
  1482. #
  1483. # verify the driver is in the kernel link-kit
  1484. #
  1485. idcheck -p $base -i /tmp/dev$$
  1486. if [ $? -le 16 ]
  1487. then
  1488.         echo "Error: $base driver is not installed"
  1489.         cleanup $FAIL
  1490. fi
  1491.  
  1492. echo "Reconfiguring the $drv driver"
  1493. cd /usr/lib/lli/$drv
  1494. makedevs
  1495.  
  1496. #
  1497. # create the temporary directory for installing the driver
  1498. #
  1499. cd /tmp; rm -rf $base
  1500. mkdir $base; cd $base
  1501.  
  1502. DMACHAN="-1"
  1503.  
  1504. #
  1505. # set rel, type variables.
  1506. #
  1507. os_type
  1508.  
  1509. # get the interrupt vector & Base I/O address for the board that we are removing
  1510. currdir=`pwd`
  1511. cd /etc/conf/sdevice.d
  1512. ivec=`awk '{ if ( $1 != "*" ) print $6 }' < $base`
  1513. OBIO=`awk '{ if ( $1 != "*" ) print $7 }' < $base`
  1514. cd $currdir
  1515.  
  1516. #
  1517. # Do special board dependent processing
  1518. #
  1519. system_$drv $bd
  1520.  
  1521. echo
  1522. if [ "$IRQ" = "2" ]
  1523. then
  1524.         IRQ=9
  1525. fi
  1526.  
  1527. echo "$base\tY\t$NMINORS\t0\t0\t$IRQ\t$BIO\t$EIO\t$BRAM\t$ERAM" >./System
  1528.  
  1529. #
  1530. # All the drivers support more than one board.  In fact all the code to
  1531. # support all the boards is in the Driver.o for the board for the 1st board
  1532. # (eg the e3A0 driver acually contains enough code for the e3A1, e3A2 & e3A3
  1533. # boards).  As we need a Driver.o to be associated with 2nd, 3rd or 4th board
  1534. # we install a dummy Driver.o, and a Master and Node which will actually cause
  1535. # calls into the base driver.
  1536. #
  1537. if [ $bd -gt 0 ]
  1538. then
  1539.         echo "$base     -       iScH    $PREFIX$bd      0       0       1       256     $DMACHAN" >./Master
  1540.         echo "clone     $base   c       $base" >./Node
  1541.  
  1542.         idinstall -u -m -s -n -e -k $base
  1543. else
  1544.         echo "$base     I       iScH    $PREFIX 0       0       1       256     $DMACHAN" >./Master
  1545.         idinstall -u -m -s -e -k $base
  1546. fi
  1547.  
  1548. # delete any potential BASE I/O address conflicts with the sio driver
  1549. [ "$rel" = "3.2.0" -o "$rel" = "3.2.1" -o "$rel" = "3.2.2" ] && sio_conflict
  1550.  
  1551. if [ "$ivec" = "3" -o "$ivec" = "4" -o "$ivec" = "7" ]
  1552. then
  1553.         [ ${ivec} != ${IRQ} ] && restorevector $ivec
  1554. fi
  1555.  
  1556. cleanup $RELINK
  1557.