blob: a284e8cb8c28e5280a6212c7b6a2f72226aa2a3d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Processor capabilities determination functions.
3 *
4 * Copyright (C) xxxx the Anonymous
Ralf Baechle010b8532006-01-29 18:42:08 +00005 * Copyright (C) 1994 - 2006 Ralf Baechle
Ralf Baechle41943182005-05-05 16:45:59 +00006 * Copyright (C) 2003, 2004 Maciej W. Rozycki
Ralf Baechle70342282013-01-22 12:59:30 +01007 * Copyright (C) 2001, 2004, 2011, 2012 MIPS Technologies, Inc.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/ptrace.h>
Ralf Baechle631330f2009-06-19 14:05:26 +010017#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/stddef.h>
Paul Gortmaker73bc2562011-07-23 16:30:40 -040019#include <linux/export.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Ralf Baechle57599062007-02-18 19:07:31 +000021#include <asm/bugs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <asm/cpu.h>
Ralf Baechle69f24d12013-09-17 10:25:47 +020023#include <asm/cpu-type.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <asm/fpu.h>
25#include <asm/mipsregs.h>
David Daney654f57b2008-09-23 00:07:16 -070026#include <asm/watch.h>
Paul Gortmaker06372a62011-07-23 16:26:41 -040027#include <asm/elf.h>
Chris Dearmana074f0e2009-07-10 01:51:27 -070028#include <asm/spram.h>
David Daney949e51b2010-10-14 11:32:33 -070029#include <asm/uaccess.h>
30
Paul Gortmaker078a55f2013-06-18 13:38:59 +000031static int mips_fpu_disabled;
Kevin Cernekee0103d232010-05-02 14:43:52 -070032
33static int __init fpu_disable(char *s)
34{
35 cpu_data[0].options &= ~MIPS_CPU_FPU;
36 mips_fpu_disabled = 1;
37
38 return 1;
39}
40
41__setup("nofpu", fpu_disable);
42
Paul Gortmaker078a55f2013-06-18 13:38:59 +000043int mips_dsp_disabled;
Kevin Cernekee0103d232010-05-02 14:43:52 -070044
45static int __init dsp_disable(char *s)
46{
Steven J. Hillee80f7c72012-08-03 10:26:04 -050047 cpu_data[0].ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
Kevin Cernekee0103d232010-05-02 14:43:52 -070048 mips_dsp_disabled = 1;
49
50 return 1;
51}
52
53__setup("nodsp", dsp_disable);
54
Marc St-Jean9267a302007-06-14 15:55:31 -060055static inline void check_errata(void)
56{
57 struct cpuinfo_mips *c = &current_cpu_data;
58
Ralf Baechle69f24d12013-09-17 10:25:47 +020059 switch (current_cpu_type()) {
Marc St-Jean9267a302007-06-14 15:55:31 -060060 case CPU_34K:
61 /*
62 * Erratum "RPS May Cause Incorrect Instruction Execution"
63 * This code only handles VPE0, any SMP/SMTC/RTOS code
64 * making use of VPE1 will be responsable for that VPE.
65 */
66 if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2)
67 write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS);
68 break;
69 default:
70 break;
71 }
72}
73
Linus Torvalds1da177e2005-04-16 15:20:36 -070074void __init check_bugs32(void)
75{
Marc St-Jean9267a302007-06-14 15:55:31 -060076 check_errata();
Linus Torvalds1da177e2005-04-16 15:20:36 -070077}
78
79/*
80 * Probe whether cpu has config register by trying to play with
81 * alternate cache bit and see whether it matters.
82 * It's used by cpu_probe to distinguish between R3000A and R3081.
83 */
84static inline int cpu_has_confreg(void)
85{
86#ifdef CONFIG_CPU_R3000
87 extern unsigned long r3k_cache_size(unsigned long);
88 unsigned long size1, size2;
89 unsigned long cfg = read_c0_conf();
90
91 size1 = r3k_cache_size(ST0_ISC);
92 write_c0_conf(cfg ^ R30XX_CONF_AC);
93 size2 = r3k_cache_size(ST0_ISC);
94 write_c0_conf(cfg);
95 return size1 != size2;
96#else
97 return 0;
98#endif
99}
100
Robert Millanc094c992011-04-18 11:37:55 -0700101static inline void set_elf_platform(int cpu, const char *plat)
102{
103 if (cpu == 0)
104 __elf_platform = plat;
105}
106
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107/*
108 * Get the FPU Implementation/Revision.
109 */
110static inline unsigned long cpu_get_fpu_id(void)
111{
112 unsigned long tmp, fpu_id;
113
114 tmp = read_c0_status();
Paul Burton597ce172013-11-22 13:12:07 +0000115 __enable_fpu(FPU_AS_IS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 fpu_id = read_32bit_cp1_register(CP1_REVISION);
117 write_c0_status(tmp);
118 return fpu_id;
119}
120
121/*
122 * Check the CPU has an FPU the official way.
123 */
124static inline int __cpu_has_fpu(void)
125{
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100126 return ((cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127}
128
Guenter Roeck91dfc422010-02-02 08:52:20 -0800129static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
130{
131#ifdef __NEED_VMBITS_PROBE
David Daney5b7efa82010-02-08 12:27:00 -0800132 write_c0_entryhi(0x3fffffffffffe000ULL);
Guenter Roeck91dfc422010-02-02 08:52:20 -0800133 back_to_back_c0_hazard();
David Daney5b7efa82010-02-08 12:27:00 -0800134 c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL);
Guenter Roeck91dfc422010-02-02 08:52:20 -0800135#endif
136}
137
Paul Gortmaker078a55f2013-06-18 13:38:59 +0000138static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
Steven J. Hilla96102b2012-12-07 04:31:36 +0000139{
140 switch (isa) {
141 case MIPS_CPU_ISA_M64R2:
142 c->isa_level |= MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2;
143 case MIPS_CPU_ISA_M64R1:
144 c->isa_level |= MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1;
145 case MIPS_CPU_ISA_V:
146 c->isa_level |= MIPS_CPU_ISA_V;
147 case MIPS_CPU_ISA_IV:
148 c->isa_level |= MIPS_CPU_ISA_IV;
149 case MIPS_CPU_ISA_III:
Ralf Baechle1990e542013-06-26 17:06:34 +0200150 c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III;
Steven J. Hilla96102b2012-12-07 04:31:36 +0000151 break;
152
153 case MIPS_CPU_ISA_M32R2:
154 c->isa_level |= MIPS_CPU_ISA_M32R2;
155 case MIPS_CPU_ISA_M32R1:
156 c->isa_level |= MIPS_CPU_ISA_M32R1;
157 case MIPS_CPU_ISA_II:
158 c->isa_level |= MIPS_CPU_ISA_II;
Steven J. Hilla96102b2012-12-07 04:31:36 +0000159 break;
160 }
161}
162
Paul Gortmaker078a55f2013-06-18 13:38:59 +0000163static char unknown_isa[] = KERN_ERR \
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100164 "Unsupported ISA type, c0.config0: %d.";
165
166static inline unsigned int decode_config0(struct cpuinfo_mips *c)
167{
168 unsigned int config0;
169 int isa;
170
171 config0 = read_c0_config();
172
173 if (((config0 & MIPS_CONF_MT) >> 7) == 1)
174 c->options |= MIPS_CPU_TLB;
175 isa = (config0 & MIPS_CONF_AT) >> 13;
176 switch (isa) {
177 case 0:
178 switch ((config0 & MIPS_CONF_AR) >> 10) {
179 case 0:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000180 set_isa(c, MIPS_CPU_ISA_M32R1);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100181 break;
182 case 1:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000183 set_isa(c, MIPS_CPU_ISA_M32R2);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100184 break;
185 default:
186 goto unknown;
187 }
188 break;
189 case 2:
190 switch ((config0 & MIPS_CONF_AR) >> 10) {
191 case 0:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000192 set_isa(c, MIPS_CPU_ISA_M64R1);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100193 break;
194 case 1:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000195 set_isa(c, MIPS_CPU_ISA_M64R2);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100196 break;
197 default:
198 goto unknown;
199 }
200 break;
201 default:
202 goto unknown;
203 }
204
205 return config0 & MIPS_CONF_M;
206
207unknown:
208 panic(unknown_isa, config0);
209}
210
211static inline unsigned int decode_config1(struct cpuinfo_mips *c)
212{
213 unsigned int config1;
214
215 config1 = read_c0_config1();
216
217 if (config1 & MIPS_CONF1_MD)
218 c->ases |= MIPS_ASE_MDMX;
219 if (config1 & MIPS_CONF1_WR)
220 c->options |= MIPS_CPU_WATCH;
221 if (config1 & MIPS_CONF1_CA)
222 c->ases |= MIPS_ASE_MIPS16;
223 if (config1 & MIPS_CONF1_EP)
224 c->options |= MIPS_CPU_EJTAG;
225 if (config1 & MIPS_CONF1_FP) {
226 c->options |= MIPS_CPU_FPU;
227 c->options |= MIPS_CPU_32FPR;
228 }
229 if (cpu_has_tlb)
230 c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
231
232 return config1 & MIPS_CONF_M;
233}
234
235static inline unsigned int decode_config2(struct cpuinfo_mips *c)
236{
237 unsigned int config2;
238
239 config2 = read_c0_config2();
240
241 if (config2 & MIPS_CONF2_SL)
242 c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
243
244 return config2 & MIPS_CONF_M;
245}
246
247static inline unsigned int decode_config3(struct cpuinfo_mips *c)
248{
249 unsigned int config3;
250
251 config3 = read_c0_config3();
252
Steven J. Hillb2ab4f02012-09-13 16:47:58 -0500253 if (config3 & MIPS_CONF3_SM) {
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100254 c->ases |= MIPS_ASE_SMARTMIPS;
Steven J. Hillb2ab4f02012-09-13 16:47:58 -0500255 c->options |= MIPS_CPU_RIXI;
256 }
257 if (config3 & MIPS_CONF3_RXI)
258 c->options |= MIPS_CPU_RIXI;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100259 if (config3 & MIPS_CONF3_DSP)
260 c->ases |= MIPS_ASE_DSP;
Steven J. Hillee80f7c72012-08-03 10:26:04 -0500261 if (config3 & MIPS_CONF3_DSP2P)
262 c->ases |= MIPS_ASE_DSP2P;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100263 if (config3 & MIPS_CONF3_VINT)
264 c->options |= MIPS_CPU_VINT;
265 if (config3 & MIPS_CONF3_VEIC)
266 c->options |= MIPS_CPU_VEIC;
267 if (config3 & MIPS_CONF3_MT)
268 c->ases |= MIPS_ASE_MIPSMT;
269 if (config3 & MIPS_CONF3_ULRI)
270 c->options |= MIPS_CPU_ULRI;
Steven J. Hillf8fa4812012-12-07 03:51:35 +0000271 if (config3 & MIPS_CONF3_ISA)
272 c->options |= MIPS_CPU_MICROMIPS;
David Daney1e7decd2013-02-16 23:42:43 +0100273 if (config3 & MIPS_CONF3_VZ)
274 c->ases |= MIPS_ASE_VZ;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100275
276 return config3 & MIPS_CONF_M;
277}
278
279static inline unsigned int decode_config4(struct cpuinfo_mips *c)
280{
281 unsigned int config4;
282
283 config4 = read_c0_config4();
284
285 if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT
286 && cpu_has_tlb)
287 c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
288
Leonid Yegoshin1745c1e2013-11-14 16:12:23 +0000289 if (cpu_has_tlb) {
290 if (((config4 & MIPS_CONF4_IE) >> 29) == 2)
291 c->options |= MIPS_CPU_TLBINV;
292 }
293
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100294 c->kscratch_mask = (config4 >> 16) & 0xff;
295
296 return config4 & MIPS_CONF_M;
297}
298
Ralf Baechle8b8a76342013-09-19 11:15:49 +0200299static inline unsigned int decode_config5(struct cpuinfo_mips *c)
300{
301 unsigned int config5;
302
303 config5 = read_c0_config5();
304 config5 &= ~MIPS_CONF5_UFR;
305 write_c0_config5(config5);
306
307 return config5 & MIPS_CONF_M;
308}
309
Paul Gortmaker078a55f2013-06-18 13:38:59 +0000310static void decode_configs(struct cpuinfo_mips *c)
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100311{
312 int ok;
313
314 /* MIPS32 or MIPS64 compliant CPU. */
315 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
316 MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
317
318 c->scache.flags = MIPS_CACHE_NOT_PRESENT;
319
320 ok = decode_config0(c); /* Read Config registers. */
Ralf Baechle70342282013-01-22 12:59:30 +0100321 BUG_ON(!ok); /* Arch spec violation! */
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100322 if (ok)
323 ok = decode_config1(c);
324 if (ok)
325 ok = decode_config2(c);
326 if (ok)
327 ok = decode_config3(c);
328 if (ok)
329 ok = decode_config4(c);
Ralf Baechle8b8a76342013-09-19 11:15:49 +0200330 if (ok)
331 ok = decode_config5(c);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100332
333 mips_probe_watch_registers(c);
334
335 if (cpu_has_mips_r2)
336 c->core = read_c0_ebase() & 0x3ff;
337}
338
Ralf Baechle02cf2112005-10-01 13:06:32 +0100339#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 | MIPS_CPU_COUNTER)
341
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000342static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343{
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100344 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 case PRID_IMP_R2000:
346 c->cputype = CPU_R2000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000347 __cpu_name[cpu] = "R2000";
Ralf Baechle02cf2112005-10-01 13:06:32 +0100348 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
Steven J. Hill03751e72012-05-10 23:21:18 -0500349 MIPS_CPU_NOFPUEX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 if (__cpu_has_fpu())
351 c->options |= MIPS_CPU_FPU;
352 c->tlbsize = 64;
353 break;
354 case PRID_IMP_R3000:
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100355 if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) {
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000356 if (cpu_has_confreg()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357 c->cputype = CPU_R3081E;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000358 __cpu_name[cpu] = "R3081";
359 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 c->cputype = CPU_R3000A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000361 __cpu_name[cpu] = "R3000A";
362 }
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000363 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 c->cputype = CPU_R3000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000365 __cpu_name[cpu] = "R3000";
366 }
Ralf Baechle02cf2112005-10-01 13:06:32 +0100367 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
Steven J. Hill03751e72012-05-10 23:21:18 -0500368 MIPS_CPU_NOFPUEX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 if (__cpu_has_fpu())
370 c->options |= MIPS_CPU_FPU;
371 c->tlbsize = 64;
372 break;
373 case PRID_IMP_R4000:
374 if (read_c0_config() & CONF_SC) {
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100375 if ((c->processor_id & PRID_REV_MASK) >=
376 PRID_REV_R4400) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 c->cputype = CPU_R4400PC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000378 __cpu_name[cpu] = "R4400PC";
379 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 c->cputype = CPU_R4000PC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000381 __cpu_name[cpu] = "R4000PC";
382 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 } else {
Maciej W. Rozycki7f177a52013-09-23 14:01:53 +0100384 int cca = read_c0_config() & CONF_CM_CMASK;
385 int mc;
386
387 /*
388 * SC and MC versions can't be reliably told apart,
389 * but only the latter support coherent caching
390 * modes so assume the firmware has set the KSEG0
391 * coherency attribute reasonably (if uncached, we
392 * assume SC).
393 */
394 switch (cca) {
395 case CONF_CM_CACHABLE_CE:
396 case CONF_CM_CACHABLE_COW:
397 case CONF_CM_CACHABLE_CUW:
398 mc = 1;
399 break;
400 default:
401 mc = 0;
402 break;
403 }
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100404 if ((c->processor_id & PRID_REV_MASK) >=
405 PRID_REV_R4400) {
Maciej W. Rozycki7f177a52013-09-23 14:01:53 +0100406 c->cputype = mc ? CPU_R4400MC : CPU_R4400SC;
407 __cpu_name[cpu] = mc ? "R4400MC" : "R4400SC";
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000408 } else {
Maciej W. Rozycki7f177a52013-09-23 14:01:53 +0100409 c->cputype = mc ? CPU_R4000MC : CPU_R4000SC;
410 __cpu_name[cpu] = mc ? "R4000MC" : "R4000SC";
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000411 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412 }
413
Steven J. Hilla96102b2012-12-07 04:31:36 +0000414 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500416 MIPS_CPU_WATCH | MIPS_CPU_VCE |
417 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 c->tlbsize = 48;
419 break;
420 case PRID_IMP_VR41XX:
Yoichi Yuasa9f91e502013-02-21 15:38:19 +0900421 set_isa(c, MIPS_CPU_ISA_III);
422 c->options = R4K_OPTS;
423 c->tlbsize = 32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 switch (c->processor_id & 0xf0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 case PRID_REV_VR4111:
426 c->cputype = CPU_VR4111;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000427 __cpu_name[cpu] = "NEC VR4111";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 case PRID_REV_VR4121:
430 c->cputype = CPU_VR4121;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000431 __cpu_name[cpu] = "NEC VR4121";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 break;
433 case PRID_REV_VR4122:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000434 if ((c->processor_id & 0xf) < 0x3) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 c->cputype = CPU_VR4122;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000436 __cpu_name[cpu] = "NEC VR4122";
437 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438 c->cputype = CPU_VR4181A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000439 __cpu_name[cpu] = "NEC VR4181A";
440 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 break;
442 case PRID_REV_VR4130:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000443 if ((c->processor_id & 0xf) < 0x4) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 c->cputype = CPU_VR4131;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000445 __cpu_name[cpu] = "NEC VR4131";
446 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 c->cputype = CPU_VR4133;
Yoichi Yuasa9f91e502013-02-21 15:38:19 +0900448 c->options |= MIPS_CPU_LLSC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000449 __cpu_name[cpu] = "NEC VR4133";
450 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 break;
452 default:
453 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
454 c->cputype = CPU_VR41XX;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000455 __cpu_name[cpu] = "NEC Vr41xx";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 break;
457 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 break;
459 case PRID_IMP_R4300:
460 c->cputype = CPU_R4300;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000461 __cpu_name[cpu] = "R4300";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000462 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500464 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 c->tlbsize = 32;
466 break;
467 case PRID_IMP_R4600:
468 c->cputype = CPU_R4600;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000469 __cpu_name[cpu] = "R4600";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000470 set_isa(c, MIPS_CPU_ISA_III);
Thiemo Seufer075e7502005-07-27 21:48:12 +0000471 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
472 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473 c->tlbsize = 48;
474 break;
475 #if 0
Steven J. Hill03751e72012-05-10 23:21:18 -0500476 case PRID_IMP_R4650:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 /*
478 * This processor doesn't have an MMU, so it's not
479 * "real easy" to run Linux on it. It is left purely
480 * for documentation. Commented out because it shares
481 * it's c0_prid id number with the TX3900.
482 */
Ralf Baechlea3dddd52006-03-11 08:18:41 +0000483 c->cputype = CPU_R4650;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000484 __cpu_name[cpu] = "R4650";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000485 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
Steven J. Hill03751e72012-05-10 23:21:18 -0500487 c->tlbsize = 48;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 break;
489 #endif
490 case PRID_IMP_TX39:
Ralf Baechle02cf2112005-10-01 13:06:32 +0100491 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492
493 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
494 c->cputype = CPU_TX3927;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000495 __cpu_name[cpu] = "TX3927";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 c->tlbsize = 64;
497 } else {
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100498 switch (c->processor_id & PRID_REV_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 case PRID_REV_TX3912:
500 c->cputype = CPU_TX3912;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000501 __cpu_name[cpu] = "TX3912";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 c->tlbsize = 32;
503 break;
504 case PRID_REV_TX3922:
505 c->cputype = CPU_TX3922;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000506 __cpu_name[cpu] = "TX3922";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 c->tlbsize = 64;
508 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 }
510 }
511 break;
512 case PRID_IMP_R4700:
513 c->cputype = CPU_R4700;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000514 __cpu_name[cpu] = "R4700";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000515 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500517 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 c->tlbsize = 48;
519 break;
520 case PRID_IMP_TX49:
521 c->cputype = CPU_TX49XX;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000522 __cpu_name[cpu] = "R49XX";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000523 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524 c->options = R4K_OPTS | MIPS_CPU_LLSC;
525 if (!(c->processor_id & 0x08))
526 c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
527 c->tlbsize = 48;
528 break;
529 case PRID_IMP_R5000:
530 c->cputype = CPU_R5000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000531 __cpu_name[cpu] = "R5000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000532 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500534 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 c->tlbsize = 48;
536 break;
537 case PRID_IMP_R5432:
538 c->cputype = CPU_R5432;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000539 __cpu_name[cpu] = "R5432";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000540 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500542 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 c->tlbsize = 48;
544 break;
545 case PRID_IMP_R5500:
546 c->cputype = CPU_R5500;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000547 __cpu_name[cpu] = "R5500";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000548 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500550 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 c->tlbsize = 48;
552 break;
553 case PRID_IMP_NEVADA:
554 c->cputype = CPU_NEVADA;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000555 __cpu_name[cpu] = "Nevada";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000556 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500558 MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 c->tlbsize = 48;
560 break;
561 case PRID_IMP_R6000:
562 c->cputype = CPU_R6000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000563 __cpu_name[cpu] = "R6000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000564 set_isa(c, MIPS_CPU_ISA_II);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
Steven J. Hill03751e72012-05-10 23:21:18 -0500566 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 c->tlbsize = 32;
568 break;
569 case PRID_IMP_R6000A:
570 c->cputype = CPU_R6000A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000571 __cpu_name[cpu] = "R6000A";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000572 set_isa(c, MIPS_CPU_ISA_II);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
Steven J. Hill03751e72012-05-10 23:21:18 -0500574 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 c->tlbsize = 32;
576 break;
577 case PRID_IMP_RM7000:
578 c->cputype = CPU_RM7000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000579 __cpu_name[cpu] = "RM7000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000580 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500582 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 /*
Ralf Baechle70342282013-01-22 12:59:30 +0100584 * Undocumented RM7000: Bit 29 in the info register of
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 * the RM7000 v2.0 indicates if the TLB has 48 or 64
586 * entries.
587 *
Ralf Baechle70342282013-01-22 12:59:30 +0100588 * 29 1 => 64 entry JTLB
589 * 0 => 48 entry JTLB
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 */
591 c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
592 break;
593 case PRID_IMP_RM9000:
594 c->cputype = CPU_RM9000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000595 __cpu_name[cpu] = "RM9000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000596 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500598 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 /*
600 * Bit 29 in the info register of the RM9000
601 * indicates if the TLB has 48 or 64 entries.
602 *
Ralf Baechle70342282013-01-22 12:59:30 +0100603 * 29 1 => 64 entry JTLB
604 * 0 => 48 entry JTLB
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 */
606 c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
607 break;
608 case PRID_IMP_R8000:
609 c->cputype = CPU_R8000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000610 __cpu_name[cpu] = "RM8000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000611 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500613 MIPS_CPU_FPU | MIPS_CPU_32FPR |
614 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 c->tlbsize = 384; /* has weird TLB: 3-way x 128 */
616 break;
617 case PRID_IMP_R10000:
618 c->cputype = CPU_R10000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000619 __cpu_name[cpu] = "R10000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000620 set_isa(c, MIPS_CPU_ISA_IV);
Ralf Baechle8b366122005-11-22 17:53:59 +0000621 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500622 MIPS_CPU_FPU | MIPS_CPU_32FPR |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
Steven J. Hill03751e72012-05-10 23:21:18 -0500624 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 c->tlbsize = 64;
626 break;
627 case PRID_IMP_R12000:
628 c->cputype = CPU_R12000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000629 __cpu_name[cpu] = "R12000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000630 set_isa(c, MIPS_CPU_ISA_IV);
Ralf Baechle8b366122005-11-22 17:53:59 +0000631 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500632 MIPS_CPU_FPU | MIPS_CPU_32FPR |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
Steven J. Hill03751e72012-05-10 23:21:18 -0500634 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635 c->tlbsize = 64;
636 break;
Kumba44d921b2006-05-16 22:23:59 -0400637 case PRID_IMP_R14000:
638 c->cputype = CPU_R14000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000639 __cpu_name[cpu] = "R14000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000640 set_isa(c, MIPS_CPU_ISA_IV);
Kumba44d921b2006-05-16 22:23:59 -0400641 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500642 MIPS_CPU_FPU | MIPS_CPU_32FPR |
Kumba44d921b2006-05-16 22:23:59 -0400643 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
Steven J. Hill03751e72012-05-10 23:21:18 -0500644 MIPS_CPU_LLSC;
Kumba44d921b2006-05-16 22:23:59 -0400645 c->tlbsize = 64;
646 break;
Fuxin Zhang2a21c732007-06-06 14:52:43 +0800647 case PRID_IMP_LOONGSON2:
648 c->cputype = CPU_LOONGSON2;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000649 __cpu_name[cpu] = "ICT Loongson-2";
Robert Millan5aac1e82011-04-16 11:29:29 -0700650
651 switch (c->processor_id & PRID_REV_MASK) {
652 case PRID_REV_LOONGSON2E:
653 set_elf_platform(cpu, "loongson2e");
654 break;
655 case PRID_REV_LOONGSON2F:
656 set_elf_platform(cpu, "loongson2f");
657 break;
658 }
659
Steven J. Hilla96102b2012-12-07 04:31:36 +0000660 set_isa(c, MIPS_CPU_ISA_III);
Fuxin Zhang2a21c732007-06-06 14:52:43 +0800661 c->options = R4K_OPTS |
662 MIPS_CPU_FPU | MIPS_CPU_LLSC |
663 MIPS_CPU_32FPR;
664 c->tlbsize = 64;
665 break;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100666 case PRID_IMP_LOONGSON1:
667 decode_configs(c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100669 c->cputype = CPU_LOONGSON1;
Ralf Baechleb4672d32005-12-08 14:04:24 +0000670
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100671 switch (c->processor_id & PRID_REV_MASK) {
672 case PRID_REV_LOONGSON1B:
673 __cpu_name[cpu] = "Loongson 1B";
Ralf Baechleb4672d32005-12-08 14:04:24 +0000674 break;
Ralf Baechleb4672d32005-12-08 14:04:24 +0000675 }
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100676
Ralf Baechle41943182005-05-05 16:45:59 +0000677 break;
Ralf Baechle41943182005-05-05 16:45:59 +0000678 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679}
680
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000681static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682{
Ralf Baechle41943182005-05-05 16:45:59 +0000683 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100684 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 case PRID_IMP_4KC:
686 c->cputype = CPU_4KC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000687 __cpu_name[cpu] = "MIPS 4Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 break;
689 case PRID_IMP_4KEC:
Ralf Baechle2b07bd02005-04-08 20:36:05 +0000690 case PRID_IMP_4KECR2:
691 c->cputype = CPU_4KEC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000692 __cpu_name[cpu] = "MIPS 4KEc";
Ralf Baechle2b07bd02005-04-08 20:36:05 +0000693 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 case PRID_IMP_4KSC:
Ralf Baechle8afcb5d2005-10-04 15:01:26 +0100695 case PRID_IMP_4KSD:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 c->cputype = CPU_4KSC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000697 __cpu_name[cpu] = "MIPS 4KSc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 break;
699 case PRID_IMP_5KC:
700 c->cputype = CPU_5KC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000701 __cpu_name[cpu] = "MIPS 5Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 break;
Leonid Yegoshin78d48032012-07-06 21:56:01 +0200703 case PRID_IMP_5KE:
704 c->cputype = CPU_5KE;
705 __cpu_name[cpu] = "MIPS 5KE";
706 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707 case PRID_IMP_20KC:
708 c->cputype = CPU_20KC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000709 __cpu_name[cpu] = "MIPS 20Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710 break;
711 case PRID_IMP_24K:
712 c->cputype = CPU_24K;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000713 __cpu_name[cpu] = "MIPS 24Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714 break;
John Crispin42f3cae2013-01-11 22:44:10 +0100715 case PRID_IMP_24KE:
716 c->cputype = CPU_24K;
717 __cpu_name[cpu] = "MIPS 24KEc";
718 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719 case PRID_IMP_25KF:
720 c->cputype = CPU_25KF;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000721 __cpu_name[cpu] = "MIPS 25Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 break;
Ralf Baechlebbc7f222005-07-12 16:12:05 +0000723 case PRID_IMP_34K:
724 c->cputype = CPU_34K;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000725 __cpu_name[cpu] = "MIPS 34Kc";
Ralf Baechlebbc7f222005-07-12 16:12:05 +0000726 break;
Chris Dearmanc6209532006-05-02 14:08:46 +0100727 case PRID_IMP_74K:
728 c->cputype = CPU_74K;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000729 __cpu_name[cpu] = "MIPS 74Kc";
Chris Dearmanc6209532006-05-02 14:08:46 +0100730 break;
Steven J. Hill113c62d2012-07-06 23:56:00 +0200731 case PRID_IMP_M14KC:
732 c->cputype = CPU_M14KC;
733 __cpu_name[cpu] = "MIPS M14Kc";
734 break;
Steven J. Hillf8fa4812012-12-07 03:51:35 +0000735 case PRID_IMP_M14KEC:
736 c->cputype = CPU_M14KEC;
737 __cpu_name[cpu] = "MIPS M14KEc";
738 break;
Ralf Baechle39b8d522008-04-28 17:14:26 +0100739 case PRID_IMP_1004K:
740 c->cputype = CPU_1004K;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000741 __cpu_name[cpu] = "MIPS 1004Kc";
Ralf Baechle39b8d522008-04-28 17:14:26 +0100742 break;
Steven J. Hill006a8512012-06-26 04:11:03 +0000743 case PRID_IMP_1074K:
744 c->cputype = CPU_74K;
745 __cpu_name[cpu] = "MIPS 1074Kc";
746 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 }
Chris Dearman0b6d4972007-09-13 12:32:02 +0100748
749 spram_config();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750}
751
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000752static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753{
Ralf Baechle41943182005-05-05 16:45:59 +0000754 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100755 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 case PRID_IMP_AU1_REV1:
757 case PRID_IMP_AU1_REV2:
Manuel Lauss270717a2009-03-25 17:49:28 +0100758 c->cputype = CPU_ALCHEMY;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 switch ((c->processor_id >> 24) & 0xff) {
760 case 0:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000761 __cpu_name[cpu] = "Au1000";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 break;
763 case 1:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000764 __cpu_name[cpu] = "Au1500";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 break;
766 case 2:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000767 __cpu_name[cpu] = "Au1100";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 break;
769 case 3:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000770 __cpu_name[cpu] = "Au1550";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771 break;
Pete Popove3ad1c22005-03-01 06:33:16 +0000772 case 4:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000773 __cpu_name[cpu] = "Au1200";
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100774 if ((c->processor_id & PRID_REV_MASK) == 2)
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000775 __cpu_name[cpu] = "Au1250";
Manuel Lauss237cfee2007-12-06 09:07:55 +0100776 break;
777 case 5:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000778 __cpu_name[cpu] = "Au1210";
Pete Popove3ad1c22005-03-01 06:33:16 +0000779 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780 default:
Manuel Lauss270717a2009-03-25 17:49:28 +0100781 __cpu_name[cpu] = "Au1xxx";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782 break;
783 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784 break;
785 }
786}
787
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000788static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789{
Ralf Baechle41943182005-05-05 16:45:59 +0000790 decode_configs(c);
Ralf Baechle02cf2112005-10-01 13:06:32 +0100791
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100792 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793 case PRID_IMP_SB1:
794 c->cputype = CPU_SB1;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000795 __cpu_name[cpu] = "SiByte SB1";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796 /* FPU in pass1 is known to have issues. */
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100797 if ((c->processor_id & PRID_REV_MASK) < 0x02)
Ralf Baechle010b8532006-01-29 18:42:08 +0000798 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 break;
Andrew Isaacson93ce2f522005-10-19 23:56:20 -0700800 case PRID_IMP_SB1A:
801 c->cputype = CPU_SB1A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000802 __cpu_name[cpu] = "SiByte SB1A";
Andrew Isaacson93ce2f522005-10-19 23:56:20 -0700803 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 }
805}
806
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000807static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808{
Ralf Baechle41943182005-05-05 16:45:59 +0000809 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100810 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 case PRID_IMP_SR71000:
812 c->cputype = CPU_SR71000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000813 __cpu_name[cpu] = "Sandcraft SR71000";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814 c->scache.ways = 8;
815 c->tlbsize = 64;
816 break;
817 }
818}
819
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000820static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
Pete Popovbdf21b12005-07-14 17:47:57 +0000821{
822 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100823 switch (c->processor_id & PRID_IMP_MASK) {
Pete Popovbdf21b12005-07-14 17:47:57 +0000824 case PRID_IMP_PR4450:
825 c->cputype = CPU_PR4450;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000826 __cpu_name[cpu] = "Philips PR4450";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000827 set_isa(c, MIPS_CPU_ISA_M32R1);
Pete Popovbdf21b12005-07-14 17:47:57 +0000828 break;
Pete Popovbdf21b12005-07-14 17:47:57 +0000829 }
830}
831
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000832static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +0200833{
834 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100835 switch (c->processor_id & PRID_IMP_MASK) {
Kevin Cernekee190fca32010-11-23 10:26:45 -0800836 case PRID_IMP_BMIPS32_REV4:
837 case PRID_IMP_BMIPS32_REV8:
Kevin Cernekee602977b2010-10-16 14:22:30 -0700838 c->cputype = CPU_BMIPS32;
839 __cpu_name[cpu] = "Broadcom BMIPS32";
Kevin Cernekee06785df2011-04-16 11:29:28 -0700840 set_elf_platform(cpu, "bmips32");
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +0200841 break;
Kevin Cernekee602977b2010-10-16 14:22:30 -0700842 case PRID_IMP_BMIPS3300:
843 case PRID_IMP_BMIPS3300_ALT:
844 case PRID_IMP_BMIPS3300_BUG:
845 c->cputype = CPU_BMIPS3300;
846 __cpu_name[cpu] = "Broadcom BMIPS3300";
Kevin Cernekee06785df2011-04-16 11:29:28 -0700847 set_elf_platform(cpu, "bmips3300");
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +0200848 break;
Kevin Cernekee602977b2010-10-16 14:22:30 -0700849 case PRID_IMP_BMIPS43XX: {
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100850 int rev = c->processor_id & PRID_REV_MASK;
Kevin Cernekee602977b2010-10-16 14:22:30 -0700851
852 if (rev >= PRID_REV_BMIPS4380_LO &&
853 rev <= PRID_REV_BMIPS4380_HI) {
854 c->cputype = CPU_BMIPS4380;
855 __cpu_name[cpu] = "Broadcom BMIPS4380";
Kevin Cernekee06785df2011-04-16 11:29:28 -0700856 set_elf_platform(cpu, "bmips4380");
Kevin Cernekee602977b2010-10-16 14:22:30 -0700857 } else {
858 c->cputype = CPU_BMIPS4350;
859 __cpu_name[cpu] = "Broadcom BMIPS4350";
Kevin Cernekee06785df2011-04-16 11:29:28 -0700860 set_elf_platform(cpu, "bmips4350");
Maxime Bizon0de663e2009-08-18 13:23:37 +0100861 }
862 break;
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +0200863 }
Kevin Cernekee602977b2010-10-16 14:22:30 -0700864 case PRID_IMP_BMIPS5000:
865 c->cputype = CPU_BMIPS5000;
866 __cpu_name[cpu] = "Broadcom BMIPS5000";
Kevin Cernekee06785df2011-04-16 11:29:28 -0700867 set_elf_platform(cpu, "bmips5000");
Kevin Cernekee602977b2010-10-16 14:22:30 -0700868 c->options |= MIPS_CPU_ULRI;
869 break;
Kevin Cernekee602977b2010-10-16 14:22:30 -0700870 }
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +0200871}
872
David Daney0dd47812008-12-11 15:33:26 -0800873static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
874{
875 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100876 switch (c->processor_id & PRID_IMP_MASK) {
David Daney0dd47812008-12-11 15:33:26 -0800877 case PRID_IMP_CAVIUM_CN38XX:
878 case PRID_IMP_CAVIUM_CN31XX:
879 case PRID_IMP_CAVIUM_CN30XX:
David Daney6f329462010-02-10 15:12:48 -0800880 c->cputype = CPU_CAVIUM_OCTEON;
881 __cpu_name[cpu] = "Cavium Octeon";
882 goto platform;
David Daney0dd47812008-12-11 15:33:26 -0800883 case PRID_IMP_CAVIUM_CN58XX:
884 case PRID_IMP_CAVIUM_CN56XX:
885 case PRID_IMP_CAVIUM_CN50XX:
886 case PRID_IMP_CAVIUM_CN52XX:
David Daney6f329462010-02-10 15:12:48 -0800887 c->cputype = CPU_CAVIUM_OCTEON_PLUS;
888 __cpu_name[cpu] = "Cavium Octeon+";
889platform:
Robert Millanc094c992011-04-18 11:37:55 -0700890 set_elf_platform(cpu, "octeon");
David Daney0dd47812008-12-11 15:33:26 -0800891 break;
David Daneya1431b62011-09-24 02:29:54 +0200892 case PRID_IMP_CAVIUM_CN61XX:
David Daney0e56b382010-10-07 16:03:45 -0700893 case PRID_IMP_CAVIUM_CN63XX:
David Daneya1431b62011-09-24 02:29:54 +0200894 case PRID_IMP_CAVIUM_CN66XX:
895 case PRID_IMP_CAVIUM_CN68XX:
David Daneyaf04bb82013-07-29 15:07:01 -0700896 case PRID_IMP_CAVIUM_CNF71XX:
David Daney0e56b382010-10-07 16:03:45 -0700897 c->cputype = CPU_CAVIUM_OCTEON2;
898 __cpu_name[cpu] = "Cavium Octeon II";
Robert Millanc094c992011-04-18 11:37:55 -0700899 set_elf_platform(cpu, "octeon2");
David Daney0e56b382010-10-07 16:03:45 -0700900 break;
David Daneyaf04bb82013-07-29 15:07:01 -0700901 case PRID_IMP_CAVIUM_CN70XX:
902 case PRID_IMP_CAVIUM_CN78XX:
903 c->cputype = CPU_CAVIUM_OCTEON3;
904 __cpu_name[cpu] = "Cavium Octeon III";
905 set_elf_platform(cpu, "octeon3");
906 break;
David Daney0dd47812008-12-11 15:33:26 -0800907 default:
908 printk(KERN_INFO "Unknown Octeon chip!\n");
909 c->cputype = CPU_UNKNOWN;
910 break;
911 }
912}
913
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +0000914static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
915{
916 decode_configs(c);
917 /* JZRISC does not implement the CP0 counter. */
918 c->options &= ~MIPS_CPU_COUNTER;
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100919 switch (c->processor_id & PRID_IMP_MASK) {
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +0000920 case PRID_IMP_JZRISC:
921 c->cputype = CPU_JZRISC;
922 __cpu_name[cpu] = "Ingenic JZRISC";
923 break;
924 default:
925 panic("Unknown Ingenic Processor ID!");
926 break;
927 }
928}
929
Jayachandran Ca7117c62011-05-11 12:04:58 +0530930static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
931{
932 decode_configs(c);
933
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100934 if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) {
Manuel Lauss809f36c2011-11-01 20:03:30 +0100935 c->cputype = CPU_ALCHEMY;
936 __cpu_name[cpu] = "Au1300";
937 /* following stuff is not for Alchemy */
938 return;
939 }
940
Ralf Baechle70342282013-01-22 12:59:30 +0100941 c->options = (MIPS_CPU_TLB |
942 MIPS_CPU_4KEX |
Jayachandran Ca7117c62011-05-11 12:04:58 +0530943 MIPS_CPU_COUNTER |
Ralf Baechle70342282013-01-22 12:59:30 +0100944 MIPS_CPU_DIVEC |
945 MIPS_CPU_WATCH |
946 MIPS_CPU_EJTAG |
Jayachandran Ca7117c62011-05-11 12:04:58 +0530947 MIPS_CPU_LLSC);
948
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100949 switch (c->processor_id & PRID_IMP_MASK) {
Jayachandran C4ca86a22013-08-11 14:43:54 +0530950 case PRID_IMP_NETLOGIC_XLP2XX:
951 c->cputype = CPU_XLP;
952 __cpu_name[cpu] = "Broadcom XLPII";
953 break;
954
Jayachandran C2aa54b22011-11-16 00:21:29 +0000955 case PRID_IMP_NETLOGIC_XLP8XX:
956 case PRID_IMP_NETLOGIC_XLP3XX:
Jayachandran Ca3d4fb22011-11-16 00:21:20 +0000957 c->cputype = CPU_XLP;
958 __cpu_name[cpu] = "Netlogic XLP";
959 break;
960
Jayachandran Ca7117c62011-05-11 12:04:58 +0530961 case PRID_IMP_NETLOGIC_XLR732:
962 case PRID_IMP_NETLOGIC_XLR716:
963 case PRID_IMP_NETLOGIC_XLR532:
964 case PRID_IMP_NETLOGIC_XLR308:
965 case PRID_IMP_NETLOGIC_XLR532C:
966 case PRID_IMP_NETLOGIC_XLR516C:
967 case PRID_IMP_NETLOGIC_XLR508C:
968 case PRID_IMP_NETLOGIC_XLR308C:
969 c->cputype = CPU_XLR;
970 __cpu_name[cpu] = "Netlogic XLR";
971 break;
972
973 case PRID_IMP_NETLOGIC_XLS608:
974 case PRID_IMP_NETLOGIC_XLS408:
975 case PRID_IMP_NETLOGIC_XLS404:
976 case PRID_IMP_NETLOGIC_XLS208:
977 case PRID_IMP_NETLOGIC_XLS204:
978 case PRID_IMP_NETLOGIC_XLS108:
979 case PRID_IMP_NETLOGIC_XLS104:
980 case PRID_IMP_NETLOGIC_XLS616B:
981 case PRID_IMP_NETLOGIC_XLS608B:
982 case PRID_IMP_NETLOGIC_XLS416B:
983 case PRID_IMP_NETLOGIC_XLS412B:
984 case PRID_IMP_NETLOGIC_XLS408B:
985 case PRID_IMP_NETLOGIC_XLS404B:
986 c->cputype = CPU_XLR;
987 __cpu_name[cpu] = "Netlogic XLS";
988 break;
989
990 default:
Jayachandran Ca3d4fb22011-11-16 00:21:20 +0000991 pr_info("Unknown Netlogic chip id [%02x]!\n",
Jayachandran Ca7117c62011-05-11 12:04:58 +0530992 c->processor_id);
993 c->cputype = CPU_XLR;
994 break;
995 }
996
Jayachandran Ca3d4fb22011-11-16 00:21:20 +0000997 if (c->cputype == CPU_XLP) {
Steven J. Hilla96102b2012-12-07 04:31:36 +0000998 set_isa(c, MIPS_CPU_ISA_M64R2);
Jayachandran Ca3d4fb22011-11-16 00:21:20 +0000999 c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK);
1000 /* This will be updated again after all threads are woken up */
1001 c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
1002 } else {
Steven J. Hilla96102b2012-12-07 04:31:36 +00001003 set_isa(c, MIPS_CPU_ISA_M64R1);
Jayachandran Ca3d4fb22011-11-16 00:21:20 +00001004 c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1;
1005 }
Jayachandran C7777b932013-06-11 14:41:35 +00001006 c->kscratch_mask = 0xf;
Jayachandran Ca7117c62011-05-11 12:04:58 +05301007}
1008
David Daney949e51b2010-10-14 11:32:33 -07001009#ifdef CONFIG_64BIT
1010/* For use by uaccess.h */
1011u64 __ua_limit;
1012EXPORT_SYMBOL(__ua_limit);
1013#endif
1014
Ralf Baechle9966db252007-10-11 23:46:17 +01001015const char *__cpu_name[NR_CPUS];
David Daney874fd3b2010-01-28 16:52:12 -08001016const char *__elf_platform;
Ralf Baechle9966db252007-10-11 23:46:17 +01001017
Paul Gortmaker078a55f2013-06-18 13:38:59 +00001018void cpu_probe(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019{
1020 struct cpuinfo_mips *c = &current_cpu_data;
Ralf Baechle9966db252007-10-11 23:46:17 +01001021 unsigned int cpu = smp_processor_id();
Linus Torvalds1da177e2005-04-16 15:20:36 -07001022
Ralf Baechle70342282013-01-22 12:59:30 +01001023 c->processor_id = PRID_IMP_UNKNOWN;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001024 c->fpu_id = FPIR_IMP_NONE;
1025 c->cputype = CPU_UNKNOWN;
1026
1027 c->processor_id = read_c0_prid();
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001028 switch (c->processor_id & PRID_COMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029 case PRID_COMP_LEGACY:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001030 cpu_probe_legacy(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001031 break;
1032 case PRID_COMP_MIPS:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001033 cpu_probe_mips(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001034 break;
1035 case PRID_COMP_ALCHEMY:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001036 cpu_probe_alchemy(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001037 break;
1038 case PRID_COMP_SIBYTE:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001039 cpu_probe_sibyte(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040 break;
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001041 case PRID_COMP_BROADCOM:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001042 cpu_probe_broadcom(c, cpu);
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001043 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044 case PRID_COMP_SANDCRAFT:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001045 cpu_probe_sandcraft(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001046 break;
Daniel Lairda92b0582008-03-06 09:07:18 +00001047 case PRID_COMP_NXP:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001048 cpu_probe_nxp(c, cpu);
Ralf Baechlea3dddd52006-03-11 08:18:41 +00001049 break;
David Daney0dd47812008-12-11 15:33:26 -08001050 case PRID_COMP_CAVIUM:
1051 cpu_probe_cavium(c, cpu);
1052 break;
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +00001053 case PRID_COMP_INGENIC:
1054 cpu_probe_ingenic(c, cpu);
1055 break;
Jayachandran Ca7117c62011-05-11 12:04:58 +05301056 case PRID_COMP_NETLOGIC:
1057 cpu_probe_netlogic(c, cpu);
1058 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001059 }
Franck Bui-Huudec8b1c2007-10-08 16:11:51 +02001060
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001061 BUG_ON(!__cpu_name[cpu]);
1062 BUG_ON(c->cputype == CPU_UNKNOWN);
1063
Franck Bui-Huudec8b1c2007-10-08 16:11:51 +02001064 /*
1065 * Platform code can force the cpu type to optimize code
1066 * generation. In that case be sure the cpu type is correctly
1067 * manually setup otherwise it could trigger some nasty bugs.
1068 */
1069 BUG_ON(current_cpu_type() != c->cputype);
1070
Kevin Cernekee0103d232010-05-02 14:43:52 -07001071 if (mips_fpu_disabled)
1072 c->options &= ~MIPS_CPU_FPU;
1073
1074 if (mips_dsp_disabled)
Steven J. Hillee80f7c72012-08-03 10:26:04 -05001075 c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
Kevin Cernekee0103d232010-05-02 14:43:52 -07001076
Ralf Baechle41943182005-05-05 16:45:59 +00001077 if (c->options & MIPS_CPU_FPU) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001078 c->fpu_id = cpu_get_fpu_id();
Ralf Baechle41943182005-05-05 16:45:59 +00001079
Deng-Cheng Zhuadb37892013-04-01 18:14:28 +00001080 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1081 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
Ralf Baechle41943182005-05-05 16:45:59 +00001082 if (c->fpu_id & MIPS_FPIR_3D)
1083 c->ases |= MIPS_ASE_MIPS3D;
1084 }
1085 }
Ralf Baechle9966db252007-10-11 23:46:17 +01001086
Al Cooperda4b62c2012-07-13 16:44:51 -04001087 if (cpu_has_mips_r2) {
Ralf Baechlef6771db2007-11-08 18:02:29 +00001088 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
Al Cooperda4b62c2012-07-13 16:44:51 -04001089 /* R2 has Performance Counter Interrupt indicator */
1090 c->options |= MIPS_CPU_PCI;
1091 }
Ralf Baechlef6771db2007-11-08 18:02:29 +00001092 else
1093 c->srsets = 1;
Guenter Roeck91dfc422010-02-02 08:52:20 -08001094
1095 cpu_probe_vmbits(c);
David Daney949e51b2010-10-14 11:32:33 -07001096
1097#ifdef CONFIG_64BIT
1098 if (cpu == 0)
1099 __ua_limit = ~((1ull << cpu_vmbits) - 1);
1100#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101}
1102
Paul Gortmaker078a55f2013-06-18 13:38:59 +00001103void cpu_report(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104{
1105 struct cpuinfo_mips *c = &current_cpu_data;
1106
Leonid Yegoshind9f897c2013-10-07 10:43:32 +01001107 pr_info("CPU%d revision is: %08x (%s)\n",
1108 smp_processor_id(), c->processor_id, cpu_name_string());
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 if (c->options & MIPS_CPU_FPU)
Ralf Baechle9966db252007-10-11 23:46:17 +01001110 printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111}