xref: /original-bsd/sys/tahoe/if/if_enpreg.h (revision 26fd1ce5)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Computer Consoles Inc.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)if_enpreg.h	7.2 (Berkeley) 05/08/91
11  */
12 
13 /*	Copyright (c) 1984 by Communication Machinery Corporation
14  *
15  *	This file contains material which is proprietary to
16  *	Communication Machinery Corporation (CMC) and which
17  *	may not be divulged without the written permission
18  *	of CMC.
19  *
20  *	ENP-10 Ram Definition
21  *
22  *	3/15/85 Jon Phares
23  *	Update 7/10/85 S. Holmgren
24  *	ENP-10 update 7/21/85 J. Mullen
25  *	ENP-20 update 8/11/85 J. Mullen
26  *	Mods for CCI TAHOE system 8/14/85 J. Mullen
27  */
28 
29 #define K		*1024
30 
31 struct ether_addr {
32 	u_char ea_addr[6];
33 };
34 
35 typedef struct ethlist {
36 	int	e_listsize;		/* active addr entries */
37 	struct	ether_addr e_baseaddr;	/* addr lance is working with */
38 	struct	ether_addr e_addrs[16];	/* possible addresses */
39 } ETHLIST;
40 
41 typedef struct {
42 	u_long	e_xmit_successful;	/* Successful transmissions */
43 	u_long	e_mult_retry;		/* multiple retries on xmit */
44 	u_long	e_one_retry;		/* single retries */
45 	u_long	e_fail_retry;		/* too many retries */
46 	u_long	e_deferrals;		/* xmit delayed 'cuz cable busy */
47 	u_long	e_xmit_buff_err;	/* xmit data chaining failed --
48 						   "can't happen" */
49 	u_long	e_silo_underrun;	/* transmit data fetch failed */
50 	u_long	e_late_coll;		/* collision after xmit */
51 	u_long	e_lost_carrier;
52 	u_long	e_babble;		/* xmit length > 1518 */
53 	u_long	e_collision;
54 	u_long	e_xmit_mem_err;
55 	u_long	e_rcv_successful;	/* good receptions */
56 	u_long	e_rcv_missed;		/* no recv buff available */
57 	u_long	e_crc_err;		/* checksum failed */
58 	u_long	e_frame_err;		/* crc error & data length != 0 mod 8 */
59 	u_long	e_rcv_buff_err;		/* rcv data chain failure --
60 						   "can't happen" */
61 	u_long	e_silo_overrun;		/* receive data store failed */
62 	u_long	e_rcv_mem_err;
63 } ENPSTAT;
64 
65 typedef struct RING {
66 	short	r_rdidx;
67 	short	r_wrtidx;
68 	short	r_size;
69 	short	r_pad;
70 	int	r_slot[1];
71 } RING;
72 
73 typedef struct RING32 {
74 	short	r_rdidx;
75 	short	r_wrtidx;
76 	short	r_size;
77 	short	r_pad;			/* to make VAXen happy */
78 	int	r_slot[32];
79 } RING32;
80 
81 /*
82  * ENP Ram data layout
83  */
84 
85 /*
86  * Note: paged window (4 K) is identity mapped by ENP kernel to provide
87  * 124 K contiguous RAM (as reflected in RAM_SIZE)
88  */
89 #define RAM_WINDOW	(128 K)
90 #define IOACCESS_WINDOW (512)
91 #define FIXED_WINDOW	(RAM_WINDOW - IOACCESS_WINDOW)
92 #define RAMROM_SWAP	(4 K)
93 #define RAM_SIZE	(FIXED_WINDOW - RAMROM_SWAP)
94 
95 #define HOST_RAMSIZE	(48 K)
96 #define ENP_RAMSIZE	(20 K)
97 
98 typedef	struct iow20 {
99 	char	pad0;
100 	char	hst2enp_interrupt;
101 	char	pad1[510];
102 } iow20;
103 
104 struct enpdevice {
105 #ifdef notdef
106 	char	enp_ram_rom[4 K];
107 #endif notdef
108 	union {
109 		char	all_ram[RAM_SIZE];
110 		struct {
111 			u_int	t_go;
112 			u_int	t_pstart;
113 		} t;
114 		struct {
115 			char	nram[RAM_SIZE - (HOST_RAMSIZE + ENP_RAMSIZE)];
116 			char	hram[HOST_RAMSIZE];
117 			char	kram[ENP_RAMSIZE];
118 		} u_ram;
119 		struct {
120 			char	pad7[0x100];	/* starts 0x1100 - 0x2000 */
121 			short	e_enpstate;	/* 1102 */
122 			short	e_enpmode;	/* 1104 */
123 			int	e_enpbase;	/* 1104 */
124 			int	e_enprun;	/* 1108 */
125 			u_short	e_intrvec;
126 			u_short	e_dummy[3];
127 			RING32	h_toenp;	/* 110C */
128 			RING32	h_hostfree;
129 			RING32	e_tohost;
130 			RING32 	e_enpfree;
131 			ENPSTAT	e_stat;
132 			ETHLIST	e_netaddr;
133 		} iface;
134 	} enp_u;
135 	iow20	enp_iow;
136 };
137 
138 #define	enp_ram		enp_u.all_ram
139 #define	enp_nram	enp_u.u_ram.nram
140 #define	enp_hram	enp_u.u_ram.hram
141 #define	enp_kram	enp_u.u_ram.kram
142 #define	enp_go		enp_u.t.t_go
143 #define	enp_prog_start	enp_u.t.t_pstart
144 #define	enp_intrvec	enp_u.iface.e_intrvec
145 #define enp_state	enp_u.iface.e_enpstate
146 #define enp_mode	enp_u.iface.e_enpmode
147 #define enp_base	enp_u.iface.e_enpbase
148 #define enp_enprun	enp_u.iface.e_enprun
149 #define enp_toenp	enp_u.iface.h_toenp
150 #define enp_hostfree	enp_u.iface.h_hostfree
151 #define enp_tohost	enp_u.iface.e_tohost
152 #define enp_enpfree	enp_u.iface.e_enpfree
153 #define enp_freembuf	enp_u.iface.h_freembuf
154 #define enp_stat	enp_u.iface.e_stat
155 #define enp_addr	enp_u.iface.e_netaddr
156 
157 #define ENPVAL		0xff	/* enp_iow.hst2enp_interrupt poke value */
158 #define RESETVAL	0x00	/* enp_iow.enp2hst_clear_intr poke value */
159 
160 #define INTR_ENP(addr)		(addr->enp_iow.hst2enp_interrupt = ENPVAL)
161 
162 #if ENP == 30
163 #define ACK_ENP_INTR(addr)	(addr->enp_iow.enp2hst_clear_intr = RESETVAL)
164 #define IS_ENP_INTR(addr)	(addr->enp_iow.enp2hst_clear_intr&0x80)
165 #endif
166 
167 #ifdef notdef
168 #define RESET_ENP(addr)		(addr->enp_iow.hst2enp_reset = 01)
169 #else
170 #ifdef lint
171 #define RESET_ENP(addr)		((addr) = (addr))
172 #else
173 #define RESET_ENP(addr)
174 #endif lint
175 #endif notdef
176 
177 #ifdef tahoe
178 #define ENP_GO(addr,start) { \
179 	int v = start; \
180 	enpcopy((u_char *)&v, (u_char *)&addr->enp_prog_start, sizeof(v) ); \
181 	v = 0x80800000; \
182 	enpcopy((u_char *)&v, (u_char *)&addr->enp_go, sizeof(v) ); \
183 }
184 #else
185 #define ENP_GO(addr,start,intvec ) { \
186 	addr->enp_prog_start = (u_int)(start); \
187 	addr->enp_intrvec = (u_short) intvec; \
188 	addr->enp_go = 0x80800000; \
189 }
190 #endif tahoe
191 
192 /*
193  * State bits
194  */
195 #define S_ENPRESET	01		/* enp is in reset state */
196 #define S_ENPRUN	02		/* enp is in run state */
197 
198 /*
199  * Mode bits
200  */
201 #define E_SWAP16	0x1		/* swap two octets within 16 */
202 #define E_SWAP32	0x2		/* swap 16s within 32 */
203 #define E_SWAPRD	0x4		/* swap on read */
204 #define E_SWAPWRT	0x8		/* swap on write */
205 #define E_DMA		0x10		/* enp does data moving */
206 
207 #define E_EXAM_LIST	0x80000000	/* enp should examine addrlist */
208 #define E_ADDR_SUPP	0x40000000	/* enp should use supplied addr */
209 
210 /*
211  * Download ioctl definitions
212  */
213 #define ENPIOGO		_IO('S',1)		/* start the enp */
214 #define ENPIORESET	_IO('S',2)		/* reset the enp */
215 
216 /*
217  * The ENP Data Buffer Structure
218  */
219 typedef struct BCB {
220 	struct	BCB *b_link;
221 	short	 b_stat;
222 	short	 b_len;
223 	u_char	*b_addr;
224 	short	 b_msglen;
225 	short	 b_reserved;
226 } BCB;
227