The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/atm/hea/eni_init.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  *
    3  * ===================================
    4  * HARP  |  Host ATM Research Platform
    5  * ===================================
    6  *
    7  *
    8  * This Host ATM Research Platform ("HARP") file (the "Software") is
    9  * made available by Network Computing Services, Inc. ("NetworkCS")
   10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
   11  * support of any kind.
   12  *
   13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
   14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
   15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
   16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
   17  * In no event shall NetworkCS be responsible for any damages, including
   18  * but not limited to consequential damages, arising from or relating to
   19  * any use of the Software or related support.
   20  *
   21  * Copyright 1994-1998 Network Computing Services, Inc.
   22  *
   23  * Copies of this Software may be made, however, the above copyright
   24  * notice must be reproduced on all copies.
   25  *
   26  *      @(#) $FreeBSD: src/sys/dev/hea/eni_init.c,v 1.3 1999/08/28 00:41:44 peter Exp $
   27  */
   28 
   29 /*
   30  * Efficient ENI Adapter Support
   31  * -----------------------------
   32  *
   33  * Driver initialization support
   34  *
   35  */
   36 
   37 #include <netproto/atm/kern_include.h>
   38 
   39 #include "eni_stats.h"
   40 #include "eni.h"
   41 #include "eni_var.h"
   42 
   43 /*
   44  * Initialize adapter for PDU processing
   45  *
   46  * Enable interrupts, set master control, initialize TX buffer,
   47  * set initial pointers, etc.
   48  *
   49  * Arguments:
   50  *      eup             pointer to device unit structure
   51  *
   52  * Returns:
   53  *      0               successful
   54  *      error           error condition
   55  */
   56 int
   57 eni_init(Eni_unit *eup)
   58 {
   59         u_long  words, order;
   60 
   61         /*
   62          * Allocate one large TX buffer. Currently we use only one
   63          * channel with full cell rate which all VCs will use.
   64          * This will (probably) have to change (alot) when we
   65          * implement QoS.
   66          */
   67         /*
   68          * Server cards, which have more then 512KB of RAM, will
   69          * allocate a 128KB TX buffer, while client cards, with
   70          * 512KB or less will allocate a 32KB TX buffer.
   71          */
   72         words = ( eup->eu_ramsize > MAX_CLIENT_RAM * ENI_BUF_PGSZ ?
   73                 TX_LARGE_BSIZE : TX_SMALL_BSIZE ) * ENI_BUF_PGSZ;
   74         if ( ( eup->eu_txbuf = eni_allocate_buffer ( eup, &words ) ) ==
   75             NULL ) {
   76                 return ENOMEM;
   77         } 
   78         eup->eu_txsize = words >> 2;            /* Bytes to words */
   79         words >>= ENI_LOC_PREDIV;               /* Predivide by 256 words */
   80         for ( order = -1; words; order++ )
   81                 words >>= 1;
   82         eup->eu_midway[MIDWAY_TXPLACE] =
   83             (order << TXSIZE_SHIFT) | ((int)eup->eu_txbuf >> ENI_LOC_PREDIV);
   84         eup->eu_txpos = eup->eu_midway[MIDWAY_DESCR] & 0x7FFF;
   85         /*
   86          * Set first word of unack'ed data to start
   87          */
   88         eup->eu_txfirst = eup->eu_txpos;
   89         
   90         /*
   91          * Set initial values of local DMA pointer used to prevent wraps
   92          */
   93         eup->eu_txdmawr = 0;
   94         eup->eu_rxdmawr = 0;
   95 
   96         /*
   97          * Initialize queue's for receive/transmit pdus
   98          */
   99         eup->eu_txqueue.ifq_maxlen = ENI_IFQ_MAXLEN;
  100         eup->eu_rxqueue.ifq_maxlen = ENI_IFQ_MAXLEN;
  101 
  102         /*
  103          * Acknowledge any interrupts
  104          */
  105         (void) eup->eu_midway[MIDWAY_ISA];
  106 
  107         /*
  108          * "Zero" Sonet error counters
  109          */
  110         eni_zero_stats ( eup );
  111 
  112         /*
  113          * Set master control register
  114          *
  115          * IntSel1 | LOCK_MODE | DMA_ENABLE | TX_ENABLE | RX_ENABLE
  116          *
  117          */
  118         eup->eu_midway[MIDWAY_MASTER] = 1 << ENI_ISEL_SHIFT |
  119             ENI_M_DMAENABLE | ENI_M_TXENABLE | ENI_M_RXENABLE;
  120 
  121         /*
  122          * Enable interrupts
  123          */
  124         eup->eu_midway[MIDWAY_IE] = ENI_INT_SERVICE | ENI_INT_RX_DMA |
  125                 ENI_INT_TX_DMA | ENI_INT_DMA_ERR | ENI_INT_DMA_LERR |
  126                         ENI_INT_IDEN | ENI_INT_DMA_OVFL;
  127 
  128         /*
  129          * Last thing to do is to indicate that we've finished initializing
  130          * this unit.
  131          */
  132         eup->eu_flags |= CUF_INITED;
  133 
  134         return 0;
  135 }
  136 

Cache object: b1cf1996e1918c90be21153cf77ed43a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.