dp83932reg.h revision 1.2 1 1.2 thorpej /* $NetBSD: dp83932reg.h,v 1.2 2002/05/03 00:07:02 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.1 thorpej * by Jason R. Thorpe.
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.1 thorpej * must display the following acknowledgement:
20 1.1 thorpej * This product includes software developed by the NetBSD
21 1.1 thorpej * Foundation, Inc. and its contributors.
22 1.1 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 thorpej * contributors may be used to endorse or promote products derived
24 1.1 thorpej * from this software without specific prior written permission.
25 1.1 thorpej *
26 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
37 1.1 thorpej */
38 1.1 thorpej
39 1.1 thorpej #ifndef _DEV_IC_DP83932REG_H_
40 1.1 thorpej #define _DEV_IC_DP83932REG_H_
41 1.1 thorpej
42 1.1 thorpej /*
43 1.1 thorpej * Register description for the National Semiconductor DP83932
44 1.1 thorpej * Systems-Oriented Network Interface Controller (SONIC).
45 1.1 thorpej */
46 1.1 thorpej
47 1.1 thorpej /*
48 1.1 thorpej * SONIC Receive Descriptor Area.
49 1.1 thorpej */
50 1.1 thorpej struct sonic_rda16 {
51 1.1 thorpej uint16_t rda_status;
52 1.1 thorpej uint16_t rda_bytecount;
53 1.1 thorpej uint16_t rda_pkt_ptr0;
54 1.1 thorpej uint16_t rda_pkt_ptr1;
55 1.1 thorpej uint16_t rda_seqno;
56 1.1 thorpej uint16_t rda_link;
57 1.1 thorpej uint16_t rda_inuse;
58 1.1 thorpej } __attribute__((__packed__));
59 1.1 thorpej
60 1.1 thorpej struct sonic_rda32 {
61 1.1 thorpej uint32_t rda_status;
62 1.1 thorpej uint32_t rda_bytecount;
63 1.1 thorpej uint32_t rda_pkt_ptr0;
64 1.1 thorpej uint32_t rda_pkt_ptr1;
65 1.1 thorpej uint32_t rda_seqno;
66 1.1 thorpej uint32_t rda_link;
67 1.1 thorpej uint32_t rda_inuse;
68 1.1 thorpej } __attribute__((__packed__));
69 1.1 thorpej
70 1.1 thorpej #define RDA_SEQNO_RBA(x) (((x) >> 8) & 0xff)
71 1.1 thorpej #define RDA_SEQNO_RSN(x) ((x) & 0xff)
72 1.1 thorpej
73 1.1 thorpej #define RDA_LINK_EOL 0x01 /* end-of-list */
74 1.1 thorpej
75 1.1 thorpej /*
76 1.1 thorpej * SONIC Receive Resource Area.
77 1.1 thorpej *
78 1.1 thorpej * Note, in 32-bit mode, Rx buffers must be aligned to 32-bit
79 1.1 thorpej * boundaries, and in 16-bit mode, to 16-bit boundaries.
80 1.1 thorpej *
81 1.1 thorpej * Also note the `word count' is always in units of 16-bit words.
82 1.1 thorpej */
83 1.1 thorpej struct sonic_rra16 {
84 1.1 thorpej uint16_t rra_ptr0;
85 1.1 thorpej uint16_t rra_ptr1;
86 1.1 thorpej uint16_t rra_wc0;
87 1.1 thorpej uint16_t rra_wc1;
88 1.1 thorpej } __attribute__((__packed__));
89 1.1 thorpej
90 1.1 thorpej struct sonic_rra32 {
91 1.1 thorpej uint32_t rra_ptr0;
92 1.1 thorpej uint32_t rra_ptr1;
93 1.1 thorpej uint32_t rra_wc0;
94 1.1 thorpej uint32_t rra_wc1;
95 1.1 thorpej } __attribute__((__packed__));
96 1.1 thorpej
97 1.1 thorpej /*
98 1.1 thorpej * SONIC Transmit Descriptor Area
99 1.1 thorpej *
100 1.1 thorpej * Note the number of fragments defined here is arbitrary.
101 1.1 thorpej */
102 1.2 thorpej #define SONIC_NTXFRAGS 16
103 1.1 thorpej
104 1.1 thorpej struct sonic_frag16 {
105 1.1 thorpej uint16_t frag_ptr0;
106 1.1 thorpej uint16_t frag_ptr1;
107 1.1 thorpej uint16_t frag_size;
108 1.1 thorpej } __attribute__((__packed__));
109 1.1 thorpej
110 1.1 thorpej struct sonic_frag32 {
111 1.1 thorpej uint32_t frag_ptr0;
112 1.1 thorpej uint32_t frag_ptr1;
113 1.1 thorpej uint32_t frag_size;
114 1.1 thorpej } __attribute__((__packed__));
115 1.1 thorpej
116 1.1 thorpej /*
117 1.1 thorpej * Note the frag after the last frag is used to link up to the
118 1.1 thorpej * next descriptor.
119 1.1 thorpej */
120 1.1 thorpej
121 1.1 thorpej struct sonic_tda16 {
122 1.1 thorpej uint16_t tda_status;
123 1.1 thorpej uint16_t tda_pktconfig;
124 1.1 thorpej uint16_t tda_pktsize;
125 1.1 thorpej uint16_t tda_fragcnt;
126 1.1 thorpej struct sonic_frag16 tda_frags[SONIC_NTXFRAGS + 1];
127 1.1 thorpej #if 0
128 1.1 thorpej uint16_t tda_link;
129 1.1 thorpej #endif
130 1.1 thorpej } __attribute__((__packed__));
131 1.1 thorpej
132 1.1 thorpej struct sonic_tda32 {
133 1.1 thorpej uint32_t tda_status;
134 1.1 thorpej uint32_t tda_pktconfig;
135 1.1 thorpej uint32_t tda_pktsize;
136 1.1 thorpej uint32_t tda_fragcnt;
137 1.1 thorpej struct sonic_frag32 tda_frags[SONIC_NTXFRAGS + 1];
138 1.1 thorpej #if 0
139 1.1 thorpej uint32_t tda_link;
140 1.1 thorpej #endif
141 1.1 thorpej } __attribute__((__packed__));
142 1.1 thorpej
143 1.1 thorpej #define TDA_STATUS_NCOL(x) (((x) >> 11) & 0x1f)
144 1.1 thorpej
145 1.1 thorpej #define TDA_LINK_EOL 0x01 /* end-of-list */
146 1.1 thorpej
147 1.1 thorpej /*
148 1.1 thorpej * SONIC CAM Descriptor Area.
149 1.1 thorpej */
150 1.1 thorpej struct sonic_cda16 {
151 1.1 thorpej uint16_t cda_entry;
152 1.1 thorpej uint16_t cda_addr0;
153 1.1 thorpej uint16_t cda_addr1;
154 1.1 thorpej uint16_t cda_addr2;
155 1.1 thorpej } __attribute__((__packed__));
156 1.1 thorpej
157 1.1 thorpej struct sonic_cda32 {
158 1.1 thorpej uint32_t cda_entry;
159 1.1 thorpej uint32_t cda_addr0;
160 1.1 thorpej uint32_t cda_addr1;
161 1.1 thorpej uint32_t cda_addr2;
162 1.1 thorpej } __attribute__((__packed__));
163 1.1 thorpej
164 1.1 thorpej /*
165 1.1 thorpej * SONIC register file.
166 1.1 thorpej *
167 1.1 thorpej * NOTE: We define these as indices, and use a register map to deal
168 1.1 thorpej * with different address strides.
169 1.1 thorpej */
170 1.1 thorpej
171 1.1 thorpej #define SONIC_CR 0x00 /* Command Register */
172 1.1 thorpej #define CR_HTX (1U << 0) /* Halt Transmission */
173 1.1 thorpej #define CR_TXP (1U << 1) /* Transmit Packets */
174 1.1 thorpej #define CR_RXDIS (1U << 2) /* Receiver Disable */
175 1.1 thorpej #define CR_RXEN (1U << 3) /* Receiver Enable */
176 1.1 thorpej #define CR_STP (1U << 4) /* Stop Timer */
177 1.1 thorpej #define CR_ST (1U << 5) /* Start Timer */
178 1.1 thorpej #define CR_RST (1U << 7) /* Software Reset */
179 1.1 thorpej #define CR_RRRA (1U << 8) /* Read RRA */
180 1.1 thorpej #define CR_LCAM (1U << 9) /* Load CAM */
181 1.1 thorpej
182 1.1 thorpej #define SONIC_DCR 0x01 /* Data Configuration Register */
183 1.1 thorpej #define DCR_TFT0 (1U << 0) /* Transmit FIFO Threshold (lo) */
184 1.1 thorpej #define DCR_TFT1 (1U << 1) /* Transmit FIFO Threshold (hi) */
185 1.1 thorpej #define DCR_RFT0 (1U << 2) /* Receive FIFO Threshold (lo) */
186 1.1 thorpej #define DCR_RFT1 (1U << 3) /* Receive FIFO Threshold (hi) */
187 1.1 thorpej #define DCR_BMS (1U << 4) /* Block Mode Select for DMA */
188 1.1 thorpej #define DCR_DW (1U << 5) /* Data Width Select */
189 1.1 thorpej #define DCR_WC0 (1U << 6) /* Wait State Control (lo) */
190 1.1 thorpej #define DCR_WC1 (1U << 7) /* Wait State Control (hi) */
191 1.1 thorpej #define DCR_USR0 (1U << 8) /* User Definable Pin 0 */
192 1.1 thorpej #define DCR_USR1 (1U << 9) /* User Definable Pin 1 */
193 1.1 thorpej #define DCR_SBUS (1U << 10) /* Synchronous Bus Mode */
194 1.1 thorpej #define DCR_PO0 (1U << 11) /* Programmable Output 0 */
195 1.1 thorpej #define DCR_PO1 (1U << 12) /* Programmable Output 1 */
196 1.1 thorpej #define DCR_LBR (1U << 13) /* Latched Bus Retry */
197 1.1 thorpej #define DCR_EXBUS (1U << 15) /* Extended Bus Mode */
198 1.1 thorpej
199 1.1 thorpej #define SONIC_RCR 0x02 /* Receive Control Register */
200 1.1 thorpej #define RCR_PRX (1U << 0) /* Packet Received OK */
201 1.1 thorpej #define RCR_LBK (1U << 1) /* Loopback Packet Received */
202 1.1 thorpej #define RCR_FAER (1U << 2) /* Frame Alignment Error */
203 1.1 thorpej #define RCR_CRCR (1U << 3) /* CRC Error */
204 1.1 thorpej #define RCR_COL (1U << 4) /* Collision Activity */
205 1.1 thorpej #define RCR_CRS (1U << 5) /* Carrier Sense Activity */
206 1.1 thorpej #define RCR_LPKT (1U << 6) /* Last Packet in RBA */
207 1.1 thorpej #define RCR_BC (1U << 7) /* Broadcast Packet Received */
208 1.1 thorpej #define RCR_MC (1U << 8) /* Multicast Packet Received */
209 1.1 thorpej #define RCR_LB0 (1U << 9) /* Loopback Control 0 */
210 1.1 thorpej #define RCR_LB1 (1U << 10) /* Loopback Control 1 */
211 1.1 thorpej #define RCR_AMC (1U << 11) /* Accept All Multicast Packets */
212 1.1 thorpej #define RCR_PRO (1U << 12) /* Physical Promiscuous Packets */
213 1.1 thorpej #define RCR_BRD (1U << 13) /* Accept Broadcast Packets */
214 1.1 thorpej #define RCR_RNT (1U << 14) /* Accept Runt Packets */
215 1.1 thorpej #define RCR_ERR (1U << 15) /* Accept Packets with Errors */
216 1.1 thorpej
217 1.1 thorpej #define SONIC_TCR 0x03 /* Transmit Control Register */
218 1.1 thorpej #define TCR_PTX (1U << 0) /* Packet Transmitted OK */
219 1.1 thorpej #define TCR_BCM (1U << 1) /* Byte Count Mismatch */
220 1.1 thorpej #define TCR_FU (1U << 2) /* FIFO Underrun */
221 1.1 thorpej #define TCR_PMB (1U << 3) /* Packet Monitored Bad */
222 1.1 thorpej #define TCR_OWC (1U << 5) /* Out of Window Collision */
223 1.1 thorpej #define TCR_EXC (1U << 6) /* Excessive Collisions */
224 1.1 thorpej #define TCR_CRSL (1U << 7) /* Carrier Sense Lost */
225 1.1 thorpej #define TCR_NCRS (1U << 8) /* No Carrier Sense */
226 1.1 thorpej #define TCR_DEF (1U << 9) /* Deferred Transmission */
227 1.1 thorpej #define TCR_EXD (1U << 10) /* Excessive Deferral */
228 1.1 thorpej #define TCR_EXDIS (1U << 12) /* Disable Excessive Deferral Timer */
229 1.1 thorpej #define TCR_CRCI (1U << 13) /* CRC Inhibit */
230 1.1 thorpej #define TCR_POWC (1U << 14) /* Programmed Out of Window Col. Tmr */
231 1.1 thorpej #define TCR_PINT (1U << 15) /* Programmable Interrupt */
232 1.1 thorpej
233 1.1 thorpej #define SONIC_IMR 0x04 /* Interrupt Mask Register */
234 1.1 thorpej #define IMR_RFO (1U << 0) /* Rx FIFO Overrun */
235 1.1 thorpej #define IMR_MP (1U << 1) /* Missed Packet Tally */
236 1.1 thorpej #define IMR_FAE (1U << 2) /* Frame Alignment Error Tally */
237 1.1 thorpej #define IMR_CRC (1U << 3) /* CRC Tally */
238 1.1 thorpej #define IMR_RBA (1U << 4) /* RBA Exceeded */
239 1.1 thorpej #define IMR_RBE (1U << 5) /* Rx Buffers Exhausted */
240 1.1 thorpej #define IMR_RDE (1U << 6) /* Rx Descriptors Exhausted */
241 1.1 thorpej #define IMR_TC (1U << 7) /* Timer Complete */
242 1.1 thorpej #define IMR_TXER (1U << 8) /* Transmit Error */
243 1.1 thorpej #define IMR_PTX (1U << 9) /* Transmit OK */
244 1.1 thorpej #define IMR_PRX (1U << 10) /* Packet Received */
245 1.1 thorpej #define IMR_PINT (1U << 11) /* Programmable Interrupt */
246 1.1 thorpej #define IMR_LCD (1U << 12) /* Load CAM Done */
247 1.1 thorpej #define IMR_HBL (1U << 13) /* Heartbeat Lost */
248 1.1 thorpej #define IMR_BR (1U << 14) /* Bus Retry Occurred */
249 1.1 thorpej
250 1.1 thorpej #define SONIC_ISR 0x05 /* Interrupt Status Register */
251 1.1 thorpej /* See IMR bits. */
252 1.1 thorpej
253 1.1 thorpej #define SONIC_UTDAR 0x06 /* Upper Tx Descriptor Adress Register */
254 1.1 thorpej
255 1.1 thorpej #define SONIC_CTDAR 0x07 /* Current Tx Descriptor Address Register */
256 1.1 thorpej
257 1.1 thorpej #define SONIC_TPS 0x08 /* Transmit Packet Size */
258 1.1 thorpej
259 1.1 thorpej #define SONIC_TFC 0x09 /* Transmit Fragment Count */
260 1.1 thorpej
261 1.1 thorpej #define SONIC_TSA0 0x0a /* Transmit Start Address (lo) */
262 1.1 thorpej
263 1.1 thorpej #define SONIC_TSA1 0x0b /* Transmit Start Address (hi) */
264 1.1 thorpej
265 1.1 thorpej #define SONIC_TFS 0x0c /* Transmit Fragment Size */
266 1.1 thorpej
267 1.1 thorpej #define SONIC_URDAR 0x0d /* Upper Rx Descriptor Address Register */
268 1.1 thorpej
269 1.1 thorpej #define SONIC_CRDAR 0x0e /* Current Rx Descriptor Address Register */
270 1.1 thorpej
271 1.1 thorpej #define SONIC_CRBA0 0x0f /* Current Receive Buffer Address (lo) */
272 1.1 thorpej
273 1.1 thorpej #define SONIC_CRBA1 0x10 /* Current Receive Buffer Address (hi) */
274 1.1 thorpej
275 1.1 thorpej #define SONIC_RBWC0 0x11 /* Remaining Buffer Word Count 0 */
276 1.1 thorpej
277 1.1 thorpej #define SONIC_RBWC1 0x12 /* Remaining Buffer Word Count 1 */
278 1.1 thorpej
279 1.1 thorpej #define SONIC_EOBC 0x13 /* End Of Buffer Word Count */
280 1.1 thorpej
281 1.1 thorpej #define SONIC_URRAR 0x14 /* Upper Rx Resource Address Register */
282 1.1 thorpej
283 1.1 thorpej #define SONIC_RSAR 0x15 /* Resource Start Address Register */
284 1.1 thorpej
285 1.1 thorpej #define SONIC_REAR 0x16 /* Resource End Address Register */
286 1.1 thorpej
287 1.1 thorpej #define SONIC_RRR 0x17 /* Resource Read Register */
288 1.1 thorpej
289 1.1 thorpej #define SONIC_RWR 0x18 /* Resource Write Register */
290 1.1 thorpej
291 1.1 thorpej #define SONIC_TRBA0 0x19 /* Temporary Receive Buffer Address (lo) */
292 1.1 thorpej
293 1.1 thorpej #define SONIC_TRBA1 0x1a /* Temporary Receive Buffer Address (hi) */
294 1.1 thorpej
295 1.1 thorpej #define SONIC_TBWC0 0x1b /* Temporary Buffer Word Count 0 */
296 1.1 thorpej
297 1.1 thorpej #define SONIC_TBWC1 0x1c /* Temporary Buffer Word Count 1 */
298 1.1 thorpej
299 1.1 thorpej #define SONIC_ADDR0 0x1d /* Address Generator 0 */
300 1.1 thorpej
301 1.1 thorpej #define SONIC_ADDR1 0x1e /* Address Generator 1 */
302 1.1 thorpej
303 1.1 thorpej #define SONIC_LLFA 0x1f /* Last Link Field Address */
304 1.1 thorpej
305 1.1 thorpej #define SONIC_TTDA 0x20 /* Temporary Tx Descriptor Address */
306 1.1 thorpej
307 1.1 thorpej #define SONIC_CEP 0x21 /* CAM Entry Pointer */
308 1.1 thorpej
309 1.1 thorpej #define SONIC_CAP2 0x22 /* CAM Address Port 2 */
310 1.1 thorpej
311 1.1 thorpej #define SONIC_CAP1 0x23 /* CAM Address Port 1 */
312 1.1 thorpej
313 1.1 thorpej #define SONIC_CAP0 0x24 /* CAM Address Port 0 */
314 1.1 thorpej
315 1.1 thorpej #define SONIC_CER 0x25 /* CAM Enable Register */
316 1.1 thorpej
317 1.1 thorpej #define SONIC_CDP 0x26 /* CAM Descriptor Pointer */
318 1.1 thorpej
319 1.1 thorpej #define SONIC_CDC 0x27 /* CAM Descriptor Count */
320 1.1 thorpej
321 1.1 thorpej #define SONIC_SRR 0x28 /* Silicon Revision Register */
322 1.1 thorpej
323 1.1 thorpej #define SONIC_WT0 0x29 /* Watchdog Timer 0 */
324 1.1 thorpej
325 1.1 thorpej #define SONIC_WT1 0x2a /* Watchdog Timer 1 */
326 1.1 thorpej
327 1.1 thorpej #define SONIC_RSC 0x2b /* Receive Sequence Counter */
328 1.1 thorpej
329 1.1 thorpej #define SONIC_CRCETC 0x2c /* CRC Error Tally Count */
330 1.1 thorpej
331 1.1 thorpej #define SONIC_FAET 0x2d /* Frame Alignment Error Tally */
332 1.1 thorpej
333 1.1 thorpej #define SONIC_MPT 0x2e /* Missed Packet Tally */
334 1.1 thorpej
335 1.1 thorpej #define SONIC_DCR2 0x3f /* Data Configuration Register 2 */
336 1.1 thorpej #define DCR2_RJCM (1U << 0) /* Reject on CAM Match */
337 1.1 thorpej #define DCR2_PCNM (1U << 1) /* Packet Compress When not Matched */
338 1.1 thorpej #define DCR2_PCM (1U << 2) /* Packet Compress When Matched */
339 1.1 thorpej #define DCR2_PH (1U << 4) /* Program Hold */
340 1.1 thorpej #define DCR2_EXPO0 (1U << 12) /* Extended Programmable Output 0 */
341 1.1 thorpej #define DCR2_EXPO1 (1U << 13) /* Extended Programmable Output 1 */
342 1.1 thorpej #define DCR2_EXPO2 (1U << 14) /* Extended Programmable Output 2 */
343 1.1 thorpej #define DCR2_EXPO3 (1U << 15) /* Extended Programmable Output 3 */
344 1.1 thorpej
345 1.1 thorpej #define SONIC_NREGS 0x40
346 1.1 thorpej
347 1.1 thorpej #endif /* _DEV_IC_DP83932REG_H_ */
348