1 /*
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 (mhipp@student.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
15 #define NI52_RESET 0 /* writing to this address, resets the i82586 */
16 #define NI52_ATTENTION 1 /* channel attention, kick the 586 */
17 #define NI52_TENA 3 /* 2-5 possibly wrong, Xmit enable */
18 #define NI52_TDIS 2 /* Xmit disable */
19 #define NI52_INTENA 5 /* Interrupt enable */
20 #define NI52_INTDIS 4 /* Interrupt disable */
21 #define NI52_MAGIC1 6 /* dunno exact function */
22 #define NI52_MAGIC2 7 /* dunno exact function */
23
24 #define NI52_MAGICVAL1 0x00 /* magic-values for ni5210 card */
25 #define NI52_MAGICVAL2 0x55
26
27 /*
28 * where to find the System Configuration Pointer (SCP)
29 */
30 #define SCP_DEFAULT_ADDRESS 0xfffff4
31
32
33 /*
34 * System Configuration Pointer Struct
35 */
36
37 struct scp_struct
38 {
39 unsigned short zero_dum0; /* has to be zero */
40 unsigned char sysbus; /* 0=16Bit,1=8Bit */
41 unsigned char zero_dum1; /* has to be zero for 586 */
42 unsigned short zero_dum2;
43 unsigned short zero_dum3;
44 char *iscp; /* pointer to the iscp-block */
45 };
46
47
48 /*
49 * Intermediate System Configuration Pointer (ISCP)
50 */
51 struct iscp_struct
52 {
53 unsigned char busy; /* 586 clears after successful init */
54 unsigned char zero_dummy; /* hast to be zero */
55 unsigned short scb_offset; /* pointeroffset to the scb_base */
56 char *scb_base; /* base-address of all 16-bit offsets */
57 };
58
59 /*
60 * System Control Block (SCB)
61 */
62 struct scb_struct
63 {
64 unsigned short status; /* status word */
65 unsigned short cmd; /* command word */
66 unsigned short cbl_offset; /* pointeroffset, command block list */
67 unsigned short rfa_offset; /* pointeroffset, receive frame area */
68 unsigned short crc_errs; /* CRC-Error counter */
69 unsigned short aln_errs; /* allignmenterror counter */
70 unsigned short rsc_errs; /* Resourceerror counter */
71 unsigned short ovrn_errs; /* OVerrunerror counter */
72 };
73
74 /*
75 * possible command values for the command word
76 */
77 #define RUC_MASK 0x0070 /* mask for RU commands */
78 #define RUC_NOP 0x0000 /* NOP-command */
79 #define RUC_START 0x0010 /* start RU */
80 #define RUC_RESUME 0x0020 /* resume RU after suspend */
81 #define RUC_SUSPEND 0x0030 /* suspend RU */
82 #define RUC_ABORT 0x0040 /* abort receiver operation immediately */
83
84 #define CUC_MASK 0x0700 /* mask for CU command */
85 #define CUC_NOP 0x0000 /* NOP-command */
86 #define CUC_START 0x0100 /* start execution of 1. cmd on the CBL */
87 #define CUC_RESUME 0x0200 /* resume after suspend */
88 #define CUC_SUSPEND 0x0300 /* Suspend CU */
89 #define CUC_ABORT 0x0400 /* abort command operation immediately */
90
91 #define ACK_MASK 0xf000 /* mask for ACK command */
92 #define ACK_CX 0x8000 /* acknowledges STAT_CX */
93 #define ACK_FR 0x4000 /* ack. STAT_FR */
94 #define ACK_CNA 0x2000 /* ack. STAT_CNA */
95 #define ACK_RNR 0x1000 /* ack. STAT_RNR */
96
97 /*
98 * possible status values for the status word
99 */
100 #define STAT_MASK 0xf000 /* mask for cause of interrupt */
101 #define STAT_CX 0x8000 /* CU finished cmd with its I bit set */
102 #define STAT_FR 0x4000 /* RU finished receiving a frame */
103 #define STAT_CNA 0x2000 /* CU left active state */
104 #define STAT_RNR 0x1000 /* RU left ready state */
105
106 #define CU_STATUS 0x700 /* CU status, 0=idle */
107 #define CU_SUSPEND 0x100 /* CU is suspended */
108 #define CU_ACTIVE 0x200 /* CU is active */
109
110 #define RU_STATUS 0x70 /* RU status, 0=idle */
111 #define RU_SUSPEND 0x10 /* RU suspended */
112 #define RU_NOSPACE 0x20 /* RU no resources */
113 #define RU_READY 0x40 /* RU is ready */
114
115 /*
116 * Receive Frame Descriptor (RFD)
117 */
118 struct rfd_struct
119 {
120 unsigned short status; /* status word */
121 unsigned short last; /* Bit15,Last Frame on List / Bit14,suspend */
122 unsigned short next; /* linkoffset to next RFD */
123 unsigned short rbd_offset; /* pointeroffset to RBD-buffer */
124 unsigned char dest[6]; /* ethernet-address, destination */
125 unsigned char source[6]; /* ethernet-address, source */
126 unsigned short length; /* 802.3 frame-length */
127 unsigned short zero_dummy; /* dummy */
128 };
129
130 #define RFD_LAST 0x8000 /* last: last rfd in the list */
131 #define RFD_SUSP 0x4000 /* last: suspend RU after */
132 #define RFD_ERRMASK 0x0fe1 /* status: errormask */
133 #define RFD_MATCHADD 0x0002 /* status: Destinationaddress !matches IA */
134 #define RFD_RNR 0x0200 /* status: receiver out of resources */
135
136 /*
137 * Receive Buffer Descriptor (RBD)
138 */
139 struct rbd_struct
140 {
141 unsigned short status; /* status word,number of used bytes in buff */
142 unsigned short next; /* pointeroffset to next RBD */
143 char *buffer; /* receive buffer address pointer */
144 unsigned short size; /* size of this buffer */
145 unsigned short zero_dummy; /* dummy */
146 };
147
148 #define RBD_LAST 0x8000 /* last buffer */
149 #define RBD_USED 0x4000 /* this buffer has data */
150 #define RBD_MASK 0x3fff /* size-mask for length */
151
152 /*
153 * Statusvalues for Commands/RFD
154 */
155 #define STAT_COMPL 0x8000 /* status: frame/command is complete */
156 #define STAT_BUSY 0x4000 /* status: frame/command is busy */
157 #define STAT_OK 0x2000 /* status: frame/command is ok */
158
159 /*
160 * Action-Commands
161 */
162 #define CMD_NOP 0x0000 /* NOP */
163 #define CMD_IASETUP 0x0001 /* initial address setup command */
164 #define CMD_CONFIGURE 0x0002 /* configure command */
165 #define CMD_MCSETUP 0x0003 /* MC setup command */
166 #define CMD_XMIT 0x0004 /* transmit command */
167 #define CMD_TDR 0x0005 /* time domain reflectometer (TDR) command */
168 #define CMD_DUMP 0x0006 /* dump command */
169 #define CMD_DIAGNOSE 0x0007 /* diagnose command */
170
171 /*
172 * Action command bits
173 */
174 #define CMD_LAST 0x8000 /* indicates last command in the CBL */
175 #define CMD_SUSPEND 0x4000 /* suspend CU after this CB */
176 #define CMD_INT 0x2000 /* generate interrupt after execution */
177
178 /*
179 * NOP - command
180 */
181 struct nop_cmd_struct
182 {
183 unsigned short cmd_status; /* status of this command */
184 unsigned short cmd_cmd; /* the command itself (+bits) */
185 unsigned short cmd_link; /* offsetpointer to next command */
186 };
187
188 /*
189 * IA Setup command
190 */
191 struct iasetup_cmd_struct
192 {
193 unsigned short cmd_status;
194 unsigned short cmd_cmd;
195 unsigned short cmd_link;
196 unsigned char iaddr[6];
197 };
198
199 /*
200 * Configure command
201 */
202 struct configure_cmd_struct
203 {
204 unsigned short cmd_status;
205 unsigned short cmd_cmd;
206 unsigned short cmd_link;
207 unsigned char byte_cnt; /* size of the config-cmd */
208 unsigned char fifo; /* fifo/recv monitor */
209 unsigned char sav_bf; /* save bad frames (bit7=1)*/
210 unsigned char adr_len; /* adr_len(0-2),al_loc(3),pream(4-5),loopbak(6-7)*/
211 unsigned char priority; /* lin_prio(0-2),exp_prio(4-6),bof_metd(7) */
212 unsigned char ifs; /* inter frame spacing */
213 unsigned char time_low; /* slot time low */
214 unsigned char time_high; /* slot time high(0-2) and max. retries(4-7) */
215 unsigned char promisc; /* promisc-mode(0) , et al (1-7) */
216 unsigned char carr_coll; /* carrier(0-3)/collision(4-7) stuff */
217 unsigned char fram_len; /* minimal frame len */
218 unsigned char dummy; /* dummy */
219 };
220
221 /*
222 * Multicast Setup command
223 */
224 struct mcsetup_cmd_struct
225 {
226 unsigned short cmd_status;
227 unsigned short cmd_cmd;
228 unsigned short cmd_link;
229 unsigned short mc_cnt; /* number of bytes in the MC-List */
230 unsigned char mc_list[0][6]; /* pointer to 6 bytes entries */
231 };
232
233 /*
234 * transmit command
235 */
236 struct transmit_cmd_struct
237 {
238 unsigned short cmd_status;
239 unsigned short cmd_cmd;
240 unsigned short cmd_link;
241 unsigned short tbd_offset; /* pointeroffset to TBD */
242 unsigned char dest[6]; /* destination address of the frame */
243 unsigned short length; /* user defined: 802.3 length / Ether type */
244 };
245
246 #define TCMD_ERRMASK 0x0fa0
247 #define TCMD_MAXCOLLMASK 0x000f
248 #define TCMD_MAXCOLL 0x0020
249 #define TCMD_HEARTBEAT 0x0040
250 #define TCMD_DEFERRED 0x0080
251 #define TCMD_UNDERRUN 0x0100
252 #define TCMD_LOSTCTS 0x0200
253 #define TCMD_NOCARRIER 0x0400
254 #define TCMD_LATECOLL 0x0800
255
256 struct tdr_cmd_struct
257 {
258 unsigned short cmd_status;
259 unsigned short cmd_cmd;
260 unsigned short cmd_link;
261 unsigned short status;
262 };
263
264 #define TDR_LNK_OK 0x8000 /* No link problem identified */
265 #define TDR_XCVR_PRB 0x4000 /* indicates a transceiver problem */
266 #define TDR_ET_OPN 0x2000 /* open, no correct termination */
267 #define TDR_ET_SRT 0x1000 /* TDR detected a short circuit */
268 #define TDR_TIMEMASK 0x07ff /* mask for the time field */
269
270 /*
271 * Transmit Buffer Descriptor (TBD)
272 */
273 struct tbd_struct
274 {
275 unsigned short size; /* size + EOF-Flag(15) */
276 unsigned short next; /* pointeroffset to next TBD */
277 char *buffer; /* pointer to buffer */
278 };
279
280 #define TBD_LAST 0x8000 /* EOF-Flag, indicates last buffer in list */
281
282
283
284