xref: /original-bsd/sys/i386/isa/if_ecreg.h (revision edc2ab72)
1 /*
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)if_ecreg.h	8.1 (Berkeley) 06/11/93
8  */
9 /*
10  * Device definitions for the i82586 generally and the 3com ec507
11  * ISA bus ethernet controller.
12  */
13 /*
14  * Intermediate System Control Block pointer
15  */
16 struct	ec_iscp {
17 	u_short	busy;
18 	u_short	scb_off;
19 	caddr_t	scb_base;
20 };
21 /*
22  * System Control Block
23  */
24 struct	ec_scb {
25 	u_short status;
26 #define CX		0x8000
27 #define FR		0x4000
28 #define CNA		0x2000
29 #define RNR		0x1000
30 #define CU_STATE	0x700
31 #define	CUS_IDLE	0x000
32 #define	CUS_SUSPENDED	0x100
33 #define	CUS_ACTIVE	0x200
34 #define RU_STATE	0x70
35 #define	RUS_IDLE	0x00
36 #define	RUS_SUSPENDED	0x10
37 #define	RUS_OVERRUN	0x20
38 #define	RUS_READY	0x40
39 	u_short command;
40 #define	CU_NOP		0
41 #define CU_START	0x100
42 #define RU_NOP		0
43 #define	RU_START	0x100
44 #define	RU_ABORT	0x400
45 #define	ACK_CX		0x8000
46 #define	ACK_RX		0x4000
47 #define ACK_CNA		0x2000
48 #define ACK_RNR		0x1000
49 	u_short	cbl_off;
50 	u_short	rfa_off;
51 	struct	errors {
52 		u_short crc;
53 		u_short alignment;
54 		u_short resource;
55 		u_short overrun;
56 	} scb_errs;
57 };
58 
59 /*
60  * Individual Address Setup
61  */
62 struct ec_iasetup {
63 	u_short	com0;
64 #define	COM0_A	0x1000
65 #define	COM0_OK	0x2000
66 #define	COM0_B	0x4000
67 #define	COM0_C	0x8000
68 	u_short	com1;
69 #define	COM1_IASETUP	0x1
70 #define	COM1_I	0x2000
71 #define	COM1_S	0x4000
72 #define	COM1_EL	0x8000
73 	u_short	next_off;
74 	u_char	srcaddr[6];
75 };
76 
77 /*
78  * Load Multicast Addresses
79  */
80 
81 struct ec_mcsetup {
82 	u_short	com0;
83 	u_short	com1;
84 #define COM1_MCSETUP	0x3
85 	u_short	next_off;
86 	u_short	count;		/* number of bytes, 14 bits only */
87 	/* char	mcaddrs[6];	/* white lie, data goes here */
88 };
89 
90 /*
91  * Transmit Command
92  */
93 struct	ec_transmit {
94 	u_short com0;
95 #define COLLISIONS(p) (p->com0 & 0xf)
96 #define EXCOL		0x10	/* Excessive Collisions, Aborted */
97 #define HEARTBEAT	0x20	/* CDT signal monitored and OK (good) */
98 #define TXDEFFERED	0x40	/* ``due to Previous Link Activity'' */
99 #define	DMALATE		0x80	/* DMA underrun */
100 #define	NOCTS		0x100	/* Transmission stopped due to ... */
101 #define	NOCARSENSE	0x200	/* Loss of Carrier sense during TX */
102 #define	LATECOLL	0x400	/* Late Collision detected */
103 #define TXERRS		0x7d0	/* Various Bad Things */
104 	u_short	com1;
105 #define COM1_TRANSMIT	0x4
106 	u_short	next_off;
107 	u_short tbd_off;
108 	u_char	dstaddr[6];
109 	u_short	proto;		/* Length for 802.3 */
110 /*
111  * };	 struct	ec_tba {
112  *
113  * Transmit Buffer Descriptor
114  * This really should be a separate structure,
115  * but it will be convenient to lump them together.
116  */
117 	u_short	count;
118 	u_short next_tbd_off;
119 	caddr_t	buffer;
120 };
121 
122 /*
123  * Receive Frame Descriptor
124  */
125 struct	ec_rfd {
126 	u_short	rfd0;
127 	u_short rfd1;
128 	u_short	next_off;
129 	u_short rbd_off;
130 	struct	ether_header eh;
131 	u_short	mbz;
132 /*
133  * };	struct	ec_rbd {
134  *
135  * Receive Buffer Descriptor
136  */
137 	u_short	count;
138 #define RBD_EOF	0x8000
139 #define RBD_F	0x4000
140 	u_short	next_rbd_off;
141 	caddr_t	buffer;
142 	u_short	size;
143 	u_short	mbz2;
144 };
145 
146 /*
147  * Set Operating Parameters
148  */
149 struct	ec_82586params {
150 	u_char	count;
151 	u_char	fifolimit;
152 	u_char	save_bad_frames;
153 	u_char	data1;		/* addr len, no src ins, lpbk, prmble */
154 	u_char	priority;
155 	u_char	ifspacing;
156 	u_char	mbz1;
157 	u_char	data2;		/* max restries, slot time high */
158 	u_char	promisc;	/* brddis, mnch/nrz, tnocr, crc16, bstf, pad */
159 #define M_PROMISC 1
160 #define M_TNOCR 8
161 	u_char	cdf_cds;	/* carrier detect/sense filter(length) & src */
162 	u_char	min_frame_len;
163 	u_char	mbz2[3];
164 };
165 
166 struct	ec_configure {
167 	u_short	com0;
168 	u_short com1;
169 #define COM1_CONFIGURE	0x2
170 	u_short next_off;
171 	struct ec_82586params modes;
172 };
173 #define ECMTU	1518
174 #define ECMINSIZE 64
175 #define NTXBUF	2
176 #define	NRXBUF	8
177 
178 struct	ec_mem {
179 	struct	ec_iscp iscp;
180 	struct	ec_scb scb;
181 	struct	ec_transmit tcom[NTXBUF];
182 	struct	ec_rfd rcom[NRXBUF];
183 	struct	ec_configure config;
184 	struct	ec_iasetup iasetup;
185 	struct	ec_mcsetup mcsetup;
186 	char	txbuf[NTXBUF][ECMTU];
187 	char	rxbuf[NRXBUF][ECMTU];
188 };
189 
190 struct ec_ports {
191 	u_char	data[6];
192 	u_char	creg;
193 #define R_ECID	0x00
194 #define R_ETHER	0x01
195 #define R_REV	0x02
196 #define R_IEN	0x04
197 #define R_INT	0x08
198 #define R_LAD	0x10
199 #define R_LPB	0x20
200 #define R_CA	0x40
201 #define R_NORST	0x80
202 	u_char	mbz0[3];
203 	u_char	port_ic;
204 	u_char	port_ca;
205 	u_char	mbz1;
206 	u_char	rom_conf;
207 	u_char	ram_conf;
208 	u_char	int_conf;
209 };
210