gemreg.h revision 1.6 1 1.6 heas /* $NetBSD: gemreg.h,v 1.6 2004/10/17 21:49:08 heas Exp $ */
2 1.1 eeh
3 1.1 eeh /*
4 1.6 heas *
5 1.1 eeh * Copyright (C) 2001 Eduardo Horvath.
6 1.1 eeh * All rights reserved.
7 1.1 eeh *
8 1.1 eeh *
9 1.1 eeh * Redistribution and use in source and binary forms, with or without
10 1.1 eeh * modification, are permitted provided that the following conditions
11 1.1 eeh * are met:
12 1.1 eeh * 1. Redistributions of source code must retain the above copyright
13 1.1 eeh * notice, this list of conditions and the following disclaimer.
14 1.1 eeh * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 eeh * notice, this list of conditions and the following disclaimer in the
16 1.1 eeh * documentation and/or other materials provided with the distribution.
17 1.6 heas *
18 1.1 eeh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
19 1.1 eeh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 1.1 eeh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 1.1 eeh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
22 1.1 eeh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.1 eeh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 1.1 eeh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1 eeh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.1 eeh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1 eeh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1 eeh * SUCH DAMAGE.
29 1.1 eeh *
30 1.1 eeh */
31 1.1 eeh
32 1.1 eeh #ifndef _IF_GEMREG_H
33 1.1 eeh #define _IF_GEMREG_H
34 1.1 eeh
35 1.1 eeh /* Register definitions for Sun GEM gigabit ethernet */
36 1.1 eeh
37 1.1 eeh #define GEM_SEB_STATE 0x0000 /* SEB state reg, R/O */
38 1.1 eeh #define GEM_CONFIG 0x0004 /* config reg */
39 1.1 eeh #define GEM_STATUS 0x000c /* status reg */
40 1.1 eeh /* Note: Reading the status reg clears bits 0-6 */
41 1.1 eeh #define GEM_INTMASK 0x0010
42 1.1 eeh #define GEM_INTACK 0x0014 /* Interrupt acknowledge, W/O */
43 1.6 heas #define GEM_STATUS_ALIAS 0x001c
44 1.1 eeh /* This is the same as the GEM_STATUS reg but reading it does not clear bits. */
45 1.1 eeh #define GEM_ERROR_STATUS 0x1000 /* PCI error status R/C */
46 1.1 eeh #define GEM_ERROR_MASK 0x1004
47 1.1 eeh #define GEM_BIF_CONFIG 0x1008 /* BIF config reg */
48 1.1 eeh #define GEM_BIF_DIAG 0x100c
49 1.1 eeh #define GEM_RESET 0x1010 /* Software reset register */
50 1.1 eeh
51 1.1 eeh
52 1.1 eeh /* Bits in GEM_SEB register */
53 1.1 eeh #define GEM_SEB_ARB 0x000000002 /* Arbitration status */
54 1.1 eeh #define GEM_SEB_RXWON 0x000000004
55 1.1 eeh
56 1.1 eeh
57 1.1 eeh /* Bits in GEM_CONFIG register */
58 1.5 wiz #define GEM_CONFIG_BURST_64 0x000000000 /* 0->infinity, 1->64KB */
59 1.5 wiz #define GEM_CONFIG_BURST_INF 0x000000001 /* 0->infinity, 1->64KB */
60 1.1 eeh #define GEM_CONFIG_TXDMA_LIMIT 0x00000003e
61 1.1 eeh #define GEM_CONFIG_RXDMA_LIMIT 0x0000007c0
62 1.1 eeh
63 1.1 eeh #define GEM_CONFIG_TXDMA_LIMIT_SHIFT 1
64 1.1 eeh #define GEM_CONFIG_RXDMA_LIMIT_SHIFT 6
65 1.1 eeh
66 1.1 eeh
67 1.1 eeh /* Top part of GEM_STATUS has TX completion information */
68 1.1 eeh #define GEM_STATUS_TX_COMPL 0xfff800000 /* TX completion reg. */
69 1.1 eeh
70 1.1 eeh
71 1.6 heas /*
72 1.6 heas * Interrupt bits, for both the GEM_STATUS and GEM_INTMASK regs.
73 1.6 heas * Bits 0-6 auto-clear when read.
74 1.6 heas */
75 1.1 eeh #define GEM_INTR_TX_INTME 0x000000001 /* Frame w/INTME bit set sent */
76 1.1 eeh #define GEM_INTR_TX_EMPTY 0x000000002 /* TX ring empty */
77 1.1 eeh #define GEM_INTR_TX_DONE 0x000000004 /* TX complete */
78 1.1 eeh #define GEM_INTR_RX_DONE 0x000000010 /* Got a packet */
79 1.1 eeh #define GEM_INTR_RX_NOBUF 0x000000020
80 1.1 eeh #define GEM_INTR_RX_TAG_ERR 0x000000040
81 1.6 heas #define GEM_INTR_PCS 0x000002000 /* Physical Code Sub-layer */
82 1.1 eeh #define GEM_INTR_TX_MAC 0x000004000
83 1.1 eeh #define GEM_INTR_RX_MAC 0x000008000
84 1.1 eeh #define GEM_INTR_MAC_CONTROL 0x000010000 /* MAC control interrupt */
85 1.1 eeh #define GEM_INTR_MIF 0x000020000
86 1.1 eeh #define GEM_INTR_BERR 0x000040000 /* Bus error interrupt */
87 1.1 eeh #define GEM_INTR_BITS "\177\020" \
88 1.1 eeh "b\0INTME\0b\1TXEMPTY\0b\2TXDONE\0" \
89 1.1 eeh "b\4RXDONE\0b\5RXNOBUF\0b\6RX_TAG_ERR\0" \
90 1.1 eeh "b\15PCS\0b\16TXMAC\0b\17RXMAC\0" \
91 1.1 eeh "b\20MAC_CONTROL\0b\21MIF\0b\22BERR\0\0" \
92 1.1 eeh
93 1.1 eeh
94 1.1 eeh
95 1.1 eeh /* GEM_ERROR_STATUS and GEM_ERROR_MASK PCI error bits */
96 1.1 eeh #define GEM_ERROR_STAT_BADACK 0x000000001 /* No ACK64# */
97 1.1 eeh #define GEM_ERROR_STAT_DTRTO 0x000000002 /* Delayed xaction timeout */
98 1.1 eeh #define GEM_ERROR_STAT_OTHERS 0x000000004
99 1.1 eeh
100 1.1 eeh
101 1.1 eeh /* GEM_BIF_CONFIG register bits */
102 1.1 eeh #define GEM_BIF_CONFIG_SLOWCLK 0x000000001 /* Parity error timing */
103 1.1 eeh #define GEM_BIF_CONFIG_HOST_64 0x000000002 /* 64-bit host */
104 1.1 eeh #define GEM_BIF_CONFIG_B64D_DIS 0x000000004 /* no 64-bit data cycle */
105 1.1 eeh #define GEM_BIF_CONFIG_M66EN 0x000000008
106 1.1 eeh
107 1.1 eeh
108 1.1 eeh /* GEM_RESET register bits -- TX and RX self clear when complete. */
109 1.1 eeh #define GEM_RESET_TX 0x000000001 /* Reset TX half */
110 1.1 eeh #define GEM_RESET_RX 0x000000002 /* Reset RX half */
111 1.1 eeh #define GEM_RESET_RSTOUT 0x000000004 /* Force PCI RSTOUT# */
112 1.1 eeh
113 1.1 eeh
114 1.1 eeh /* GEM TX DMA registers */
115 1.1 eeh #define GEM_TX_KICK 0x2000 /* Write last valid desc + 1 */
116 1.1 eeh #define GEM_TX_CONFIG 0x2004
117 1.2 thorpej #define GEM_TX_RING_PTR_LO 0x2008
118 1.2 thorpej #define GEM_TX_RING_PTR_HI 0x200c
119 1.1 eeh
120 1.1 eeh #define GEM_TX_FIFO_WR_PTR 0x2014 /* FIFO write pointer */
121 1.1 eeh #define GEM_TX_FIFO_SDWR_PTR 0x2018 /* FIFO shadow write pointer */
122 1.1 eeh #define GEM_TX_FIFO_RD_PTR 0x201c /* FIFO read pointer */
123 1.1 eeh #define GEM_TX_FIFO_SDRD_PTR 0x2020 /* FIFO shadow read pointer */
124 1.1 eeh #define GEM_TX_FIFO_PKT_CNT 0x2024 /* FIFO packet counter */
125 1.1 eeh
126 1.1 eeh #define GEM_TX_STATE_MACHINE 0x2028 /* ETX state machine reg */
127 1.1 eeh #define GEM_TX_DATA_PTR 0x2030 /* ETX state machine reg (64-bit)*/
128 1.1 eeh
129 1.1 eeh #define GEM_TX_COMPLETION 0x2100
130 1.1 eeh #define GEM_TX_FIFO_ADDRESS 0x2104
131 1.1 eeh #define GEM_TX_FIFO_TAG 0x2108
132 1.1 eeh #define GEM_TX_FIFO_DATA_LO 0x210c
133 1.1 eeh #define GEM_TX_FIFO_DATA_HI_T1 0x2110
134 1.1 eeh #define GEM_TX_FIFO_DATA_HI_T0 0x2114
135 1.1 eeh #define GEM_TX_FIFO_SIZE 0x2118
136 1.1 eeh #define GEM_TX_DEBUG 0x3028
137 1.1 eeh
138 1.1 eeh
139 1.1 eeh /* GEM_TX_CONFIG register bits. */
140 1.1 eeh #define GEM_TX_CONFIG_TXDMA_EN 0x00000001 /* TX DMA enable */
141 1.1 eeh #define GEM_TX_CONFIG_TXRING_SZ 0x0000001e /* TX ring size */
142 1.1 eeh #define GEM_TX_CONFIG_TXFIFO_TH 0x001ffc00 /* TX fifo threshold */
143 1.1 eeh #define GEM_TX_CONFIG_PACED 0x00200000 /* TX_all_int modifier */
144 1.1 eeh
145 1.1 eeh #define GEM_RING_SZ_32 (0<<1) /* 32 descriptors */
146 1.1 eeh #define GEM_RING_SZ_64 (1<<1)
147 1.1 eeh #define GEM_RING_SZ_128 (2<<1)
148 1.1 eeh #define GEM_RING_SZ_256 (3<<1)
149 1.1 eeh #define GEM_RING_SZ_512 (4<<1)
150 1.1 eeh #define GEM_RING_SZ_1024 (5<<1)
151 1.1 eeh #define GEM_RING_SZ_2048 (6<<1)
152 1.1 eeh #define GEM_RING_SZ_4096 (7<<1)
153 1.1 eeh #define GEM_RING_SZ_8192 (8<<1)
154 1.1 eeh
155 1.1 eeh
156 1.1 eeh /* GEM_TX_COMPLETION register bits */
157 1.1 eeh #define GEM_TX_COMPLETION_MASK 0x00001fff /* # of last descriptor */
158 1.1 eeh
159 1.1 eeh
160 1.1 eeh /* GEM RX DMA registers */
161 1.1 eeh #define GEM_RX_CONFIG 0x4000
162 1.1 eeh #define GEM_RX_RING_PTR_LO 0x4004 /* 64-bits unaligned GAK! */
163 1.1 eeh #define GEM_RX_RING_PTR_HI 0x4008 /* 64-bits unaligned GAK! */
164 1.1 eeh
165 1.1 eeh #define GEM_RX_FIFO_WR_PTR 0x400c /* FIFO write pointer */
166 1.1 eeh #define GEM_RX_FIFO_SDWR_PTR 0x4010 /* FIFO shadow write pointer */
167 1.1 eeh #define GEM_RX_FIFO_RD_PTR 0x4014 /* FIFO read pointer */
168 1.1 eeh #define GEM_RX_FIFO_PKT_CNT 0x4018 /* FIFO packet counter */
169 1.1 eeh
170 1.1 eeh #define GEM_RX_STATE_MACHINE 0x401c /* ERX state machine reg */
171 1.1 eeh #define GEM_RX_PAUSE_THRESH 0x4020
172 1.1 eeh
173 1.1 eeh #define GEM_RX_DATA_PTR_LO 0x4024 /* ERX state machine reg */
174 1.1 eeh #define GEM_RX_DATA_PTR_HI 0x4028 /* Damn thing is unaligned */
175 1.1 eeh
176 1.1 eeh #define GEM_RX_KICK 0x4100 /* Write last valid desc + 1 */
177 1.1 eeh #define GEM_RX_COMPLETION 0x4104 /* First pending desc */
178 1.1 eeh #define GEM_RX_BLANKING 0x4108 /* Interrupt blanking reg */
179 1.1 eeh
180 1.1 eeh #define GEM_RX_FIFO_ADDRESS 0x410c
181 1.1 eeh #define GEM_RX_FIFO_TAG 0x4110
182 1.1 eeh #define GEM_RX_FIFO_DATA_LO 0x4114
183 1.1 eeh #define GEM_RX_FIFO_DATA_HI_T1 0x4118
184 1.1 eeh #define GEM_RX_FIFO_DATA_HI_T0 0x411c
185 1.1 eeh #define GEM_RX_FIFO_SIZE 0x4120
186 1.1 eeh
187 1.1 eeh
188 1.1 eeh /* GEM_RX_CONFIG register bits. */
189 1.1 eeh #define GEM_RX_CONFIG_RXDMA_EN 0x00000001 /* RX DMA enable */
190 1.1 eeh #define GEM_RX_CONFIG_RXRING_SZ 0x0000001e /* RX ring size */
191 1.1 eeh #define GEM_RX_CONFIG_BATCH_DIS 0x00000020 /* desc batching disable */
192 1.1 eeh #define GEM_RX_CONFIG_FBOFF 0x00001c00 /* first byte offset */
193 1.1 eeh #define GEM_RX_CONFIG_CXM_START 0x000fe000 /* checksum start offset */
194 1.1 eeh #define GEM_RX_CONFIG_FIFO_THRS 0x07000000 /* fifo threshold size */
195 1.1 eeh
196 1.1 eeh #define GEM_THRSH_64 0
197 1.1 eeh #define GEM_THRSH_128 1
198 1.1 eeh #define GEM_THRSH_256 2
199 1.1 eeh #define GEM_THRSH_512 3
200 1.1 eeh #define GEM_THRSH_1024 4
201 1.1 eeh #define GEM_THRSH_2048 5
202 1.1 eeh
203 1.1 eeh #define GEM_RX_CONFIG_FIFO_THRS_SHIFT 24
204 1.1 eeh #define GEM_RX_CONFIG_FBOFF_SHFT 10
205 1.1 eeh #define GEM_RX_CONFIG_CXM_START_SHFT 13
206 1.1 eeh
207 1.1 eeh
208 1.1 eeh /* GEM_RX_PAUSE_THRESH register bits -- sizes in multiples of 64 bytes */
209 1.1 eeh #define GEM_RX_PTH_XOFF_THRESH 0x000001ff
210 1.4 matt #define GEM_RX_PTH_XON_THRESH 0x001ff000
211 1.1 eeh
212 1.1 eeh
213 1.1 eeh /* GEM_RX_BLANKING register bits */
214 1.1 eeh #define GEM_RX_BLANKING_PACKETS 0x000001ff /* Delay intr for x packets */
215 1.4 matt #define GEM_RX_BLANKING_TIME 0x000ff000 /* Delay intr for x ticks */
216 1.4 matt #define GEM_RX_BLANKING_TIME_SHIFT 12
217 1.4 matt /* One tick is 2048 PCI clocks, or 16us at 66MHz */
218 1.1 eeh
219 1.1 eeh
220 1.1 eeh /* GEM_MAC registers */
221 1.1 eeh #define GEM_MAC_TXRESET 0x6000 /* Store 1, cleared when done */
222 1.1 eeh #define GEM_MAC_RXRESET 0x6004 /* ditto */
223 1.1 eeh #define GEM_MAC_SEND_PAUSE_CMD 0x6008
224 1.1 eeh #define GEM_MAC_TX_STATUS 0x6010
225 1.1 eeh #define GEM_MAC_RX_STATUS 0x6014
226 1.1 eeh #define GEM_MAC_CONTROL_STATUS 0x6018 /* MAC control status reg */
227 1.1 eeh #define GEM_MAC_TX_MASK 0x6020 /* TX MAC mask register */
228 1.1 eeh #define GEM_MAC_RX_MASK 0x6024
229 1.1 eeh #define GEM_MAC_CONTROL_MASK 0x6028
230 1.1 eeh #define GEM_MAC_TX_CONFIG 0x6030
231 1.1 eeh #define GEM_MAC_RX_CONFIG 0x6034
232 1.1 eeh #define GEM_MAC_CONTROL_CONFIG 0x6038
233 1.1 eeh #define GEM_MAC_XIF_CONFIG 0x603c
234 1.1 eeh #define GEM_MAC_IPG0 0x6040 /* inter packet gap 0 */
235 1.1 eeh #define GEM_MAC_IPG1 0x6044 /* inter packet gap 1 */
236 1.1 eeh #define GEM_MAC_IPG2 0x6048 /* inter packet gap 2 */
237 1.1 eeh #define GEM_MAC_SLOT_TIME 0x604c
238 1.1 eeh #define GEM_MAC_MAC_MIN_FRAME 0x6050
239 1.1 eeh #define GEM_MAC_MAC_MAX_FRAME 0x6054
240 1.1 eeh #define GEM_MAC_PREAMBLE_LEN 0x6058
241 1.1 eeh #define GEM_MAC_JAM_SIZE 0x605c
242 1.1 eeh #define GEM_MAC_ATTEMPT_LIMIT 0x6060
243 1.1 eeh #define GEM_MAC_CONTROL_TYPE 0x6064
244 1.1 eeh
245 1.1 eeh #define GEM_MAC_ADDR0 0x6080 /* Normal MAC address 0 */
246 1.1 eeh #define GEM_MAC_ADDR1 0x6084
247 1.1 eeh #define GEM_MAC_ADDR2 0x6088
248 1.1 eeh #define GEM_MAC_ADDR3 0x608c /* Alternate MAC address 0 */
249 1.1 eeh #define GEM_MAC_ADDR4 0x6090
250 1.1 eeh #define GEM_MAC_ADDR5 0x6094
251 1.1 eeh #define GEM_MAC_ADDR6 0x6098 /* Control MAC address 0 */
252 1.1 eeh #define GEM_MAC_ADDR7 0x609c
253 1.1 eeh #define GEM_MAC_ADDR8 0x60a0
254 1.1 eeh
255 1.1 eeh #define GEM_MAC_ADDR_FILTER0 0x60a4
256 1.1 eeh #define GEM_MAC_ADDR_FILTER1 0x60a8
257 1.1 eeh #define GEM_MAC_ADDR_FILTER2 0x60ac
258 1.1 eeh #define GEM_MAC_ADR_FLT_MASK1_2 0x60b0 /* Address filter mask 1,2 */
259 1.1 eeh #define GEM_MAC_ADR_FLT_MASK0 0x60b4 /* Address filter mask 0 reg */
260 1.1 eeh
261 1.1 eeh #define GEM_MAC_HASH0 0x60c0 /* Hash table 0 */
262 1.1 eeh #define GEM_MAC_HASH1 0x60c4
263 1.1 eeh #define GEM_MAC_HASH2 0x60c8
264 1.1 eeh #define GEM_MAC_HASH3 0x60cc
265 1.1 eeh #define GEM_MAC_HASH4 0x60d0
266 1.1 eeh #define GEM_MAC_HASH5 0x60d4
267 1.1 eeh #define GEM_MAC_HASH6 0x60d8
268 1.1 eeh #define GEM_MAC_HASH7 0x60dc
269 1.1 eeh #define GEM_MAC_HASH8 0x60e0
270 1.1 eeh #define GEM_MAC_HASH9 0x60e4
271 1.1 eeh #define GEM_MAC_HASH10 0x60e8
272 1.1 eeh #define GEM_MAC_HASH11 0x60ec
273 1.1 eeh #define GEM_MAC_HASH12 0x60f0
274 1.1 eeh #define GEM_MAC_HASH13 0x60f4
275 1.1 eeh #define GEM_MAC_HASH14 0x60f8
276 1.1 eeh #define GEM_MAC_HASH15 0x60fc
277 1.1 eeh
278 1.1 eeh #define GEM_MAC_NORM_COLL_CNT 0x6100 /* Normal collision counter */
279 1.1 eeh #define GEM_MAC_FIRST_COLL_CNT 0x6104 /* 1st successful collision cntr */
280 1.1 eeh #define GEM_MAC_EXCESS_COLL_CNT 0x6108 /* Excess collision counter */
281 1.1 eeh #define GEM_MAC_LATE_COLL_CNT 0x610c /* Late collision counter */
282 1.1 eeh #define GEM_MAC_DEFER_TMR_CNT 0x6110 /* defer timer counter */
283 1.1 eeh #define GEM_MAC_PEAK_ATTEMPTS 0x6114
284 1.1 eeh #define GEM_MAC_RX_FRAME_COUNT 0x6118
285 1.1 eeh #define GEM_MAC_RX_LEN_ERR_CNT 0x611c
286 1.1 eeh #define GEM_MAC_RX_ALIGN_ERR 0x6120
287 1.1 eeh #define GEM_MAC_RX_CRC_ERR_CNT 0x6124
288 1.1 eeh #define GEM_MAC_RX_CODE_VIOL 0x6128
289 1.1 eeh #define GEM_MAC_RANDOM_SEED 0x6130
290 1.1 eeh #define GEM_MAC_MAC_STATE 0x6134 /* MAC sstate machine reg */
291 1.1 eeh
292 1.1 eeh
293 1.1 eeh /* GEM_MAC_SEND_PAUSE_CMD register bits */
294 1.1 eeh #define GEM_MAC_PAUSE_CMD_TIME 0x0000ffff
295 1.1 eeh #define GEM_MAC_PAUSE_CMD_SEND 0x00010000
296 1.1 eeh
297 1.1 eeh
298 1.1 eeh /* GEM_MAC_TX_STATUS and _MASK register bits */
299 1.1 eeh #define GEM_MAC_TX_XMIT_DONE 0x00000001
300 1.1 eeh #define GEM_MAC_TX_UNDERRUN 0x00000002
301 1.1 eeh #define GEM_MAC_TX_PKT_TOO_LONG 0x00000004
302 1.1 eeh #define GEM_MAC_TX_NCC_EXP 0x00000008 /* Normal collision cnt exp */
303 1.1 eeh #define GEM_MAC_TX_ECC_EXP 0x00000010
304 1.1 eeh #define GEM_MAC_TX_LCC_EXP 0x00000020
305 1.1 eeh #define GEM_MAC_TX_FCC_EXP 0x00000040
306 1.1 eeh #define GEM_MAC_TX_DEFER_EXP 0x00000080
307 1.1 eeh #define GEM_MAC_TX_PEAK_EXP 0x00000100
308 1.1 eeh
309 1.1 eeh
310 1.1 eeh /* GEM_MAC_RX_STATUS and _MASK register bits */
311 1.1 eeh #define GEM_MAC_RX_DONE 0x00000001
312 1.1 eeh #define GEM_MAC_RX_OVERFLOW 0x00000002
313 1.1 eeh #define GEM_MAC_RX_FRAME_CNT 0x00000004
314 1.1 eeh #define GEM_MAC_RX_ALIGN_EXP 0x00000008
315 1.1 eeh #define GEM_MAC_RX_CRC_EXP 0x00000010
316 1.1 eeh #define GEM_MAC_RX_LEN_EXP 0x00000020
317 1.1 eeh #define GEM_MAC_RX_CVI_EXP 0x00000040 /* Code violation */
318 1.1 eeh
319 1.1 eeh
320 1.1 eeh /* GEM_MAC_CONTROL_STATUS and GEM_MAC_CONTROL_MASK register bits */
321 1.1 eeh #define GEM_MAC_PAUSED 0x00000001 /* Pause received */
322 1.1 eeh #define GEM_MAC_PAUSE 0x00000002 /* enter pause state */
323 1.1 eeh #define GEM_MAC_RESUME 0x00000004 /* exit pause state */
324 1.1 eeh #define GEM_MAC_PAUSE_TIME 0xffff0000
325 1.1 eeh
326 1.1 eeh /* GEM_MAC_XIF_CONFIG register bits */
327 1.1 eeh #define GEM_MAC_XIF_TX_MII_ENA 0x00000001 /* Enable XIF output drivers */
328 1.1 eeh #define GEM_MAC_XIF_MII_LOOPBK 0x00000002 /* Enable MII loopback mode */
329 1.1 eeh #define GEM_MAC_XIF_ECHO_DISABL 0x00000004 /* Disable echo */
330 1.3 matt #define GEM_MAC_XIF_GMII_MODE 0x00000008 /* Select GMII/MII mode */
331 1.1 eeh #define GEM_MAC_XIF_MII_BUF_ENA 0x00000010 /* Enable MII recv buffers */
332 1.1 eeh #define GEM_MAC_XIF_LINK_LED 0x00000020 /* force link LED active */
333 1.1 eeh #define GEM_MAC_XIF_FDPLX_LED 0x00000040 /* force FDPLX LED active */
334 1.1 eeh
335 1.1 eeh /* GEM_MAC_TX_CONFIG register bits */
336 1.1 eeh #define GEM_MAC_TX_ENABLE 0x00000001 /* TX enable */
337 1.1 eeh #define GEM_MAC_TX_IGN_CARRIER 0x00000002 /* Ignore carrier sense */
338 1.5 wiz #define GEM_MAC_TX_IGN_COLLIS 0x00000004 /* ignore collisions */
339 1.1 eeh #define GEM_MAC_TX_ENA_IPG0 0x00000008 /* extend Rx-to-TX IPG */
340 1.1 eeh #define GEM_MAC_TX_NGU 0x00000010 /* Never give up */
341 1.1 eeh #define GEM_MAC_TX_NGU_LIMIT 0x00000020 /* Never give up limit */
342 1.1 eeh #define GEM_MAC_TX_NO_BACKOFF 0x00000040
343 1.1 eeh #define GEM_MAC_TX_SLOWDOWN 0x00000080
344 1.1 eeh #define GEM_MAC_TX_NO_FCS 0x00000100 /* no FCS will be generated */
345 1.1 eeh #define GEM_MAC_TX_CARR_EXTEND 0x00000200 /* Ena TX Carrier Extension */
346 1.1 eeh /* Carrier Extension is required for half duplex Gbps operation */
347 1.1 eeh
348 1.1 eeh
349 1.1 eeh /* GEM_MAC_RX_CONFIG register bits */
350 1.1 eeh #define GEM_MAC_RX_ENABLE 0x00000001 /* RX enable */
351 1.1 eeh #define GEM_MAC_RX_STRIP_PAD 0x00000002 /* strip pad bytes */
352 1.1 eeh #define GEM_MAC_RX_STRIP_CRC 0x00000004
353 1.1 eeh #define GEM_MAC_RX_PROMISCUOUS 0x00000008 /* promiscuous mode */
354 1.1 eeh #define GEM_MAC_RX_PROMISC_GRP 0x00000010 /* promiscuous group mode */
355 1.1 eeh #define GEM_MAC_RX_HASH_FILTER 0x00000020 /* enable hash filter */
356 1.1 eeh #define GEM_MAC_RX_ADDR_FILTER 0x00000040 /* enable address filter */
357 1.1 eeh #define GEM_MAC_RX_ERRCHK_DIS 0x00000080 /* disable error checking */
358 1.1 eeh #define GEM_MAC_RX_CARR_EXTEND 0x00000100 /* Ena RX Carrier Extension */
359 1.6 heas /*
360 1.1 eeh * Carrier Extension enables reception of packet bursts generated by
361 1.1 eeh * senders with carrier extension enabled.
362 1.1 eeh */
363 1.1 eeh
364 1.1 eeh
365 1.1 eeh /* GEM_MAC_CONTROL_CONFIG bits */
366 1.1 eeh #define GEM_MAC_CC_TX_PAUSE 0x00000001 /* send pause enabled */
367 1.1 eeh #define GEM_MAC_CC_RX_PAUSE 0x00000002 /* receive pause enabled */
368 1.1 eeh #define GEM_MAC_CC_PASS_PAUSE 0x00000004 /* pass pause up */
369 1.1 eeh
370 1.1 eeh
371 1.1 eeh /* GEM MIF registers */
372 1.1 eeh /* Bit bang registers use low bit only */
373 1.1 eeh #define GEM_MIF_BB_CLOCK 0x6200 /* bit bang clock */
374 1.1 eeh #define GEM_MIF_BB_DATA 0x6204 /* bit bang data */
375 1.1 eeh #define GEM_MIF_BB_OUTPUT_ENAB 0x6208
376 1.1 eeh #define GEM_MIF_FRAME 0x620c /* MIF frame - ctl and data */
377 1.1 eeh #define GEM_MIF_CONFIG 0x6210
378 1.1 eeh #define GEM_MIF_INTERRUPT_MASK 0x6214
379 1.1 eeh #define GEM_MIF_BASIC_STATUS 0x6218
380 1.1 eeh #define GEM_MIF_STATE_MACHINE 0x621c
381 1.1 eeh
382 1.1 eeh
383 1.1 eeh /* GEM_MIF_FRAME bits */
384 1.1 eeh #define GEM_MIF_FRAME_DATA 0x0000ffff
385 1.1 eeh #define GEM_MIF_FRAME_TA0 0x00010000 /* TA bit, 1 for completion */
386 1.1 eeh #define GEM_MIF_FRAME_TA1 0x00020000 /* TA bits */
387 1.1 eeh #define GEM_MIF_FRAME_REG_ADDR 0x007c0000
388 1.1 eeh #define GEM_MIF_FRAME_PHY_ADDR 0x0f800000 /* phy address, should be 0 */
389 1.1 eeh #define GEM_MIF_FRAME_OP 0x30000000 /* operation - write/read */
390 1.1 eeh #define GEM_MIF_FRAME_START 0xc0000000 /* START bits */
391 1.1 eeh
392 1.1 eeh #define GEM_MIF_FRAME_READ 0x60020000
393 1.1 eeh #define GEM_MIF_FRAME_WRITE 0x50020000
394 1.1 eeh
395 1.1 eeh #define GEM_MIF_REG_SHIFT 18
396 1.1 eeh #define GEM_MIF_PHY_SHIFT 23
397 1.1 eeh
398 1.1 eeh
399 1.1 eeh /* GEM_MIF_CONFIG register bits */
400 1.1 eeh #define GEM_MIF_CONFIG_PHY_SEL 0x00000001 /* PHY select */
401 1.1 eeh #define GEM_MIF_CONFIG_POLL_ENA 0x00000002 /* poll enable */
402 1.1 eeh #define GEM_MIF_CONFIG_BB_ENA 0x00000004 /* bit bang enable */
403 1.1 eeh #define GEM_MIF_CONFIG_REG_ADR 0x000000f8 /* poll register address */
404 1.1 eeh #define GEM_MIF_CONFIG_MDI0 0x00000100 /* MDIO_0 Data/MDIO_0 atached */
405 1.1 eeh #define GEM_MIF_CONFIG_MDI1 0x00000200 /* MDIO_1 Data/MDIO_1 atached */
406 1.1 eeh #define GEM_MIF_CONFIG_PHY_ADR 0x00007c00 /* poll PHY address */
407 1.5 wiz /* MDI0 is onboard transceiver MID1 is external, PHYAD for both is 0 */
408 1.1 eeh
409 1.1 eeh
410 1.1 eeh /* GEM_MIF_BASIC_STATUS and GEM_MIF_INTERRUPT_MASK bits */
411 1.1 eeh #define GEM_MIF_STATUS 0x0000ffff
412 1.1 eeh #define GEM_MIF_BASIC 0xffff0000
413 1.1 eeh /*
414 1.1 eeh * The Basic part is the last value read in the POLL field of the config
415 1.1 eeh * register.
416 1.1 eeh *
417 1.1 eeh * The status part indicates the bits that have changed.
418 1.1 eeh */
419 1.1 eeh
420 1.1 eeh
421 1.1 eeh /* The GEM PCS/Serial link register. */
422 1.6 heas /* DO NOT TOUCH THESE REGISTERS ON ERI -- IT HARD HANGS. */
423 1.1 eeh #define GEM_MII_CONTROL 0x9000
424 1.1 eeh #define GEM_MII_STATUS 0x9004
425 1.1 eeh #define GEM_MII_ANAR 0x9008 /* MII advertisement reg */
426 1.1 eeh #define GEM_MII_ANLPAR 0x900c /* LP ability reg */
427 1.1 eeh #define GEM_MII_CONFIG 0x9010
428 1.1 eeh #define GEM_MII_STATE_MACHINE 0x9014
429 1.1 eeh #define GEM_MII_INTERRUP_STATUS 0x9018
430 1.1 eeh #define GEM_MII_DATAPATH_MODE 0x9050
431 1.1 eeh #define GEM_MII_SLINK_CONTROL 0x9054 /* Serial link control */
432 1.1 eeh #define GEM_MII_OUTPUT_SELECT 0x9058
433 1.1 eeh #define GEM_MII_SLINK_STATUS 0x905c /* serial link status */
434 1.1 eeh
435 1.1 eeh
436 1.6 heas /* GEM_MII_CONTROL bits - PCS "BMCR" (Basic Mode Control Reg) */
437 1.1 eeh #define GEM_MII_CONTROL_RESET 0x00008000
438 1.1 eeh #define GEM_MII_CONTROL_LOOPBK 0x00004000 /* 10-bit i/f loopback */
439 1.1 eeh #define GEM_MII_CONTROL_1000M 0x00002000 /* speed select, always 0 */
440 1.1 eeh #define GEM_MII_CONTROL_AUTONEG 0x00001000 /* auto negotiation enabled */
441 1.1 eeh #define GEM_MII_CONTROL_POWERDN 0x00000800
442 1.1 eeh #define GEM_MII_CONTROL_ISOLATE 0x00000400 /* isolate phy from mii */
443 1.5 wiz #define GEM_MII_CONTROL_RAN 0x00000200 /* restart auto negotiation */
444 1.1 eeh #define GEM_MII_CONTROL_FDUPLEX 0x00000100 /* full duplex, always 0 */
445 1.1 eeh #define GEM_MII_CONTROL_COL_TST 0x00000080 /* collision test */
446 1.1 eeh
447 1.1 eeh
448 1.6 heas /* GEM_MII_STATUS reg - PCS "BMSR" (Basic Mode Status Reg) */
449 1.1 eeh #define GEM_MII_STATUS_GB_FDX 0x00000400 /* can perform GBit FDX */
450 1.1 eeh #define GEM_MII_STATUS_GB_HDX 0x00000200 /* can perform GBit HDX */
451 1.1 eeh #define GEM_MII_STATUS_ANEG_CPT 0x00000020 /* auto negotiate compete */
452 1.1 eeh #define GEM_MII_STATUS_REM_FLT 0x00000010 /* remote fault detected */
453 1.1 eeh #define GEM_MII_STATUS_ACFG 0x00000008 /* can auto negotiate */
454 1.1 eeh #define GEM_MII_STATUS_LINK_STS 0x00000004 /* link status */
455 1.1 eeh #define GEM_MII_STATUS_JABBER 0x00000002 /* jabber condition detected */
456 1.1 eeh #define GEM_MII_STATUS_EXTCAP 0x00000001 /* extended register capability */
457 1.1 eeh
458 1.1 eeh
459 1.1 eeh /* GEM_MII_ANAR and GEM_MII_ANLAR reg bits */
460 1.1 eeh #define GEM_MII_ANEG_NP 0x00008000 /* next page bit */
461 1.1 eeh #define GEM_MII_ANEG_ACK 0x00004000 /* ack reception of */
462 1.1 eeh /* Link Partner Capability */
463 1.1 eeh #define GEM_MII_ANEG_RF 0x00003000 /* advertise remote fault cap */
464 1.1 eeh #define GEM_MII_ANEG_ASYM_PAUSE 0x00000100 /* asymmetric pause */
465 1.1 eeh #define GEM_MII_ANEG_SYM_PAUSE 0x00000080 /* symmetric pause */
466 1.1 eeh #define GEM_MII_ANEG_HLF_DUPLX 0x00000040
467 1.1 eeh #define GEM_MII_ANEG_FUL_DUPLX 0x00000020
468 1.1 eeh
469 1.1 eeh
470 1.1 eeh /* GEM_MII_CONFIG reg */
471 1.1 eeh #define GEM_MII_CONFIG_TIMER 0x0000001c /* link monitor timer values */
472 1.1 eeh #define GEM_MII_CONFIG_ENABLE 0x00000001 /* Enable PCS */
473 1.1 eeh
474 1.1 eeh
475 1.6 heas /*
476 1.6 heas * GEM_MII_STATE_MACHINE
477 1.6 heas * XXX These are best guesses from observed behavior.
478 1.6 heas */
479 1.6 heas #define GEM_MII_FSM_STOP 0x00000000 /* stopped */
480 1.6 heas #define GEM_MII_FSM_RUN 0x00000001 /* running */
481 1.6 heas #define GEM_MII_FSM_UNKWN 0x00000100 /* unknown */
482 1.6 heas #define GEM_MII_FSM_DONE 0x00000101 /* complete */
483 1.6 heas
484 1.6 heas
485 1.6 heas /*
486 1.6 heas * GEM_MII_INTERRUP_STATUS reg
487 1.6 heas * No mask register; mask with the global interrupt mask register.
488 1.6 heas */
489 1.6 heas #define GEM_MII_INTERRUP_LINK 0x00000002 /* PCS link status change */
490 1.6 heas
491 1.6 heas
492 1.1 eeh /* GEM_MII_DATAPATH_MODE reg */
493 1.1 eeh #define GEM_MII_DATAPATH_SERIAL 0x00000001 /* Serial link */
494 1.1 eeh #define GEM_MII_DATAPATH_SERDES 0x00000002 /* Use PCS via 10bit interfac */
495 1.1 eeh #define GEM_MII_DATAPATH_MII 0x00000004 /* Use MII, not PCS */
496 1.1 eeh #define GEM_MII_DATAPATH_MIIOUT 0x00000008 /* enable serial output on GMII */
497 1.4 matt #define GEM_MII_DATAPATH_BITS "\177\020" \
498 1.4 matt "b\0SERIAL\0b\1SERDES\0b\2MII\0b\3MIIOUT\0\0"
499 1.1 eeh
500 1.1 eeh
501 1.1 eeh /* GEM_MII_SLINK_CONTROL reg */
502 1.6 heas #define GEM_MII_SLINK_LOOPBACK 0x00000001 /* enable loopback at sl, logic
503 1.6 heas * reversed for SERDES */
504 1.1 eeh #define GEM_MII_SLINK_EN_SYNC_D 0x00000002 /* enable sync detection */
505 1.1 eeh #define GEM_MII_SLINK_LOCK_REF 0x00000004 /* lock reference clock */
506 1.1 eeh #define GEM_MII_SLINK_EMPHASIS 0x00000008 /* enable emphasis */
507 1.1 eeh #define GEM_MII_SLINK_SELFTEST 0x000001c0
508 1.1 eeh #define GEM_MII_SLINK_POWER_OFF 0x00000200 /* Power down serial link */
509 1.1 eeh
510 1.1 eeh
511 1.1 eeh /* GEM_MII_SLINK_STATUS reg */
512 1.1 eeh #define GEM_MII_SLINK_TEST 0x00000000 /* undergoing test */
513 1.1 eeh #define GEM_MII_SLINK_LOCKED 0x00000001 /* waiting 500us lockrefn */
514 1.1 eeh #define GEM_MII_SLINK_COMMA 0x00000002 /* waiting for comma detect */
515 1.1 eeh #define GEM_MII_SLINK_SYNC 0x00000003 /* recv data synchronized */
516 1.1 eeh
517 1.1 eeh
518 1.1 eeh /* Wired GEM PHY addresses */
519 1.1 eeh #define GEM_PHYAD_INTERNAL 1
520 1.1 eeh #define GEM_PHYAD_EXTERNAL 0
521 1.1 eeh
522 1.1 eeh /*
523 1.1 eeh * GEM descriptor table structures.
524 1.1 eeh */
525 1.1 eeh struct gem_desc {
526 1.1 eeh uint64_t gd_flags;
527 1.1 eeh uint64_t gd_addr;
528 1.1 eeh };
529 1.1 eeh
530 1.1 eeh /* Transmit flags */
531 1.1 eeh #define GEM_TD_BUFSIZE 0x0000000000007fffLL
532 1.1 eeh #define GEM_TD_CXSUM_START 0x00000000001f8000LL /* Cxsum start offset */
533 1.1 eeh #define GEM_TD_CXSUM_STUFF 0x000000001fe00000LL /* Cxsum stuff offset */
534 1.1 eeh #define GEM_TD_CXSUM_ENABLE 0x0000000020000000LL /* Cxsum generation enable */
535 1.1 eeh #define GEM_TD_END_OF_PACKET 0x0000000040000000LL
536 1.1 eeh #define GEM_TD_START_OF_PACKET 0x0000000080000000LL
537 1.1 eeh #define GEM_TD_INTERRUPT_ME 0x0000000100000000LL /* Interrupt me now */
538 1.1 eeh #define GEM_TD_NO_CRC 0x0000000200000000LL /* do not insert crc */
539 1.1 eeh /*
540 1.1 eeh * Only need to set GEM_TD_CXSUM_ENABLE, GEM_TD_CXSUM_STUFF,
541 1.6 heas * GEM_TD_CXSUM_START, and GEM_TD_INTERRUPT_ME in 1st descriptor of a group.
542 1.1 eeh */
543 1.1 eeh
544 1.1 eeh /* Receive flags */
545 1.1 eeh #define GEM_RD_CHECKSUM 0x000000000000ffffLL
546 1.1 eeh #define GEM_RD_BUFSIZE 0x000000007fff0000LL
547 1.1 eeh #define GEM_RD_OWN 0x0000000080000000LL /* 1 - owned by h/w */
548 1.1 eeh #define GEM_RD_HASHVAL 0x0ffff00000000000LL
549 1.1 eeh #define GEM_RD_HASH_PASS 0x1000000000000000LL /* passed hash filter */
550 1.1 eeh #define GEM_RD_ALTERNATE_MAC 0x2000000000000000LL /* Alternate MAC adrs */
551 1.1 eeh #define GEM_RD_BAD_CRC 0x4000000000000000LL
552 1.1 eeh
553 1.1 eeh #define GEM_RD_BUFSHIFT 16
554 1.1 eeh #define GEM_RD_BUFLEN(x) (((x)&GEM_RD_BUFSIZE)>>GEM_RD_BUFSHIFT)
555 1.1 eeh
556 1.1 eeh #endif
557