Thu Aug 29 05:55:19 2019 UTC ()
 Add missing NUL to prevent buffer overrun.


(msaitoh)
diff -r1.29 -r1.30 src/sys/arch/sparc/include/ctlreg.h
diff -r1.2 -r1.3 src/sys/dev/pci/if_xgereg.h

cvs diff -r1.29 -r1.30 src/sys/arch/sparc/include/ctlreg.h (switch to unified diff)

--- src/sys/arch/sparc/include/ctlreg.h 2013/12/04 18:44:14 1.29
+++ src/sys/arch/sparc/include/ctlreg.h 2019/08/29 05:55:18 1.30
@@ -1,494 +1,494 @@ @@ -1,494 +1,494 @@
1/* $NetBSD: ctlreg.h,v 1.29 2013/12/04 18:44:14 jdc Exp $ */ 1/* $NetBSD: ctlreg.h,v 1.30 2019/08/29 05:55:18 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * The President and Fellows of Harvard College. All rights reserved. 5 * The President and Fellows of Harvard College. All rights reserved.
6 * Copyright (c) 1992, 1993 6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * This software was developed by the Computer Systems Engineering group 9 * This software was developed by the Computer Systems Engineering group
10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
11 * contributed to Berkeley. 11 * contributed to Berkeley.
12 * 12 *
13 * All advertising materials mentioning features or use of this software 13 * All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement: 14 * must display the following acknowledgement:
15 * This product includes software developed by Harvard University. 15 * This product includes software developed by Harvard University.
16 * This product includes software developed by the University of 16 * This product includes software developed by the University of
17 * California, Lawrence Berkeley Laboratory. 17 * California, Lawrence Berkeley Laboratory.
18 * 18 *
19 * Redistribution and use in source and binary forms, with or without 19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions 20 * modification, are permitted provided that the following conditions
21 * are met: 21 * are met:
22 * 1. Redistributions of source code must retain the above copyright 22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer. 23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright 24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the 25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution. 26 * documentation and/or other materials provided with the distribution.
27 * 3. All advertising materials mentioning features or use of this software 27 * 3. All advertising materials mentioning features or use of this software
28 * must display the following acknowledgement: 28 * must display the following acknowledgement:
29 * This product includes software developed by the University of 29 * This product includes software developed by the University of
30 * California, Berkeley and its contributors. 30 * California, Berkeley and its contributors.
31 * 4. Neither the name of the University nor the names of its contributors 31 * 4. Neither the name of the University nor the names of its contributors
32 * may be used to endorse or promote products derived from this software 32 * may be used to endorse or promote products derived from this software
33 * without specific prior written permission. 33 * without specific prior written permission.
34 * 34 *
35 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 35 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
36 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 38 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE. 45 * SUCH DAMAGE.
46 * 46 *
47 * @(#)ctlreg.h 8.1 (Berkeley) 6/11/93 47 * @(#)ctlreg.h 8.1 (Berkeley) 6/11/93
48 */ 48 */
49 49
50/* 50/*
51 * Sun4m support by Aaron Brown, Harvard University. 51 * Sun4m support by Aaron Brown, Harvard University.
52 * Changes Copyright (c) 1995 The President and Fellows of Harvard College. 52 * Changes Copyright (c) 1995 The President and Fellows of Harvard College.
53 * All rights reserved. 53 * All rights reserved.
54 */ 54 */
55 55
56/* 56/*
57 * Sun 4, 4c, and 4m control registers. (includes address space definitions 57 * Sun 4, 4c, and 4m control registers. (includes address space definitions
58 * and some registers in control space). 58 * and some registers in control space).
59 */ 59 */
60 60
61/* 61/*
62 * The Alternate address spaces. 62 * The Alternate address spaces.
63 */ 63 */
64 64
65/* 0x00 unused */ 65/* 0x00 unused */
66/* 0x01 unused */ 66/* 0x01 unused */
67#define ASI_CONTROL 0x02 /* cache enable, context reg, etc */ 67#define ASI_CONTROL 0x02 /* cache enable, context reg, etc */
68#define ASI_SEGMAP 0x03 /* [4/4c] segment maps */ 68#define ASI_SEGMAP 0x03 /* [4/4c] segment maps */
69#define ASI_SRMMUFP 0x03 /* [4m] ref mmu flush/probe */ 69#define ASI_SRMMUFP 0x03 /* [4m] ref mmu flush/probe */
70#define ASI_PTE 0x04 /* [4/4c] PTE space (pmegs) */ 70#define ASI_PTE 0x04 /* [4/4c] PTE space (pmegs) */
71#define ASI_SRMMU 0x04 /* [4m] ref mmu registers */ 71#define ASI_SRMMU 0x04 /* [4m] ref mmu registers */
72#define ASI_REGMAP 0x06 /* [4/3-level MMU ] region maps */ 72#define ASI_REGMAP 0x06 /* [4/3-level MMU ] region maps */
73#define ASI_HWFLUSHSEG 0x05 /* [4/4c] hardware assisted version of FLUSHSEG */ 73#define ASI_HWFLUSHSEG 0x05 /* [4/4c] hardware assisted version of FLUSHSEG */
74#define ASI_HWFLUSHPG 0x06 /* [4/4c] hardware assisted version of FLUSHPG */ 74#define ASI_HWFLUSHPG 0x06 /* [4/4c] hardware assisted version of FLUSHPG */
75#define ASI_SRMMUDIAG 0x06 /* [4m] */ 75#define ASI_SRMMUDIAG 0x06 /* [4m] */
76#define ASI_HWFLUSHCTX 0x07 /* [4/4c] hardware assisted version of FLUSHCTX */ 76#define ASI_HWFLUSHCTX 0x07 /* [4/4c] hardware assisted version of FLUSHCTX */
77 77
78#define ASI_USERI 0x08 /* I-space (user) */ 78#define ASI_USERI 0x08 /* I-space (user) */
79#define ASI_KERNELI 0x09 /* I-space (kernel) */ 79#define ASI_KERNELI 0x09 /* I-space (kernel) */
80#define ASI_USERD 0x0a /* D-space (user) */ 80#define ASI_USERD 0x0a /* D-space (user) */
81#define ASI_KERNELD 0x0b /* D-space (kernel) */ 81#define ASI_KERNELD 0x0b /* D-space (kernel) */
82 82
83#define ASI_FLUSHREG 0x7 /* [4/4c] flush cache by region */ 83#define ASI_FLUSHREG 0x7 /* [4/4c] flush cache by region */
84#define ASI_FLUSHSEG 0x0c /* [4/4c] flush cache by segment */ 84#define ASI_FLUSHSEG 0x0c /* [4/4c] flush cache by segment */
85#define ASI_FLUSHPG 0x0d /* [4/4c] flush cache by page */ 85#define ASI_FLUSHPG 0x0d /* [4/4c] flush cache by page */
86#define ASI_FLUSHCTX 0x0e /* [4/4c] flush cache by context */ 86#define ASI_FLUSHCTX 0x0e /* [4/4c] flush cache by context */
87 87
88#define ASI_DCACHE 0x0f /* [4] flush data cache */ 88#define ASI_DCACHE 0x0f /* [4] flush data cache */
89 89
90#define ASI_ICACHETAG 0x0c /* [4m] instruction cache tag */ 90#define ASI_ICACHETAG 0x0c /* [4m] instruction cache tag */
91#define ASI_ICACHEDATA 0x0d /* [4m] instruction cache data */ 91#define ASI_ICACHEDATA 0x0d /* [4m] instruction cache data */
92#define ASI_DCACHETAG 0x0e /* [4m] data cache tag */ 92#define ASI_DCACHETAG 0x0e /* [4m] data cache tag */
93#define ASI_DCACHEDATA 0x0f /* [4m] data cache data */ 93#define ASI_DCACHEDATA 0x0f /* [4m] data cache data */
94#define ASI_IDCACHELFP 0x10 /* [4m] flush i&d cache line (page) */ 94#define ASI_IDCACHELFP 0x10 /* [4m] flush i&d cache line (page) */
95#define ASI_IDCACHELFS 0x11 /* [4m] flush i&d cache line (seg) */ 95#define ASI_IDCACHELFS 0x11 /* [4m] flush i&d cache line (seg) */
96#define ASI_IDCACHELFR 0x12 /* [4m] flush i&d cache line (reg) */ 96#define ASI_IDCACHELFR 0x12 /* [4m] flush i&d cache line (reg) */
97#define ASI_IDCACHELFC 0x13 /* [4m] flush i&d cache line (ctxt) */ 97#define ASI_IDCACHELFC 0x13 /* [4m] flush i&d cache line (ctxt) */
98#define ASI_IDCACHELFU 0x14 /* [4m] flush i&d cache line (user) */ 98#define ASI_IDCACHELFU 0x14 /* [4m] flush i&d cache line (user) */
99#define ASI_BLOCKCOPY 0x17 /* [4m] hypersparc: hardware block copy */ 99#define ASI_BLOCKCOPY 0x17 /* [4m] hypersparc: hardware block copy */
100#define ASI_BLOCKFILL 0x1f /* [4m] hypersparc: hardware block fill */ 100#define ASI_BLOCKFILL 0x1f /* [4m] hypersparc: hardware block fill */
101#define ASI_BYPASS 0x20 /* [4m] sun ref mmu bypass, 101#define ASI_BYPASS 0x20 /* [4m] sun ref mmu bypass,
102 ie. direct phys access */ 102 ie. direct phys access */
103#define ASI_CSR 0x2f /* [4d] CPU-unit CSR space */ 103#define ASI_CSR 0x2f /* [4d] CPU-unit CSR space */
104#define ASI_ECSR 0x2f /* [4d] CPU-unit ECSR space */ 104#define ASI_ECSR 0x2f /* [4d] CPU-unit ECSR space */
105#define ASI_HICACHECLR 0x31 /* [4m] hypersparc only: I-cache flash clear */ 105#define ASI_HICACHECLR 0x31 /* [4m] hypersparc only: I-cache flash clear */
106#define ASI_ICACHECLR 0x36 /* [4m] ms1 only: I-cache flash clear */ 106#define ASI_ICACHECLR 0x36 /* [4m] ms1 only: I-cache flash clear */
107#define ASI_DCACHECLR 0x37 /* [4m] ms1 only: D-cache flash clear */ 107#define ASI_DCACHECLR 0x37 /* [4m] ms1 only: D-cache flash clear */
108#define ASI_DCACHEDIAG 0x39 /* [4m] data cache diagnostic register access */ 108#define ASI_DCACHEDIAG 0x39 /* [4m] data cache diagnostic register access */
109 109
110/* 110/*
111 * [4/4c] Registers in the control space (ASI_CONTROL). 111 * [4/4c] Registers in the control space (ASI_CONTROL).
112 */ 112 */
113#define AC_IDPROM 0x00000000 /* [4] ID PROM */ 113#define AC_IDPROM 0x00000000 /* [4] ID PROM */
114#define AC_CONTEXT 0x30000000 /* [4/4c] context register (byte) */ 114#define AC_CONTEXT 0x30000000 /* [4/4c] context register (byte) */
115#define AC_SYSENABLE 0x40000000 /* [4/4c] system enable register (byte) */ 115#define AC_SYSENABLE 0x40000000 /* [4/4c] system enable register (byte) */
116#define AC_DVMA_ENABLE 0x50000000 /* [4] enable user dvma */ 116#define AC_DVMA_ENABLE 0x50000000 /* [4] enable user dvma */
117#define AC_BUS_ERR 0x60000000 /* [4] bus error register */ 117#define AC_BUS_ERR 0x60000000 /* [4] bus error register */
118#define AC_SYNC_ERR 0x60000000 /* [4c] sync (memory) error reg */ 118#define AC_SYNC_ERR 0x60000000 /* [4c] sync (memory) error reg */
119#define AC_SYNC_VA 0x60000004 /* [4c] sync error virtual addr */ 119#define AC_SYNC_VA 0x60000004 /* [4c] sync error virtual addr */
120#define AC_ASYNC_ERR 0x60000008 /* [4c] async error reg */ 120#define AC_ASYNC_ERR 0x60000008 /* [4c] async error reg */
121#define AC_ASYNC_VA 0x6000000c /* [4c] async error virtual addr */ 121#define AC_ASYNC_VA 0x6000000c /* [4c] async error virtual addr */
122#define AC_DIAG_REG 0x70000000 /* [4] diagnostic reg */ 122#define AC_DIAG_REG 0x70000000 /* [4] diagnostic reg */
123#define AC_CACHETAGS 0x80000000 /* [4/4c?] cache tag base address */ 123#define AC_CACHETAGS 0x80000000 /* [4/4c?] cache tag base address */
124#define AC_CACHEDATA 0x90000000 /* [4] cached data [sun4/400?] */ 124#define AC_CACHEDATA 0x90000000 /* [4] cached data [sun4/400?] */
125#define AC_DVMA_MAP 0xd0000000 /* [4] user dvma map entries */ 125#define AC_DVMA_MAP 0xd0000000 /* [4] user dvma map entries */
126#define AC_VMEINTVEC 0xe0000000 /* [4] vme interrupt vector */ 126#define AC_VMEINTVEC 0xe0000000 /* [4] vme interrupt vector */
127#define AC_SERIAL 0xf0000000 /* [4/4c] special serial port sneakiness */ 127#define AC_SERIAL 0xf0000000 /* [4/4c] special serial port sneakiness */
128 /* AC_SERIAL is not used in the kernel (it is for the PROM) */ 128 /* AC_SERIAL is not used in the kernel (it is for the PROM) */
129 129
130/* XXX: does not belong here */ 130/* XXX: does not belong here */
131#define ME_REG_IERR 0x80 /* memory err ctrl reg error intr pending bit */ 131#define ME_REG_IERR 0x80 /* memory err ctrl reg error intr pending bit */
132 132
133/* 133/*
134 * [4/4c] 134 * [4/4c]
135 * Bits in sync error register. Reading the register clears these; 135 * Bits in sync error register. Reading the register clears these;
136 * otherwise they accumulate. The error(s) occurred at the virtual 136 * otherwise they accumulate. The error(s) occurred at the virtual
137 * address stored in the sync error address register, and may have 137 * address stored in the sync error address register, and may have
138 * been due to, e.g., what would usually be called a page fault. 138 * been due to, e.g., what would usually be called a page fault.
139 * Worse, the bits accumulate during instruction prefetch, so 139 * Worse, the bits accumulate during instruction prefetch, so
140 * various bits can be on that should be off. 140 * various bits can be on that should be off.
141 */ 141 */
142#define SER_WRITE 0x8000 /* error occurred during write */ 142#define SER_WRITE 0x8000 /* error occurred during write */
143#define SER_INVAL 0x80 /* PTE had PG_V off */ 143#define SER_INVAL 0x80 /* PTE had PG_V off */
144#define SER_PROT 0x40 /* operation violated PTE prot */ 144#define SER_PROT 0x40 /* operation violated PTE prot */
145#define SER_TIMEOUT 0x20 /* bus timeout (non-existent mem) */ 145#define SER_TIMEOUT 0x20 /* bus timeout (non-existent mem) */
146#define SER_SBUSERR 0x10 /* S-Bus bus error */ 146#define SER_SBUSERR 0x10 /* S-Bus bus error */
147#define SER_MEMERR 0x08 /* memory ecc/parity error */ 147#define SER_MEMERR 0x08 /* memory ecc/parity error */
148#define SER_SZERR 0x02 /* [4/vme] size error (r/w too large) */ 148#define SER_SZERR 0x02 /* [4/vme] size error (r/w too large) */
149#define SER_WATCHDOG 0x01 /* watchdog reset (never see this) */ 149#define SER_WATCHDOG 0x01 /* watchdog reset (never see this) */
150 150
151#define SER_BITS \ 151#define SER_BITS \
152"\20\20WRITE\10INVAL\7PROT\6TIMEOUT\5SBUSERR\4MEMERR\2SZERR\1WATCHDOG" 152"\20\20WRITE\10INVAL\7PROT\6TIMEOUT\5SBUSERR\4MEMERR\2SZERR\1WATCHDOG"
153 153
154/* 154/*
155 * [4/4c] 155 * [4/4c]
156 * Bits in async error register (errors from DVMA or Sun-4 cache 156 * Bits in async error register (errors from DVMA or Sun-4 cache
157 * writeback). The corresponding bit is also set in the sync error reg. 157 * writeback). The corresponding bit is also set in the sync error reg.
158 * 158 *
159 * A writeback invalid error means there is a bug in the PTE manager. 159 * A writeback invalid error means there is a bug in the PTE manager.
160 * 160 *
161 * The word is that the async error register does not work right. 161 * The word is that the async error register does not work right.
162 */ 162 */
163#define AER_WBINVAL 0x80 /* writeback found PTE without PG_V */ 163#define AER_WBINVAL 0x80 /* writeback found PTE without PG_V */
164#define AER_TIMEOUT 0x20 /* bus timeout */ 164#define AER_TIMEOUT 0x20 /* bus timeout */
165#define AER_DVMAERR 0x10 /* bus error during DVMA */ 165#define AER_DVMAERR 0x10 /* bus error during DVMA */
166 166
167#define AER_BITS "\20\10WBINVAL\6TIMEOUT\5DVMAERR" 167#define AER_BITS "\20\10WBINVAL\6TIMEOUT\5DVMAERR"
168 168
169/* 169/*
170 * [4/4c] Bits in system enable register. 170 * [4/4c] Bits in system enable register.
171 */ 171 */
172#define SYSEN_DVMA 0x20 /* Enable dvma */ 172#define SYSEN_DVMA 0x20 /* Enable dvma */
173#define SYSEN_CACHE 0x10 /* Enable cache */ 173#define SYSEN_CACHE 0x10 /* Enable cache */
174#define SYSEN_IOCACHE 0x40 /* Enable IO cache */ 174#define SYSEN_IOCACHE 0x40 /* Enable IO cache */
175#define SYSEN_VIDEO 0x08 /* Enable on-board video */ 175#define SYSEN_VIDEO 0x08 /* Enable on-board video */
176#define SYSEN_RESET 0x04 /* Reset the hardware */ 176#define SYSEN_RESET 0x04 /* Reset the hardware */
177#define SYSEN_RESETVME 0x02 /* Reset the VME bus */ 177#define SYSEN_RESETVME 0x02 /* Reset the VME bus */
178 178
179 179
180/* 180/*
181 * [4m] Bits in ASI_CONTROL space, sun4m only. 181 * [4m] Bits in ASI_CONTROL space, sun4m only.
182 */ 182 */
183#define MXCC_STREAM_DATA 0x1c00000 /* Stream data register */ 183#define MXCC_STREAM_DATA 0x1c00000 /* Stream data register */
184#define MXCC_STREAM_SRC 0x1c00100 /* Stream source register */ 184#define MXCC_STREAM_SRC 0x1c00100 /* Stream source register */
185#define MXCC_STREAM_DST 0x1c00200 /* Stream dest register */ 185#define MXCC_STREAM_DST 0x1c00200 /* Stream dest register */
186#define MXCC_BIST 0x1c00800 /* Builtin self test register */ 186#define MXCC_BIST 0x1c00800 /* Builtin self test register */
187#define MXCC_CTRLREG 0x1c00a00 /* Control register for MXCC */ 187#define MXCC_CTRLREG 0x1c00a00 /* Control register for MXCC */
188#define MXCC_STATREG 0x1c00b00 /* Status register for MXCC */ 188#define MXCC_STATREG 0x1c00b00 /* Status register for MXCC */
189#define MXCC_MRST 0x1c00c00 /* Module reset register */ 189#define MXCC_MRST 0x1c00c00 /* Module reset register */
190#define MXCC_ERROR 0x1c00e00 /* Error register */ 190#define MXCC_ERROR 0x1c00e00 /* Error register */
191#define MXCC_MBUSPORT 0x1c00f00 /* MBus port register */ 191#define MXCC_MBUSPORT 0x1c00f00 /* MBus port register */
192 192
193/* Bits in MXCC_CTRLREG */ 193/* Bits in MXCC_CTRLREG */
194#define MXCC_CTRLREG_HC 0x1 /* Half cache (Xbus only) */ 194#define MXCC_CTRLREG_HC 0x1 /* Half cache (Xbus only) */
195#define MXCC_CTRLREG_CS 0x2 /* E-cache size (Xbus only) */ 195#define MXCC_CTRLREG_CS 0x2 /* E-cache size (Xbus only) */
196#define MXCC_CTRLREG_CE 0x4 /* Enable e-cache */  196#define MXCC_CTRLREG_CE 0x4 /* Enable e-cache */
197#define MXCC_CTRLREG_PE 0x8 /* Parity enable */  197#define MXCC_CTRLREG_PE 0x8 /* Parity enable */
198#define MXCC_CTRLREG_MC 0x10 /* Multiple command enable */ 198#define MXCC_CTRLREG_MC 0x10 /* Multiple command enable */
199#define MXCC_CTRLREG_PF 0x20 /* Prefetch enable */ 199#define MXCC_CTRLREG_PF 0x20 /* Prefetch enable */
200#define MXCC_CTRLREG_WI 0x40 /* Write invalidate (Xbus only) */ 200#define MXCC_CTRLREG_WI 0x40 /* Write invalidate (Xbus only) */
201#define MXCC_CTRLREG_BWC_MASK 0x180 /* Bus watch count (Xbus only) */ 201#define MXCC_CTRLREG_BWC_MASK 0x180 /* Bus watch count (Xbus only) */
202#define MXCC_CTRLREG_RC 0x200 /* Read reference count */ 202#define MXCC_CTRLREG_RC 0x200 /* Read reference count */
203 203
204/* Bits in MXCC_MRST */ 204/* Bits in MXCC_MRST */
205#define MXCC_MRST_SI 0x00000002 /* Software Internal reset */ 205#define MXCC_MRST_SI 0x00000002 /* Software Internal reset */
206#define MXCC_MRST_WD 0x00000004 /* Watchdog reset */ 206#define MXCC_MRST_WD 0x00000004 /* Watchdog reset */
207 207
208/* 208/*
209 * Stream register usage: 209 * Stream register usage:
210 * To fill a block with some value, load that value into the 64 byte 210 * To fill a block with some value, load that value into the 64 byte
211 * stream data register (using double-word access; on Mbus only the 211 * stream data register (using double-word access; on Mbus only the
212 * lower 32 bytes are used), then write the physical address of 212 * lower 32 bytes are used), then write the physical address of
213 * the destination into the stream destination register. 213 * the destination into the stream destination register.
214 * 214 *
215 * To copy a block, write the physical address of the source into 215 * To copy a block, write the physical address of the source into
216 * the stream source register causing the block to be transferred 216 * the stream source register causing the block to be transferred
217 * into the stream data register, then write the physical address of 217 * into the stream data register, then write the physical address of
218 * the destination into the stream destination register. 218 * the destination into the stream destination register.
219 * 219 *
220 * In both cases, or in the MXCC_STREAM_CE bit to make the transactions 220 * In both cases, or in the MXCC_STREAM_CE bit to make the transactions
221 * cache-coherent. Note that stream operations do not cause cache 221 * cache-coherent. Note that stream operations do not cause cache
222 * lines to be allocated. 222 * lines to be allocated.
223 */ 223 */
224#define MXCC_STREAM_BLKSZ 32 /* Unit for stream ops */ 224#define MXCC_STREAM_BLKSZ 32 /* Unit for stream ops */
225#define MXCC_STREAM_C 0x1000000000ULL /* Cacheable bit for stream ops */ 225#define MXCC_STREAM_C 0x1000000000ULL /* Cacheable bit for stream ops */
226 226
227/* 227/*
228 * Bits in ASI_SRMMUFP space. 228 * Bits in ASI_SRMMUFP space.
229 * Bits 8-11 determine the type of flush/probe. 229 * Bits 8-11 determine the type of flush/probe.
230 * Address bits 12-31 hold the page frame. 230 * Address bits 12-31 hold the page frame.
231 */ 231 */
232#define ASI_SRMMUFP_L3 (0<<8) /* probe L3 | flush L3 PTE */ 232#define ASI_SRMMUFP_L3 (0<<8) /* probe L3 | flush L3 PTE */
233#define ASI_SRMMUFP_L2 (1<<8) /* probe L2 | flush L2/L3 PTE/PTD's */ 233#define ASI_SRMMUFP_L2 (1<<8) /* probe L2 | flush L2/L3 PTE/PTD's */
234#define ASI_SRMMUFP_L1 (2<<8) /* probe L1 | flush L1/L2/L3 PTE/PTD's*/ 234#define ASI_SRMMUFP_L1 (2<<8) /* probe L1 | flush L1/L2/L3 PTE/PTD's*/
235#define ASI_SRMMUFP_L0 (3<<8) /* probe L0 | flush L0/L1/L2/L3 PTE/PTD's */ 235#define ASI_SRMMUFP_L0 (3<<8) /* probe L0 | flush L0/L1/L2/L3 PTE/PTD's */
236#define ASI_SRMMUFP_LN (4<<8) /* probe all | flush all levels */ 236#define ASI_SRMMUFP_LN (4<<8) /* probe all | flush all levels */
237 237
238/* 238/*
239 * [4m] Registers and bits in the SPARC Reference MMU (ASI_SRMMU). 239 * [4m] Registers and bits in the SPARC Reference MMU (ASI_SRMMU).
240 */ 240 */
241#define SRMMU_PCR 0x00000000 /* Processor control register */ 241#define SRMMU_PCR 0x00000000 /* Processor control register */
242#define SRMMU_CXTPTR 0x00000100 /* Context table pointer register */ 242#define SRMMU_CXTPTR 0x00000100 /* Context table pointer register */
243#define SRMMU_CXR 0x00000200 /* Context register */ 243#define SRMMU_CXR 0x00000200 /* Context register */
244#define SRMMU_SFSR 0x00000300 /* Synchronous fault status reg */ 244#define SRMMU_SFSR 0x00000300 /* Synchronous fault status reg */
245#define SRMMU_SFAR 0x00000400 /* Synchronous fault address reg */ 245#define SRMMU_SFAR 0x00000400 /* Synchronous fault address reg */
246#define SRMMU_AFSR 0x00000500 /* Asynchronous fault status reg (HS) */ 246#define SRMMU_AFSR 0x00000500 /* Asynchronous fault status reg (HS) */
247#define SRMMU_AFAR 0x00000600 /* Asynchronous fault address reg (HS)*/ 247#define SRMMU_AFAR 0x00000600 /* Asynchronous fault address reg (HS)*/
248#define SRMMU_PCFG 0x00000600 /* Processor configuration reg (TURBO)*/ 248#define SRMMU_PCFG 0x00000600 /* Processor configuration reg (TURBO)*/
249#define SRMMU_RST 0x00000700 /* Reset reg */ 249#define SRMMU_RST 0x00000700 /* Reset reg */
250#define SRMMU_TLBCTRL 0x00001000 /* TLB replacement control reg */ 250#define SRMMU_TLBCTRL 0x00001000 /* TLB replacement control reg */
251 251
252 252
253/* 253/*
254 * [4m] Bits in SRMMU control register. One set per module. 254 * [4m] Bits in SRMMU control register. One set per module.
255 */ 255 */
256 256
257/* Bits 0 and 1 are common between implementations */ 257/* Bits 0 and 1 are common between implementations */
258#define SRMMU_PCR_ME 0x00000001 /* MMU Enable */ 258#define SRMMU_PCR_ME 0x00000001 /* MMU Enable */
259#define SRMMU_PCR_NF 0x00000002 /* Fault inhibit bit */ 259#define SRMMU_PCR_NF 0x00000002 /* Fault inhibit bit */
260 260
261#define VIKING_PCR_ME SRMMU_PCR_ME /* MMU Enable */ 261#define VIKING_PCR_ME SRMMU_PCR_ME /* MMU Enable */
262#define VIKING_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */ 262#define VIKING_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */
263#define VIKING_PCR_PSO 0x00000080 /* Partial Store Ordering enable */ 263#define VIKING_PCR_PSO 0x00000080 /* Partial Store Ordering enable */
264#define VIKING_PCR_DCE 0x00000100 /* Data cache enable bit */ 264#define VIKING_PCR_DCE 0x00000100 /* Data cache enable bit */
265#define VIKING_PCR_ICE 0x00000200 /* SuperSPARC instr. cache enable */ 265#define VIKING_PCR_ICE 0x00000200 /* SuperSPARC instr. cache enable */
266#define VIKING_PCR_SB 0x00000400 /* Store buffer enable bit */ 266#define VIKING_PCR_SB 0x00000400 /* Store buffer enable bit */
267#define VIKING_PCR_MB 0x00000800 /* MBus mode: 0=MXCC, 1=no MXCC */ 267#define VIKING_PCR_MB 0x00000800 /* MBus mode: 0=MXCC, 1=no MXCC */
268#define VIKING_PCR_PE 0x00001000 /* Enable memory parity checking */ 268#define VIKING_PCR_PE 0x00001000 /* Enable memory parity checking */
269#define VIKING_PCR_BM 0x00002000 /* 1 iff booting */ 269#define VIKING_PCR_BM 0x00002000 /* 1 iff booting */
270#define VIKING_PCR_SE 0x00004000 /* Coherent bus snoop enable */ 270#define VIKING_PCR_SE 0x00004000 /* Coherent bus snoop enable */
271#define VIKING_PCR_AC 0x00008000 /* 1=cache non-MMU accesses */ 271#define VIKING_PCR_AC 0x00008000 /* 1=cache non-MMU accesses */
272#define VIKING_PCR_TC 0x00010000 /* 1=cache table walks */ 272#define VIKING_PCR_TC 0x00010000 /* 1=cache table walks */
273 273
274#define HYPERSPARC_PCR_ME SRMMU_PCR_ME /* MMU Enable */ 274#define HYPERSPARC_PCR_ME SRMMU_PCR_ME /* MMU Enable */
275#define HYPERSPARC_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */ 275#define HYPERSPARC_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */
276#define HYPERSPARC_PCR_CE 0x00000100 /* Cache enable bit */ 276#define HYPERSPARC_PCR_CE 0x00000100 /* Cache enable bit */
277#define HYPERSPARC_PCR_CM 0x00000400 /* Cache mode: 1=write-back */ 277#define HYPERSPARC_PCR_CM 0x00000400 /* Cache mode: 1=write-back */
278#define HYPERSPARC_PCR_MR 0x00000800 /* Memory reflection: 1 = on */ 278#define HYPERSPARC_PCR_MR 0x00000800 /* Memory reflection: 1 = on */
279#define HYPERSPARC_PCR_CS 0x00001000 /* cache size: 1=256k, 0=128k */ 279#define HYPERSPARC_PCR_CS 0x00001000 /* cache size: 1=256k, 0=128k */
280#define HYPERSPARC_PCR_C 0x00002000 /* enable cache when MMU off */ 280#define HYPERSPARC_PCR_C 0x00002000 /* enable cache when MMU off */
281#define HYPERSPARC_PCR_BM 0x00004000 /* 1 iff booting */ 281#define HYPERSPARC_PCR_BM 0x00004000 /* 1 iff booting */
282#define HYPERSPARC_PCR_MID 0x00078000 /* MBus module ID MID<3:0> */ 282#define HYPERSPARC_PCR_MID 0x00078000 /* MBus module ID MID<3:0> */
283#define HYPERSPARC_PCR_WBE 0x00080000 /* Write buffer enable */ 283#define HYPERSPARC_PCR_WBE 0x00080000 /* Write buffer enable */
284#define HYPERSPARC_PCR_SE 0x00100000 /* Coherent bus snoop enable */ 284#define HYPERSPARC_PCR_SE 0x00100000 /* Coherent bus snoop enable */
285#define HYPERSPARC_PCR_CWR 0x00200000 /* Cache wrap enable */ 285#define HYPERSPARC_PCR_CWR 0x00200000 /* Cache wrap enable */
286 286
287#define CYPRESS_PCR_ME SRMMU_PCR_ME /* MMU Enable */ 287#define CYPRESS_PCR_ME SRMMU_PCR_ME /* MMU Enable */
288#define CYPRESS_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */ 288#define CYPRESS_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */
289#define CYPRESS_PCR_CE 0x00000100 /* Cache enable bit */ 289#define CYPRESS_PCR_CE 0x00000100 /* Cache enable bit */
290#define CYPRESS_PCR_CL 0x00000200 /* Cache Lock (604 only) */ 290#define CYPRESS_PCR_CL 0x00000200 /* Cache Lock (604 only) */
291#define CYPRESS_PCR_CM 0x00000400 /* Cache mode: 1=write-back */ 291#define CYPRESS_PCR_CM 0x00000400 /* Cache mode: 1=write-back */
292#define CYPRESS_PCR_MR 0x00000800 /* Memory reflection: 1=on (605 only) */ 292#define CYPRESS_PCR_MR 0x00000800 /* Memory reflection: 1=on (605 only) */
293#define CYPRESS_PCR_C 0x00002000 /* enable cache when MMU off */ 293#define CYPRESS_PCR_C 0x00002000 /* enable cache when MMU off */
294#define CYPRESS_PCR_BM 0x00004000 /* 1 iff booting */ 294#define CYPRESS_PCR_BM 0x00004000 /* 1 iff booting */
295#define CYPRESS_PCR_MID 0x00078000 /* MBus module ID MID<3:0> (605 only) */ 295#define CYPRESS_PCR_MID 0x00078000 /* MBus module ID MID<3:0> (605 only) */
296#define CYPRESS_PCR_MV 0x00080000 /* Multichip Valid */ 296#define CYPRESS_PCR_MV 0x00080000 /* Multichip Valid */
297#define CYPRESS_PCR_MCM 0x00300000 /* Multichip Mask */ 297#define CYPRESS_PCR_MCM 0x00300000 /* Multichip Mask */
298#define CYPRESS_PCR_MCA 0x00c00000 /* Multichip Address */ 298#define CYPRESS_PCR_MCA 0x00c00000 /* Multichip Address */
299 299
300#define MS1_PCR_ME SRMMU_PCR_ME /* MMU Enable */ 300#define MS1_PCR_ME SRMMU_PCR_ME /* MMU Enable */
301#define MS1_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */ 301#define MS1_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */
302#define MS1_PCR_DCE 0x00000100 /* Data cache enable */ 302#define MS1_PCR_DCE 0x00000100 /* Data cache enable */
303#define MS1_PCR_ICE 0x00000200 /* Instruction cache enable */ 303#define MS1_PCR_ICE 0x00000200 /* Instruction cache enable */
304#define MS1_PCR_RC 0x00000c00 /* DRAM Refresh control */ 304#define MS1_PCR_RC 0x00000c00 /* DRAM Refresh control */
305#define MS1_PCR_PE 0x00001000 /* Enable memory parity checking */ 305#define MS1_PCR_PE 0x00001000 /* Enable memory parity checking */
306#define MS1_PCR_BM 0x00004000 /* 1 iff booting */ 306#define MS1_PCR_BM 0x00004000 /* 1 iff booting */
307#define MS1_PCR_AC 0x00008000 /* 1=cache if ME==0 (and [ID]CE on) */ 307#define MS1_PCR_AC 0x00008000 /* 1=cache if ME==0 (and [ID]CE on) */
308#define MS1_PCR_ID 0x00010000 /* 1=disable ITBR */ 308#define MS1_PCR_ID 0x00010000 /* 1=disable ITBR */
309#define MS1_PCR_PC 0x00020000 /* Parity control: 0=even,1=odd */ 309#define MS1_PCR_PC 0x00020000 /* Parity control: 0=even,1=odd */
310#define MS1_PCR_MV 0x00100000 /* Memory data View (diag) */ 310#define MS1_PCR_MV 0x00100000 /* Memory data View (diag) */
311#define MS1_PCR_DV 0x00200000 /* Data View (diag) */ 311#define MS1_PCR_DV 0x00200000 /* Data View (diag) */
312#define MS1_PCR_AV 0x00400000 /* Address View (diag) */ 312#define MS1_PCR_AV 0x00400000 /* Address View (diag) */
313#define MS1_PCR_STW 0x00800000 /* Software Tablewalk enable */ 313#define MS1_PCR_STW 0x00800000 /* Software Tablewalk enable */
314 314
315#define SWIFT_PCR_ME SRMMU_PCR_ME /* MMU Enable */ 315#define SWIFT_PCR_ME SRMMU_PCR_ME /* MMU Enable */
316#define SWIFT_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */ 316#define SWIFT_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */
317#define SWIFT_PCR_SA 0x00000080 /* Store Allocate */ 317#define SWIFT_PCR_SA 0x00000080 /* Store Allocate */
318#define SWIFT_PCR_DCE 0x00000100 /* Data cache enable */ 318#define SWIFT_PCR_DCE 0x00000100 /* Data cache enable */
319#define SWIFT_PCR_ICE 0x00000200 /* Instruction cache enable */ 319#define SWIFT_PCR_ICE 0x00000200 /* Instruction cache enable */
320#define SWIFT_PCR_RC 0x00003c00 /* DRAM Refresh control */ 320#define SWIFT_PCR_RC 0x00003c00 /* DRAM Refresh control */
321#define SWIFT_PCR_BM 0x00004000 /* 1 iff booting */ 321#define SWIFT_PCR_BM 0x00004000 /* 1 iff booting */
322#define SWIFT_PCR_AC 0x00008000 /* 1=cache if ME=0 (and [ID]CE on) */ 322#define SWIFT_PCR_AC 0x00008000 /* 1=cache if ME=0 (and [ID]CE on) */
323#define SWIFT_PCR_PA 0x00010000 /* TCX/SX control */ 323#define SWIFT_PCR_PA 0x00010000 /* TCX/SX control */
324#define SWIFT_PCR_PC 0x00020000 /* Parity control: 0=even,1=odd */ 324#define SWIFT_PCR_PC 0x00020000 /* Parity control: 0=even,1=odd */
325#define SWIFT_PCR_PE 0x00040000 /* Enable memory parity checking */ 325#define SWIFT_PCR_PE 0x00040000 /* Enable memory parity checking */
326#define SWIFT_PCR_PMC 0x00180000 /* Page mode control */ 326#define SWIFT_PCR_PMC 0x00180000 /* Page mode control */
327#define SWIFT_PCR_BF 0x00200000 /* Branch Folding */ 327#define SWIFT_PCR_BF 0x00200000 /* Branch Folding */
328#define SWIFT_PCR_WP 0x00400000 /* Watch point enable */ 328#define SWIFT_PCR_WP 0x00400000 /* Watch point enable */
329#define SWIFT_PCR_STW 0x00800000 /* Software Tablewalk enable */ 329#define SWIFT_PCR_STW 0x00800000 /* Software Tablewalk enable */
330 330
331#define TURBOSPARC_PCR_ME SRMMU_PCR_ME /* MMU Enable */ 331#define TURBOSPARC_PCR_ME SRMMU_PCR_ME /* MMU Enable */
332#define TURBOSPARC_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */ 332#define TURBOSPARC_PCR_NF SRMMU_PCR_NF /* Fault inhibit bit */
333#define TURBOSPARC_PCR_ICS 0x00000004 /* I-cache snoop enable */ 333#define TURBOSPARC_PCR_ICS 0x00000004 /* I-cache snoop enable */
334#define TURBOSPARC_PCR_PSO 0x00000008 /* Partial Store order (ro!) */ 334#define TURBOSPARC_PCR_PSO 0x00000008 /* Partial Store order (ro!) */
335#define TURBOSPARC_PCR_DCE 0x00000100 /* Data cache enable */ 335#define TURBOSPARC_PCR_DCE 0x00000100 /* Data cache enable */
336#define TURBOSPARC_PCR_ICE 0x00000200 /* Instruction cache enable */ 336#define TURBOSPARC_PCR_ICE 0x00000200 /* Instruction cache enable */
337#define TURBOSPARC_PCR_RC 0x00003c00 /* DRAM Refresh control */ 337#define TURBOSPARC_PCR_RC 0x00003c00 /* DRAM Refresh control */
338#define TURBOSPARC_PCR_BM 0x00004000 /* 1 iff booting */ 338#define TURBOSPARC_PCR_BM 0x00004000 /* 1 iff booting */
339#define TURBOSPARC_PCR_PC 0x00020000 /* Parity ctrl: 0=even,1=odd */ 339#define TURBOSPARC_PCR_PC 0x00020000 /* Parity ctrl: 0=even,1=odd */
340#define TURBOSPARC_PCR_PE 0x00040000 /* Enable parity checking */ 340#define TURBOSPARC_PCR_PE 0x00040000 /* Enable parity checking */
341#define TURBOSPARC_PCR_PMC 0x00180000 /* Page mode control */ 341#define TURBOSPARC_PCR_PMC 0x00180000 /* Page mode control */
342 342
343/* The Turbosparc's Processor Configuration Register */ 343/* The Turbosparc's Processor Configuration Register */
344#define TURBOSPARC_PCFG_SCC 0x00000007 /* e-cache config */ 344#define TURBOSPARC_PCFG_SCC 0x00000007 /* e-cache config */
345#define TURBOSPARC_PCFG_SE 0x00000008 /* e-cache enable */ 345#define TURBOSPARC_PCFG_SE 0x00000008 /* e-cache enable */
346#define TURBOSPARC_PCFG_US2 0x00000010 /* microsparc II compat */ 346#define TURBOSPARC_PCFG_US2 0x00000010 /* microsparc II compat */
347#define TURBOSPARC_PCFG_WT 0x00000020 /* write-through enable */ 347#define TURBOSPARC_PCFG_WT 0x00000020 /* write-through enable */
348#define TURBOSPARC_PCFG_SBC 0x000000c0 /* SBus Clock */ 348#define TURBOSPARC_PCFG_SBC 0x000000c0 /* SBus Clock */
349#define TURBOSPARC_PCFG_WS 0x03800000 /* DRAM wait states */ 349#define TURBOSPARC_PCFG_WS 0x03800000 /* DRAM wait states */
350#define TURBOSPARC_PCFG_RAH 0x0c000000 /* DRAM Row Address Hold */ 350#define TURBOSPARC_PCFG_RAH 0x0c000000 /* DRAM Row Address Hold */
351#define TURBOSPARC_PCFG_AXC 0x30000000 /* AFX Clock */ 351#define TURBOSPARC_PCFG_AXC 0x30000000 /* AFX Clock */
352#define TURBOSPARC_PCFG_SNP 0x40000000 /* DVMA Snoop enable */ 352#define TURBOSPARC_PCFG_SNP 0x40000000 /* DVMA Snoop enable */
353#define TURBOSPARC_PCFG_IOCLK 0x80000000 /* I/O clock ratio */ 353#define TURBOSPARC_PCFG_IOCLK 0x80000000 /* I/O clock ratio */
354 354
355 355
356/* Implementation and Version fields are common to all modules */ 356/* Implementation and Version fields are common to all modules */
357#define SRMMU_PCR_VER 0x0f000000 /* Version of MMU implementation */ 357#define SRMMU_PCR_VER 0x0f000000 /* Version of MMU implementation */
358#define SRMMU_PCR_IMPL 0xf0000000 /* Implementation number of MMU */ 358#define SRMMU_PCR_IMPL 0xf0000000 /* Implementation number of MMU */
359 359
360 360
361/* [4m] Bits in the Synchronous Fault Status Register */ 361/* [4m] Bits in the Synchronous Fault Status Register */
362#define SFSR_EM 0x00020000 /* Error mode watchdog reset occurred */ 362#define SFSR_EM 0x00020000 /* Error mode watchdog reset occurred */
363#define SFSR_CS 0x00010000 /* Control Space error */ 363#define SFSR_CS 0x00010000 /* Control Space error */
364#define SFSR_SB 0x00008000 /* SS: Store Buffer Error */ 364#define SFSR_SB 0x00008000 /* SS: Store Buffer Error */
365#define SFSR_PERR 0x00006000 /* Parity error code */ 365#define SFSR_PERR 0x00006000 /* Parity error code */
366#define SFSR_P 0x00004000 /* SS: Parity error */ 366#define SFSR_P 0x00004000 /* SS: Parity error */
367#define SFSR_UC 0x00001000 /* Uncorrectable error */ 367#define SFSR_UC 0x00001000 /* Uncorrectable error */
368#define SFSR_TO 0x00000800 /* S-Bus timeout */ 368#define SFSR_TO 0x00000800 /* S-Bus timeout */
369#define SFSR_BE 0x00000400 /* S-Bus bus error */ 369#define SFSR_BE 0x00000400 /* S-Bus bus error */
370#define SFSR_LVL 0x00000300 /* Pagetable level causing the fault */ 370#define SFSR_LVL 0x00000300 /* Pagetable level causing the fault */
371#define SFSR_AT 0x000000e0 /* Access type */ 371#define SFSR_AT 0x000000e0 /* Access type */
372#define SFSR_FT 0x0000001c /* Fault type */ 372#define SFSR_FT 0x0000001c /* Fault type */
373#define SFSR_FAV 0x00000002 /* Fault Address is valid */ 373#define SFSR_FAV 0x00000002 /* Fault Address is valid */
374#define SFSR_OW 0x00000001 /* Overwritten with new fault */ 374#define SFSR_OW 0x00000001 /* Overwritten with new fault */
375 375
376#define SFSR_BITS "\177\020" \ 376#define SFSR_BITS "\177\020" \
377 "b\21EM\0b\20CS\0b\17SB\0f\15\2PERR\0" \ 377 "b\21EM\0b\20CS\0b\17SB\0f\15\2PERR\0" \
378 "b\14UC\0b\13TO\0b\12BE\0f\10\2LVL\0" \ 378 "b\14UC\0b\13TO\0b\12BE\0f\10\2LVL\0" \
379 "f\05\3AT\0f\02\3FT\0b\01FAV\0b\01OW" 379 "f\05\3AT\0f\02\3FT\0b\01FAV\0b\01OW\0"
380 380
381/* [4m] Synchronous Fault Types */ 381/* [4m] Synchronous Fault Types */
382#define SFSR_FT_NONE (0 << 2) /* no fault */ 382#define SFSR_FT_NONE (0 << 2) /* no fault */
383#define SFSR_FT_INVADDR (1 << 2) /* invalid address fault */ 383#define SFSR_FT_INVADDR (1 << 2) /* invalid address fault */
384#define SFSR_FT_PROTERR (2 << 2) /* protection fault */ 384#define SFSR_FT_PROTERR (2 << 2) /* protection fault */
385#define SFSR_FT_PRIVERR (3 << 2) /* privelege violation */ 385#define SFSR_FT_PRIVERR (3 << 2) /* privelege violation */
386#define SFSR_FT_TRANSERR (4 << 2) /* translation fault */ 386#define SFSR_FT_TRANSERR (4 << 2) /* translation fault */
387#define SFSR_FT_BUSERR (5 << 2) /* access bus error */ 387#define SFSR_FT_BUSERR (5 << 2) /* access bus error */
388#define SFSR_FT_INTERR (6 << 2) /* internal error */ 388#define SFSR_FT_INTERR (6 << 2) /* internal error */
389#define SFSR_FT_RESERVED (7 << 2) /* reserved */ 389#define SFSR_FT_RESERVED (7 << 2) /* reserved */
390 390
391/* [4m] Synchronous Fault Access Types */ 391/* [4m] Synchronous Fault Access Types */
392#define SFSR_AT_LDUDATA (0 << 5) /* Load user data */ 392#define SFSR_AT_LDUDATA (0 << 5) /* Load user data */
393#define SFSR_AT_LDSDATA (1 << 5) /* Load supervisor data */ 393#define SFSR_AT_LDSDATA (1 << 5) /* Load supervisor data */
394#define SFSR_AT_LDUTEXT (2 << 5) /* Load user text */ 394#define SFSR_AT_LDUTEXT (2 << 5) /* Load user text */
395#define SFSR_AT_LDSTEXT (3 << 5) /* Load supervisor text */ 395#define SFSR_AT_LDSTEXT (3 << 5) /* Load supervisor text */
396#define SFSR_AT_STUDATA (4 << 5) /* Store user data */ 396#define SFSR_AT_STUDATA (4 << 5) /* Store user data */
397#define SFSR_AT_STSDATA (5 << 5) /* Store supervisor data */ 397#define SFSR_AT_STSDATA (5 << 5) /* Store supervisor data */
398#define SFSR_AT_STUTEXT (6 << 5) /* Store user text */ 398#define SFSR_AT_STUTEXT (6 << 5) /* Store user text */
399#define SFSR_AT_STSTEXT (7 << 5) /* Store supervisor text */ 399#define SFSR_AT_STSTEXT (7 << 5) /* Store supervisor text */
400#define SFSR_AT_SUPERVISOR (1 << 5) /* Set iff supervisor */ 400#define SFSR_AT_SUPERVISOR (1 << 5) /* Set iff supervisor */
401#define SFSR_AT_TEXT (2 << 5) /* Set iff text */ 401#define SFSR_AT_TEXT (2 << 5) /* Set iff text */
402#define SFSR_AT_STORE (4 << 5) /* Set iff store */ 402#define SFSR_AT_STORE (4 << 5) /* Set iff store */
403 403
404/* [4m] Synchronous Fault PT Levels */ 404/* [4m] Synchronous Fault PT Levels */
405#define SFSR_LVL_0 (0 << 8) /* Context table entry */ 405#define SFSR_LVL_0 (0 << 8) /* Context table entry */
406#define SFSR_LVL_1 (1 << 8) /* Region table entry */ 406#define SFSR_LVL_1 (1 << 8) /* Region table entry */
407#define SFSR_LVL_2 (2 << 8) /* Segment table entry */ 407#define SFSR_LVL_2 (2 << 8) /* Segment table entry */
408#define SFSR_LVL_3 (3 << 8) /* Page table entry */ 408#define SFSR_LVL_3 (3 << 8) /* Page table entry */
409 409
410/* [4m] Asynchronous Fault Status Register bits */ 410/* [4m] Asynchronous Fault Status Register bits */
411#define AFSR_AFO 0x00000001 /* Async. fault occurred */ 411#define AFSR_AFO 0x00000001 /* Async. fault occurred */
412#define AFSR_AFA 0x000000f0 /* Bits <35:32> of faulting phys addr */ 412#define AFSR_AFA 0x000000f0 /* Bits <35:32> of faulting phys addr */
413#define AFSR_AFA_RSHIFT 4 /* Shift to get AFA to bit 0 */ 413#define AFSR_AFA_RSHIFT 4 /* Shift to get AFA to bit 0 */
414#define AFSR_AFA_LSHIFT 28 /* Shift to get AFA to bit 32 */ 414#define AFSR_AFA_LSHIFT 28 /* Shift to get AFA to bit 32 */
415#define AFSR_BE 0x00000400 /* Bus error */ 415#define AFSR_BE 0x00000400 /* Bus error */
416#define AFSR_TO 0x00000800 /* Bus timeout */ 416#define AFSR_TO 0x00000800 /* Bus timeout */
417#define AFSR_UC 0x00001000 /* Uncorrectable error */ 417#define AFSR_UC 0x00001000 /* Uncorrectable error */
418#define AFSR_SE 0x00002000 /* System error */ 418#define AFSR_SE 0x00002000 /* System error */
419 419
420#define AFSR_BITS "\177\020" \ 420#define AFSR_BITS "\177\020" \
421 "b\15SE\0b\14UC\0b\13TO\0b\12BE\0f\04\4AFA\0b\0AFO\0" 421 "b\15SE\0b\14UC\0b\13TO\0b\12BE\0f\04\4AFA\0b\0AFO\0"
422 422
423/* [4m] TLB Replacement Control Register bits */ 423/* [4m] TLB Replacement Control Register bits */
424#define TLBC_DISABLE 0x00000020 /* Disable replacement counter */ 424#define TLBC_DISABLE 0x00000020 /* Disable replacement counter */
425#define TLBC_RCNTMASK 0x0000001f /* Replacement counter (0-31) */ 425#define TLBC_RCNTMASK 0x0000001f /* Replacement counter (0-31) */
426 426
427/* [4m] SRMMU Reset Register bits */ 427/* [4m] SRMMU Reset Register bits */
428#define SRMMU_RST_SI 0x00000002 /* Software Internal reset */ 428#define SRMMU_RST_SI 0x00000002 /* Software Internal reset */
429#define SRMMU_RST_WD 0x00000004 /* Watchdog reset */ 429#define SRMMU_RST_WD 0x00000004 /* Watchdog reset */
430 430
431/* 431/*
432 * The Ross Hypersparc has an Instruction Cache Control Register (ICCR) 432 * The Ross Hypersparc has an Instruction Cache Control Register (ICCR)
433 * It contains an enable bit for the on-chip instruction cache and a bit 433 * It contains an enable bit for the on-chip instruction cache and a bit
434 * that controls whether a FLUSH instruction causes an Unimplemented 434 * that controls whether a FLUSH instruction causes an Unimplemented
435 * Flush Trap or just flushes the appropriate instruction cache line. 435 * Flush Trap or just flushes the appropriate instruction cache line.
436 * The ICCR register is implemented as Ancillary State register number 31. 436 * The ICCR register is implemented as Ancillary State register number 31.
437 */ 437 */
438#define HYPERSPARC_ICCR_ICE 1 /* Instruction cache enable */ 438#define HYPERSPARC_ICCR_ICE 1 /* Instruction cache enable */
439#define HYPERSPARC_ICCR_FTD 2 /* Unimpl. flush trap disable */ 439#define HYPERSPARC_ICCR_FTD 2 /* Unimpl. flush trap disable */
440#define HYPERSPARC_ASRNUM_ICCR 31 /* ICCR == ASR#31 */ 440#define HYPERSPARC_ASRNUM_ICCR 31 /* ICCR == ASR#31 */
441 441
442 442
443/* 443/*
444 * microSPARC-IIep has control space registers in PA[30:28] = 0x1 444 * microSPARC-IIep has control space registers in PA[30:28] = 0x1
445 */ 445 */
446 446
447/* Asynchronous memory Fault Status/Address Registers */ 447/* Asynchronous memory Fault Status/Address Registers */
448#define MSIIEP_AFSR 0x10001000 448#define MSIIEP_AFSR 0x10001000
449#define MSIIEP_AFAR 0x10001004 449#define MSIIEP_AFAR 0x10001004
450 450
451#define MSIIEP_AFSR_ERR 0x80000000 /* summary bit: LE || TO || BE */ 451#define MSIIEP_AFSR_ERR 0x80000000 /* summary bit: LE || TO || BE */
452#define MSIIEP_AFSR_LE 0x40000000 /* late error */ 452#define MSIIEP_AFSR_LE 0x40000000 /* late error */
453#define MSIIEP_AFSR_TO 0x20000000 /* time out */ 453#define MSIIEP_AFSR_TO 0x20000000 /* time out */
454#define MSIIEP_AFSR_BE 0x10000000 /* bus error */ 454#define MSIIEP_AFSR_BE 0x10000000 /* bus error */
455#define MSIIEP_AFSR_S 0x01000000 /* supervisor */ 455#define MSIIEP_AFSR_S 0x01000000 /* supervisor */
456#define MSIIEP_AFSR_ME 0x00080000 /* multiple error */ 456#define MSIIEP_AFSR_ME 0x00080000 /* multiple error */
457#define MSIIEP_AFSR_RD 0x00040000 /* read operation */ 457#define MSIIEP_AFSR_RD 0x00040000 /* read operation */
458#define MSIIEP_AFSR_FAV 0x00020000 /* fault address valid */ 458#define MSIIEP_AFSR_FAV 0x00020000 /* fault address valid */
459 459
460#define MSIIEP_AFSR_BITS "\177\20" \ 460#define MSIIEP_AFSR_BITS "\177\20" \
461 "b\37ERR\0" "b\36LE\0" "b\35TO\0" "b\34BE\0" \ 461 "b\37ERR\0" "b\36LE\0" "b\35TO\0" "b\34BE\0" \
462 "b\30S\0" "b\23ME\0" "b\22RD\0" "b\21FAV\0" 462 "b\30S\0" "b\23ME\0" "b\22RD\0" "b\21FAV\0"
463 463
464 464
465/* Memory Fault Status/Address Registers (parity faults) */ 465/* Memory Fault Status/Address Registers (parity faults) */
466#define MSIIEP_MFSR 0x10001050 466#define MSIIEP_MFSR 0x10001050
467#define MSIIEP_MFAR 0x10001054 467#define MSIIEP_MFAR 0x10001054
468 468
469#define MSIIEP_MFSR_ERR 0x80000000 /* summary bit */ 469#define MSIIEP_MFSR_ERR 0x80000000 /* summary bit */
470#define MSIIEP_MFSR_S 0x01000000 /* supervisor */ 470#define MSIIEP_MFSR_S 0x01000000 /* supervisor */
471#define MSIIEP_MFSR_CP 0x00800000 /* CPU transaction */ 471#define MSIIEP_MFSR_CP 0x00800000 /* CPU transaction */
472#define MSIIEP_MFSR_ME 0x00080000 /* multiple error */ 472#define MSIIEP_MFSR_ME 0x00080000 /* multiple error */
473#define MSIIEP_MFSR_ATO 0x00008000 /* PCI local bus timeout */ 473#define MSIIEP_MFSR_ATO 0x00008000 /* PCI local bus timeout */
474#define MSIIEP_MFSR_PERR_1 0x00004000 /* parity error [1] */ 474#define MSIIEP_MFSR_PERR_1 0x00004000 /* parity error [1] */
475#define MSIIEP_MFSR_PERR_0 0x00002000 /* parity error [0] */ 475#define MSIIEP_MFSR_PERR_0 0x00002000 /* parity error [0] */
476#define MSIIEP_MFSR_BM 0x00001000 /* boot mode */ 476#define MSIIEP_MFSR_BM 0x00001000 /* boot mode */
477#define MSIIEP_MFSR_C 0x00000800 /* cacheable */ 477#define MSIIEP_MFSR_C 0x00000800 /* cacheable */
478#define MSIIEP_MFSR_REQ 0x000000f0 /* request type */ 478#define MSIIEP_MFSR_REQ 0x000000f0 /* request type */
479 479
480#define MSIIEP_MFSR_REQ_NOP 0x00 480#define MSIIEP_MFSR_REQ_NOP 0x00
481#define MSIIEP_MFSR_REQ_RD64 0x10 481#define MSIIEP_MFSR_REQ_RD64 0x10
482#define MSIIEP_MFSR_REQ_RD128 0x20 482#define MSIIEP_MFSR_REQ_RD128 0x20
483#define MSIIEP_MFSR_REQ_RD256 0x40 483#define MSIIEP_MFSR_REQ_RD256 0x40
484#define MSIIEP_MFSR_REQ_WR8 0x90 484#define MSIIEP_MFSR_REQ_WR8 0x90
485#define MSIIEP_MFSR_REQ_WR16 0xa0 485#define MSIIEP_MFSR_REQ_WR16 0xa0
486#define MSIIEP_MFSR_REQ_WR32 0xb0 486#define MSIIEP_MFSR_REQ_WR32 0xb0
487#define MSIIEP_MFSR_REQ_WR64 0xc0 487#define MSIIEP_MFSR_REQ_WR64 0xc0
488 488
489#define MSIIEP_MFSR_BITS "\177\20" \ 489#define MSIIEP_MFSR_BITS "\177\20" \
490 "b\37ERR\0" "b\30S\0" "b\27CP\0" "b\23ME\0" "b\17ATO\0" \ 490 "b\37ERR\0" "b\30S\0" "b\27CP\0" "b\23ME\0" "b\17ATO\0" \
491 "b\16PERR1\0" "b\15PERR0\0" "b\14BM\0" "b\13C\0" \ 491 "b\16PERR1\0" "b\15PERR0\0" "b\14BM\0" "b\13C\0" \
492 "f\4\4REQ\0" ":\0(NOP)\0" ":\1(RD64)\0" ":\2(RD128)\0" \ 492 "f\4\4REQ\0" ":\0(NOP)\0" ":\1(RD64)\0" ":\2(RD128)\0" \
493 ":\4(RD256)\0" ":\11(WR8)\0" ":\12(WR16)\0" ":\13(WR32)\0" \ 493 ":\4(RD256)\0" ":\11(WR8)\0" ":\12(WR16)\0" ":\13(WR32)\0" \
494 ":\14(WR64)\0" 494 ":\14(WR64)\0"

cvs diff -r1.2 -r1.3 src/sys/dev/pci/if_xgereg.h (switch to unified diff)

--- src/sys/dev/pci/if_xgereg.h 2005/12/11 12:22:50 1.2
+++ src/sys/dev/pci/if_xgereg.h 2019/08/29 05:55:19 1.3
@@ -1,427 +1,427 @@ @@ -1,427 +1,427 @@
1/* $NetBSD: if_xgereg.h,v 1.2 2005/12/11 12:22:50 christos Exp $ */ 1/* $NetBSD: if_xgereg.h,v 1.3 2019/08/29 05:55:19 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004, SUNET, Swedish University Computer Network. 4 * Copyright (c) 2004, SUNET, Swedish University Computer Network.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Anders Magnusson for SUNET, Swedish University Computer Network. 7 * Written by Anders Magnusson for SUNET, Swedish University Computer Network.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution. 16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software 17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement: 18 * must display the following acknowledgement:
19 * This product includes software developed for the NetBSD Project by 19 * This product includes software developed for the NetBSD Project by
20 * SUNET, Swedish University Computer Network. 20 * SUNET, Swedish University Computer Network.
21 * 4. The name of SUNET may not be used to endorse or promote products 21 * 4. The name of SUNET may not be used to endorse or promote products
22 * derived from this software without specific prior written permission. 22 * derived from this software without specific prior written permission.
23 * 23 *
24 * THIS SOFTWARE IS PROVIDED BY SUNET ``AS IS'' AND 24 * THIS SOFTWARE IS PROVIDED BY SUNET ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SUNET 27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SUNET
28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE. 34 * POSSIBILITY OF SUCH DAMAGE.
35 */ 35 */
36 36
37 37
38/* 38/*
39 * Defines for the S2io Xframe adapter. 39 * Defines for the S2io Xframe adapter.
40 */ 40 */
41 41
42/* PCI address space */ 42/* PCI address space */
43#define XGE_PIF_BAR 0x10 43#define XGE_PIF_BAR 0x10
44#define XGE_TXP_BAR 0x18 44#define XGE_TXP_BAR 0x18
45 45
46/* PIF register address calculation */ 46/* PIF register address calculation */
47#define DCSRB(x) (0x0000+(x)) /* 10GbE Device Control and Status Registers */ 47#define DCSRB(x) (0x0000+(x)) /* 10GbE Device Control and Status Registers */
48#define PCIXB(x) (0x0800+(x)) /* PCI-X Interface Functional Registers */ 48#define PCIXB(x) (0x0800+(x)) /* PCI-X Interface Functional Registers */
49#define TDMAB(x) (0x1000+(x)) /* Transmit DMA Functional Registers */ 49#define TDMAB(x) (0x1000+(x)) /* Transmit DMA Functional Registers */
50#define RDMAB(x) (0x1800+(x)) /* Receive DMA Functional Registers */ 50#define RDMAB(x) (0x1800+(x)) /* Receive DMA Functional Registers */
51#define MACRB(x) (0x2000+(x)) /* MAC functional registers */ 51#define MACRB(x) (0x2000+(x)) /* MAC functional registers */
52#define RLDRB(x) (0x2800+(x)) /* RLDRAM memory controller */ 52#define RLDRB(x) (0x2800+(x)) /* RLDRAM memory controller */
53#define XGXSB(x) (0x3000+(x)) /* XGXS functional Registers */ 53#define XGXSB(x) (0x3000+(x)) /* XGXS functional Registers */
54 54
55/* 55/*
56 * Control and Status Registers 56 * Control and Status Registers
57 */ 57 */
58#define GENERAL_INT_STATUS DCSRB(0x0000) 58#define GENERAL_INT_STATUS DCSRB(0x0000)
59#define GENERAL_INT_MASK DCSRB(0x0008) 59#define GENERAL_INT_MASK DCSRB(0x0008)
60#define SW_RESET DCSRB(0x0100) 60#define SW_RESET DCSRB(0x0100)
61#define XGXS_RESET(x) ((uint64_t)(x) << 32) 61#define XGXS_RESET(x) ((uint64_t)(x) << 32)
62#define ADAPTER_STATUS DCSRB(0x0108) 62#define ADAPTER_STATUS DCSRB(0x0108)
63#define TDMA_READY (1ULL<<63) 63#define TDMA_READY (1ULL<<63)
64#define RDMA_READY (1ULL<<62) 64#define RDMA_READY (1ULL<<62)
65#define PFC_READY (1ULL<<61) 65#define PFC_READY (1ULL<<61)
66#define TMAC_BUF_EMPTY (1ULL<<60) 66#define TMAC_BUF_EMPTY (1ULL<<60)
67#define PIC_QUIESCENT (1ULL<<58) 67#define PIC_QUIESCENT (1ULL<<58)
68#define RMAC_REMOTE_FAULT (1ULL<<57) 68#define RMAC_REMOTE_FAULT (1ULL<<57)
69#define RMAC_LOCAL_FAULT (1ULL<<56) 69#define RMAC_LOCAL_FAULT (1ULL<<56)
70#define MC_DRAM_READY (1ULL<<39) 70#define MC_DRAM_READY (1ULL<<39)
71#define MC_QUEUES_READY (1ULL<<38) 71#define MC_QUEUES_READY (1ULL<<38)
72#define M_PLL_LOCK (1ULL<<33) 72#define M_PLL_LOCK (1ULL<<33)
73#define P_PLL_LOCK (1ULL<<32) 73#define P_PLL_LOCK (1ULL<<32)
74#define ADAPTER_CONTROL DCSRB(0x0110) 74#define ADAPTER_CONTROL DCSRB(0x0110)
75#define ADAPTER_EN (1ULL<<56) 75#define ADAPTER_EN (1ULL<<56)
76#define EOI_TX_ON (1ULL<<48) 76#define EOI_TX_ON (1ULL<<48)
77#define LED_ON (1ULL<<40) 77#define LED_ON (1ULL<<40)
78#define WAIT_INT_EN (1ULL<<15) 78#define WAIT_INT_EN (1ULL<<15)
79#define ECC_ENABLE_N (1ULL<<8) 79#define ECC_ENABLE_N (1ULL<<8)
80 80
81/* for debug of ADAPTER_STATUS */ 81/* for debug of ADAPTER_STATUS */
82#define QUIESCENT (TDMA_READY|RDMA_READY|PFC_READY|TMAC_BUF_EMPTY|\ 82#define QUIESCENT (TDMA_READY|RDMA_READY|PFC_READY|TMAC_BUF_EMPTY|\
83 PIC_QUIESCENT|MC_DRAM_READY|MC_QUEUES_READY|M_PLL_LOCK|P_PLL_LOCK) 83 PIC_QUIESCENT|MC_DRAM_READY|MC_QUEUES_READY|M_PLL_LOCK|P_PLL_LOCK)
84#define QUIESCENT_BMSK \ 84#define QUIESCENT_BMSK \
85 "\177\20b\x3fTDMA_READY\0b\x3eRDMA_READY\0b\x3dPFC_READY\0" \ 85 "\177\20b\x3fTDMA_READY\0b\x3eRDMA_READY\0b\x3dPFC_READY\0" \
86 "b\x3cTMAC_BUF_EMPTY\0b\x3aPIC_QUIESCENT\0\x39RMAC_REMOTE_FAULT\0" \ 86 "b\x3cTMAC_BUF_EMPTY\0b\x3aPIC_QUIESCENT\0\x39RMAC_REMOTE_FAULT\0" \
87 "b\x38RMAC_LOCAL_FAULT\0b\x27MC_DRAM_READY\0b\x26MC_QUEUES_READY\0" \ 87 "b\x38RMAC_LOCAL_FAULT\0b\x27MC_DRAM_READY\0b\x26MC_QUEUES_READY\0" \
88 "b\x21M_PLL_LOCK\0b\x20P_PLL_LOCK" 88 "b\x21M_PLL_LOCK\0b\x20P_PLL_LOCK\0"
89 89
90/* 90/*
91 * PCI-X registers 91 * PCI-X registers
92 */ 92 */
93/* Interrupt control registers */ 93/* Interrupt control registers */
94#define PIC_INT_STATUS PCIXB(0) 94#define PIC_INT_STATUS PCIXB(0)
95#define PIC_INT_MASK PCIXB(0x008) 95#define PIC_INT_MASK PCIXB(0x008)
96#define TXPIC_INT_MASK PCIXB(0x018) 96#define TXPIC_INT_MASK PCIXB(0x018)
97#define RXPIC_INT_MASK PCIXB(0x030) 97#define RXPIC_INT_MASK PCIXB(0x030)
98#define FLASH_INT_MASK PCIXB(0x048) 98#define FLASH_INT_MASK PCIXB(0x048)
99#define MDIO_INT_MASK PCIXB(0x060) 99#define MDIO_INT_MASK PCIXB(0x060)
100#define IIC_INT_MASK PCIXB(0x078) 100#define IIC_INT_MASK PCIXB(0x078)
101#define GPIO_INT_MASK PCIXB(0x098) 101#define GPIO_INT_MASK PCIXB(0x098)
102#define TX_TRAFFIC_INT PCIXB(0x0e0) 102#define TX_TRAFFIC_INT PCIXB(0x0e0)
103#define TX_TRAFFIC_MASK PCIXB(0x0e8) 103#define TX_TRAFFIC_MASK PCIXB(0x0e8)
104#define RX_TRAFFIC_INT PCIXB(0x0f0) 104#define RX_TRAFFIC_INT PCIXB(0x0f0)
105#define RX_TRAFFIC_MASK PCIXB(0x0f8) 105#define RX_TRAFFIC_MASK PCIXB(0x0f8)
106#define PIC_CONTROL PCIXB(0x100) 106#define PIC_CONTROL PCIXB(0x100)
107 107
108/* Byte swapping for little-endian */ 108/* Byte swapping for little-endian */
109#define SWAPPER_CTRL PCIXB(0x108) 109#define SWAPPER_CTRL PCIXB(0x108)
110#define PIF_R_FE (1ULL<<63) 110#define PIF_R_FE (1ULL<<63)
111#define PIF_R_SE (1ULL<<62) 111#define PIF_R_SE (1ULL<<62)
112#define PIF_W_FE (1ULL<<55) 112#define PIF_W_FE (1ULL<<55)
113#define PIF_W_SE (1ULL<<54) 113#define PIF_W_SE (1ULL<<54)
114#define TxP_FE (1ULL<<47) 114#define TxP_FE (1ULL<<47)
115#define TxP_SE (1ULL<<46) 115#define TxP_SE (1ULL<<46)
116#define TxD_R_FE (1ULL<<45) 116#define TxD_R_FE (1ULL<<45)
117#define TxD_R_SE (1ULL<<44) 117#define TxD_R_SE (1ULL<<44)
118#define TxD_W_FE (1ULL<<43) 118#define TxD_W_FE (1ULL<<43)
119#define TxD_W_SE (1ULL<<42) 119#define TxD_W_SE (1ULL<<42)
120#define TxF_R_FE (1ULL<<41) 120#define TxF_R_FE (1ULL<<41)
121#define TxF_R_SE (1ULL<<40) 121#define TxF_R_SE (1ULL<<40)
122#define RxD_R_FE (1ULL<<31) 122#define RxD_R_FE (1ULL<<31)
123#define RxD_R_SE (1ULL<<30) 123#define RxD_R_SE (1ULL<<30)
124#define RxD_W_FE (1ULL<<29) 124#define RxD_W_FE (1ULL<<29)
125#define RxD_W_SE (1ULL<<28) 125#define RxD_W_SE (1ULL<<28)
126#define RxF_W_FE (1ULL<<27) 126#define RxF_W_FE (1ULL<<27)
127#define RxF_W_SE (1ULL<<26) 127#define RxF_W_SE (1ULL<<26)
128#define XMSI_FE (1ULL<<23) 128#define XMSI_FE (1ULL<<23)
129#define XMSI_SE (1ULL<<22) 129#define XMSI_SE (1ULL<<22)
130#define STATS_FE (1ULL<<15) 130#define STATS_FE (1ULL<<15)
131#define STATS_SE (1ULL<<14) 131#define STATS_SE (1ULL<<14)
132 132
133/* Diagnostic register to check byte-swapping conf */ 133/* Diagnostic register to check byte-swapping conf */
134#define PIF_RD_SWAPPER_Fb PCIXB(0x110) 134#define PIF_RD_SWAPPER_Fb PCIXB(0x110)
135#define SWAPPER_MAGIC 0x0123456789abcdefULL 135#define SWAPPER_MAGIC 0x0123456789abcdefULL
136 136
137/* Stats registers */ 137/* Stats registers */
138#define STAT_CFG PCIXB(0x1d0) 138#define STAT_CFG PCIXB(0x1d0)
139#define STAT_ADDR PCIXB(0x1d8) 139#define STAT_ADDR PCIXB(0x1d8)
140 140
141/* DTE-XGXS Interface */ 141/* DTE-XGXS Interface */
142#define MDIO_CONTROL PCIXB(0x1e0) 142#define MDIO_CONTROL PCIXB(0x1e0)
143#define DTX_CONTROL PCIXB(0x1e8) 143#define DTX_CONTROL PCIXB(0x1e8)
144#define I2C_CONTROL PCIXB(0x1f0) 144#define I2C_CONTROL PCIXB(0x1f0)
145#define GPIO_CONTROL PCIXB(0x1f8) 145#define GPIO_CONTROL PCIXB(0x1f8)
146 146
147/* 147/*
148 * Transmit DMA registers. 148 * Transmit DMA registers.
149 */ 149 */
150#define TXDMA_INT_MASK TDMAB(0x008) 150#define TXDMA_INT_MASK TDMAB(0x008)
151#define PFC_ERR_MASK TDMAB(0x018) 151#define PFC_ERR_MASK TDMAB(0x018)
152#define TDA_ERR_MASK TDMAB(0x030) 152#define TDA_ERR_MASK TDMAB(0x030)
153#define PCC_ERR_MASK TDMAB(0x048) 153#define PCC_ERR_MASK TDMAB(0x048)
154#define TTI_ERR_MASK TDMAB(0x060) 154#define TTI_ERR_MASK TDMAB(0x060)
155#define LSO_ERR_MASK TDMAB(0x078) 155#define LSO_ERR_MASK TDMAB(0x078)
156#define TPA_ERR_MASK TDMAB(0x090) 156#define TPA_ERR_MASK TDMAB(0x090)
157#define SM_ERR_MASK TDMAB(0x0a8) 157#define SM_ERR_MASK TDMAB(0x0a8)
158 158
159/* Transmit FIFO config */ 159/* Transmit FIFO config */
160#define TX_FIFO_P0 TDMAB(0x0108) 160#define TX_FIFO_P0 TDMAB(0x0108)
161#define TX_FIFO_P1 TDMAB(0x0110) 161#define TX_FIFO_P1 TDMAB(0x0110)
162#define TX_FIFO_P2 TDMAB(0x0118) 162#define TX_FIFO_P2 TDMAB(0x0118)
163#define TX_FIFO_P3 TDMAB(0x0120) 163#define TX_FIFO_P3 TDMAB(0x0120)
164#define TX_FIFO_ENABLE (1ULL<<63) 164#define TX_FIFO_ENABLE (1ULL<<63)
165#define TX_FIFO_NUM0(x) ((uint64_t)(x) << 56) 165#define TX_FIFO_NUM0(x) ((uint64_t)(x) << 56)
166#define TX_FIFO_LEN0(x) ((uint64_t)((x)-1) << 32)  166#define TX_FIFO_LEN0(x) ((uint64_t)((x)-1) << 32)
167#define TX_FIFO_NUM1(x) ((uint64_t)(x) << 24) 167#define TX_FIFO_NUM1(x) ((uint64_t)(x) << 24)
168#define TX_FIFO_LEN1(x) ((uint64_t)((x)-1) << 0)  168#define TX_FIFO_LEN1(x) ((uint64_t)((x)-1) << 0)
169 169
170/* Transmit interrupts */ 170/* Transmit interrupts */
171#define TTI_COMMAND_MEM TDMAB(0x150) 171#define TTI_COMMAND_MEM TDMAB(0x150)
172#define TTI_CMD_MEM_WE (1ULL<<56) 172#define TTI_CMD_MEM_WE (1ULL<<56)
173#define TTI_CMD_MEM_STROBE (1ULL<<48) 173#define TTI_CMD_MEM_STROBE (1ULL<<48)
174#define TTI_DATA1_MEM TDMAB(0x158) 174#define TTI_DATA1_MEM TDMAB(0x158)
175#define TX_TIMER_VAL(x) ((uint64_t)(x) << 32) 175#define TX_TIMER_VAL(x) ((uint64_t)(x) << 32)
176#define TX_TIMER_AC (1ULL<<25) 176#define TX_TIMER_AC (1ULL<<25)
177#define TX_TIMER_CI (1ULL<<24) 177#define TX_TIMER_CI (1ULL<<24)
178#define TX_URNG_A(x) ((uint64_t)(x) << 16) 178#define TX_URNG_A(x) ((uint64_t)(x) << 16)
179#define TX_URNG_B(x) ((uint64_t)(x) << 8) 179#define TX_URNG_B(x) ((uint64_t)(x) << 8)
180#define TX_URNG_C(x) ((uint64_t)(x) << 0) 180#define TX_URNG_C(x) ((uint64_t)(x) << 0)
181#define TTI_DATA2_MEM TDMAB(0x160) 181#define TTI_DATA2_MEM TDMAB(0x160)
182#define TX_UFC_A(x) ((uint64_t)(x) << 48) 182#define TX_UFC_A(x) ((uint64_t)(x) << 48)
183#define TX_UFC_B(x) ((uint64_t)(x) << 32) 183#define TX_UFC_B(x) ((uint64_t)(x) << 32)
184#define TX_UFC_C(x) ((uint64_t)(x) << 16) 184#define TX_UFC_C(x) ((uint64_t)(x) << 16)
185#define TX_UFC_D(x) ((uint64_t)(x) << 0) 185#define TX_UFC_D(x) ((uint64_t)(x) << 0)
186 186
187 187
188/* Transmit protocol assist */ 188/* Transmit protocol assist */
189#define TX_PA_CFG TDMAB(0x0168) 189#define TX_PA_CFG TDMAB(0x0168)
190#define TX_PA_CFG_IFR (1ULL<<62) /* Ignore frame error */ 190#define TX_PA_CFG_IFR (1ULL<<62) /* Ignore frame error */
191#define TX_PA_CFG_ISO (1ULL<<61) /* Ignore snap OUI */ 191#define TX_PA_CFG_ISO (1ULL<<61) /* Ignore snap OUI */
192#define TX_PA_CFG_ILC (1ULL<<60) /* Ignore LLC ctrl */ 192#define TX_PA_CFG_ILC (1ULL<<60) /* Ignore LLC ctrl */
193#define TX_PA_CFG_ILE (1ULL<<57) /* Ignore L2 error */ 193#define TX_PA_CFG_ILE (1ULL<<57) /* Ignore L2 error */
194 194
195/* 195/*
196 * Transmit descriptor list (TxDL) pointer and control. 196 * Transmit descriptor list (TxDL) pointer and control.
197 * There may be up to 8192 TxDL's per FIFO, but with a NIC total 197 * There may be up to 8192 TxDL's per FIFO, but with a NIC total
198 * of 8192. The TxDL's are located in the NIC memory. 198 * of 8192. The TxDL's are located in the NIC memory.
199 * Each TxDL can have up to 256 Transmit descriptors (TxD) 199 * Each TxDL can have up to 256 Transmit descriptors (TxD)
200 * that are located in host memory. 200 * that are located in host memory.
201 * 201 *
202 * The txdl struct fields must be written in order. 202 * The txdl struct fields must be written in order.
203 */ 203 */
204#ifdef notdef /* Use bus_space stuff instead */ 204#ifdef notdef /* Use bus_space stuff instead */
205struct txdl { 205struct txdl {
206 uint64_t txdl_pointer; /* address of TxD's */ 206 uint64_t txdl_pointer; /* address of TxD's */
207 uint64_t txdl_control; 207 uint64_t txdl_control;
208}; 208};
209#endif 209#endif
210#define TXDLOFF1(x) (16*(x)) /* byte offset in txdl for list */ 210#define TXDLOFF1(x) (16*(x)) /* byte offset in txdl for list */
211#define TXDLOFF2(x) (16*(x)+8) /* byte offset in txdl for list */ 211#define TXDLOFF2(x) (16*(x)+8) /* byte offset in txdl for list */
212#define TXDL_NUMTXD(x) ((uint64_t)(x) << 56) /* # of TxD's in the list */ 212#define TXDL_NUMTXD(x) ((uint64_t)(x) << 56) /* # of TxD's in the list */
213#define TXDL_LGC_FIRST (1ULL << 49) /* First special list */ 213#define TXDL_LGC_FIRST (1ULL << 49) /* First special list */
214#define TXDL_LGC_LAST (1ULL << 48) /* Last special list */ 214#define TXDL_LGC_LAST (1ULL << 48) /* Last special list */
215#define TXDL_SFF (1ULL << 40) /* List is a special function list */ 215#define TXDL_SFF (1ULL << 40) /* List is a special function list */
216#define TXDL_PAR 0 /* Pointer address register */ 216#define TXDL_PAR 0 /* Pointer address register */
217#define TXDL_LCR 8 /* List control register */ 217#define TXDL_LCR 8 /* List control register */
218 218
219struct txd { 219struct txd {
220 uint64_t txd_control1; 220 uint64_t txd_control1;
221 uint64_t txd_control2; 221 uint64_t txd_control2;
222 uint64_t txd_bufaddr; 222 uint64_t txd_bufaddr;
223 uint64_t txd_hostctrl; 223 uint64_t txd_hostctrl;
224}; 224};
225#define TXD_CTL1_OWN (1ULL << 56) /* Owner, 0 == host, 1 == NIC */ 225#define TXD_CTL1_OWN (1ULL << 56) /* Owner, 0 == host, 1 == NIC */
226#define TXD_CTL1_GCF (1ULL << 41) /* First frame or LSO */ 226#define TXD_CTL1_GCF (1ULL << 41) /* First frame or LSO */
227#define TXD_CTL1_GCL (1ULL << 40) /* Last frame or LSO */ 227#define TXD_CTL1_GCL (1ULL << 40) /* Last frame or LSO */
228#define TXD_CTL1_LSO (1ULL << 33) /* LSO should be performed */ 228#define TXD_CTL1_LSO (1ULL << 33) /* LSO should be performed */
229#define TXD_CTL1_COF (1ULL << 32) /* UDP Checksum over fragments */ 229#define TXD_CTL1_COF (1ULL << 32) /* UDP Checksum over fragments */
230#define TXD_CTL1_MSS(x) ((uint64_t)(x) << 16) 230#define TXD_CTL1_MSS(x) ((uint64_t)(x) << 16)
231 231
232#define TXD_CTL2_INTLST (1ULL << 16) /* Per-list interrupt */ 232#define TXD_CTL2_INTLST (1ULL << 16) /* Per-list interrupt */
233#define TXD_CTL2_UTIL (1ULL << 17) /* Utilization interrupt */ 233#define TXD_CTL2_UTIL (1ULL << 17) /* Utilization interrupt */
234#define TXD_CTL2_CIPv4 (1ULL << 58) /* Calculate IPv4 header checksum */ 234#define TXD_CTL2_CIPv4 (1ULL << 58) /* Calculate IPv4 header checksum */
235#define TXD_CTL2_CTCP (1ULL << 57) /* Calculate TCP checksum */ 235#define TXD_CTL2_CTCP (1ULL << 57) /* Calculate TCP checksum */
236#define TXD_CTL2_CUDP (1ULL << 56) /* Calculate UDP checksum */ 236#define TXD_CTL2_CUDP (1ULL << 56) /* Calculate UDP checksum */
237/* 237/*
238 * Receive DMA registers 238 * Receive DMA registers
239 */ 239 */
240/* Receive interrupt registers */ 240/* Receive interrupt registers */
241#define RXDMA_INT_MASK RDMAB(0x008) 241#define RXDMA_INT_MASK RDMAB(0x008)
242#define RDA_ERR_MASK RDMAB(0x018) 242#define RDA_ERR_MASK RDMAB(0x018)
243#define RC_ERR_MASK RDMAB(0x030) 243#define RC_ERR_MASK RDMAB(0x030)
244#define PRC_PCIX_ERR_MASK RDMAB(0x048) 244#define PRC_PCIX_ERR_MASK RDMAB(0x048)
245#define RPA_ERR_MASK RDMAB(0x060) 245#define RPA_ERR_MASK RDMAB(0x060)
246#define RTI_ERR_MASK RDMAB(0x078) 246#define RTI_ERR_MASK RDMAB(0x078)
247 247
248#define RX_QUEUE_PRIORITY RDMAB(0x100) 248#define RX_QUEUE_PRIORITY RDMAB(0x100)
249#define RX_W_ROUND_ROBIN_0 RDMAB(0x108) 249#define RX_W_ROUND_ROBIN_0 RDMAB(0x108)
250#define RX_W_ROUND_ROBIN_1 RDMAB(0x110) 250#define RX_W_ROUND_ROBIN_1 RDMAB(0x110)
251#define RX_W_ROUND_ROBIN_2 RDMAB(0x118) 251#define RX_W_ROUND_ROBIN_2 RDMAB(0x118)
252#define RX_W_ROUND_ROBIN_3 RDMAB(0x120) 252#define RX_W_ROUND_ROBIN_3 RDMAB(0x120)
253#define RX_W_ROUND_ROBIN_4 RDMAB(0x128) 253#define RX_W_ROUND_ROBIN_4 RDMAB(0x128)
254#define PRC_RXD0_0 RDMAB(0x130) 254#define PRC_RXD0_0 RDMAB(0x130)
255#define PRC_CTRL_0 RDMAB(0x170) 255#define PRC_CTRL_0 RDMAB(0x170)
256#define RC_IN_SVC (1ULL << 56) 256#define RC_IN_SVC (1ULL << 56)
257#define RING_MODE_1 (0ULL << 48) 257#define RING_MODE_1 (0ULL << 48)
258#define RING_MODE_3 (1ULL << 48) 258#define RING_MODE_3 (1ULL << 48)
259#define RING_MODE_5 (2ULL << 48) 259#define RING_MODE_5 (2ULL << 48)
260#define RC_NO_SNOOP_D (1ULL << 41) 260#define RC_NO_SNOOP_D (1ULL << 41)
261#define RC_NO_SNOOP_B (1ULL << 40) 261#define RC_NO_SNOOP_B (1ULL << 40)
262#define PRC_ALARM_ACTION RDMAB(0x1b0) 262#define PRC_ALARM_ACTION RDMAB(0x1b0)
263#define RTI_COMMAND_MEM RDMAB(0x1b8) 263#define RTI_COMMAND_MEM RDMAB(0x1b8)
264#define RTI_CMD_MEM_WE (1ULL << 56) 264#define RTI_CMD_MEM_WE (1ULL << 56)
265#define RTI_CMD_MEM_STROBE (1ULL << 48) 265#define RTI_CMD_MEM_STROBE (1ULL << 48)
266#define RTI_DATA1_MEM RDMAB(0x1c0) 266#define RTI_DATA1_MEM RDMAB(0x1c0)
267#define RX_TIMER_VAL(x) ((uint64_t)(x) << 32) 267#define RX_TIMER_VAL(x) ((uint64_t)(x) << 32)
268#define RX_TIMER_AC (1ULL << 25) 268#define RX_TIMER_AC (1ULL << 25)
269#define RX_URNG_A(x) ((uint64_t)(x) << 16) 269#define RX_URNG_A(x) ((uint64_t)(x) << 16)
270#define RX_URNG_B(x) ((uint64_t)(x) << 8) 270#define RX_URNG_B(x) ((uint64_t)(x) << 8)
271#define RX_URNG_C(x) ((uint64_t)(x) << 0) 271#define RX_URNG_C(x) ((uint64_t)(x) << 0)
272#define RTI_DATA2_MEM RDMAB(0x1c8) 272#define RTI_DATA2_MEM RDMAB(0x1c8)
273#define RX_UFC_A(x) ((uint64_t)(x) << 48) 273#define RX_UFC_A(x) ((uint64_t)(x) << 48)
274#define RX_UFC_B(x) ((uint64_t)(x) << 32) 274#define RX_UFC_B(x) ((uint64_t)(x) << 32)
275#define RX_UFC_C(x) ((uint64_t)(x) << 16) 275#define RX_UFC_C(x) ((uint64_t)(x) << 16)
276#define RX_UFC_D(x) ((uint64_t)(x) << 0) 276#define RX_UFC_D(x) ((uint64_t)(x) << 0)
277#define RX_PA_CFG RDMAB(0x1d0) 277#define RX_PA_CFG RDMAB(0x1d0)
278/* 278/*
279 * Receive descriptor (RxD) format. 279 * Receive descriptor (RxD) format.
280 * There are three formats of receive descriptors, 1, 3 and 5 buffer format. 280 * There are three formats of receive descriptors, 1, 3 and 5 buffer format.
281 */ 281 */
282#define RX_MODE_1 1 282#define RX_MODE_1 1
283#define RX_MODE_3 3 283#define RX_MODE_3 3
284#define RX_MODE_5 5 284#define RX_MODE_5 5
285 285
286struct rxd1 { 286struct rxd1 {
287 uint64_t rxd_hcontrol; 287 uint64_t rxd_hcontrol;
288 uint64_t rxd_control1; 288 uint64_t rxd_control1;
289 uint64_t rxd_control2;  289 uint64_t rxd_control2;
290 uint64_t rxd_buf0; 290 uint64_t rxd_buf0;
291}; 291};
292 292
293/* 4k struct for 5 buffer mode */ 293/* 4k struct for 5 buffer mode */
294#define NDESC_1BUFMODE 127 /* # desc/page for 5-buffer mode */ 294#define NDESC_1BUFMODE 127 /* # desc/page for 5-buffer mode */
295struct rxd1_4k { 295struct rxd1_4k {
296 struct rxd1 r4_rxd[NDESC_1BUFMODE]; 296 struct rxd1 r4_rxd[NDESC_1BUFMODE];
297 uint64_t pad[3]; 297 uint64_t pad[3];
298 uint64_t r4_next; /* phys address of next 4k buffer */ 298 uint64_t r4_next; /* phys address of next 4k buffer */
299}; 299};
300 300
301struct rxd3 { 301struct rxd3 {
302 uint64_t rxd_hcontrol; 302 uint64_t rxd_hcontrol;
303 uint64_t rxd_control1; 303 uint64_t rxd_control1;
304 uint64_t rxd_control2; 304 uint64_t rxd_control2;
305 uint64_t rxd_buf0; 305 uint64_t rxd_buf0;
306 uint64_t rxd_buf1;  306 uint64_t rxd_buf1;
307 uint64_t rxd_buf2;  307 uint64_t rxd_buf2;
308}; 308};
309 309
310struct rxd5 { 310struct rxd5 {
311 uint64_t rxd_control3; 311 uint64_t rxd_control3;
312 uint64_t rxd_control1; 312 uint64_t rxd_control1;
313 uint64_t rxd_control2; 313 uint64_t rxd_control2;
314 uint64_t rxd_buf0; 314 uint64_t rxd_buf0;
315 uint64_t rxd_buf1; 315 uint64_t rxd_buf1;
316 uint64_t rxd_buf2; 316 uint64_t rxd_buf2;
317 uint64_t rxd_buf3; 317 uint64_t rxd_buf3;
318 uint64_t rxd_buf4; 318 uint64_t rxd_buf4;
319}; 319};
320 320
321/* 4k struct for 5 buffer mode */ 321/* 4k struct for 5 buffer mode */
322#define NDESC_5BUFMODE 63 /* # desc/page for 5-buffer mode */ 322#define NDESC_5BUFMODE 63 /* # desc/page for 5-buffer mode */
323#define XGE_PAGE 4096 /* page size used for receive */ 323#define XGE_PAGE 4096 /* page size used for receive */
324struct rxd5_4k { 324struct rxd5_4k {
325 struct rxd5 r4_rxd[NDESC_5BUFMODE]; 325 struct rxd5 r4_rxd[NDESC_5BUFMODE];
326 uint64_t pad[7]; 326 uint64_t pad[7];
327 uint64_t r4_next; /* phys address of next 4k buffer */ 327 uint64_t r4_next; /* phys address of next 4k buffer */
328}; 328};
329 329
330#define RXD_MKCTL3(h,bs3,bs4) \ 330#define RXD_MKCTL3(h,bs3,bs4) \
331 (((uint64_t)(h) << 32) | ((uint64_t)(bs3) << 16) | (uint64_t)(bs4)) 331 (((uint64_t)(h) << 32) | ((uint64_t)(bs3) << 16) | (uint64_t)(bs4))
332#define RXD_MKCTL2(bs0,bs1,bs2) \ 332#define RXD_MKCTL2(bs0,bs1,bs2) \
333 (((uint64_t)(bs0) << 48) | ((uint64_t)(bs1) << 32) | \ 333 (((uint64_t)(bs0) << 48) | ((uint64_t)(bs1) << 32) | \
334 ((uint64_t)(bs2) << 16)) 334 ((uint64_t)(bs2) << 16))
335 335
336#define RXD_CTL2_BUF0SIZ(x) (((x) >> 48) & 0xffff) 336#define RXD_CTL2_BUF0SIZ(x) (((x) >> 48) & 0xffff)
337#define RXD_CTL2_BUF1SIZ(x) (((x) >> 32) & 0xffff) 337#define RXD_CTL2_BUF1SIZ(x) (((x) >> 32) & 0xffff)
338#define RXD_CTL2_BUF2SIZ(x) (((x) >> 16) & 0xffff) 338#define RXD_CTL2_BUF2SIZ(x) (((x) >> 16) & 0xffff)
339#define RXD_CTL3_BUF3SIZ(x) (((x) >> 16) & 0xffff) 339#define RXD_CTL3_BUF3SIZ(x) (((x) >> 16) & 0xffff)
340#define RXD_CTL3_BUF4SIZ(x) ((x) & 0xffff) 340#define RXD_CTL3_BUF4SIZ(x) ((x) & 0xffff)
341#define RXD_CTL1_OWN (1ULL << 56) 341#define RXD_CTL1_OWN (1ULL << 56)
342#define RXD_CTL1_XCODE(x) (((x) >> 48) & 0xf) /* Status bits */ 342#define RXD_CTL1_XCODE(x) (((x) >> 48) & 0xf) /* Status bits */
343#define RXD_CTL1_X_OK 0 343#define RXD_CTL1_X_OK 0
344#define RXD_CTL1_X_PERR 1 /* Parity error */ 344#define RXD_CTL1_X_PERR 1 /* Parity error */
345#define RXD_CTL1_X_ABORT 2 /* Abort during xfer */ 345#define RXD_CTL1_X_ABORT 2 /* Abort during xfer */
346#define RXD_CTL1_X_PA 3 /* Parity error and abort */ 346#define RXD_CTL1_X_PA 3 /* Parity error and abort */
347#define RXD_CTL1_X_RDA 4 /* RDA failure */ 347#define RXD_CTL1_X_RDA 4 /* RDA failure */
348#define RXD_CTL1_X_UP 5 /* Unknown protocol */ 348#define RXD_CTL1_X_UP 5 /* Unknown protocol */
349#define RXD_CTL1_X_FI 6 /* Frame integrity (FCS) error */ 349#define RXD_CTL1_X_FI 6 /* Frame integrity (FCS) error */
350#define RXD_CTL1_X_BSZ 7 /* Buffer size error */ 350#define RXD_CTL1_X_BSZ 7 /* Buffer size error */
351#define RXD_CTL1_X_ECC 8 /* Internal ECC */ 351#define RXD_CTL1_X_ECC 8 /* Internal ECC */
352#define RXD_CTL1_X_UNK 15 /* Unknown error */ 352#define RXD_CTL1_X_UNK 15 /* Unknown error */
353#define RXD_CTL1_PROTOS(x) (((x) >> 32) & 0xff) 353#define RXD_CTL1_PROTOS(x) (((x) >> 32) & 0xff)
354#define RXD_CTL1_P_VLAN 0x80 /* VLAN tagged */ 354#define RXD_CTL1_P_VLAN 0x80 /* VLAN tagged */
355#define RXD_CTL1_P_MSK 0x60 /* Mask for frame type */ 355#define RXD_CTL1_P_MSK 0x60 /* Mask for frame type */
356#define RXD_CTL1_P_DIX 0x00 356#define RXD_CTL1_P_DIX 0x00
357#define RXD_CTL1_P_LLC 0x20 357#define RXD_CTL1_P_LLC 0x20
358#define RXD_CTL1_P_SNAP 0x40 358#define RXD_CTL1_P_SNAP 0x40
359#define RXD_CTL1_P_IPX 0x60 359#define RXD_CTL1_P_IPX 0x60
360#define RXD_CTL1_P_IPv4 0x10 360#define RXD_CTL1_P_IPv4 0x10
361#define RXD_CTL1_P_IPv6 0x08 361#define RXD_CTL1_P_IPv6 0x08
362#define RXD_CTL1_P_IPFRAG 0x04 362#define RXD_CTL1_P_IPFRAG 0x04
363#define RXD_CTL1_P_TCP 0x02 363#define RXD_CTL1_P_TCP 0x02
364#define RXD_CTL1_P_UDP 0x01 364#define RXD_CTL1_P_UDP 0x01
365#define RXD_CTL1_L3CSUM(x) (((x) >> 16) & 0xffff) 365#define RXD_CTL1_L3CSUM(x) (((x) >> 16) & 0xffff)
366#define RXD_CTL1_L4CSUM(x) ((x) & 0xffff) 366#define RXD_CTL1_L4CSUM(x) ((x) & 0xffff)
367#define RXD_CTL2_VLANTAG(x) ((x) & 0xffff) 367#define RXD_CTL2_VLANTAG(x) ((x) & 0xffff)
368 368
369/* 369/*
370 * MAC Configuration/Status 370 * MAC Configuration/Status
371 */ 371 */
372#define MAC_INT_STATUS MACRB(0x000) 372#define MAC_INT_STATUS MACRB(0x000)
373#define MAC_TMAC_INT (1ULL<<63) 373#define MAC_TMAC_INT (1ULL<<63)
374#define MAC_RMAC_INT (1ULL<<62) 374#define MAC_RMAC_INT (1ULL<<62)
375#define MAC_INT_MASK MACRB(0x008) 375#define MAC_INT_MASK MACRB(0x008)
376#define MAC_TMAC_ERR_MASK MACRB(0x018) 376#define MAC_TMAC_ERR_MASK MACRB(0x018)
377#define MAC_RMAC_ERR_REG MACRB(0x028) 377#define MAC_RMAC_ERR_REG MACRB(0x028)
378#define RMAC_LINK_STATE_CHANGE_INT (1ULL<<32) 378#define RMAC_LINK_STATE_CHANGE_INT (1ULL<<32)
379#define MAC_RMAC_ERR_MASK MACRB(0x030) 379#define MAC_RMAC_ERR_MASK MACRB(0x030)
380 380
381#define MAC_CFG MACRB(0x0100) 381#define MAC_CFG MACRB(0x0100)
382#define TMAC_EN (1ULL<<63) 382#define TMAC_EN (1ULL<<63)
383#define RMAC_EN (1ULL<<62) 383#define RMAC_EN (1ULL<<62)
384#define UTILZATION_CALC_SEL (1ULL<<61) 384#define UTILZATION_CALC_SEL (1ULL<<61)
385#define TMAC_LOOPBACK (1ULL<<60) 385#define TMAC_LOOPBACK (1ULL<<60)
386#define TMAC_APPEND_PAD (1ULL<<59) 386#define TMAC_APPEND_PAD (1ULL<<59)
387#define RMAC_STRIP_FCS (1ULL<<58) 387#define RMAC_STRIP_FCS (1ULL<<58)
388#define RMAC_STRIP_PAD (1ULL<<57) 388#define RMAC_STRIP_PAD (1ULL<<57)
389#define RMAC_PROM_EN (1ULL<<56) 389#define RMAC_PROM_EN (1ULL<<56)
390#define RMAC_DISCARD_PFRM (1ULL<<55) 390#define RMAC_DISCARD_PFRM (1ULL<<55)
391#define RMAC_BCAST_EN (1ULL<<54) 391#define RMAC_BCAST_EN (1ULL<<54)
392#define RMAC_ALL_ADDR_EN (1ULL<<53) 392#define RMAC_ALL_ADDR_EN (1ULL<<53)
393#define RMAC_MAX_PYLD_LEN MACRB(0x0110) 393#define RMAC_MAX_PYLD_LEN MACRB(0x0110)
394#define RMAC_PYLD_LEN(x) ((uint64_t)(x) << 48) 394#define RMAC_PYLD_LEN(x) ((uint64_t)(x) << 48)
395#define RMAC_CFG_KEY MACRB(0x0120) 395#define RMAC_CFG_KEY MACRB(0x0120)
396#define RMAC_KEY_VALUE (0x4c0dULL<<48) 396#define RMAC_KEY_VALUE (0x4c0dULL<<48)
397#define RMAC_ADDR_CMD_MEM MACRB(0x0128) 397#define RMAC_ADDR_CMD_MEM MACRB(0x0128)
398#define RMAC_ADDR_CMD_MEM_WE (1ULL<<56) 398#define RMAC_ADDR_CMD_MEM_WE (1ULL<<56)
399#define RMAC_ADDR_CMD_MEM_STR (1ULL<<48) 399#define RMAC_ADDR_CMD_MEM_STR (1ULL<<48)
400#define RMAC_ADDR_CMD_MEM_OFF(x) ((uint64_t)(x) << 32) 400#define RMAC_ADDR_CMD_MEM_OFF(x) ((uint64_t)(x) << 32)
401#define MAX_MCAST_ADDR 64 /* slots in mcast table */ 401#define MAX_MCAST_ADDR 64 /* slots in mcast table */
402#define RMAC_ADDR_DATA0_MEM MACRB(0x0130) 402#define RMAC_ADDR_DATA0_MEM MACRB(0x0130)
403#define RMAC_ADDR_DATA1_MEM MACRB(0x0138) 403#define RMAC_ADDR_DATA1_MEM MACRB(0x0138)
404#define RMAC_PAUSE_CFG MACRB(0x150) 404#define RMAC_PAUSE_CFG MACRB(0x150)
405#define RMAC_PAUSE_GEN_EN (1ULL<<63) 405#define RMAC_PAUSE_GEN_EN (1ULL<<63)
406#define RMAC_PAUSE_RCV_EN (1ULL<<62) 406#define RMAC_PAUSE_RCV_EN (1ULL<<62)
407 407
408/* 408/*
409 * RLDRAM registers. 409 * RLDRAM registers.
410 */ 410 */
411#define MC_INT_MASK RLDRB(0x008) 411#define MC_INT_MASK RLDRB(0x008)
412#define MC_ERR_MASK RLDRB(0x018) 412#define MC_ERR_MASK RLDRB(0x018)
413 413
414#define RX_QUEUE_CFG RLDRB(0x100) 414#define RX_QUEUE_CFG RLDRB(0x100)
415#define MC_QUEUE(q,s) ((uint64_t)(s)<<(56-(q*8))) 415#define MC_QUEUE(q,s) ((uint64_t)(s)<<(56-(q*8)))
416#define MC_RLDRAM_MRS RLDRB(0x108) 416#define MC_RLDRAM_MRS RLDRB(0x108)
417#define MC_QUEUE_SIZE_ENABLE (1ULL<<24) 417#define MC_QUEUE_SIZE_ENABLE (1ULL<<24)
418#define MC_RLDRAM_MRS_ENABLE (1ULL<<16) 418#define MC_RLDRAM_MRS_ENABLE (1ULL<<16)
419 419
420/* 420/*
421 * XGXS registers. 421 * XGXS registers.
422 */ 422 */
423/* XGXS control/statue */ 423/* XGXS control/statue */
424#define XGXS_INT_MASK XGXSB(0x008) 424#define XGXS_INT_MASK XGXSB(0x008)
425#define XGXS_TXGXS_ERR_MASK XGXSB(0x018) 425#define XGXS_TXGXS_ERR_MASK XGXSB(0x018)
426#define XGXS_RXGXS_ERR_MASK XGXSB(0x030) 426#define XGXS_RXGXS_ERR_MASK XGXSB(0x030)
427#define XGXS_CFG XGXSB(0x0100) 427#define XGXS_CFG XGXSB(0x0100)