home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nics / root.2 / etc / inst / nd / mdi / eeE / Space.c / Space.c
Encoding:
C/C++ Source or Header  |  1998-08-19  |  5.6 KB  |  175 lines

  1. #ident "@(#)Space.c    26.1"
  2. /*
  3.  * space.c
  4.  * (c) 1994-1997, Intel.
  5.  *
  6.  */
  7. #include <sys/types.h>
  8. #include <sys/stream.h>
  9. #include <net/if.h>
  10. #include <config.h>
  11. #include <sys/dlpi_ether.h>
  12.  
  13. char *eeE_oem_copyright="(c) 1997, Intel Corporation. All Rights Reserved";
  14.  
  15. /*
  16.  *  The N_SAPS define determines how many protocol drivers can bind to a single
  17.  *  EEE  board.  A TCP/IP environment requires a minimum of two (IP and ARP).
  18.  *  Putting an excessively large value here would waste memory.  A value that
  19.  *  is too small could prevent a system from supporting a desired protocol.
  20.  */
  21. #define    N_SAPS        8
  22.  
  23. /*
  24.  *  The STREAMS_LOG define determines if STREAMS tracing will be done in the
  25.  *  driver.  A non-zero value will allow the strace(1M) command to follow
  26.  *  activity in the driver.  The driver ID used in the strace(1M) command is
  27.  *  equal to the ENET_ID value (generally 2101).
  28.  *
  29.  *  NOTE:  STREAMS tracing can greatly reduce the performance of the driver
  30.  *         and should only be used for trouble shooting.
  31.  */
  32. #define    STREAMS_LOG    0
  33.  
  34. /*
  35.  *  The IFNAME define determines the name of the the internet statistics
  36.  *  structure for this driver and only has meaning if the inet package is
  37.  *  installed.  It should match the interface prefix specified in the strcf(4)
  38.  *  file and ifconfig(1M) command used in rc.inet.  The unit number of the
  39.  *  interface will match the board number (i.e eeE0, eeE1, eeE2) and is not
  40.  *  defined here.
  41.  */
  42. #define    IFNAME    "eeE"
  43.  
  44. /*
  45.  * Configure the PCI Configuration Type
  46.  *
  47.  */
  48. #define PCI_CONF_T1    1
  49. #define PCI_CONF_T2    2
  50. #define PCI_CONF_AUTO    0
  51.  
  52. #define PCI_CONF_TYPE    PCI_CONF_AUTO
  53.  
  54. /*
  55.  *  Configure parameters for buffers per controller.
  56.  *  If the machine this is being used on is a faster machine (i.e. > 150MHz)
  57.  *  and running on a 10MBS network then more queueing of data occurs. This
  58.  *  may indicate the some of the numbers below should be adjusted.  Here are
  59.  *  some typical numbers:
  60.  *                             MAX_TCB 100
  61.  *                             MAX_TBD_PER_TCB 12
  62.  *                             MAX_RFD 100
  63.  *                             MAX_PRCOUNT 20
  64.  *  The default numbers give work well on most systems tests so no real
  65.  *  adjustments really need to take place.  Also, if the machine is connected
  66.  *  to a 100MBS network the numbers described above can be lowered from the
  67.  *  defaults as considerably less data will be queued.
  68.  */                                                   
  69.  
  70. #define MAX_TCB        60    /* number of transmit control blocks */
  71. #define MAX_TBD_PER_TCB    10
  72. #define MAX_TBD        (MAX_TCB*MAX_TBD_PER_TCB)
  73. #define MAX_RFD        60
  74. #define EEE_CNTLS    4       /* number of receive control blocks */
  75. #define EEE_MAJORS      1
  76. #define TX_CONG_DFLT    0       /* congestion enable flag for National TX Phy */
  77. #define TX_FIFO_LMT    0
  78. #define RX_FIFO_LMT    8
  79. #define TX_DMA_CNT     0
  80. #define RX_DMA_CNT     0
  81. #define TX_UR_RETRY    1
  82. #define TX_THRSHLD    8
  83. #define MAX_PRCOUNT    15      /* number of frames to process per interrupt */
  84.  
  85. /* These are special #defs NOT TO TOUCHED */
  86. #define DEFAULT_TX_FIFO_LIMIT       0x00
  87. #define DEFAULT_RX_FIFO_LIMIT       0x08
  88. #define CB_557_CFIG_DEFAULT_PARM4   0x00
  89. #define CB_557_CFIG_DEFAULT_PARM5   0x00
  90. #define DEFAULT_TRANSMIT_THRESHOLD      12      /* 12 -> 96 bytes */
  91. #define ADAPTIVE_IFS                0
  92. /*end of specials */
  93.  
  94. /********************** STOP!  DON'T TOUCH THAT DIAL ************************
  95.  *
  96.  *  The following values are set by the kernel build utilities and should not
  97.  *  be modified by mere motals.
  98.  */
  99. int        eeEboards;
  100. int        eeEstrlog = STREAMS_LOG;
  101. int          eeE_max_saps=N_SAPS;
  102. char        *eeE_ifname = IFNAME;
  103. int        eeE_pci_type=PCI_CONF_TYPE;
  104. int      eeE_adaptive_ifs=ADAPTIVE_IFS;
  105.  
  106. uchar_t        eeE_rx_fifo_lmt= ( RX_FIFO_LMT < 0 )?  DEFAULT_RX_FIFO_LIMIT :
  107. ((RX_FIFO_LMT > 15 )? DEFAULT_RX_FIFO_LIMIT : 
  108. RX_FIFO_LMT );
  109.  
  110. uchar_t        eeE_tx_fifo_lmt= ( TX_FIFO_LMT < 0 )?  DEFAULT_TX_FIFO_LIMIT :
  111. ((TX_FIFO_LMT > 7 )?  DEFAULT_TX_FIFO_LIMIT : 
  112. TX_FIFO_LMT );
  113.  
  114. uchar_t        eeE_rx_dma_cnt= ( RX_DMA_CNT < 0 )? CB_557_CFIG_DEFAULT_PARM4 :
  115. ((RX_DMA_CNT  > 63 )? 
  116. CB_557_CFIG_DEFAULT_PARM4 : RX_DMA_CNT );
  117.  
  118. uchar_t        eeE_tx_dma_cnt= ( TX_DMA_CNT < 0 )? CB_557_CFIG_DEFAULT_PARM5 :
  119. ((TX_DMA_CNT  > 63 )? 
  120. CB_557_CFIG_DEFAULT_PARM5 : TX_DMA_CNT );
  121.  
  122. uchar_t        eeE_urun_retry= ( TX_UR_RETRY < 0 )? CB_557_CFIG_DEFAULT_PARM5:
  123. ((TX_UR_RETRY  > 3 )?  
  124. CB_557_CFIG_DEFAULT_PARM5 : TX_UR_RETRY );
  125.  
  126. uchar_t        eeE_tx_thld= ( TX_THRSHLD < 0 )? DEFAULT_TRANSMIT_THRESHOLD :
  127. ((TX_THRSHLD > 200 )? DEFAULT_TRANSMIT_THRESHOLD :
  128. TX_THRSHLD );
  129.  
  130. /* maximum # of receive buffs processed in each call to eeE ISR */
  131. int            eeE_max_prcount= ( MAX_PRCOUNT  < 1 )?   3 :
  132. ((MAX_PRCOUNT  > MAX_RFD )? 3 : MAX_PRCOUNT );
  133.  
  134. struct ifstats    eeEifstats[ EEE_CNTLS ];
  135. major_t     eeE_majors[ EEE_MAJORS ] =
  136. {
  137.     EEE_CMAJOR_0,        /* Major number            */
  138. };
  139.  
  140. /* The Transmit Area */
  141. uint_t        eeE_max_tcb     = MAX_TCB;
  142. uint_t        eeE_max_tbd     = MAX_TBD;
  143. uint_t        eeE_tbd_per_tcb = MAX_TBD_PER_TCB;
  144.  
  145. /* The Receive Area */
  146. uint_t        eeE_max_rfd = MAX_RFD;
  147.  
  148. /* Congestion enable flag for National Phy */
  149. uint_t eeE_cong_enbl = TX_CONG_DFLT;
  150.  
  151. #ifdef IP
  152. int    eeEinetstats = 1;
  153. #else
  154. int    eeEinetstats = 0;
  155. #endif
  156.  
  157.  
  158. /*
  159.  * Set the line speed and duplex mode of the controller.
  160.  *  0 indicates autodetection for both speed and duplex mode
  161.  *  1 indicates a speed of 10MBS and a duplex mode of half
  162.  *  2 indicates a speed of 10MBS and a duplex mode of full
  163.  *  3 indicates a speed of 100MBS and a duplex mode of half
  164.  *  4 indicates a speed of 100MBS and a duplex mode of full
  165.  */
  166. int eeE_speed_duplex = 0;         
  167.  
  168. /* 
  169.  * Auto-polarity enable/disable
  170.  * eeE_autopolarity = 0 => disable auto-polarity
  171.  * eeE_autopolarity = 1 => enable auto-polarity
  172.  * eeE_autopolarity = 2 => let software determine
  173.  */
  174. int eeE_autopolarity = 2;
  175.