[TG3]: Add tagged status support.
[linux-2.6/verdex.git] / drivers / net / sun3_82586.h
blob81cfb098bccaf22c672e8fdfd89819ed441547d5
1 /*
2 * Intel i82586 Ethernet definitions
4 * This is an extension to the Linux operating system, and is covered by the
5 * same Gnu Public License that covers that work.
7 * copyrights (c) 1994 by Michael Hipp (hippm@informatik.uni-tuebingen.de)
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
15 * Cloned from ni52.h, copyright as above.
17 * Modified for Sun3 OBIO i82586 by Sam Creasey (sammy@sammy.net)
21 /* defines for the obio chip (not vme) */
22 #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 */
31 /* where the obio one lives */
32 #define IE_OBIO 0xc0000
33 #define IE_IRQ 3
36 * where to find the System Configuration Pointer (SCP)
38 #define SCP_DEFAULT_ADDRESS 0xfffff4
42 * System Configuration Pointer Struct
45 struct scp_struct
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 */
57 * Intermediate System Configuration Pointer (ISCP)
59 struct iscp_struct
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 */
68 * System Control Block (SCB)
70 struct scb_struct
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 */
85 * possible command values for the command word
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 */
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 */
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 */
108 * possible status values for the status word
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 */
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 */
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 */
126 * Receive Frame Descriptor (RFD)
128 struct rfd_struct
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 */
136 unsigned char dest[6]; /* ethernet-address, destination */
137 unsigned char source[6]; /* ethernet-address, source */
138 unsigned short length; /* 802.3 frame-length */
139 unsigned short zero_dummy; /* dummy */
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! */
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 */
160 * Receive Buffer Descriptor (RBD)
162 struct rbd_struct
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 */
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 */
176 * Statusvalues for Commands/RFD
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 */
183 * Action-Commands
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 */
195 * Action command bits
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 */
202 * NOP - command
204 struct nop_cmd_struct
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 */
212 * IA Setup command
214 struct iasetup_cmd_struct
216 unsigned short cmd_status;
217 unsigned short cmd_cmd;
218 unsigned short cmd_link;
219 unsigned char iaddr[6];
223 * Configure command
225 struct configure_cmd_struct
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 */
245 * Multicast Setup command
247 struct mcsetup_cmd_struct
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 */
257 * DUMP command
259 struct dump_cmd_struct
261 unsigned short cmd_status;
262 unsigned short cmd_cmd;
263 unsigned short cmd_link;
264 unsigned short dump_offset; /* pointeroffset to DUMP space */
268 * transmit command
270 struct transmit_cmd_struct
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 */
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
290 struct tdr_cmd_struct
292 unsigned short cmd_status;
293 unsigned short cmd_cmd;
294 unsigned short cmd_link;
295 unsigned short status;
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 */
305 * Transmit Buffer Descriptor (TBD)
307 struct tbd_struct
309 unsigned short size; /* size + EOF-Flag(15) */
310 unsigned short next; /* pointeroffset to next TBD */
311 char *buffer; /* pointer to buffer */
314 #define TBD_LAST 0x8000 /* EOF-Flag, indicates last buffer in list */