Annotation of sys/arch/mvme68k/dev/i82596.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: i82596.h,v 1.2 2003/06/02 05:09:14 deraadt Exp $ */
2:
3: /*-
4: * Copyright (c) 1995 Theo de Raadt
5: * Copyright (c) 1992, University of Vermont and State Agricultural College.
6: * Copyright (c) 1992, Garrett A. Wollman.
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. All advertising materials mentioning features or use of this software
18: * must display the following acknowledgement:
19: * This product includes software developed by the University of
20: * Vermont and State Agricultural College and Garrett A. Wollman.
21: * 4. Neither the name of the University nor the name of the author
22: * may be used to endorse or promote products derived from this software
23: * without specific prior written permission.
24: *
25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28: * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35: * SUCH DAMAGE.
36: */
37:
38: /*
39: * Intel 82596 Ethernet chip
40: * Register, bit, and structure definitions.
41: *
42: * Written by GAW with reference to the Clarkson Packet Driver code for this
43: * chip written by Russ Nelson and others.
44: *
45: * Sun support added by Charles D. Cranor, 25-Oct-94
46: *
47: * Remade for 82596 in 32 bit mode by Per Fogelstrom.
48: */
49:
50: struct ie_en_addr {
51: u_char data[6];
52: };
53:
54: /*
55: * This is the master configuration block. It tells the hardware where all
56: * the rest of the stuff is.
57: */
58: struct ie_sys_conf_ptr {
59: u_char mbz1[3]; /* must be zero */
60: u_char ie_bus_use; /* true if 8-bit only */
61: u_char mbz2[4]; /* must be zero */
62: u_int ie_iscp_ptr; /* physaddr of ISCP */
63: };
64:
65: /*
66: * The tells the hardware where all the rest of the stuff is, too.
67: * FIXME: some of these should be re-commented after we figure out their
68: * REAL function.
69: */
70: struct ie_int_sys_conf_ptr {
71: u_char mbz1[1]; /* must be zero */
72: u_char ie_busy; /* zeroed after init */
73: u_short ie_mbz2; /* must be zero */
74: u_int ie_base; /* 32-bit physaddr for all vars */
75: };
76:
77: /*
78: * This FINALLY tells the hardware what to do and where to put it.
79: */
80: struct ie_sys_ctl_block {
81: u_short ie_status; /* status word */
82: u_short ie_command; /* command word */
83: u_int ie_command_list; /* 32-pointer to command block list */
84: u_int ie_recv_list; /* 32-pointer to receive frame list */
85: u_int ie_err_crc; /* CRC errors */
86: u_int ie_err_align; /* Alignment errors */
87: u_int ie_err_resource; /* Resource errors */
88: u_int ie_err_overrun; /* Overrun errors */
89: u_int ie_err_coll; /* Receive packets collision errors */
90: u_int ie_err_short; /* Short frames recived errors */
91: u_short ie_off_timer; /* Bus Throttle OFF timer */
92: u_short ie_on_timer; /* Bus Throttle ON timer */
93: };
94:
95: /* Command values */
96: #define IE_RU_COMMAND 0x0070 /* mask for RU command */
97: #define IE_RU_NOP 0 /* for completeness */
98: #define IE_RU_START 0x0010 /* start receive unit command */
99: #define IE_RU_ENABLE 0x0020 /* enable receiver command */
100: #define IE_RU_DISABLE 0x0030 /* disable receiver command */
101: #define IE_RU_ABORT 0x0040 /* abort current receive operation */
102:
103: #define IE_CU_COMMAND 0x0700 /* mask for CU command */
104: #define IE_CU_NOP 0 /* included for completeness */
105: #define IE_CU_START 0x0100 /* do-command command */
106: #define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
107: #define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
108: #define IE_CU_ABORT 0x0400 /* abort current command */
109: #define IE_CU_THROTTLE 0x0500 /* load new throttle valuse */
110:
111: #define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
112: #define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */
113: #define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */
114: #define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */
115: #define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
116:
117: #define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
118: /* is this command an action command? */
119:
120: /* Status values */
121: #define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
122: #define IE_ST_DONE 0x8000 /* command with I bit completed */
123: #define IE_ST_RECV 0x4000 /* frame received */
124: #define IE_ST_ALLDONE 0x2000 /* all commands completed */
125: #define IE_ST_RNR 0x1000 /* receive not ready */
126:
127: #define IE_CU_STATUS 0x700 /* mask for command unit status */
128: #define IE_CU_ACTIVE 0x200 /* command unit is active */
129: #define IE_CU_SUSPEND 0x100 /* command unit is suspended */
130:
131: #define IE_RU_STATUS 0x70 /* mask for receiver unit status */
132: #define IE_RU_SUSPEND 0x10 /* receiver is suspended */
133: #define IE_RU_NOSPACE 0x20 /* receiver has no resources */
134: #define IE_RU_READY 0x40 /* reveiver is ready */
135:
136: /*
137: * This is filled in partially by the chip, partially by us.
138: */
139: struct ie_recv_frame_desc {
140: u_short ie_fd_status; /* status for this frame */
141: u_short ie_fd_last; /* end of frame list flag */
142: u_int ie_fd_next; /* 32-pointer to next RFD */
143: u_int ie_fd_buf_desc; /* 32-pointer to list of buffer desc's */
144: u_short ie_fd_actual; /* Actual count */
145: u_short ie_fd_size; /* Size */
146: struct ie_en_addr dest; /* destination ether */
147: struct ie_en_addr src; /* source ether */
148: u_short ie_length; /* 802 length/Ether type */
149: u_short mbz; /* must be zero */
150: };
151:
152: #define IE_FD_LAST 0x8000 /* last rfd in list */
153: #define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
154:
155: #define IE_FD_COMPLETE 0x8000 /* frame is complete */
156: #define IE_FD_BUSY 0x4000 /* frame is busy */
157: #define IE_FD_OK 0x2000 /* frame is bad */
158: #define IE_FD_RNR 0x0200 /* receiver out of resources here */
159: #define IE_FD_FLEX 0x0008 /* use flexible buffer scheeme */
160:
161: /*
162: * linked list of buffers...
163: */
164: struct ie_recv_buf_desc {
165: u_short ie_rbd_actual; /* status for this buffer */
166: u_short ie_mbz1;
167: u_int ie_rbd_next; /* pointer to next RBD */
168: u_int ie_rbd_buffer; /* pointer to buffer for this RBD */
169: u_short ie_rbd_length; /* length of the buffer */
170: u_short mbz; /* must be zero */
171: };
172:
173: #define IE_RBD_LAST 0x8000 /* last buffer */
174: #define IE_RBD_USED 0x4000 /* this buffer has data */
175: /*
176: * All commands share this in common.
177: */
178: struct ie_cmd_common {
179: u_short ie_cmd_status; /* status of this command */
180: u_short ie_cmd_cmd; /* command word */
181: u_int ie_cmd_link; /* link to next command */
182: };
183:
184: #define IE_STAT_COMPL 0x8000 /* command is completed */
185: #define IE_STAT_BUSY 0x4000 /* command is running now */
186: #define IE_STAT_OK 0x2000 /* command completed successfully */
187: #define IE_STAT_ABORT 0x1000 /* command was aborted */
188:
189:
190: #define IE_CMD_NOP 0x0000 /* NOP */
191: #define IE_CMD_IASETUP 0x0001 /* initial address setup */
192: #define IE_CMD_CONFIG 0x0002 /* configure command */
193: #define IE_CMD_MCAST 0x0003 /* multicast setup command */
194: #define IE_CMD_XMIT 0x0004 /* transmit command */
195: #define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
196: #define IE_CMD_DUMP 0x0006 /* dump command */
197: #define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
198:
199: #define IE_CMD_LAST 0x8000 /* this is the last command in the list */
200: #define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
201: #define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
202: #define IE_CMD_FLEX 0x0008 /* use flexible format */
203:
204: /*
205: * This is the command to transmit a frame.
206: */
207: struct ie_xmit_cmd {
208: struct ie_cmd_common com; /* common part */
209: #define ie_xmit_status com.ie_cmd_status
210:
211: u_int ie_xmit_desc; /* pointer to buffer descriptor */
212: u_short ie_xmit_count; /* Tcb count field */
213: u_short ie_mbz1;
214: struct ie_en_addr ie_xmit_addr; /* destination address */
215:
216: u_short ie_xmit_length; /* 802.3 length/Ether type field */
217: };
218:
219: #define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
220: #define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
221: #define IE_XS_SQE 0x0040 /* SQE positive */
222: #define IE_XS_DEFERRED 0x0080 /* transmission deferred */
223: #define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
224: #define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
225: #define IE_XS_NOCARRIER 0x0400 /* No Carrier */
226:
227: /*
228: * This is a buffer descriptor for a frame to be transmitted.
229: */
230:
231: struct ie_xmit_buf {
232: u_short ie_xmit_flags; /* see below */
233: u_short mbz1; /* Must be zero */
234: u_int ie_xmit_next; /* pointer to next desc. */
235: u_int ie_xmit_buf; /* pointer to the actual buffer */
236: };
237:
238: #define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
239: /* The rest of the `flags' word is actually the length. */
240:
241: /*
242: * Multicast setup command.
243: */
244:
245: #define MAXMCAST 250 /* must fit in transmit buffer */
246:
247: struct ie_mcast_cmd {
248: struct ie_cmd_common com; /* common part */
249: #define ie_mcast_status com.ie_cmd_status
250:
251: u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
252: struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
253: };
254:
255: /*
256: * Time Domain Reflectometer command.
257: */
258:
259: struct ie_tdr_cmd {
260: struct ie_cmd_common com; /* common part */
261: #define ie_tdr_status com.ie_cmd_status
262:
263: u_short ie_tdr_time; /* error bits and time */
264: u_short ie_mbz1;
265: };
266:
267: #define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
268: #define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
269: #define IE_TDR_OPEN 0x2000 /* detected an open */
270: #define IE_TDR_SHORT 0x1000 /* TDR detected a short */
271: #define IE_TDR_TIME 0x07ff /* mask for reflection time */
272:
273: /*
274: * Initial Address Setup command
275: */
276: struct ie_iasetup_cmd {
277: struct ie_cmd_common com;
278: #define ie_iasetup_status com.ie_cmd_status
279:
280: struct ie_en_addr ie_address;
281:
282: u_short ie_mbz1;
283: };
284:
285: /*
286: * Configuration command
287: */
288: struct ie_config_cmd {
289: struct ie_cmd_common com; /* common part */
290: #define ie_config_status com.ie_cmd_status
291:
292: u_char ie_config_count; /* byte count (0x0c) */
293: u_char ie_fifo; /* fifo (8) */
294: u_char ie_save_bad; /* save bad frames (0x40) */
295: u_char ie_addr_len; /* address length (0x2e) (AL-LOC==1) */
296: u_char ie_priority; /* priority and backoff (0x0) */
297: u_char ie_ifs; /* inter-frame spacing (0x60) */
298: u_char ie_slot_low; /* slot time, LSB (0x0) */
299: u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
300: u_char ie_promisc; /* 1 if promiscuous, else 0 */
301: u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
302: u_char ie_min_len; /* min frame length (0x40) */
303: u_char ie_junk; /* stuff for 82596 (0xff) */
304: u_char ie_dplx;
305: u_char ie_miabf;
306: };
307:
CVSweb