| @@ -1,2473 +1,2474 @@ | | | @@ -1,2473 +1,2474 @@ |
1 | /* $NetBSD: mips_machdep.c,v 1.277 2017/05/07 05:45:07 skrll Exp $ */ | | 1 | /* $NetBSD: mips_machdep.c,v 1.278 2017/06/09 06:43:30 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2002 Wasabi Systems, Inc. | | 4 | * Copyright 2002 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Simon Burge for Wasabi Systems, Inc. | | 7 | * Written by Simon Burge for Wasabi Systems, Inc. |
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 | * Wasabi Systems, Inc. | | 20 | * Wasabi Systems, Inc. |
21 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse | | 21 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse |
22 | * or promote products derived from this software without specific prior | | 22 | * or promote products derived from this software without specific prior |
23 | * written permission. | | 23 | * written permission. |
24 | * | | 24 | * |
25 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND | | 25 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | | 28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC |
29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | * POSSIBILITY OF SUCH DAMAGE. | | 35 | * POSSIBILITY OF SUCH DAMAGE. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | /* | | 38 | /* |
39 | * Copyright 2000, 2001 | | 39 | * Copyright 2000, 2001 |
40 | * Broadcom Corporation. All rights reserved. | | 40 | * Broadcom Corporation. All rights reserved. |
41 | * | | 41 | * |
42 | * This software is furnished under license and may be used and copied only | | 42 | * This software is furnished under license and may be used and copied only |
43 | * in accordance with the following terms and conditions. Subject to these | | 43 | * in accordance with the following terms and conditions. Subject to these |
44 | * conditions, you may download, copy, install, use, modify and distribute | | 44 | * conditions, you may download, copy, install, use, modify and distribute |
45 | * modified or unmodified copies of this software in source and/or binary | | 45 | * modified or unmodified copies of this software in source and/or binary |
46 | * form. No title or ownership is transferred hereby. | | 46 | * form. No title or ownership is transferred hereby. |
47 | * | | 47 | * |
48 | * 1) Any source code used, modified or distributed must reproduce and | | 48 | * 1) Any source code used, modified or distributed must reproduce and |
49 | * retain this copyright notice and list of conditions as they appear in | | 49 | * retain this copyright notice and list of conditions as they appear in |
50 | * the source file. | | 50 | * the source file. |
51 | * | | 51 | * |
52 | * 2) No right is granted to use any trade name, trademark, or logo of | | 52 | * 2) No right is granted to use any trade name, trademark, or logo of |
53 | * Broadcom Corporation. The "Broadcom Corporation" name may not be | | 53 | * Broadcom Corporation. The "Broadcom Corporation" name may not be |
54 | * used to endorse or promote products derived from this software | | 54 | * used to endorse or promote products derived from this software |
55 | * without the prior written permission of Broadcom Corporation. | | 55 | * without the prior written permission of Broadcom Corporation. |
56 | * | | 56 | * |
57 | * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED | | 57 | * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED |
58 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF | | 58 | * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF |
59 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | | 59 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR |
60 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE | | 60 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE |
61 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE | | 61 | * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE |
62 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 62 | * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
63 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 63 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
64 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | | 64 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
65 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 65 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
66 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | | 66 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
67 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 67 | * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
68 | */ | | 68 | */ |
69 | | | 69 | |
70 | /*- | | 70 | /*- |
71 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. | | 71 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. |
72 | * All rights reserved. | | 72 | * All rights reserved. |
73 | * | | 73 | * |
74 | * This code is derived from software contributed to The NetBSD Foundation | | 74 | * This code is derived from software contributed to The NetBSD Foundation |
75 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 75 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
76 | * NASA Ames Research Center and by Chris Demetriou. | | 76 | * NASA Ames Research Center and by Chris Demetriou. |
77 | * | | 77 | * |
78 | * Redistribution and use in source and binary forms, with or without | | 78 | * Redistribution and use in source and binary forms, with or without |
79 | * modification, are permitted provided that the following conditions | | 79 | * modification, are permitted provided that the following conditions |
80 | * are met: | | 80 | * are met: |
81 | * 1. Redistributions of source code must retain the above copyright | | 81 | * 1. Redistributions of source code must retain the above copyright |
82 | * notice, this list of conditions and the following disclaimer. | | 82 | * notice, this list of conditions and the following disclaimer. |
83 | * 2. Redistributions in binary form must reproduce the above copyright | | 83 | * 2. Redistributions in binary form must reproduce the above copyright |
84 | * notice, this list of conditions and the following disclaimer in the | | 84 | * notice, this list of conditions and the following disclaimer in the |
85 | * documentation and/or other materials provided with the distribution. | | 85 | * documentation and/or other materials provided with the distribution. |
86 | * | | 86 | * |
87 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 87 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
88 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 88 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
89 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 89 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
90 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 90 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
91 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 91 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
92 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 92 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
93 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 93 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
94 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 94 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
95 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 95 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
96 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 96 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
97 | * POSSIBILITY OF SUCH DAMAGE. | | 97 | * POSSIBILITY OF SUCH DAMAGE. |
98 | */ | | 98 | */ |
99 | | | 99 | |
100 | /* | | 100 | /* |
101 | * Copyright 1996 The Board of Trustees of The Leland Stanford | | 101 | * Copyright 1996 The Board of Trustees of The Leland Stanford |
102 | * Junior University. All Rights Reserved. | | 102 | * Junior University. All Rights Reserved. |
103 | * | | 103 | * |
104 | * Permission to use, copy, modify, and distribute this | | 104 | * Permission to use, copy, modify, and distribute this |
105 | * software and its documentation for any purpose and without | | 105 | * software and its documentation for any purpose and without |
106 | * fee is hereby granted, provided that the above copyright | | 106 | * fee is hereby granted, provided that the above copyright |
107 | * notice appear in all copies. Stanford University | | 107 | * notice appear in all copies. Stanford University |
108 | * makes no representations about the suitability of this | | 108 | * makes no representations about the suitability of this |
109 | * software for any purpose. It is provided "as is" without | | 109 | * software for any purpose. It is provided "as is" without |
110 | * express or implied warranty. | | 110 | * express or implied warranty. |
111 | */ | | 111 | */ |
112 | | | 112 | |
113 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 113 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
114 | __KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.277 2017/05/07 05:45:07 skrll Exp $"); | | 114 | __KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.278 2017/06/09 06:43:30 skrll Exp $"); |
115 | | | 115 | |
116 | #define __INTR_PRIVATE | | 116 | #define __INTR_PRIVATE |
117 | #include "opt_cputype.h" | | 117 | #include "opt_cputype.h" |
118 | #include "opt_compat_netbsd32.h" | | 118 | #include "opt_compat_netbsd32.h" |
119 | #include "opt_multiprocessor.h" | | 119 | #include "opt_multiprocessor.h" |
120 | | | 120 | |
121 | #include <sys/param.h> | | 121 | #include <sys/param.h> |
122 | #include <sys/systm.h> | | 122 | #include <sys/systm.h> |
123 | #include <sys/proc.h> | | 123 | #include <sys/proc.h> |
124 | #include <sys/intr.h> | | 124 | #include <sys/intr.h> |
125 | #include <sys/exec.h> | | 125 | #include <sys/exec.h> |
126 | #include <sys/reboot.h> | | 126 | #include <sys/reboot.h> |
127 | #include <sys/mount.h> /* fsid_t for syscallargs */ | | 127 | #include <sys/mount.h> /* fsid_t for syscallargs */ |
128 | #include <sys/lwp.h> | | 128 | #include <sys/lwp.h> |
129 | #include <sys/sysctl.h> | | 129 | #include <sys/sysctl.h> |
130 | #include <sys/msgbuf.h> | | 130 | #include <sys/msgbuf.h> |
131 | #include <sys/conf.h> | | 131 | #include <sys/conf.h> |
132 | #include <sys/core.h> | | 132 | #include <sys/core.h> |
133 | #include <sys/device.h> | | 133 | #include <sys/device.h> |
134 | #include <sys/kcore.h> | | 134 | #include <sys/kcore.h> |
135 | #include <sys/kmem.h> | | 135 | #include <sys/kmem.h> |
136 | #include <sys/ras.h> | | 136 | #include <sys/ras.h> |
137 | #include <sys/cpu.h> | | 137 | #include <sys/cpu.h> |
138 | #include <sys/atomic.h> | | 138 | #include <sys/atomic.h> |
139 | #include <sys/ucontext.h> | | 139 | #include <sys/ucontext.h> |
140 | #include <sys/bitops.h> | | 140 | #include <sys/bitops.h> |
141 | | | 141 | |
142 | #include <mips/kcore.h> | | 142 | #include <mips/kcore.h> |
143 | | | 143 | |
144 | #ifdef COMPAT_NETBSD32 | | 144 | #ifdef COMPAT_NETBSD32 |
145 | #include <compat/netbsd32/netbsd32.h> | | 145 | #include <compat/netbsd32/netbsd32.h> |
146 | #endif | | 146 | #endif |
147 | | | 147 | |
148 | #include <uvm/uvm.h> | | 148 | #include <uvm/uvm.h> |
149 | #include <uvm/uvm_physseg.h> | | 149 | #include <uvm/uvm_physseg.h> |
150 | | | 150 | |
151 | #include <dev/cons.h> | | 151 | #include <dev/cons.h> |
152 | #include <dev/mm.h> | | 152 | #include <dev/mm.h> |
153 | | | 153 | |
154 | #include <mips/pcb.h> | | 154 | #include <mips/pcb.h> |
155 | #include <mips/cache.h> | | 155 | #include <mips/cache.h> |
156 | #include <mips/frame.h> | | 156 | #include <mips/frame.h> |
157 | #include <mips/regnum.h> | | 157 | #include <mips/regnum.h> |
158 | #include <mips/mips_opcode.h> | | 158 | #include <mips/mips_opcode.h> |
159 | | | 159 | |
160 | #include <mips/cpu.h> | | 160 | #include <mips/cpu.h> |
161 | #include <mips/locore.h> | | 161 | #include <mips/locore.h> |
162 | #include <mips/psl.h> | | 162 | #include <mips/psl.h> |
163 | #include <mips/pte.h> | | 163 | #include <mips/pte.h> |
164 | #include <mips/userret.h> | | 164 | #include <mips/userret.h> |
165 | | | 165 | |
166 | #ifdef __HAVE_BOOTINFO_H | | 166 | #ifdef __HAVE_BOOTINFO_H |
167 | #include <machine/bootinfo.h> | | 167 | #include <machine/bootinfo.h> |
168 | #endif | | 168 | #endif |
169 | | | 169 | |
170 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 | | 170 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 |
171 | #include <mips/mipsNN.h> /* MIPS32/MIPS64 registers */ | | 171 | #include <mips/mipsNN.h> /* MIPS32/MIPS64 registers */ |
172 | | | 172 | |
173 | #define _MKINSN(a,b,c,d,e) ((uint32_t)(((a) << 26)|((b) << 21)|((c) << 16)|((d) << 11)|(e))) | | 173 | #define _MKINSN(a,b,c,d,e) ((uint32_t)(((a) << 26)|((b) << 21)|((c) << 16)|((d) << 11)|(e))) |
174 | | | 174 | |
175 | #ifdef _LP64 | | 175 | #ifdef _LP64 |
176 | #define _LOAD_V0_L_PRIVATE_A0 _MKINSN(OP_LD, _R_A0, _R_V0, 0, offsetof(lwp_t, l_private)) | | 176 | #define _LOAD_V0_L_PRIVATE_A0 _MKINSN(OP_LD, _R_A0, _R_V0, 0, offsetof(lwp_t, l_private)) |
177 | #define _MTC0_V0_USERLOCAL _MKINSN(OP_COP0, OP_DMT, _R_V0, MIPS_COP_0_TLB_CONTEXT, 2) | | 177 | #define _MTC0_V0_USERLOCAL _MKINSN(OP_COP0, OP_DMT, _R_V0, MIPS_COP_0_TLB_CONTEXT, 2) |
178 | #else | | 178 | #else |
179 | #define _LOAD_V0_L_PRIVATE_A0 _MKINSN(OP_LW, _R_A0, _R_V0, 0, offsetof(lwp_t, l_private)) | | 179 | #define _LOAD_V0_L_PRIVATE_A0 _MKINSN(OP_LW, _R_A0, _R_V0, 0, offsetof(lwp_t, l_private)) |
180 | #define _MTC0_V0_USERLOCAL _MKINSN(OP_COP0, OP_MT, _R_V0, MIPS_COP_0_TLB_CONTEXT, 2) | | 180 | #define _MTC0_V0_USERLOCAL _MKINSN(OP_COP0, OP_MT, _R_V0, MIPS_COP_0_TLB_CONTEXT, 2) |
181 | #endif | | 181 | #endif |
182 | #define JR_RA _MKINSN(OP_SPECIAL, _R_RA, 0, 0, OP_JR) | | 182 | #define JR_RA _MKINSN(OP_SPECIAL, _R_RA, 0, 0, OP_JR) |
183 | | | 183 | |
184 | #endif | | 184 | #endif |
185 | | | 185 | |
186 | /* Internal routines. */ | | 186 | /* Internal routines. */ |
187 | int cpu_dumpsize(void); | | 187 | int cpu_dumpsize(void); |
188 | u_long cpu_dump_mempagecnt(void); | | 188 | u_long cpu_dump_mempagecnt(void); |
189 | int cpu_dump(void); | | 189 | int cpu_dump(void); |
190 | | | 190 | |
191 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 | | 191 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 |
192 | static void mips_watchpoint_init(void); | | 192 | static void mips_watchpoint_init(void); |
193 | #endif | | 193 | #endif |
194 | | | 194 | |
195 | #if defined(_LP64) && defined(ENABLE_MIPS_16KB_PAGE) | | 195 | #if defined(_LP64) && defined(ENABLE_MIPS_16KB_PAGE) |
196 | vaddr_t mips_vm_maxuser_address = MIPS_VM_MAXUSER_ADDRESS; | | 196 | vaddr_t mips_vm_maxuser_address = MIPS_VM_MAXUSER_ADDRESS; |
197 | #endif | | 197 | #endif |
198 | | | 198 | |
199 | #if defined(MIPS3_PLUS) | | 199 | #if defined(MIPS3_PLUS) |
200 | uint32_t mips3_cp0_tlb_page_mask_probe(void); | | 200 | uint32_t mips3_cp0_tlb_page_mask_probe(void); |
201 | uint64_t mips3_cp0_tlb_entry_hi_probe(void); | | 201 | uint64_t mips3_cp0_tlb_entry_hi_probe(void); |
202 | uint64_t mips3_cp0_tlb_entry_lo_probe(void); | | 202 | uint64_t mips3_cp0_tlb_entry_lo_probe(void); |
203 | | | 203 | |
204 | static void mips3_tlb_probe(void); | | 204 | static void mips3_tlb_probe(void); |
205 | #endif | | 205 | #endif |
206 | | | 206 | |
207 | #if defined(MIPS1) | | 207 | #if defined(MIPS1) |
208 | static void mips1_vector_init(const struct splsw *); | | 208 | static void mips1_vector_init(const struct splsw *); |
209 | extern const struct locoresw mips1_locoresw; | | 209 | extern const struct locoresw mips1_locoresw; |
210 | extern const mips_locore_jumpvec_t mips1_locore_vec; | | 210 | extern const mips_locore_jumpvec_t mips1_locore_vec; |
211 | #endif | | 211 | #endif |
212 | | | 212 | |
213 | #if defined(MIPS3) | | 213 | #if defined(MIPS3) |
214 | static void mips3_vector_init(const struct splsw *); | | 214 | static void mips3_vector_init(const struct splsw *); |
215 | extern const struct locoresw mips3_locoresw; | | 215 | extern const struct locoresw mips3_locoresw; |
216 | extern const mips_locore_jumpvec_t mips3_locore_vec; | | 216 | extern const mips_locore_jumpvec_t mips3_locore_vec; |
217 | #endif | | 217 | #endif |
218 | | | 218 | |
219 | #if defined(MIPS3_LOONGSON2) | | 219 | #if defined(MIPS3_LOONGSON2) |
220 | static void loongson2_vector_init(const struct splsw *); | | 220 | static void loongson2_vector_init(const struct splsw *); |
221 | extern const struct locoresw loongson2_locoresw; | | 221 | extern const struct locoresw loongson2_locoresw; |
222 | extern const mips_locore_jumpvec_t loongson2_locore_vec; | | 222 | extern const mips_locore_jumpvec_t loongson2_locore_vec; |
223 | #endif | | 223 | #endif |
224 | | | 224 | |
225 | #if defined(MIPS32) | | 225 | #if defined(MIPS32) |
226 | static void mips32_vector_init(const struct splsw *); | | 226 | static void mips32_vector_init(const struct splsw *); |
227 | extern const struct locoresw mips32_locoresw; | | 227 | extern const struct locoresw mips32_locoresw; |
228 | extern const mips_locore_jumpvec_t mips32_locore_vec; | | 228 | extern const mips_locore_jumpvec_t mips32_locore_vec; |
229 | #endif | | 229 | #endif |
230 | | | 230 | |
231 | #if defined(MIPS32R2) | | 231 | #if defined(MIPS32R2) |
232 | static void mips32r2_vector_init(const struct splsw *); | | 232 | static void mips32r2_vector_init(const struct splsw *); |
233 | extern const struct locoresw mips32r2_locoresw; | | 233 | extern const struct locoresw mips32r2_locoresw; |
234 | extern const mips_locore_jumpvec_t mips32r2_locore_vec; | | 234 | extern const mips_locore_jumpvec_t mips32r2_locore_vec; |
235 | #endif | | 235 | #endif |
236 | | | 236 | |
237 | #if defined(MIPS64) | | 237 | #if defined(MIPS64) |
238 | static void mips64_vector_init(const struct splsw *); | | 238 | static void mips64_vector_init(const struct splsw *); |
239 | extern const struct locoresw mips64_locoresw; | | 239 | extern const struct locoresw mips64_locoresw; |
240 | extern const mips_locore_jumpvec_t mips64_locore_vec; | | 240 | extern const mips_locore_jumpvec_t mips64_locore_vec; |
241 | #endif | | 241 | #endif |
242 | | | 242 | |
243 | #if defined(MIPS64R2) | | 243 | #if defined(MIPS64R2) |
244 | extern const struct locoresw mips64r2_locoresw; | | 244 | extern const struct locoresw mips64r2_locoresw; |
245 | extern const mips_locore_jumpvec_t mips64r2_locore_vec; | | 245 | extern const mips_locore_jumpvec_t mips64r2_locore_vec; |
246 | #endif | | 246 | #endif |
247 | | | 247 | |
248 | #if defined(PARANOIA) | | 248 | #if defined(PARANOIA) |
249 | void std_splsw_test(void); | | 249 | void std_splsw_test(void); |
250 | #endif | | 250 | #endif |
251 | | | 251 | |
252 | mips_locore_jumpvec_t mips_locore_jumpvec; | | 252 | mips_locore_jumpvec_t mips_locore_jumpvec; |
253 | | | 253 | |
254 | struct locoresw mips_locoresw; | | 254 | struct locoresw mips_locoresw; |
255 | | | 255 | |
256 | extern const struct splsw std_splsw; | | 256 | extern const struct splsw std_splsw; |
257 | struct splsw mips_splsw; | | 257 | struct splsw mips_splsw; |
258 | | | 258 | |
259 | struct mips_options mips_options = { | | 259 | struct mips_options mips_options = { |
260 | .mips_cpu_id = 0xffffffff, | | 260 | .mips_cpu_id = 0xffffffff, |
261 | .mips_fpu_id = 0xffffffff, | | 261 | .mips_fpu_id = 0xffffffff, |
262 | }; | | 262 | }; |
263 | | | 263 | |
264 | void * msgbufaddr; | | 264 | void * msgbufaddr; |
265 | | | 265 | |
266 | /* the following is used externally (sysctl_hw) */ | | 266 | /* the following is used externally (sysctl_hw) */ |
267 | char machine[] = MACHINE; /* from <machine/param.h> */ | | 267 | char machine[] = MACHINE; /* from <machine/param.h> */ |
268 | char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */ | | 268 | char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */ |
269 | | | 269 | |
270 | | | 270 | |
271 | /* | | 271 | /* |
272 | * Assumptions: | | 272 | * Assumptions: |
273 | * - All MIPS3+ have an r4k-style MMU. _Many_ assumptions throughout | | 273 | * - All MIPS3+ have an r4k-style MMU. _Many_ assumptions throughout |
274 | * much of the mips code about this. Includes overloaded usage of | | 274 | * much of the mips code about this. Includes overloaded usage of |
275 | * MIPS3_PLUS. | | 275 | * MIPS3_PLUS. |
276 | * - All MIPS3+ use the same exception model (cp0 status, cause bits, | | 276 | * - All MIPS3+ use the same exception model (cp0 status, cause bits, |
277 | * etc). _Many_ assumptions throughout much of the mips code about | | 277 | * etc). _Many_ assumptions throughout much of the mips code about |
278 | * this. Includes overloaded usage of MIPS3_PLUS. | | 278 | * this. Includes overloaded usage of MIPS3_PLUS. |
279 | * - All MIPS3+ have a count register. MIPS_HAS_CLOCK in <mips/cpu.h> | | 279 | * - All MIPS3+ have a count register. MIPS_HAS_CLOCK in <mips/cpu.h> |
280 | * will need to be revised if this is false. | | 280 | * will need to be revised if this is false. |
281 | */ | | 281 | */ |
282 | #define MIPS32_FLAGS CPU_MIPS_R4K_MMU | CPU_MIPS_CAUSE_IV | CPU_MIPS_USE_WAIT | | 282 | #define MIPS32_FLAGS CPU_MIPS_R4K_MMU | CPU_MIPS_CAUSE_IV | CPU_MIPS_USE_WAIT |
283 | #define MIPS64_FLAGS MIPS32_FLAGS /* same as MIPS32 flags (for now) */ | | 283 | #define MIPS64_FLAGS MIPS32_FLAGS /* same as MIPS32 flags (for now) */ |
284 | | | 284 | |
285 | static const struct pridtab cputab[] = { | | 285 | static const struct pridtab cputab[] = { |
286 | { 0, MIPS_R2000, -1, -1, CPU_ARCH_MIPS1, 64, | | 286 | { 0, MIPS_R2000, -1, -1, CPU_ARCH_MIPS1, 64, |
287 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R2000 CPU" }, | | 287 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R2000 CPU" }, |
288 | { 0, MIPS_R3000, MIPS_REV_R2000A, -1, CPU_ARCH_MIPS1, 64, | | 288 | { 0, MIPS_R3000, MIPS_REV_R2000A, -1, CPU_ARCH_MIPS1, 64, |
289 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R2000A CPU" }, | | 289 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R2000A CPU" }, |
290 | { 0, MIPS_R3000, MIPS_REV_R3000, -1, CPU_ARCH_MIPS1, 64, | | 290 | { 0, MIPS_R3000, MIPS_REV_R3000, -1, CPU_ARCH_MIPS1, 64, |
291 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R3000 CPU" }, | | 291 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R3000 CPU" }, |
292 | { 0, MIPS_R3000, MIPS_REV_R3000A, -1, CPU_ARCH_MIPS1, 64, | | 292 | { 0, MIPS_R3000, MIPS_REV_R3000A, -1, CPU_ARCH_MIPS1, 64, |
293 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R3000A CPU" }, | | 293 | CPU_MIPS_NO_LLSC, 0, 0, "MIPS R3000A CPU" }, |
294 | { 0, MIPS_R6000, -1, -1, CPU_ARCH_MIPS2, 32, | | 294 | { 0, MIPS_R6000, -1, -1, CPU_ARCH_MIPS2, 32, |
295 | MIPS_NOT_SUPP, 0, 0, "MIPS R6000 CPU" }, | | 295 | MIPS_NOT_SUPP, 0, 0, "MIPS R6000 CPU" }, |
296 | | | 296 | |
297 | /* | | 297 | /* |
298 | * rev 0x00, 0x22 and 0x30 are R4000, 0x40, 0x50 and 0x60 are R4400. | | 298 | * rev 0x00, 0x22 and 0x30 are R4000, 0x40, 0x50 and 0x60 are R4400. |
299 | * should we allow ranges and use 0x00 - 0x3f for R4000 and | | 299 | * should we allow ranges and use 0x00 - 0x3f for R4000 and |
300 | * 0x40 - 0xff for R4400? | | 300 | * 0x40 - 0xff for R4400? |
301 | */ | | 301 | */ |
302 | { 0, MIPS_R4000, MIPS_REV_R4000_A, -1, CPU_ARCH_MIPS3, 48, | | 302 | { 0, MIPS_R4000, MIPS_REV_R4000_A, -1, CPU_ARCH_MIPS3, 48, |
303 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 303 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
304 | "MIPS R4000 CPU" }, | | 304 | "MIPS R4000 CPU" }, |
305 | { 0, MIPS_R4000, MIPS_REV_R4000_B, -1, CPU_ARCH_MIPS3, 48, | | 305 | { 0, MIPS_R4000, MIPS_REV_R4000_B, -1, CPU_ARCH_MIPS3, 48, |
306 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 306 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
307 | "MIPS R4000 CPU" }, | | 307 | "MIPS R4000 CPU" }, |
308 | { 0, MIPS_R4000, MIPS_REV_R4000_C, -1, CPU_ARCH_MIPS3, 48, | | 308 | { 0, MIPS_R4000, MIPS_REV_R4000_C, -1, CPU_ARCH_MIPS3, 48, |
309 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 309 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
310 | "MIPS R4000 CPU" }, | | 310 | "MIPS R4000 CPU" }, |
311 | { 0, MIPS_R4000, MIPS_REV_R4400_A, -1, CPU_ARCH_MIPS3, 48, | | 311 | { 0, MIPS_R4000, MIPS_REV_R4400_A, -1, CPU_ARCH_MIPS3, 48, |
312 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 312 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
313 | "MIPS R4400 CPU" }, | | 313 | "MIPS R4400 CPU" }, |
314 | { 0, MIPS_R4000, MIPS_REV_R4400_B, -1, CPU_ARCH_MIPS3, 48, | | 314 | { 0, MIPS_R4000, MIPS_REV_R4400_B, -1, CPU_ARCH_MIPS3, 48, |
315 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 315 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
316 | "MIPS R4400 CPU" }, | | 316 | "MIPS R4400 CPU" }, |
317 | { 0, MIPS_R4000, MIPS_REV_R4400_C, -1, CPU_ARCH_MIPS3, 48, | | 317 | { 0, MIPS_R4000, MIPS_REV_R4400_C, -1, CPU_ARCH_MIPS3, 48, |
318 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 318 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
319 | "MIPS R4400 CPU" }, | | 319 | "MIPS R4400 CPU" }, |
320 | | | 320 | |
321 | { 0, MIPS_R3LSI, -1, -1, CPU_ARCH_MIPS1, -1, | | 321 | { 0, MIPS_R3LSI, -1, -1, CPU_ARCH_MIPS1, -1, |
322 | MIPS_NOT_SUPP, 0, 0, "LSI Logic R3000 derivative" }, | | 322 | MIPS_NOT_SUPP, 0, 0, "LSI Logic R3000 derivative" }, |
323 | { 0, MIPS_R6000A, -1, -1, CPU_ARCH_MIPS2, 32, | | 323 | { 0, MIPS_R6000A, -1, -1, CPU_ARCH_MIPS2, 32, |
324 | MIPS_NOT_SUPP, 0, 0, "MIPS R6000A CPU" }, | | 324 | MIPS_NOT_SUPP, 0, 0, "MIPS R6000A CPU" }, |
325 | { 0, MIPS_R3IDT, -1, -1, CPU_ARCH_MIPS1, -1, | | 325 | { 0, MIPS_R3IDT, -1, -1, CPU_ARCH_MIPS1, -1, |
326 | MIPS_NOT_SUPP, 0, 0, "IDT R3041 or RC36100 CPU" }, | | 326 | MIPS_NOT_SUPP, 0, 0, "IDT R3041 or RC36100 CPU" }, |
327 | { 0, MIPS_R4100, -1, -1, CPU_ARCH_MIPS3, 32, | | 327 | { 0, MIPS_R4100, -1, -1, CPU_ARCH_MIPS3, 32, |
328 | CPU_MIPS_R4K_MMU | CPU_MIPS_NO_LLSC, 0, 0, | | 328 | CPU_MIPS_R4K_MMU | CPU_MIPS_NO_LLSC, 0, 0, |
329 | "NEC VR4100 CPU" }, | | 329 | "NEC VR4100 CPU" }, |
330 | { 0, MIPS_R4200, -1, -1, CPU_ARCH_MIPS3, -1, | | 330 | { 0, MIPS_R4200, -1, -1, CPU_ARCH_MIPS3, -1, |
331 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, | | 331 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, |
332 | "NEC VR4200 CPU" }, | | 332 | "NEC VR4200 CPU" }, |
333 | { 0, MIPS_R4300, -1, -1, CPU_ARCH_MIPS3, 32, | | 333 | { 0, MIPS_R4300, -1, -1, CPU_ARCH_MIPS3, 32, |
334 | CPU_MIPS_R4K_MMU, 0, 0, "NEC VR4300 CPU" }, | | 334 | CPU_MIPS_R4K_MMU, 0, 0, "NEC VR4300 CPU" }, |
335 | { 0, MIPS_R4600, -1, -1, CPU_ARCH_MIPS3, 48, | | 335 | { 0, MIPS_R4600, -1, -1, CPU_ARCH_MIPS3, 48, |
336 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 336 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
337 | "QED R4600 Orion CPU" }, | | 337 | "QED R4600 Orion CPU" }, |
338 | { 0, MIPS_R4700, -1, -1, CPU_ARCH_MIPS3, 48, | | 338 | { 0, MIPS_R4700, -1, -1, CPU_ARCH_MIPS3, 48, |
339 | CPU_MIPS_R4K_MMU, 0, 0, "QED R4700 Orion CPU" }, | | 339 | CPU_MIPS_R4K_MMU, 0, 0, "QED R4700 Orion CPU" }, |
340 | | | 340 | |
341 | { 0, MIPS_R8000, -1, -1, CPU_ARCH_MIPS4, 384, | | 341 | { 0, MIPS_R8000, -1, -1, CPU_ARCH_MIPS4, 384, |
342 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, | | 342 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, |
343 | "MIPS R8000 Blackbird/TFP CPU" }, | | 343 | "MIPS R8000 Blackbird/TFP CPU" }, |
344 | { 0, MIPS_R10000, -1, -1, CPU_ARCH_MIPS4, 64, | | 344 | { 0, MIPS_R10000, -1, -1, CPU_ARCH_MIPS4, 64, |
345 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 345 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
346 | "MIPS R10000 CPU" }, | | 346 | "MIPS R10000 CPU" }, |
347 | { 0, MIPS_R12000, -1, -1, CPU_ARCH_MIPS4, 64, | | 347 | { 0, MIPS_R12000, -1, -1, CPU_ARCH_MIPS4, 64, |
348 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 348 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
349 | "MIPS R12000 CPU" }, | | 349 | "MIPS R12000 CPU" }, |
350 | { 0, MIPS_R14000, -1, -1, CPU_ARCH_MIPS4, 64, | | 350 | { 0, MIPS_R14000, -1, -1, CPU_ARCH_MIPS4, 64, |
351 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 351 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
352 | "MIPS R14000 CPU" }, | | 352 | "MIPS R14000 CPU" }, |
353 | | | 353 | |
354 | /* XXX | | 354 | /* XXX |
355 | * If the Processor Revision ID of the 4650 isn't 0, the following | | 355 | * If the Processor Revision ID of the 4650 isn't 0, the following |
356 | * entry needs to be adjusted. Can't use a wildcard match because | | 356 | * entry needs to be adjusted. Can't use a wildcard match because |
357 | * the TX39 series processors share the same Processor ID value. | | 357 | * the TX39 series processors share the same Processor ID value. |
358 | * Or maybe put TX39 CPUs first if the revid doesn't overlap with | | 358 | * Or maybe put TX39 CPUs first if the revid doesn't overlap with |
359 | * the 4650... | | 359 | * the 4650... |
360 | */ | | 360 | */ |
361 | { 0, MIPS_R4650, 0, -1, CPU_ARCH_MIPS3, -1, | | 361 | { 0, MIPS_R4650, 0, -1, CPU_ARCH_MIPS3, -1, |
362 | MIPS_NOT_SUPP /* no MMU! */, 0, 0, "QED R4650 CPU" }, | | 362 | MIPS_NOT_SUPP /* no MMU! */, 0, 0, "QED R4650 CPU" }, |
363 | { 0, MIPS_TX3900, MIPS_REV_TX3912, -1, CPU_ARCH_MIPS1, 32, | | 363 | { 0, MIPS_TX3900, MIPS_REV_TX3912, -1, CPU_ARCH_MIPS1, 32, |
364 | CPU_MIPS_NO_LLSC, 0, 0, "Toshiba TX3912 CPU" }, | | 364 | CPU_MIPS_NO_LLSC, 0, 0, "Toshiba TX3912 CPU" }, |
365 | { 0, MIPS_TX3900, MIPS_REV_TX3922, -1, CPU_ARCH_MIPS1, 64, | | 365 | { 0, MIPS_TX3900, MIPS_REV_TX3922, -1, CPU_ARCH_MIPS1, 64, |
366 | CPU_MIPS_NO_LLSC, 0, 0, "Toshiba TX3922 CPU" }, | | 366 | CPU_MIPS_NO_LLSC, 0, 0, "Toshiba TX3922 CPU" }, |
367 | { 0, MIPS_TX3900, MIPS_REV_TX3927, -1, CPU_ARCH_MIPS1, 64, | | 367 | { 0, MIPS_TX3900, MIPS_REV_TX3927, -1, CPU_ARCH_MIPS1, 64, |
368 | CPU_MIPS_NO_LLSC, 0, 0, "Toshiba TX3927 CPU" }, | | 368 | CPU_MIPS_NO_LLSC, 0, 0, "Toshiba TX3927 CPU" }, |
369 | { 0, MIPS_R5000, -1, -1, CPU_ARCH_MIPS4, 48, | | 369 | { 0, MIPS_R5000, -1, -1, CPU_ARCH_MIPS4, 48, |
370 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 370 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
371 | "MIPS R5000 CPU" }, | | 371 | "MIPS R5000 CPU" }, |
372 | { 0, MIPS_RM5200, -1, -1, CPU_ARCH_MIPS4, 48, | | 372 | { 0, MIPS_RM5200, -1, -1, CPU_ARCH_MIPS4, 48, |
373 | CPU_MIPS_R4K_MMU | CPU_MIPS_CAUSE_IV | CPU_MIPS_DOUBLE_COUNT | | | 373 | CPU_MIPS_R4K_MMU | CPU_MIPS_CAUSE_IV | CPU_MIPS_DOUBLE_COUNT | |
374 | CPU_MIPS_USE_WAIT, 0, 0, "QED RM5200 CPU" }, | | 374 | CPU_MIPS_USE_WAIT, 0, 0, "QED RM5200 CPU" }, |
375 | | | 375 | |
376 | /* XXX | | 376 | /* XXX |
377 | * The rm7000 rev 2.0 can have 64 tlbs, and has 6 extra interrupts. See | | 377 | * The rm7000 rev 2.0 can have 64 tlbs, and has 6 extra interrupts. See |
378 | * "Migrating to the RM7000 from other MIPS Microprocessors" | | 378 | * "Migrating to the RM7000 from other MIPS Microprocessors" |
379 | * for more details. | | 379 | * for more details. |
380 | */ | | 380 | */ |
381 | { 0, MIPS_RM7000, -1, -1, CPU_ARCH_MIPS4, 48, | | 381 | { 0, MIPS_RM7000, -1, -1, CPU_ARCH_MIPS4, 48, |
382 | MIPS_NOT_SUPP | CPU_MIPS_CAUSE_IV | CPU_MIPS_DOUBLE_COUNT | | | 382 | MIPS_NOT_SUPP | CPU_MIPS_CAUSE_IV | CPU_MIPS_DOUBLE_COUNT | |
383 | CPU_MIPS_USE_WAIT, 0, 0, "QED RM7000 CPU" }, | | 383 | CPU_MIPS_USE_WAIT, 0, 0, "QED RM7000 CPU" }, |
384 | | | 384 | |
385 | /* | | 385 | /* |
386 | * IDT RC32300 core is a 32 bit MIPS2 processor with | | 386 | * IDT RC32300 core is a 32 bit MIPS2 processor with |
387 | * MIPS3/MIPS4 extensions. It has an R4000-style TLB, | | 387 | * MIPS3/MIPS4 extensions. It has an R4000-style TLB, |
388 | * while all registers are 32 bits and any 64 bit | | 388 | * while all registers are 32 bits and any 64 bit |
389 | * instructions like ld/sd/dmfc0/dmtc0 are not allowed. | | 389 | * instructions like ld/sd/dmfc0/dmtc0 are not allowed. |
390 | * | | 390 | * |
391 | * note that the Config register has a non-standard base | | 391 | * note that the Config register has a non-standard base |
392 | * for IC and DC (2^9 instead of 2^12). | | 392 | * for IC and DC (2^9 instead of 2^12). |
393 | * | | 393 | * |
394 | */ | | 394 | */ |
395 | { 0, MIPS_RC32300, -1, -1, CPU_ARCH_MIPS3, 16, | | 395 | { 0, MIPS_RC32300, -1, -1, CPU_ARCH_MIPS3, 16, |
396 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, | | 396 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, |
397 | "IDT RC32300 CPU" }, | | 397 | "IDT RC32300 CPU" }, |
398 | { 0, MIPS_RC32364, -1, -1, CPU_ARCH_MIPS3, 16, | | 398 | { 0, MIPS_RC32364, -1, -1, CPU_ARCH_MIPS3, 16, |
399 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, | | 399 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, |
400 | "IDT RC32364 CPU" }, | | 400 | "IDT RC32364 CPU" }, |
401 | { 0, MIPS_RC64470, -1, -1, CPU_ARCH_MIPSx, -1, | | 401 | { 0, MIPS_RC64470, -1, -1, CPU_ARCH_MIPSx, -1, |
402 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, | | 402 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, |
403 | "IDT RC64474/RC64475 CPU" }, | | 403 | "IDT RC64474/RC64475 CPU" }, |
404 | | | 404 | |
405 | { 0, MIPS_R5400, -1, -1, CPU_ARCH_MIPSx, -1, | | 405 | { 0, MIPS_R5400, -1, -1, CPU_ARCH_MIPSx, -1, |
406 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, | | 406 | MIPS_NOT_SUPP | CPU_MIPS_R4K_MMU, 0, 0, |
407 | "NEC VR5400 CPU" }, | | 407 | "NEC VR5400 CPU" }, |
408 | { 0, MIPS_R5900, -1, -1, CPU_ARCH_MIPS3, 48, | | 408 | { 0, MIPS_R5900, -1, -1, CPU_ARCH_MIPS3, 48, |
409 | CPU_MIPS_NO_LLSC | CPU_MIPS_R4K_MMU, 0, 0, | | 409 | CPU_MIPS_NO_LLSC | CPU_MIPS_R4K_MMU, 0, 0, |
410 | "Toshiba R5900 CPU" }, | | 410 | "Toshiba R5900 CPU" }, |
411 | | | 411 | |
412 | { 0, MIPS_TX4900, MIPS_REV_TX4927, -1, CPU_ARCH_MIPS3, 48, | | 412 | { 0, MIPS_TX4900, MIPS_REV_TX4927, -1, CPU_ARCH_MIPS3, 48, |
413 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 413 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
414 | "Toshiba TX4927 CPU" }, | | 414 | "Toshiba TX4927 CPU" }, |
415 | | | 415 | |
416 | { 0, MIPS_TX4900, -1, -1, CPU_ARCH_MIPS3, 48, | | 416 | { 0, MIPS_TX4900, -1, -1, CPU_ARCH_MIPS3, 48, |
417 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, | | 417 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0, |
418 | "Toshiba TX4900 CPU" }, | | 418 | "Toshiba TX4900 CPU" }, |
419 | | | 419 | |
420 | /* | | 420 | /* |
421 | * ICT Loongson2 is a MIPS64 CPU with a few quirks. For some reason | | 421 | * ICT Loongson2 is a MIPS64 CPU with a few quirks. For some reason |
422 | * the virtual aliases present with 4KB pages make the caches misbehave | | 422 | * the virtual aliases present with 4KB pages make the caches misbehave |
423 | * so we make all accesses uncached. With 16KB pages, no virtual | | 423 | * so we make all accesses uncached. With 16KB pages, no virtual |
424 | * aliases are possible so we can use caching. | | 424 | * aliases are possible so we can use caching. |
425 | */ | | 425 | */ |
426 | #ifdef ENABLE_MIPS_16KB_PAGE | | 426 | #ifdef ENABLE_MIPS_16KB_PAGE |
427 | #define MIPS_LOONGSON2_CCA 0 | | 427 | #define MIPS_LOONGSON2_CCA 0 |
428 | #else | | 428 | #else |
429 | #define MIPS_LOONGSON2_CCA (CPU_MIPS_HAVE_SPECIAL_CCA | \ | | 429 | #define MIPS_LOONGSON2_CCA (CPU_MIPS_HAVE_SPECIAL_CCA | \ |
430 | (2 << CPU_MIPS_CACHED_CCA_SHIFT)) | | 430 | (2 << CPU_MIPS_CACHED_CCA_SHIFT)) |
431 | #endif | | 431 | #endif |
432 | { 0, MIPS_LOONGSON2, MIPS_REV_LOONGSON2E, -1, CPU_ARCH_MIPS3, 64, | | 432 | { 0, MIPS_LOONGSON2, MIPS_REV_LOONGSON2E, -1, CPU_ARCH_MIPS3, 64, |
433 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT | CPU_MIPS_LOONGSON2 | | 433 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT | CPU_MIPS_LOONGSON2 |
434 | | MIPS_LOONGSON2_CCA, 0, 0, "ICT Loongson 2E CPU" }, | | 434 | | MIPS_LOONGSON2_CCA, 0, 0, "ICT Loongson 2E CPU" }, |
435 | { 0, MIPS_LOONGSON2, MIPS_REV_LOONGSON2F, -1, CPU_ARCH_MIPS3, 64, | | 435 | { 0, MIPS_LOONGSON2, MIPS_REV_LOONGSON2F, -1, CPU_ARCH_MIPS3, 64, |
436 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT | CPU_MIPS_LOONGSON2 | | 436 | CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT | CPU_MIPS_LOONGSON2 |
437 | | MIPS_LOONGSON2_CCA, 0, 0, "ICT Loongson 2F CPU" }, | | 437 | | MIPS_LOONGSON2_CCA, 0, 0, "ICT Loongson 2F CPU" }, |
438 | | | 438 | |
439 | #if 0 /* ID collisions : can we use a CU1 test or similar? */ | | 439 | #if 0 /* ID collisions : can we use a CU1 test or similar? */ |
440 | { 0, MIPS_R3SONY, -1, -1, CPU_ARCH_MIPS1, -1, | | 440 | { 0, MIPS_R3SONY, -1, -1, CPU_ARCH_MIPS1, -1, |
441 | MIPS_NOT_SUPP, 0, 0, "SONY R3000 derivative" }, /* 0x21; crash R4700? */ | | 441 | MIPS_NOT_SUPP, 0, 0, "SONY R3000 derivative" }, /* 0x21; crash R4700? */ |
442 | { 0, MIPS_R3NKK, -1, -1, CPU_ARCH_MIPS1, -1, | | 442 | { 0, MIPS_R3NKK, -1, -1, CPU_ARCH_MIPS1, -1, |
443 | MIPS_NOT_SUPP, 0, 0, "NKK R3000 derivative" }, /* 0x23; crash R5000? */ | | 443 | MIPS_NOT_SUPP, 0, 0, "NKK R3000 derivative" }, /* 0x23; crash R5000? */ |
444 | #endif | | 444 | #endif |
445 | | | 445 | |
446 | { MIPS_PRID_CID_MTI, MIPS_4Kc, -1, -1, -1, 0, | | 446 | { MIPS_PRID_CID_MTI, MIPS_4Kc, -1, -1, -1, 0, |
447 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4Kc" }, | | 447 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4Kc" }, |
448 | { MIPS_PRID_CID_MTI, MIPS_4KEc, -1, -1, -1, 0, | | 448 | { MIPS_PRID_CID_MTI, MIPS_4KEc, -1, -1, -1, 0, |
449 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4KEc" }, | | 449 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4KEc" }, |
450 | { MIPS_PRID_CID_MTI, MIPS_4KEc_R2, -1, -1, -1, 0, | | 450 | { MIPS_PRID_CID_MTI, MIPS_4KEc_R2, -1, -1, -1, 0, |
451 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4KEc (Rev 2)" }, | | 451 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4KEc (Rev 2)" }, |
452 | { MIPS_PRID_CID_MTI, MIPS_4KSc, -1, -1, -1, 0, | | 452 | { MIPS_PRID_CID_MTI, MIPS_4KSc, -1, -1, -1, 0, |
453 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4KSc" }, | | 453 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "4KSc" }, |
454 | { MIPS_PRID_CID_MTI, MIPS_5Kc, -1, -1, -1, 0, | | 454 | { MIPS_PRID_CID_MTI, MIPS_5Kc, -1, -1, -1, 0, |
455 | MIPS64_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "5Kc" }, | | 455 | MIPS64_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "5Kc" }, |
456 | { MIPS_PRID_CID_MTI, MIPS_20Kc, -1, -1, -1, 0, | | 456 | { MIPS_PRID_CID_MTI, MIPS_20Kc, -1, -1, -1, 0, |
457 | MIPS64_FLAGS, 0, 0, "20Kc" }, | | 457 | MIPS64_FLAGS, 0, 0, "20Kc" }, |
458 | { MIPS_PRID_CID_MTI, MIPS_24K, -1, -1, -1, 0, | | 458 | { MIPS_PRID_CID_MTI, MIPS_24K, -1, -1, -1, 0, |
459 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, | | 459 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, |
460 | MIPS_CP0FL_USE | | | 460 | MIPS_CP0FL_USE | |
461 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | | | 461 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | |
462 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | | | 462 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | |
463 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG7, | | 463 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG7, |
464 | 0, "24K" }, | | 464 | 0, "24K" }, |
465 | { MIPS_PRID_CID_MTI, MIPS_24KE, -1, -1, -1, 0, | | 465 | { MIPS_PRID_CID_MTI, MIPS_24KE, -1, -1, -1, 0, |
466 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, | | 466 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, |
467 | MIPS_CP0FL_USE | | | 467 | MIPS_CP0FL_USE | |
468 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | | | 468 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | |
469 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | | | 469 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | |
470 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG7, | | 470 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG7, |
471 | 0, "24KE" }, | | 471 | 0, "24KE" }, |
472 | { MIPS_PRID_CID_MTI, MIPS_34K, -1, -1, -1, 0, | | 472 | { MIPS_PRID_CID_MTI, MIPS_34K, -1, -1, -1, 0, |
473 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, | | 473 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, |
474 | MIPS_CP0FL_USE | | | 474 | MIPS_CP0FL_USE | |
475 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | | | 475 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | |
476 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | | | 476 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | |
477 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG7, | | 477 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG7, |
478 | 0, "34K" }, | | 478 | 0, "34K" }, |
479 | { MIPS_PRID_CID_MTI, MIPS_74K, -1, -1, -1, 0, | | 479 | { MIPS_PRID_CID_MTI, MIPS_74K, -1, -1, -1, 0, |
480 | CPU_MIPS_HAVE_SPECIAL_CCA | (0 << CPU_MIPS_CACHED_CCA_SHIFT) | | | 480 | CPU_MIPS_HAVE_SPECIAL_CCA | (0 << CPU_MIPS_CACHED_CCA_SHIFT) | |
481 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, | | 481 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, |
482 | MIPS_CP0FL_USE | | | 482 | MIPS_CP0FL_USE | |
483 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | | | 483 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | |
484 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | | | 484 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | |
485 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7, | | 485 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7, |
486 | 0, "74K" }, | | 486 | 0, "74K" }, |
487 | { MIPS_PRID_CID_MTI, MIPS_1004K, -1, -1, -1, 0, | | 487 | { MIPS_PRID_CID_MTI, MIPS_1004K, -1, -1, -1, 0, |
488 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, | | 488 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, |
489 | MIPS_CP0FL_USE | | | 489 | MIPS_CP0FL_USE | |
490 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | | | 490 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | |
491 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | | | 491 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | |
492 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7, | | 492 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7, |
493 | 0, "1004K" }, | | 493 | 0, "1004K" }, |
494 | { MIPS_PRID_CID_MTI, MIPS_1074K, -1, -1, -1, 0, | | 494 | { MIPS_PRID_CID_MTI, MIPS_1074K, -1, -1, -1, 0, |
495 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, | | 495 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, |
496 | MIPS_CP0FL_USE | | | 496 | MIPS_CP0FL_USE | |
497 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | | | 497 | MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA | |
498 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | | | 498 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | |
499 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7, | | 499 | MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7, |
500 | 0, "1074K" }, | | 500 | 0, "1074K" }, |
501 | | | 501 | |
502 | { MIPS_PRID_CID_BROADCOM, MIPS_BCM3302, -1, -1, -1, 0, | | 502 | { MIPS_PRID_CID_BROADCOM, MIPS_BCM3302, -1, -1, -1, 0, |
503 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "BCM3302" }, | | 503 | MIPS32_FLAGS | CPU_MIPS_DOUBLE_COUNT, 0, 0, "BCM3302" }, |
504 | | | 504 | |
505 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV1, -1, MIPS_AU1000, -1, 0, | | 505 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV1, -1, MIPS_AU1000, -1, 0, |
506 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 506 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
507 | "Au1000 (Rev 1 core)" }, | | 507 | "Au1000 (Rev 1 core)" }, |
508 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1000, -1, 0, | | 508 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1000, -1, 0, |
509 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 509 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
510 | "Au1000 (Rev 2 core)" }, | | 510 | "Au1000 (Rev 2 core)" }, |
511 | | | 511 | |
512 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV1, -1, MIPS_AU1100, -1, 0, | | 512 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV1, -1, MIPS_AU1100, -1, 0, |
513 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 513 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
514 | "Au1100 (Rev 1 core)" }, | | 514 | "Au1100 (Rev 1 core)" }, |
515 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1100, -1, 0, | | 515 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1100, -1, 0, |
516 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 516 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
517 | "Au1100 (Rev 2 core)" }, | | 517 | "Au1100 (Rev 2 core)" }, |
518 | | | 518 | |
519 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV1, -1, MIPS_AU1500, -1, 0, | | 519 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV1, -1, MIPS_AU1500, -1, 0, |
520 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 520 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
521 | "Au1500 (Rev 1 core)" }, | | 521 | "Au1500 (Rev 1 core)" }, |
522 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1500, -1, 0, | | 522 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1500, -1, 0, |
523 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 523 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
524 | "Au1500 (Rev 2 core)" }, | | 524 | "Au1500 (Rev 2 core)" }, |
525 | | | 525 | |
526 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1550, -1, 0, | | 526 | { MIPS_PRID_CID_ALCHEMY, MIPS_AU_REV2, -1, MIPS_AU1550, -1, 0, |
527 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, | | 527 | MIPS32_FLAGS | CPU_MIPS_NO_WAIT | CPU_MIPS_I_D_CACHE_COHERENT, 0, 0, |
528 | "Au1550 (Rev 2 core)" }, | | 528 | "Au1550 (Rev 2 core)" }, |
529 | | | 529 | |
530 | /* The SB-1 CPU uses a CCA of 5 - "Cacheable Coherent Shareable" */ | | 530 | /* The SB-1 CPU uses a CCA of 5 - "Cacheable Coherent Shareable" */ |
531 | { MIPS_PRID_CID_SIBYTE, MIPS_SB1, -1, -1, -1, 0, | | 531 | { MIPS_PRID_CID_SIBYTE, MIPS_SB1, -1, -1, -1, 0, |
532 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | | | 532 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | |
533 | CPU_MIPS_HAVE_SPECIAL_CCA | (5 << CPU_MIPS_CACHED_CCA_SHIFT), 0, 0, | | 533 | CPU_MIPS_HAVE_SPECIAL_CCA | (5 << CPU_MIPS_CACHED_CCA_SHIFT), 0, 0, |
534 | "SB-1" }, | | 534 | "SB-1" }, |
535 | | | 535 | |
536 | { MIPS_PRID_CID_RMI, MIPS_XLR732B, -1, -1, -1, 0, | | 536 | { MIPS_PRID_CID_RMI, MIPS_XLR732B, -1, -1, -1, 0, |
537 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 537 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
538 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 538 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
539 | MIPS_CP0FL_USE | | | 539 | MIPS_CP0FL_USE | |
540 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 540 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
541 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 541 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
542 | CIDFL_RMI_TYPE_XLR|MIPS_CIDFL_RMI_CPUS(8,4)|MIPS_CIDFL_RMI_L2(2MB), | | 542 | CIDFL_RMI_TYPE_XLR|MIPS_CIDFL_RMI_CPUS(8,4)|MIPS_CIDFL_RMI_L2(2MB), |
543 | "XLR732B" }, | | 543 | "XLR732B" }, |
544 | | | 544 | |
545 | { MIPS_PRID_CID_RMI, MIPS_XLR732C, -1, -1, -1, 0, | | 545 | { MIPS_PRID_CID_RMI, MIPS_XLR732C, -1, -1, -1, 0, |
546 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 546 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
547 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 547 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
548 | MIPS_CP0FL_USE | | | 548 | MIPS_CP0FL_USE | |
549 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 549 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
550 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 550 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
551 | CIDFL_RMI_TYPE_XLR|MIPS_CIDFL_RMI_CPUS(8,4)|MIPS_CIDFL_RMI_L2(2MB), | | 551 | CIDFL_RMI_TYPE_XLR|MIPS_CIDFL_RMI_CPUS(8,4)|MIPS_CIDFL_RMI_L2(2MB), |
552 | "XLR732C" }, | | 552 | "XLR732C" }, |
553 | | | 553 | |
554 | { MIPS_PRID_CID_RMI, MIPS_XLS616, -1, -1, -1, 0, | | 554 | { MIPS_PRID_CID_RMI, MIPS_XLS616, -1, -1, -1, 0, |
555 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 555 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
556 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 556 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
557 | MIPS_CP0FL_USE | | | 557 | MIPS_CP0FL_USE | |
558 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 558 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
559 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 559 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
560 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(4,4)|MIPS_CIDFL_RMI_L2(1MB), | | 560 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(4,4)|MIPS_CIDFL_RMI_L2(1MB), |
561 | "XLS616" }, | | 561 | "XLS616" }, |
562 | | | 562 | |
563 | { MIPS_PRID_CID_RMI, MIPS_XLS416, -1, -1, -1, 0, | | 563 | { MIPS_PRID_CID_RMI, MIPS_XLS416, -1, -1, -1, 0, |
564 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 564 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
565 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 565 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
566 | MIPS_CP0FL_USE | | | 566 | MIPS_CP0FL_USE | |
567 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 567 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
568 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 568 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
569 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(4,4)|MIPS_CIDFL_RMI_L2(1MB), | | 569 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(4,4)|MIPS_CIDFL_RMI_L2(1MB), |
570 | "XLS416" }, | | 570 | "XLS416" }, |
571 | | | 571 | |
572 | { MIPS_PRID_CID_RMI, MIPS_XLS408, -1, -1, -1, 0, | | 572 | { MIPS_PRID_CID_RMI, MIPS_XLS408, -1, -1, -1, 0, |
573 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 573 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
574 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 574 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
575 | MIPS_CP0FL_USE | | | 575 | MIPS_CP0FL_USE | |
576 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 576 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
577 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 577 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
578 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(1MB), | | 578 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(1MB), |
579 | "XLS408" }, | | 579 | "XLS408" }, |
580 | | | 580 | |
581 | { MIPS_PRID_CID_RMI, MIPS_XLS408LITE, -1, -1, -1, 0, | | 581 | { MIPS_PRID_CID_RMI, MIPS_XLS408LITE, -1, -1, -1, 0, |
582 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 582 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
583 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 583 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
584 | MIPS_CP0FL_USE | | | 584 | MIPS_CP0FL_USE | |
585 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 585 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
586 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 586 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
587 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(1MB), | | 587 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(1MB), |
588 | "XLS408lite" }, | | 588 | "XLS408lite" }, |
589 | | | 589 | |
590 | { MIPS_PRID_CID_RMI, MIPS_XLS404LITE, -1, -1, -1, 0, | | 590 | { MIPS_PRID_CID_RMI, MIPS_XLS404LITE, -1, -1, -1, 0, |
591 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 591 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
592 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 592 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
593 | MIPS_CP0FL_USE | | | 593 | MIPS_CP0FL_USE | |
594 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 594 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
595 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 595 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
596 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(512KB), | | 596 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(512KB), |
597 | "XLS404lite" }, | | 597 | "XLS404lite" }, |
598 | | | 598 | |
599 | { MIPS_PRID_CID_RMI, MIPS_XLS208, -1, -1, -1, 0, | | 599 | { MIPS_PRID_CID_RMI, MIPS_XLS208, -1, -1, -1, 0, |
600 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 600 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
601 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 601 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
602 | MIPS_CP0FL_USE | | | 602 | MIPS_CP0FL_USE | |
603 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 603 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
604 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 604 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
605 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(512KB), | | 605 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(512KB), |
606 | "XLS208" }, | | 606 | "XLS208" }, |
607 | | | 607 | |
608 | { MIPS_PRID_CID_RMI, MIPS_XLS204, -1, -1, -1, 0, | | 608 | { MIPS_PRID_CID_RMI, MIPS_XLS204, -1, -1, -1, 0, |
609 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 609 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
610 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 610 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
611 | MIPS_CP0FL_USE | | | 611 | MIPS_CP0FL_USE | |
612 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 612 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
613 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 613 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
614 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(256KB), | | 614 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(256KB), |
615 | "XLS204" }, | | 615 | "XLS204" }, |
616 | | | 616 | |
617 | { MIPS_PRID_CID_RMI, MIPS_XLS108, -1, -1, -1, 0, | | 617 | { MIPS_PRID_CID_RMI, MIPS_XLS108, -1, -1, -1, 0, |
618 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 618 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
619 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 619 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
620 | MIPS_CP0FL_USE | | | 620 | MIPS_CP0FL_USE | |
621 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 621 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
622 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 622 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
623 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(512KB), | | 623 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(2,4)|MIPS_CIDFL_RMI_L2(512KB), |
624 | "XLS108" }, | | 624 | "XLS108" }, |
625 | | | 625 | |
626 | { MIPS_PRID_CID_RMI, MIPS_XLS104, -1, -1, -1, 0, | | 626 | { MIPS_PRID_CID_RMI, MIPS_XLS104, -1, -1, -1, 0, |
627 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | | | 627 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR | |
628 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, | | 628 | CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR, |
629 | MIPS_CP0FL_USE | | | 629 | MIPS_CP0FL_USE | |
630 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | | | 630 | MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR | MIPS_CP0FL_EBASE | |
631 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, | | 631 | MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG7, |
632 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(256KB), | | 632 | CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(256KB), |
633 | "XLS104" }, | | 633 | "XLS104" }, |
634 | | | 634 | |
635 | { MIPS_PRID_CID_CAVIUM, MIPS_CN31XX, -1, -1, -1, 0, | | 635 | { MIPS_PRID_CID_CAVIUM, MIPS_CN31XX, -1, -1, -1, 0, |
636 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR, | | 636 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR, |
637 | MIPS_CP0FL_USE | | | 637 | MIPS_CP0FL_USE | |
638 | MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG | | | 638 | MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG | |
639 | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3, | | 639 | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3, |
640 | 0, | | 640 | 0, |
641 | "CN31xx" }, | | 641 | "CN31xx" }, |
642 | | | 642 | |
643 | { MIPS_PRID_CID_CAVIUM, MIPS_CN30XX, -1, -1, -1, 0, | | 643 | { MIPS_PRID_CID_CAVIUM, MIPS_CN30XX, -1, -1, -1, 0, |
644 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR, | | 644 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR, |
645 | MIPS_CP0FL_USE | | | 645 | MIPS_CP0FL_USE | |
646 | MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG | | | 646 | MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG | |
647 | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3, | | 647 | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3, |
648 | 0, | | 648 | 0, |
649 | "CN30xx" }, | | 649 | "CN30xx" }, |
650 | | | 650 | |
651 | { MIPS_PRID_CID_CAVIUM, MIPS_CN50XX, -1, -1, -1, 0, | | 651 | { MIPS_PRID_CID_CAVIUM, MIPS_CN50XX, -1, -1, -1, 0, |
652 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR, | | 652 | MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR, |
653 | MIPS_CP0FL_USE | | | 653 | MIPS_CP0FL_USE | |
654 | MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG | MIPS_CP0FL_HWRENA | | | 654 | MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG | MIPS_CP0FL_HWRENA | |
655 | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3, | | 655 | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3, |
656 | 0, | | 656 | 0, |
657 | "CN50xx" }, | | 657 | "CN50xx" }, |
658 | | | 658 | |
659 | /* Microsoft Research' extensible MIPS */ | | 659 | /* Microsoft Research' extensible MIPS */ |
660 | { MIPS_PRID_CID_MICROSOFT, MIPS_eMIPS, 1, -1, CPU_ARCH_MIPS1, 64, | | 660 | { MIPS_PRID_CID_MICROSOFT, MIPS_eMIPS, 1, -1, CPU_ARCH_MIPS1, 64, |
661 | CPU_MIPS_NO_WAIT, 0, 0, "eMIPS CPU" }, | | 661 | CPU_MIPS_NO_WAIT, 0, 0, "eMIPS CPU" }, |
662 | | | 662 | |
663 | /* Ingenic XBurst */ | | 663 | /* Ingenic XBurst */ |
664 | { MIPS_PRID_CID_INGENIC, MIPS_XBURST, -1, -1, -1, 0, | | 664 | { MIPS_PRID_CID_INGENIC, MIPS_XBURST, -1, -1, -1, 0, |
665 | MIPS32_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_DOUBLE_COUNT, | | 665 | MIPS32_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_DOUBLE_COUNT, |
666 | 0, 0, "XBurst" }, | | 666 | 0, 0, "XBurst" }, |
667 | | | 667 | |
668 | { 0, 0, 0, 0, 0, 0, | | 668 | { 0, 0, 0, 0, 0, 0, |
669 | 0, 0, 0, NULL } | | 669 | 0, 0, 0, NULL } |
670 | }; | | 670 | }; |
671 | | | 671 | |
672 | static const struct pridtab fputab[] = { | | 672 | static const struct pridtab fputab[] = { |
673 | { 0, MIPS_SOFT, -1, 0, 0, 0, 0, 0, 0, "software emulated floating point" }, | | 673 | { 0, MIPS_SOFT, -1, 0, 0, 0, 0, 0, 0, "software emulated floating point" }, |
674 | { 0, MIPS_R2360, -1, 0, 0, 0, 0, 0, 0, "MIPS R2360 Floating Point Board" }, | | 674 | { 0, MIPS_R2360, -1, 0, 0, 0, 0, 0, 0, "MIPS R2360 Floating Point Board" }, |
675 | { 0, MIPS_R2010, -1, 0, 0, 0, 0, 0, 0, "MIPS R2010 FPC" }, | | 675 | { 0, MIPS_R2010, -1, 0, 0, 0, 0, 0, 0, "MIPS R2010 FPC" }, |
676 | { 0, MIPS_R3010, -1, 0, 0, 0, 0, 0, 0, "MIPS R3010 FPC" }, | | 676 | { 0, MIPS_R3010, -1, 0, 0, 0, 0, 0, 0, "MIPS R3010 FPC" }, |
677 | { 0, MIPS_R6010, -1, 0, 0, 0, 0, 0, 0, "MIPS R6010 FPC" }, | | 677 | { 0, MIPS_R6010, -1, 0, 0, 0, 0, 0, 0, "MIPS R6010 FPC" }, |
678 | { 0, MIPS_R4010, -1, 0, 0, 0, 0, 0, 0, "MIPS R4010 FPC" }, | | 678 | { 0, MIPS_R4010, -1, 0, 0, 0, 0, 0, 0, "MIPS R4010 FPC" }, |
679 | }; | | 679 | }; |
680 | | | 680 | |
681 | /* | | 681 | /* |
682 | * Company ID's are not sparse (yet), this array is indexed directly | | 682 | * Company ID's are not sparse (yet), this array is indexed directly |
683 | * by pridtab->cpu_cid. | | 683 | * by pridtab->cpu_cid. |
684 | */ | | 684 | */ |
685 | static const char * const cidnames[] = { | | 685 | static const char * const cidnames[] = { |
686 | "Prehistoric", | | 686 | "Prehistoric", |
687 | "MIPS", /* or "MIPS Technologies, Inc. */ | | 687 | "MIPS", /* or "MIPS Technologies, Inc. */ |
688 | "Broadcom", /* or "Broadcom Corp." */ | | 688 | "Broadcom", /* or "Broadcom Corp." */ |
689 | "Alchemy", /* or "Alchemy Semiconductor" */ | | 689 | "Alchemy", /* or "Alchemy Semiconductor" */ |
690 | "SiByte", /* or "Broadcom Corp. (SiByte)" */ | | 690 | "SiByte", /* or "Broadcom Corp. (SiByte)" */ |
691 | "SandCraft", | | 691 | "SandCraft", |
692 | "Phillips", | | 692 | "Phillips", |
693 | "Toshiba or Microsoft", | | 693 | "Toshiba or Microsoft", |
694 | "LSI", | | 694 | "LSI", |
695 | "(unannounced)", | | 695 | "(unannounced)", |
696 | "(unannounced)", | | 696 | "(unannounced)", |
697 | "Lexra", | | 697 | "Lexra", |
698 | "RMI", | | 698 | "RMI", |
699 | "Cavium", | | 699 | "Cavium", |
700 | }; | | 700 | }; |
701 | #define ncidnames __arraycount(cidnames) | | 701 | #define ncidnames __arraycount(cidnames) |
702 | | | 702 | |
703 | #if defined(MIPS1) | | 703 | #if defined(MIPS1) |
704 | /* | | 704 | /* |
705 | * MIPS-I locore function vector | | 705 | * MIPS-I locore function vector |
706 | */ | | 706 | */ |
707 | | | 707 | |
708 | static void | | 708 | static void |
709 | mips1_vector_init(const struct splsw *splsw) | | 709 | mips1_vector_init(const struct splsw *splsw) |
710 | { | | 710 | { |
711 | extern char mips1_utlb_miss[], mips1_utlb_miss_end[]; | | 711 | extern char mips1_utlb_miss[], mips1_utlb_miss_end[]; |
712 | extern char mips1_exception[], mips1_exception_end[]; | | 712 | extern char mips1_exception[], mips1_exception_end[]; |
713 | | | 713 | |
714 | /* | | 714 | /* |
715 | * Copy down exception vector code. | | 715 | * Copy down exception vector code. |
716 | */ | | 716 | */ |
717 | if (mips1_utlb_miss_end - mips1_utlb_miss > 0x80) | | 717 | if (mips1_utlb_miss_end - mips1_utlb_miss > 0x80) |
718 | panic("startup: UTLB vector code too large"); | | 718 | panic("startup: UTLB vector code too large"); |
719 | if (mips1_exception_end - mips1_exception > 0x80) | | 719 | if (mips1_exception_end - mips1_exception > 0x80) |
720 | panic("startup: general exception vector code too large"); | | 720 | panic("startup: general exception vector code too large"); |
721 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips1_utlb_miss, | | 721 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips1_utlb_miss, |
722 | mips1_exception_end - mips1_utlb_miss); | | 722 | mips1_exception_end - mips1_utlb_miss); |
723 | | | 723 | |
724 | /* | | 724 | /* |
725 | * Copy locore-function vector. | | 725 | * Copy locore-function vector. |
726 | */ | | 726 | */ |
727 | mips_locore_jumpvec = mips1_locore_vec; | | 727 | mips_locore_jumpvec = mips1_locore_vec; |
728 | | | 728 | |
729 | /* | | 729 | /* |
730 | * Clear out the I and D caches. | | 730 | * Clear out the I and D caches. |
731 | */ | | 731 | */ |
732 | mips_icache_sync_all(); | | 732 | mips_icache_sync_all(); |
733 | mips_dcache_wbinv_all(); | | 733 | mips_dcache_wbinv_all(); |
734 | } | | 734 | } |
735 | #endif /* MIPS1 */ | | 735 | #endif /* MIPS1 */ |
736 | | | 736 | |
737 | #if defined(MIPS3) | | 737 | #if defined(MIPS3) |
738 | static void | | 738 | static void |
739 | mips3_vector_init(const struct splsw *splsw) | | 739 | mips3_vector_init(const struct splsw *splsw) |
740 | { | | 740 | { |
741 | /* r4000 exception handler address and end */ | | 741 | /* r4000 exception handler address and end */ |
742 | extern char mips3_exception[], mips3_exception_end[]; | | 742 | extern char mips3_exception[], mips3_exception_end[]; |
743 | | | 743 | |
744 | /* TLB miss handler address and end */ | | 744 | /* TLB miss handler address and end */ |
745 | extern char mips3_tlb_miss[]; | | 745 | extern char mips3_tlb_miss[]; |
746 | extern char mips3_xtlb_miss[]; | | 746 | extern char mips3_xtlb_miss[]; |
747 | | | 747 | |
748 | /* Cache error handler */ | | 748 | /* Cache error handler */ |
749 | extern char mips3_cache[]; | | 749 | extern char mips3_cache[]; |
750 | /* | | 750 | /* |
751 | * Copy down exception vector code. | | 751 | * Copy down exception vector code. |
752 | */ | | 752 | */ |
753 | | | 753 | |
754 | if (mips3_xtlb_miss - mips3_tlb_miss != 0x80) | | 754 | if (mips3_xtlb_miss - mips3_tlb_miss != 0x80) |
755 | panic("startup: %s vector code not 128 bytes in length", | | 755 | panic("startup: %s vector code not 128 bytes in length", |
756 | "UTLB"); | | 756 | "UTLB"); |
757 | if (mips3_cache - mips3_xtlb_miss != 0x80) | | 757 | if (mips3_cache - mips3_xtlb_miss != 0x80) |
758 | panic("startup: %s vector code not 128 bytes in length", | | 758 | panic("startup: %s vector code not 128 bytes in length", |
759 | "XTLB"); | | 759 | "XTLB"); |
760 | if (mips3_exception - mips3_cache != 0x80) | | 760 | if (mips3_exception - mips3_cache != 0x80) |
761 | panic("startup: %s vector code not 128 bytes in length", | | 761 | panic("startup: %s vector code not 128 bytes in length", |
762 | "Cache error"); | | 762 | "Cache error"); |
763 | if (mips3_exception_end - mips3_exception > 0x80) | | 763 | if (mips3_exception_end - mips3_exception > 0x80) |
764 | panic("startup: %s vector code too large", | | 764 | panic("startup: %s vector code too large", |
765 | "General exception"); | | 765 | "General exception"); |
766 | | | 766 | |
767 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips3_tlb_miss, | | 767 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips3_tlb_miss, |
768 | mips3_exception_end - mips3_tlb_miss); | | 768 | mips3_exception_end - mips3_tlb_miss); |
769 | | | 769 | |
770 | /* | | 770 | /* |
771 | * Copy locore-function vector. | | 771 | * Copy locore-function vector. |
772 | */ | | 772 | */ |
773 | mips_locore_jumpvec = mips3_locore_vec; | | 773 | mips_locore_jumpvec = mips3_locore_vec; |
774 | | | 774 | |
775 | mips_icache_sync_all(); | | 775 | mips_icache_sync_all(); |
776 | mips_dcache_wbinv_all(); | | 776 | mips_dcache_wbinv_all(); |
777 | | | 777 | |
778 | /* Clear BEV in SR so we start handling our own exceptions */ | | 778 | /* Clear BEV in SR so we start handling our own exceptions */ |
779 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); | | 779 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); |
780 | } | | 780 | } |
781 | #endif /* MIPS3 */ | | 781 | #endif /* MIPS3 */ |
782 | | | 782 | |
783 | #if defined(MIPS3_LOONGSON2) | | 783 | #if defined(MIPS3_LOONGSON2) |
784 | static void | | 784 | static void |
785 | loongson2_vector_init(const struct splsw *splsw) | | 785 | loongson2_vector_init(const struct splsw *splsw) |
786 | { | | 786 | { |
787 | /* r4000 exception handler address and end */ | | 787 | /* r4000 exception handler address and end */ |
788 | extern char loongson2_exception[], loongson2_exception_end[]; | | 788 | extern char loongson2_exception[], loongson2_exception_end[]; |
789 | | | 789 | |
790 | /* TLB miss handler address and end */ | | 790 | /* TLB miss handler address and end */ |
791 | extern char loongson2_tlb_miss[]; | | 791 | extern char loongson2_tlb_miss[]; |
792 | extern char loongson2_xtlb_miss[]; | | 792 | extern char loongson2_xtlb_miss[]; |
793 | | | 793 | |
794 | /* Cache error handler */ | | 794 | /* Cache error handler */ |
795 | extern char loongson2_cache[]; | | 795 | extern char loongson2_cache[]; |
796 | | | 796 | |
797 | /* | | 797 | /* |
798 | * Copy down exception vector code. | | 798 | * Copy down exception vector code. |
799 | */ | | 799 | */ |
800 | | | 800 | |
801 | if (loongson2_xtlb_miss - loongson2_tlb_miss != 0x80) | | 801 | if (loongson2_xtlb_miss - loongson2_tlb_miss != 0x80) |
802 | panic("startup: %s vector code not 128 bytes in length", | | 802 | panic("startup: %s vector code not 128 bytes in length", |
803 | "UTLB"); | | 803 | "UTLB"); |
804 | if (loongson2_cache - loongson2_xtlb_miss != 0x80) | | 804 | if (loongson2_cache - loongson2_xtlb_miss != 0x80) |
805 | panic("startup: %s vector code not 128 bytes in length", | | 805 | panic("startup: %s vector code not 128 bytes in length", |
806 | "XTLB"); | | 806 | "XTLB"); |
807 | if (loongson2_exception - loongson2_cache != 0x80) | | 807 | if (loongson2_exception - loongson2_cache != 0x80) |
808 | panic("startup: %s vector code not 128 bytes in length", | | 808 | panic("startup: %s vector code not 128 bytes in length", |
809 | "Cache error"); | | 809 | "Cache error"); |
810 | if (loongson2_exception_end - loongson2_exception > 0x80) | | 810 | if (loongson2_exception_end - loongson2_exception > 0x80) |
811 | panic("startup: %s vector code too large", | | 811 | panic("startup: %s vector code too large", |
812 | "General exception"); | | 812 | "General exception"); |
813 | | | 813 | |
814 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, loongson2_tlb_miss, | | 814 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, loongson2_tlb_miss, |
815 | loongson2_exception_end - loongson2_tlb_miss); | | 815 | loongson2_exception_end - loongson2_tlb_miss); |
816 | | | 816 | |
817 | /* | | 817 | /* |
818 | * Copy locore-function vector. | | 818 | * Copy locore-function vector. |
819 | */ | | 819 | */ |
820 | mips_locore_jumpvec = loongson2_locore_vec; | | 820 | mips_locore_jumpvec = loongson2_locore_vec; |
821 | | | 821 | |
822 | mips_icache_sync_all(); | | 822 | mips_icache_sync_all(); |
823 | mips_dcache_wbinv_all(); | | 823 | mips_dcache_wbinv_all(); |
824 | | | 824 | |
825 | /* Clear BEV in SR so we start handling our own exceptions */ | | 825 | /* Clear BEV in SR so we start handling our own exceptions */ |
826 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); | | 826 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); |
827 | } | | 827 | } |
828 | #endif /* MIPS3_LOONGSON2 */ | | 828 | #endif /* MIPS3_LOONGSON2 */ |
829 | | | 829 | |
830 | #if defined(MIPS32) | | 830 | #if defined(MIPS32) |
831 | static void | | 831 | static void |
832 | mips32_vector_init(const struct splsw *splsw) | | 832 | mips32_vector_init(const struct splsw *splsw) |
833 | { | | 833 | { |
834 | /* r4000 exception handler address */ | | 834 | /* r4000 exception handler address */ |
835 | extern char mips32_exception[]; | | 835 | extern char mips32_exception[]; |
836 | | | 836 | |
837 | /* TLB miss handler addresses */ | | 837 | /* TLB miss handler addresses */ |
838 | extern char mips32_tlb_miss[]; | | 838 | extern char mips32_tlb_miss[]; |
839 | | | 839 | |
840 | /* Cache error handler */ | | 840 | /* Cache error handler */ |
841 | extern char mips32_cache[]; | | 841 | extern char mips32_cache[]; |
842 | | | 842 | |
843 | /* MIPS32 interrupt exception handler */ | | 843 | /* MIPS32 interrupt exception handler */ |
844 | extern char mips32_intr[], mips32_intr_end[]; | | 844 | extern char mips32_intr[], mips32_intr_end[]; |
845 | | | 845 | |
846 | /* | | 846 | /* |
847 | * Copy down exception vector code. | | 847 | * Copy down exception vector code. |
848 | */ | | 848 | */ |
849 | | | 849 | |
850 | if (mips32_cache - mips32_tlb_miss != 0x100) | | 850 | if (mips32_cache - mips32_tlb_miss != 0x100) |
851 | panic("startup: %s vector code not 128 bytes in length", | | 851 | panic("startup: %s vector code not 128 bytes in length", |
852 | "UTLB"); | | 852 | "UTLB"); |
853 | if (mips32_exception - mips32_cache != 0x80) | | 853 | if (mips32_exception - mips32_cache != 0x80) |
854 | panic("startup: %s vector code not 128 bytes in length", | | 854 | panic("startup: %s vector code not 128 bytes in length", |
855 | "Cache error"); | | 855 | "Cache error"); |
856 | if (mips32_intr - mips32_exception != 0x80) | | 856 | if (mips32_intr - mips32_exception != 0x80) |
857 | panic("startup: %s vector code not 128 bytes in length", | | 857 | panic("startup: %s vector code not 128 bytes in length", |
858 | "General exception"); | | 858 | "General exception"); |
859 | if (mips32_intr_end - mips32_intr > 0x80) | | 859 | if (mips32_intr_end - mips32_intr > 0x80) |
860 | panic("startup: %s vector code too large", | | 860 | panic("startup: %s vector code too large", |
861 | "interrupt exception"); | | 861 | "interrupt exception"); |
862 | | | 862 | |
863 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips32_tlb_miss, | | 863 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips32_tlb_miss, |
864 | mips32_intr_end - mips32_tlb_miss); | | 864 | mips32_intr_end - mips32_tlb_miss); |
865 | | | 865 | |
866 | /* | | 866 | /* |
867 | * Copy locore-function vector. | | 867 | * Copy locore-function vector. |
868 | */ | | 868 | */ |
869 | mips_locore_jumpvec = mips32_locore_vec; | | 869 | mips_locore_jumpvec = mips32_locore_vec; |
870 | | | 870 | |
871 | mips_icache_sync_all(); | | 871 | mips_icache_sync_all(); |
872 | mips_dcache_wbinv_all(); | | 872 | mips_dcache_wbinv_all(); |
873 | | | 873 | |
874 | /* Clear BEV in SR so we start handling our own exceptions */ | | 874 | /* Clear BEV in SR so we start handling our own exceptions */ |
875 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); | | 875 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); |
876 | | | 876 | |
877 | mips_watchpoint_init(); | | 877 | mips_watchpoint_init(); |
878 | } | | 878 | } |
879 | #endif /* MIPS32 */ | | 879 | #endif /* MIPS32 */ |
880 | | | 880 | |
881 | #if defined(MIPS32R2) | | 881 | #if defined(MIPS32R2) |
882 | static void | | 882 | static void |
883 | mips32r2_vector_init(const struct splsw *splsw) | | 883 | mips32r2_vector_init(const struct splsw *splsw) |
884 | { | | 884 | { |
885 | /* r4000 exception handler address */ | | 885 | /* r4000 exception handler address */ |
886 | extern char mips32r2_exception[]; | | 886 | extern char mips32r2_exception[]; |
887 | | | 887 | |
888 | /* TLB miss handler addresses */ | | 888 | /* TLB miss handler addresses */ |
889 | extern char mips32r2_tlb_miss[]; | | 889 | extern char mips32r2_tlb_miss[]; |
890 | | | 890 | |
891 | /* Cache error handler */ | | 891 | /* Cache error handler */ |
892 | extern char mips32r2_cache[]; | | 892 | extern char mips32r2_cache[]; |
893 | | | 893 | |
894 | /* MIPS32 interrupt exception handler */ | | 894 | /* MIPS32 interrupt exception handler */ |
895 | extern char mips32r2_intr[], mips32r2_intr_end[]; | | 895 | extern char mips32r2_intr[], mips32r2_intr_end[]; |
896 | | | 896 | |
897 | /* | | 897 | /* |
898 | * Copy down exception vector code. | | 898 | * Copy down exception vector code. |
899 | */ | | 899 | */ |
900 | if (mips32r2_cache - mips32r2_tlb_miss != 0x100) | | 900 | if (mips32r2_cache - mips32r2_tlb_miss != 0x100) |
901 | panic("startup: %s vector code not 128 bytes in length", | | 901 | panic("startup: %s vector code not 128 bytes in length", |
902 | "UTLB"); | | 902 | "UTLB"); |
903 | if (mips32r2_exception - mips32r2_cache != 0x80) | | 903 | if (mips32r2_exception - mips32r2_cache != 0x80) |
904 | panic("startup: %s vector code not 128 bytes in length", | | 904 | panic("startup: %s vector code not 128 bytes in length", |
905 | "Cache error"); | | 905 | "Cache error"); |
906 | if (mips32r2_intr - mips32r2_exception != 0x80) | | 906 | if (mips32r2_intr - mips32r2_exception != 0x80) |
907 | panic("startup: %s vector code not 128 bytes in length", | | 907 | panic("startup: %s vector code not 128 bytes in length", |
908 | "General exception"); | | 908 | "General exception"); |
909 | if (mips32r2_intr_end - mips32r2_intr > 0x80) | | 909 | if (mips32r2_intr_end - mips32r2_intr > 0x80) |
910 | panic("startup: %s vector code too large", | | 910 | panic("startup: %s vector code too large", |
911 | "interrupt exception"); | | 911 | "interrupt exception"); |
912 | | | 912 | |
913 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips32r2_tlb_miss, | | 913 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips32r2_tlb_miss, |
914 | mips32r2_intr_end - mips32r2_tlb_miss); | | 914 | mips32r2_intr_end - mips32r2_tlb_miss); |
915 | | | 915 | |
916 | /* | | 916 | /* |
917 | * Let see if this cpu has DSP V2 ASE... | | 917 | * Let see if this cpu has DSP V2 ASE... |
918 | */ | | 918 | */ |
919 | uint32_t cp0flags = mips_options.mips_cpu->cpu_cp0flags; | | 919 | uint32_t cp0flags = mips_options.mips_cpu->cpu_cp0flags; |
920 | if (mipsNN_cp0_config2_read() & MIPSNN_CFG2_M) { | | 920 | if (mipsNN_cp0_config2_read() & MIPSNN_CFG2_M) { |
921 | const uint32_t cfg3 = mipsNN_cp0_config3_read(); | | 921 | const uint32_t cfg3 = mipsNN_cp0_config3_read(); |
922 | if (cfg3 & MIPSNN_CFG3_ULRP) { | | 922 | if (cfg3 & MIPSNN_CFG3_ULRP) { |
923 | cp0flags |= MIPS_CP0FL_USERLOCAL; | | 923 | cp0flags |= MIPS_CP0FL_USERLOCAL; |
924 | } | | 924 | } |
925 | if (cfg3 & MIPSNN_CFG3_DSP2P) { | | 925 | if (cfg3 & MIPSNN_CFG3_DSP2P) { |
926 | mips_options.mips_cpu_flags |= CPU_MIPS_HAVE_DSP; | | 926 | mips_options.mips_cpu_flags |= CPU_MIPS_HAVE_DSP; |
927 | } | | 927 | } |
928 | } | | 928 | } |
929 | /* | | 929 | /* |
930 | * If this CPU doesn't have a COP0 USERLOCAL register, at the end | | 930 | * If this CPU doesn't have a COP0 USERLOCAL register, at the end |
931 | * of cpu_switch resume overwrite the instructions which update it. | | 931 | * of cpu_switch resume overwrite the instructions which update it. |
932 | */ | | 932 | */ |
933 | if (!(cp0flags & MIPS_CP0FL_USERLOCAL)) { | | 933 | if (!(cp0flags & MIPS_CP0FL_USERLOCAL)) { |
934 | extern uint32_t mips32r2_cpu_switch_resume[]; | | 934 | extern uint32_t mips32r2_cpu_switch_resume[]; |
935 | for (uint32_t *insnp = mips32r2_cpu_switch_resume;; insnp++) { | | 935 | for (uint32_t *insnp = mips32r2_cpu_switch_resume;; insnp++) { |
936 | KASSERT(insnp[0] != JR_RA); | | 936 | KASSERT(insnp[0] != JR_RA); |
937 | if (insnp[0] == _LOAD_V0_L_PRIVATE_A0 | | 937 | if (insnp[0] == _LOAD_V0_L_PRIVATE_A0 |
938 | && insnp[1] == _MTC0_V0_USERLOCAL) { | | 938 | && insnp[1] == _MTC0_V0_USERLOCAL) { |
939 | insnp[0] = JR_RA; | | 939 | insnp[0] = JR_RA; |
940 | insnp[1] = 0; /* NOP */ | | 940 | insnp[1] = 0; /* NOP */ |
941 | break; | | 941 | break; |
942 | } | | 942 | } |
943 | } | | 943 | } |
944 | } | | 944 | } |
945 | | | 945 | |
946 | /* | | 946 | /* |
947 | * Copy locore-function vector. | | 947 | * Copy locore-function vector. |
948 | */ | | 948 | */ |
949 | mips_locore_jumpvec = mips32r2_locore_vec; | | 949 | mips_locore_jumpvec = mips32r2_locore_vec; |
950 | | | 950 | |
951 | mips_icache_sync_all(); | | 951 | mips_icache_sync_all(); |
952 | mips_dcache_wbinv_all(); | | 952 | mips_dcache_wbinv_all(); |
953 | | | 953 | |
954 | /* Clear BEV in SR so we start handling our own exceptions */ | | 954 | /* Clear BEV in SR so we start handling our own exceptions */ |
955 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); | | 955 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); |
956 | | | 956 | |
957 | mips_watchpoint_init(); | | 957 | mips_watchpoint_init(); |
958 | } | | 958 | } |
959 | #endif /* MIPS32R2 */ | | 959 | #endif /* MIPS32R2 */ |
960 | | | 960 | |
961 | #if defined(MIPS64) | | 961 | #if defined(MIPS64) |
962 | static void | | 962 | static void |
963 | mips64_vector_init(const struct splsw *splsw) | | 963 | mips64_vector_init(const struct splsw *splsw) |
964 | { | | 964 | { |
965 | /* r4000 exception handler address */ | | 965 | /* r4000 exception handler address */ |
966 | extern char mips64_exception[]; | | 966 | extern char mips64_exception[]; |
967 | | | 967 | |
968 | /* TLB miss handler addresses */ | | 968 | /* TLB miss handler addresses */ |
969 | extern char mips64_tlb_miss[]; | | 969 | extern char mips64_tlb_miss[]; |
970 | extern char mips64_xtlb_miss[]; | | 970 | extern char mips64_xtlb_miss[]; |
971 | | | 971 | |
972 | /* Cache error handler */ | | 972 | /* Cache error handler */ |
973 | extern char mips64_cache[]; | | 973 | extern char mips64_cache[]; |
974 | | | 974 | |
975 | /* MIPS64 interrupt exception handler */ | | 975 | /* MIPS64 interrupt exception handler */ |
976 | extern char mips64_intr[], mips64_intr_end[]; | | 976 | extern char mips64_intr[], mips64_intr_end[]; |
977 | | | 977 | |
978 | /* | | 978 | /* |
979 | * Copy down exception vector code. | | 979 | * Copy down exception vector code. |
980 | */ | | 980 | */ |
981 | | | 981 | |
982 | if (mips64_xtlb_miss - mips64_tlb_miss != 0x80) | | 982 | if (mips64_xtlb_miss - mips64_tlb_miss != 0x80) |
983 | panic("startup: %s vector code not 128 bytes in length", | | 983 | panic("startup: %s vector code not 128 bytes in length", |
984 | "UTLB"); | | 984 | "UTLB"); |
985 | if (mips64_cache - mips64_xtlb_miss != 0x80) | | 985 | if (mips64_cache - mips64_xtlb_miss != 0x80) |
986 | panic("startup: %s vector code not 128 bytes in length", | | 986 | panic("startup: %s vector code not 128 bytes in length", |
987 | "XTLB"); | | 987 | "XTLB"); |
988 | if (mips64_exception - mips64_cache != 0x80) | | 988 | if (mips64_exception - mips64_cache != 0x80) |
989 | panic("startup: %s vector code not 128 bytes in length", | | 989 | panic("startup: %s vector code not 128 bytes in length", |
990 | "Cache error"); | | 990 | "Cache error"); |
991 | if (mips64_intr - mips64_exception != 0x80) | | 991 | if (mips64_intr - mips64_exception != 0x80) |
992 | panic("startup: %s vector code not 128 bytes in length", | | 992 | panic("startup: %s vector code not 128 bytes in length", |
993 | "General exception"); | | 993 | "General exception"); |
994 | if (mips64_intr_end - mips64_intr > 0x80) | | 994 | if (mips64_intr_end - mips64_intr > 0x80) |
995 | panic("startup: %s vector code too large", | | 995 | panic("startup: %s vector code too large", |
996 | "interrupt exception"); | | 996 | "interrupt exception"); |
997 | | | 997 | |
998 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips64_tlb_miss, | | 998 | memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, mips64_tlb_miss, |
999 | mips64_intr_end - mips64_tlb_miss); | | 999 | mips64_intr_end - mips64_tlb_miss); |
1000 | | | 1000 | |
1001 | /* | | 1001 | /* |
1002 | * Copy locore-function vector. | | 1002 | * Copy locore-function vector. |
1003 | */ | | 1003 | */ |
1004 | mips_locore_jumpvec = mips64_locore_vec; | | 1004 | mips_locore_jumpvec = mips64_locore_vec; |
1005 | | | 1005 | |
1006 | mips_icache_sync_all(); | | 1006 | mips_icache_sync_all(); |
1007 | mips_dcache_wbinv_all(); | | 1007 | mips_dcache_wbinv_all(); |
1008 | | | 1008 | |
1009 | /* Clear BEV in SR so we start handling our own exceptions */ | | 1009 | /* Clear BEV in SR so we start handling our own exceptions */ |
1010 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); | | 1010 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); |
1011 | | | 1011 | |
1012 | mips_watchpoint_init(); | | 1012 | mips_watchpoint_init(); |
1013 | } | | 1013 | } |
1014 | #endif /* MIPS64 */ | | 1014 | #endif /* MIPS64 */ |
1015 | | | 1015 | |
1016 | #if defined(MIPS64R2) | | 1016 | #if defined(MIPS64R2) |
1017 | void | | 1017 | void |
1018 | mips64r2_vector_init(const struct splsw *splsw) | | 1018 | mips64r2_vector_init(const struct splsw *splsw) |
1019 | { | | 1019 | { |
1020 | /* r4000 exception handler address */ | | 1020 | /* r4000 exception handler address */ |
1021 | extern char mips64r2_exception[]; | | 1021 | extern char mips64r2_exception[]; |
1022 | | | 1022 | |
1023 | /* TLB miss handler addresses */ | | 1023 | /* TLB miss handler addresses */ |
1024 | extern char mips64r2_tlb_miss[]; | | 1024 | extern char mips64r2_tlb_miss[]; |
1025 | extern char mips64r2_xtlb_miss[]; | | 1025 | extern char mips64r2_xtlb_miss[]; |
1026 | | | 1026 | |
1027 | /* Cache error handler */ | | 1027 | /* Cache error handler */ |
1028 | extern char mips64r2_cache[]; | | 1028 | extern char mips64r2_cache[]; |
1029 | | | 1029 | |
1030 | /* MIPS64 interrupt exception handler */ | | 1030 | /* MIPS64 interrupt exception handler */ |
1031 | extern char mips64r2_intr[], mips64r2_intr_end[]; | | 1031 | extern char mips64r2_intr[], mips64r2_intr_end[]; |
1032 | | | 1032 | |
1033 | /* | | 1033 | /* |
1034 | * Copy down exception vector code. | | 1034 | * Copy down exception vector code. |
1035 | */ | | 1035 | */ |
1036 | | | 1036 | |
1037 | if (mips64r2_xtlb_miss - mips64r2_tlb_miss != 0x80) | | 1037 | if (mips64r2_xtlb_miss - mips64r2_tlb_miss != 0x80) |
1038 | panic("startup: %s vector code not 128 bytes in length", | | 1038 | panic("startup: %s vector code not 128 bytes in length", |
1039 | "UTLB"); | | 1039 | "UTLB"); |
1040 | if (mips64r2_cache - mips64r2_xtlb_miss != 0x80) | | 1040 | if (mips64r2_cache - mips64r2_xtlb_miss != 0x80) |
1041 | panic("startup: %s vector code not 128 bytes in length", | | 1041 | panic("startup: %s vector code not 128 bytes in length", |
1042 | "XTLB"); | | 1042 | "XTLB"); |
1043 | if (mips64r2_exception - mips64r2_cache != 0x80) | | 1043 | if (mips64r2_exception - mips64r2_cache != 0x80) |
1044 | panic("startup: %s vector code not 128 bytes in length", | | 1044 | panic("startup: %s vector code not 128 bytes in length", |
1045 | "Cache error"); | | 1045 | "Cache error"); |
1046 | if (mips64r2_intr - mips64r2_exception != 0x80) | | 1046 | if (mips64r2_intr - mips64r2_exception != 0x80) |
1047 | panic("startup: %s vector code not 128 bytes in length", | | 1047 | panic("startup: %s vector code not 128 bytes in length", |
1048 | "General exception"); | | 1048 | "General exception"); |
1049 | if (mips64r2_intr_end - mips64r2_intr > 0x80) | | 1049 | if (mips64r2_intr_end - mips64r2_intr > 0x80) |
1050 | panic("startup: %s vector code too large", | | 1050 | panic("startup: %s vector code too large", |
1051 | "interrupt exception"); | | 1051 | "interrupt exception"); |
1052 | | | 1052 | |
1053 | const intptr_t ebase = (intptr_t)mipsNN_cp0_ebase_read(); | | 1053 | const intptr_t ebase = (intptr_t)mipsNN_cp0_ebase_read(); |
1054 | const int cpunum = ebase & MIPS_EBASE_CPUNUM; | | 1054 | const int cpunum = ebase & MIPS_EBASE_CPUNUM; |
1055 | | | 1055 | |
1056 | // This may need to be on CPUs other CPU0 so use EBASE to fetch | | 1056 | // This may need to be on CPUs other CPU0 so use EBASE to fetch |
1057 | // the appropriate address for exception code. EBASE also contains | | 1057 | // the appropriate address for exception code. EBASE also contains |
1058 | // the cpunum so remove that. | | 1058 | // the cpunum so remove that. |
1059 | memcpy((void *)(intptr_t)(ebase & ~MIPS_EBASE_CPUNUM), mips64r2_tlb_miss, | | 1059 | memcpy((void *)(intptr_t)(ebase & ~MIPS_EBASE_CPUNUM), mips64r2_tlb_miss, |
1060 | mips64r2_intr_end - mips64r2_tlb_miss); | | 1060 | mips64r2_intr_end - mips64r2_tlb_miss); |
1061 | | | 1061 | |
1062 | /* | | 1062 | /* |
1063 | * Let see if this cpu has DSP V2 ASE... | | 1063 | * Let see if this cpu has DSP V2 ASE... |
1064 | */ | | 1064 | */ |
1065 | uint32_t cp0flags = mips_options.mips_cpu->cpu_cp0flags; | | 1065 | uint32_t cp0flags = mips_options.mips_cpu->cpu_cp0flags; |
1066 | if (mipsNN_cp0_config2_read() & MIPSNN_CFG2_M) { | | 1066 | if (mipsNN_cp0_config2_read() & MIPSNN_CFG2_M) { |
1067 | const uint32_t cfg3 = mipsNN_cp0_config3_read(); | | 1067 | const uint32_t cfg3 = mipsNN_cp0_config3_read(); |
1068 | if (cfg3 & MIPSNN_CFG3_ULRP) { | | 1068 | if (cfg3 & MIPSNN_CFG3_ULRP) { |
1069 | cp0flags |= MIPS_CP0FL_USERLOCAL; | | 1069 | cp0flags |= MIPS_CP0FL_USERLOCAL; |
1070 | } | | 1070 | } |
1071 | if (cfg3 & MIPSNN_CFG3_DSP2P) { | | 1071 | if (cfg3 & MIPSNN_CFG3_DSP2P) { |
1072 | mips_options.mips_cpu_flags |= CPU_MIPS_HAVE_DSP; | | 1072 | mips_options.mips_cpu_flags |= CPU_MIPS_HAVE_DSP; |
1073 | } | | 1073 | } |
1074 | } | | 1074 | } |
1075 | | | 1075 | |
1076 | /* | | 1076 | /* |
1077 | * If this CPU doesn't have a COP0 USERLOCAL register, at the end | | 1077 | * If this CPU doesn't have a COP0 USERLOCAL register, at the end |
1078 | * of cpu_switch resume overwrite the instructions which update it. | | 1078 | * of cpu_switch resume overwrite the instructions which update it. |
1079 | */ | | 1079 | */ |
1080 | if (!(cp0flags & MIPS_CP0FL_USERLOCAL) && cpunum == 0) { | | 1080 | if (!(cp0flags & MIPS_CP0FL_USERLOCAL) && cpunum == 0) { |
1081 | extern uint32_t mips64r2_cpu_switch_resume[]; | | 1081 | extern uint32_t mips64r2_cpu_switch_resume[]; |
1082 | for (uint32_t *insnp = mips64r2_cpu_switch_resume;; insnp++) { | | 1082 | for (uint32_t *insnp = mips64r2_cpu_switch_resume;; insnp++) { |
1083 | KASSERT(insnp[0] != JR_RA); | | 1083 | KASSERT(insnp[0] != JR_RA); |
1084 | if (insnp[0] == _LOAD_V0_L_PRIVATE_A0 | | 1084 | if (insnp[0] == _LOAD_V0_L_PRIVATE_A0 |
1085 | && insnp[1] == _MTC0_V0_USERLOCAL) { | | 1085 | && insnp[1] == _MTC0_V0_USERLOCAL) { |
1086 | insnp[0] = JR_RA; | | 1086 | insnp[0] = JR_RA; |
1087 | insnp[1] = 0; /* NOP */ | | 1087 | insnp[1] = 0; /* NOP */ |
1088 | break; | | 1088 | break; |
1089 | } | | 1089 | } |
1090 | } | | 1090 | } |
1091 | } | | 1091 | } |
1092 | | | 1092 | |
1093 | /* | | 1093 | /* |
1094 | * Copy locore-function vector. | | 1094 | * Copy locore-function vector. |
1095 | */ | | 1095 | */ |
1096 | if (cpunum == 0) | | 1096 | if (cpunum == 0) |
1097 | mips_locore_jumpvec = mips64r2_locore_vec; | | 1097 | mips_locore_jumpvec = mips64r2_locore_vec; |
1098 | | | 1098 | |
1099 | mips_icache_sync_all(); | | 1099 | mips_icache_sync_all(); |
1100 | mips_dcache_wbinv_all(); | | 1100 | mips_dcache_wbinv_all(); |
1101 | | | 1101 | |
1102 | /* Clear BEV in SR so we start handling our own exceptions */ | | 1102 | /* Clear BEV in SR so we start handling our own exceptions */ |
1103 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); | | 1103 | mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV); |
1104 | | | 1104 | |
1105 | mips_watchpoint_init(); | | 1105 | mips_watchpoint_init(); |
1106 | } | | 1106 | } |
1107 | #endif /* MIPS64R2 */ | | 1107 | #endif /* MIPS64R2 */ |
1108 | | | 1108 | |
1109 | /* | | 1109 | /* |
1110 | * Do all the stuff that locore normally does before calling main(), | | 1110 | * Do all the stuff that locore normally does before calling main(), |
1111 | * that is common to all mips-CPU NetBSD ports. | | 1111 | * that is common to all mips-CPU NetBSD ports. |
1112 | * | | 1112 | * |
1113 | * The principal purpose of this function is to examine the | | 1113 | * The principal purpose of this function is to examine the |
1114 | * variable cpu_id, into which the kernel locore start code | | 1114 | * variable cpu_id, into which the kernel locore start code |
1115 | * writes the CPU ID register, and to then copy appropriate | | 1115 | * writes the CPU ID register, and to then copy appropriate |
1116 | * code into the CPU exception-vector entries and the jump tables | | 1116 | * code into the CPU exception-vector entries and the jump tables |
1117 | * used to hide the differences in cache and TLB handling in | | 1117 | * used to hide the differences in cache and TLB handling in |
1118 | * different MIPS CPUs. | | 1118 | * different MIPS CPUs. |
1119 | * | | 1119 | * |
1120 | * This should be the very first thing called by each port's | | 1120 | * This should be the very first thing called by each port's |
1121 | * init_main() function. | | 1121 | * init_main() function. |
1122 | */ | | 1122 | */ |
1123 | | | 1123 | |
1124 | /* | | 1124 | /* |
1125 | * Initialize the hardware exception vectors, and the jump table used to | | 1125 | * Initialize the hardware exception vectors, and the jump table used to |
1126 | * call locore cache and TLB management functions, based on the kind | | 1126 | * call locore cache and TLB management functions, based on the kind |
1127 | * of CPU the kernel is running on. | | 1127 | * of CPU the kernel is running on. |
1128 | */ | | 1128 | */ |
1129 | void | | 1129 | void |
1130 | mips_vector_init(const struct splsw *splsw, bool multicpu_p) | | 1130 | mips_vector_init(const struct splsw *splsw, bool multicpu_p) |
1131 | { | | 1131 | { |
1132 | struct mips_options * const opts = &mips_options; | | 1132 | struct mips_options * const opts = &mips_options; |
1133 | const struct pridtab *ct; | | 1133 | const struct pridtab *ct; |
1134 | const mips_prid_t cpu_id = opts->mips_cpu_id; | | 1134 | const mips_prid_t cpu_id = opts->mips_cpu_id; |
1135 | | | 1135 | |
1136 | for (ct = cputab; ct->cpu_name != NULL; ct++) { | | 1136 | for (ct = cputab; ct->cpu_name != NULL; ct++) { |
1137 | if (MIPS_PRID_CID(cpu_id) != ct->cpu_cid || | | 1137 | if (MIPS_PRID_CID(cpu_id) != ct->cpu_cid || |
1138 | MIPS_PRID_IMPL(cpu_id) != ct->cpu_pid) | | 1138 | MIPS_PRID_IMPL(cpu_id) != ct->cpu_pid) |
1139 | continue; | | 1139 | continue; |
1140 | if (ct->cpu_rev >= 0 && | | 1140 | if (ct->cpu_rev >= 0 && |
1141 | MIPS_PRID_REV(cpu_id) != ct->cpu_rev) | | 1141 | MIPS_PRID_REV(cpu_id) != ct->cpu_rev) |
1142 | continue; | | 1142 | continue; |
1143 | if (ct->cpu_copts >= 0 && | | 1143 | if (ct->cpu_copts >= 0 && |
1144 | MIPS_PRID_COPTS(cpu_id) != ct->cpu_copts) | | 1144 | MIPS_PRID_COPTS(cpu_id) != ct->cpu_copts) |
1145 | continue; | | 1145 | continue; |
1146 | | | 1146 | |
1147 | opts->mips_cpu = ct; | | 1147 | opts->mips_cpu = ct; |
1148 | opts->mips_cpu_arch = ct->cpu_isa; | | 1148 | opts->mips_cpu_arch = ct->cpu_isa; |
1149 | opts->mips_num_tlb_entries = ct->cpu_ntlb; | | 1149 | opts->mips_num_tlb_entries = ct->cpu_ntlb; |
1150 | break; | | 1150 | break; |
1151 | } | | 1151 | } |
1152 | | | 1152 | |
1153 | if (opts->mips_cpu == NULL) | | 1153 | if (opts->mips_cpu == NULL) |
1154 | panic("CPU type (0x%x) not supported", cpu_id); | | 1154 | panic("CPU type (0x%x) not supported", cpu_id); |
1155 | | | 1155 | |
1156 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 | | 1156 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 |
1157 | if (MIPS_PRID_CID(cpu_id) != 0) { | | 1157 | if (MIPS_PRID_CID(cpu_id) != 0) { |
1158 | /* MIPS32/MIPS64, use coprocessor 0 config registers */ | | 1158 | /* MIPS32/MIPS64, use coprocessor 0 config registers */ |
1159 | uint32_t cfg, cfg1; | | 1159 | uint32_t cfg, cfg1; |
1160 | | | 1160 | |
1161 | cfg = mips3_cp0_config_read(); | | 1161 | cfg = mips3_cp0_config_read(); |
1162 | cfg1 = mipsNN_cp0_config1_read(); | | 1162 | cfg1 = mipsNN_cp0_config1_read(); |
1163 | | | 1163 | |
1164 | /* pick CPU type */ | | 1164 | /* pick CPU type */ |
1165 | switch (MIPSNN_GET(CFG_AT, cfg)) { | | 1165 | switch (MIPSNN_GET(CFG_AT, cfg)) { |
1166 | case MIPSNN_CFG_AT_MIPS32: | | 1166 | case MIPSNN_CFG_AT_MIPS32: |
1167 | opts->mips_cpu_arch = CPU_ARCH_MIPS32; | | 1167 | opts->mips_cpu_arch = CPU_ARCH_MIPS32; |
1168 | break; | | 1168 | break; |
1169 | case MIPSNN_CFG_AT_MIPS64: | | 1169 | case MIPSNN_CFG_AT_MIPS64: |
1170 | opts->mips_cpu_arch = CPU_ARCH_MIPS64; | | 1170 | opts->mips_cpu_arch = CPU_ARCH_MIPS64; |
1171 | break; | | 1171 | break; |
1172 | case MIPSNN_CFG_AT_MIPS64S: | | 1172 | case MIPSNN_CFG_AT_MIPS64S: |
1173 | default: | | 1173 | default: |
1174 | panic("MIPS32/64 architecture type %d not supported", | | 1174 | panic("MIPS32/64 architecture type %d not supported", |
1175 | MIPSNN_GET(CFG_AT, cfg)); | | 1175 | MIPSNN_GET(CFG_AT, cfg)); |
1176 | } | | 1176 | } |
1177 | | | 1177 | |
1178 | switch (MIPSNN_GET(CFG_AR, cfg)) { | | 1178 | switch (MIPSNN_GET(CFG_AR, cfg)) { |
1179 | case MIPSNN_CFG_AR_REV1: | | 1179 | case MIPSNN_CFG_AR_REV1: |
1180 | break; | | 1180 | break; |
1181 | case MIPSNN_CFG_AR_REV2: | | 1181 | case MIPSNN_CFG_AR_REV2: |
1182 | switch (opts->mips_cpu_arch) { | | 1182 | switch (opts->mips_cpu_arch) { |
1183 | case CPU_ARCH_MIPS32: | | 1183 | case CPU_ARCH_MIPS32: |
1184 | opts->mips_cpu_arch = CPU_ARCH_MIPS32R2; | | 1184 | opts->mips_cpu_arch = CPU_ARCH_MIPS32R2; |
1185 | break; | | 1185 | break; |
1186 | case CPU_ARCH_MIPS64: | | 1186 | case CPU_ARCH_MIPS64: |
1187 | opts->mips_cpu_arch = CPU_ARCH_MIPS64R2; | | 1187 | opts->mips_cpu_arch = CPU_ARCH_MIPS64R2; |
1188 | break; | | 1188 | break; |
1189 | default: | | 1189 | default: |
1190 | printf("WARNING: MIPS32/64 arch %d revision %d " | | 1190 | printf("WARNING: MIPS32/64 arch %d revision %d " |
1191 | "unknown!\n", opts->mips_cpu_arch, | | 1191 | "unknown!\n", opts->mips_cpu_arch, |
1192 | MIPSNN_GET(CFG_AR, cfg)); | | 1192 | MIPSNN_GET(CFG_AR, cfg)); |
1193 | break; | | 1193 | break; |
1194 | } | | 1194 | } |
1195 | break; | | 1195 | break; |
1196 | default: | | 1196 | default: |
1197 | printf("WARNING: MIPS32/64 arch revision %d " | | 1197 | printf("WARNING: MIPS32/64 arch revision %d " |
1198 | "unknown!\n", MIPSNN_GET(CFG_AR, cfg)); | | 1198 | "unknown!\n", MIPSNN_GET(CFG_AR, cfg)); |
1199 | break; | | 1199 | break; |
1200 | } | | 1200 | } |
1201 | | | 1201 | |
1202 | /* figure out MMU type (and number of TLB entries) */ | | 1202 | /* figure out MMU type (and number of TLB entries) */ |
1203 | switch (MIPSNN_GET(CFG_MT, cfg)) { | | 1203 | switch (MIPSNN_GET(CFG_MT, cfg)) { |
1204 | case MIPSNN_CFG_MT_TLB: | | 1204 | case MIPSNN_CFG_MT_TLB: |
1205 | opts->mips_num_tlb_entries = MIPSNN_CFG1_MS(cfg1); | | 1205 | opts->mips_num_tlb_entries = MIPSNN_CFG1_MS(cfg1); |
1206 | break; | | 1206 | break; |
1207 | case MIPSNN_CFG_MT_NONE: | | 1207 | case MIPSNN_CFG_MT_NONE: |
1208 | case MIPSNN_CFG_MT_BAT: | | 1208 | case MIPSNN_CFG_MT_BAT: |
1209 | case MIPSNN_CFG_MT_FIXED: | | 1209 | case MIPSNN_CFG_MT_FIXED: |
1210 | default: | | 1210 | default: |
1211 | panic("MIPS32/64 MMU type %d not supported", | | 1211 | panic("MIPS32/64 MMU type %d not supported", |
1212 | MIPSNN_GET(CFG_MT, cfg)); | | 1212 | MIPSNN_GET(CFG_MT, cfg)); |
1213 | } | | 1213 | } |
1214 | } | | 1214 | } |
1215 | #endif /* (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */ | | 1215 | #endif /* (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */ |
1216 | | | 1216 | |
1217 | if (opts->mips_cpu_arch < 1) | | 1217 | if (opts->mips_cpu_arch < 1) |
1218 | panic("Unknown CPU ISA for CPU type 0x%x", cpu_id); | | 1218 | panic("Unknown CPU ISA for CPU type 0x%x", cpu_id); |
1219 | if (opts->mips_num_tlb_entries < 1) | | 1219 | if (opts->mips_num_tlb_entries < 1) |
1220 | panic("Unknown number of TLBs for CPU type 0x%x", cpu_id); | | 1220 | panic("Unknown number of TLBs for CPU type 0x%x", cpu_id); |
1221 | | | 1221 | |
1222 | /* | | 1222 | /* |
1223 | * Check CPU-specific flags. | | 1223 | * Check CPU-specific flags. |
1224 | */ | | 1224 | */ |
1225 | opts->mips_cpu_flags = opts->mips_cpu->cpu_flags; | | 1225 | opts->mips_cpu_flags = opts->mips_cpu->cpu_flags; |
1226 | opts->mips_has_r4k_mmu = (opts->mips_cpu_flags & CPU_MIPS_R4K_MMU) != 0; | | 1226 | opts->mips_has_r4k_mmu = (opts->mips_cpu_flags & CPU_MIPS_R4K_MMU) != 0; |
1227 | opts->mips_has_llsc = (opts->mips_cpu_flags & CPU_MIPS_NO_LLSC) == 0; | | 1227 | opts->mips_has_llsc = (opts->mips_cpu_flags & CPU_MIPS_NO_LLSC) == 0; |
1228 | #if defined(MIPS3_4100) | | 1228 | #if defined(MIPS3_4100) |
1229 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_R4100) | | 1229 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_R4100) |
1230 | opts->mips3_pg_shift = MIPS3_4100_PG_SHIFT; | | 1230 | opts->mips3_pg_shift = MIPS3_4100_PG_SHIFT; |
1231 | else | | 1231 | else |
1232 | #endif | | 1232 | #endif |
1233 | opts->mips3_pg_shift = MIPS3_DEFAULT_PG_SHIFT; | | 1233 | opts->mips3_pg_shift = MIPS3_DEFAULT_PG_SHIFT; |
1234 | | | 1234 | |
1235 | opts->mips3_cca_devmem = CCA_UNCACHED; | | 1235 | opts->mips3_cca_devmem = CCA_UNCACHED; |
1236 | if (opts->mips_cpu_flags & CPU_MIPS_HAVE_SPECIAL_CCA) { | | 1236 | if (opts->mips_cpu_flags & CPU_MIPS_HAVE_SPECIAL_CCA) { |
1237 | uint32_t cca; | | 1237 | uint32_t cca; |
1238 | | | 1238 | |
1239 | cca = (opts->mips_cpu_flags & CPU_MIPS_CACHED_CCA_MASK) >> | | 1239 | cca = (opts->mips_cpu_flags & CPU_MIPS_CACHED_CCA_MASK) >> |
1240 | CPU_MIPS_CACHED_CCA_SHIFT; | | 1240 | CPU_MIPS_CACHED_CCA_SHIFT; |
1241 | opts->mips3_pg_cached = MIPS3_CCA_TO_PG(cca); | | 1241 | opts->mips3_pg_cached = MIPS3_CCA_TO_PG(cca); |
1242 | #ifndef __mips_o32 | | 1242 | #ifndef __mips_o32 |
1243 | opts->mips3_xkphys_cached = MIPS_PHYS_TO_XKPHYS(cca, 0); | | 1243 | opts->mips3_xkphys_cached = MIPS_PHYS_TO_XKPHYS(cca, 0); |
1244 | #endif | | 1244 | #endif |
1245 | } else { | | 1245 | } else { |
1246 | opts->mips3_pg_cached = MIPS3_DEFAULT_PG_CACHED; | | 1246 | opts->mips3_pg_cached = MIPS3_DEFAULT_PG_CACHED; |
1247 | #ifndef __mips_o32 | | 1247 | #ifndef __mips_o32 |
1248 | opts->mips3_xkphys_cached = MIPS3_DEFAULT_XKPHYS_CACHED; | | 1248 | opts->mips3_xkphys_cached = MIPS3_DEFAULT_XKPHYS_CACHED; |
1249 | #endif | | 1249 | #endif |
1250 | } | | 1250 | } |
1251 | | | 1251 | |
1252 | #ifdef __HAVE_MIPS_MACHDEP_CACHE_CONFIG | | 1252 | #ifdef __HAVE_MIPS_MACHDEP_CACHE_CONFIG |
1253 | mips_machdep_cache_config(); | | 1253 | mips_machdep_cache_config(); |
1254 | #endif | | 1254 | #endif |
1255 | | | 1255 | |
1256 | /* | | 1256 | /* |
1257 | * if 'splsw' is NULL, use standard SPL with COP0 status/cause | | 1257 | * if 'splsw' is NULL, use standard SPL with COP0 status/cause |
1258 | * otherwise use chip-specific splsw | | 1258 | * otherwise use chip-specific splsw |
1259 | */ | | 1259 | */ |
1260 | if (splsw == NULL) { | | 1260 | if (splsw == NULL) { |
1261 | mips_splsw = std_splsw; | | 1261 | mips_splsw = std_splsw; |
1262 | #ifdef PARANOIA | | 1262 | #ifdef PARANOIA |
1263 | std_splsw_test(); /* only works with std_splsw */ | | 1263 | std_splsw_test(); /* only works with std_splsw */ |
1264 | #endif | | 1264 | #endif |
1265 | } else { | | 1265 | } else { |
1266 | mips_splsw = *splsw; | | 1266 | mips_splsw = *splsw; |
1267 | } | | 1267 | } |
1268 | | | 1268 | |
1269 | /* | | 1269 | /* |
1270 | * Determine cache configuration and initialize our cache | | 1270 | * Determine cache configuration and initialize our cache |
1271 | * frobbing routine function pointers. | | 1271 | * frobbing routine function pointers. |
1272 | */ | | 1272 | */ |
1273 | mips_config_cache(); | | 1273 | mips_config_cache(); |
1274 | | | 1274 | |
1275 | /* | | 1275 | /* |
1276 | * We default to RAS atomic ops since they are the lowest overhead. | | 1276 | * We default to RAS atomic ops since they are the lowest overhead. |
1277 | */ | | 1277 | */ |
1278 | #ifdef MULTIPROCESSOR | | 1278 | #ifdef MULTIPROCESSOR |
1279 | if (multicpu_p) { | | 1279 | if (multicpu_p) { |
1280 | /* | | 1280 | /* |
1281 | * If we could have multiple CPUs active, | | 1281 | * If we could have multiple CPUs active, |
1282 | * use the ll/sc variants. | | 1282 | * use the ll/sc variants. |
1283 | */ | | 1283 | */ |
1284 | mips_locore_atomicvec = mips_llsc_locore_atomicvec; | | 1284 | mips_locore_atomicvec = mips_llsc_locore_atomicvec; |
1285 | } | | 1285 | } |
1286 | #endif | | 1286 | #endif |
1287 | /* | | 1287 | /* |
1288 | * Now initialize our ISA-dependent function vector. | | 1288 | * Now initialize our ISA-dependent function vector. |
1289 | */ | | 1289 | */ |
1290 | switch (opts->mips_cpu_arch) { | | 1290 | switch (opts->mips_cpu_arch) { |
1291 | #if defined(MIPS1) | | 1291 | #if defined(MIPS1) |
1292 | case CPU_ARCH_MIPS1: | | 1292 | case CPU_ARCH_MIPS1: |
1293 | (*mips1_locore_vec.ljv_tlb_invalidate_all)(); | | 1293 | (*mips1_locore_vec.ljv_tlb_invalidate_all)(); |
1294 | mips1_vector_init(splsw); | | 1294 | mips1_vector_init(splsw); |
1295 | mips_locoresw = mips1_locoresw; | | 1295 | mips_locoresw = mips1_locoresw; |
1296 | break; | | 1296 | break; |
1297 | #endif | | 1297 | #endif |
1298 | #if defined(MIPS3) | | 1298 | #if defined(MIPS3) |
1299 | case CPU_ARCH_MIPS3: | | 1299 | case CPU_ARCH_MIPS3: |
1300 | case CPU_ARCH_MIPS4: | | 1300 | case CPU_ARCH_MIPS4: |
1301 | mips3_tlb_probe(); | | 1301 | mips3_tlb_probe(); |
1302 | #if defined(MIPS3_4100) | | 1302 | #if defined(MIPS3_4100) |
1303 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_R4100) | | 1303 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_R4100) |
1304 | mips3_cp0_pg_mask_write(MIPS4100_PG_SIZE_TO_MASK(PAGE_SIZE)); | | 1304 | mips3_cp0_pg_mask_write(MIPS4100_PG_SIZE_TO_MASK(PAGE_SIZE)); |
1305 | else | | 1305 | else |
1306 | #endif | | 1306 | #endif |
1307 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); | | 1307 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); |
1308 | mips3_cp0_wired_write(0); | | 1308 | mips3_cp0_wired_write(0); |
1309 | #if defined(MIPS3_LOONGSON2) | | 1309 | #if defined(MIPS3_LOONGSON2) |
1310 | if (opts->mips_cpu_flags & CPU_MIPS_LOONGSON2) { | | 1310 | if (opts->mips_cpu_flags & CPU_MIPS_LOONGSON2) { |
1311 | (*loongson2_locore_vec.ljv_tlb_invalidate_all)(); | | 1311 | (*loongson2_locore_vec.ljv_tlb_invalidate_all)(); |
1312 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); | | 1312 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); |
1313 | loongson2_vector_init(splsw); | | 1313 | loongson2_vector_init(splsw); |
1314 | mips_locoresw = loongson2_locoresw; | | 1314 | mips_locoresw = loongson2_locoresw; |
1315 | opts->mips3_cca_devmem = CCA_ACCEL; | | 1315 | opts->mips3_cca_devmem = CCA_ACCEL; |
1316 | break; | | 1316 | break; |
1317 | } | | 1317 | } |
1318 | #endif /* MIPS3_LOONGSON2 */ | | 1318 | #endif /* MIPS3_LOONGSON2 */ |
1319 | (*mips3_locore_vec.ljv_tlb_invalidate_all)(); | | 1319 | (*mips3_locore_vec.ljv_tlb_invalidate_all)(); |
1320 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); | | 1320 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); |
1321 | mips3_vector_init(splsw); | | 1321 | mips3_vector_init(splsw); |
1322 | mips_locoresw = mips3_locoresw; | | 1322 | mips_locoresw = mips3_locoresw; |
1323 | break; | | 1323 | break; |
1324 | | | 1324 | |
1325 | #endif /* MIPS3 */ | | 1325 | #endif /* MIPS3 */ |
1326 | #if defined(MIPS32) | | 1326 | #if defined(MIPS32) |
1327 | case CPU_ARCH_MIPS32: | | 1327 | case CPU_ARCH_MIPS32: |
1328 | mips3_tlb_probe(); | | 1328 | mips3_tlb_probe(); |
1329 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); | | 1329 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); |
1330 | mips3_cp0_wired_write(0); | | 1330 | mips3_cp0_wired_write(0); |
1331 | (*mips32_locore_vec.ljv_tlb_invalidate_all)(); | | 1331 | (*mips32_locore_vec.ljv_tlb_invalidate_all)(); |
1332 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); | | 1332 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); |
1333 | mips32_vector_init(splsw); | | 1333 | mips32_vector_init(splsw); |
1334 | mips_locoresw = mips32_locoresw; | | 1334 | mips_locoresw = mips32_locoresw; |
1335 | break; | | 1335 | break; |
1336 | #endif | | 1336 | #endif |
1337 | #if defined(MIPS32R2) | | 1337 | #if defined(MIPS32R2) |
1338 | case CPU_ARCH_MIPS32R2: | | 1338 | case CPU_ARCH_MIPS32R2: |
1339 | mips3_tlb_probe(); | | 1339 | mips3_tlb_probe(); |
1340 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); | | 1340 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); |
1341 | mips3_cp0_wired_write(0); | | 1341 | mips3_cp0_wired_write(0); |
1342 | (*mips32r2_locore_vec.ljv_tlb_invalidate_all)(); | | 1342 | (*mips32r2_locore_vec.ljv_tlb_invalidate_all)(); |
1343 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); | | 1343 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); |
1344 | mips32r2_vector_init(splsw); | | 1344 | mips32r2_vector_init(splsw); |
1345 | mips_locoresw = mips32r2_locoresw; | | 1345 | mips_locoresw = mips32r2_locoresw; |
1346 | break; | | 1346 | break; |
1347 | #endif | | 1347 | #endif |
1348 | #if defined(MIPS64) | | 1348 | #if defined(MIPS64) |
1349 | case CPU_ARCH_MIPS64: { | | 1349 | case CPU_ARCH_MIPS64: { |
1350 | mips3_tlb_probe(); | | 1350 | mips3_tlb_probe(); |
1351 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); | | 1351 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); |
1352 | mips3_cp0_wired_write(0); | | 1352 | mips3_cp0_wired_write(0); |
1353 | (*mips64_locore_vec.ljv_tlb_invalidate_all)(); | | 1353 | (*mips64_locore_vec.ljv_tlb_invalidate_all)(); |
1354 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); | | 1354 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); |
1355 | mips64_vector_init(splsw); | | 1355 | mips64_vector_init(splsw); |
1356 | mips_locoresw = mips64_locoresw; | | 1356 | mips_locoresw = mips64_locoresw; |
1357 | break; | | 1357 | break; |
1358 | } | | 1358 | } |
1359 | #endif | | 1359 | #endif |
1360 | #if defined(MIPS64R2) | | 1360 | #if defined(MIPS64R2) |
1361 | case CPU_ARCH_MIPS64R2: { | | 1361 | case CPU_ARCH_MIPS64R2: { |
1362 | mips3_tlb_probe(); | | 1362 | mips3_tlb_probe(); |
1363 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); | | 1363 | mips3_cp0_pg_mask_write(MIPS3_PG_SIZE_TO_MASK(PAGE_SIZE)); |
1364 | mips3_cp0_wired_write(0); | | 1364 | mips3_cp0_wired_write(0); |
1365 | (*mips64r2_locore_vec.ljv_tlb_invalidate_all)(); | | 1365 | (*mips64r2_locore_vec.ljv_tlb_invalidate_all)(); |
1366 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); | | 1366 | mips3_cp0_wired_write(pmap_tlb0_info.ti_wired); |
1367 | mips64r2_vector_init(splsw); | | 1367 | mips64r2_vector_init(splsw); |
1368 | mips_locoresw = mips64r2_locoresw; | | 1368 | mips_locoresw = mips64r2_locoresw; |
1369 | break; | | 1369 | break; |
1370 | } | | 1370 | } |
1371 | #endif | | 1371 | #endif |
1372 | default: | | 1372 | default: |
1373 | printf("cpu_arch 0x%x: not supported\n", opts->mips_cpu_arch); | | 1373 | printf("cpu_arch 0x%x: not supported\n", opts->mips_cpu_arch); |
1374 | cpu_reboot(RB_HALT, NULL); | | 1374 | cpu_reboot(RB_HALT, NULL); |
1375 | } | | 1375 | } |
1376 | | | 1376 | |
1377 | /* | | 1377 | /* |
1378 | * Now that the splsw and locoresw have been filled in, fixup the | | 1378 | * Now that the splsw and locoresw have been filled in, fixup the |
1379 | * jumps to any stubs to actually jump to the real routines. | | 1379 | * jumps to any stubs to actually jump to the real routines. |
1380 | */ | | 1380 | */ |
1381 | extern uint32_t _ftext[]; | | 1381 | extern uint32_t _ftext[]; |
1382 | extern uint32_t _etext[]; | | 1382 | extern uint32_t _etext[]; |
1383 | mips_fixup_stubs(_ftext, _etext); | | 1383 | mips_fixup_stubs(_ftext, _etext); |
1384 | | | 1384 | |
1385 | #if (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 | | 1385 | #if (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 |
1386 | /* | | 1386 | /* |
1387 | * Install power-saving idle routines. | | 1387 | * Install power-saving idle routines. |
1388 | */ | | 1388 | */ |
1389 | if ((opts->mips_cpu_flags & CPU_MIPS_USE_WAIT) && | | 1389 | if ((opts->mips_cpu_flags & CPU_MIPS_USE_WAIT) && |
1390 | !(opts->mips_cpu_flags & CPU_MIPS_NO_WAIT)) | | 1390 | !(opts->mips_cpu_flags & CPU_MIPS_NO_WAIT)) |
1391 | mips_locoresw.lsw_cpu_idle = mips_wait_idle; | | 1391 | mips_locoresw.lsw_cpu_idle = mips_wait_idle; |
1392 | #endif /* (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */ | | 1392 | #endif /* (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */ |
1393 | } | | 1393 | } |
1394 | | | 1394 | |
1395 | void | | 1395 | void |
1396 | mips_set_wbflush(void (*flush_fn)(void)) | | 1396 | mips_set_wbflush(void (*flush_fn)(void)) |
1397 | { | | 1397 | { |
1398 | mips_locoresw.lsw_wbflush = flush_fn; | | 1398 | mips_locoresw.lsw_wbflush = flush_fn; |
1399 | (*flush_fn)(); | | 1399 | (*flush_fn)(); |
1400 | } | | 1400 | } |
1401 | | | 1401 | |
1402 | #if defined(MIPS3_PLUS) | | 1402 | #if defined(MIPS3_PLUS) |
1403 | static void | | 1403 | static void |
1404 | mips3_tlb_probe(void) | | 1404 | mips3_tlb_probe(void) |
1405 | { | | 1405 | { |
1406 | struct mips_options * const opts = &mips_options; | | 1406 | struct mips_options * const opts = &mips_options; |
1407 | opts->mips3_tlb_pg_mask = mips3_cp0_tlb_page_mask_probe(); | | 1407 | opts->mips3_tlb_pg_mask = mips3_cp0_tlb_page_mask_probe(); |
1408 | if (CPUIS64BITS) { | | 1408 | if (CPUIS64BITS) { |
1409 | opts->mips3_tlb_vpn_mask = mips3_cp0_tlb_entry_hi_probe(); | | 1409 | opts->mips3_tlb_vpn_mask = mips3_cp0_tlb_entry_hi_probe(); |
1410 | opts->mips3_tlb_vpn_mask |= PAGE_MASK; | | 1410 | opts->mips3_tlb_vpn_mask |= PAGE_MASK; |
1411 | opts->mips3_tlb_vpn_mask <<= 2; | | 1411 | opts->mips3_tlb_vpn_mask <<= 2; |
1412 | opts->mips3_tlb_vpn_mask >>= 2; | | 1412 | opts->mips3_tlb_vpn_mask >>= 2; |
1413 | opts->mips3_tlb_pfn_mask = mips3_cp0_tlb_entry_lo_probe(); | | 1413 | opts->mips3_tlb_pfn_mask = mips3_cp0_tlb_entry_lo_probe(); |
1414 | #if defined(_LP64) && defined(ENABLE_MIPS_16KB_PAGE) | | 1414 | #if defined(_LP64) && defined(ENABLE_MIPS_16KB_PAGE) |
1415 | /* | | 1415 | /* |
1416 | * 16KB pages could cause our page table being able to address | | 1416 | * 16KB pages could cause our page table being able to address |
1417 | * a larger address space than the actual chip supports. So | | 1417 | * a larger address space than the actual chip supports. So |
1418 | * we need to limit the address space to what it can really | | 1418 | * we need to limit the address space to what it can really |
1419 | * address. | | 1419 | * address. |
1420 | */ | | 1420 | */ |
1421 | if (mips_vm_maxuser_address > opts->mips3_tlb_vpn_mask + 1) | | 1421 | if (mips_vm_maxuser_address > opts->mips3_tlb_vpn_mask + 1) |
1422 | mips_vm_maxuser_address = opts->mips3_tlb_vpn_mask + 1; | | 1422 | mips_vm_maxuser_address = opts->mips3_tlb_vpn_mask + 1; |
1423 | #endif | | 1423 | #endif |
1424 | } | | 1424 | } |
1425 | } | | 1425 | } |
1426 | #endif | | 1426 | #endif |
1427 | | | 1427 | |
1428 | /* | | 1428 | /* |
1429 | * Identify product revision IDs of CPU and FPU. | | 1429 | * Identify product revision IDs of CPU and FPU. |
1430 | */ | | 1430 | */ |
1431 | void | | 1431 | void |
1432 | cpu_identify(device_t dev) | | 1432 | cpu_identify(device_t dev) |
1433 | { | | 1433 | { |
1434 | const struct mips_options * const opts = &mips_options; | | 1434 | const struct mips_options * const opts = &mips_options; |
1435 | const struct mips_cache_info * const mci = &mips_cache_info; | | 1435 | const struct mips_cache_info * const mci = &mips_cache_info; |
1436 | const mips_prid_t cpu_id = opts->mips_cpu_id; | | 1436 | const mips_prid_t cpu_id = opts->mips_cpu_id; |
1437 | const mips_prid_t fpu_id = opts->mips_fpu_id; | | 1437 | const mips_prid_t fpu_id = opts->mips_fpu_id; |
1438 | static const char * const waynames[] = { | | 1438 | static const char * const waynames[] = { |
1439 | [0] = "fully set-associative", | | 1439 | [0] = "fully set-associative", |
1440 | [1] = "direct-mapped", | | 1440 | [1] = "direct-mapped", |
1441 | [2] = "2-way set-associative", | | 1441 | [2] = "2-way set-associative", |
1442 | [3] = NULL, | | 1442 | [3] = NULL, |
1443 | [4] = "4-way set-associative", | | 1443 | [4] = "4-way set-associative", |
1444 | [5] = "5-way set-associative", | | 1444 | [5] = "5-way set-associative", |
1445 | [6] = "6-way set-associative", | | 1445 | [6] = "6-way set-associative", |
1446 | [7] = "7-way set-associative", | | 1446 | [7] = "7-way set-associative", |
1447 | [8] = "8-way set-associative", | | 1447 | [8] = "8-way set-associative", |
1448 | #ifdef MIPS64_OCTEON | | 1448 | #ifdef MIPS64_OCTEON |
1449 | [64] = "64-way set-associative", | | 1449 | [64] = "64-way set-associative", |
1450 | #endif | | 1450 | #endif |
1451 | }; | | 1451 | }; |
1452 | #define nwaynames (sizeof(waynames) / sizeof(waynames[0])) | | 1452 | #define nwaynames (sizeof(waynames) / sizeof(waynames[0])) |
1453 | static const char * const wtnames[] = { | | 1453 | static const char * const wtnames[] = { |
1454 | "write-back", | | 1454 | "write-back", |
1455 | "write-through", | | 1455 | "write-through", |
1456 | }; | | 1456 | }; |
1457 | const char *cpuname, *fpuname; | | 1457 | const char *cpuname, *fpuname; |
1458 | int i; | | 1458 | int i; |
1459 | | | 1459 | |
1460 | cpuname = opts->mips_cpu->cpu_name; | | 1460 | cpuname = opts->mips_cpu->cpu_name; |
1461 | | | 1461 | |
1462 | fpuname = NULL; | | 1462 | fpuname = NULL; |
1463 | for (i = 0; i < sizeof(fputab)/sizeof(fputab[0]); i++) { | | 1463 | for (i = 0; i < sizeof(fputab)/sizeof(fputab[0]); i++) { |
1464 | if (MIPS_PRID_CID(fpu_id) == fputab[i].cpu_cid && | | 1464 | if (MIPS_PRID_CID(fpu_id) == fputab[i].cpu_cid && |
1465 | MIPS_PRID_IMPL(fpu_id) == fputab[i].cpu_pid) { | | 1465 | MIPS_PRID_IMPL(fpu_id) == fputab[i].cpu_pid) { |
1466 | fpuname = fputab[i].cpu_name; | | 1466 | fpuname = fputab[i].cpu_name; |
1467 | break; | | 1467 | break; |
1468 | } | | 1468 | } |
1469 | } | | 1469 | } |
1470 | if (fpuname == NULL && MIPS_PRID_IMPL(fpu_id) == MIPS_PRID_IMPL(cpu_id)) | | 1470 | if (fpuname == NULL && MIPS_PRID_IMPL(fpu_id) == MIPS_PRID_IMPL(cpu_id)) |
1471 | fpuname = "built-in FPU"; | | 1471 | fpuname = "built-in FPU"; |
1472 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_R4700) /* FPU PRid is 0x20 */ | | 1472 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_R4700) /* FPU PRid is 0x20 */ |
1473 | fpuname = "built-in FPU"; | | 1473 | fpuname = "built-in FPU"; |
1474 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_RC64470) /* FPU PRid is 0x21 */ | | 1474 | if (MIPS_PRID_IMPL(cpu_id) == MIPS_RC64470) /* FPU PRid is 0x21 */ |
1475 | fpuname = "built-in FPU"; | | 1475 | fpuname = "built-in FPU"; |
1476 | | | 1476 | |
1477 | if (opts->mips_cpu->cpu_cid != 0) { | | 1477 | if (opts->mips_cpu->cpu_cid != 0) { |
1478 | if (opts->mips_cpu->cpu_cid <= ncidnames) | | 1478 | if (opts->mips_cpu->cpu_cid <= ncidnames) |
1479 | aprint_normal("%s ", cidnames[opts->mips_cpu->cpu_cid]); | | 1479 | aprint_normal("%s ", cidnames[opts->mips_cpu->cpu_cid]); |
1480 | else if (opts->mips_cpu->cpu_cid == MIPS_PRID_CID_INGENIC) { | | 1480 | else if (opts->mips_cpu->cpu_cid == MIPS_PRID_CID_INGENIC) { |
1481 | aprint_normal("Ingenic "); | | 1481 | aprint_normal("Ingenic "); |
1482 | } else { | | 1482 | } else { |
1483 | aprint_normal("Unknown Company ID - 0x%x", opts->mips_cpu->cpu_cid); | | 1483 | aprint_normal("Unknown Company ID - 0x%x", opts->mips_cpu->cpu_cid); |
1484 | aprint_normal_dev(dev, ""); | | 1484 | aprint_normal_dev(dev, ""); |
1485 | } | | 1485 | } |
1486 | } | | 1486 | } |
1487 | if (cpuname != NULL) | | 1487 | if (cpuname != NULL) |
1488 | aprint_normal("%s (0x%x)", cpuname, cpu_id); | | 1488 | aprint_normal("%s (0x%x)", cpuname, cpu_id); |
1489 | else | | 1489 | else |
1490 | aprint_normal("unknown CPU type (0x%x)", cpu_id); | | 1490 | aprint_normal("unknown CPU type (0x%x)", cpu_id); |
1491 | if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_PREHISTORIC) | | 1491 | if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_PREHISTORIC) |
1492 | aprint_normal(" Rev. %d.%d", MIPS_PRID_REV_MAJ(cpu_id), | | 1492 | aprint_normal(" Rev. %d.%d", MIPS_PRID_REV_MAJ(cpu_id), |
1493 | MIPS_PRID_REV_MIN(cpu_id)); | | 1493 | MIPS_PRID_REV_MIN(cpu_id)); |
1494 | else | | 1494 | else |
1495 | aprint_normal(" Rev. %d", MIPS_PRID_REV(cpu_id)); | | 1495 | aprint_normal(" Rev. %d", MIPS_PRID_REV(cpu_id)); |
1496 | | | 1496 | |
1497 | if (fpuname != NULL) | | 1497 | if (fpuname != NULL) |
1498 | aprint_normal(" with %s", fpuname); | | 1498 | aprint_normal(" with %s", fpuname); |
1499 | else | | 1499 | else |
1500 | aprint_normal(" with unknown FPC type (0x%x)", fpu_id); | | 1500 | aprint_normal(" with unknown FPC type (0x%x)", fpu_id); |
1501 | if (opts->mips_fpu_id != 0) { | | 1501 | if (opts->mips_fpu_id != 0) { |
1502 | if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_PREHISTORIC) | | 1502 | if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_PREHISTORIC) |
1503 | aprint_normal(" Rev. %d.%d", MIPS_PRID_REV_MAJ(fpu_id), | | 1503 | aprint_normal(" Rev. %d.%d", MIPS_PRID_REV_MAJ(fpu_id), |
1504 | MIPS_PRID_REV_MIN(fpu_id)); | | 1504 | MIPS_PRID_REV_MIN(fpu_id)); |
1505 | else | | 1505 | else |
1506 | aprint_normal(" Rev. %d", MIPS_PRID_REV(fpu_id)); | | 1506 | aprint_normal(" Rev. %d", MIPS_PRID_REV(fpu_id)); |
1507 | } | | 1507 | } |
1508 | if (opts->mips_cpu_flags & MIPS_HAS_DSP) { | | 1508 | if (opts->mips_cpu_flags & MIPS_HAS_DSP) { |
1509 | aprint_normal(" and DSPv2"); | | 1509 | aprint_normal(" and DSPv2"); |
1510 | } | | 1510 | } |
1511 | aprint_normal("\n"); | | 1511 | aprint_normal("\n"); |
1512 | | | 1512 | |
1513 | if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_PREHISTORIC && | | 1513 | if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_PREHISTORIC && |
1514 | MIPS_PRID_RSVD(cpu_id) != 0) { | | 1514 | MIPS_PRID_RSVD(cpu_id) != 0) { |
1515 | aprint_normal_dev(dev, "NOTE: top 8 bits of prehistoric PRID not 0!\n"); | | 1515 | aprint_normal_dev(dev, "NOTE: top 8 bits of prehistoric PRID not 0!\n"); |
1516 | aprint_normal_dev(dev, "Please mail port-mips@NetBSD.org with %s " | | 1516 | aprint_normal_dev(dev, "Please mail port-mips@NetBSD.org with %s " |
1517 | "dmesg lines.\n", device_xname(dev)); | | 1517 | "dmesg lines.\n", device_xname(dev)); |
1518 | } | | 1518 | } |
1519 | | | 1519 | |
1520 | KASSERT(mci->mci_picache_ways < nwaynames); | | 1520 | KASSERT(mci->mci_picache_ways < nwaynames); |
1521 | KASSERT(mci->mci_pdcache_ways < nwaynames); | | 1521 | KASSERT(mci->mci_pdcache_ways < nwaynames); |
1522 | KASSERT(mci->mci_sicache_ways < nwaynames); | | 1522 | KASSERT(mci->mci_sicache_ways < nwaynames); |
1523 | KASSERT(mci->mci_sdcache_ways < nwaynames); | | 1523 | KASSERT(mci->mci_sdcache_ways < nwaynames); |
1524 | | | 1524 | |
1525 | switch (opts->mips_cpu_arch) { | | 1525 | switch (opts->mips_cpu_arch) { |
1526 | #if defined(MIPS1) | | 1526 | #if defined(MIPS1) |
1527 | case CPU_ARCH_MIPS1: | | 1527 | case CPU_ARCH_MIPS1: |
1528 | if (mci->mci_picache_size) | | 1528 | if (mci->mci_picache_size) |
1529 | aprint_normal_dev(dev, "%dKB/%dB %s Instruction cache, " | | 1529 | aprint_normal_dev(dev, "%dKB/%dB %s Instruction cache, " |
1530 | "%d TLB entries\n", mci->mci_picache_size / 1024, | | 1530 | "%d TLB entries\n", mci->mci_picache_size / 1024, |
1531 | mci->mci_picache_line_size, waynames[mci->mci_picache_ways], | | 1531 | mci->mci_picache_line_size, waynames[mci->mci_picache_ways], |
1532 | opts->mips_num_tlb_entries); | | 1532 | opts->mips_num_tlb_entries); |
1533 | else | | 1533 | else |
1534 | aprint_normal_dev(dev, "%d TLB entries\n", | | 1534 | aprint_normal_dev(dev, "%d TLB entries\n", |
1535 | opts->mips_num_tlb_entries); | | 1535 | opts->mips_num_tlb_entries); |
1536 | if (mci->mci_pdcache_size) | | 1536 | if (mci->mci_pdcache_size) |
1537 | aprint_normal_dev(dev, "%dKB/%dB %s %s Data cache\n", | | 1537 | aprint_normal_dev(dev, "%dKB/%dB %s %s Data cache\n", |
1538 | mci->mci_pdcache_size / 1024, mci->mci_pdcache_line_size, | | 1538 | mci->mci_pdcache_size / 1024, mci->mci_pdcache_line_size, |
1539 | waynames[mci->mci_pdcache_ways], | | 1539 | waynames[mci->mci_pdcache_ways], |
1540 | wtnames[mci->mci_pdcache_write_through]); | | 1540 | wtnames[mci->mci_pdcache_write_through]); |
1541 | break; | | 1541 | break; |
1542 | #endif /* MIPS1 */ | | 1542 | #endif /* MIPS1 */ |
1543 | #if (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 | | 1543 | #if (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 |
1544 | case CPU_ARCH_MIPS3: | | 1544 | case CPU_ARCH_MIPS3: |
1545 | case CPU_ARCH_MIPS4: | | 1545 | case CPU_ARCH_MIPS4: |
1546 | case CPU_ARCH_MIPS32: | | 1546 | case CPU_ARCH_MIPS32: |
1547 | case CPU_ARCH_MIPS32R2: | | 1547 | case CPU_ARCH_MIPS32R2: |
1548 | case CPU_ARCH_MIPS64: | | 1548 | case CPU_ARCH_MIPS64: |
1549 | case CPU_ARCH_MIPS64R2: { | | 1549 | case CPU_ARCH_MIPS64R2: { |
1550 | const char *sufx = "KMGTPE"; | | 1550 | const char *sufx = "KMGTPE"; |
1551 | uint32_t pg_mask; | | 1551 | uint32_t pg_mask; |
1552 | aprint_normal_dev(dev, "%d TLB entries", opts->mips_num_tlb_entries); | | 1552 | aprint_normal_dev(dev, "%d TLB entries", opts->mips_num_tlb_entries); |
1553 | #if !defined(__mips_o32) | | 1553 | #if !defined(__mips_o32) |
1554 | if (CPUIS64BITS) { | | 1554 | if (CPUIS64BITS) { |
1555 | int64_t pfn_mask; | | 1555 | int64_t pfn_mask; |
1556 | i = ffs(~(opts->mips3_tlb_vpn_mask >> 31)) + 30; | | 1556 | i = ffs(~(opts->mips3_tlb_vpn_mask >> 31)) + 30; |
1557 | aprint_normal(", %d%cB (%d-bit) VAs", | | 1557 | aprint_normal(", %d%cB (%d-bit) VAs", |
1558 | 1 << (i % 10), sufx[(i / 10) - 1], i); | | 1558 | 1 << (i % 10), sufx[(i / 10) - 1], i); |
1559 | for (i = 64, pfn_mask = opts->mips3_tlb_pfn_mask << 6; | | 1559 | for (i = 64, pfn_mask = opts->mips3_tlb_pfn_mask << 6; |
1560 | pfn_mask > 0; i--, pfn_mask <<= 1) | | 1560 | pfn_mask > 0; i--, pfn_mask <<= 1) |
1561 | ; | | 1561 | ; |
1562 | aprint_normal(", %d%cB (%d-bit) PAs", | | 1562 | aprint_normal(", %d%cB (%d-bit) PAs", |
1563 | 1 << (i % 10), sufx[(i / 10) - 1], i); | | 1563 | 1 << (i % 10), sufx[(i / 10) - 1], i); |
1564 | } | | 1564 | } |
1565 | #endif | | 1565 | #endif |
1566 | for (i = 4, pg_mask = opts->mips3_tlb_pg_mask >> 13; | | 1566 | for (i = 4, pg_mask = opts->mips3_tlb_pg_mask >> 13; |
1567 | pg_mask != 0; ) { | | 1567 | pg_mask != 0; ) { |
1568 | if ((pg_mask & 3) != 3) | | 1568 | if ((pg_mask & 3) != 3) |
1569 | break; | | 1569 | break; |
1570 | pg_mask >>= 2; | | 1570 | pg_mask >>= 2; |
1571 | i *= 4; | | 1571 | i *= 4; |
1572 | if (i == 1024) { | | 1572 | if (i == 1024) { |
1573 | i = 1; | | 1573 | i = 1; |
1574 | sufx++; | | 1574 | sufx++; |
1575 | } | | 1575 | } |
1576 | } | | 1576 | } |
1577 | aprint_normal(", %d%cB max page size\n", i, sufx[0]); | | 1577 | aprint_normal(", %d%cB max page size\n", i, sufx[0]); |
1578 | if (mci->mci_picache_size) | | 1578 | if (mci->mci_picache_size) |
1579 | aprint_normal_dev(dev, | | 1579 | aprint_normal_dev(dev, |
1580 | "%dKB/%dB %s L1 instruction cache\n", | | 1580 | "%dKB/%dB %s L1 instruction cache\n", |
1581 | mci->mci_picache_size / 1024, | | 1581 | mci->mci_picache_size / 1024, |
1582 | mci->mci_picache_line_size, waynames[mci->mci_picache_ways]); | | 1582 | mci->mci_picache_line_size, waynames[mci->mci_picache_ways]); |
1583 | if (mci->mci_pdcache_size) | | 1583 | if (mci->mci_pdcache_size) |
1584 | aprint_normal_dev(dev, | | 1584 | aprint_normal_dev(dev, |
1585 | "%dKB/%dB %s %s %sL1 data cache\n", | | 1585 | "%dKB/%dB %s %s %sL1 data cache\n", |
1586 | mci->mci_pdcache_size / 1024, mci->mci_pdcache_line_size, | | 1586 | mci->mci_pdcache_size / 1024, mci->mci_pdcache_line_size, |
1587 | waynames[mci->mci_pdcache_ways], | | 1587 | waynames[mci->mci_pdcache_ways], |
1588 | wtnames[mci->mci_pdcache_write_through], | | 1588 | wtnames[mci->mci_pdcache_write_through], |
1589 | ((opts->mips_cpu_flags & CPU_MIPS_D_CACHE_COHERENT) | | 1589 | ((opts->mips_cpu_flags & CPU_MIPS_D_CACHE_COHERENT) |
1590 | ? "coherent " : "")); | | 1590 | ? "coherent " : "")); |
1591 | if (mci->mci_sdcache_line_size) | | 1591 | if (mci->mci_sdcache_line_size) |
1592 | aprint_normal_dev(dev, | | 1592 | aprint_normal_dev(dev, |
1593 | "%dKB/%dB %s %s L2 %s cache\n", | | 1593 | "%dKB/%dB %s %s L2 %s cache\n", |
1594 | mci->mci_sdcache_size / 1024, mci->mci_sdcache_line_size, | | 1594 | mci->mci_sdcache_size / 1024, mci->mci_sdcache_line_size, |
1595 | waynames[mci->mci_sdcache_ways], | | 1595 | waynames[mci->mci_sdcache_ways], |
1596 | wtnames[mci->mci_sdcache_write_through], | | 1596 | wtnames[mci->mci_sdcache_write_through], |
1597 | mci->mci_scache_unified ? "unified" : "data"); | | 1597 | mci->mci_scache_unified ? "unified" : "data"); |
1598 | break; | | 1598 | break; |
1599 | } | | 1599 | } |
1600 | #endif /* (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */ | | 1600 | #endif /* (MIPS3 + MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */ |
1601 | default: | | 1601 | default: |
1602 | panic("cpu_identify: impossible"); | | 1602 | panic("cpu_identify: impossible"); |
1603 | } | | 1603 | } |
1604 | } | | 1604 | } |
1605 | | | 1605 | |
1606 | /* | | 1606 | /* |
1607 | * Set registers on exec. | | 1607 | * Set registers on exec. |
1608 | * Clear all registers except sp, pc, and t9. | | 1608 | * Clear all registers except sp, pc, and t9. |
1609 | * $sp is set to the stack pointer passed in. $pc is set to the entry | | 1609 | * $sp is set to the stack pointer passed in. $pc is set to the entry |
1610 | * point given by the exec_package passed in, as is $t9 (used for PIC | | 1610 | * point given by the exec_package passed in, as is $t9 (used for PIC |
1611 | * code by the MIPS elf abi). | | 1611 | * code by the MIPS elf abi). |
1612 | */ | | 1612 | */ |
1613 | void | | 1613 | void |
1614 | setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack) | | 1614 | setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack) |
1615 | { | | 1615 | { |
1616 | struct trapframe * const tf = l->l_md.md_utf; | | 1616 | struct trapframe * const tf = l->l_md.md_utf; |
1617 | struct proc * const p = l->l_proc; | | 1617 | struct proc * const p = l->l_proc; |
1618 | | | 1618 | |
1619 | memset(tf, 0, sizeof(struct trapframe)); | | 1619 | memset(tf, 0, sizeof(struct trapframe)); |
1620 | tf->tf_regs[_R_SP] = (intptr_t)stack; | | 1620 | tf->tf_regs[_R_SP] = (intptr_t)stack; |
1621 | tf->tf_regs[_R_PC] = (intptr_t)pack->ep_entry & ~3; | | 1621 | tf->tf_regs[_R_PC] = (intptr_t)pack->ep_entry & ~3; |
1622 | tf->tf_regs[_R_T9] = (intptr_t)pack->ep_entry & ~3; /* abicall requirement */ | | 1622 | tf->tf_regs[_R_T9] = (intptr_t)pack->ep_entry & ~3; /* abicall requirement */ |
1623 | tf->tf_regs[_R_SR] = PSL_USERSET; | | 1623 | tf->tf_regs[_R_SR] = PSL_USERSET; |
1624 | #if !defined(__mips_o32) | | 1624 | #if !defined(__mips_o32) |
1625 | /* | | 1625 | /* |
1626 | * allow 64bit ops in userland for non-O32 ABIs | | 1626 | * allow 64bit ops in userland for non-O32 ABIs |
1627 | */ | | 1627 | */ |
1628 | if (p->p_md.md_abi == _MIPS_BSD_API_N32 | | 1628 | if (p->p_md.md_abi == _MIPS_BSD_API_N32 |
1629 | && (CPUISMIPS64 || CPUISMIPS64R2)) { | | 1629 | && (CPUISMIPS64 || CPUISMIPS64R2)) { |
1630 | tf->tf_regs[_R_SR] |= MIPS_SR_PX; | | 1630 | tf->tf_regs[_R_SR] |= MIPS_SR_PX; |
1631 | } else if (p->p_md.md_abi != _MIPS_BSD_API_O32) { | | 1631 | } else if (p->p_md.md_abi != _MIPS_BSD_API_O32) { |
1632 | tf->tf_regs[_R_SR] |= MIPS_SR_UX; | | 1632 | tf->tf_regs[_R_SR] |= MIPS_SR_UX; |
1633 | } | | 1633 | } |
1634 | if (_MIPS_SIM_NEWABI_P(p->p_md.md_abi)) | | 1634 | if (_MIPS_SIM_NEWABI_P(p->p_md.md_abi)) |
1635 | tf->tf_regs[_R_SR] |= MIPS3_SR_FR; | | 1635 | tf->tf_regs[_R_SR] |= MIPS3_SR_FR; |
1636 | #endif | | 1636 | #endif |
1637 | #ifdef _LP64 | | 1637 | #ifdef _LP64 |
1638 | /* | | 1638 | /* |
1639 | * If we are using a 32-bit ABI on a 64-bit kernel, mark the process | | 1639 | * If we are using a 32-bit ABI on a 64-bit kernel, mark the process |
1640 | * that way. If we aren't, clear it. | | 1640 | * that way. If we aren't, clear it. |
1641 | */ | | 1641 | */ |
1642 | if (p->p_md.md_abi == _MIPS_BSD_API_N32 | | 1642 | if (p->p_md.md_abi == _MIPS_BSD_API_N32 |
1643 | || p->p_md.md_abi == _MIPS_BSD_API_O32) { | | 1643 | || p->p_md.md_abi == _MIPS_BSD_API_O32) { |
1644 | p->p_flag |= PK_32; | | 1644 | p->p_flag |= PK_32; |
1645 | } else { | | 1645 | } else { |
1646 | p->p_flag &= ~PK_32; | | 1646 | p->p_flag &= ~PK_32; |
1647 | } | | 1647 | } |
1648 | #endif | | 1648 | #endif |
1649 | /* | | 1649 | /* |
1650 | * Set up arguments for _start(): | | 1650 | * Set up arguments for _start(): |
1651 | * _start(stack, obj, cleanup, ps_strings); | | 1651 | * _start(stack, obj, cleanup, ps_strings); |
1652 | * | | 1652 | * |
1653 | * Notes: | | 1653 | * Notes: |
1654 | * - obj and cleanup are the auxiliary and termination | | 1654 | * - obj and cleanup are the auxiliary and termination |
1655 | * vectors. They are fixed up by ld.elf_so. | | 1655 | * vectors. They are fixed up by ld.elf_so. |
1656 | * - ps_strings is a NetBSD extension. | | 1656 | * - ps_strings is a NetBSD extension. |
1657 | */ | | 1657 | */ |
1658 | tf->tf_regs[_R_A0] = (intptr_t)stack; | | 1658 | tf->tf_regs[_R_A0] = (intptr_t)stack; |
1659 | tf->tf_regs[_R_A1] = 0; | | 1659 | tf->tf_regs[_R_A1] = 0; |
1660 | tf->tf_regs[_R_A2] = 0; | | 1660 | tf->tf_regs[_R_A2] = 0; |
1661 | tf->tf_regs[_R_A3] = p->p_psstrp; | | 1661 | tf->tf_regs[_R_A3] = p->p_psstrp; |
1662 | | | 1662 | |
1663 | l->l_md.md_ss_addr = 0; | | 1663 | l->l_md.md_ss_addr = 0; |
1664 | } | | 1664 | } |
1665 | | | 1665 | |
1666 | #ifdef __HAVE_BOOTINFO_H | | 1666 | #ifdef __HAVE_BOOTINFO_H |
1667 | /* | | 1667 | /* |
1668 | * Machine dependent system variables. | | 1668 | * Machine dependent system variables. |
1669 | */ | | 1669 | */ |
1670 | static int | | 1670 | static int |
1671 | sysctl_machdep_booted_kernel(SYSCTLFN_ARGS) | | 1671 | sysctl_machdep_booted_kernel(SYSCTLFN_ARGS) |
1672 | { | | 1672 | { |
1673 | struct btinfo_bootpath *bibp; | | 1673 | struct btinfo_bootpath *bibp; |
1674 | struct sysctlnode node; | | 1674 | struct sysctlnode node; |
1675 | | | 1675 | |
1676 | bibp = lookup_bootinfo(BTINFO_BOOTPATH); | | 1676 | bibp = lookup_bootinfo(BTINFO_BOOTPATH); |
1677 | if(!bibp) | | 1677 | if(!bibp) |
1678 | return(ENOENT); /* ??? */ | | 1678 | return(ENOENT); /* ??? */ |
1679 | | | 1679 | |
1680 | node = *rnode; | | 1680 | node = *rnode; |
1681 | node.sysctl_data = bibp->bootpath; | | 1681 | node.sysctl_data = bibp->bootpath; |
1682 | node.sysctl_size = sizeof(bibp->bootpath); | | 1682 | node.sysctl_size = sizeof(bibp->bootpath); |
1683 | return (sysctl_lookup(SYSCTLFN_CALL(&node))); | | 1683 | return (sysctl_lookup(SYSCTLFN_CALL(&node))); |
1684 | } | | 1684 | } |
1685 | #endif | | 1685 | #endif |
1686 | | | 1686 | |
1687 | SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup") | | 1687 | SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup") |
1688 | { | | 1688 | { |
1689 | | | 1689 | |
1690 | sysctl_createv(clog, 0, NULL, NULL, | | 1690 | sysctl_createv(clog, 0, NULL, NULL, |
1691 | CTLFLAG_PERMANENT, | | 1691 | CTLFLAG_PERMANENT, |
1692 | CTLTYPE_NODE, "machdep", NULL, | | 1692 | CTLTYPE_NODE, "machdep", NULL, |
1693 | NULL, 0, NULL, 0, | | 1693 | NULL, 0, NULL, 0, |
1694 | CTL_MACHDEP, CTL_EOL); | | 1694 | CTL_MACHDEP, CTL_EOL); |
1695 | | | 1695 | |
1696 | sysctl_createv(clog, 0, NULL, NULL, | | 1696 | sysctl_createv(clog, 0, NULL, NULL, |
1697 | CTLFLAG_PERMANENT, | | 1697 | CTLFLAG_PERMANENT, |
1698 | CTLTYPE_STRUCT, "console_device", NULL, | | 1698 | CTLTYPE_STRUCT, "console_device", NULL, |
1699 | sysctl_consdev, 0, NULL, sizeof(dev_t), | | 1699 | sysctl_consdev, 0, NULL, sizeof(dev_t), |
1700 | CTL_MACHDEP, CPU_CONSDEV, CTL_EOL); | | 1700 | CTL_MACHDEP, CPU_CONSDEV, CTL_EOL); |
1701 | #ifdef __HAVE_BOOTINFO_H | | 1701 | #ifdef __HAVE_BOOTINFO_H |
1702 | sysctl_createv(clog, 0, NULL, NULL, | | 1702 | sysctl_createv(clog, 0, NULL, NULL, |
1703 | CTLFLAG_PERMANENT, | | 1703 | CTLFLAG_PERMANENT, |
1704 | CTLTYPE_STRING, "booted_kernel", NULL, | | 1704 | CTLTYPE_STRING, "booted_kernel", NULL, |
1705 | sysctl_machdep_booted_kernel, 0, NULL, 0, | | 1705 | sysctl_machdep_booted_kernel, 0, NULL, 0, |
1706 | CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL); | | 1706 | CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL); |
1707 | #endif | | 1707 | #endif |
1708 | sysctl_createv(clog, 0, NULL, NULL, | | 1708 | sysctl_createv(clog, 0, NULL, NULL, |
1709 | CTLFLAG_PERMANENT, | | 1709 | CTLFLAG_PERMANENT, |
1710 | CTLTYPE_STRING, "root_device", NULL, | | 1710 | CTLTYPE_STRING, "root_device", NULL, |
1711 | sysctl_root_device, 0, NULL, 0, | | 1711 | sysctl_root_device, 0, NULL, 0, |
1712 | CTL_MACHDEP, CPU_ROOT_DEVICE, CTL_EOL); | | 1712 | CTL_MACHDEP, CPU_ROOT_DEVICE, CTL_EOL); |
1713 | sysctl_createv(clog, 0, NULL, NULL, | | 1713 | sysctl_createv(clog, 0, NULL, NULL, |
1714 | CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, | | 1714 | CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, |
1715 | CTLTYPE_INT, "llsc", NULL, | | 1715 | CTLTYPE_INT, "llsc", NULL, |
1716 | NULL, MIPS_HAS_LLSC, NULL, 0, | | 1716 | NULL, MIPS_HAS_LLSC, NULL, 0, |
1717 | CTL_MACHDEP, CPU_LLSC, CTL_EOL); | | 1717 | CTL_MACHDEP, CPU_LLSC, CTL_EOL); |
1718 | #ifdef MIPS3_LOONGSON2 | | 1718 | #ifdef MIPS3_LOONGSON2 |
1719 | sysctl_createv(clog, 0, NULL, NULL, | | 1719 | sysctl_createv(clog, 0, NULL, NULL, |
1720 | CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, | | 1720 | CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, |
1721 | CTLTYPE_INT, "loongson-mmi", NULL, | | 1721 | CTLTYPE_INT, "loongson-mmi", NULL, |
1722 | NULL, MIPS_HAS_LMMI, NULL, 0, | | 1722 | NULL, MIPS_HAS_LMMI, NULL, 0, |
1723 | CTL_MACHDEP, CPU_LMMI, CTL_EOL); | | 1723 | CTL_MACHDEP, CPU_LMMI, CTL_EOL); |
1724 | #endif | | 1724 | #endif |
1725 | sysctl_createv(clog, 0, NULL, NULL, | | 1725 | sysctl_createv(clog, 0, NULL, NULL, |
1726 | CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, | | 1726 | CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, |
1727 | CTLTYPE_INT, "fpu_present", NULL, | | 1727 | CTLTYPE_INT, "fpu_present", NULL, |
1728 | NULL, | | 1728 | NULL, |
1729 | #ifdef NOFPU | | 1729 | #ifdef NOFPU |
1730 | 0, | | 1730 | 0, |
1731 | #else | | 1731 | #else |
1732 | 1, | | 1732 | 1, |
1733 | #endif | | 1733 | #endif |
1734 | NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); | | 1734 | NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); |
1735 | } | | 1735 | } |
1736 | | | 1736 | |
1737 | /* | | 1737 | /* |
1738 | * These are imported from platform-specific code. | | 1738 | * These are imported from platform-specific code. |
1739 | * XXX Should be declared in a header file. | | 1739 | * XXX Should be declared in a header file. |
1740 | */ | | 1740 | */ |
1741 | extern phys_ram_seg_t mem_clusters[]; | | 1741 | extern phys_ram_seg_t mem_clusters[]; |
1742 | extern int mem_cluster_cnt; | | 1742 | extern int mem_cluster_cnt; |
1743 | | | 1743 | |
1744 | /* | | 1744 | /* |
1745 | * These variables are needed by /sbin/savecore. | | 1745 | * These variables are needed by /sbin/savecore. |
1746 | */ | | 1746 | */ |
1747 | u_int32_t dumpmag = 0x8fca0101; /* magic number */ | | 1747 | u_int32_t dumpmag = 0x8fca0101; /* magic number */ |
1748 | int dumpsize = 0; /* pages */ | | 1748 | int dumpsize = 0; /* pages */ |
1749 | long dumplo = 0; /* blocks */ | | 1749 | long dumplo = 0; /* blocks */ |
1750 | | | 1750 | |
1751 | #if 0 | | 1751 | #if 0 |
1752 | struct pcb dumppcb; | | 1752 | struct pcb dumppcb; |
1753 | #endif | | 1753 | #endif |
1754 | | | 1754 | |
1755 | /* | | 1755 | /* |
1756 | * cpu_dumpsize: calculate size of machine-dependent kernel core dump headers. | | 1756 | * cpu_dumpsize: calculate size of machine-dependent kernel core dump headers. |
1757 | */ | | 1757 | */ |
1758 | int | | 1758 | int |
1759 | cpu_dumpsize(void) | | 1759 | cpu_dumpsize(void) |
1760 | { | | 1760 | { |
1761 | int size; | | 1761 | int size; |
1762 | | | 1762 | |
1763 | size = ALIGN(sizeof(kcore_seg_t)) + ALIGN(sizeof(cpu_kcore_hdr_t)) + | | 1763 | size = ALIGN(sizeof(kcore_seg_t)) + ALIGN(sizeof(cpu_kcore_hdr_t)) + |
1764 | ALIGN(mem_cluster_cnt * sizeof(phys_ram_seg_t)); | | 1764 | ALIGN(mem_cluster_cnt * sizeof(phys_ram_seg_t)); |
1765 | if (roundup(size, dbtob(1)) != dbtob(1)) | | 1765 | if (roundup(size, dbtob(1)) != dbtob(1)) |
1766 | return (-1); | | 1766 | return (-1); |
1767 | | | 1767 | |
1768 | return (1); | | 1768 | return (1); |
1769 | } | | 1769 | } |
1770 | | | 1770 | |
1771 | /* | | 1771 | /* |
1772 | * cpu_dump_mempagecnt: calculate size of RAM (in pages) to be dumped. | | 1772 | * cpu_dump_mempagecnt: calculate size of RAM (in pages) to be dumped. |
1773 | */ | | 1773 | */ |
1774 | u_long | | 1774 | u_long |
1775 | cpu_dump_mempagecnt(void) | | 1775 | cpu_dump_mempagecnt(void) |
1776 | { | | 1776 | { |
1777 | u_long i, n; | | 1777 | u_long i, n; |
1778 | | | 1778 | |
1779 | n = 0; | | 1779 | n = 0; |
1780 | for (i = 0; i < mem_cluster_cnt; i++) | | 1780 | for (i = 0; i < mem_cluster_cnt; i++) |
1781 | n += atop(mem_clusters[i].size); | | 1781 | n += atop(mem_clusters[i].size); |
1782 | return (n); | | 1782 | return (n); |
1783 | } | | 1783 | } |
1784 | | | 1784 | |
1785 | /* | | 1785 | /* |
1786 | * cpu_dump: dump machine-dependent kernel core dump headers. | | 1786 | * cpu_dump: dump machine-dependent kernel core dump headers. |
1787 | */ | | 1787 | */ |
1788 | int | | 1788 | int |
1789 | cpu_dump(void) | | 1789 | cpu_dump(void) |
1790 | { | | 1790 | { |
1791 | int (*dump)(dev_t, daddr_t, void *, size_t); | | 1791 | int (*dump)(dev_t, daddr_t, void *, size_t); |
1792 | char buf[dbtob(1)]; | | 1792 | char buf[dbtob(1)]; |
1793 | kcore_seg_t *segp; | | 1793 | kcore_seg_t *segp; |
1794 | cpu_kcore_hdr_t *cpuhdrp; | | 1794 | cpu_kcore_hdr_t *cpuhdrp; |
1795 | phys_ram_seg_t *memsegp; | | 1795 | phys_ram_seg_t *memsegp; |
1796 | const struct bdevsw *bdev; | | 1796 | const struct bdevsw *bdev; |
1797 | int i; | | 1797 | int i; |
1798 | | | 1798 | |
1799 | bdev = bdevsw_lookup(dumpdev); | | 1799 | bdev = bdevsw_lookup(dumpdev); |
1800 | if (bdev == NULL) | | 1800 | if (bdev == NULL) |
1801 | return (ENXIO); | | 1801 | return (ENXIO); |
1802 | | | 1802 | |
1803 | dump = bdev->d_dump; | | 1803 | dump = bdev->d_dump; |
1804 | | | 1804 | |
1805 | memset(buf, 0, sizeof buf); | | 1805 | memset(buf, 0, sizeof buf); |
1806 | segp = (kcore_seg_t *)buf; | | 1806 | segp = (kcore_seg_t *)buf; |
1807 | cpuhdrp = (cpu_kcore_hdr_t *)&buf[ALIGN(sizeof(*segp))]; | | 1807 | cpuhdrp = (cpu_kcore_hdr_t *)&buf[ALIGN(sizeof(*segp))]; |
1808 | memsegp = (phys_ram_seg_t *)&buf[ ALIGN(sizeof(*segp)) + | | 1808 | memsegp = (phys_ram_seg_t *)&buf[ ALIGN(sizeof(*segp)) + |
1809 | ALIGN(sizeof(*cpuhdrp))]; | | 1809 | ALIGN(sizeof(*cpuhdrp))]; |
1810 | | | 1810 | |
1811 | /* | | 1811 | /* |
1812 | * Generate a segment header. | | 1812 | * Generate a segment header. |
1813 | */ | | 1813 | */ |
1814 | CORE_SETMAGIC(*segp, KCORE_MAGIC, MID_MACHINE, CORE_CPU); | | 1814 | CORE_SETMAGIC(*segp, KCORE_MAGIC, MID_MACHINE, CORE_CPU); |
1815 | segp->c_size = dbtob(1) - ALIGN(sizeof(*segp)); | | 1815 | segp->c_size = dbtob(1) - ALIGN(sizeof(*segp)); |
1816 | | | 1816 | |
1817 | /* | | 1817 | /* |
1818 | * Add the machine-dependent header info. | | 1818 | * Add the machine-dependent header info. |
1819 | */ | | 1819 | */ |
1820 | if (MIPS_HAS_R4K_MMU) { | | 1820 | if (MIPS_HAS_R4K_MMU) { |
1821 | cpuhdrp->archlevel = 3; | | 1821 | cpuhdrp->archlevel = 3; |
1822 | cpuhdrp->pg_shift = MIPS3_PG_SHIFT; | | 1822 | cpuhdrp->pg_shift = MIPS3_PG_SHIFT; |
1823 | cpuhdrp->pg_frame = MIPS3_PG_FRAME; | | 1823 | cpuhdrp->pg_frame = MIPS3_PG_FRAME; |
1824 | cpuhdrp->pg_v = MIPS3_PG_V; | | 1824 | cpuhdrp->pg_v = MIPS3_PG_V; |
1825 | } else { | | 1825 | } else { |
1826 | cpuhdrp->archlevel = 1; | | 1826 | cpuhdrp->archlevel = 1; |
1827 | cpuhdrp->pg_shift = MIPS1_PG_SHIFT; | | 1827 | cpuhdrp->pg_shift = MIPS1_PG_SHIFT; |
1828 | cpuhdrp->pg_frame = MIPS1_PG_FRAME; | | 1828 | cpuhdrp->pg_frame = MIPS1_PG_FRAME; |
1829 | cpuhdrp->pg_v = MIPS1_PG_V; | | 1829 | cpuhdrp->pg_v = MIPS1_PG_V; |
1830 | } | | 1830 | } |
1831 | cpuhdrp->sysmappa = MIPS_KSEG0_TO_PHYS(curcpu()->ci_pmap_kern_segtab); | | 1831 | cpuhdrp->sysmappa = MIPS_KSEG0_TO_PHYS(curcpu()->ci_pmap_kern_segtab); |
1832 | cpuhdrp->nmemsegs = mem_cluster_cnt; | | 1832 | cpuhdrp->nmemsegs = mem_cluster_cnt; |
1833 | | | 1833 | |
1834 | /* | | 1834 | /* |
1835 | * Fill in the memory segment descriptors. | | 1835 | * Fill in the memory segment descriptors. |
1836 | */ | | 1836 | */ |
1837 | for (i = 0; i < mem_cluster_cnt; i++) { | | 1837 | for (i = 0; i < mem_cluster_cnt; i++) { |
1838 | memsegp[i].start = mem_clusters[i].start; | | 1838 | memsegp[i].start = mem_clusters[i].start; |
1839 | memsegp[i].size = mem_clusters[i].size; | | 1839 | memsegp[i].size = mem_clusters[i].size; |
1840 | } | | 1840 | } |
1841 | | | 1841 | |
1842 | return (dump(dumpdev, dumplo, (void *)buf, dbtob(1))); | | 1842 | return (dump(dumpdev, dumplo, (void *)buf, dbtob(1))); |
1843 | } | | 1843 | } |
1844 | | | 1844 | |
1845 | /* | | 1845 | /* |
1846 | * This is called by main to set dumplo and dumpsize. | | 1846 | * This is called by main to set dumplo and dumpsize. |
1847 | * Dumps always skip the first CLBYTES of disk space | | 1847 | * Dumps always skip the first CLBYTES of disk space |
1848 | * in case there might be a disk label stored there. | | 1848 | * in case there might be a disk label stored there. |
1849 | * If there is extra space, put dump at the end to | | 1849 | * If there is extra space, put dump at the end to |
1850 | * reduce the chance that swapping trashes it. | | 1850 | * reduce the chance that swapping trashes it. |
1851 | */ | | 1851 | */ |
1852 | void | | 1852 | void |
1853 | cpu_dumpconf(void) | | 1853 | cpu_dumpconf(void) |
1854 | { | | 1854 | { |
1855 | int nblks, dumpblks; /* size of dump area */ | | 1855 | int nblks, dumpblks; /* size of dump area */ |
1856 | | | 1856 | |
1857 | if (dumpdev == NODEV) | | 1857 | if (dumpdev == NODEV) |
1858 | goto bad; | | 1858 | goto bad; |
1859 | nblks = bdev_size(dumpdev); | | 1859 | nblks = bdev_size(dumpdev); |
1860 | if (nblks <= ctod(1)) | | 1860 | if (nblks <= ctod(1)) |
1861 | goto bad; | | 1861 | goto bad; |
1862 | | | 1862 | |
1863 | dumpblks = cpu_dumpsize(); | | 1863 | dumpblks = cpu_dumpsize(); |
1864 | if (dumpblks < 0) | | 1864 | if (dumpblks < 0) |
1865 | goto bad; | | 1865 | goto bad; |
1866 | dumpblks += ctod(cpu_dump_mempagecnt()); | | 1866 | dumpblks += ctod(cpu_dump_mempagecnt()); |
1867 | | | 1867 | |
1868 | /* If dump won't fit (incl. room for possible label), punt. */ | | 1868 | /* If dump won't fit (incl. room for possible label), punt. */ |
1869 | if (dumpblks > (nblks - ctod(1))) | | 1869 | if (dumpblks > (nblks - ctod(1))) |
1870 | goto bad; | | 1870 | goto bad; |
1871 | | | 1871 | |
1872 | /* Put dump at end of partition */ | | 1872 | /* Put dump at end of partition */ |
1873 | dumplo = nblks - dumpblks; | | 1873 | dumplo = nblks - dumpblks; |
1874 | | | 1874 | |
1875 | /* dumpsize is in page units, and doesn't include headers. */ | | 1875 | /* dumpsize is in page units, and doesn't include headers. */ |
1876 | dumpsize = cpu_dump_mempagecnt(); | | 1876 | dumpsize = cpu_dump_mempagecnt(); |
1877 | return; | | 1877 | return; |
1878 | | | 1878 | |
1879 | bad: | | 1879 | bad: |
1880 | dumpsize = 0; | | 1880 | dumpsize = 0; |
1881 | } | | 1881 | } |
1882 | | | 1882 | |
1883 | /* | | 1883 | /* |
1884 | * Dump the kernel's image to the swap partition. | | 1884 | * Dump the kernel's image to the swap partition. |
1885 | */ | | 1885 | */ |
1886 | #define BYTES_PER_DUMP PAGE_SIZE | | 1886 | #define BYTES_PER_DUMP PAGE_SIZE |
1887 | | | 1887 | |
1888 | void | | 1888 | void |
1889 | dumpsys(void) | | 1889 | dumpsys(void) |
1890 | { | | 1890 | { |
1891 | u_long totalbytesleft, bytes, i, n, memcl; | | 1891 | u_long totalbytesleft, bytes, i, n, memcl; |
1892 | u_long maddr; | | 1892 | u_long maddr; |
1893 | int psize; | | 1893 | int psize; |
1894 | daddr_t blkno; | | 1894 | daddr_t blkno; |
1895 | const struct bdevsw *bdev; | | 1895 | const struct bdevsw *bdev; |
1896 | int (*dump)(dev_t, daddr_t, void *, size_t); | | 1896 | int (*dump)(dev_t, daddr_t, void *, size_t); |
1897 | int error; | | 1897 | int error; |
1898 | | | 1898 | |
1899 | #if 0 | | 1899 | #if 0 |
1900 | /* Save registers. */ | | 1900 | /* Save registers. */ |
1901 | savectx(&dumppcb); | | 1901 | savectx(&dumppcb); |
1902 | #endif | | 1902 | #endif |
1903 | | | 1903 | |
1904 | if (dumpdev == NODEV) | | 1904 | if (dumpdev == NODEV) |
1905 | return; | | 1905 | return; |
1906 | bdev = bdevsw_lookup(dumpdev); | | 1906 | bdev = bdevsw_lookup(dumpdev); |
1907 | if (bdev == NULL || bdev->d_psize == NULL) | | 1907 | if (bdev == NULL || bdev->d_psize == NULL) |
1908 | return; | | 1908 | return; |
1909 | | | 1909 | |
1910 | /* | | 1910 | /* |
1911 | * For dumps during autoconfiguration, | | 1911 | * For dumps during autoconfiguration, |
1912 | * if dump device has already configured... | | 1912 | * if dump device has already configured... |
1913 | */ | | 1913 | */ |
1914 | if (dumpsize == 0) | | 1914 | if (dumpsize == 0) |
1915 | cpu_dumpconf(); | | 1915 | cpu_dumpconf(); |
1916 | if (dumplo <= 0) { | | 1916 | if (dumplo <= 0) { |
1917 | printf("\ndump to dev %u,%u not possible\n", major(dumpdev), | | 1917 | printf("\ndump to dev %u,%u not possible\n", major(dumpdev), |
1918 | minor(dumpdev)); | | 1918 | minor(dumpdev)); |
1919 | return; | | 1919 | return; |
1920 | } | | 1920 | } |
1921 | printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev), | | 1921 | printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev), |
1922 | minor(dumpdev), dumplo); | | 1922 | minor(dumpdev), dumplo); |
1923 | | | 1923 | |
1924 | psize = bdev_size(dumpdev); | | 1924 | psize = bdev_size(dumpdev); |
1925 | printf("dump "); | | 1925 | printf("dump "); |
1926 | if (psize == -1) { | | 1926 | if (psize == -1) { |
1927 | printf("area unavailable\n"); | | 1927 | printf("area unavailable\n"); |
1928 | return; | | 1928 | return; |
1929 | } | | 1929 | } |
1930 | | | 1930 | |
1931 | /* XXX should purge all outstanding keystrokes. */ | | 1931 | /* XXX should purge all outstanding keystrokes. */ |
1932 | | | 1932 | |
1933 | if ((error = cpu_dump()) != 0) | | 1933 | if ((error = cpu_dump()) != 0) |
1934 | goto err; | | 1934 | goto err; |
1935 | | | 1935 | |
1936 | totalbytesleft = ptoa(cpu_dump_mempagecnt()); | | 1936 | totalbytesleft = ptoa(cpu_dump_mempagecnt()); |
1937 | blkno = dumplo + cpu_dumpsize(); | | 1937 | blkno = dumplo + cpu_dumpsize(); |
1938 | dump = bdev->d_dump; | | 1938 | dump = bdev->d_dump; |
1939 | error = 0; | | 1939 | error = 0; |
1940 | | | 1940 | |
1941 | for (memcl = 0; memcl < mem_cluster_cnt; memcl++) { | | 1941 | for (memcl = 0; memcl < mem_cluster_cnt; memcl++) { |
1942 | maddr = mem_clusters[memcl].start; | | 1942 | maddr = mem_clusters[memcl].start; |
1943 | bytes = mem_clusters[memcl].size; | | 1943 | bytes = mem_clusters[memcl].size; |
1944 | | | 1944 | |
1945 | for (i = 0; i < bytes; i += n, totalbytesleft -= n) { | | 1945 | for (i = 0; i < bytes; i += n, totalbytesleft -= n) { |
1946 | void *maddr_va; | | 1946 | void *maddr_va; |
1947 | | | 1947 | |
1948 | /* Print out how many MBs we have left to go. */ | | 1948 | /* Print out how many MBs we have left to go. */ |
1949 | if ((totalbytesleft % (1024*1024)) == 0) | | 1949 | if ((totalbytesleft % (1024*1024)) == 0) |
1950 | printf_nolog("%ld ", | | 1950 | printf_nolog("%ld ", |
1951 | totalbytesleft / (1024 * 1024)); | | 1951 | totalbytesleft / (1024 * 1024)); |
1952 | | | 1952 | |
1953 | /* Limit size for next transfer. */ | | 1953 | /* Limit size for next transfer. */ |
1954 | n = bytes - i; | | 1954 | n = bytes - i; |
1955 | if (n > BYTES_PER_DUMP) | | 1955 | if (n > BYTES_PER_DUMP) |
1956 | n = BYTES_PER_DUMP; | | 1956 | n = BYTES_PER_DUMP; |
1957 | | | 1957 | |
1958 | #ifdef _LP64 | | 1958 | #ifdef _LP64 |
1959 | maddr_va = (void *)MIPS_PHYS_TO_XKPHYS_CACHED(maddr); | | 1959 | maddr_va = (void *)MIPS_PHYS_TO_XKPHYS_CACHED(maddr); |
1960 | #else | | 1960 | #else |
1961 | maddr_va = (void *)MIPS_PHYS_TO_KSEG0(maddr); | | 1961 | maddr_va = (void *)MIPS_PHYS_TO_KSEG0(maddr); |
1962 | #endif | | 1962 | #endif |
1963 | error = (*dump)(dumpdev, blkno, maddr_va, n); | | 1963 | error = (*dump)(dumpdev, blkno, maddr_va, n); |
1964 | if (error) | | 1964 | if (error) |
1965 | goto err; | | 1965 | goto err; |
1966 | maddr += n; | | 1966 | maddr += n; |
1967 | blkno += btodb(n); /* XXX? */ | | 1967 | blkno += btodb(n); /* XXX? */ |
1968 | | | 1968 | |
1969 | /* XXX should look for keystrokes, to cancel. */ | | 1969 | /* XXX should look for keystrokes, to cancel. */ |
1970 | } | | 1970 | } |
1971 | } | | 1971 | } |
1972 | | | 1972 | |
1973 | err: | | 1973 | err: |
1974 | switch (error) { | | 1974 | switch (error) { |
1975 | | | 1975 | |
1976 | case ENXIO: | | 1976 | case ENXIO: |
1977 | printf("device bad\n"); | | 1977 | printf("device bad\n"); |
1978 | break; | | 1978 | break; |
1979 | | | 1979 | |
1980 | case EFAULT: | | 1980 | case EFAULT: |
1981 | printf("device not ready\n"); | | 1981 | printf("device not ready\n"); |
1982 | break; | | 1982 | break; |
1983 | | | 1983 | |
1984 | case EINVAL: | | 1984 | case EINVAL: |
1985 | printf("area improper\n"); | | 1985 | printf("area improper\n"); |
1986 | break; | | 1986 | break; |
1987 | | | 1987 | |
1988 | case EIO: | | 1988 | case EIO: |
1989 | printf("i/o error\n"); | | 1989 | printf("i/o error\n"); |
1990 | break; | | 1990 | break; |
1991 | | | 1991 | |
1992 | case EINTR: | | 1992 | case EINTR: |
1993 | printf("aborted from console\n"); | | 1993 | printf("aborted from console\n"); |
1994 | break; | | 1994 | break; |
1995 | | | 1995 | |
1996 | case 0: | | 1996 | case 0: |
1997 | printf("succeeded\n"); | | 1997 | printf("succeeded\n"); |
1998 | break; | | 1998 | break; |
1999 | | | 1999 | |
2000 | default: | | 2000 | default: |
2001 | printf("error %d\n", error); | | 2001 | printf("error %d\n", error); |
2002 | break; | | 2002 | break; |
2003 | } | | 2003 | } |
2004 | printf("\n\n"); | | 2004 | printf("\n\n"); |
2005 | delay(5000000); /* 5 seconds */ | | 2005 | delay(5000000); /* 5 seconds */ |
2006 | } | | 2006 | } |
2007 | | | 2007 | |
2008 | void | | 2008 | void |
2009 | mips_init_msgbuf(void) | | 2009 | mips_init_msgbuf(void) |
2010 | { | | 2010 | { |
2011 | vsize_t sz = (vsize_t)round_page(MSGBUFSIZE); | | 2011 | vsize_t sz = (vsize_t)round_page(MSGBUFSIZE); |
2012 | vsize_t reqsz = sz; | | 2012 | vsize_t reqsz = sz; |
2013 | uvm_physseg_t bank = uvm_physseg_get_last(); | | 2013 | uvm_physseg_t bank = uvm_physseg_get_last(); |
2014 | #ifndef _LP64 | | 2014 | #ifndef _LP64 |
2015 | /* | | 2015 | /* |
2016 | * Fist the physical segment that can be mapped to KSEG0 | | 2016 | * Fist the physical segment that can be mapped to KSEG0 |
2017 | */ | | 2017 | */ |
2018 | for (; uvm_physseg_valid_p(bank); bank = uvm_physseg_get_prev(bank)) { | | 2018 | for (; uvm_physseg_valid_p(bank); bank = uvm_physseg_get_prev(bank)) { |
2019 | if (uvm_physseg_get_avail_start(bank) + atop(sz) <= atop(MIPS_PHYS_MASK)) | | 2019 | if (uvm_physseg_get_avail_start(bank) + atop(sz) <= atop(MIPS_PHYS_MASK)) |
2020 | break; | | 2020 | break; |
2021 | } | | 2021 | } |
2022 | #endif | | 2022 | #endif |
2023 | | | 2023 | |
2024 | paddr_t start = uvm_physseg_get_start(bank); | | 2024 | paddr_t start = uvm_physseg_get_start(bank); |
2025 | paddr_t end = uvm_physseg_get_end(bank); | | 2025 | paddr_t end = uvm_physseg_get_end(bank); |
2026 | | | 2026 | |
2027 | /* shrink so that it'll fit in the last segment */ | | 2027 | /* shrink so that it'll fit in the last segment */ |
2028 | if ((end - start) < atop(sz)) | | 2028 | if ((end - start) < atop(sz)) |
2029 | sz = ptoa(end - start); | | 2029 | sz = ptoa(end - start); |
2030 | | | 2030 | |
2031 | end -= atop(sz); | | 2031 | end -= atop(sz); |
2032 | uvm_physseg_unplug(end, atop(sz)); | | 2032 | uvm_physseg_unplug(end, atop(sz)); |
2033 | | | 2033 | |
2034 | #ifdef _LP64 | | 2034 | #ifdef _LP64 |
2035 | msgbufaddr = (void *) MIPS_PHYS_TO_XKPHYS_CACHED(ptoa(end)); | | 2035 | msgbufaddr = (void *) MIPS_PHYS_TO_XKPHYS_CACHED(ptoa(end)); |
2036 | #else | | 2036 | #else |
2037 | msgbufaddr = (void *) MIPS_PHYS_TO_KSEG0(ptoa(end)); | | 2037 | msgbufaddr = (void *) MIPS_PHYS_TO_KSEG0(ptoa(end)); |
2038 | #endif | | 2038 | #endif |
2039 | initmsgbuf(msgbufaddr, sz); | | 2039 | initmsgbuf(msgbufaddr, sz); |
2040 | | | 2040 | |
2041 | /* warn if the message buffer had to be shrunk */ | | 2041 | /* warn if the message buffer had to be shrunk */ |
2042 | if (sz != reqsz) | | 2042 | if (sz != reqsz) |
2043 | printf("WARNING: %"PRIdVSIZE" bytes not available for msgbuf " | | 2043 | printf("WARNING: %"PRIdVSIZE" bytes not available for msgbuf " |
2044 | "in last cluster (%"PRIdVSIZE" used)\n", reqsz, sz); | | 2044 | "in last cluster (%"PRIdVSIZE" used)\n", reqsz, sz); |
2045 | } | | 2045 | } |
2046 | | | 2046 | |
2047 | void | | 2047 | void |
2048 | mips_init_lwp0_uarea(void) | | 2048 | mips_init_lwp0_uarea(void) |
2049 | { | | 2049 | { |
2050 | struct lwp * const l = &lwp0; | | 2050 | struct lwp * const l = &lwp0; |
2051 | vaddr_t v; | | 2051 | vaddr_t v; |
2052 | | | 2052 | |
2053 | if (l->l_addr == NULL) { | | 2053 | if (l->l_addr == NULL) { |
2054 | v = uvm_pageboot_alloc(USPACE); | | 2054 | v = uvm_pageboot_alloc(USPACE); |
2055 | uvm_lwp_setuarea(&lwp0, v); | | 2055 | uvm_lwp_setuarea(&lwp0, v); |
2056 | } else { | | 2056 | } else { |
2057 | v = (vaddr_t)l->l_addr; | | 2057 | v = (vaddr_t)l->l_addr; |
2058 | } | | 2058 | } |
2059 | | | 2059 | |
2060 | l->l_md.md_utf = (struct trapframe *)(v + USPACE) - 1; | | 2060 | l->l_md.md_utf = (struct trapframe *)(v + USPACE) - 1; |
2061 | struct pcb * const pcb = lwp_getpcb(l); | | 2061 | struct pcb * const pcb = lwp_getpcb(l); |
2062 | /* | | 2062 | /* |
2063 | * Now zero out the only two areas of the uarea that we care about. | | 2063 | * Now zero out the only two areas of the uarea that we care about. |
2064 | */ | | 2064 | */ |
2065 | memset(l->l_md.md_utf, 0, sizeof(*l->l_md.md_utf)); | | 2065 | memset(l->l_md.md_utf, 0, sizeof(*l->l_md.md_utf)); |
2066 | memset(pcb, 0, sizeof(*pcb)); | | 2066 | memset(pcb, 0, sizeof(*pcb)); |
2067 | | | 2067 | |
2068 | pcb->pcb_context.val[_L_SR] = MIPS_SR_INT_IE | | 2068 | pcb->pcb_context.val[_L_SR] = MIPS_SR_INT_IE |
2069 | | (ipl_sr_map.sr_bits[IPL_SCHED] ^ MIPS_INT_MASK); | | 2069 | | (ipl_sr_map.sr_bits[IPL_SCHED] ^ MIPS_INT_MASK); |
2070 | #ifdef __mips_n32 | | 2070 | #ifdef __mips_n32 |
2071 | pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX; | | 2071 | pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX; |
2072 | l->l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX; | | 2072 | l->l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX; |
2073 | #endif | | 2073 | #endif |
2074 | #ifdef _LP64 | | 2074 | #ifdef _LP64 |
2075 | pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX | MIPS_SR_UX; | | 2075 | pcb->pcb_context.val[_L_SR] |= MIPS_SR_KX | MIPS_SR_UX; |
2076 | l->l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX | MIPS_SR_UX; | | 2076 | l->l_md.md_utf->tf_regs[_R_SR] = MIPS_SR_KX | MIPS_SR_UX; |
2077 | #endif | | 2077 | #endif |
2078 | } | | 2078 | } |
2079 | | | 2079 | |
2080 | int mips_poolpage_vmfreelist = VM_FREELIST_DEFAULT; | | 2080 | int mips_poolpage_vmfreelist = VM_FREELIST_DEFAULT; |
2081 | | | 2081 | |
2082 | #define HALFGIG ((paddr_t)512 * 1024 * 1024) | | 2082 | #define HALFGIG ((paddr_t)512 * 1024 * 1024) |
2083 | #define FOURGIG ((paddr_t)4 * 1024 * 1024 * 1024) | | 2083 | #define FOURGIG ((paddr_t)4 * 1024 * 1024 * 1024) |
2084 | | | 2084 | |
2085 | void | | 2085 | void |
2086 | mips_page_physload(vaddr_t vkernstart, vaddr_t vkernend, | | 2086 | mips_page_physload(vaddr_t vkernstart, vaddr_t vkernend, |
2087 | const phys_ram_seg_t *segs, size_t nseg, | | 2087 | const phys_ram_seg_t *segs, size_t nseg, |
2088 | const struct mips_vmfreelist *flp, size_t nfl) | | 2088 | const struct mips_vmfreelist *flp, size_t nfl) |
2089 | { | | 2089 | { |
2090 | const paddr_t kernstart = MIPS_KSEG0_TO_PHYS(trunc_page(vkernstart)); | | 2090 | const paddr_t kernstart = MIPS_KSEG0_TO_PHYS(trunc_page(vkernstart)); |
2091 | const paddr_t kernend = MIPS_KSEG0_TO_PHYS(round_page(vkernend)); | | 2091 | const paddr_t kernend = MIPS_KSEG0_TO_PHYS(round_page(vkernend)); |
2092 | #if defined(VM_FREELIST_FIRST4G) || defined(VM_FREELIST_FIRST512M) | | 2092 | #if defined(VM_FREELIST_FIRST4G) || defined(VM_FREELIST_FIRST512M) |
2093 | #ifdef VM_FREELIST_FIRST512M | | 2093 | #ifdef VM_FREELIST_FIRST512M |
2094 | bool need512m = false; | | 2094 | bool need512m = false; |
2095 | #endif | | 2095 | #endif |
2096 | #ifdef VM_FREELIST_FIRST4G | | 2096 | #ifdef VM_FREELIST_FIRST4G |
2097 | bool need4g = false; | | 2097 | bool need4g = false; |
2098 | #endif | | 2098 | #endif |
2099 | | | 2099 | |
2100 | /* | | 2100 | /* |
2101 | * Do a first pass and see what ranges memory we have to deal with. | | 2101 | * Do a first pass and see what ranges memory we have to deal with. |
2102 | */ | | 2102 | */ |
2103 | for (size_t i = 0; i < nseg; i++) { | | 2103 | for (size_t i = 0; i < nseg; i++) { |
2104 | #ifdef VM_FREELIST_FIRST4G | | 2104 | #ifdef VM_FREELIST_FIRST4G |
2105 | if (round_page(segs[i].start + segs[i].size) > FOURGIG) { | | 2105 | if (round_page(segs[i].start + segs[i].size) > FOURGIG) { |
2106 | need4g = true; | | 2106 | need4g = true; |
2107 | mips_poolpage_vmfreelist = VM_FREELIST_FIRST4G; | | | |
2108 | } | | 2107 | } |
2109 | #endif | | 2108 | #endif |
2110 | #ifdef VM_FREELIST_FIRST512M | | 2109 | #ifdef VM_FREELIST_FIRST512M |
2111 | if (round_page(segs[i].start + segs[i].size) > HALFGIG) { | | 2110 | if (round_page(segs[i].start + segs[i].size) > HALFGIG) { |
2112 | need512m = true; | | 2111 | need512m = true; |
| | | 2112 | #if !defined(_LP64) |
2113 | mips_poolpage_vmfreelist = VM_FREELIST_FIRST512M; | | 2113 | mips_poolpage_vmfreelist = VM_FREELIST_FIRST512M; |
| | | 2114 | #endif |
2114 | } | | 2115 | } |
2115 | #endif | | 2116 | #endif |
2116 | } | | 2117 | } |
2117 | #endif /* VM_FREELIST_FIRST512M || VM_FREELIST_FIRST4G */ | | 2118 | #endif /* VM_FREELIST_FIRST512M || VM_FREELIST_FIRST4G */ |
2118 | | | 2119 | |
2119 | for (; nseg-- > 0; segs++) { | | 2120 | for (; nseg-- > 0; segs++) { |
2120 | /* | | 2121 | /* |
2121 | * Make sure everything is in page units. | | 2122 | * Make sure everything is in page units. |
2122 | */ | | 2123 | */ |
2123 | paddr_t segstart = round_page(segs->start); | | 2124 | paddr_t segstart = round_page(segs->start); |
2124 | const paddr_t segfinish = trunc_page(segs->start + segs->size); | | 2125 | const paddr_t segfinish = trunc_page(segs->start + segs->size); |
2125 | | | 2126 | |
2126 | printf("phys segment: %#"PRIxPADDR" @ %#"PRIxPADDR"\n", | | 2127 | printf("phys segment: %#"PRIxPADDR" @ %#"PRIxPADDR"\n", |
2127 | segfinish - segstart, segstart); | | 2128 | segfinish - segstart, segstart); |
2128 | | | 2129 | |
2129 | /* | | 2130 | /* |
2130 | * Page 0 is reserved for exception vectors. | | 2131 | * Page 0 is reserved for exception vectors. |
2131 | */ | | 2132 | */ |
2132 | if (segstart == 0) { | | 2133 | if (segstart == 0) { |
2133 | segstart = PAGE_SIZE; | | 2134 | segstart = PAGE_SIZE; |
2134 | } | | 2135 | } |
2135 | while (segstart < segfinish) { | | 2136 | while (segstart < segfinish) { |
2136 | int freelist = -1; /* unknown freelist */ | | 2137 | int freelist = -1; /* unknown freelist */ |
2137 | paddr_t segend = segfinish; | | 2138 | paddr_t segend = segfinish; |
2138 | for (size_t i = 0; i < nfl; i++) { | | 2139 | for (size_t i = 0; i < nfl; i++) { |
2139 | /* | | 2140 | /* |
2140 | * If this segment doesn't overlap the freelist | | 2141 | * If this segment doesn't overlap the freelist |
2141 | * at all, skip it. | | 2142 | * at all, skip it. |
2142 | */ | | 2143 | */ |
2143 | if (segstart >= flp[i].fl_end | | 2144 | if (segstart >= flp[i].fl_end |
2144 | || segend <= flp[i].fl_start) | | 2145 | || segend <= flp[i].fl_start) |
2145 | continue; | | 2146 | continue; |
2146 | /* | | 2147 | /* |
2147 | * If the start of this segment starts before | | 2148 | * If the start of this segment starts before |
2148 | * the start of the freelist, then limit the | | 2149 | * the start of the freelist, then limit the |
2149 | * segment to loaded to the part that doesn't | | 2150 | * segment to loaded to the part that doesn't |
2150 | * match this freelist and fall back to normal | | 2151 | * match this freelist and fall back to normal |
2151 | * freelist matching. | | 2152 | * freelist matching. |
2152 | */ | | 2153 | */ |
2153 | if (segstart < flp[i].fl_start) { | | 2154 | if (segstart < flp[i].fl_start) { |
2154 | segstart = flp[i].fl_start; | | 2155 | segstart = flp[i].fl_start; |
2155 | break; | | 2156 | break; |
2156 | } | | 2157 | } |
2157 | | | 2158 | |
2158 | /* | | 2159 | /* |
2159 | * We've matched this freelist so remember it. | | 2160 | * We've matched this freelist so remember it. |
2160 | */ | | 2161 | */ |
2161 | freelist = flp->fl_freelist; | | 2162 | freelist = flp->fl_freelist; |
2162 | | | 2163 | |
2163 | /* | | 2164 | /* |
2164 | * If this segment extends past the end of this | | 2165 | * If this segment extends past the end of this |
2165 | * freelist, bound to segment to the freelist. | | 2166 | * freelist, bound to segment to the freelist. |
2166 | */ | | 2167 | */ |
2167 | if (segend > flp[i].fl_end) | | 2168 | if (segend > flp[i].fl_end) |
2168 | segend = flp[i].fl_end; | | 2169 | segend = flp[i].fl_end; |
2169 | break; | | 2170 | break; |
2170 | } | | 2171 | } |
2171 | /* | | 2172 | /* |
2172 | * If we didn't match one of the port dependent | | 2173 | * If we didn't match one of the port dependent |
2173 | * freelists, let's try the common ones. | | 2174 | * freelists, let's try the common ones. |
2174 | */ | | 2175 | */ |
2175 | if (freelist == -1) { | | 2176 | if (freelist == -1) { |
2176 | #ifdef VM_FREELIST_FIRST512M | | 2177 | #ifdef VM_FREELIST_FIRST512M |
2177 | if (need512m && segstart < HALFGIG) { | | 2178 | if (need512m && segstart < HALFGIG) { |
2178 | freelist = VM_FREELIST_FIRST512M; | | 2179 | freelist = VM_FREELIST_FIRST512M; |
2179 | if (segend > HALFGIG) | | 2180 | if (segend > HALFGIG) |
2180 | segend = HALFGIG; | | 2181 | segend = HALFGIG; |
2181 | } else | | 2182 | } else |
2182 | #endif | | 2183 | #endif |
2183 | #ifdef VM_FREELIST_FIRST4G | | 2184 | #ifdef VM_FREELIST_FIRST4G |
2184 | if (need4g && segstart < FOURGIG) { | | 2185 | if (need4g && segstart < FOURGIG) { |
2185 | freelist = VM_FREELIST_FIRST4G; | | 2186 | freelist = VM_FREELIST_FIRST4G; |
2186 | if (segend > FOURGIG) | | 2187 | if (segend > FOURGIG) |
2187 | segend = FOURGIG; | | 2188 | segend = FOURGIG; |
2188 | } else | | 2189 | } else |
2189 | #endif | | 2190 | #endif |
2190 | freelist = VM_FREELIST_DEFAULT; | | 2191 | freelist = VM_FREELIST_DEFAULT; |
2191 | } | | 2192 | } |
2192 | | | 2193 | |
2193 | /* | | 2194 | /* |
2194 | * Make sure the memory we provide to uvm doesn't | | 2195 | * Make sure the memory we provide to uvm doesn't |
2195 | * include the kernel. | | 2196 | * include the kernel. |
2196 | */ | | 2197 | */ |
2197 | if (segstart < kernend && segend > kernstart) { | | 2198 | if (segstart < kernend && segend > kernstart) { |
2198 | if (segstart < kernstart) { | | 2199 | if (segstart < kernstart) { |
2199 | /* | | 2200 | /* |
2200 | * Only add the memory before the | | 2201 | * Only add the memory before the |
2201 | * kernel. | | 2202 | * kernel. |
2202 | */ | | 2203 | */ |
2203 | segend = kernstart; | | 2204 | segend = kernstart; |
2204 | } else if (segend > kernend) { | | 2205 | } else if (segend > kernend) { |
2205 | /* | | 2206 | /* |
2206 | * Only add the memory after the | | 2207 | * Only add the memory after the |
2207 | * kernel. | | 2208 | * kernel. |
2208 | */ | | 2209 | */ |
2209 | segstart = kernend; | | 2210 | segstart = kernend; |
2210 | } else { | | 2211 | } else { |
2211 | /* | | 2212 | /* |
2212 | * Just skip the segment entirely since | | 2213 | * Just skip the segment entirely since |
2213 | * it's completely inside the kernel. | | 2214 | * it's completely inside the kernel. |
2214 | */ | | 2215 | */ |
2215 | printf("skipping %#"PRIxPADDR" @ %#"PRIxPADDR" (kernel)\n", | | 2216 | printf("skipping %#"PRIxPADDR" @ %#"PRIxPADDR" (kernel)\n", |
2216 | segend - segstart, segstart); | | 2217 | segend - segstart, segstart); |
2217 | break; | | 2218 | break; |
2218 | } | | 2219 | } |
2219 | } | | 2220 | } |
2220 | | | 2221 | |
2221 | /* | | 2222 | /* |
2222 | * Now we give this segment to uvm. | | 2223 | * Now we give this segment to uvm. |
2223 | */ | | 2224 | */ |
2224 | printf("adding %#"PRIxPADDR" @ %#"PRIxPADDR" to freelist %d\n", | | 2225 | printf("adding %#"PRIxPADDR" @ %#"PRIxPADDR" to freelist %d\n", |
2225 | | | 2226 | |
2226 | segend - segstart, segstart, freelist); | | 2227 | segend - segstart, segstart, freelist); |
2227 | paddr_t first = atop(segstart); | | 2228 | paddr_t first = atop(segstart); |
2228 | paddr_t last = atop(segend); | | 2229 | paddr_t last = atop(segend); |
2229 | uvm_page_physload(first, last, first, last, freelist); | | 2230 | uvm_page_physload(first, last, first, last, freelist); |
2230 | | | 2231 | |
2231 | /* | | 2232 | /* |
2232 | * Start where we finished. | | 2233 | * Start where we finished. |
2233 | */ | | 2234 | */ |
2234 | segstart = segend; | | 2235 | segstart = segend; |
2235 | } | | 2236 | } |
2236 | } | | 2237 | } |
2237 | } | | 2238 | } |
2238 | | | 2239 | |
2239 | /* | | 2240 | /* |
2240 | * Start a new LWP | | 2241 | * Start a new LWP |
2241 | */ | | 2242 | */ |
2242 | void | | 2243 | void |
2243 | startlwp(void *arg) | | 2244 | startlwp(void *arg) |
2244 | { | | 2245 | { |
2245 | ucontext_t * const uc = arg; | | 2246 | ucontext_t * const uc = arg; |
2246 | lwp_t * const l = curlwp; | | 2247 | lwp_t * const l = curlwp; |
2247 | int error __diagused; | | 2248 | int error __diagused; |
2248 | | | 2249 | |
2249 | error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); | | 2250 | error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); |
2250 | KASSERT(error == 0); | | 2251 | KASSERT(error == 0); |
2251 | | | 2252 | |
2252 | kmem_free(uc, sizeof(ucontext_t)); | | 2253 | kmem_free(uc, sizeof(ucontext_t)); |
2253 | userret(l); | | 2254 | userret(l); |
2254 | } | | 2255 | } |
2255 | | | 2256 | |
2256 | #ifdef COMPAT_NETBSD32 | | 2257 | #ifdef COMPAT_NETBSD32 |
2257 | /* | | 2258 | /* |
2258 | * Start a new LWP | | 2259 | * Start a new LWP |
2259 | */ | | 2260 | */ |
2260 | void | | 2261 | void |
2261 | startlwp32(void *arg) | | 2262 | startlwp32(void *arg) |
2262 | { | | 2263 | { |
2263 | ucontext32_t * const uc = arg; | | 2264 | ucontext32_t * const uc = arg; |
2264 | lwp_t * const l = curlwp; | | 2265 | lwp_t * const l = curlwp; |
2265 | int error __diagused; | | 2266 | int error __diagused; |
2266 | | | 2267 | |
2267 | error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags); | | 2268 | error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags); |
2268 | KASSERT(error == 0); | | 2269 | KASSERT(error == 0); |
2269 | | | 2270 | |
2270 | /* Note: we are freeing ucontext_t, not ucontext32_t. */ | | 2271 | /* Note: we are freeing ucontext_t, not ucontext32_t. */ |
2271 | kmem_free(uc, sizeof(ucontext_t)); | | 2272 | kmem_free(uc, sizeof(ucontext_t)); |
2272 | userret(l); | | 2273 | userret(l); |
2273 | } | | 2274 | } |
2274 | #endif /* COMPAT_NETBSD32 */ | | 2275 | #endif /* COMPAT_NETBSD32 */ |
2275 | | | 2276 | |
2276 | #ifdef PARANOIA | | 2277 | #ifdef PARANOIA |
2277 | void | | 2278 | void |
2278 | std_splsw_test(void) | | 2279 | std_splsw_test(void) |
2279 | { | | 2280 | { |
2280 | struct cpu_info * const ci = curcpu(); | | 2281 | struct cpu_info * const ci = curcpu(); |
2281 | const uint32_t * const sr_map = ipl_sr_map.sr_bits; | | 2282 | const uint32_t * const sr_map = ipl_sr_map.sr_bits; |
2282 | uint32_t status = mips_cp0_status_read(); | | 2283 | uint32_t status = mips_cp0_status_read(); |
2283 | uint32_t sr_bits; | | 2284 | uint32_t sr_bits; |
2284 | int s; | | 2285 | int s; |
2285 | | | 2286 | |
2286 | KASSERT((status & MIPS_SR_INT_IE) == 0); | | 2287 | KASSERT((status & MIPS_SR_INT_IE) == 0); |
2287 | | | 2288 | |
2288 | sr_bits = sr_map[IPL_NONE]; | | 2289 | sr_bits = sr_map[IPL_NONE]; |
2289 | | | 2290 | |
2290 | splx(IPL_NONE); | | 2291 | splx(IPL_NONE); |
2291 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2292 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2292 | KASSERT(status == MIPS_INT_MASK); | | 2293 | KASSERT(status == MIPS_INT_MASK); |
2293 | KASSERT(ci->ci_cpl == IPL_NONE); | | 2294 | KASSERT(ci->ci_cpl == IPL_NONE); |
2294 | | | 2295 | |
2295 | s = splsoftclock(); | | 2296 | s = splsoftclock(); |
2296 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2297 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2297 | KASSERT((status ^ sr_map[IPL_SOFTCLOCK]) == MIPS_INT_MASK); | | 2298 | KASSERT((status ^ sr_map[IPL_SOFTCLOCK]) == MIPS_INT_MASK); |
2298 | KASSERT(ci->ci_cpl == IPL_SOFTCLOCK); | | 2299 | KASSERT(ci->ci_cpl == IPL_SOFTCLOCK); |
2299 | KASSERT(s == IPL_NONE); | | 2300 | KASSERT(s == IPL_NONE); |
2300 | | | 2301 | |
2301 | s = splsoftbio(); | | 2302 | s = splsoftbio(); |
2302 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2303 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2303 | KASSERT((status ^ sr_map[IPL_SOFTBIO]) == MIPS_INT_MASK); | | 2304 | KASSERT((status ^ sr_map[IPL_SOFTBIO]) == MIPS_INT_MASK); |
2304 | KASSERT(ci->ci_cpl == IPL_SOFTBIO); | | 2305 | KASSERT(ci->ci_cpl == IPL_SOFTBIO); |
2305 | KASSERT(s == IPL_SOFTCLOCK); | | 2306 | KASSERT(s == IPL_SOFTCLOCK); |
2306 | | | 2307 | |
2307 | s = splsoftnet(); | | 2308 | s = splsoftnet(); |
2308 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2309 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2309 | KASSERT((status ^ sr_map[IPL_SOFTNET]) == MIPS_INT_MASK); | | 2310 | KASSERT((status ^ sr_map[IPL_SOFTNET]) == MIPS_INT_MASK); |
2310 | KASSERT(ci->ci_cpl == IPL_SOFTNET); | | 2311 | KASSERT(ci->ci_cpl == IPL_SOFTNET); |
2311 | KASSERT(s == IPL_SOFTBIO); | | 2312 | KASSERT(s == IPL_SOFTBIO); |
2312 | | | 2313 | |
2313 | s = splsoftserial(); | | 2314 | s = splsoftserial(); |
2314 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2315 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2315 | KASSERT((status ^ sr_map[IPL_SOFTSERIAL]) == MIPS_INT_MASK); | | 2316 | KASSERT((status ^ sr_map[IPL_SOFTSERIAL]) == MIPS_INT_MASK); |
2316 | KASSERT(ci->ci_cpl == IPL_SOFTSERIAL); | | 2317 | KASSERT(ci->ci_cpl == IPL_SOFTSERIAL); |
2317 | KASSERT(s == IPL_SOFTNET); | | 2318 | KASSERT(s == IPL_SOFTNET); |
2318 | | | 2319 | |
2319 | s = splvm(); | | 2320 | s = splvm(); |
2320 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2321 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2321 | KASSERT((status ^ sr_map[IPL_VM]) == MIPS_INT_MASK); | | 2322 | KASSERT((status ^ sr_map[IPL_VM]) == MIPS_INT_MASK); |
2322 | KASSERT(ci->ci_cpl == IPL_VM); | | 2323 | KASSERT(ci->ci_cpl == IPL_VM); |
2323 | KASSERT(s == IPL_SOFTSERIAL); | | 2324 | KASSERT(s == IPL_SOFTSERIAL); |
2324 | | | 2325 | |
2325 | s = splsched(); | | 2326 | s = splsched(); |
2326 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2327 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2327 | KASSERT((status ^ sr_map[IPL_SCHED]) == MIPS_INT_MASK); | | 2328 | KASSERT((status ^ sr_map[IPL_SCHED]) == MIPS_INT_MASK); |
2328 | KASSERT(ci->ci_cpl == IPL_SCHED); | | 2329 | KASSERT(ci->ci_cpl == IPL_SCHED); |
2329 | KASSERT(s == IPL_VM); | | 2330 | KASSERT(s == IPL_VM); |
2330 | | | 2331 | |
2331 | s = splhigh(); | | 2332 | s = splhigh(); |
2332 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2333 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2333 | KASSERT((status ^ sr_map[IPL_HIGH]) == MIPS_INT_MASK); | | 2334 | KASSERT((status ^ sr_map[IPL_HIGH]) == MIPS_INT_MASK); |
2334 | KASSERT(ci->ci_cpl == IPL_HIGH); | | 2335 | KASSERT(ci->ci_cpl == IPL_HIGH); |
2335 | KASSERT(s == IPL_SCHED); | | 2336 | KASSERT(s == IPL_SCHED); |
2336 | | | 2337 | |
2337 | splx(IPL_NONE); | | 2338 | splx(IPL_NONE); |
2338 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2339 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2339 | KASSERT(status == MIPS_INT_MASK); | | 2340 | KASSERT(status == MIPS_INT_MASK); |
2340 | KASSERT(ci->ci_cpl == IPL_NONE); | | 2341 | KASSERT(ci->ci_cpl == IPL_NONE); |
2341 | | | 2342 | |
2342 | for (int r = IPL_SOFTCLOCK; r <= IPL_HIGH; r++) { | | 2343 | for (int r = IPL_SOFTCLOCK; r <= IPL_HIGH; r++) { |
2343 | /* | | 2344 | /* |
2344 | * As IPL increases, more intrs may be masked but no intrs | | 2345 | * As IPL increases, more intrs may be masked but no intrs |
2345 | * may become unmasked. | | 2346 | * may become unmasked. |
2346 | */ | | 2347 | */ |
2347 | KASSERT((sr_map[r] & sr_bits) == sr_bits); | | 2348 | KASSERT((sr_map[r] & sr_bits) == sr_bits); |
2348 | sr_bits |= sr_map[r]; | | 2349 | sr_bits |= sr_map[r]; |
2349 | s = splraise(r); | | 2350 | s = splraise(r); |
2350 | KASSERT(s == IPL_NONE); | | 2351 | KASSERT(s == IPL_NONE); |
2351 | | | 2352 | |
2352 | for (int t = r; t <= IPL_HIGH; t++) { | | 2353 | for (int t = r; t <= IPL_HIGH; t++) { |
2353 | int o = splraise(t); | | 2354 | int o = splraise(t); |
2354 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2355 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2355 | KASSERT((status ^ sr_map[t]) == MIPS_INT_MASK); | | 2356 | KASSERT((status ^ sr_map[t]) == MIPS_INT_MASK); |
2356 | KASSERT(ci->ci_cpl == t); | | 2357 | KASSERT(ci->ci_cpl == t); |
2357 | KASSERT(o == r); | | 2358 | KASSERT(o == r); |
2358 | | | 2359 | |
2359 | splx(o); | | 2360 | splx(o); |
2360 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2361 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2361 | KASSERT((status ^ sr_map[r]) == MIPS_INT_MASK); | | 2362 | KASSERT((status ^ sr_map[r]) == MIPS_INT_MASK); |
2362 | KASSERT(ci->ci_cpl == r); | | 2363 | KASSERT(ci->ci_cpl == r); |
2363 | } | | 2364 | } |
2364 | | | 2365 | |
2365 | splx(s); | | 2366 | splx(s); |
2366 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2367 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2367 | KASSERT((status ^ sr_map[s]) == MIPS_INT_MASK); | | 2368 | KASSERT((status ^ sr_map[s]) == MIPS_INT_MASK); |
2368 | KASSERT(ci->ci_cpl == s); | | 2369 | KASSERT(ci->ci_cpl == s); |
2369 | } | | 2370 | } |
2370 | | | 2371 | |
2371 | status = mips_cp0_status_read() & MIPS_INT_MASK; | | 2372 | status = mips_cp0_status_read() & MIPS_INT_MASK; |
2372 | KASSERT(status == MIPS_INT_MASK); | | 2373 | KASSERT(status == MIPS_INT_MASK); |
2373 | KASSERT(ci->ci_cpl == IPL_NONE); | | 2374 | KASSERT(ci->ci_cpl == IPL_NONE); |
2374 | } | | 2375 | } |
2375 | | | 2376 | |
2376 | #endif /* PARANOIA */ | | 2377 | #endif /* PARANOIA */ |
2377 | | | 2378 | |
2378 | bool | | 2379 | bool |
2379 | mm_md_direct_mapped_phys(paddr_t pa, vaddr_t *vap) | | 2380 | mm_md_direct_mapped_phys(paddr_t pa, vaddr_t *vap) |
2380 | { | | 2381 | { |
2381 | #ifdef _LP64 | | 2382 | #ifdef _LP64 |
2382 | if (MIPS_XKSEG_P(pa)) { | | 2383 | if (MIPS_XKSEG_P(pa)) { |
2383 | *vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa); | | 2384 | *vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa); |
2384 | return true; | | 2385 | return true; |
2385 | } | | 2386 | } |
2386 | #endif | | 2387 | #endif |
2387 | if (MIPS_KSEG0_P(pa)) { | | 2388 | if (MIPS_KSEG0_P(pa)) { |
2388 | *vap = MIPS_PHYS_TO_KSEG0(pa); | | 2389 | *vap = MIPS_PHYS_TO_KSEG0(pa); |
2389 | return true; | | 2390 | return true; |
2390 | } | | 2391 | } |
2391 | return false; | | 2392 | return false; |
2392 | } | | 2393 | } |
2393 | | | 2394 | |
2394 | bool | | 2395 | bool |
2395 | mm_md_page_color(paddr_t pa, int *colorp) | | 2396 | mm_md_page_color(paddr_t pa, int *colorp) |
2396 | { | | 2397 | { |
2397 | if (MIPS_CACHE_VIRTUAL_ALIAS) { | | 2398 | if (MIPS_CACHE_VIRTUAL_ALIAS) { |
2398 | struct vm_page * const pg = PHYS_TO_VM_PAGE(pa); | | 2399 | struct vm_page * const pg = PHYS_TO_VM_PAGE(pa); |
2399 | KASSERT(pg != NULL); | | 2400 | KASSERT(pg != NULL); |
2400 | struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg); | | 2401 | struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg); |
2401 | *colorp = atop(mdpg->mdpg_first.pv_va); | | 2402 | *colorp = atop(mdpg->mdpg_first.pv_va); |
2402 | return !mips_cache_badalias(pa, mdpg->mdpg_first.pv_va); | | 2403 | return !mips_cache_badalias(pa, mdpg->mdpg_first.pv_va); |
2403 | } | | 2404 | } |
2404 | *colorp = 0; | | 2405 | *colorp = 0; |
2405 | return true; | | 2406 | return true; |
2406 | } | | 2407 | } |
2407 | | | 2408 | |
2408 | int | | 2409 | int |
2409 | mm_md_physacc(paddr_t pa, vm_prot_t prot) | | 2410 | mm_md_physacc(paddr_t pa, vm_prot_t prot) |
2410 | { | | 2411 | { |
2411 | | | 2412 | |
2412 | return (pa < ctob(physmem)) ? 0 : EFAULT; | | 2413 | return (pa < ctob(physmem)) ? 0 : EFAULT; |
2413 | } | | 2414 | } |
2414 | | | 2415 | |
2415 | int | | 2416 | int |
2416 | mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled) | | 2417 | mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled) |
2417 | { | | 2418 | { |
2418 | const vaddr_t v = (vaddr_t)ptr; | | 2419 | const vaddr_t v = (vaddr_t)ptr; |
2419 | | | 2420 | |
2420 | #ifdef _LP64 | | 2421 | #ifdef _LP64 |
2421 | if (v < MIPS_XKPHYS_START) { | | 2422 | if (v < MIPS_XKPHYS_START) { |
2422 | return EFAULT; | | 2423 | return EFAULT; |
2423 | } | | 2424 | } |
2424 | if (MIPS_XKPHYS_P(v) && v > MIPS_PHYS_TO_XKPHYS_CACHED(pmap_limits.avail_end + | | 2425 | if (MIPS_XKPHYS_P(v) && v > MIPS_PHYS_TO_XKPHYS_CACHED(pmap_limits.avail_end + |
2425 | mips_round_page(MSGBUFSIZE))) { | | 2426 | mips_round_page(MSGBUFSIZE))) { |
2426 | return EFAULT; | | 2427 | return EFAULT; |
2427 | } | | 2428 | } |
2428 | if (MIPS_KSEG0_P(v) || | | 2429 | if (MIPS_KSEG0_P(v) || |
2429 | (MIPS_XKSEG_P(v) && v < MIPS_KSEG0_START)) { | | 2430 | (MIPS_XKSEG_P(v) && v < MIPS_KSEG0_START)) { |
2430 | *handled = true; | | 2431 | *handled = true; |
2431 | return 0; | | 2432 | return 0; |
2432 | } | | 2433 | } |
2433 | if (MIPS_KSEG1_P(v) || MIPS_KSEG2_P(v)) { | | 2434 | if (MIPS_KSEG1_P(v) || MIPS_KSEG2_P(v)) { |
2434 | return EFAULT; | | 2435 | return EFAULT; |
2435 | } | | 2436 | } |
2436 | #else | | 2437 | #else |
2437 | if (v < MIPS_KSEG0_START) { | | 2438 | if (v < MIPS_KSEG0_START) { |
2438 | return EFAULT; | | 2439 | return EFAULT; |
2439 | } | | 2440 | } |
2440 | if (v < MIPS_PHYS_TO_KSEG0(pmap_limits.avail_end + | | 2441 | if (v < MIPS_PHYS_TO_KSEG0(pmap_limits.avail_end + |
2441 | mips_round_page(MSGBUFSIZE))) { | | 2442 | mips_round_page(MSGBUFSIZE))) { |
2442 | *handled = true; | | 2443 | *handled = true; |
2443 | return 0; | | 2444 | return 0; |
2444 | } | | 2445 | } |
2445 | if (v < MIPS_KSEG2_START) { | | 2446 | if (v < MIPS_KSEG2_START) { |
2446 | return EFAULT; | | 2447 | return EFAULT; |
2447 | } | | 2448 | } |
2448 | #endif | | 2449 | #endif |
2449 | *handled = false; | | 2450 | *handled = false; |
2450 | return 0; | | 2451 | return 0; |
2451 | } | | 2452 | } |
2452 | | | 2453 | |
2453 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 | | 2454 | #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 |
2454 | static void | | 2455 | static void |
2455 | mips_watchpoint_init(void) | | 2456 | mips_watchpoint_init(void) |
2456 | { | | 2457 | { |
2457 | /* | | 2458 | /* |
2458 | * determine number of CPU watchpoints | | 2459 | * determine number of CPU watchpoints |
2459 | */ | | 2460 | */ |
2460 | curcpu()->ci_cpuwatch_count = cpuwatch_discover(); | | 2461 | curcpu()->ci_cpuwatch_count = cpuwatch_discover(); |
2461 | } | | 2462 | } |
2462 | #endif | | 2463 | #endif |
2463 | | | 2464 | |
2464 | | | 2465 | |
2465 | /* | | 2466 | /* |
2466 | * Process the tail end of a posix_spawn() for the child. | | 2467 | * Process the tail end of a posix_spawn() for the child. |
2467 | */ | | 2468 | */ |
2468 | void | | 2469 | void |
2469 | cpu_spawn_return(struct lwp *l) | | 2470 | cpu_spawn_return(struct lwp *l) |
2470 | { | | 2471 | { |
2471 | userret(l); | | 2472 | userret(l); |
2472 | } | | 2473 | } |
2473 | | | 2474 | |