cpu.c revision 1.9.2.5 1 1.9.2.5 nathanw /* $NetBSD: cpu.c,v 1.9.2.5 2002/04/17 00:02:25 nathanw Exp $ */
2 1.9.2.2 nathanw
3 1.9.2.2 nathanw /*
4 1.9.2.2 nathanw * Copyright (c) 1995 Mark Brinicombe.
5 1.9.2.2 nathanw * Copyright (c) 1995 Brini.
6 1.9.2.2 nathanw * All rights reserved.
7 1.9.2.2 nathanw *
8 1.9.2.2 nathanw * Redistribution and use in source and binary forms, with or without
9 1.9.2.2 nathanw * modification, are permitted provided that the following conditions
10 1.9.2.2 nathanw * are met:
11 1.9.2.2 nathanw * 1. Redistributions of source code must retain the above copyright
12 1.9.2.2 nathanw * notice, this list of conditions and the following disclaimer.
13 1.9.2.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
14 1.9.2.2 nathanw * notice, this list of conditions and the following disclaimer in the
15 1.9.2.2 nathanw * documentation and/or other materials provided with the distribution.
16 1.9.2.2 nathanw * 3. All advertising materials mentioning features or use of this software
17 1.9.2.2 nathanw * must display the following acknowledgement:
18 1.9.2.2 nathanw * This product includes software developed by Brini.
19 1.9.2.2 nathanw * 4. The name of the company nor the name of the author may be used to
20 1.9.2.2 nathanw * endorse or promote products derived from this software without specific
21 1.9.2.2 nathanw * prior written permission.
22 1.9.2.2 nathanw *
23 1.9.2.2 nathanw * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 1.9.2.2 nathanw * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 1.9.2.2 nathanw * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 1.9.2.2 nathanw * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 1.9.2.2 nathanw * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 1.9.2.2 nathanw * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 1.9.2.2 nathanw * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.9.2.2 nathanw * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.9.2.2 nathanw * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.9.2.2 nathanw * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.9.2.2 nathanw * SUCH DAMAGE.
34 1.9.2.2 nathanw *
35 1.9.2.2 nathanw * RiscBSD kernel project
36 1.9.2.2 nathanw *
37 1.9.2.2 nathanw * cpu.c
38 1.9.2.2 nathanw *
39 1.9.2.2 nathanw * Probing and configuration for the master cpu
40 1.9.2.2 nathanw *
41 1.9.2.2 nathanw * Created : 10/10/95
42 1.9.2.2 nathanw */
43 1.9.2.2 nathanw
44 1.9.2.2 nathanw #include "opt_armfpe.h"
45 1.9.2.2 nathanw
46 1.9.2.2 nathanw #include <sys/param.h>
47 1.9.2.4 nathanw
48 1.9.2.5 nathanw __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9.2.5 2002/04/17 00:02:25 nathanw Exp $");
49 1.9.2.4 nathanw
50 1.9.2.2 nathanw #include <sys/systm.h>
51 1.9.2.2 nathanw #include <sys/malloc.h>
52 1.9.2.2 nathanw #include <sys/device.h>
53 1.9.2.2 nathanw #include <sys/proc.h>
54 1.9.2.2 nathanw #include <uvm/uvm_extern.h>
55 1.9.2.2 nathanw #include <machine/conf.h>
56 1.9.2.2 nathanw #include <machine/cpu.h>
57 1.9.2.5 nathanw
58 1.9.2.5 nathanw #include <arm/cpuconf.h>
59 1.9.2.2 nathanw #include <arm/undefined.h>
60 1.9.2.2 nathanw
61 1.9.2.2 nathanw #ifdef ARMFPE
62 1.9.2.2 nathanw #include <machine/bootconfig.h> /* For boot args */
63 1.9.2.2 nathanw #include <arm/fpe-arm/armfpe.h>
64 1.9.2.2 nathanw #endif
65 1.9.2.2 nathanw
66 1.9.2.4 nathanw char cpu_model[256];
67 1.9.2.2 nathanw
68 1.9.2.2 nathanw /* Prototypes */
69 1.9.2.4 nathanw void identify_arm_cpu(struct device *dv, struct cpu_info *);
70 1.9.2.2 nathanw
71 1.9.2.2 nathanw /*
72 1.9.2.4 nathanw * Identify the master (boot) CPU
73 1.9.2.2 nathanw */
74 1.9.2.2 nathanw
75 1.9.2.2 nathanw void
76 1.9.2.3 nathanw cpu_attach(struct device *dv)
77 1.9.2.2 nathanw {
78 1.9.2.4 nathanw int usearmfpe;
79 1.9.2.3 nathanw
80 1.9.2.4 nathanw usearmfpe = 1; /* when compiled in, its enabled by default */
81 1.9.2.2 nathanw
82 1.9.2.4 nathanw curcpu()->ci_dev = dv;
83 1.9.2.2 nathanw
84 1.9.2.4 nathanw evcnt_attach_dynamic(&curcpu()->ci_arm700bugcount, EVCNT_TYPE_MISC,
85 1.9.2.4 nathanw NULL, dv->dv_xname, "arm700swibug");
86 1.9.2.4 nathanw
87 1.9.2.2 nathanw /* Get the cpu ID from coprocessor 15 */
88 1.9.2.2 nathanw
89 1.9.2.4 nathanw curcpu()->ci_cpuid = cpu_id();
90 1.9.2.4 nathanw curcpu()->ci_cputype = curcpu()->ci_cpuid & CPU_ID_CPU_MASK;
91 1.9.2.4 nathanw curcpu()->ci_cpurev = curcpu()->ci_cpuid & CPU_ID_REVISION_MASK;
92 1.9.2.2 nathanw
93 1.9.2.4 nathanw identify_arm_cpu(dv, curcpu());
94 1.9.2.2 nathanw
95 1.9.2.4 nathanw if (curcpu()->ci_cputype == CPU_ID_SA110 && curcpu()->ci_cpurev < 3) {
96 1.9.2.2 nathanw printf("%s: SA-110 with bugged STM^ instruction\n",
97 1.9.2.2 nathanw dv->dv_xname);
98 1.9.2.2 nathanw }
99 1.9.2.2 nathanw
100 1.9.2.2 nathanw #ifdef CPU_ARM8
101 1.9.2.4 nathanw if ((curcpu()->ci_cpuid & CPU_ID_CPU_MASK) == CPU_ID_ARM810) {
102 1.9.2.2 nathanw int clock = arm8_clock_config(0, 0);
103 1.9.2.2 nathanw char *fclk;
104 1.9.2.2 nathanw printf("%s: ARM810 cp15=%02x", dv->dv_xname, clock);
105 1.9.2.2 nathanw printf(" clock:%s", (clock & 1) ? " dynamic" : "");
106 1.9.2.2 nathanw printf("%s", (clock & 2) ? " sync" : "");
107 1.9.2.2 nathanw switch ((clock >> 2) & 3) {
108 1.9.2.3 nathanw case 0:
109 1.9.2.2 nathanw fclk = "bus clock";
110 1.9.2.2 nathanw break;
111 1.9.2.3 nathanw case 1:
112 1.9.2.2 nathanw fclk = "ref clock";
113 1.9.2.2 nathanw break;
114 1.9.2.3 nathanw case 3:
115 1.9.2.2 nathanw fclk = "pll";
116 1.9.2.2 nathanw break;
117 1.9.2.3 nathanw default:
118 1.9.2.2 nathanw fclk = "illegal";
119 1.9.2.2 nathanw break;
120 1.9.2.2 nathanw }
121 1.9.2.2 nathanw printf(" fclk source=%s\n", fclk);
122 1.9.2.2 nathanw }
123 1.9.2.2 nathanw #endif
124 1.9.2.2 nathanw
125 1.9.2.4 nathanw #ifdef ARMFPE
126 1.9.2.2 nathanw /*
127 1.9.2.2 nathanw * Ok now we test for an FPA
128 1.9.2.2 nathanw * At this point no floating point emulator has been installed.
129 1.9.2.2 nathanw * This means any FP instruction will cause undefined exception.
130 1.9.2.2 nathanw * We install a temporay coproc 1 handler which will modify
131 1.9.2.2 nathanw * undefined_test if it is called.
132 1.9.2.2 nathanw * We then try to read the FP status register. If undefined_test
133 1.9.2.2 nathanw * has been decremented then the instruction was not handled by
134 1.9.2.2 nathanw * an FPA so we know the FPA is missing. If undefined_test is
135 1.9.2.2 nathanw * still 1 then we know the instruction was handled by an FPA.
136 1.9.2.2 nathanw * We then remove our test handler and look at the
137 1.9.2.2 nathanw * FP status register for identification.
138 1.9.2.2 nathanw */
139 1.9.2.2 nathanw
140 1.9.2.4 nathanw /*
141 1.9.2.4 nathanw * Ok if ARMFPE is defined and the boot options request the
142 1.9.2.4 nathanw * ARM FPE then it will be installed as the FPE.
143 1.9.2.4 nathanw * This is just while I work on integrating the new FPE.
144 1.9.2.4 nathanw * It means the new FPE gets installed if compiled int (ARMFPE
145 1.9.2.4 nathanw * defined) and also gives me a on/off option when I boot in
146 1.9.2.4 nathanw * case the new FPE is causing panics.
147 1.9.2.4 nathanw */
148 1.9.2.2 nathanw
149 1.9.2.2 nathanw
150 1.9.2.4 nathanw if (boot_args)
151 1.9.2.4 nathanw get_bootconf_option(boot_args, "armfpe",
152 1.9.2.4 nathanw BOOTOPT_TYPE_BOOLEAN, &usearmfpe);
153 1.9.2.4 nathanw if (usearmfpe)
154 1.9.2.4 nathanw initialise_arm_fpe();
155 1.9.2.2 nathanw #endif
156 1.9.2.2 nathanw }
157 1.9.2.2 nathanw
158 1.9.2.4 nathanw enum cpu_class {
159 1.9.2.4 nathanw CPU_CLASS_NONE,
160 1.9.2.4 nathanw CPU_CLASS_ARM2,
161 1.9.2.4 nathanw CPU_CLASS_ARM2AS,
162 1.9.2.4 nathanw CPU_CLASS_ARM3,
163 1.9.2.4 nathanw CPU_CLASS_ARM6,
164 1.9.2.4 nathanw CPU_CLASS_ARM7,
165 1.9.2.4 nathanw CPU_CLASS_ARM7TDMI,
166 1.9.2.4 nathanw CPU_CLASS_ARM8,
167 1.9.2.4 nathanw CPU_CLASS_ARM9TDMI,
168 1.9.2.4 nathanw CPU_CLASS_ARM9ES,
169 1.9.2.4 nathanw CPU_CLASS_SA1,
170 1.9.2.4 nathanw CPU_CLASS_XSCALE,
171 1.9.2.4 nathanw CPU_CLASS_ARM10E
172 1.9.2.4 nathanw };
173 1.9.2.4 nathanw
174 1.9.2.3 nathanw static const char *generic_steppings[16] = {
175 1.9.2.3 nathanw "rev 0", "rev 1", "rev 2", "rev 3",
176 1.9.2.3 nathanw "rev 4", "rev 5", "rev 6", "rev 7",
177 1.9.2.3 nathanw "rev 8", "rev 9", "rev 10", "rev 11",
178 1.9.2.3 nathanw "rev 12", "rev 13", "rev 14", "rev 15",
179 1.9.2.3 nathanw };
180 1.9.2.3 nathanw
181 1.9.2.3 nathanw static const char *sa110_steppings[16] = {
182 1.9.2.3 nathanw "rev 0", "step J", "step K", "step S",
183 1.9.2.3 nathanw "step T", "rev 5", "rev 6", "rev 7",
184 1.9.2.3 nathanw "rev 8", "rev 9", "rev 10", "rev 11",
185 1.9.2.3 nathanw "rev 12", "rev 13", "rev 14", "rev 15",
186 1.9.2.3 nathanw };
187 1.9.2.3 nathanw
188 1.9.2.3 nathanw static const char *sa1100_steppings[16] = {
189 1.9.2.3 nathanw "rev 0", "step B", "step C", "rev 3",
190 1.9.2.3 nathanw "rev 4", "rev 5", "rev 6", "rev 7",
191 1.9.2.3 nathanw "step D", "step E", "rev 10" "step G",
192 1.9.2.3 nathanw "rev 12", "rev 13", "rev 14", "rev 15",
193 1.9.2.3 nathanw };
194 1.9.2.3 nathanw
195 1.9.2.3 nathanw static const char *sa1110_steppings[16] = {
196 1.9.2.3 nathanw "step A-0", "rev 1", "rev 2", "rev 3",
197 1.9.2.3 nathanw "step B-0", "step B-1", "step B-2", "step B-3",
198 1.9.2.3 nathanw "step B-4", "step B-5", "rev 10", "rev 11",
199 1.9.2.3 nathanw "rev 12", "rev 13", "rev 14", "rev 15",
200 1.9.2.3 nathanw };
201 1.9.2.3 nathanw
202 1.9.2.4 nathanw static const char *xscale_steppings[16] = {
203 1.9.2.3 nathanw "step A-0", "step A-1", "step B-0", "step C-0",
204 1.9.2.3 nathanw "rev 4", "rev 5", "rev 6", "rev 7",
205 1.9.2.3 nathanw "rev 8", "rev 9", "rev 10", "rev 11",
206 1.9.2.3 nathanw "rev 12", "rev 13", "rev 14", "rev 15",
207 1.9.2.3 nathanw };
208 1.9.2.3 nathanw
209 1.9.2.2 nathanw struct cpuidtab {
210 1.9.2.2 nathanw u_int32_t cpuid;
211 1.9.2.2 nathanw enum cpu_class cpu_class;
212 1.9.2.2 nathanw const char *cpu_name;
213 1.9.2.3 nathanw const char **cpu_steppings;
214 1.9.2.2 nathanw };
215 1.9.2.2 nathanw
216 1.9.2.2 nathanw const struct cpuidtab cpuids[] = {
217 1.9.2.3 nathanw { CPU_ID_ARM2, CPU_CLASS_ARM2, "ARM2",
218 1.9.2.3 nathanw generic_steppings },
219 1.9.2.3 nathanw { CPU_ID_ARM250, CPU_CLASS_ARM2AS, "ARM250",
220 1.9.2.3 nathanw generic_steppings },
221 1.9.2.3 nathanw
222 1.9.2.3 nathanw { CPU_ID_ARM3, CPU_CLASS_ARM3, "ARM3",
223 1.9.2.3 nathanw generic_steppings },
224 1.9.2.3 nathanw
225 1.9.2.3 nathanw { CPU_ID_ARM600, CPU_CLASS_ARM6, "ARM600",
226 1.9.2.3 nathanw generic_steppings },
227 1.9.2.3 nathanw { CPU_ID_ARM610, CPU_CLASS_ARM6, "ARM610",
228 1.9.2.3 nathanw generic_steppings },
229 1.9.2.3 nathanw { CPU_ID_ARM620, CPU_CLASS_ARM6, "ARM620",
230 1.9.2.3 nathanw generic_steppings },
231 1.9.2.3 nathanw
232 1.9.2.3 nathanw { CPU_ID_ARM700, CPU_CLASS_ARM7, "ARM700",
233 1.9.2.3 nathanw generic_steppings },
234 1.9.2.3 nathanw { CPU_ID_ARM710, CPU_CLASS_ARM7, "ARM710",
235 1.9.2.3 nathanw generic_steppings },
236 1.9.2.3 nathanw { CPU_ID_ARM7500, CPU_CLASS_ARM7, "ARM7500",
237 1.9.2.3 nathanw generic_steppings },
238 1.9.2.3 nathanw { CPU_ID_ARM710A, CPU_CLASS_ARM7, "ARM710a",
239 1.9.2.3 nathanw generic_steppings },
240 1.9.2.3 nathanw { CPU_ID_ARM7500FE, CPU_CLASS_ARM7, "ARM7500FE",
241 1.9.2.3 nathanw generic_steppings },
242 1.9.2.3 nathanw { CPU_ID_ARM710T, CPU_CLASS_ARM7TDMI, "ARM710T",
243 1.9.2.3 nathanw generic_steppings },
244 1.9.2.3 nathanw { CPU_ID_ARM720T, CPU_CLASS_ARM7TDMI, "ARM720T",
245 1.9.2.3 nathanw generic_steppings },
246 1.9.2.3 nathanw { CPU_ID_ARM740T8K, CPU_CLASS_ARM7TDMI, "ARM740T (8 KB cache)",
247 1.9.2.3 nathanw generic_steppings },
248 1.9.2.3 nathanw { CPU_ID_ARM740T4K, CPU_CLASS_ARM7TDMI, "ARM740T (4 KB cache)",
249 1.9.2.3 nathanw generic_steppings },
250 1.9.2.3 nathanw
251 1.9.2.3 nathanw { CPU_ID_ARM810, CPU_CLASS_ARM8, "ARM810",
252 1.9.2.3 nathanw generic_steppings },
253 1.9.2.3 nathanw
254 1.9.2.3 nathanw { CPU_ID_ARM920T, CPU_CLASS_ARM9TDMI, "ARM920T",
255 1.9.2.3 nathanw generic_steppings },
256 1.9.2.3 nathanw { CPU_ID_ARM922T, CPU_CLASS_ARM9TDMI, "ARM922T",
257 1.9.2.3 nathanw generic_steppings },
258 1.9.2.3 nathanw { CPU_ID_ARM940T, CPU_CLASS_ARM9TDMI, "ARM940T",
259 1.9.2.3 nathanw generic_steppings },
260 1.9.2.3 nathanw { CPU_ID_ARM946ES, CPU_CLASS_ARM9ES, "ARM946E-S",
261 1.9.2.3 nathanw generic_steppings },
262 1.9.2.3 nathanw { CPU_ID_ARM966ES, CPU_CLASS_ARM9ES, "ARM966E-S",
263 1.9.2.3 nathanw generic_steppings },
264 1.9.2.3 nathanw { CPU_ID_ARM966ESR1, CPU_CLASS_ARM9ES, "ARM966E-S",
265 1.9.2.3 nathanw generic_steppings },
266 1.9.2.3 nathanw
267 1.9.2.3 nathanw { CPU_ID_SA110, CPU_CLASS_SA1, "SA-110",
268 1.9.2.3 nathanw sa110_steppings },
269 1.9.2.3 nathanw { CPU_ID_SA1100, CPU_CLASS_SA1, "SA-1100",
270 1.9.2.3 nathanw sa1100_steppings },
271 1.9.2.3 nathanw { CPU_ID_SA1110, CPU_CLASS_SA1, "SA-1110",
272 1.9.2.3 nathanw sa1110_steppings },
273 1.9.2.3 nathanw
274 1.9.2.4 nathanw { CPU_ID_80200, CPU_CLASS_XSCALE, "i80200",
275 1.9.2.4 nathanw xscale_steppings },
276 1.9.2.4 nathanw
277 1.9.2.4 nathanw { CPU_ID_80321, CPU_CLASS_XSCALE, "i80321",
278 1.9.2.4 nathanw xscale_steppings },
279 1.9.2.4 nathanw
280 1.9.2.4 nathanw { CPU_ID_ARM1022ES, CPU_CLASS_ARM10E, "ARM1022ES",
281 1.9.2.4 nathanw generic_steppings },
282 1.9.2.3 nathanw
283 1.9.2.3 nathanw { 0, CPU_CLASS_NONE, NULL, NULL }
284 1.9.2.2 nathanw };
285 1.9.2.2 nathanw
286 1.9.2.2 nathanw struct cpu_classtab {
287 1.9.2.2 nathanw const char *class_name;
288 1.9.2.2 nathanw const char *class_option;
289 1.9.2.2 nathanw };
290 1.9.2.2 nathanw
291 1.9.2.2 nathanw const struct cpu_classtab cpu_classes[] = {
292 1.9.2.2 nathanw { "unknown", NULL }, /* CPU_CLASS_NONE */
293 1.9.2.2 nathanw { "ARM2", "CPU_ARM2" }, /* CPU_CLASS_ARM2 */
294 1.9.2.2 nathanw { "ARM2as", "CPU_ARM250" }, /* CPU_CLASS_ARM2AS */
295 1.9.2.2 nathanw { "ARM3", "CPU_ARM3" }, /* CPU_CLASS_ARM3 */
296 1.9.2.2 nathanw { "ARM6", "CPU_ARM6" }, /* CPU_CLASS_ARM6 */
297 1.9.2.2 nathanw { "ARM7", "CPU_ARM7" }, /* CPU_CLASS_ARM7 */
298 1.9.2.2 nathanw { "ARM7TDMI", "CPU_ARM7TDMI" }, /* CPU_CLASS_ARM7TDMI */
299 1.9.2.2 nathanw { "ARM8", "CPU_ARM8" }, /* CPU_CLASS_ARM8 */
300 1.9.2.2 nathanw { "ARM9TDMI", NULL }, /* CPU_CLASS_ARM9TDMI */
301 1.9.2.2 nathanw { "ARM9E-S", NULL }, /* CPU_CLASS_ARM9ES */
302 1.9.2.2 nathanw { "SA-1", "CPU_SA110" }, /* CPU_CLASS_SA1 */
303 1.9.2.4 nathanw { "XScale", "CPU_XSCALE_..." }, /* CPU_CLASS_XSCALE */
304 1.9.2.4 nathanw { "ARM10E", NULL }, /* CPU_CLASS_ARM10E */
305 1.9.2.2 nathanw };
306 1.9.2.2 nathanw
307 1.9.2.2 nathanw /*
308 1.9.2.2 nathanw * Report the type of the specifed arm processor. This uses the generic and
309 1.9.2.2 nathanw * arm specific information in the cpu structure to identify the processor.
310 1.9.2.2 nathanw * The remaining fields in the cpu structure are filled in appropriately.
311 1.9.2.2 nathanw */
312 1.9.2.2 nathanw
313 1.9.2.2 nathanw static const char *wtnames[] = {
314 1.9.2.2 nathanw "write-through",
315 1.9.2.2 nathanw "write-back",
316 1.9.2.2 nathanw "write-back",
317 1.9.2.2 nathanw "**unknown 3**",
318 1.9.2.2 nathanw "**unknown 4**",
319 1.9.2.2 nathanw "write-back-locking", /* XXX XScale-specific? */
320 1.9.2.2 nathanw "write-back-locking-A",
321 1.9.2.2 nathanw "write-back-locking-B",
322 1.9.2.2 nathanw "**unknown 8**",
323 1.9.2.2 nathanw "**unknown 9**",
324 1.9.2.2 nathanw "**unknown 10**",
325 1.9.2.2 nathanw "**unknown 11**",
326 1.9.2.2 nathanw "**unknown 12**",
327 1.9.2.2 nathanw "**unknown 13**",
328 1.9.2.2 nathanw "**unknown 14**",
329 1.9.2.2 nathanw "**unknown 15**",
330 1.9.2.2 nathanw };
331 1.9.2.2 nathanw
332 1.9.2.2 nathanw void
333 1.9.2.4 nathanw identify_arm_cpu(struct device *dv, struct cpu_info *ci)
334 1.9.2.2 nathanw {
335 1.9.2.2 nathanw u_int cpuid;
336 1.9.2.4 nathanw enum cpu_class cpu_class;
337 1.9.2.2 nathanw int i;
338 1.9.2.2 nathanw
339 1.9.2.4 nathanw cpuid = ci->ci_cpuid;
340 1.9.2.2 nathanw
341 1.9.2.2 nathanw if (cpuid == 0) {
342 1.9.2.2 nathanw printf("Processor failed probe - no CPU ID\n");
343 1.9.2.2 nathanw return;
344 1.9.2.2 nathanw }
345 1.9.2.2 nathanw
346 1.9.2.2 nathanw for (i = 0; cpuids[i].cpuid != 0; i++)
347 1.9.2.2 nathanw if (cpuids[i].cpuid == (cpuid & CPU_ID_CPU_MASK)) {
348 1.9.2.4 nathanw cpu_class = cpuids[i].cpu_class;
349 1.9.2.4 nathanw sprintf(cpu_model, "%s %s (%s core)",
350 1.9.2.3 nathanw cpuids[i].cpu_name,
351 1.9.2.3 nathanw cpuids[i].cpu_steppings[cpuid &
352 1.9.2.3 nathanw CPU_ID_REVISION_MASK],
353 1.9.2.4 nathanw cpu_classes[cpu_class].class_name);
354 1.9.2.2 nathanw break;
355 1.9.2.2 nathanw }
356 1.9.2.2 nathanw
357 1.9.2.2 nathanw if (cpuids[i].cpuid == 0)
358 1.9.2.4 nathanw sprintf(cpu_model, "unknown CPU (ID = 0x%x)", cpuid);
359 1.9.2.2 nathanw
360 1.9.2.4 nathanw printf(": %s\n", cpu_model);
361 1.9.2.4 nathanw
362 1.9.2.4 nathanw printf("%s:", dv->dv_xname);
363 1.9.2.4 nathanw
364 1.9.2.4 nathanw switch (cpu_class) {
365 1.9.2.2 nathanw case CPU_CLASS_ARM6:
366 1.9.2.2 nathanw case CPU_CLASS_ARM7:
367 1.9.2.2 nathanw case CPU_CLASS_ARM7TDMI:
368 1.9.2.2 nathanw case CPU_CLASS_ARM8:
369 1.9.2.4 nathanw if ((ci->ci_ctrl & CPU_CONTROL_IDC_ENABLE) == 0)
370 1.9.2.4 nathanw printf(" IDC disabled");
371 1.9.2.2 nathanw else
372 1.9.2.4 nathanw printf(" IDC enabled");
373 1.9.2.2 nathanw break;
374 1.9.2.2 nathanw case CPU_CLASS_ARM9TDMI:
375 1.9.2.2 nathanw case CPU_CLASS_SA1:
376 1.9.2.2 nathanw case CPU_CLASS_XSCALE:
377 1.9.2.4 nathanw if ((ci->ci_ctrl & CPU_CONTROL_DC_ENABLE) == 0)
378 1.9.2.4 nathanw printf(" DC disabled");
379 1.9.2.2 nathanw else
380 1.9.2.4 nathanw printf(" DC enabled");
381 1.9.2.4 nathanw if ((ci->ci_ctrl & CPU_CONTROL_IC_ENABLE) == 0)
382 1.9.2.4 nathanw printf(" IC disabled");
383 1.9.2.2 nathanw else
384 1.9.2.4 nathanw printf(" IC enabled");
385 1.9.2.4 nathanw break;
386 1.9.2.4 nathanw default:
387 1.9.2.2 nathanw break;
388 1.9.2.2 nathanw }
389 1.9.2.4 nathanw if ((ci->ci_ctrl & CPU_CONTROL_WBUF_ENABLE) == 0)
390 1.9.2.4 nathanw printf(" WB disabled");
391 1.9.2.2 nathanw else
392 1.9.2.4 nathanw printf(" WB enabled");
393 1.9.2.2 nathanw
394 1.9.2.4 nathanw if (ci->ci_ctrl & CPU_CONTROL_LABT_ENABLE)
395 1.9.2.4 nathanw printf(" LABT");
396 1.9.2.2 nathanw else
397 1.9.2.4 nathanw printf(" EABT");
398 1.9.2.2 nathanw
399 1.9.2.4 nathanw if (ci->ci_ctrl & CPU_CONTROL_BPRD_ENABLE)
400 1.9.2.4 nathanw printf(" branch prediction enabled");
401 1.9.2.2 nathanw
402 1.9.2.4 nathanw printf("\n");
403 1.9.2.2 nathanw
404 1.9.2.2 nathanw /* Print cache info. */
405 1.9.2.2 nathanw if (arm_picache_line_size == 0 && arm_pdcache_line_size == 0)
406 1.9.2.2 nathanw goto skip_pcache;
407 1.9.2.2 nathanw
408 1.9.2.2 nathanw if (arm_pcache_unified) {
409 1.9.2.2 nathanw printf("%s: %dKB/%dB %d-way %s unified cache\n",
410 1.9.2.2 nathanw dv->dv_xname, arm_pdcache_size / 1024,
411 1.9.2.2 nathanw arm_pdcache_line_size, arm_pdcache_ways,
412 1.9.2.2 nathanw wtnames[arm_pcache_type]);
413 1.9.2.2 nathanw } else {
414 1.9.2.2 nathanw printf("%s: %dKB/%dB %d-way Instruction cache\n",
415 1.9.2.2 nathanw dv->dv_xname, arm_picache_size / 1024,
416 1.9.2.2 nathanw arm_picache_line_size, arm_picache_ways);
417 1.9.2.2 nathanw printf("%s: %dKB/%dB %d-way %s Data cache\n",
418 1.9.2.2 nathanw dv->dv_xname, arm_pdcache_size / 1024,
419 1.9.2.2 nathanw arm_pdcache_line_size, arm_pdcache_ways,
420 1.9.2.2 nathanw wtnames[arm_pcache_type]);
421 1.9.2.2 nathanw }
422 1.9.2.2 nathanw
423 1.9.2.2 nathanw skip_pcache:
424 1.9.2.2 nathanw
425 1.9.2.4 nathanw switch (cpu_class) {
426 1.9.2.2 nathanw #ifdef CPU_ARM2
427 1.9.2.2 nathanw case CPU_CLASS_ARM2:
428 1.9.2.2 nathanw #endif
429 1.9.2.2 nathanw #ifdef CPU_ARM250
430 1.9.2.2 nathanw case CPU_CLASS_ARM2AS:
431 1.9.2.2 nathanw #endif
432 1.9.2.2 nathanw #ifdef CPU_ARM3
433 1.9.2.2 nathanw case CPU_CLASS_ARM3:
434 1.9.2.2 nathanw #endif
435 1.9.2.2 nathanw #ifdef CPU_ARM6
436 1.9.2.2 nathanw case CPU_CLASS_ARM6:
437 1.9.2.2 nathanw #endif
438 1.9.2.2 nathanw #ifdef CPU_ARM7
439 1.9.2.2 nathanw case CPU_CLASS_ARM7:
440 1.9.2.2 nathanw #endif
441 1.9.2.2 nathanw #ifdef CPU_ARM7TDMI
442 1.9.2.2 nathanw case CPU_CLASS_ARM7TDMI:
443 1.9.2.2 nathanw #endif
444 1.9.2.2 nathanw #ifdef CPU_ARM8
445 1.9.2.2 nathanw case CPU_CLASS_ARM8:
446 1.9.2.2 nathanw #endif
447 1.9.2.2 nathanw #ifdef CPU_ARM9
448 1.9.2.2 nathanw case CPU_CLASS_ARM9TDMI:
449 1.9.2.2 nathanw #endif
450 1.9.2.2 nathanw #ifdef CPU_SA110
451 1.9.2.2 nathanw case CPU_CLASS_SA1:
452 1.9.2.2 nathanw #endif
453 1.9.2.4 nathanw #if defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321)
454 1.9.2.2 nathanw case CPU_CLASS_XSCALE:
455 1.9.2.2 nathanw #endif
456 1.9.2.2 nathanw break;
457 1.9.2.2 nathanw default:
458 1.9.2.4 nathanw if (cpu_classes[cpu_class].class_option != NULL)
459 1.9.2.2 nathanw printf("%s: %s does not fully support this CPU."
460 1.9.2.2 nathanw "\n", dv->dv_xname, ostype);
461 1.9.2.2 nathanw else {
462 1.9.2.2 nathanw printf("%s: This kernel does not fully support "
463 1.9.2.2 nathanw "this CPU.\n", dv->dv_xname);
464 1.9.2.2 nathanw printf("%s: Recompile with \"options %s\" to "
465 1.9.2.2 nathanw "correct this.\n", dv->dv_xname,
466 1.9.2.4 nathanw cpu_classes[cpu_class].class_option);
467 1.9.2.2 nathanw }
468 1.9.2.2 nathanw break;
469 1.9.2.2 nathanw }
470 1.9.2.2 nathanw
471 1.9.2.2 nathanw }
472 1.9.2.2 nathanw
473 1.9.2.2 nathanw /* End of cpu.c */
474