|
|
1.1 root 1: /*
2: * Copyright (c) 1989 The Regents of the University of California.
3: * All rights reserved.
4: *
5: * This code is derived from software contributed to Berkeley by
6: * Excelan Inc.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
36: * @(#)if_exreg.h 7.3 (Berkeley) 6/28/90
37: */
38:
39: struct exdevice {
40: ushort ex_porta; /* write on porta resets EXOS */
41: ushort ex_portb; /* write on portb interrupts EXOS */
42: };
43:
44: /* EXOS I/O PORT A write definitions */
45: #define EX_RESET 0 /* value doesn't really matter... */
46:
47: /* EXOS I/O PORT B write definitions */
48: #define EX_NTRUPT 0
49:
50: /* EXOS I/O PORT B read definitions */
51: #define EX_TESTOK 1 /* set when self-diagnostics passed */
52: #define EX_UNREADY (1<<3) /* set until EXOS ready to read from B */
53:
54: /* message buffer status field definitions */
55: #define MH_OWNER 1 /* mask for status bit for owner */
56: #define MH_HOST 0 /* if 0, the host owns the buffer */
57: #define MH_EXOS 1 /* if 1, the EXOS owns the buffer */
58:
59: /* EXOS Link Level request codes */
60: #define LLTRANSMIT 0xC /* send a packet */
61: #define LLRTRANSMIT 0xE /* send a packet, and self-receive */
62: #define LLRECEIVE 0xD /* receive a packet */
63: #define LLNET_MODE 0x8 /* read/write mode control objects */
64: #define LLNET_ADDRS 0x9 /* read/write receive address slots */
65: #define LLNET_RECV 0xA /* read/alter receive slot enable bit */
66: #define LLNET_STSTCS 0xB /* read/reset network statistics objects */
67:
68: /* Link Level return codes common to all requests */
69: #define LL_OK 0 /* successful completion */
70: #define LLX_MODE 0xA1 /* EXOS not in link level mode (impossible) */
71:
72: /* LLTRANSMIT unique return codes */
73: #define LLXM_1RTRY 0x1 /* successful xmission, 1 retry */
74: #define LLXM_RTRYS 0x2 /* successful xmission, more than 1 retry */
75: #define LLXM_NSQE 0x8 /* successful xmission, no SQE TEST signal */
76: #define LLXM_CLSN 0x10 /* xmission failed, excess retries */
77: #define LLXM_NCS 0x20 /* xmission failed, no carrier sense */
78: #define LLXM_LNGTH 0x40 /* xmission failed, bad packet length */
79: #define XMIT_BITS "\7\7LENGTH\6CARRIER\5XCLSNS\4SQETST"
80: /*#define LLXM_ERROR (LLXM_NSQE|LLXM_CLSN|LLXM_NCS|LLXM_LNGTH)*/
81: #define LLXM_ERROR (LLXM_CLSN|LLXM_NCS|LLXM_LNGTH)
82:
83: /* LLRECEIVE unique return codes */
84: #define LLRC_TRUNC 0x4 /* pkt received, but truncated to fit buffer */
85: #define LLRC_ALIGN 0x10 /* pkt received, but with alignment error */
86: #define LLRC_CRC 0x20 /* pkt received, but with CRC error */
87: #define LLRC_BUFLEN 0x40 /* no pkt received, buffer less than 64 bytes */
88: /* this should never happen here */
89: #define RECV_BITS "\7\7BUFLEN\6CRC\5ALIGN\3TRUNC"
90:
91: /* LLNET_ADDRS unique return codes */
92: #define LLNA_BADSLOT 0xD1 /* slot doesn't exist or can't be accessed */
93: #define LLNA_BADADDR 0xD3 /* invalid address for designated slot */
94:
95: /* LLNET_RECV unique return codes */
96: #define LLNR_BADSLOT 0xD1 /* slot doesn't exist or can't be accessed */
97: #define LLNR_BADADDR 0xD2 /* designated slot was empty */
98:
99: /* address slot object indices */
100: #define NULLSLOT 0 /* the null slot */
101: #define MINMCSLOT 1 /* minimum multicast slot index */
102: #define MAXMCSLOT 8 /* default maximum multicast slot index */
103: #define PHYSSLOT 253 /* physical slot index */
104: #define UNVRSSLOT 254 /* universal slot index */
105: #define BROADSLOT 255 /* broadcast slot index */
106:
107: /* request mask bit definitions */
108: #define WRITE_OBJ 1 /* write the object */
109: #define READ_OBJ 2 /* read the object */
110: #define ENABLE_RCV 4 /* enable reception on designated slot */
111:
112: /* NET_MODE options mask bit definitions */
113: #define OPT_ALIGN 0x10 /* receive packets with alignment errors */
114: #define OPT_CRC 0x20 /* receive packets with CRC errors */
115: #define OPT_DSABLE 0x80 /* disconnect controller hardware */
116:
117: /* NET_MODE mode field value definitions */
118: #define MODE_OFF 0 /* stop transmission and reception */
119: #define MODE_PERF 1 /* perfect multicast address filtering */
120: #define MODE_HW 2 /* hardware-only multicast address filtering */
121: #define MODE_PROM 3 /* promiscuous reception */
122:
123: #define NFRAGMENTS 8 /* number fragments that the EXOS will scatter/gather */
124: #define EXMAXRBUF 1518 /* per EXOS 202 manual 5.3.7 (maybe 1518 would do) */
125:
126: /*
127: * N.B. Structures below are carefully constructed so that
128: * they correspond to the message formats that NX firmware
129: * defines. None of them should contain any compiler-instigated
130: * padding. Be especially careful about VAX C longword alignment!
131: */
132:
133: struct ex_stat {
134: u_long sa_fsent; /* frames sent without errors */
135: u_long sa_xsclsn; /* frames aborted excess collisions */
136: u_long sa_nsqe; /* frames subject to heartbeat failure */
137: u_long sa_undef; /* undefined (TDR on EXOS 101) */
138: u_long sa_frcvd; /* frames received no errors */
139: u_long sa_align; /* frames received alignment error */
140: u_long sa_crc; /* frames received crc error */
141: u_long sa_flost; /* frames lost */
142: };
143:
144: struct buf_blk { /* packet/buffer block descriptor */
145: u_short bb_len; /* length of block, in bytes */
146: struct i86_long {
147: u_short realaddr[2]; /* address of block */
148: } bb_addr;
149: /*
150: * Array above is really a single u_long field.
151: * We kludge its definition to defeat word-alignment.
152: */
153: };
154:
155: struct net_mode { /* read/write mode control objects */
156: /*12*/ u_char nm_rqst; /* request code */
157: /*13*/ u_char nm_rply; /* reply code */
158: /*14*/ u_char nm_mask; /* bit-wise switches for read, write */
159: /*15*/ u_char nm_optn; /* acceptable packet reception errors */
160: /*16*/ u_char nm_mode; /* EXOS filtering mode */
161: /*17*/
162: };
163:
164: struct net_addrs { /* read/write receive address slots */
165: /*12*/ u_char na_rqst; /* request code */
166: /*13*/ u_char na_rply; /* reply code */
167: /*14*/ u_char na_mask; /* bit-wise switches for read, write */
168: /*15*/ u_char na_slot; /* index of address slot */
169: /*16*/ u_char na_addrs[6]; /* address read and/or written */
170: /*22*/
171: };
172:
173: struct net_recv { /* read/alter receive slot enable bit */
174: /*12*/ u_char nr_rqst; /* request code */
175: /*13*/ u_char nr_rply; /* reply code */
176: /*14*/ u_char nr_mask; /* bit-wise switches for read, write */
177: /*15*/ u_char nr_slot; /* index of address slot */
178: /*16*/
179: };
180:
181: struct net_ststcs { /* read/reset network statistics objects */
182: /*12*/ u_char ns_rqst; /* request code */
183: /*13*/ u_char ns_rply; /* reply code */
184: /*14*/ u_char ns_mask; /* bit-wise switches for read, write */
185: /*15*/ u_char ns_rsrv; /* reserved for EXOS */
186: /*16*/ u_short ns_nobj; /* number of objects to work on */
187: /*18*/ u_short ns_xobj; /* index of first object to work on */
188: /*20*/ u_long ns_bufp; /* pointer to statistics buffer */
189: /*24*/
190: };
191:
192: struct enet_xmit { /* send a packet on the Ethernet */
193: /*12*/ u_char et_rqst; /* request code */
194: /*13*/ u_char et_rply; /* reply code */
195: /*14*/ u_char et_slot; /* address slot matching dest address */
196: /*15*/ u_char et_nblock; /* number of blocks composing packet */
197: /*16*/ struct buf_blk et_blks[NFRAGMENTS]; /* array of block descriptors */
198: /*22-64*/
199: };
200:
201: struct enet_recv { /* receive a packet on the Ethernet */
202: /*12*/ u_char er_rqst; /* request code */
203: /*13*/ u_char er_rply; /* reply code */
204: /*14*/ u_char er_slot; /* address slot matching dest address */
205: /*15*/ u_char er_nblock; /* number of blocks composing buffer */
206: /*16*/ struct buf_blk er_blks[NFRAGMENTS]; /* array of block descriptors */
207: /*22-64*/
208: };
209:
210: /* we send requests and receive replys with the EXOS using this structure */
211: struct ex_msg {
212: /*00*/ u_short mb_link; /* address of next message buffer */
213: /*02*/ u_char mb_rsrv; /* reserved for use by EXOS */
214: /*03*/ u_char mb_status; /* used bit-wise for message protocol */
215: /*04*/ u_short mb_length; /* length, in bytes, of the rest */
216: /*06*/ short mb_1rsrv; /* reserved for used by EXOS */
217: /*08*/ struct ifvba *mb_pkb; /* available to user */
218: /*12*/ union mb_all {
219: struct net_mode mb_net_mode;
220: struct net_addrs mb_net_addrs;
221: struct net_recv mb_net_recv;
222: struct net_ststcs mb_net_ststcs;
223: struct enet_xmit mb_enet_xmit;
224: struct enet_recv mb_enet_recv;
225: } mb_all;
226: /* following field is used only by host, not read by board */
227: struct ex_msg *mb_next; /* host's pointer to next message */
228: };
229: #define mb_nm mb_all.mb_net_mode
230: #define mb_na mb_all.mb_net_addrs
231: #define mb_nr mb_all.mb_net_recv
232: #define mb_ns mb_all.mb_net_ststcs
233: #define mb_et mb_all.mb_enet_xmit
234: #define mb_er mb_all.mb_enet_recv
235: #define mb_rqst mb_nm.nm_rqst
236: #define mb_rply mb_nm.nm_rply
237: #define MBDATALEN (sizeof(union mb_all)+6)
238:
239: struct ex_conf {
240: /*00*/ u_short cm_1rsrv; /* reserved, must be 1 */
241: /*02*/ char cm_vc[4]; /* returns ASCII version code */
242: /*06*/ u_char cm_cc; /* returns config completion code */
243: /*07*/ u_char cm_opmode; /* specifies operation mode */
244: /*08*/ u_short cm_dfo; /* specifies host data format option */
245: /*00*/ u_char cm_dcn1; /* reserved, must be 1 */
246: /*11*/ u_char cm_2rsrv[2]; /* reserved, must be 0 */
247: /*13*/ u_char cm_ham; /* specifies host address mode */
248: /*14*/ u_char cm_3rsrv; /* reserved, must be 0 */
249: /*15*/ u_char cm_mapsiz; /* reserved, must be 0 */
250: /*16*/ u_char cm_byteptrn[4]; /* host data format option test pattern */
251: /*20*/ u_short cm_wordptrn[2];
252: /*24*/ u_long cm_lwordptrn;
253: /*28*/ u_char cm_rsrvd[20];
254: /*48*/ u_long cm_mba; /* use 0xFFFFFFFF in link level mode */
255: /*52*/ u_char cm_nproc; /* use 0xFF in link level mode */
256: /*53*/ u_char cm_nmbox; /* use 0xFF in link level mode */
257: /*54*/ u_char cm_nmcast; /* use 0xFF in link level mode */
258: /*55*/ u_char cm_nhost; /* use 1 in link level mode */
259:
260: /* the next five parameters define the request message queue */
261: /*56*/ u_long cm_h2xba; /* base address of message queue */
262: /*60*/ u_short cm_h2xhdr; /* address offset of msg Q header */
263: /*62*/ u_char cm_h2xtyp; /* interrupt type */
264: /*63*/ u_char cm_h2xval; /* interrupt value (not used) */
265: /*64*/ u_short cm_h2xaddr; /* interrupt vector */
266: /*66*/ u_short cm_h2xpad; /* pad out unused portion of vector */
267:
268: /* the next five parameters define the reply message queue */
269: /*68*/ u_long cm_x2hba; /* base address of message queue */
270: /*72*/ u_short cm_x2hhdr; /* address offset of msg Q header */
271: /*74*/ u_char cm_x2htyp; /* interrupt type */
272: /*75*/ u_char cm_x2hval; /* interrupt value (not used) */
273: /*76*/ u_short cm_x2haddr; /* interrupt vector */
274: /*78*/ u_short cm_x2hpad; /* pad out unused portion of vector */
275: /*80*/
276: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.