mipsNN.h revision 1.4 1 1.4 gdamore /* $NetBSD: mipsNN.h,v 1.4 2006/03/20 18:31:29 gdamore Exp $ */
2 1.1 simonb
3 1.1 simonb /*
4 1.1 simonb * Copyright 2000, 2001
5 1.1 simonb * Broadcom Corporation. All rights reserved.
6 1.3 cgd *
7 1.1 simonb * This software is furnished under license and may be used and copied only
8 1.1 simonb * in accordance with the following terms and conditions. Subject to these
9 1.1 simonb * conditions, you may download, copy, install, use, modify and distribute
10 1.1 simonb * modified or unmodified copies of this software in source and/or binary
11 1.1 simonb * form. No title or ownership is transferred hereby.
12 1.3 cgd *
13 1.1 simonb * 1) Any source code used, modified or distributed must reproduce and
14 1.1 simonb * retain this copyright notice and list of conditions as they appear in
15 1.1 simonb * the source file.
16 1.3 cgd *
17 1.1 simonb * 2) No right is granted to use any trade name, trademark, or logo of
18 1.3 cgd * Broadcom Corporation. The "Broadcom Corporation" name may not be
19 1.3 cgd * used to endorse or promote products derived from this software
20 1.3 cgd * without the prior written permission of Broadcom Corporation.
21 1.3 cgd *
22 1.1 simonb * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
23 1.1 simonb * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
24 1.1 simonb * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
25 1.1 simonb * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
26 1.1 simonb * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
27 1.1 simonb * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.1 simonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.1 simonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 1.1 simonb * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 1.1 simonb * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32 1.1 simonb * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 1.1 simonb */
34 1.1 simonb
35 1.1 simonb /*
36 1.1 simonb * Values related to the MIPS32/MIPS64 Privileged Resource Architecture.
37 1.1 simonb */
38 1.1 simonb
39 1.1 simonb #define _MIPSNN_SHIFT(reg) __MIPSNN_SHIFT(reg)
40 1.1 simonb #define __MIPSNN_SHIFT(reg) MIPSNN_ ## reg ## _SHIFT
41 1.1 simonb #define _MIPSNN_MASK(reg) __MIPSNN_MASK(reg)
42 1.1 simonb #define __MIPSNN_MASK(reg) MIPSNN_ ## reg ## _MASK
43 1.1 simonb
44 1.1 simonb #define MIPSNN_GET(reg, x) \
45 1.1 simonb ((unsigned)((x) & _MIPSNN_MASK(reg)) >> _MIPSNN_SHIFT(reg))
46 1.1 simonb #define MIPSNN_PUT(reg, val) \
47 1.1 simonb (((x) << _MIPSNN_SHIFT(reg)) & _MIPSNN_MASK(reg))
48 1.1 simonb
49 1.1 simonb /*
50 1.1 simonb * Values in Configuration Register (CP0 Register 16, Select 0)
51 1.1 simonb */
52 1.1 simonb
53 1.1 simonb /* "M" (R): Configuration Register 1 present if set. Defined as always set. */
54 1.1 simonb #define MIPSNN_CFG_M 0x80000000
55 1.1 simonb
56 1.1 simonb /* Reserved for CPU implementations. */
57 1.1 simonb // reserved 0x7fff0000
58 1.1 simonb
59 1.1 simonb /* "BE" (R): Big endian if set, little endian if clear. */
60 1.1 simonb #define MIPSNN_CFG_BE 0x00008000
61 1.1 simonb
62 1.1 simonb /* "AT" (R): architecture type implemented by processor */
63 1.1 simonb #define MIPSNN_CFG_AT_MASK 0x00006000
64 1.1 simonb #define MIPSNN_CFG_AT_SHIFT 13
65 1.1 simonb
66 1.1 simonb #define MIPSNN_CFG_AT_MIPS32 0 /* MIPS32 */
67 1.1 simonb #define MIPSNN_CFG_AT_MIPS64S 1 /* MIPS64S */
68 1.1 simonb #define MIPSNN_CFG_AT_MIPS64 2 /* MIPS64 */
69 1.1 simonb // reserved 3
70 1.1 simonb
71 1.1 simonb /* "AR" (R): Architecture revision level implemented by proc. */
72 1.1 simonb #define MIPSNN_CFG_AR_MASK 0x00001c00
73 1.1 simonb #define MIPSNN_CFG_AR_SHIFT 10
74 1.1 simonb
75 1.1 simonb #define MIPSNN_CFG_AR_REV1 0 /* Revision 1 */
76 1.4 gdamore #define MIPSNN_CFG_AR_REV2 1 /* Revision 2 */
77 1.1 simonb // reserved other values
78 1.1 simonb
79 1.1 simonb /* "MT" (R): MMU type implemented by processor */
80 1.1 simonb #define MIPSNN_CFG_MT_MASK 0x00000380
81 1.1 simonb #define MIPSNN_CFG_MT_SHIFT 7
82 1.1 simonb
83 1.1 simonb #define MIPSNN_CFG_MT_NONE 0 /* No MMU */
84 1.1 simonb #define MIPSNN_CFG_MT_TLB 1 /* Std TLB */
85 1.1 simonb #define MIPSNN_CFG_MT_BAT 2 /* Std BAT */
86 1.1 simonb #define MIPSNN_CFG_MT_FIXED 3 /* Std Fixed mapping */
87 1.1 simonb // reserved other values
88 1.1 simonb
89 1.1 simonb /* Reserved. Write as 0, reads as 0. */
90 1.2 simonb // reserved 0x00000070
91 1.2 simonb
92 1.2 simonb /* "M" (R): Virtual instruction cache if set. */
93 1.2 simonb #define MIPSNN_CFG_VI 0x00000008
94 1.1 simonb
95 1.1 simonb /* "K0" (RW): Kseg0 coherency algorithm. (values are TLB_ATTRs) */
96 1.1 simonb #define MIPSNN_CFG_K0_MASK 0x00000007
97 1.1 simonb #define MIPSNN_CFG_K0_SHIFT 0
98 1.1 simonb
99 1.1 simonb
100 1.1 simonb /*
101 1.1 simonb * Values in Configuration Register 1 (CP0 Register 16, Select 1)
102 1.1 simonb */
103 1.1 simonb
104 1.4 gdamore /* M (R): Configuration Register 2 present. */
105 1.4 gdamore #define MIPSNN_CFG1_M 0x80000000
106 1.1 simonb
107 1.1 simonb /* MS (R): Number of TLB entries - 1. */
108 1.1 simonb #define MIPSNN_CFG1_MS_MASK 0x7e000000
109 1.1 simonb #define MIPSNN_CFG1_MS_SHIFT 25
110 1.1 simonb
111 1.1 simonb #define MIPSNN_CFG1_MS(x) (MIPSNN_GET(CFG1_MS, (x)) + 1)
112 1.1 simonb
113 1.1 simonb /* "IS" (R): (Primary) I-cache sets per way. */
114 1.1 simonb #define MIPSNN_CFG1_IS_MASK 0x01c00000
115 1.1 simonb #define MIPSNN_CFG1_IS_SHIFT 22
116 1.1 simonb
117 1.1 simonb #define MIPSNN_CFG1_IS_RSVD 7 /* rsvd value, otherwise: */
118 1.1 simonb #define MIPSNN_CFG1_IS(x) (64 << MIPSNN_GET(CFG1_IS, (x)))
119 1.1 simonb
120 1.1 simonb /* "IL" (R): (Primary) I-cache line size. */
121 1.1 simonb #define MIPSNN_CFG1_IL_MASK 0x00380000
122 1.1 simonb #define MIPSNN_CFG1_IL_SHIFT 19
123 1.1 simonb
124 1.1 simonb #define MIPSNN_CFG1_IL_NONE 0 /* No I-cache, */
125 1.1 simonb #define MIPSNN_CFG1_IL_RSVD 7 /* rsvd value, otherwise: */
126 1.1 simonb #define MIPSNN_CFG1_IL(x) (2 << MIPSNN_GET(CFG1_IL, (x)))
127 1.1 simonb
128 1.1 simonb /* "IA" (R): (Primary) I-cache associativity (ways - 1). */
129 1.1 simonb #define MIPSNN_CFG1_IA_MASK 0x00070000
130 1.1 simonb #define MIPSNN_CFG1_IA_SHIFT 16
131 1.1 simonb
132 1.1 simonb #define MIPSNN_CFG1_IA(x) MIPSNN_GET(CFG1_IA, (x))
133 1.1 simonb
134 1.1 simonb /* "DS" (R): (Primary) D-cache sets per way. */
135 1.1 simonb #define MIPSNN_CFG1_DS_MASK 0x0000e000
136 1.1 simonb #define MIPSNN_CFG1_DS_SHIFT 13
137 1.1 simonb
138 1.1 simonb #define MIPSNN_CFG1_DS_RSVD 7 /* rsvd value, otherwise: */
139 1.1 simonb #define MIPSNN_CFG1_DS(x) (64 << MIPSNN_GET(CFG1_DS, (x)))
140 1.1 simonb
141 1.1 simonb /* "DL" (R): (Primary) D-cache line size. */
142 1.1 simonb #define MIPSNN_CFG1_DL_MASK 0x00001c00
143 1.1 simonb #define MIPSNN_CFG1_DL_SHIFT 10
144 1.1 simonb
145 1.1 simonb #define MIPSNN_CFG1_DL_NONE 0 /* No D-cache, */
146 1.1 simonb #define MIPSNN_CFG1_DL_RSVD 7 /* rsvd value, otherwise: */
147 1.1 simonb #define MIPSNN_CFG1_DL(x) (2 << MIPSNN_GET(CFG1_DL, (x)))
148 1.1 simonb
149 1.1 simonb /* "DA" (R): (Primary) D-cache associativity (ways - 1). */
150 1.1 simonb #define MIPSNN_CFG1_DA_MASK 0x00000380
151 1.1 simonb #define MIPSNN_CFG1_DA_SHIFT 7
152 1.1 simonb
153 1.1 simonb #define MIPSNN_CFG1_DA(x) MIPSNN_GET(CFG1_DA, (x))
154 1.1 simonb
155 1.4 gdamore /* "C2" (R): Coprocessor 2 implemented if set. */
156 1.4 gdamore #define MIPSNN_CFG1_C2 0x00000040
157 1.4 gdamore
158 1.4 gdamore /* "MD" (R): MDMX ASE implemented if set. */
159 1.4 gdamore #define MIPSNN_CFG1_MD 0x00000020
160 1.1 simonb
161 1.1 simonb /* "PC" (R): Performance Counters implemented if set. */
162 1.1 simonb #define MIPSNN_CFG1_PC 0x00000010
163 1.1 simonb
164 1.1 simonb /* "WR" (R): Watch registers implemented if set. */
165 1.1 simonb #define MIPSNN_CFG1_WR 0x00000008
166 1.1 simonb
167 1.1 simonb /* "CA" (R): Code compressiong (MIPS16) implemented if set. */
168 1.1 simonb #define MIPSNN_CFG1_CA 0x00000004
169 1.1 simonb
170 1.1 simonb /* "EP" (R): EJTAG implemented if set. */
171 1.1 simonb #define MIPSNN_CFG1_EP 0x00000002
172 1.1 simonb
173 1.1 simonb /* "FP" (R): FPU implemented if set. */
174 1.1 simonb #define MIPSNN_CFG1_FP 0x00000001
175 1.4 gdamore
176 1.4 gdamore /*
177 1.4 gdamore * Values in Configuration Register 2 (CP0 Register 16, Select 2)
178 1.4 gdamore */
179 1.4 gdamore
180 1.4 gdamore /* "M" (R): Configuration Register 3 present. */
181 1.4 gdamore #define MIPSNN_CFG2_M 0x80000000
182 1.4 gdamore
183 1.4 gdamore /* "TU" (RW): Implementation specific tertiary cache status and control. */
184 1.4 gdamore #define MIPSNN_CFG2_TU_MASK 0x70000000
185 1.4 gdamore #define MIPSNN_CFG2_TU_SHIFT 28
186 1.4 gdamore
187 1.4 gdamore /* "TS" (R): Tertiary cache sets per way. */
188 1.4 gdamore #define MIPSNN_CFG2_TS_MASK 0x07000000
189 1.4 gdamore #define MIPSNN_CFG2_TS_SHIFT 24
190 1.4 gdamore
191 1.4 gdamore #define MIPSNN_CFG2_TS(x) (64 << MIPSNN_GET(CFG2_TS, (x)))
192 1.4 gdamore
193 1.4 gdamore /* "TL" (R): Tertiary cache line size. */
194 1.4 gdamore #define MIPSNN_CFG2_TL_MASK 0x00700000
195 1.4 gdamore #define MIPSNN_CFG2_TL_SHIFT 20
196 1.4 gdamore
197 1.4 gdamore #define MIPSNN_CFG2_TL_NONE 0 /* No Tertiary cache */
198 1.4 gdamore #define MIPSNN_CFG2_TL(x) (2 << MIPSNN_GET(CFG2_TL, (x)))
199 1.4 gdamore
200 1.4 gdamore /* "TA" (R): Tertiary cache associativity (ways - 1). */
201 1.4 gdamore #define MIPSNN_CFG2_TA_MASK 0x00070000
202 1.4 gdamore #define MIPSNN_CFG2_TA_SHIFT 16
203 1.4 gdamore
204 1.4 gdamore #define MIPSNN_CFG2_TA(x) MIPSNN_GET(CFG2_TA, (x))
205 1.4 gdamore
206 1.4 gdamore /* "SU" (RW): Implementation specific secondary cache status and control. */
207 1.4 gdamore #define MIPSNN_CFG2_SU_MASK 0x0000f000
208 1.4 gdamore #define MIPSNN_CFG2_SU_SHIFT 12
209 1.4 gdamore
210 1.4 gdamore /* "SS" (R): Secondary cache sets per way. */
211 1.4 gdamore #define MIPSNN_CFG2_SS_MASK 0x00000700
212 1.4 gdamore #define MIPSNN_CFG2_SS_SHIFT 8
213 1.4 gdamore
214 1.4 gdamore #define MIPSNN_CFG2_SS(x) (64 << MIPSNN_GET(CFG2_SS, (x)))
215 1.4 gdamore
216 1.4 gdamore /* "SL" (R): Secdonary cache line size. */
217 1.4 gdamore #define MIPSNN_CFG2_SL_MASK 0x00000070
218 1.4 gdamore #define MIPSNN_CFG2_SL_SHIFT 4
219 1.4 gdamore
220 1.4 gdamore #define MIPSNN_CFG2_SL_NONE 0 /* No Secondary cache */
221 1.4 gdamore #define MIPSNN_CFG2_SL(x) (2 << MIPSNN_GET(CFG2_SL, (x)))
222 1.4 gdamore
223 1.4 gdamore /* "SA" (R): Secondary cache associativity (ways - 1). */
224 1.4 gdamore #define MIPSNN_CFG2_SA_MASK 0x00000007
225 1.4 gdamore #define MIPSNN_CFG2_SA_SHIFT 0
226 1.4 gdamore
227 1.4 gdamore #define MIPSNN_CFG2_SA(x) MIPSNN_GET(CFG2_SA, (x))
228 1.4 gdamore
229 1.4 gdamore /*
230 1.4 gdamore * Values in Configuration Register 3 (CP0 Register 16, Select 3)
231 1.4 gdamore */
232 1.4 gdamore
233 1.4 gdamore /* "M" (R): Configuration Register 4 present. */
234 1.4 gdamore #define MIPSNN_CFG3_M 0x80000000
235 1.4 gdamore
236 1.4 gdamore /* "DSPP" (R): DSPP ASE extension present. */
237 1.4 gdamore #define MIPSNN_CFG3_DSPP 0x00000400
238 1.4 gdamore
239 1.4 gdamore /* "LPA" (R): Large physical addresses implemented. (MIPS64 rev 2 only). */
240 1.4 gdamore #define MIPSNN_CFG3_LPA 0x00000080
241 1.4 gdamore
242 1.4 gdamore /* "VEIC" (R): External interrupt controller present. (rev 2 only). */
243 1.4 gdamore #define MIPSNN_CFG3_VEIC 0x00000040
244 1.4 gdamore
245 1.4 gdamore /* "VINT" (R): Vectored interrupts implemented. (rev 2 only). */
246 1.4 gdamore #define MIPSNN_CFG3_VINT 0x00000020
247 1.4 gdamore
248 1.4 gdamore /* "SP" (R): Small (1K) page support implemented. (rev 2 only). */
249 1.4 gdamore #define MIPSNN_CFG3_SP 0x00000010
250 1.4 gdamore
251 1.4 gdamore /* "MT" (R): MT ASE extension implemented. */
252 1.4 gdamore #define MIPSNN_CFG3_MT 0x00000004
253 1.4 gdamore
254 1.4 gdamore /* "SM" (R): SmartMIPS ASE extension implemented. */
255 1.4 gdamore #define MIPSNN_CFG3_SM 0x00000002
256 1.4 gdamore
257 1.4 gdamore /* "TL" (R): Trace Logic implemented. */
258 1.4 gdamore #define MIPSNN_CFG3_TL 0x00000001
259