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