if_iereg.h revision 1.1.6.2 1 /* $NetBSD: if_iereg.h,v 1.1.6.2 2002/01/10 19:36:34 thorpej Exp $ */
2
3 /*
4 * Copyright (C) 1994 Wolfgang Solfrank.
5 * Copyright (C) 1994 TooLs GmbH.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #define IE_PAGE 0
35
36 #define IE_CONTROL 1
37 #define IE_CONT_RESET 1
38 #define IE_CONT_LOOP 2
39 #define IE_CONT_ATTN 4
40 #define IE_CONT_CLI 8
41
42 #define IE_MEMSIZE 65536
43 #define IE_PAGESIZE 4096
44 #define IE_MEMOFF 0x2000
45 #define IE_COFF2POFF(off) ((off) % IE_PAGESIZE * 2)
46 #define IE_COFF2PAGE(off) (((off) % IE_MEMSIZE) / IE_PAGESIZE)
47
48 #define IE_ISCP_ADDR (IE_SCP_ADDR - sizeof(struct ie_int_sys_conf_ptr))
49 #define IE_IBASE (0x1000000 - IE_MEMSIZE)
50 #define IE_SCB_OFF 0
51
52 /*-
53 * Copyright (c) 1998 The NetBSD Foundation, Inc.
54 * All rights reserved.
55 *
56 * This code is derived from software contributed to The NetBSD Foundation
57 * by Paul Kranenburg.
58 *
59 * Redistribution and use in source and binary forms, with or without
60 * modification, are permitted provided that the following conditions
61 * are met:
62 * 1. Redistributions of source code must retain the above copyright
63 * notice, this list of conditions and the following disclaimer.
64 * 2. Redistributions in binary form must reproduce the above copyright
65 * notice, this list of conditions and the following disclaimer in the
66 * documentation and/or other materials provided with the distribution.
67 * 3. All advertising materials mentioning features or use of this software
68 * must display the following acknowledgement:
69 * This product includes software developed by the NetBSD
70 * Foundation, Inc. and its contributors.
71 * 4. Neither the name of The NetBSD Foundation nor the names of its
72 * contributors may be used to endorse or promote products derived
73 * from this software without specific prior written permission.
74 *
75 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
76 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
77 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
78 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
79 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
80 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
81 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
82 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
83 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
84 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
85 * POSSIBILITY OF SUCH DAMAGE.
86 */
87
88 /*-
89 * Copyright (c) 1992, University of Vermont and State Agricultural College.
90 * Copyright (c) 1992, Garrett A. Wollman.
91 * All rights reserved.
92 *
93 * Redistribution and use in source and binary forms, with or without
94 * modification, are permitted provided that the following conditions
95 * are met:
96 * 1. Redistributions of source code must retain the above copyright
97 * notice, this list of conditions and the following disclaimer.
98 * 2. Redistributions in binary form must reproduce the above copyright
99 * notice, this list of conditions and the following disclaimer in the
100 * documentation and/or other materials provided with the distribution.
101 * 3. All advertising materials mentioning features or use of this software
102 * must display the following acknowledgement:
103 * This product includes software developed by the University of
104 * Vermont and State Agricultural College and Garrett A. Wollman.
105 * 4. Neither the name of the University nor the name of the author
106 * may be used to endorse or promote products derived from this software
107 * without specific prior written permission.
108 *
109 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
110 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
111 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
112 * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
113 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
114 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
115 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
116 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
117 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
118 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
119 * SUCH DAMAGE.
120 */
121
122 /*
123 * Intel 82586 Ethernet chip
124 * Register, bit, and structure definitions.
125 *
126 * Written by GAW with reference to the Clarkson Packet Driver code for this
127 * chip written by Russ Nelson and others.
128 */
129
130 /*
131 * NOTE, the structure definitions in here are for reference only.
132 * We use integer offsets exclusively to access the i82586 data structures.
133 */
134
135 /*
136 * OLD i82586.h; REMOVE WHEN ALL DRIVERS HAVE BEEN CONVERTED
137 */
138
139 struct ie_en_addr {
140 u_char data[6];
141 };
142
143 /*
144 * This is the master configuration block. It tells the hardware where all
145 * the rest of the stuff is.
146 */
147 struct ie_sys_conf_ptr {
148 u_short mbz; /* must be zero */
149 u_char ie_bus_use; /* true if 8-bit only */
150 u_char mbz2[5]; /* must be zero */
151 caddr_t ie_iscp_ptr; /* 24-bit physaddr of ISCP */
152 };
153
154 /*
155 * Note that this is wired in hardware; the SCP is always located here, no
156 * matter what.
157 */
158 #define IE_SCP_ADDR 0xfffff4
159
160 /*
161 * The tells the hardware where all the rest of the stuff is, too.
162 * FIXME: some of these should be re-commented after we figure out their
163 * REAL function.
164 */
165 struct ie_int_sys_conf_ptr {
166 u_char ie_busy; /* zeroed after init */
167 u_char mbz;
168 u_short ie_scb_offset; /* 16-bit physaddr of next struct */
169 caddr_t ie_base; /* 24-bit physaddr for all 16-bit vars */
170 };
171
172 /*
173 * This FINALLY tells the hardware what to do and where to put it.
174 */
175 struct ie_sys_ctl_block {
176 u_short ie_status; /* status word */
177 u_short ie_command; /* command word */
178 u_short ie_command_list; /* 16-pointer to command block list */
179 u_short ie_recv_list; /* 16-pointer to receive frame list */
180 u_short ie_err_crc; /* CRC errors */
181 u_short ie_err_align; /* Alignment errors */
182 u_short ie_err_resource; /* Resource errors */
183 u_short ie_err_overrun; /* Overrun errors */
184 };
185
186 /* Command values */
187 #define IE_RU_COMMAND 0x0070 /* mask for RU command */
188 #define IE_RU_NOP 0 /* for completeness */
189 #define IE_RU_START 0x0010 /* start receive unit command */
190 #define IE_RU_ENABLE 0x0020 /* enable receiver command */
191 #define IE_RU_DISABLE 0x0030 /* disable receiver command */
192 #define IE_RU_ABORT 0x0040 /* abort current receive operation */
193
194 #define IE_CU_COMMAND 0x0700 /* mask for CU command */
195 #define IE_CU_NOP 0 /* included for completeness */
196 #define IE_CU_START 0x0100 /* do-command command */
197 #define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
198 #define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
199 #define IE_CU_ABORT 0x0400 /* abort current command */
200
201 #define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
202 #define IE_ACK_CX 0x8000 /* ack IE_ST_CX */
203 #define IE_ACK_FR 0x4000 /* ack IE_ST_FR */
204 #define IE_ACK_CNA 0x2000 /* ack IE_ST_CNA */
205 #define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
206
207 #define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
208 /* is this command an action command? */
209
210 /* Status values */
211 #define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
212 #define IE_ST_CX 0x8000 /* command with I bit completed */
213 #define IE_ST_FR 0x4000 /* frame received */
214 #define IE_ST_CNA 0x2000 /* all commands completed */
215 #define IE_ST_RNR 0x1000 /* receive not ready */
216
217 #define IE_CU_STATUS 0x700 /* mask for command unit status */
218 #define IE_CU_ACTIVE 0x200 /* command unit is active */
219 #define IE_CU_SUSPEND 0x100 /* command unit is suspended */
220
221 #define IE_RU_STATUS 0x70 /* mask for receiver unit status */
222 #define IE_RU_SUSPEND 0x10 /* receiver is suspended */
223 #define IE_RU_NOSPACE 0x20 /* receiver has no resources */
224 #define IE_RU_READY 0x40 /* reveiver is ready */
225
226 /*
227 * This is filled in partially by the chip, partially by us.
228 */
229 struct ie_recv_frame_desc {
230 u_short ie_fd_status; /* status for this frame */
231 u_short ie_fd_last; /* end of frame list flag */
232 u_short ie_fd_next; /* 16-pointer to next RFD */
233 u_short ie_fd_buf_desc; /* 16-pointer to list of buffer desc's */
234 struct ie_en_addr dest; /* destination ether */
235 struct ie_en_addr src; /* source ether */
236 u_short ie_length; /* 802 length/Ether type */
237 u_short mbz; /* must be zero */
238 };
239
240 #define IE_FD_LAST 0x8000 /* last rfd in list */
241 #define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
242
243 #define IE_FD_COMPLETE 0x8000 /* frame is complete */
244 #define IE_FD_BUSY 0x4000 /* frame is busy */
245 #define IE_FD_OK 0x2000 /* frame is bad */
246 #define IE_FD_RNR 0x0200 /* receiver out of resources here */
247
248 /*
249 * linked list of buffers...
250 */
251 struct ie_recv_buf_desc {
252 u_short ie_rbd_actual; /* status for this buffer */
253 u_short ie_rbd_next; /* 16-pointer to next RBD */
254 caddr_t ie_rbd_buffer; /* 24-pointer to buffer for this RBD */
255 u_short ie_rbd_length; /* length of the buffer */
256 u_short mbz; /* must be zero */
257 };
258
259 #define IE_RBD_LAST 0x8000 /* last buffer */
260 #define IE_RBD_USED 0x4000 /* this buffer has data */
261 /*
262 * All commands share this in common.
263 */
264 struct ie_cmd_common {
265 u_short ie_cmd_status; /* status of this command */
266 u_short ie_cmd_cmd; /* command word */
267 u_short ie_cmd_link; /* link to next command */
268 };
269
270 #define IE_STAT_COMPL 0x8000 /* command is completed */
271 #define IE_STAT_BUSY 0x4000 /* command is running now */
272 #define IE_STAT_OK 0x2000 /* command completed successfully */
273 #define IE_STAT_ABORT 0x1000 /* command was aborted */
274
275 #define IE_CMD_NOP 0x0000 /* NOP */
276 #define IE_CMD_IASETUP 0x0001 /* initial address setup */
277 #define IE_CMD_CONFIG 0x0002 /* configure command */
278 #define IE_CMD_MCAST 0x0003 /* multicast setup command */
279 #define IE_CMD_XMIT 0x0004 /* transmit command */
280 #define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
281 #define IE_CMD_DUMP 0x0006 /* dump command */
282 #define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
283
284 #define IE_CMD_LAST 0x8000 /* this is the last command in the list */
285 #define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
286 #define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
287
288 /*
289 * This is the command to transmit a frame.
290 */
291 struct ie_xmit_cmd {
292 struct ie_cmd_common com; /* common part */
293 #define ie_xmit_status com.ie_cmd_status
294
295 u_short ie_xmit_desc; /* 16-pointer to buffer descriptor */
296 struct ie_en_addr ie_xmit_addr; /* destination address */
297
298 u_short ie_xmit_length; /* 802.3 length/Ether type field */
299 };
300
301 #define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
302 #define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
303 #define IE_XS_SQE 0x0040 /* SQE positive */
304 #define IE_XS_DEFERRED 0x0080 /* transmission deferred */
305 #define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
306 #define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
307 #define IE_XS_NOCARRIER 0x0400 /* No Carrier */
308 #define IE_XS_LATECOLL 0x0800 /* Late collision */
309
310 /*
311 * This is a buffer descriptor for a frame to be transmitted.
312 */
313
314 struct ie_xmit_buf {
315 u_short ie_xmit_flags; /* see below */
316 u_short ie_xmit_next; /* 16-pointer to next desc. */
317 caddr_t ie_xmit_buf; /* 24-pointer to the actual buffer */
318 };
319
320 #define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
321 /* The rest of the `flags' word is actually the length. */
322
323 /*
324 * Multicast setup command.
325 */
326
327 #define MAXMCAST 250 /* must fit in transmit buffer */
328
329 struct ie_mcast_cmd {
330 struct ie_cmd_common com; /* common part */
331 #define ie_mcast_status com.ie_cmd_status
332
333 u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
334 struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
335 };
336
337 /*
338 * Time Domain Reflectometer command.
339 */
340
341 struct ie_tdr_cmd {
342 struct ie_cmd_common com; /* common part */
343 #define ie_tdr_status com.ie_cmd_status
344
345 u_short ie_tdr_time; /* error bits and time */
346 };
347
348 #define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
349 #define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
350 #define IE_TDR_OPEN 0x2000 /* detected an open */
351 #define IE_TDR_SHORT 0x1000 /* TDR detected a short */
352 #define IE_TDR_TIME 0x07ff /* mask for reflection time */
353
354 /*
355 * Initial Address Setup command
356 */
357 struct ie_iasetup_cmd {
358 struct ie_cmd_common com;
359 #define ie_iasetup_status com.ie_cmd_status
360
361 struct ie_en_addr ie_address;
362 };
363
364 /*
365 * Configuration command
366 */
367 struct ie_config_cmd {
368 struct ie_cmd_common com; /* common part */
369 #define ie_config_status com.ie_cmd_status
370
371 u_char ie_config_count; /* byte count (0x0c) */
372 u_char ie_fifo; /* fifo (8) */
373 u_char ie_save_bad; /* save bad frames (0x40) */
374 u_char ie_addr_len; /* address length (0x2e) (AL-LOC == 1) */
375 u_char ie_priority; /* priority and backoff (0x0) */
376 u_char ie_ifs; /* inter-frame spacing (0x60) */
377 u_char ie_slot_low; /* slot time, LSB (0x0) */
378 u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
379 u_char ie_promisc; /* 1 if promiscuous, else 0 */
380 u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
381 u_char ie_min_len; /* min frame length (0x40) */
382 u_char ie_junk; /* stuff for 82596 (0xff) */
383 };
384