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