mipsNN.h revision 1.1.8.3 1 1.1.8.3 thorpej /* $NetBSD: mipsNN.h,v 1.1.8.3 2002/12/11 06:11:04 thorpej Exp $ */
2 1.1.8.2 nathanw
3 1.1.8.2 nathanw /*
4 1.1.8.2 nathanw * Copyright 2000, 2001
5 1.1.8.2 nathanw * Broadcom Corporation. All rights reserved.
6 1.1.8.2 nathanw *
7 1.1.8.2 nathanw * This software is furnished under license and may be used and copied only
8 1.1.8.2 nathanw * in accordance with the following terms and conditions. Subject to these
9 1.1.8.2 nathanw * conditions, you may download, copy, install, use, modify and distribute
10 1.1.8.2 nathanw * modified or unmodified copies of this software in source and/or binary
11 1.1.8.2 nathanw * form. No title or ownership is transferred hereby.
12 1.1.8.2 nathanw *
13 1.1.8.2 nathanw * 1) Any source code used, modified or distributed must reproduce and
14 1.1.8.2 nathanw * retain this copyright notice and list of conditions as they appear in
15 1.1.8.2 nathanw * the source file.
16 1.1.8.2 nathanw *
17 1.1.8.2 nathanw * 2) No right is granted to use any trade name, trademark, or logo of
18 1.1.8.2 nathanw * Broadcom Corporation. Neither the "Broadcom Corporation" name nor any
19 1.1.8.2 nathanw * trademark or logo of Broadcom Corporation may be used to endorse or
20 1.1.8.2 nathanw * promote products derived from this software without the prior written
21 1.1.8.2 nathanw * permission of Broadcom Corporation.
22 1.1.8.2 nathanw *
23 1.1.8.2 nathanw * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
24 1.1.8.2 nathanw * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
25 1.1.8.2 nathanw * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
26 1.1.8.2 nathanw * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
27 1.1.8.2 nathanw * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
28 1.1.8.2 nathanw * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 1.1.8.2 nathanw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 1.1.8.2 nathanw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 1.1.8.2 nathanw * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 1.1.8.2 nathanw * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33 1.1.8.2 nathanw * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 1.1.8.2 nathanw */
35 1.1.8.2 nathanw
36 1.1.8.2 nathanw /*
37 1.1.8.2 nathanw * Values related to the MIPS32/MIPS64 Privileged Resource Architecture.
38 1.1.8.2 nathanw */
39 1.1.8.2 nathanw
40 1.1.8.2 nathanw #define _MIPSNN_SHIFT(reg) __MIPSNN_SHIFT(reg)
41 1.1.8.2 nathanw #define __MIPSNN_SHIFT(reg) MIPSNN_ ## reg ## _SHIFT
42 1.1.8.2 nathanw #define _MIPSNN_MASK(reg) __MIPSNN_MASK(reg)
43 1.1.8.2 nathanw #define __MIPSNN_MASK(reg) MIPSNN_ ## reg ## _MASK
44 1.1.8.2 nathanw
45 1.1.8.2 nathanw #define MIPSNN_GET(reg, x) \
46 1.1.8.2 nathanw ((unsigned)((x) & _MIPSNN_MASK(reg)) >> _MIPSNN_SHIFT(reg))
47 1.1.8.2 nathanw #define MIPSNN_PUT(reg, val) \
48 1.1.8.2 nathanw (((x) << _MIPSNN_SHIFT(reg)) & _MIPSNN_MASK(reg))
49 1.1.8.2 nathanw
50 1.1.8.2 nathanw /*
51 1.1.8.2 nathanw * Values in Configuration Register (CP0 Register 16, Select 0)
52 1.1.8.2 nathanw */
53 1.1.8.2 nathanw
54 1.1.8.2 nathanw /* "M" (R): Configuration Register 1 present if set. Defined as always set. */
55 1.1.8.2 nathanw #define MIPSNN_CFG_M 0x80000000
56 1.1.8.2 nathanw
57 1.1.8.2 nathanw /* Reserved for CPU implementations. */
58 1.1.8.2 nathanw // reserved 0x7fff0000
59 1.1.8.2 nathanw
60 1.1.8.2 nathanw /* "BE" (R): Big endian if set, little endian if clear. */
61 1.1.8.2 nathanw #define MIPSNN_CFG_BE 0x00008000
62 1.1.8.2 nathanw
63 1.1.8.2 nathanw /* "AT" (R): architecture type implemented by processor */
64 1.1.8.2 nathanw #define MIPSNN_CFG_AT_MASK 0x00006000
65 1.1.8.2 nathanw #define MIPSNN_CFG_AT_SHIFT 13
66 1.1.8.2 nathanw
67 1.1.8.2 nathanw #define MIPSNN_CFG_AT_MIPS32 0 /* MIPS32 */
68 1.1.8.2 nathanw #define MIPSNN_CFG_AT_MIPS64S 1 /* MIPS64S */
69 1.1.8.2 nathanw #define MIPSNN_CFG_AT_MIPS64 2 /* MIPS64 */
70 1.1.8.2 nathanw // reserved 3
71 1.1.8.2 nathanw
72 1.1.8.2 nathanw /* "AR" (R): Architecture revision level implemented by proc. */
73 1.1.8.2 nathanw #define MIPSNN_CFG_AR_MASK 0x00001c00
74 1.1.8.2 nathanw #define MIPSNN_CFG_AR_SHIFT 10
75 1.1.8.2 nathanw
76 1.1.8.2 nathanw #define MIPSNN_CFG_AR_REV1 0 /* Revision 1 */
77 1.1.8.2 nathanw // reserved other values
78 1.1.8.2 nathanw
79 1.1.8.2 nathanw /* "MT" (R): MMU type implemented by processor */
80 1.1.8.2 nathanw #define MIPSNN_CFG_MT_MASK 0x00000380
81 1.1.8.2 nathanw #define MIPSNN_CFG_MT_SHIFT 7
82 1.1.8.2 nathanw
83 1.1.8.2 nathanw #define MIPSNN_CFG_MT_NONE 0 /* No MMU */
84 1.1.8.2 nathanw #define MIPSNN_CFG_MT_TLB 1 /* Std TLB */
85 1.1.8.2 nathanw #define MIPSNN_CFG_MT_BAT 2 /* Std BAT */
86 1.1.8.2 nathanw #define MIPSNN_CFG_MT_FIXED 3 /* Std Fixed mapping */
87 1.1.8.2 nathanw // reserved other values
88 1.1.8.2 nathanw
89 1.1.8.2 nathanw /* Reserved. Write as 0, reads as 0. */
90 1.1.8.3 thorpej // reserved 0x00000070
91 1.1.8.3 thorpej
92 1.1.8.3 thorpej /* "M" (R): Virtual instruction cache if set. */
93 1.1.8.3 thorpej #define MIPSNN_CFG_VI 0x00000008
94 1.1.8.2 nathanw
95 1.1.8.2 nathanw /* "K0" (RW): Kseg0 coherency algorithm. (values are TLB_ATTRs) */
96 1.1.8.2 nathanw #define MIPSNN_CFG_K0_MASK 0x00000007
97 1.1.8.2 nathanw #define MIPSNN_CFG_K0_SHIFT 0
98 1.1.8.2 nathanw
99 1.1.8.2 nathanw
100 1.1.8.2 nathanw /*
101 1.1.8.2 nathanw * Values in Configuration Register 1 (CP0 Register 16, Select 1)
102 1.1.8.2 nathanw */
103 1.1.8.2 nathanw
104 1.1.8.2 nathanw /* Reserved for Configuration Register 2 present. Write as 0, reads as 0. */
105 1.1.8.2 nathanw // reserved 0x80000000
106 1.1.8.2 nathanw
107 1.1.8.2 nathanw /* MS (R): Number of TLB entries - 1. */
108 1.1.8.2 nathanw #define MIPSNN_CFG1_MS_MASK 0x7e000000
109 1.1.8.2 nathanw #define MIPSNN_CFG1_MS_SHIFT 25
110 1.1.8.2 nathanw
111 1.1.8.2 nathanw #define MIPSNN_CFG1_MS(x) (MIPSNN_GET(CFG1_MS, (x)) + 1)
112 1.1.8.2 nathanw
113 1.1.8.2 nathanw /* "IS" (R): (Primary) I-cache sets per way. */
114 1.1.8.2 nathanw #define MIPSNN_CFG1_IS_MASK 0x01c00000
115 1.1.8.2 nathanw #define MIPSNN_CFG1_IS_SHIFT 22
116 1.1.8.2 nathanw
117 1.1.8.2 nathanw #define MIPSNN_CFG1_IS_RSVD 7 /* rsvd value, otherwise: */
118 1.1.8.2 nathanw #define MIPSNN_CFG1_IS(x) (64 << MIPSNN_GET(CFG1_IS, (x)))
119 1.1.8.2 nathanw
120 1.1.8.2 nathanw /* "IL" (R): (Primary) I-cache line size. */
121 1.1.8.2 nathanw #define MIPSNN_CFG1_IL_MASK 0x00380000
122 1.1.8.2 nathanw #define MIPSNN_CFG1_IL_SHIFT 19
123 1.1.8.2 nathanw
124 1.1.8.2 nathanw #define MIPSNN_CFG1_IL_NONE 0 /* No I-cache, */
125 1.1.8.2 nathanw #define MIPSNN_CFG1_IL_RSVD 7 /* rsvd value, otherwise: */
126 1.1.8.2 nathanw #define MIPSNN_CFG1_IL(x) (2 << MIPSNN_GET(CFG1_IL, (x)))
127 1.1.8.2 nathanw
128 1.1.8.2 nathanw /* "IA" (R): (Primary) I-cache associativity (ways - 1). */
129 1.1.8.2 nathanw #define MIPSNN_CFG1_IA_MASK 0x00070000
130 1.1.8.2 nathanw #define MIPSNN_CFG1_IA_SHIFT 16
131 1.1.8.2 nathanw
132 1.1.8.2 nathanw #define MIPSNN_CFG1_IA(x) MIPSNN_GET(CFG1_IA, (x))
133 1.1.8.2 nathanw
134 1.1.8.2 nathanw /* "DS" (R): (Primary) D-cache sets per way. */
135 1.1.8.2 nathanw #define MIPSNN_CFG1_DS_MASK 0x0000e000
136 1.1.8.2 nathanw #define MIPSNN_CFG1_DS_SHIFT 13
137 1.1.8.2 nathanw
138 1.1.8.2 nathanw #define MIPSNN_CFG1_DS_RSVD 7 /* rsvd value, otherwise: */
139 1.1.8.2 nathanw #define MIPSNN_CFG1_DS(x) (64 << MIPSNN_GET(CFG1_DS, (x)))
140 1.1.8.2 nathanw
141 1.1.8.2 nathanw /* "DL" (R): (Primary) D-cache line size. */
142 1.1.8.2 nathanw #define MIPSNN_CFG1_DL_MASK 0x00001c00
143 1.1.8.2 nathanw #define MIPSNN_CFG1_DL_SHIFT 10
144 1.1.8.2 nathanw
145 1.1.8.2 nathanw #define MIPSNN_CFG1_DL_NONE 0 /* No D-cache, */
146 1.1.8.2 nathanw #define MIPSNN_CFG1_DL_RSVD 7 /* rsvd value, otherwise: */
147 1.1.8.2 nathanw #define MIPSNN_CFG1_DL(x) (2 << MIPSNN_GET(CFG1_DL, (x)))
148 1.1.8.2 nathanw
149 1.1.8.2 nathanw /* "DA" (R): (Primary) D-cache associativity (ways - 1). */
150 1.1.8.2 nathanw #define MIPSNN_CFG1_DA_MASK 0x00000380
151 1.1.8.2 nathanw #define MIPSNN_CFG1_DA_SHIFT 7
152 1.1.8.2 nathanw
153 1.1.8.2 nathanw #define MIPSNN_CFG1_DA(x) MIPSNN_GET(CFG1_DA, (x))
154 1.1.8.2 nathanw
155 1.1.8.2 nathanw /* Reserved. Write as 0, reads as 0. */
156 1.1.8.2 nathanw // reserved 0x00000060
157 1.1.8.2 nathanw
158 1.1.8.2 nathanw /* "PC" (R): Performance Counters implemented if set. */
159 1.1.8.2 nathanw #define MIPSNN_CFG1_PC 0x00000010
160 1.1.8.2 nathanw
161 1.1.8.2 nathanw /* "WR" (R): Watch registers implemented if set. */
162 1.1.8.2 nathanw #define MIPSNN_CFG1_WR 0x00000008
163 1.1.8.2 nathanw
164 1.1.8.2 nathanw /* "CA" (R): Code compressiong (MIPS16) implemented if set. */
165 1.1.8.2 nathanw #define MIPSNN_CFG1_CA 0x00000004
166 1.1.8.2 nathanw
167 1.1.8.2 nathanw /* "EP" (R): EJTAG implemented if set. */
168 1.1.8.2 nathanw #define MIPSNN_CFG1_EP 0x00000002
169 1.1.8.2 nathanw
170 1.1.8.2 nathanw /* "FP" (R): FPU implemented if set. */
171 1.1.8.2 nathanw #define MIPSNN_CFG1_FP 0x00000001
172