elinkxlreg.h revision 1.2 1 /* $NetBSD: elinkxlreg.h,v 1.2 1999/09/01 21:03:03 fvdl Exp $ */
2
3 /*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * This file defines the registers specific to the EtherLink XL family
41 * of NICs.
42 */
43
44 #define EEPROM_SOFTINFO3 0x15 /* Software info #3 */
45 #define EEPROM_SUBVENDOR_ELXL 0x17 /* Subsys vendor id */
46 #define EEPROM_SUBSYSID 0x18 /* Subsys id */
47 #define EEPROM_MEDIA 0x19 /* Media options (90xB) */
48 #define EEPROM_CHECKSUM_ELXL 0x20 /* EEPROM checksum */
49
50 /*
51 * Flat address space registers (outside the windows)
52 */
53
54 #define ELINK_TXPKTID 0x18 /* 90xB only */
55 #define ELINK_TIMER 0x1a
56 #define ELINK_TXSTATUS 0x1b
57 #define ELINK_INTSTATUSAUTO 0x1e
58 #define ELINK_DMACTRL 0x20
59 # define ELINK_DMAC_DNCMPLREQ 0x00000002
60 # define ELINK_DMAC_DNSTALLED 0x00000004
61 # define ELINK_DMAC_UPCOMPLETE 0x00000008
62 # define ELINK_DMAC_DNCOMPLETE 0x00000010
63 # define ELINK_DMAC_UPRXEAREN 0x00000020
64 # define ELINK_DMAC_ARNCNTDN 0x00000040
65 # define ELINK_DMAC_DNINPROG 0x00000080
66 # define ELINK_DMAC_CNTSPEED 0x00000100
67 # define ELINK_DMAC_CNTDNMODE 0x00000200
68 # define ELINK_DMAC_ALTSEQDIS 0x00010000
69 # define ELINK_DMAC_DEFEATMWI 0x00100000
70 # define ELINK_DMAC_DEFEATMRL 0x00200000
71 # define ELINK_DMAC_UPOVERDIS 0x00400000
72 # define ELINK_DMAC_TARGABORT 0x40000000
73 # define ELINK_DMAC_MSTRABORT 0x80000000
74 #define ELINK_DNLISTPTR 0x24
75 #define ELINK_DNBURSTTHRESH 0x2a /* 90xB only */
76 #define ELINK_DNPRIOTHRESH 0x2c /* 90xB only */
77 #define ELINK_DNPOLL 0x2d /* 90xB only */
78 #define ELINK_TXFREETHRESH 0x2f /* 90x only */
79 #define ELINK_UPPKTSTATUS 0x30
80 #define ELINK_FREETIMER 0x34
81 #define ELINK_COUNTDOWN 0x36
82 #define ELINK_UPLISTPTR 0x38
83 #define ELINK_UPPRIOTHRESH 0x3c /* 90xB only */
84 #define ELINK_UPPOLL 0x3d /* 90xB only */
85 #define ELINK_UPBURSTTHRESH 0x3e /* 90xB only */
86 #define ELINK_REALTIMECNT 0x40 /* 90xB only */
87 #define ELINK_DNMAXBURST 0x78 /* 90xB only */
88 #define ELINK_UPMAXBURST 0x7a /* 90xB only */
89
90 /*
91 * This is reset options for the other cards, media options for
92 * the 90xB NICs. Reset options are in a seperate register for
93 * the 90xB.
94 */
95 #define ELINK_W3_MEDIA_OPTIONS 0x08
96 # define ELINK_MEDIACAP_100BASET4 0x0001
97 # define ELINK_MEDIACAP_100BASETX 0x0002
98 # define ELINK_MEDIACAP_100BASEFX 0x0004
99 # define ELINK_MEDIACAP_10BASET 0x0008
100 # define ELINK_MEDIACAP_10BASE2 0x0010
101 # define ELINK_MEDIACAP_10BASE5 0x0020
102 # define ELINK_MEDIACAP_MII 0x0040
103 # define ELINK_MEDIACAP_10BASEFL 0x0080
104
105 /*
106 * Window 4, offset 8 is defined for MII/PHY access for EtherLink XL
107 * cards.
108 */
109 #define ELINK_W4_PHYSMGMT 0x08
110 # define ELINK_PHY_CLK 0x0001
111 # define ELINK_PHY_DATA 0x0002
112 # define ELINK_PHY_DIR 0x0004
113
114 /*
115 * Counter in window 4 for packets with a bad start-of-stream delimiter/
116 */
117 #define ELINK_W4_BADSSD 0x0c
118 #define ELINK_W4_UBYTESOK 0x0c
119
120 /*
121 * Define for extra multicast hash filter bit implemented in the 90xB
122 */
123 #define FIL_MULTIHASH 0x10
124
125 /*
126 * Defines for the interrupt status register, only for the 90x[B]
127 */
128 #define S_HOST_ERROR 0x0002
129 #define S_LINK_EVENT 0x0100
130 #define S_DN_COMPLETE 0x0200
131 #define S_UP_COMPLETE 0x0400
132
133 #define S_MASK \
134 (S_HOST_ERROR | S_TX_COMPLETE | S_UPD_STATS | S_DN_COMPLETE | S_UP_COMPLETE)
135
136
137 /*
138 * Window 7 registers. These are different for 90x and 90xB than
139 * for the EtherLink III / Fast EtherLink cards.
140 */
141
142 #define ELINK_W7_VLANMASK 0x00 /* 90xB only */
143 #define ELINK_W7_VLANTYPE 0x04 /* 90xB only */
144 #define ELINK_W7_TIMER 0x0a /* 90x only */
145 #define ELINK_W7_TXSTATUS 0x0b /* 90x only */
146 #define ELINK_W7_POWEREVENT 0x0c /* 90xB only */
147 #define ELINK_W7_INTSTATUS 0x0e
148
149 /*
150 * Command definitions.
151 */
152 #define ELINK_UPSTALL 0x3000
153 #define ELINK_UPUNSTALL 0x3001
154 #define ELINK_DNSTALL 0x3002
155 #define ELINK_DNUNSTALL 0x3003
156 #define ELINK_TXRECLTHRESH 0xc000
157 #define ELINK_TXSTARTTHRESH 0x9800
158 #define ELINK_SETHASHFILBIT 0xcc00
159
160 /*
161 * The Internal Config register is different on 90xB cards. The
162 * different masks / shifts are defined here.
163 */
164
165 /*
166 * Lower 16 bits.
167 */
168 #define CONFIG_TXLARGE (u_int16_t) 0x4000
169 #define CONFIG_TXLARGE_SHIFT 14
170
171 #define CONFIG_RXLARGE (u_int16_t) 0x8000
172 #define CONFIG_RXLARGE_SHIFT 15
173
174 /*
175 * Upper 16 bits.
176 */
177 #define CONFIG_XCVR_SEL (u_int16_t) 0x00f0
178 #define CONFIG_XCVR_SEL_SHIFT 4
179
180 #define ELINKMEDIA_AUTO 8
181
182 #define CONFIG_AUTOSEL (u_int16_t) 0x0100
183 #define CONFIG_AUTOSEL_SHIFT 8
184
185 #define CONFIG_DISABLEROM (u_int16_t) 0x0200
186 #define CONFIG_DISABLEROM_SHIFT 9
187
188 /*
189 * ID of internal PHY.
190 */
191
192 #define ELINK_INTPHY_ID 24
193
194 /*
195 * Fragment header as laid out in memory for DMA access.
196 */
197
198 struct ex_fraghdr {
199 volatile u_int32_t fr_addr; /* phys addr of frag */
200 volatile u_int32_t fr_len; /* length of frag */
201 };
202
203 #define EX_FR_LENMASK 0x00001fff /* mask for length in fr_len field */
204 #define EX_FR_LAST 0x80000000 /* indicates last fragment */
205
206 #define EX_NDPD 128
207 #define EX_NUPD 64
208
209 /*
210 * Note: the number of receive fragments in an UPD is 1, since we're
211 * receiving into one contiguous mbuf.
212 */
213 #define EX_NRFRAGS 1 /* # fragments in rcv pkt (< 64) */
214 #define EX_NTFRAGS 32 /* # fragments in tx pkt (< 64) */
215
216 /*
217 * Type 0 Download Packet Descriptor (DPD).
218 */
219 struct ex_dpd {
220 volatile u_int32_t dpd_nextptr; /* prt to next fragheader */
221 volatile u_int32_t dpd_fsh; /* frame start header */
222 volatile struct ex_fraghdr dpd_frags[EX_NTFRAGS];
223 };
224
225 /*
226 * Type 1 DPD, supported by 90xB.
227 */
228 struct ex_dpd1 {
229 volatile u_int32_t dpd_nextptr;
230 volatile u_int32_t dpd_schedtime; /* time to download */
231 volatile u_int32_t dpd_fsh;
232 volatile struct ex_fraghdr dpd_frags[EX_NTFRAGS];
233 };
234
235 struct ex_upd {
236 volatile u_int32_t upd_nextptr;
237 volatile u_int32_t upd_pktstatus;
238 volatile struct ex_fraghdr upd_frags[EX_NRFRAGS];
239 };
240
241 /*
242 * Higher level linked list of upload packet descriptors.
243 */
244 struct ex_rxdesc {
245 struct ex_rxdesc *rx_next;
246 struct mbuf *rx_mbhead;
247 bus_dmamap_t rx_dmamap;
248 struct ex_upd *rx_upd;
249 };
250
251 /*
252 * .. and for download packet descriptors.
253 */
254 struct ex_txdesc {
255 struct ex_txdesc *tx_next;
256 struct mbuf *tx_mbhead;
257 bus_dmamap_t tx_dmamap;
258 struct ex_dpd *tx_dpd;
259 };
260
261 #define DPD_DMADDR(s,t) \
262 ((s)->sc_dpddma + ((caddr_t)((t)->tx_dpd) - (caddr_t)((s)->sc_dpd)))
263
264 /*
265 * Frame Start Header bitfields.
266 */
267
268 #define EX_DPD_DNIND 0x80000000 /* intr on download done */
269 #define EX_DPD_TXIND 0x00008000 /* intr on tx done */
270 #define EX_DPD_NOCRC 0x00002000 /* no CRC append */
271
272 /*
273 * Lower 12 bits are the tx length for the 90x family. The 90xB
274 * assumes that the tx length is the sum of all frame lengths,
275 * and uses the bits as below. It also defines some more bits in
276 * the upper part.
277 */
278 #define EX_DPD_EMPTY 0x20000000 /* no data in this DPD */
279 #define EX_DPD_UPDEFEAT 0x10000000 /* don't round tx lengths up */
280 #define EX_DPD_UDPCKSUM 0x08000000 /* do hardware UDP checksum */
281 #define EX_DPD_TCPCKSUM 0x04000000 /* do hardware TCP checksum */
282 #define EX_DPD_IPCKSUM 0x02000000 /* do hardware IP checksum */
283 #define EX_DPD_DNCMPLT 0x01000000 /* packet has been downloaded */
284 #define EX_DPD_IDMASK 0x000003fc /* mask for packet id */
285 # define EX_DPD_IDSHIFT 2
286 #define EX_DPD_RNDMASK 0x00000003 /* mask for rounding */
287 /* 0 -> dword, 2 -> word, 1,3 -> none */
288
289 /*
290 * Schedtime bitfields.
291 */
292 #define EX_SCHED_TIMEVALID 0x20000000 /* field contains value */
293 #define EX_SCHED_LDCOUNT 0x10000000 /* load schedtime onto NIC */
294 #define EX_SCHED_TIMEMASK 0x00ffffff
295
296 /*
297 * upd_pktstatus bitfields.
298 */
299 #define EX_UPD_PKTLENMASK 0x00001fff /* 12:0 -> packet length */
300 #define EX_UPD_ERROR 0x00004000 /* rcv error */
301 #define EX_UPD_COMPLETE 0x00008000 /* rcv complete */
302 #define EX_UPD_OVERRUN 0x00010000 /* rcv overrun */
303 #define EX_UPD_RUNT 0x00020000 /* pkt < 60 bytes */
304 #define EX_UPD_ALIGNERR 0x00040000 /* alignment error */
305 #define EX_UPD_CRCERR 0x00080000 /* CRC error */
306 #define EX_UPD_OVERSIZED 0x00100000 /* oversize frame */
307 #define EX_UPD_DRIBBLEBITS 0x00800000 /* pkt had dribble bits */
308 #define EX_UPD_OVERFLOW 0x01000000 /* insufficient space for pkt */
309 #define EX_UPD_IPCKSUMERR 0x02000000 /* IP cksum error (90xB) */
310 #define EX_UPD_TCPCKSUMERR 0x04000000 /* TCP cksum error (90xB) */
311 #define EX_UPD_UDPCKSUMERR 0x08000000 /* UDP cksum error (90xB) */
312
313 #define EX_UPD_ERR 0x001f4000 /* Errors we check for */
314