3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
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.
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.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
31 * Efficient ENI Adapter Support
32 * -----------------------------
34 * Driver initialization support
38 #include <sys/param.h>
39 #include <sys/socket.h>
41 #include <netatm/port.h>
42 #include <netatm/queue.h>
43 #include <netatm/atm.h>
44 #include <netatm/atm_sys.h>
45 #include <netatm/atm_cm.h>
46 #include <netatm/atm_if.h>
48 #include <dev/hea/eni_stats.h>
49 #include <dev/hea/eni.h>
50 #include <dev/hea/eni_var.h>
53 __RCSID("@(#) $FreeBSD$");
57 * Initialize adapter for PDU processing
59 * Enable interrupts, set master control, initialize TX buffer,
60 * set initial pointers, etc.
63 * eup pointer to device unit structure
67 * error error condition
76 * Allocate one large TX buffer. Currently we use only one
77 * channel with full cell rate which all VCs will use.
78 * This will (probably) have to change (alot) when we
82 * Server cards, which have more then 512KB of RAM, will
83 * allocate a 128KB TX buffer, while client cards, with
84 * 512KB or less will allocate a 32KB TX buffer.
86 words = ( eup->eu_ramsize > MAX_CLIENT_RAM * ENI_BUF_PGSZ ?
87 TX_LARGE_BSIZE : TX_SMALL_BSIZE ) * ENI_BUF_PGSZ;
88 if ( ( eup->eu_txbuf = eni_allocate_buffer ( eup, &words ) ) ==
92 eup->eu_txsize = words >> 2; /* Bytes to words */
93 words >>= ENI_LOC_PREDIV; /* Predivide by 256 words */
94 for ( order = -1; words; order++ )
96 eup->eu_midway[MIDWAY_TXPLACE] =
97 (order << TXSIZE_SHIFT) | ((intptr_t)eup->eu_txbuf >> ENI_LOC_PREDIV);
98 eup->eu_txpos = eup->eu_midway[MIDWAY_DESCR] & 0x7FFF;
100 * Set first word of unack'ed data to start
102 eup->eu_txfirst = eup->eu_txpos;
105 * Set initial values of local DMA pointer used to prevent wraps
111 * Initialize queue's for receive/transmit pdus
113 eup->eu_txqueue.ifq_maxlen = ENI_IFQ_MAXLEN;
114 eup->eu_rxqueue.ifq_maxlen = ENI_IFQ_MAXLEN;
117 * Acknowledge any interrupts
119 (void) eup->eu_midway[MIDWAY_ISA];
122 * "Zero" Sonet error counters
124 eni_zero_stats ( eup );
127 * Set master control register
129 * IntSel1 | LOCK_MODE | DMA_ENABLE | TX_ENABLE | RX_ENABLE
132 eup->eu_midway[MIDWAY_MASTER] = 1 << ENI_ISEL_SHIFT |
133 ENI_M_DMAENABLE | ENI_M_TXENABLE | ENI_M_RXENABLE;
138 eup->eu_midway[MIDWAY_IE] = ENI_INT_SERVICE | ENI_INT_RX_DMA |
139 ENI_INT_TX_DMA | ENI_INT_DMA_ERR | ENI_INT_DMA_LERR |
140 ENI_INT_IDEN | ENI_INT_DMA_OVFL;
143 * Last thing to do is to indicate that we've finished initializing
146 eup->eu_flags |= CUF_INITED;