blob: 79aef681ac85db206d65f0a31944c7ee1a6a3374 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Intel i82586 Ethernet definitions
3 *
4 * This is an extension to the Linux operating system, and is covered by the
5 * same Gnu Public License that covers that work.
6 *
7 * copyrights (c) 1994 by Michael Hipp (hippm@informatik.uni-tuebingen.de)
8 *
9 * I have done a look in the following sources:
10 * crynwr-packet-driver by Russ Nelson
11 * Garret A. Wollman's i82586-driver for BSD
12 */
13
14/*
Jeff Garzik6aa20a22006-09-13 13:24:59 -040015 * Cloned from ni52.h, copyright as above.
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 *
17 * Modified for Sun3 OBIO i82586 by Sam Creasey (sammy@sammy.net)
18 */
19
20
Jeff Garzik6aa20a22006-09-13 13:24:59 -040021/* defines for the obio chip (not vme) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#define IEOB_NORSET 0x80 /* don't reset the board */
23#define IEOB_ONAIR 0x40 /* put us on the air */
24#define IEOB_ATTEN 0x20 /* attention! */
25#define IEOB_IENAB 0x10 /* interrupt enable */
26#define IEOB_XXXXX 0x08 /* free bit */
27#define IEOB_XCVRL2 0x04 /* level 2 transceiver? */
28#define IEOB_BUSERR 0x02 /* bus error */
29#define IEOB_INT 0x01 /* interrupt */
30
31/* where the obio one lives */
32#define IE_OBIO 0xc0000
33#define IE_IRQ 3
34
35/*
36 * where to find the System Configuration Pointer (SCP)
37 */
38#define SCP_DEFAULT_ADDRESS 0xfffff4
39
40
41/*
42 * System Configuration Pointer Struct
43 */
44
45struct scp_struct
46{
47 unsigned short zero_dum0; /* has to be zero */
48 unsigned char sysbus; /* 0=16Bit,1=8Bit */
49 unsigned char zero_dum1; /* has to be zero for 586 */
50 unsigned short zero_dum2;
51 unsigned short zero_dum3;
52 char *iscp; /* pointer to the iscp-block */
53};
54
55
56/*
57 * Intermediate System Configuration Pointer (ISCP)
58 */
59struct iscp_struct
60{
61 unsigned char busy; /* 586 clears after successful init */
62 unsigned char zero_dummy; /* has to be zero */
63 unsigned short scb_offset; /* pointeroffset to the scb_base */
64 char *scb_base; /* base-address of all 16-bit offsets */
65};
66
67/*
68 * System Control Block (SCB)
69 */
70struct scb_struct
71{
72 unsigned char rus;
73 unsigned char cus;
74 unsigned char cmd_ruc; /* command word: RU part */
75 unsigned char cmd_cuc; /* command word: CU part & ACK */
76 unsigned short cbl_offset; /* pointeroffset, command block list */
77 unsigned short rfa_offset; /* pointeroffset, receive frame area */
78 unsigned short crc_errs; /* CRC-Error counter */
79 unsigned short aln_errs; /* allignmenterror counter */
80 unsigned short rsc_errs; /* Resourceerror counter */
81 unsigned short ovrn_errs; /* OVerrunerror counter */
82};
83
84/*
85 * possible command values for the command word
86 */
87#define RUC_MASK 0x0070 /* mask for RU commands */
88#define RUC_NOP 0x0000 /* NOP-command */
89#define RUC_START 0x0010 /* start RU */
90#define RUC_RESUME 0x0020 /* resume RU after suspend */
91#define RUC_SUSPEND 0x0030 /* suspend RU */
92#define RUC_ABORT 0x0040 /* abort receiver operation immediately */
93
94#define CUC_MASK 0x07 /* mask for CU command */
95#define CUC_NOP 0x00 /* NOP-command */
96#define CUC_START 0x01 /* start execution of 1. cmd on the CBL */
97#define CUC_RESUME 0x02 /* resume after suspend */
98#define CUC_SUSPEND 0x03 /* Suspend CU */
99#define CUC_ABORT 0x04 /* abort command operation immediately */
100
101#define ACK_MASK 0xf0 /* mask for ACK command */
102#define ACK_CX 0x80 /* acknowledges STAT_CX */
103#define ACK_FR 0x40 /* ack. STAT_FR */
104#define ACK_CNA 0x20 /* ack. STAT_CNA */
105#define ACK_RNR 0x10 /* ack. STAT_RNR */
106
107/*
108 * possible status values for the status word
109 */
110#define STAT_MASK 0xf0 /* mask for cause of interrupt */
111#define STAT_CX 0x80 /* CU finished cmd with its I bit set */
112#define STAT_FR 0x40 /* RU finished receiving a frame */
113#define STAT_CNA 0x20 /* CU left active state */
114#define STAT_RNR 0x10 /* RU left ready state */
115
116#define CU_STATUS 0x7 /* CU status, 0=idle */
117#define CU_SUSPEND 0x1 /* CU is suspended */
118#define CU_ACTIVE 0x2 /* CU is active */
119
120#define RU_STATUS 0x70 /* RU status, 0=idle */
121#define RU_SUSPEND 0x10 /* RU suspended */
122#define RU_NOSPACE 0x20 /* RU no resources */
123#define RU_READY 0x40 /* RU is ready */
124
125/*
126 * Receive Frame Descriptor (RFD)
127 */
128struct rfd_struct
129{
130 unsigned char stat_low; /* status word */
131 unsigned char stat_high; /* status word */
132 unsigned char rfd_sf; /* 82596 mode only */
133 unsigned char last; /* Bit15,Last Frame on List / Bit14,suspend */
134 unsigned short next; /* linkoffset to next RFD */
135 unsigned short rbd_offset; /* pointeroffset to RBD-buffer */
Joe Perches1409a932013-08-01 16:17:49 -0700136 unsigned char dest[ETH_ALEN]; /* ethernet-address, destination */
137 unsigned char source[ETH_ALEN]; /* ethernet-address, source */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 unsigned short length; /* 802.3 frame-length */
139 unsigned short zero_dummy; /* dummy */
140};
141
142#define RFD_LAST 0x80 /* last: last rfd in the list */
143#define RFD_SUSP 0x40 /* last: suspend RU after */
144#define RFD_COMPL 0x80
145#define RFD_OK 0x20
146#define RFD_BUSY 0x40
147#define RFD_ERR_LEN 0x10 /* Length error (if enabled length-checking */
148#define RFD_ERR_CRC 0x08 /* CRC error */
149#define RFD_ERR_ALGN 0x04 /* Alignment error */
150#define RFD_ERR_RNR 0x02 /* status: receiver out of resources */
151#define RFD_ERR_OVR 0x01 /* DMA Overrun! */
152
153#define RFD_ERR_FTS 0x0080 /* Frame to short */
154#define RFD_ERR_NEOP 0x0040 /* No EOP flag (for bitstuffing only) */
155#define RFD_ERR_TRUN 0x0020 /* (82596 only/SF mode) indicates truncated frame */
156#define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matches IA (only 82596) */
157#define RFD_COLLDET 0x0001 /* Detected collision during reception */
158
159/*
160 * Receive Buffer Descriptor (RBD)
161 */
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400162struct rbd_struct
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163{
164 unsigned short status; /* status word,number of used bytes in buff */
165 unsigned short next; /* pointeroffset to next RBD */
166 char *buffer; /* receive buffer address pointer */
167 unsigned short size; /* size of this buffer */
168 unsigned short zero_dummy; /* dummy */
169};
170
171#define RBD_LAST 0x8000 /* last buffer */
172#define RBD_USED 0x4000 /* this buffer has data */
173#define RBD_MASK 0x3fff /* size-mask for length */
174
175/*
176 * Statusvalues for Commands/RFD
177 */
178#define STAT_COMPL 0x8000 /* status: frame/command is complete */
179#define STAT_BUSY 0x4000 /* status: frame/command is busy */
180#define STAT_OK 0x2000 /* status: frame/command is ok */
181
182/*
183 * Action-Commands
184 */
185#define CMD_NOP 0x0000 /* NOP */
186#define CMD_IASETUP 0x0001 /* initial address setup command */
187#define CMD_CONFIGURE 0x0002 /* configure command */
188#define CMD_MCSETUP 0x0003 /* MC setup command */
189#define CMD_XMIT 0x0004 /* transmit command */
190#define CMD_TDR 0x0005 /* time domain reflectometer (TDR) command */
191#define CMD_DUMP 0x0006 /* dump command */
192#define CMD_DIAGNOSE 0x0007 /* diagnose command */
193
194/*
195 * Action command bits
196 */
197#define CMD_LAST 0x8000 /* indicates last command in the CBL */
198#define CMD_SUSPEND 0x4000 /* suspend CU after this CB */
199#define CMD_INT 0x2000 /* generate interrupt after execution */
200
201/*
202 * NOP - command
203 */
204struct nop_cmd_struct
205{
206 unsigned short cmd_status; /* status of this command */
207 unsigned short cmd_cmd; /* the command itself (+bits) */
208 unsigned short cmd_link; /* offsetpointer to next command */
209};
210
211/*
212 * IA Setup command
213 */
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400214struct iasetup_cmd_struct
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215{
216 unsigned short cmd_status;
217 unsigned short cmd_cmd;
218 unsigned short cmd_link;
219 unsigned char iaddr[6];
220};
221
222/*
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400223 * Configure command
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 */
225struct configure_cmd_struct
226{
227 unsigned short cmd_status;
228 unsigned short cmd_cmd;
229 unsigned short cmd_link;
230 unsigned char byte_cnt; /* size of the config-cmd */
231 unsigned char fifo; /* fifo/recv monitor */
232 unsigned char sav_bf; /* save bad frames (bit7=1)*/
233 unsigned char adr_len; /* adr_len(0-2),al_loc(3),pream(4-5),loopbak(6-7)*/
234 unsigned char priority; /* lin_prio(0-2),exp_prio(4-6),bof_metd(7) */
235 unsigned char ifs; /* inter frame spacing */
236 unsigned char time_low; /* slot time low */
237 unsigned char time_high; /* slot time high(0-2) and max. retries(4-7) */
238 unsigned char promisc; /* promisc-mode(0) , et al (1-7) */
239 unsigned char carr_coll; /* carrier(0-3)/collision(4-7) stuff */
240 unsigned char fram_len; /* minimal frame len */
241 unsigned char dummy; /* dummy */
242};
243
244/*
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400245 * Multicast Setup command
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 */
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400247struct mcsetup_cmd_struct
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248{
249 unsigned short cmd_status;
250 unsigned short cmd_cmd;
251 unsigned short cmd_link;
252 unsigned short mc_cnt; /* number of bytes in the MC-List */
253 unsigned char mc_list[0][6]; /* pointer to 6 bytes entries */
254};
255
256/*
257 * DUMP command
258 */
259struct dump_cmd_struct
260{
261 unsigned short cmd_status;
262 unsigned short cmd_cmd;
263 unsigned short cmd_link;
264 unsigned short dump_offset; /* pointeroffset to DUMP space */
265};
266
267/*
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400268 * transmit command
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269 */
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400270struct transmit_cmd_struct
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271{
272 unsigned short cmd_status;
273 unsigned short cmd_cmd;
274 unsigned short cmd_link;
275 unsigned short tbd_offset; /* pointeroffset to TBD */
276 unsigned char dest[6]; /* destination address of the frame */
277 unsigned short length; /* user defined: 802.3 length / Ether type */
278};
279
280#define TCMD_ERRMASK 0x0fa0
281#define TCMD_MAXCOLLMASK 0x000f
282#define TCMD_MAXCOLL 0x0020
283#define TCMD_HEARTBEAT 0x0040
284#define TCMD_DEFERRED 0x0080
285#define TCMD_UNDERRUN 0x0100
286#define TCMD_LOSTCTS 0x0200
287#define TCMD_NOCARRIER 0x0400
288#define TCMD_LATECOLL 0x0800
289
290struct tdr_cmd_struct
291{
292 unsigned short cmd_status;
293 unsigned short cmd_cmd;
294 unsigned short cmd_link;
295 unsigned short status;
296};
297
298#define TDR_LNK_OK 0x8000 /* No link problem identified */
299#define TDR_XCVR_PRB 0x4000 /* indicates a transceiver problem */
300#define TDR_ET_OPN 0x2000 /* open, no correct termination */
301#define TDR_ET_SRT 0x1000 /* TDR detected a short circuit */
302#define TDR_TIMEMASK 0x07ff /* mask for the time field */
303
304/*
305 * Transmit Buffer Descriptor (TBD)
306 */
307struct tbd_struct
308{
309 unsigned short size; /* size + EOF-Flag(15) */
310 unsigned short next; /* pointeroffset to next TBD */
311 char *buffer; /* pointer to buffer */
312};
313
314#define TBD_LAST 0x8000 /* EOF-Flag, indicates last buffer in list */
315
316
317
318