|
|
1.1 root 1: /* @(#)if_iereg.h 1.1 86/02/03 SMI */
2:
3: /*
4: * Copyright (c) 1984 by Sun Microsystems, Inc.
5: */
6:
7: /*
8: * Control block definitions for Intel 82586 (Ethernet) chip
9: * All fields are byte-swapped because the damn chip wants bytes
10: * in Intel byte order only, so we swap everything going to it.
11: */
12:
13: /* byte-swapped data types */
14: typedef u_short ieoff_t; /* control block offsets from iscp cbbase */
15: #define IENORBD 0xffff /* null pointer for rbd */
16: typedef short ieint_t; /* 16 bit integers */
17: typedef long ieaddr_t; /* data (24-bit) addresses */
18:
19: /*
20: * System Configuration Pointer
21: * Must be at 0xFFFFF6 in chip's address space
22: */
23: #define IESCPADDR 0xFFFFF6
24: struct iescp {
25: char ie_sysbus; /* bus width: 0 => 16, 1 => 8 */
26: char ie_junk1[5]; /* unused */
27: ieaddr_t ie_iscp; /* address of iscp */
28: };
29:
30: /*
31: * Intermediate System Configuration Pointer
32: * Specifies base of all other control blocks and the offset of the SCB
33: */
34: struct ieiscp {
35: char ie_busy; /* 1 => initialization in progress */
36: char ie_junk2; /* unused */
37: ieoff_t ie_scb; /* offset of SCB */
38: ieaddr_t ie_cbbase; /* base of all control blocks */
39: };
40:
41: /*
42: * System Control Block - the focus of communication
43: */
44: struct iescb {
45: u_char : 1; /* mbz */
46: u_char ie_rus : 3; /* receive unit status */
47: u_char : 4; /* mbz */
48: u_char ie_cx : 1; /* command done (interrupt) */
49: u_char ie_fr : 1; /* frame received (interrupt) */
50: u_char ie_cnr : 1; /* command unit not ready */
51: u_char ie_rnr : 1; /* receive unit not ready */
52: u_char : 1; /* mbz */
53: u_char ie_cus : 3; /* command unit status */
54: short ie_cmd; /* command word */
55: ieoff_t ie_cbl; /* command list */
56: ieoff_t ie_rfa; /* receive frame area */
57: ieint_t ie_crcerrs; /* count of CRC errors */
58: ieint_t ie_alnerrs; /* count of alignment errors */
59: ieint_t ie_rscerrs; /* count of discarded packets */
60: ieint_t ie_ovrnerrs; /* count of overrun packets */
61: #ifdef KERNEL
62: int ie_magic; /* for checking overwrite bug */
63: #define IEMAGIC 0x051956
64: #endif
65: };
66:
67: /* ie_rus */
68: #define IERUS_IDLE 0
69: #define IERUS_SUSPENDED 1
70: #define IERUS_NORESOURCE 2
71: #define IERUS_READY 4
72:
73: /* ie_cus */
74: #define IECUS_IDLE 0
75: #define IECUS_SUSPENDED 1
76: #define IECUS_READY 2
77:
78: /* ie_cmd */
79: #define IECMD_RESET 0x8000 /* reset chip */
80: #define IECMD_RU_START (1<<12) /* start receiver unit */
81: #define IECMD_RU_RESUME (2<<12) /* resume receiver unit */
82: #define IECMD_RU_SUSPEND (3<<12) /* suspend receiver unit */
83: #define IECMD_RU_ABORT (4<<12) /* abort receiver unit */
84: #define IECMD_ACK_CX 0x80 /* ack command executed */
85: #define IECMD_ACK_FR 0x40 /* ack frame received */
86: #define IECMD_ACK_CNR 0x20 /* ack CU not ready */
87: #define IECMD_ACK_RNR 0x10 /* ack RU not ready */
88: #define IECMD_CU_START 1 /* start receiver unit */
89: #define IECMD_CU_RESUME 2 /* resume receiver unit */
90: #define IECMD_CU_SUSPEND 3 /* suspend receiver unit */
91: #define IECMD_CU_ABORT 4 /* abort receiver unit */
92:
93: /*
94: * Generic command block
95: */
96: struct iecb {
97: u_char : 8; /* part of status */
98: u_char ie_done : 1; /* command done */
99: u_char ie_busy : 1; /* command busy */
100: u_char ie_ok : 1; /* command successful */
101: u_char ie_aborted : 1; /* command aborted */
102: u_char : 4; /* more status */
103: u_char : 5; /* unused */
104: u_char ie_cmd : 3; /* command # */
105: u_char ie_el : 1; /* end of list */
106: u_char ie_susp : 1; /* suspend when done */
107: u_char ie_intr : 1; /* interrupt when done */
108: u_char : 5; /* unused */
109: ieoff_t ie_next; /* next CB */
110: };
111:
112: /*
113: * CB commands (ie_cmd)
114: */
115: #define IE_NOP 0
116: #define IE_IADDR 1 /* individual address setup */
117: #define IE_CONFIG 2 /* configure */
118: #define IE_MADDR 3 /* multicast address setup */
119: #define IE_TRANSMIT 4 /* transmit */
120: #define IE_TDR 5 /* TDR test */
121: #define IE_DUMP 6 /* dump registers */
122: #define IE_DIAGNOSE 7 /* internal diagnostics */
123:
124: /*
125: * TDR command block
126: */
127: struct ietdr {
128: struct iecb ietdr_cb; /* common command block */
129: u_char ietdr_timlo: 8; /* time */
130: u_char ietdr_ok : 1; /* link OK */
131: u_char ietdr_xcvr : 1; /* transceiver bad */
132: u_char ietdr_open : 1; /* cable open */
133: u_char ietdr_shrt : 1; /* cable shorted */
134: u_char : 1;
135: u_char ietdr_timhi: 3; /* time */
136: };
137:
138: /*
139: * Individual address setup command block
140: */
141: struct ieiaddr {
142: struct iecb ieia_cb; /* common command block */
143: char ieia_addr[6]; /* the actual address */
144: };
145:
146: /*
147: * Configure command
148: */
149: struct ieconf {
150: struct iecb ieconf_cb; /* command command block */
151: u_char : 4;
152: u_char ieconf_bytes : 4; /* # of conf bytes */
153: u_char : 4;
154: u_char ieconf_fifolim : 4; /* fifo limit */
155: u_char ieconf_savbf : 1; /* save bad frames */
156: u_char ieconf_srdy : 1; /* srdy/ardy (?) */
157: u_char : 6;
158: u_char ieconf_extlp : 1; /* external loopback */
159: u_char ieconf_intlp : 1; /* external loopback */
160: u_char ieconf_pream : 2; /* preamble length code */
161: u_char ieconf_acloc : 1; /* addr&type fields separate */
162: u_char ieconf_alen : 3; /* address length */
163: u_char ieconf_bof : 1; /* backoff method */
164: u_char ieconf_exprio : 3; /* exponential prio */
165: u_char : 1;
166: u_char ieconf_linprio : 3; /* linear prio */
167: u_char ieconf_space : 8; /* interframe spacing */
168: u_char ieconf_slttml : 8; /* low bits of slot time */
169: u_char ieconf_retry : 4; /* # xmit retries */
170: u_char : 1;
171: u_char ieconf_slttmh : 3; /* high bits of slot time */
172: u_char ieconf_pad : 1; /* flag padding */
173: u_char ieconf_hdlc : 1; /* HDLC framing */
174: u_char ieconf_crc16 : 1; /* CRC type */
175: u_char ieconf_nocrc : 1; /* disable CRC appending */
176: u_char ieconf_nocarr : 1; /* no carrier OK */
177: u_char ieconf_manch : 1; /* Manchester encoding */
178: u_char ieconf_nobrd : 1; /* broadcast disable */
179: u_char ieconf_promisc : 1; /* promiscuous mode */
180: u_char ieconf_cdsrc : 1; /* CD source */
181: u_char ieconf_cdfilt : 3; /* CD filter bits (?) */
182: u_char ieconf_crsrc : 1; /* carrier source */
183: u_char ieconf_crfilt : 3; /* carrier filter bits */
184: u_char ieconf_minfrm : 8; /* min frame length */
185: u_char : 8;
186: };
187:
188: /*
189: * Receive frame descriptor
190: */
191: struct ierfd {
192: u_char ierfd_short : 1; /* short frame */
193: u_char ierfd_noeof : 1; /* no EOF (bitstuffing mode only) */
194: u_char : 6; /* unused */
195: u_char ierfd_done : 1; /* command done */
196: u_char ierfd_busy : 1; /* command busy */
197: u_char ierfd_ok : 1; /* command successful */
198: u_char : 1; /* unused */
199: u_char ierfd_crcerr : 1; /* crc error */
200: u_char ierfd_align : 1; /* alignment error */
201: u_char ierfd_nospace : 1; /* out of buffer space */
202: u_char ierfd_overrun : 1; /* DMA overrun */
203: u_char : 8; /* unused */
204: u_char ierfd_el : 1; /* end of list */
205: u_char ierfd_susp : 1; /* suspend when done */
206: u_char : 6; /* unused */
207: ieoff_t ierfd_next; /* next RFD */
208: ieoff_t ierfd_rbd; /* pointer to buffer descriptor */
209: u_char ierfd_dhost[6]; /* destination address field */
210: u_char ierfd_shost[6]; /* source address field */
211: u_short ierfd_type; /* Ethernet packet type field */
212: };
213:
214: /*
215: * Receive buffer descriptor
216: */
217: struct ierbd {
218: u_char ierbd_cntlo : 8; /* Low order 8 bits of count */
219: u_char ierbd_eof : 1; /* last buffer for this packet */
220: u_char ierbd_used : 1; /* EDLC sets when buffer is used */
221: u_char ierbd_cnthi : 6; /* High order 6 bits of count */
222: ieoff_t ierbd_next; /* next RBD */
223: ieaddr_t ierbd_buf; /* pointer to buffer */
224: u_char ierbd_sizelo : 8; /* Low order 8 bits of buffer size */
225: u_char ierbd_el : 1; /* end-of-list if set */
226: u_char : 1; /* unused */
227: u_char ierbd_sizehi : 6; /* High order 6 bits of buffer size */
228: #ifdef KERNEL
229: struct ieipack *ierbd_iep; /* ptr to data packet descriptor */
230: #endif
231: };
232:
233: /*
234: * Transmit frame descriptor ( Transmit command block )
235: */
236: struct ietfd {
237: u_char ietfd_defer : 1; /* transmission deferred */
238: u_char ietfd_heart : 1; /* Heartbeat */
239: u_char ietfd_xcoll : 1; /* Too many collisions */
240: u_char : 1; /* unused */
241: u_char ietfd_ncoll : 4; /* Number of collisions */
242: u_char ietfd_done : 1; /* command done */
243: u_char ietfd_busy : 1; /* command busy */
244: u_char ietfd_ok : 1; /* command successful */
245: u_char ietfd_aborted : 1; /* command aborted */
246: u_char : 1; /* unused */
247: u_char ietfd_nocarr : 1; /* No carrier sense */
248: u_char ietfd_nocts : 1; /* Lost Clear to Send */
249: u_char ietfd_underrun : 1; /* DMA underrun */
250: u_char : 5; /* unused */
251: u_char ietfd_cmd : 3; /* command # */
252: u_char ietfd_el : 1; /* end of list */
253: u_char ietfd_susp : 1; /* suspend when done */
254: u_char ietfd_intr : 1; /* interrupt when done */
255: u_char : 5; /* unused */
256: ieoff_t ietfd_next; /* next RFD */
257: ieoff_t ietfd_tbd; /* pointer to buffer descriptor */
258: u_char ietfd_dhost[6]; /* destination address field */
259: u_short ietfd_type; /* Ethernet packet type field */
260: #ifdef KERNEL
261: struct mbuf *ietfd_mbuf; /* associated mbuf chain */
262: #endif
263: };
264:
265: /*
266: * Transmit buffer descriptor
267: */
268: struct ietbd {
269: u_char ietbd_cntlo : 8; /* Low order 8 bits of count */
270: u_char ietbd_eof : 1; /* last buffer for this packet */
271: u_char : 1; /* unused */
272: u_char ietbd_cnthi : 6; /* High order 6 bits of count */
273: ieoff_t ietbd_next; /* next TBD */
274: ieaddr_t ietbd_buf; /* pointer to buffer */
275: #ifdef KERNEL
276: short ietbd_memlen; /* memory size for data copy */
277: #endif
278: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.