Merge from vendor branch BIND:
[dragonfly.git] / sys / dev / netif / sk / xmaciireg.h
1 /*
2  * Copyright (c) 1997, 1998, 1999, 2000
3  *      Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Bill Paul.
16  * 4. Neither the name of the author nor the names of any co-contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30  * THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $FreeBSD: src/sys/pci/xmaciireg.h,v 1.2.4.1 2000/04/27 14:48:07 wpaul Exp $
33  * $DragonFly: src/sys/dev/netif/sk/xmaciireg.h,v 1.2 2003/06/17 04:28:57 dillon Exp $
34  */
35
36 /*
37  * Registers and data structures for the XaQti Corporation XMAC II
38  * Gigabit Ethernet MAC. Datasheet is available from http://www.xaqti.com.
39  * The XMAC can be programmed for 16-bit or 32-bit register access modes.
40  * The SysKonnect gigabit ethernet adapters use 16-bit mode, so that's
41  * how the registers are laid out here.
42  */
43
44 #define XM_DEVICEID             0x00E0AE20
45 #define XM_XAQTI_OUI            0x00E0AE
46
47 #define XM_XMAC_REV(x)          (((x) & 0x000000E0) >> 5)
48
49 #define XM_XMAC_REV_B2          0x0
50 #define XM_XMAC_REV_C1          0x1
51
52 #define XM_MMUCMD               0x0000
53 #define XM_POFF                 0x0008
54 #define XM_BURST                0x000C
55 #define XM_VLAN_TAGLEV1         0x0010
56 #define XM_VLAN_TAGLEV2         0x0014
57 #define XM_TXCMD                0x0020
58 #define XM_TX_RETRYLIMIT        0x0024
59 #define XM_TX_SLOTTIME          0x0028
60 #define XM_TX_IPG               0x003C
61 #define XM_RXCMD                0x0030
62 #define XM_PHY_ADDR             0x0034
63 #define XM_PHY_DATA             0x0038
64 #define XM_GPIO                 0x0040
65 #define XM_IMR                  0x0044
66 #define XM_ISR                  0x0048
67 #define XM_HWCFG                0x004C
68 #define XM_TX_LOWAT             0x0060
69 #define XM_TX_HIWAT             0x0062
70 #define XM_TX_REQTHRESH_LO      0x0064
71 #define XM_TX_REQTHRESH_HI      0x0066
72 #define XM_TX_REQTHRESH         XM_TX_REQTHRESH_LO
73 #define XM_PAUSEDST0            0x0068
74 #define XM_PAUSEDST1            0x006A
75 #define XM_PAUSEDST2            0x006C
76 #define XM_CTLPARM_LO           0x0070
77 #define XM_CTLPARM_HI           0x0072
78 #define XM_CTLPARM              XM_CTLPARM_LO
79 #define XM_OPCODE_PAUSE_TIMER   0x0074
80 #define XM_TXSTAT_LIFO          0x0078
81
82 /*
83  * Perfect filter registers. The XMAC has a table of 16 perfect
84  * filter entries, spaced 8 bytes apart. This is in addition to
85  * the station address registers, which appear below.
86  */
87 #define XM_RXFILT_BASE          0x0080
88 #define XM_RXFILT_END           0x0107
89 #define XM_RXFILT_MAX           16
90 #define XM_RXFILT_ENTRY(ent)            (XM_RXFILT_BASE + ((ent * 8)))
91
92 /* Primary station address. */
93 #define XM_PAR0                 0x0108
94 #define XM_PAR1                 0x010A
95 #define XM_PAR2                 0x010C
96
97 /* 64-bit multicast hash table registers */
98 #define XM_MAR0                 0x0110
99 #define XM_MAR1                 0x0112
100 #define XM_MAR2                 0x0114
101 #define XM_MAR3                 0x0116
102 #define XM_RX_LOWAT             0x0118
103 #define XM_RX_HIWAT             0x011A
104 #define XM_RX_REQTHRESH_LO      0x011C
105 #define XM_RX_REQTHRESH_HI      0x011E
106 #define XM_RX_REQTHRESH         XM_RX_REQTHRESH_LO
107 #define XM_DEVID_LO             0x0120
108 #define XM_DEVID_HI             0x0122
109 #define XM_DEVID                XM_DEVID_LO
110 #define XM_MODE_LO              0x0124
111 #define XM_MODE_HI              0x0126
112 #define XM_MODE                 XM_MODE_LO
113 #define XM_LASTSRC0             0x0128
114 #define XM_LASTSRC1             0x012A
115 #define XM_LASTSRC2             0x012C
116 #define XM_TSTAMP_READ          0x0130
117 #define XM_TSTAMP_LOAD          0x0134
118 #define XM_STATS_CMD            0x0200
119 #define XM_RXCNT_EVENT_LO       0x0204
120 #define XM_RXCNT_EVENT_HI       0x0206
121 #define XM_RXCNT_EVENT          XM_RXCNT_EVENT_LO
122 #define XM_TXCNT_EVENT_LO       0x0208
123 #define XM_TXCNT_EVENT_HI       0x020A
124 #define XM_TXCNT_EVENT          XM_TXCNT_EVENT_LO
125 #define XM_RXCNT_EVMASK_LO      0x020C
126 #define XM_RXCNT_EVMASK_HI      0x020E
127 #define XM_RXCNT_EVMASK         XM_RXCNT_EVMASK_LO
128 #define XM_TXCNT_EVMASK_LO      0x0210
129 #define XM_TXCNT_EVMASK_HI      0x0212
130 #define XM_TXCNT_EVMASK         XM_TXCNT_EVMASK_LO
131
132 /* Statistics command register */
133 #define XM_STATCMD_CLR_TX       0x0001
134 #define XM_STATCMD_CLR_RX       0x0002
135 #define XM_STATCMD_COPY_TX      0x0004
136 #define XM_STATCMD_COPY_RX      0x0008
137 #define XM_STATCMD_SNAP_TX      0x0010
138 #define XM_STATCMD_SNAP_RX      0x0020
139
140 /* TX statistics registers */
141 #define XM_TXSTATS_PKTSOK       0x280
142 #define XM_TXSTATS_BYTESOK_HI   0x284
143 #define XM_TXSTATS_BYTESOK_LO   0x288
144 #define XM_TXSTATS_BCASTSOK     0x28C
145 #define XM_TXSTATS_MCASTSOK     0x290
146 #define XM_TXSTATS_UCASTSOK     0x294
147 #define XM_TXSTATS_GIANTS       0x298
148 #define XM_TXSTATS_BURSTCNT     0x29C
149 #define XM_TXSTATS_PAUSEPKTS    0x2A0
150 #define XM_TXSTATS_MACCTLPKTS   0x2A4
151 #define XM_TXSTATS_SINGLECOLS   0x2A8
152 #define XM_TXSTATS_MULTICOLS    0x2AC
153 #define XM_TXSTATS_EXCESSCOLS   0x2B0
154 #define XM_TXSTATS_LATECOLS     0x2B4
155 #define XM_TXSTATS_DEFER        0x2B8
156 #define XM_TXSTATS_EXCESSDEFER  0x2BC
157 #define XM_TXSTATS_UNDERRUN     0x2C0
158 #define XM_TXSTATS_CARRIERSENSE 0x2C4
159 #define XM_TXSTATS_UTILIZATION  0x2C8
160 #define XM_TXSTATS_64           0x2D0
161 #define XM_TXSTATS_65_127       0x2D4
162 #define XM_TXSTATS_128_255      0x2D8
163 #define XM_TXSTATS_256_511      0x2DC
164 #define XM_TXSTATS_512_1023     0x2E0
165 #define XM_TXSTATS_1024_MAX     0x2E4
166
167 /* RX statistics registers */
168 #define XM_RXSTATS_PKTSOK       0x300
169 #define XM_RXSTATS_BYTESOK_HI   0x304
170 #define XM_RXSTATS_BYTESOK_LO   0x308
171 #define XM_RXSTATS_BCASTSOK     0x30C
172 #define XM_RXSTATS_MCASTSOK     0x310
173 #define XM_RXSTATS_UCASTSOK     0x314
174 #define XM_RXSTATS_PAUSEPKTS    0x318
175 #define XM_RXSTATS_MACCTLPKTS   0x31C
176 #define XM_RXSTATS_BADPAUSEPKTS 0x320
177 #define XM_RXSTATS_BADMACCTLPKTS        0x324
178 #define XM_RXSTATS_BURSTCNT     0x328
179 #define XM_RXSTATS_MISSEDPKTS   0x32C
180 #define XM_RXSTATS_FRAMEERRS    0x330
181 #define XM_RXSTATS_OVERRUN      0x334
182 #define XM_RXSTATS_JABBER       0x338
183 #define XM_RXSTATS_CARRLOSS     0x33C
184 #define XM_RXSTATS_INRNGLENERR  0x340
185 #define XM_RXSTATS_SYMERR       0x344
186 #define XM_RXSTATS_SHORTEVENT   0x348
187 #define XM_RXSTATS_RUNTS        0x34C
188 #define XM_RXSTATS_GIANTS       0x350
189 #define XM_RXSTATS_CRCERRS      0x354
190 #define XM_RXSTATS_CEXTERRS     0x35C
191 #define XM_RXSTATS_UTILIZATION  0x360
192 #define XM_RXSTATS_64           0x368
193 #define XM_RXSTATS_65_127       0x36C
194 #define XM_RXSTATS_128_255      0x370
195 #define XM_RXSTATS_256_511      0x374
196 #define XM_RXSTATS_512_1023     0x378
197 #define XM_RXSTATS_1024_MAX     0x37C
198
199 #define XM_MMUCMD_TX_ENB        0x0001
200 #define XM_MMUCMD_RX_ENB        0x0002
201 #define XM_MMUCMD_GMIILOOP      0x0004
202 #define XM_MMUCMD_RATECTL       0x0008
203 #define XM_MMUCMD_GMIIFDX       0x0010
204 #define XM_MMUCMD_NO_MGMT_PRMB  0x0020
205 #define XM_MMUCMD_SIMCOL        0x0040
206 #define XM_MMUCMD_FORCETX       0x0080
207 #define XM_MMUCMD_LOOPENB       0x0200
208 #define XM_MMUCMD_IGNPAUSE      0x0400
209 #define XM_MMUCMD_PHYBUSY       0x0800
210 #define XM_MMUCMD_PHYDATARDY    0x1000
211
212 #define XM_TXCMD_AUTOPAD        0x0001
213 #define XM_TXCMD_NOCRC          0x0002
214 #define XM_TXCMD_NOPREAMBLE     0x0004
215 #define XM_TXCMD_NOGIGAMODE     0x0008
216 #define XM_TXCMD_SAMPLELINE     0x0010
217 #define XM_TXCMD_ENCBYPASS      0x0020
218 #define XM_TXCMD_XMITBK2BK      0x0040
219 #define XM_TXCMD_FAIRSHARE      0x0080
220
221 #define XM_RXCMD_DISABLE_CEXT   0x0001
222 #define XM_RXCMD_STRIPPAD       0x0002
223 #define XM_RXCMD_SAMPLELINE     0x0004
224 #define XM_RXCMD_SELFRX         0x0008
225 #define XM_RXCMD_STRIPFCS       0x0010
226 #define XM_RXCMD_TRANSPARENT    0x0020
227 #define XM_RXCMD_IPGCAPTURE     0x0040
228 #define XM_RXCMD_BIGPKTOK       0x0080
229 #define XM_RXCMD_LENERROK       0x0100
230
231 #define XM_GPIO_GP0_SET         0x0001
232 #define XM_GPIO_RESETSTATS      0x0004
233 #define XM_GPIO_RESETMAC        0x0008
234 #define XM_GPIO_FORCEINT        0x0020
235 #define XM_GPIO_ANEGINPROG      0x0040
236
237 #define XM_IMR_RX_EOF           0x0001
238 #define XM_IMR_TX_EOF           0x0002
239 #define XM_IMR_TX_UNDERRUN      0x0004
240 #define XM_IMR_RX_OVERRUN       0x0008
241 #define XM_IMR_TX_STATS_OFLOW   0x0010
242 #define XM_IMR_RX_STATS_OFLOW   0x0020
243 #define XM_IMR_TSTAMP_OFLOW     0x0040
244 #define XM_IMR_AUTONEG_DONE     0x0080
245 #define XM_IMR_NEXTPAGE_RDY     0x0100
246 #define XM_IMR_PAGE_RECEIVED    0x0200
247 #define XM_IMR_LP_REQCFG        0x0400
248 #define XM_IMR_GP0_SET          0x0800
249 #define XM_IMR_FORCEINTR        0x1000
250 #define XM_IMR_TX_ABORT         0x2000
251 #define XM_IMR_LINKEVENT        0x4000
252
253 #define XM_INTRS        \
254         (~(XM_IMR_GP0_SET|XM_IMR_AUTONEG_DONE|XM_IMR_TX_UNDERRUN))
255
256 #define XM_ISR_RX_EOF           0x0001
257 #define XM_ISR_TX_EOF           0x0002
258 #define XM_ISR_TX_UNDERRUN      0x0004
259 #define XM_ISR_RX_OVERRUN       0x0008
260 #define XM_ISR_TX_STATS_OFLOW   0x0010
261 #define XM_ISR_RX_STATS_OFLOW   0x0020
262 #define XM_ISR_TSTAMP_OFLOW     0x0040
263 #define XM_ISR_AUTONEG_DONE     0x0080
264 #define XM_ISR_NEXTPAGE_RDY     0x0100
265 #define XM_ISR_PAGE_RECEIVED    0x0200
266 #define XM_ISR_LP_REQCFG        0x0400
267 #define XM_ISR_GP0_SET          0x0800
268 #define XM_ISR_FORCEINTR        0x1000
269 #define XM_ISR_TX_ABORT         0x2000
270 #define XM_ISR_LINKEVENT        0x4000
271
272 #define XM_HWCFG_GENEOP         0x0008
273 #define XM_HWCFG_SIGSTATCKH     0x0004
274 #define XM_HWCFG_GMIIMODE       0x0001
275
276 #define XM_MODE_FLUSH_RXFIFO    0x00000001
277 #define XM_MODE_FLUSH_TXFIFO    0x00000002
278 #define XM_MODE_BIGENDIAN       0x00000004
279 #define XM_MODE_RX_PROMISC      0x00000008
280 #define XM_MODE_RX_NOBROAD      0x00000010
281 #define XM_MODE_RX_NOMULTI      0x00000020
282 #define XM_MODE_RX_NOUNI        0x00000040
283 #define XM_MODE_RX_BADFRAMES    0x00000080
284 #define XM_MODE_RX_CRCERRS      0x00000100
285 #define XM_MODE_RX_GIANTS       0x00000200
286 #define XM_MODE_RX_INRANGELEN   0x00000400
287 #define XM_MODE_RX_RUNTS        0x00000800
288 #define XM_MODE_RX_MACCTL       0x00001000
289 #define XM_MODE_RX_USE_PERFECT  0x00002000
290 #define XM_MODE_RX_USE_STATION  0x00004000
291 #define XM_MODE_RX_USE_HASH     0x00008000
292 #define XM_MODE_RX_ADDRPAIR     0x00010000
293 #define XM_MODE_PAUSEONHI       0x00020000
294 #define XM_MODE_PAUSEONLO       0x00040000
295 #define XM_MODE_TIMESTAMP       0x00080000
296 #define XM_MODE_SENDPAUSE       0x00100000
297 #define XM_MODE_SENDCONTINUOUS  0x00200000
298 #define XM_MODE_LE_STATUSWORD   0x00400000
299 #define XM_MODE_AUTOFIFOPAUSE   0x00800000
300 #define XM_MODE_EXPAUSEGEN      0x02000000
301 #define XM_MODE_RX_INVERSE      0x04000000
302
303 #define XM_RXSTAT_MACCTL        0x00000001
304 #define XM_RXSTAT_ERRFRAME      0x00000002
305 #define XM_RXSTAT_CRCERR        0x00000004
306 #define XM_RXSTAT_GIANT         0x00000008
307 #define XM_RXSTAT_RUNT          0x00000010
308 #define XM_RXSTAT_FRAMEERR      0x00000020
309 #define XM_RXSTAT_INRANGEERR    0x00000040
310 #define XM_RXSTAT_CARRIERERR    0x00000080
311 #define XM_RXSTAT_COLLERR       0x00000100
312 #define XM_RXSTAT_802_3         0x00000200
313 #define XM_RXSTAT_CARREXTERR    0x00000400
314 #define XM_RXSTAT_BURSTMODE     0x00000800
315 #define XM_RXSTAT_UNICAST       0x00002000
316 #define XM_RXSTAT_MULTICAST     0x00004000
317 #define XM_RXSTAT_BROADCAST     0x00008000
318 #define XM_RXSTAT_VLAN_LEV1     0x00010000
319 #define XM_RXSTAT_VLAN_LEV2     0x00020000
320 #define XM_RXSTAT_LEN           0xFFFC0000
321
322 /*
323  * XMAC PHY registers, indirectly accessed through
324  * XM_PHY_ADDR and XM_PHY_REG.
325  */
326
327 #define XM_PHY_BMCR             0x0000  /* control */
328 #define XM_PHY_BMSR             0x0001  /* status */
329 #define XM_PHY_VENID            0x0002  /* vendor id */
330 #define XM_PHY_DEVID            0x0003  /* device id */
331 #define XM_PHY_ANAR             0x0004  /* autoneg advertisenemt */
332 #define XM_PHY_LPAR             0x0005  /* link partner ability */
333 #define XM_PHY_ANEXP            0x0006  /* autoneg expansion */
334 #define XM_PHY_NEXTP            0x0007  /* nextpage */
335 #define XM_PHY_LPNEXTP          0x0008  /* link partner's nextpage */
336 #define XM_PHY_EXTSTS           0x000F  /* extented status */
337 #define XM_PHY_RESAB            0x0010  /* resolved ability */
338
339 #define XM_BMCR_DUPLEX          0x0100
340 #define XM_BMCR_RENEGOTIATE     0x0200
341 #define XM_BMCR_AUTONEGENBL     0x1000
342 #define XM_BMCR_LOOPBACK        0x4000
343 #define XM_BMCR_RESET           0x8000
344
345 #define XM_BMSR_EXTCAP          0x0001
346 #define XM_BMSR_LINKSTAT        0x0004
347 #define XM_BMSR_AUTONEGABLE     0x0008
348 #define XM_BMSR_REMFAULT        0x0010
349 #define XM_BMSR_AUTONEGDONE     0x0020
350 #define XM_BMSR_EXTSTAT         0x0100
351
352 #define XM_VENID_XAQTI          0xD14C
353 #define XM_DEVID_XMAC           0x0002
354
355 #define XM_ANAR_FULLDUPLEX      0x0020
356 #define XM_ANAR_HALFDUPLEX      0x0040
357 #define XM_ANAR_PAUSEBITS       0x0180
358 #define XM_ANAR_REMFAULTBITS    0x1800
359 #define XM_ANAR_ACK             0x4000
360 #define XM_ANAR_NEXTPAGE        0x8000
361
362 #define XM_LPAR_FULLDUPLEX      0x0020
363 #define XM_LPAR_HALFDUPLEX      0x0040
364 #define XM_LPAR_PAUSEBITS       0x0180
365 #define XM_LPAR_REMFAULTBITS    0x1800
366 #define XM_LPAR_ACK             0x4000
367 #define XM_LPAR_NEXTPAGE        0x8000
368
369 #define XM_PAUSE_NOPAUSE        0x0000
370 #define XM_PAUSE_SYMPAUSE       0x0080
371 #define XM_PAUSE_ASYMPAUSE      0x0100
372 #define XM_PAUSE_BOTH           0x0180
373
374 #define XM_REMFAULT_LINKOK      0x0000
375 #define XM_REMFAULT_LINKFAIL    0x0800
376 #define XM_REMFAULT_OFFLINE     0x1000
377 #define XM_REMFAULT_ANEGERR     0x1800
378
379 #define XM_ANEXP_GOTPAGE        0x0002
380 #define XM_ANEXP_NEXTPAGE_SELF  0x0004
381 #define XM_ANEXP_NEXTPAGE_LP    0x0008
382
383 #define XM_NEXTP_MESSAGE        0x07FF
384 #define XM_NEXTP_TOGGLE         0x0800
385 #define XM_NEXTP_ACK2           0x1000
386 #define XM_NEXTP_MPAGE          0x2000
387 #define XM_NEXTP_ACK1           0x4000
388 #define XM_NEXTP_NPAGE          0x8000
389
390 #define XM_LPNEXTP_MESSAGE      0x07FF
391 #define XM_LPNEXTP_TOGGLE       0x0800
392 #define XM_LPNEXTP_ACK2         0x1000
393 #define XM_LPNEXTP_MPAGE        0x2000
394 #define XM_LPNEXTP_ACK1         0x4000
395 #define XM_LPNEXTP_NPAGE        0x8000
396
397 #define XM_EXTSTS_HALFDUPLEX    0x4000
398 #define XM_EXTSTS_FULLDUPLEX    0x8000
399
400 #define XM_RESAB_PAUSEMISMATCH  0x0008
401 #define XM_RESAB_ABLMISMATCH    0x0010
402 #define XM_RESAB_FDMODESEL      0x0020
403 #define XM_RESAB_HDMODESEL      0x0040
404 #define XM_RESAB_PAUSEBITS      0x0180