if_qereg.h revision 1.4 1 /* $NetBSD: if_qereg.h,v 1.4 1999/06/06 19:27:06 ragge Exp $ */
2 /*
3 * Copyright (c) 1988 Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Digital Equipment Corp.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)if_qereg.h 7.3 (Berkeley) 6/28/90
38 */
39
40 /* @(#)if_qereg.h 1.2 (ULTRIX) 1/3/85 */
41
42 /****************************************************************
43 * *
44 * Licensed from Digital Equipment Corporation *
45 * Copyright (c) *
46 * Digital Equipment Corporation *
47 * Maynard, Massachusetts *
48 * 1985, 1986 *
49 * All rights reserved. *
50 * *
51 * The Information in this software is subject to change *
52 * without notice and should not be construed as a commitment *
53 * by Digital Equipment Corporation. Digital makes no *
54 * representations about the suitability of this software for *
55 * any purpose. It is supplied "As Is" without expressed or *
56 * implied warranty. *
57 * *
58 * If the Regents of the University of California or its *
59 * licensees modify the software in a manner creating *
60 * derivative copyright rights, appropriate copyright *
61 * legends may be placed on the derivative work in addition *
62 * to that set forth above. *
63 * *
64 ****************************************************************/
65 /* ---------------------------------------------------------------------
66 * Modification History
67 *
68 * 13 Feb. 84 -- rjl
69 *
70 * Initial version of driver. derived from IL driver.
71 *
72 * ---------------------------------------------------------------------
73 */
74
75 /*
76 * Digital Q-BUS to NI Adapter
77 */
78 struct qedevice {
79 u_short qe_sta_addr[2]; /* Station address (actually 6 */
80 u_short qe_rcvlist_lo; /* Receive list lo address */
81 u_short qe_rcvlist_hi; /* Receive list hi address */
82 u_short qe_xmtlist_lo; /* Transmit list lo address */
83 u_short qe_xmtlist_hi; /* Transmit list hi address */
84 u_short qe_vector; /* Interrupt vector */
85 u_short qe_csr; /* Command and Status Register */
86 };
87
88 /*
89 * Command and status bits (csr)
90 */
91 #define QE_RCV_ENABLE 0x0001 /* Receiver enable */
92 #define QE_RESET 0x0002 /* Software reset */
93 #define QE_NEX_MEM_INT 0x0004 /* Non existant mem interrupt */
94 #define QE_LOAD_ROM 0x0008 /* Load boot/diag from rom */
95 #define QE_XL_INVALID 0x0010 /* Transmit list invalid */
96 #define QE_RL_INVALID 0x0020 /* Receive list invalid */
97 #define QE_INT_ENABLE 0x0040 /* Interrupt enable */
98 #define QE_XMIT_INT 0x0080 /* Transmit interrupt */
99 #define QE_ILOOP 0x0100 /* Internal loopback */
100 #define QE_ELOOP 0x0200 /* External loopback */
101 #define QE_STIM_ENABLE 0x0400 /* Sanity timer enable */
102 #define QE_POWERUP 0x1000 /* Tranceiver power on */
103 #define QE_CARRIER 0x2000 /* Carrier detect */
104 #define QE_RCV_INT 0x8000 /* Receiver interrupt */
105
106 /*
107 * Transmit and receive ring discriptor ---------------------------
108 *
109 * The QNA uses the flag, status1 and the valid bit as a handshake/semiphore
110 * mechinism.
111 *
112 * The flag word is written on ( bits 15,15 set to 1 ) when it reads the
113 * descriptor. If the valid bit is set it considers the address to be valid.
114 * When it uses the buffer pointed to by the valid address it sets status word
115 * one.
116 */
117 struct qe_ring {
118 u_short qe_flag; /* Buffer utilization flags */
119 u_short qe_addr_hi:6, /* Hi order bits of buffer addr */
120 qe_odd_begin:1, /* Odd byte begin and end (xmit)*/
121 qe_odd_end:1,
122 qe_fill1:4,
123 qe_setup:1, /* Setup packet */
124 qe_eomsg:1, /* End of message flag */
125 qe_chain:1, /* Chain address instead of buf */
126 qe_valid:1; /* Address field is valid */
127 u_short qe_addr_lo; /* Low order bits of address */
128 short qe_buf_len; /* Negative buffer length */
129 u_short qe_status1; /* Status word one */
130 u_short qe_status2; /* Status word two */
131 };
132
133 /*
134 * Status word definations (receive)
135 * word1
136 */
137 #define QE_OVF 0x0001 /* Receiver overflow */
138 #define QE_CRCERR 0x0002 /* CRC error */
139 #define QE_FRAME 0x0004 /* Framing alignment error */
140 #define QE_SHORT 0x0008 /* Packet size < 10 bytes */
141 #define QE_RBL_HI 0x0700 /* Hi bits of receive len */
142 #define QE_RUNT 0x0800 /* Runt packet */
143 #define QE_DISCARD 0x1000 /* Discard the packet */
144 #define QE_ESETUP 0x2000 /* Looped back setup or eloop */
145 #define QE_ERROR 0x4000 /* Receiver error */
146 #define QE_LASTNOT 0x8000 /* Not the last in the packet */
147 /* word2 */
148 #define QE_RBL_LO 0x00ff /* Low bits of receive len */
149
150 /*
151 * Status word definations (transmit)
152 * word1
153 */
154 #define QE_CCNT 0x00f0 /* Collision count this packet */
155 #define QE_FAIL 0x0100 /* Heart beat check failure */
156 #define QE_ABORT 0x0200 /* Transmission abort */
157 #define QE_STE16 0x0400 /* Sanity timer default on */
158 #define QE_NOCAR 0x0800 /* No carrier */
159 #define QE_LOSS 0x1000 /* Loss of carrier while xmit */
160 /* word2 */
161 #define QE_TDR 0x3fff /* Time domain reflectometry */
162
163 /*
164 * General constant definations
165 */
166 #define QEALLOC 0 /* Allocate an mbuf */
167 #define QENOALLOC 1 /* No mbuf allocation */
168 #define QEDEALLOC 2 /* Release an mbuf chain */
169
170 #define QE_NOTYET 0x8000 /* Descriptor not in use yet */
171 #define QE_INUSE 0x4000 /* Descriptor being used by QNA */
172 #define QE_MASK 0xc000 /* Lastnot/error/used mask */
173
174 /*
175 * Values for the length of the setup packet that control reception filter.
176 */
177 #define QE_SOMEMULTI 128 /* Receive up to 12 multicasts */
178 #define QE_ALLMULTI 129 /* Receive all multicasts */
179 #define QE_PROMISC 130 /* Receive all packets */
180