if_smapreg.h revision 1.1 1 /* $NetBSD: if_smapreg.h,v 1.1 2001/10/16 15:38:34 uch Exp $ */
2
3 /*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * SMAP memory access layer.
41 *
42 * <-> FIFO <-> BUF
43 * CPU +<-----> EMAC3
44 * <----------> DESC
45 */
46
47 /*
48 * Buffer (accessed by FIFO or EMAC3. indexed by descriptor)
49 */
50 #define SMAP_TXBUF_BASE 0x1000
51 #define SMAP_TXBUF_SIZE 0x1000
52 #define SMAP_RXBUF_BASE 0x4000
53 #define SMAP_RXBUF_SIZE 0x4000
54
55 /*
56 * FIFO access
57 */
58 #define SMAP_TXFIFO_CTRL_REG8 MIPS_PHYS_TO_KSEG1(0x14001000)
59 #define SMAP_TXFIFO_PTR_REG16 MIPS_PHYS_TO_KSEG1(0x14001004)
60 #define SMAP_TXFIFO_FRAME_REG8 MIPS_PHYS_TO_KSEG1(0x1400100c)
61 #define SMAP_TXFIFO_FRAME_INC_REG8 MIPS_PHYS_TO_KSEG1(0x14001010)
62 #define SMAP_TXFIFO_DATA_REG MIPS_PHYS_TO_KSEG1(0x14001100)
63 #define SMAP_RXFIFO_CTRL_REG8 MIPS_PHYS_TO_KSEG1(0x14001030)
64 #define SMAP_RXFIFO_PTR_REG16 MIPS_PHYS_TO_KSEG1(0x14001034)
65 #define SMAP_RXFIFO_FRAME_REG8 MIPS_PHYS_TO_KSEG1(0x1400103c)
66 #define SMAP_RXFIFO_FRAME_DEC_REG8 MIPS_PHYS_TO_KSEG1(0x14001040)
67 #define SMAP_RXFIFO_DATA_REG MIPS_PHYS_TO_KSEG1(0x14001200)
68 #define SMAP_FIFO_RESET 0x01
69
70 /*
71 * Descriptor access
72 */
73 #define SMAP_DESC_MODE_REG8 MIPS_PHYS_TO_KSEG1(0x14000102)
74 #define SMAP_DESC_MODE_SWAP 0x0001
75
76 #define SMAP_TXDESC_BASE MIPS_PHYS_TO_KSEG1(0x14003000)
77 #define SMAP_RXDESC_BASE MIPS_PHYS_TO_KSEG1(0x14003200)
78 #define SMAP_DESC_MAX 64
79 struct smap_desc {
80 u_int16_t stat;
81 u_int16_t __reserved;
82 u_int16_t sz;
83 u_int16_t ptr;
84 }__attribute__((__packed__, __aligned__(8)));
85
86 /* TX Control */
87 #define SMAP_TXDESC_READY 0x8000
88 #define SMAP_TXDESC_GENFCS 0x0200
89 #define SMAP_TXDESC_GENPAD 0x0100
90 #define SMAP_TXDESC_INSSA 0x0080
91 #define SMAP_TXDESC_RPLSA 0x0040
92 #define SMAP_TXDESC_INSVLAN 0x0020
93 #define SMAP_TXDESC_RPLVLAN 0x0010
94
95 /* TX Status */
96 #define SMAP_TXDESC_READY 0x8000
97 #define SMAP_TXDESC_BADFCS 0x0200
98 #define SMAP_TXDESC_BADPKT 0x0100
99 #define SMAP_TXDESC_LOSSCR 0x0080
100 #define SMAP_TXDESC_EDEFER 0x0040
101 #define SMAP_TXDESC_ECOLL 0x0020
102 #define SMAP_TXDESC_LCOLL 0x0010
103 #define SMAP_TXDESC_MCOLL 0x0008
104 #define SMAP_TXDESC_SCOLL 0x0004
105 #define SMAP_TXDESC_UNDERRUN 0x0002
106 #define SMAP_TXDESC_SQE 0x0001
107
108 /* RX Control */
109 #define SMAP_RXDESC_EMPTY 0x8000
110
111 /* RX Status */
112 #define SMAP_RXDESC_EMPTY 0x8000
113 #define SMAP_RXDESC_OVERRUN 0x0200
114 #define SMAP_RXDESC_PFRM 0x0100
115 #define SMAP_RXDESC_BADFRM 0x0080
116 #define SMAP_RXDESC_RUNTFRM 0x0040
117 #define SMAP_RXDESC_SHORTEVNT 0x0020
118 #define SMAP_RXDESC_ALIGNERR 0x0010
119 #define SMAP_RXDESC_BADFCS 0x0008
120 #define SMAP_RXDESC_FRMTOOLONG 0x0004
121 #define SMAP_RXDESC_OUTRANGE 0x0002
122 #define SMAP_RXDESC_INRANGE 0x0001
123