xref: /minix/sys/arch/i386/stand/lib/netif/3c509.h (revision 58a2b000)
1*58a2b000SEvgeniy Ivanov /*	$NetBSD: 3c509.h,v 1.6 2006/11/24 22:52:16 wiz Exp $	*/
2*58a2b000SEvgeniy Ivanov 
3*58a2b000SEvgeniy Ivanov /*
4*58a2b000SEvgeniy Ivanov  * Copyright (c) 1993 Herb Peyerl
5*58a2b000SEvgeniy Ivanov  * All rights reserved.
6*58a2b000SEvgeniy Ivanov  *
7*58a2b000SEvgeniy Ivanov  * Redistribution and use in source and binary forms, with or without
8*58a2b000SEvgeniy Ivanov  * modification, are permitted provided that the following conditions
9*58a2b000SEvgeniy Ivanov  * are met:
10*58a2b000SEvgeniy Ivanov  * 1. Redistributions of source code must retain the above copyright
11*58a2b000SEvgeniy Ivanov  *    notice, this list of conditions and the following disclaimer.
12*58a2b000SEvgeniy Ivanov  * 2. The name of the author may not be used to endorse or promote products
13*58a2b000SEvgeniy Ivanov  *    derived from this software without specific prior written permission.
14*58a2b000SEvgeniy Ivanov  *
15*58a2b000SEvgeniy Ivanov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*58a2b000SEvgeniy Ivanov  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*58a2b000SEvgeniy Ivanov  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*58a2b000SEvgeniy Ivanov  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*58a2b000SEvgeniy Ivanov  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20*58a2b000SEvgeniy Ivanov  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21*58a2b000SEvgeniy Ivanov  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22*58a2b000SEvgeniy Ivanov  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23*58a2b000SEvgeniy Ivanov  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*58a2b000SEvgeniy Ivanov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*58a2b000SEvgeniy Ivanov  * SUCH DAMAGE.
26*58a2b000SEvgeniy Ivanov  *
27*58a2b000SEvgeniy Ivanov  * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by:
28*58a2b000SEvgeniy Ivanov  *
29*58a2b000SEvgeniy Ivanov  October 2, 1994
30*58a2b000SEvgeniy Ivanov 
31*58a2b000SEvgeniy Ivanov  Modified by: Andres Vega Garcia
32*58a2b000SEvgeniy Ivanov 
33*58a2b000SEvgeniy Ivanov  INRIA - Sophia Antipolis, France
34*58a2b000SEvgeniy Ivanov  e-mail: avega@sophia.inria.fr
35*58a2b000SEvgeniy Ivanov  finger: avega@pax.inria.fr
36*58a2b000SEvgeniy Ivanov 
37*58a2b000SEvgeniy Ivanov  */
38*58a2b000SEvgeniy Ivanov 
39*58a2b000SEvgeniy Ivanov /*
40*58a2b000SEvgeniy Ivanov  * Ethernet software status per interface.
41*58a2b000SEvgeniy Ivanov  */
42*58a2b000SEvgeniy Ivanov /*
43*58a2b000SEvgeniy Ivanov  * Some global constants
44*58a2b000SEvgeniy Ivanov  */
45*58a2b000SEvgeniy Ivanov #define ETHER_MIN_LEN	     64
46*58a2b000SEvgeniy Ivanov #define ETHER_MAX_LEN	   1518
47*58a2b000SEvgeniy Ivanov #define ETHER_ADDR_LEN	      6
48*58a2b000SEvgeniy Ivanov 
49*58a2b000SEvgeniy Ivanov #define TX_INIT_RATE         16
50*58a2b000SEvgeniy Ivanov #define TX_INIT_MAX_RATE     64
51*58a2b000SEvgeniy Ivanov #define RX_INIT_LATENCY      64
52*58a2b000SEvgeniy Ivanov #define RX_INIT_EARLY_THRESH 64
53*58a2b000SEvgeniy Ivanov #define MIN_RX_EARLY_THRESHF   16 /* not less than ether_header */
54*58a2b000SEvgeniy Ivanov #define MIN_RX_EARLY_THRESHL   4
55*58a2b000SEvgeniy Ivanov 
56*58a2b000SEvgeniy Ivanov #define EEPROMSIZE      0x40
57*58a2b000SEvgeniy Ivanov #define MAX_EEPROMBUSY  1000
58*58a2b000SEvgeniy Ivanov #define EP_LAST_TAG     0xd7
59*58a2b000SEvgeniy Ivanov #define EP_MAX_BOARDS   16
60*58a2b000SEvgeniy Ivanov #define EP_ID_PORT      0x100
61*58a2b000SEvgeniy Ivanov 
62*58a2b000SEvgeniy Ivanov /*
63*58a2b000SEvgeniy Ivanov  * some macros to acces long named fields
64*58a2b000SEvgeniy Ivanov  */
65*58a2b000SEvgeniy Ivanov #define IS_BASE (eth_base)
66*58a2b000SEvgeniy Ivanov #define BASE 	(eth_base)
67*58a2b000SEvgeniy Ivanov 
68*58a2b000SEvgeniy Ivanov /*
69*58a2b000SEvgeniy Ivanov  * Commands to read/write EEPROM through EEPROM command register (Window 0,
70*58a2b000SEvgeniy Ivanov  * Offset 0xa)
71*58a2b000SEvgeniy Ivanov  */
72*58a2b000SEvgeniy Ivanov #define EEPROM_CMD_RD    0x0080	/* Read:  Address required (5 bits) */
73*58a2b000SEvgeniy Ivanov #define EEPROM_CMD_WR    0x0040	/* Write: Address required (5 bits) */
74*58a2b000SEvgeniy Ivanov #define EEPROM_CMD_ERASE 0x00c0	/* Erase: Address required (5 bits) */
75*58a2b000SEvgeniy Ivanov #define EEPROM_CMD_EWEN  0x0030	/* Erase/Write Enable: No data required */
76*58a2b000SEvgeniy Ivanov 
77*58a2b000SEvgeniy Ivanov #define EEPROM_BUSY		(1<<15)
78*58a2b000SEvgeniy Ivanov #define EEPROM_TST_MODE		(1<<14)
79*58a2b000SEvgeniy Ivanov 
80*58a2b000SEvgeniy Ivanov /*
81*58a2b000SEvgeniy Ivanov  * Some short functions, worth to let them be a macro
82*58a2b000SEvgeniy Ivanov  */
83*58a2b000SEvgeniy Ivanov #define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY)
84*58a2b000SEvgeniy Ivanov #define GO_WINDOW(x)      outw(BASE+EP_COMMAND, WINDOW_SELECT|(x))
85*58a2b000SEvgeniy Ivanov 
86*58a2b000SEvgeniy Ivanov /**************************************************************************
87*58a2b000SEvgeniy Ivanov  *									  *
88*58a2b000SEvgeniy Ivanov  * These define the EEPROM data structure.  They are used in the probe
89*58a2b000SEvgeniy Ivanov  * function to verify the existence of the adapter after having sent
90*58a2b000SEvgeniy Ivanov  * the ID_Sequence.
91*58a2b000SEvgeniy Ivanov  *
92*58a2b000SEvgeniy Ivanov  * There are others but only the ones we use are defined here.
93*58a2b000SEvgeniy Ivanov  *
94*58a2b000SEvgeniy Ivanov  **************************************************************************/
95*58a2b000SEvgeniy Ivanov 
96*58a2b000SEvgeniy Ivanov #define EEPROM_NODE_ADDR_0	0x0	/* Word */
97*58a2b000SEvgeniy Ivanov #define EEPROM_NODE_ADDR_1	0x1	/* Word */
98*58a2b000SEvgeniy Ivanov #define EEPROM_NODE_ADDR_2	0x2	/* Word */
99*58a2b000SEvgeniy Ivanov #define EEPROM_PROD_ID		0x3	/* 0x9[0-f]50 */
100*58a2b000SEvgeniy Ivanov #define EEPROM_MFG_ID		0x7	/* 0x6d50 */
101*58a2b000SEvgeniy Ivanov #define EEPROM_ADDR_CFG		0x8	/* Base addr */
102*58a2b000SEvgeniy Ivanov #define EEPROM_RESOURCE_CFG	0x9	/* IRQ. Bits 12-15 */
103*58a2b000SEvgeniy Ivanov 
104*58a2b000SEvgeniy Ivanov /**************************************************************************
105*58a2b000SEvgeniy Ivanov  *										  *
106*58a2b000SEvgeniy Ivanov  * These are the registers for the 3Com 3c509 and their bit patterns when *
107*58a2b000SEvgeniy Ivanov  * applicable.  They have been taken out of the "EtherLink III Parallel   *
108*58a2b000SEvgeniy Ivanov  * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual *
109*58a2b000SEvgeniy Ivanov  * from 3com.								  *
110*58a2b000SEvgeniy Ivanov  *										  *
111*58a2b000SEvgeniy Ivanov  **************************************************************************/
112*58a2b000SEvgeniy Ivanov 
113*58a2b000SEvgeniy Ivanov #define EP_COMMAND		0x0e	/* Write. BASE+0x0e is always a
114*58a2b000SEvgeniy Ivanov 					 * command reg. */
115*58a2b000SEvgeniy Ivanov #define EP_STATUS		0x0e	/* Read. BASE+0x0e is always status
116*58a2b000SEvgeniy Ivanov 					 * reg. */
117*58a2b000SEvgeniy Ivanov #define EP_WINDOW		0x0f	/* Read. BASE+0x0f is always window
118*58a2b000SEvgeniy Ivanov 					 * reg. */
119*58a2b000SEvgeniy Ivanov /*
120*58a2b000SEvgeniy Ivanov  * Window 0 registers. Setup.
121*58a2b000SEvgeniy Ivanov  */
122*58a2b000SEvgeniy Ivanov /* Write */
123*58a2b000SEvgeniy Ivanov #define EP_W0_EEPROM_DATA	0x0c
124*58a2b000SEvgeniy Ivanov #define EP_W0_EEPROM_COMMAND	0x0a
125*58a2b000SEvgeniy Ivanov #define EP_W0_RESOURCE_CFG	0x08
126*58a2b000SEvgeniy Ivanov #define EP_W0_ADDRESS_CFG	0x06
127*58a2b000SEvgeniy Ivanov #define EP_W0_CONFIG_CTRL	0x04
128*58a2b000SEvgeniy Ivanov /* Read */
129*58a2b000SEvgeniy Ivanov #define EP_W0_PRODUCT_ID	0x02
130*58a2b000SEvgeniy Ivanov #define EP_W0_MFG_ID		0x00
131*58a2b000SEvgeniy Ivanov 
132*58a2b000SEvgeniy Ivanov /*
133*58a2b000SEvgeniy Ivanov  * Window 1 registers. Operating Set.
134*58a2b000SEvgeniy Ivanov  */
135*58a2b000SEvgeniy Ivanov /* Write */
136*58a2b000SEvgeniy Ivanov #define EP_W1_TX_PIO_WR_2	0x02
137*58a2b000SEvgeniy Ivanov #define EP_W1_TX_PIO_WR_1	0x00
138*58a2b000SEvgeniy Ivanov /* Read */
139*58a2b000SEvgeniy Ivanov #define EP_W1_FREE_TX		0x0c
140*58a2b000SEvgeniy Ivanov #define EP_W1_TX_STATUS		0x0b	/* byte */
141*58a2b000SEvgeniy Ivanov #define EP_W1_TIMER		0x0a	/* byte */
142*58a2b000SEvgeniy Ivanov #define EP_W1_RX_STATUS		0x08
143*58a2b000SEvgeniy Ivanov #define EP_W1_RX_PIO_RD_2	0x02
144*58a2b000SEvgeniy Ivanov #define EP_W1_RX_PIO_RD_1	0x00
145*58a2b000SEvgeniy Ivanov 
146*58a2b000SEvgeniy Ivanov /*
147*58a2b000SEvgeniy Ivanov  * Window 2 registers. Station Address Setup/Read
148*58a2b000SEvgeniy Ivanov  */
149*58a2b000SEvgeniy Ivanov /* Read/Write */
150*58a2b000SEvgeniy Ivanov #define EP_W2_ADDR_5		0x05
151*58a2b000SEvgeniy Ivanov #define EP_W2_ADDR_4		0x04
152*58a2b000SEvgeniy Ivanov #define EP_W2_ADDR_3		0x03
153*58a2b000SEvgeniy Ivanov #define EP_W2_ADDR_2		0x02
154*58a2b000SEvgeniy Ivanov #define EP_W2_ADDR_1		0x01
155*58a2b000SEvgeniy Ivanov #define EP_W2_ADDR_0		0x00
156*58a2b000SEvgeniy Ivanov 
157*58a2b000SEvgeniy Ivanov /*
158*58a2b000SEvgeniy Ivanov  * Window 3 registers.  FIFO Management.
159*58a2b000SEvgeniy Ivanov  */
160*58a2b000SEvgeniy Ivanov /* Read */
161*58a2b000SEvgeniy Ivanov #define EP_W3_FREE_TX		0x0c
162*58a2b000SEvgeniy Ivanov #define EP_W3_FREE_RX		0x0a
163*58a2b000SEvgeniy Ivanov 
164*58a2b000SEvgeniy Ivanov /*
165*58a2b000SEvgeniy Ivanov  * Window 4 registers. Diagnostics.
166*58a2b000SEvgeniy Ivanov  */
167*58a2b000SEvgeniy Ivanov /* Read/Write */
168*58a2b000SEvgeniy Ivanov #define EP_W4_MEDIA_TYPE	0x0a
169*58a2b000SEvgeniy Ivanov #define EP_W4_CTRLR_STATUS	0x08
170*58a2b000SEvgeniy Ivanov #define EP_W4_NET_DIAG		0x06
171*58a2b000SEvgeniy Ivanov #define EP_W4_FIFO_DIAG		0x04
172*58a2b000SEvgeniy Ivanov #define EP_W4_HOST_DIAG		0x02
173*58a2b000SEvgeniy Ivanov #define EP_W4_TX_DIAG		0x00
174*58a2b000SEvgeniy Ivanov 
175*58a2b000SEvgeniy Ivanov /*
176*58a2b000SEvgeniy Ivanov  * Window 5 Registers.  Results and Internal status.
177*58a2b000SEvgeniy Ivanov  */
178*58a2b000SEvgeniy Ivanov /* Read */
179*58a2b000SEvgeniy Ivanov #define EP_W5_READ_0_MASK	0x0c
180*58a2b000SEvgeniy Ivanov #define EP_W5_INTR_MASK		0x0a
181*58a2b000SEvgeniy Ivanov #define EP_W5_RX_FILTER		0x08
182*58a2b000SEvgeniy Ivanov #define EP_W5_RX_EARLY_THRESH	0x06
183*58a2b000SEvgeniy Ivanov #define EP_W5_TX_AVAIL_THRESH	0x02
184*58a2b000SEvgeniy Ivanov #define EP_W5_TX_START_THRESH	0x00
185*58a2b000SEvgeniy Ivanov 
186*58a2b000SEvgeniy Ivanov /*
187*58a2b000SEvgeniy Ivanov  * Window 6 registers. Statistics.
188*58a2b000SEvgeniy Ivanov  */
189*58a2b000SEvgeniy Ivanov /* Read/Write */
190*58a2b000SEvgeniy Ivanov #define TX_TOTAL_OK		0x0c
191*58a2b000SEvgeniy Ivanov #define RX_TOTAL_OK		0x0a
192*58a2b000SEvgeniy Ivanov #define TX_DEFERRALS		0x08
193*58a2b000SEvgeniy Ivanov #define RX_FRAMES_OK		0x07
194*58a2b000SEvgeniy Ivanov #define TX_FRAMES_OK		0x06
195*58a2b000SEvgeniy Ivanov #define RX_OVERRUNS		0x05
196*58a2b000SEvgeniy Ivanov #define TX_COLLISIONS		0x04
197*58a2b000SEvgeniy Ivanov #define TX_AFTER_1_COLLISION	0x03
198*58a2b000SEvgeniy Ivanov #define TX_AFTER_X_COLLISIONS	0x02
199*58a2b000SEvgeniy Ivanov #define TX_NO_SQE		0x01
200*58a2b000SEvgeniy Ivanov #define TX_CD_LOST		0x00
201*58a2b000SEvgeniy Ivanov 
202*58a2b000SEvgeniy Ivanov /****************************************
203*58a2b000SEvgeniy Ivanov  *
204*58a2b000SEvgeniy Ivanov  * Register definitions.
205*58a2b000SEvgeniy Ivanov  *
206*58a2b000SEvgeniy Ivanov  ****************************************/
207*58a2b000SEvgeniy Ivanov 
208*58a2b000SEvgeniy Ivanov /*
209*58a2b000SEvgeniy Ivanov  * Command register. All windows.
210*58a2b000SEvgeniy Ivanov  *
211*58a2b000SEvgeniy Ivanov  * 16 bit register.
212*58a2b000SEvgeniy Ivanov  *     15-11:  5-bit code for command to be executed.
213*58a2b000SEvgeniy Ivanov  *     10-0:   11-bit arg if any. For commands with no args;
214*58a2b000SEvgeniy Ivanov  *	      this can be set to anything.
215*58a2b000SEvgeniy Ivanov  */
216*58a2b000SEvgeniy Ivanov #define GLOBAL_RESET		(u_short) 0x0000	/* Wait at least 1ms
217*58a2b000SEvgeniy Ivanov 							 * after issuing */
218*58a2b000SEvgeniy Ivanov #define WINDOW_SELECT		(u_short) (0x1<<11)
219*58a2b000SEvgeniy Ivanov #define START_TRANSCEIVER	(u_short) (0x2<<11)	/* Read ADDR_CFG reg to
220*58a2b000SEvgeniy Ivanov 							 * determine whether
221*58a2b000SEvgeniy Ivanov 							 * this is needed. If
222*58a2b000SEvgeniy Ivanov 							 * so; wait 800 uSec
223*58a2b000SEvgeniy Ivanov 							 * before using trans-
224*58a2b000SEvgeniy Ivanov 							 * ceiver. */
225*58a2b000SEvgeniy Ivanov #define RX_DISABLE		(u_short) (0x3<<11)	/* state disabled on
226*58a2b000SEvgeniy Ivanov 							 * power-up */
227*58a2b000SEvgeniy Ivanov #define RX_ENABLE		(u_short) (0x4<<11)
228*58a2b000SEvgeniy Ivanov #define RX_RESET		(u_short) (0x5<<11)
229*58a2b000SEvgeniy Ivanov #define RX_DISCARD_TOP_PACK	(u_short) (0x8<<11)
230*58a2b000SEvgeniy Ivanov #define TX_ENABLE		(u_short) (0x9<<11)
231*58a2b000SEvgeniy Ivanov #define TX_DISABLE		(u_short) (0xa<<11)
232*58a2b000SEvgeniy Ivanov #define TX_RESET		(u_short) (0xb<<11)
233*58a2b000SEvgeniy Ivanov #define REQ_INTR		(u_short) (0xc<<11)
234*58a2b000SEvgeniy Ivanov #define SET_INTR_MASK		(u_short) (0xe<<11)
235*58a2b000SEvgeniy Ivanov #define SET_RD_0_MASK		(u_short) (0xf<<11)
236*58a2b000SEvgeniy Ivanov #define SET_RX_FILTER		(u_short) (0x10<<11)
237*58a2b000SEvgeniy Ivanov #define FIL_INDIVIDUAL	(u_short) (0x1)
238*58a2b000SEvgeniy Ivanov #define FIL_GROUP		(u_short) (0x2)
239*58a2b000SEvgeniy Ivanov #define FIL_BRDCST	(u_short) (0x4)
240*58a2b000SEvgeniy Ivanov #define FIL_ALL		(u_short) (0x8)
241*58a2b000SEvgeniy Ivanov #define SET_RX_EARLY_THRESH	(u_short) (0x11<<11)
242*58a2b000SEvgeniy Ivanov #define SET_TX_AVAIL_THRESH	(u_short) (0x12<<11)
243*58a2b000SEvgeniy Ivanov #define SET_TX_START_THRESH	(u_short) (0x13<<11)
244*58a2b000SEvgeniy Ivanov #define STATS_ENABLE		(u_short) (0x15<<11)
245*58a2b000SEvgeniy Ivanov #define STATS_DISABLE		(u_short) (0x16<<11)
246*58a2b000SEvgeniy Ivanov #define STOP_TRANSCEIVER	(u_short) (0x17<<11)
247*58a2b000SEvgeniy Ivanov /*
248*58a2b000SEvgeniy Ivanov  * The following C_* acknowledge the various interrupts. Some of them don't
249*58a2b000SEvgeniy Ivanov  * do anything.  See the manual.
250*58a2b000SEvgeniy Ivanov  */
251*58a2b000SEvgeniy Ivanov #define ACK_INTR		(u_short) (0x6800)
252*58a2b000SEvgeniy Ivanov #define C_INTR_LATCH	(u_short) (ACK_INTR|0x1)
253*58a2b000SEvgeniy Ivanov #define C_CARD_FAILURE	(u_short) (ACK_INTR|0x2)
254*58a2b000SEvgeniy Ivanov #define C_TX_COMPLETE	(u_short) (ACK_INTR|0x4)
255*58a2b000SEvgeniy Ivanov #define C_TX_AVAIL	(u_short) (ACK_INTR|0x8)
256*58a2b000SEvgeniy Ivanov #define C_RX_COMPLETE	(u_short) (ACK_INTR|0x10)
257*58a2b000SEvgeniy Ivanov #define C_RX_EARLY	(u_short) (ACK_INTR|0x20)
258*58a2b000SEvgeniy Ivanov #define C_INT_RQD		(u_short) (ACK_INTR|0x40)
259*58a2b000SEvgeniy Ivanov #define C_UPD_STATS	(u_short) (ACK_INTR|0x80)
260*58a2b000SEvgeniy Ivanov 
261*58a2b000SEvgeniy Ivanov /*
262*58a2b000SEvgeniy Ivanov  * Status register. All windows.
263*58a2b000SEvgeniy Ivanov  *
264*58a2b000SEvgeniy Ivanov  *     15-13:  Window number(0-7).
265*58a2b000SEvgeniy Ivanov  *     12:     Command_in_progress.
266*58a2b000SEvgeniy Ivanov  *     11:     reserved.
267*58a2b000SEvgeniy Ivanov  *     10:     reserved.
268*58a2b000SEvgeniy Ivanov  *     9:      reserved.
269*58a2b000SEvgeniy Ivanov  *     8:      reserved.
270*58a2b000SEvgeniy Ivanov  *     7:      Update Statistics.
271*58a2b000SEvgeniy Ivanov  *     6:      Interrupt Requested.
272*58a2b000SEvgeniy Ivanov  *     5:      RX Early.
273*58a2b000SEvgeniy Ivanov  *     4:      RX Complete.
274*58a2b000SEvgeniy Ivanov  *     3:      TX Available.
275*58a2b000SEvgeniy Ivanov  *     2:      TX Complete.
276*58a2b000SEvgeniy Ivanov  *     1:      Adapter Failure.
277*58a2b000SEvgeniy Ivanov  *     0:      Interrupt Latch.
278*58a2b000SEvgeniy Ivanov  */
279*58a2b000SEvgeniy Ivanov #define S_INTR_LATCH		(u_short) (0x1)
280*58a2b000SEvgeniy Ivanov #define S_CARD_FAILURE		(u_short) (0x2)
281*58a2b000SEvgeniy Ivanov #define S_TX_COMPLETE		(u_short) (0x4)
282*58a2b000SEvgeniy Ivanov #define S_TX_AVAIL		(u_short) (0x8)
283*58a2b000SEvgeniy Ivanov #define S_RX_COMPLETE		(u_short) (0x10)
284*58a2b000SEvgeniy Ivanov #define S_RX_EARLY		(u_short) (0x20)
285*58a2b000SEvgeniy Ivanov #define S_INT_RQD		(u_short) (0x40)
286*58a2b000SEvgeniy Ivanov #define S_UPD_STATS		(u_short) (0x80)
287*58a2b000SEvgeniy Ivanov #define S_5_INTS                (S_CARD_FAILURE|S_TX_COMPLETE|\
288*58a2b000SEvgeniy Ivanov 				 S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
289*58a2b000SEvgeniy Ivanov #define S_COMMAND_IN_PROGRESS	(u_short) (0x1000)
290*58a2b000SEvgeniy Ivanov 
291*58a2b000SEvgeniy Ivanov /*
292*58a2b000SEvgeniy Ivanov  * FIFO Registers.
293*58a2b000SEvgeniy Ivanov  * RX Status. Window 1/Port 08
294*58a2b000SEvgeniy Ivanov  *
295*58a2b000SEvgeniy Ivanov  *     15:     Incomplete or FIFO empty.
296*58a2b000SEvgeniy Ivanov  *     14:     1: Error in RX Packet   0: Incomplete or no error.
297*58a2b000SEvgeniy Ivanov  *     13-11:  Type of error.
298*58a2b000SEvgeniy Ivanov  *	      1000 = Overrun.
299*58a2b000SEvgeniy Ivanov  *	      1011 = Run Packet Error.
300*58a2b000SEvgeniy Ivanov  *	      1100 = Alignment Error.
301*58a2b000SEvgeniy Ivanov  *	      1101 = CRC Error.
302*58a2b000SEvgeniy Ivanov  *	      1001 = Oversize Packet Error (>1514 bytes)
303*58a2b000SEvgeniy Ivanov  *	      0010 = Dribble Bits.
304*58a2b000SEvgeniy Ivanov  *	      (all other error codes, no errors.)
305*58a2b000SEvgeniy Ivanov  *
306*58a2b000SEvgeniy Ivanov  *     10-0:   RX Bytes (0-1514)
307*58a2b000SEvgeniy Ivanov  */
308*58a2b000SEvgeniy Ivanov #define ERR_RX_INCOMPLETE  (u_short) (0x1<<15)
309*58a2b000SEvgeniy Ivanov #define ERR_RX		   (u_short) (0x1<<14)
310*58a2b000SEvgeniy Ivanov #define ERR_RX_OVERRUN 	   (u_short) (0x8<<11)
311*58a2b000SEvgeniy Ivanov #define ERR_RX_RUN_PKT	   (u_short) (0xb<<11)
312*58a2b000SEvgeniy Ivanov #define ERR_RX_ALIGN	   (u_short) (0xc<<11)
313*58a2b000SEvgeniy Ivanov #define ERR_RX_CRC	   (u_short) (0xd<<11)
314*58a2b000SEvgeniy Ivanov #define ERR_RX_OVERSIZE	   (u_short) (0x9<<11)
315*58a2b000SEvgeniy Ivanov #define ERR_RX_DRIBBLE	   (u_short) (0x2<<11)
316*58a2b000SEvgeniy Ivanov 
317*58a2b000SEvgeniy Ivanov /*
318*58a2b000SEvgeniy Ivanov  * FIFO Registers.
319*58a2b000SEvgeniy Ivanov  * TX Status. Window 1/Port 0B
320*58a2b000SEvgeniy Ivanov  *
321*58a2b000SEvgeniy Ivanov  *   Reports the transmit status of a completed transmission. Writing this
322*58a2b000SEvgeniy Ivanov  *   register pops the transmit completion stack.
323*58a2b000SEvgeniy Ivanov  *
324*58a2b000SEvgeniy Ivanov  *   Window 1/Port 0x0b.
325*58a2b000SEvgeniy Ivanov  *
326*58a2b000SEvgeniy Ivanov  *     7:      Complete
327*58a2b000SEvgeniy Ivanov  *     6:      Interrupt on successful transmission requested.
328*58a2b000SEvgeniy Ivanov  *     5:      Jabber Error (TP Only, TX Reset required. )
329*58a2b000SEvgeniy Ivanov  *     4:      Underrun (TX Reset required. )
330*58a2b000SEvgeniy Ivanov  *     3:      Maximum Collisions.
331*58a2b000SEvgeniy Ivanov  *     2:      TX Status Overflow.
332*58a2b000SEvgeniy Ivanov  *     1-0:    Undefined.
333*58a2b000SEvgeniy Ivanov  *
334*58a2b000SEvgeniy Ivanov  */
335*58a2b000SEvgeniy Ivanov #define TXS_COMPLETE		0x80
336*58a2b000SEvgeniy Ivanov #define TXS_SUCCES_INTR_REQ		0x40
337*58a2b000SEvgeniy Ivanov #define TXS_JABBER		0x20
338*58a2b000SEvgeniy Ivanov #define TXS_UNDERRUN		0x10
339*58a2b000SEvgeniy Ivanov #define TXS_MAX_COLLISION	0x8
340*58a2b000SEvgeniy Ivanov #define TXS_STATUS_OVERFLOW	0x4
341*58a2b000SEvgeniy Ivanov 
342*58a2b000SEvgeniy Ivanov /*
343*58a2b000SEvgeniy Ivanov  * Configuration control register.
344*58a2b000SEvgeniy Ivanov  * Window 0/Port 04
345*58a2b000SEvgeniy Ivanov  */
346*58a2b000SEvgeniy Ivanov /* Read */
347*58a2b000SEvgeniy Ivanov #define IS_AUI 				(1<<13)
348*58a2b000SEvgeniy Ivanov #define IS_BNC 				(1<<12)
349*58a2b000SEvgeniy Ivanov #define IS_UTP 				(1<<9)
350*58a2b000SEvgeniy Ivanov /* Write */
351*58a2b000SEvgeniy Ivanov #define ENABLE_DRQ_IRQ			0x0001
352*58a2b000SEvgeniy Ivanov #define W0_P4_CMD_RESET_ADAPTER       0x4
353*58a2b000SEvgeniy Ivanov #define W0_P4_CMD_ENABLE_ADAPTER      0x1
354*58a2b000SEvgeniy Ivanov /*
355*58a2b000SEvgeniy Ivanov  * Media type and status.
356*58a2b000SEvgeniy Ivanov  * Window 4/Port 0A
357*58a2b000SEvgeniy Ivanov  */
358*58a2b000SEvgeniy Ivanov #define ENABLE_UTP			0xc0
359*58a2b000SEvgeniy Ivanov #define DISABLE_UTP			0x0
360*58a2b000SEvgeniy Ivanov 
361*58a2b000SEvgeniy Ivanov /*
362*58a2b000SEvgeniy Ivanov  * Resource control register
363*58a2b000SEvgeniy Ivanov  */
364*58a2b000SEvgeniy Ivanov 
365*58a2b000SEvgeniy Ivanov #define SET_IRQ(i)	( ((i)<<12) | 0xF00) /* set IRQ i */
366*58a2b000SEvgeniy Ivanov 
367*58a2b000SEvgeniy Ivanov /*
368*58a2b000SEvgeniy Ivanov  * Receive status register
369*58a2b000SEvgeniy Ivanov  */
370*58a2b000SEvgeniy Ivanov 
371*58a2b000SEvgeniy Ivanov #define RX_BYTES_MASK			(u_short) (0x07ff)
372*58a2b000SEvgeniy Ivanov #define RX_ERROR	0x4000
373*58a2b000SEvgeniy Ivanov #define RX_INCOMPLETE	0x8000
374*58a2b000SEvgeniy Ivanov 
375*58a2b000SEvgeniy Ivanov 
376*58a2b000SEvgeniy Ivanov /*
377*58a2b000SEvgeniy Ivanov  * Misc defines for various things.
378*58a2b000SEvgeniy Ivanov  */
379*58a2b000SEvgeniy Ivanov #define ACTIVATE_ADAPTER_TO_CONFIG 	0xff /* to the id_port */
380*58a2b000SEvgeniy Ivanov #define MFG_ID 				0x6d50 /* in EEPROM and W0 ADDR_CONFIG */
381*58a2b000SEvgeniy Ivanov #define PROD_ID 			0x9150
382*58a2b000SEvgeniy Ivanov 
383*58a2b000SEvgeniy Ivanov #define AUI 				0x1
384*58a2b000SEvgeniy Ivanov #define BNC 				0x2
385*58a2b000SEvgeniy Ivanov #define UTP 				0x4
386*58a2b000SEvgeniy Ivanov 
387*58a2b000SEvgeniy Ivanov #define ETHER_ADDR_LEN			6
388*58a2b000SEvgeniy Ivanov #define ETHER_MAX			1536
389*58a2b000SEvgeniy Ivanov #define RX_BYTES_MASK			(u_short) (0x07ff)
390*58a2b000SEvgeniy Ivanov 
391*58a2b000SEvgeniy Ivanov  /* EISA support */
392*58a2b000SEvgeniy Ivanov #define EP_EISA_START                    0x1000
393*58a2b000SEvgeniy Ivanov #define EP_EISA_W0                       0x0c80
394