blob: ca9b9c62c6eacc675ad75d925f9d3390e1f38976 [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>
Maciej W. Rozyckif6843622015-04-03 23:27:26 +010023#include <asm/cpu-features.h>
Ralf Baechle69f24d12013-09-17 10:25:47 +020024#include <asm/cpu-type.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/fpu.h>
26#include <asm/mipsregs.h>
Paul Burton30ee6152014-03-27 10:57:30 +000027#include <asm/mipsmtregs.h>
Paul Burtona5e9a692014-01-27 15:23:10 +000028#include <asm/msa.h>
David Daney654f57b2008-09-23 00:07:16 -070029#include <asm/watch.h>
Paul Gortmaker06372a62011-07-23 16:26:41 -040030#include <asm/elf.h>
Markos Chandras4f12b912014-07-18 10:51:32 +010031#include <asm/pgtable-bits.h>
Chris Dearmana074f0e2009-07-10 01:51:27 -070032#include <asm/spram.h>
David Daney949e51b2010-10-14 11:32:33 -070033#include <asm/uaccess.h>
34
Maciej W. Rozyckif6843622015-04-03 23:27:26 +010035/*
36 * Set the FIR feature flags for the FPU emulator.
37 */
38static void cpu_set_nofpu_id(struct cpuinfo_mips *c)
39{
40 u32 value;
41
42 value = 0;
43 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
44 MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
45 MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
46 value |= MIPS_FPIR_D | MIPS_FPIR_S;
47 if (c->isa_level & (MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
48 MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
49 value |= MIPS_FPIR_F64 | MIPS_FPIR_L | MIPS_FPIR_W;
50 c->fpu_id = value;
51}
52
Paul Gortmaker078a55f2013-06-18 13:38:59 +000053static int mips_fpu_disabled;
Kevin Cernekee0103d232010-05-02 14:43:52 -070054
55static int __init fpu_disable(char *s)
56{
Maciej W. Rozyckif6843622015-04-03 23:27:26 +010057 boot_cpu_data.options &= ~MIPS_CPU_FPU;
58 cpu_set_nofpu_id(&boot_cpu_data);
Kevin Cernekee0103d232010-05-02 14:43:52 -070059 mips_fpu_disabled = 1;
60
61 return 1;
62}
63
64__setup("nofpu", fpu_disable);
65
Paul Gortmaker078a55f2013-06-18 13:38:59 +000066int mips_dsp_disabled;
Kevin Cernekee0103d232010-05-02 14:43:52 -070067
68static int __init dsp_disable(char *s)
69{
Steven J. Hillee80f7c72012-08-03 10:26:04 -050070 cpu_data[0].ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
Kevin Cernekee0103d232010-05-02 14:43:52 -070071 mips_dsp_disabled = 1;
72
73 return 1;
74}
75
76__setup("nodsp", dsp_disable);
77
Markos Chandras3d528b32014-07-14 12:46:13 +010078static int mips_htw_disabled;
79
80static int __init htw_disable(char *s)
81{
82 mips_htw_disabled = 1;
83 cpu_data[0].options &= ~MIPS_CPU_HTW;
84 write_c0_pwctl(read_c0_pwctl() &
85 ~(1 << MIPS_PWCTL_PWEN_SHIFT));
86
87 return 1;
88}
89
90__setup("nohtw", htw_disable);
91
Markos Chandras97f4ad22014-08-29 09:37:26 +010092static int mips_ftlb_disabled;
93static int mips_has_ftlb_configured;
94
95static void set_ftlb_enable(struct cpuinfo_mips *c, int enable);
96
97static int __init ftlb_disable(char *s)
98{
99 unsigned int config4, mmuextdef;
100
101 /*
102 * If the core hasn't done any FTLB configuration, there is nothing
103 * for us to do here.
104 */
105 if (!mips_has_ftlb_configured)
106 return 1;
107
108 /* Disable it in the boot cpu */
109 set_ftlb_enable(&cpu_data[0], 0);
110
111 back_to_back_c0_hazard();
112
113 config4 = read_c0_config4();
114
115 /* Check that FTLB has been disabled */
116 mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF;
117 /* MMUSIZEEXT == VTLB ON, FTLB OFF */
118 if (mmuextdef == MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT) {
119 /* This should never happen */
120 pr_warn("FTLB could not be disabled!\n");
121 return 1;
122 }
123
124 mips_ftlb_disabled = 1;
125 mips_has_ftlb_configured = 0;
126
127 /*
128 * noftlb is mainly used for debug purposes so print
129 * an informative message instead of using pr_debug()
130 */
131 pr_info("FTLB has been disabled\n");
132
133 /*
134 * Some of these bits are duplicated in the decode_config4.
135 * MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT is the only possible case
136 * once FTLB has been disabled so undo what decode_config4 did.
137 */
138 cpu_data[0].tlbsize -= cpu_data[0].tlbsizeftlbways *
139 cpu_data[0].tlbsizeftlbsets;
140 cpu_data[0].tlbsizeftlbsets = 0;
141 cpu_data[0].tlbsizeftlbways = 0;
142
143 return 1;
144}
145
146__setup("noftlb", ftlb_disable);
147
148
Marc St-Jean9267a302007-06-14 15:55:31 -0600149static inline void check_errata(void)
150{
151 struct cpuinfo_mips *c = &current_cpu_data;
152
Ralf Baechle69f24d12013-09-17 10:25:47 +0200153 switch (current_cpu_type()) {
Marc St-Jean9267a302007-06-14 15:55:31 -0600154 case CPU_34K:
155 /*
156 * Erratum "RPS May Cause Incorrect Instruction Execution"
Ralf Baechleb633648c52014-05-23 16:29:44 +0200157 * This code only handles VPE0, any SMP/RTOS code
Marc St-Jean9267a302007-06-14 15:55:31 -0600158 * making use of VPE1 will be responsable for that VPE.
159 */
160 if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2)
161 write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS);
162 break;
163 default:
164 break;
165 }
166}
167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168void __init check_bugs32(void)
169{
Marc St-Jean9267a302007-06-14 15:55:31 -0600170 check_errata();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171}
172
173/*
174 * Probe whether cpu has config register by trying to play with
175 * alternate cache bit and see whether it matters.
176 * It's used by cpu_probe to distinguish between R3000A and R3081.
177 */
178static inline int cpu_has_confreg(void)
179{
180#ifdef CONFIG_CPU_R3000
181 extern unsigned long r3k_cache_size(unsigned long);
182 unsigned long size1, size2;
183 unsigned long cfg = read_c0_conf();
184
185 size1 = r3k_cache_size(ST0_ISC);
186 write_c0_conf(cfg ^ R30XX_CONF_AC);
187 size2 = r3k_cache_size(ST0_ISC);
188 write_c0_conf(cfg);
189 return size1 != size2;
190#else
191 return 0;
192#endif
193}
194
Robert Millanc094c992011-04-18 11:37:55 -0700195static inline void set_elf_platform(int cpu, const char *plat)
196{
197 if (cpu == 0)
198 __elf_platform = plat;
199}
200
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201/*
202 * Get the FPU Implementation/Revision.
203 */
204static inline unsigned long cpu_get_fpu_id(void)
205{
206 unsigned long tmp, fpu_id;
207
208 tmp = read_c0_status();
Paul Burton597ce172013-11-22 13:12:07 +0000209 __enable_fpu(FPU_AS_IS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 fpu_id = read_32bit_cp1_register(CP1_REVISION);
211 write_c0_status(tmp);
212 return fpu_id;
213}
214
215/*
Maciej W. Rozyckif6c70ff2015-04-03 23:24:18 +0100216 * Check if the CPU has an external FPU.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 */
218static inline int __cpu_has_fpu(void)
219{
Ralf Baechle635c99072014-10-21 14:12:49 +0200220 return (cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221}
222
Paul Burtona5e9a692014-01-27 15:23:10 +0000223static inline unsigned long cpu_get_msa_id(void)
224{
Paul Burton3587ea82014-07-11 16:44:34 +0100225 unsigned long status, msa_id;
Paul Burtona5e9a692014-01-27 15:23:10 +0000226
227 status = read_c0_status();
228 __enable_fpu(FPU_64BIT);
Paul Burtona5e9a692014-01-27 15:23:10 +0000229 enable_msa();
230 msa_id = read_msa_ir();
Paul Burton3587ea82014-07-11 16:44:34 +0100231 disable_msa();
Paul Burtona5e9a692014-01-27 15:23:10 +0000232 write_c0_status(status);
233 return msa_id;
234}
235
Guenter Roeck91dfc422010-02-02 08:52:20 -0800236static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
237{
238#ifdef __NEED_VMBITS_PROBE
David Daney5b7efa82010-02-08 12:27:00 -0800239 write_c0_entryhi(0x3fffffffffffe000ULL);
Guenter Roeck91dfc422010-02-02 08:52:20 -0800240 back_to_back_c0_hazard();
David Daney5b7efa82010-02-08 12:27:00 -0800241 c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL);
Guenter Roeck91dfc422010-02-02 08:52:20 -0800242#endif
243}
244
Paul Gortmaker078a55f2013-06-18 13:38:59 +0000245static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
Steven J. Hilla96102b2012-12-07 04:31:36 +0000246{
247 switch (isa) {
248 case MIPS_CPU_ISA_M64R2:
249 c->isa_level |= MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2;
250 case MIPS_CPU_ISA_M64R1:
251 c->isa_level |= MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1;
252 case MIPS_CPU_ISA_V:
253 c->isa_level |= MIPS_CPU_ISA_V;
254 case MIPS_CPU_ISA_IV:
255 c->isa_level |= MIPS_CPU_ISA_IV;
256 case MIPS_CPU_ISA_III:
Ralf Baechle1990e542013-06-26 17:06:34 +0200257 c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III;
Steven J. Hilla96102b2012-12-07 04:31:36 +0000258 break;
259
Leonid Yegoshin8b8aa632014-11-13 13:51:51 +0000260 /* R6 incompatible with everything else */
261 case MIPS_CPU_ISA_M64R6:
262 c->isa_level |= MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6;
263 case MIPS_CPU_ISA_M32R6:
264 c->isa_level |= MIPS_CPU_ISA_M32R6;
265 /* Break here so we don't add incompatible ISAs */
266 break;
Steven J. Hilla96102b2012-12-07 04:31:36 +0000267 case MIPS_CPU_ISA_M32R2:
268 c->isa_level |= MIPS_CPU_ISA_M32R2;
269 case MIPS_CPU_ISA_M32R1:
270 c->isa_level |= MIPS_CPU_ISA_M32R1;
271 case MIPS_CPU_ISA_II:
272 c->isa_level |= MIPS_CPU_ISA_II;
Steven J. Hilla96102b2012-12-07 04:31:36 +0000273 break;
274 }
275}
276
Paul Gortmaker078a55f2013-06-18 13:38:59 +0000277static char unknown_isa[] = KERN_ERR \
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100278 "Unsupported ISA type, c0.config0: %d.";
279
Markos Chandrascf0a8aa2014-11-10 12:25:34 +0000280static unsigned int calculate_ftlb_probability(struct cpuinfo_mips *c)
281{
282
283 unsigned int probability = c->tlbsize / c->tlbsizevtlb;
284
285 /*
286 * 0 = All TLBWR instructions go to FTLB
287 * 1 = 15:1: For every 16 TBLWR instructions, 15 go to the
288 * FTLB and 1 goes to the VTLB.
289 * 2 = 7:1: As above with 7:1 ratio.
290 * 3 = 3:1: As above with 3:1 ratio.
291 *
292 * Use the linear midpoint as the probability threshold.
293 */
294 if (probability >= 12)
295 return 1;
296 else if (probability >= 6)
297 return 2;
298 else
299 /*
300 * So FTLB is less than 4 times bigger than VTLB.
301 * A 3:1 ratio can still be useful though.
302 */
303 return 3;
304}
305
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000306static void set_ftlb_enable(struct cpuinfo_mips *c, int enable)
307{
308 unsigned int config6;
James Hogand83b0e82014-01-22 16:19:40 +0000309
310 /* It's implementation dependent how the FTLB can be enabled */
311 switch (c->cputype) {
312 case CPU_PROAPTIV:
313 case CPU_P5600:
314 /* proAptiv & related cores use Config6 to enable the FTLB */
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000315 config6 = read_c0_config6();
Markos Chandrascf0a8aa2014-11-10 12:25:34 +0000316 /* Clear the old probability value */
317 config6 &= ~(3 << MIPS_CONF6_FTLBP_SHIFT);
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000318 if (enable)
319 /* Enable FTLB */
Markos Chandrascf0a8aa2014-11-10 12:25:34 +0000320 write_c0_config6(config6 |
321 (calculate_ftlb_probability(c)
322 << MIPS_CONF6_FTLBP_SHIFT)
323 | MIPS_CONF6_FTLBEN);
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000324 else
325 /* Disable FTLB */
326 write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN);
327 back_to_back_c0_hazard();
James Hogand83b0e82014-01-22 16:19:40 +0000328 break;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000329 }
330}
331
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100332static inline unsigned int decode_config0(struct cpuinfo_mips *c)
333{
334 unsigned int config0;
335 int isa;
336
337 config0 = read_c0_config();
338
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000339 /*
340 * Look for Standard TLB or Dual VTLB and FTLB
341 */
342 if ((((config0 & MIPS_CONF_MT) >> 7) == 1) ||
343 (((config0 & MIPS_CONF_MT) >> 7) == 4))
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100344 c->options |= MIPS_CPU_TLB;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000345
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100346 isa = (config0 & MIPS_CONF_AT) >> 13;
347 switch (isa) {
348 case 0:
349 switch ((config0 & MIPS_CONF_AR) >> 10) {
350 case 0:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000351 set_isa(c, MIPS_CPU_ISA_M32R1);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100352 break;
353 case 1:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000354 set_isa(c, MIPS_CPU_ISA_M32R2);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100355 break;
Leonid Yegoshin8b8aa632014-11-13 13:51:51 +0000356 case 2:
357 set_isa(c, MIPS_CPU_ISA_M32R6);
358 break;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100359 default:
360 goto unknown;
361 }
362 break;
363 case 2:
364 switch ((config0 & MIPS_CONF_AR) >> 10) {
365 case 0:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000366 set_isa(c, MIPS_CPU_ISA_M64R1);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100367 break;
368 case 1:
Steven J. Hilla96102b2012-12-07 04:31:36 +0000369 set_isa(c, MIPS_CPU_ISA_M64R2);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100370 break;
Leonid Yegoshin8b8aa632014-11-13 13:51:51 +0000371 case 2:
372 set_isa(c, MIPS_CPU_ISA_M64R6);
373 break;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100374 default:
375 goto unknown;
376 }
377 break;
378 default:
379 goto unknown;
380 }
381
382 return config0 & MIPS_CONF_M;
383
384unknown:
385 panic(unknown_isa, config0);
386}
387
388static inline unsigned int decode_config1(struct cpuinfo_mips *c)
389{
390 unsigned int config1;
391
392 config1 = read_c0_config1();
393
394 if (config1 & MIPS_CONF1_MD)
395 c->ases |= MIPS_ASE_MDMX;
396 if (config1 & MIPS_CONF1_WR)
397 c->options |= MIPS_CPU_WATCH;
398 if (config1 & MIPS_CONF1_CA)
399 c->ases |= MIPS_ASE_MIPS16;
400 if (config1 & MIPS_CONF1_EP)
401 c->options |= MIPS_CPU_EJTAG;
402 if (config1 & MIPS_CONF1_FP) {
403 c->options |= MIPS_CPU_FPU;
404 c->options |= MIPS_CPU_32FPR;
405 }
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000406 if (cpu_has_tlb) {
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100407 c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000408 c->tlbsizevtlb = c->tlbsize;
409 c->tlbsizeftlbsets = 0;
410 }
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100411
412 return config1 & MIPS_CONF_M;
413}
414
415static inline unsigned int decode_config2(struct cpuinfo_mips *c)
416{
417 unsigned int config2;
418
419 config2 = read_c0_config2();
420
421 if (config2 & MIPS_CONF2_SL)
422 c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
423
424 return config2 & MIPS_CONF_M;
425}
426
427static inline unsigned int decode_config3(struct cpuinfo_mips *c)
428{
429 unsigned int config3;
430
431 config3 = read_c0_config3();
432
Steven J. Hillb2ab4f02012-09-13 16:47:58 -0500433 if (config3 & MIPS_CONF3_SM) {
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100434 c->ases |= MIPS_ASE_SMARTMIPS;
Steven J. Hillb2ab4f02012-09-13 16:47:58 -0500435 c->options |= MIPS_CPU_RIXI;
436 }
437 if (config3 & MIPS_CONF3_RXI)
438 c->options |= MIPS_CPU_RIXI;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100439 if (config3 & MIPS_CONF3_DSP)
440 c->ases |= MIPS_ASE_DSP;
Steven J. Hillee80f7c72012-08-03 10:26:04 -0500441 if (config3 & MIPS_CONF3_DSP2P)
442 c->ases |= MIPS_ASE_DSP2P;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100443 if (config3 & MIPS_CONF3_VINT)
444 c->options |= MIPS_CPU_VINT;
445 if (config3 & MIPS_CONF3_VEIC)
446 c->options |= MIPS_CPU_VEIC;
447 if (config3 & MIPS_CONF3_MT)
448 c->ases |= MIPS_ASE_MIPSMT;
449 if (config3 & MIPS_CONF3_ULRI)
450 c->options |= MIPS_CPU_ULRI;
Steven J. Hillf8fa4812012-12-07 03:51:35 +0000451 if (config3 & MIPS_CONF3_ISA)
452 c->options |= MIPS_CPU_MICROMIPS;
David Daney1e7decd2013-02-16 23:42:43 +0100453 if (config3 & MIPS_CONF3_VZ)
454 c->ases |= MIPS_ASE_VZ;
Steven J. Hill4a0156f2013-11-14 16:12:24 +0000455 if (config3 & MIPS_CONF3_SC)
456 c->options |= MIPS_CPU_SEGMENTS;
Paul Burtona5e9a692014-01-27 15:23:10 +0000457 if (config3 & MIPS_CONF3_MSA)
458 c->ases |= MIPS_ASE_MSA;
Markos Chandras3d528b32014-07-14 12:46:13 +0100459 /* Only tested on 32-bit cores */
Markos Chandrased4cbc82015-01-26 13:04:33 +0000460 if ((config3 & MIPS_CONF3_PW) && config_enabled(CONFIG_32BIT)) {
461 c->htw_seq = 0;
Markos Chandras3d528b32014-07-14 12:46:13 +0100462 c->options |= MIPS_CPU_HTW;
Markos Chandrased4cbc82015-01-26 13:04:33 +0000463 }
James Hogan9b3274b2015-02-02 11:45:08 +0000464 if (config3 & MIPS_CONF3_CDMM)
465 c->options |= MIPS_CPU_CDMM;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100466
467 return config3 & MIPS_CONF_M;
468}
469
470static inline unsigned int decode_config4(struct cpuinfo_mips *c)
471{
472 unsigned int config4;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000473 unsigned int newcf4;
474 unsigned int mmuextdef;
475 unsigned int ftlb_page = MIPS_CONF4_FTLBPAGESIZE;
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100476
477 config4 = read_c0_config4();
478
Leonid Yegoshin1745c1e2013-11-14 16:12:23 +0000479 if (cpu_has_tlb) {
480 if (((config4 & MIPS_CONF4_IE) >> 29) == 2)
481 c->options |= MIPS_CPU_TLBINV;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000482 mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF;
483 switch (mmuextdef) {
484 case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT:
485 c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
486 c->tlbsizevtlb = c->tlbsize;
487 break;
488 case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT:
489 c->tlbsizevtlb +=
490 ((config4 & MIPS_CONF4_VTLBSIZEEXT) >>
491 MIPS_CONF4_VTLBSIZEEXT_SHIFT) * 0x40;
492 c->tlbsize = c->tlbsizevtlb;
493 ftlb_page = MIPS_CONF4_VFTLBPAGESIZE;
494 /* fall through */
495 case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT:
Markos Chandras97f4ad22014-08-29 09:37:26 +0100496 if (mips_ftlb_disabled)
497 break;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000498 newcf4 = (config4 & ~ftlb_page) |
499 (page_size_ftlb(mmuextdef) <<
500 MIPS_CONF4_FTLBPAGESIZE_SHIFT);
501 write_c0_config4(newcf4);
502 back_to_back_c0_hazard();
503 config4 = read_c0_config4();
504 if (config4 != newcf4) {
505 pr_err("PAGE_SIZE 0x%lx is not supported by FTLB (config4=0x%x)\n",
506 PAGE_SIZE, config4);
507 /* Switch FTLB off */
508 set_ftlb_enable(c, 0);
509 break;
510 }
511 c->tlbsizeftlbsets = 1 <<
512 ((config4 & MIPS_CONF4_FTLBSETS) >>
513 MIPS_CONF4_FTLBSETS_SHIFT);
514 c->tlbsizeftlbways = ((config4 & MIPS_CONF4_FTLBWAYS) >>
515 MIPS_CONF4_FTLBWAYS_SHIFT) + 2;
516 c->tlbsize += c->tlbsizeftlbways * c->tlbsizeftlbsets;
Markos Chandras97f4ad22014-08-29 09:37:26 +0100517 mips_has_ftlb_configured = 1;
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000518 break;
519 }
Leonid Yegoshin1745c1e2013-11-14 16:12:23 +0000520 }
521
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100522 c->kscratch_mask = (config4 >> 16) & 0xff;
523
524 return config4 & MIPS_CONF_M;
525}
526
Ralf Baechle8b8a76342013-09-19 11:15:49 +0200527static inline unsigned int decode_config5(struct cpuinfo_mips *c)
528{
529 unsigned int config5;
530
531 config5 = read_c0_config5();
Paul Burtond175ed22014-09-11 08:30:19 +0100532 config5 &= ~(MIPS_CONF5_UFR | MIPS_CONF5_UFE);
Ralf Baechle8b8a76342013-09-19 11:15:49 +0200533 write_c0_config5(config5);
534
Markos Chandras49016742014-01-09 16:04:51 +0000535 if (config5 & MIPS_CONF5_EVA)
536 c->options |= MIPS_CPU_EVA;
Paul Burton1f6c52f2014-07-14 10:32:14 +0100537 if (config5 & MIPS_CONF5_MRP)
538 c->options |= MIPS_CPU_MAAR;
Markos Chandras5aed9da2014-12-02 09:46:19 +0000539 if (config5 & MIPS_CONF5_LLB)
540 c->options |= MIPS_CPU_RW_LLB;
Markos Chandras49016742014-01-09 16:04:51 +0000541
Ralf Baechle8b8a76342013-09-19 11:15:49 +0200542 return config5 & MIPS_CONF_M;
543}
544
Paul Gortmaker078a55f2013-06-18 13:38:59 +0000545static void decode_configs(struct cpuinfo_mips *c)
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100546{
547 int ok;
548
549 /* MIPS32 or MIPS64 compliant CPU. */
550 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
551 MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
552
553 c->scache.flags = MIPS_CACHE_NOT_PRESENT;
554
Markos Chandras97f4ad22014-08-29 09:37:26 +0100555 /* Enable FTLB if present and not disabled */
556 set_ftlb_enable(c, !mips_ftlb_disabled);
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +0000557
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100558 ok = decode_config0(c); /* Read Config registers. */
Ralf Baechle70342282013-01-22 12:59:30 +0100559 BUG_ON(!ok); /* Arch spec violation! */
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100560 if (ok)
561 ok = decode_config1(c);
562 if (ok)
563 ok = decode_config2(c);
564 if (ok)
565 ok = decode_config3(c);
566 if (ok)
567 ok = decode_config4(c);
Ralf Baechle8b8a76342013-09-19 11:15:49 +0200568 if (ok)
569 ok = decode_config5(c);
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100570
571 mips_probe_watch_registers(c);
572
Leonid Yegoshin6575b1d2014-07-15 14:09:57 +0100573 if (cpu_has_rixi) {
574 /* Enable the RIXI exceptions */
Steven J. Hilla5770df2015-02-19 10:18:52 -0600575 set_c0_pagegrain(PG_IEC);
Leonid Yegoshin6575b1d2014-07-15 14:09:57 +0100576 back_to_back_c0_hazard();
577 /* Verify the IEC bit is set */
578 if (read_c0_pagegrain() & PG_IEC)
579 c->options |= MIPS_CPU_RIXIEX;
580 }
581
Paul Burton0ee958e2014-01-15 10:31:53 +0000582#ifndef CONFIG_MIPS_CPS
Leonid Yegoshin8b8aa632014-11-13 13:51:51 +0000583 if (cpu_has_mips_r2_r6) {
David Daney45b585c2014-05-28 23:52:10 +0200584 c->core = get_ebase_cpunum();
Paul Burton30ee6152014-03-27 10:57:30 +0000585 if (cpu_has_mipsmt)
586 c->core >>= fls(core_nvpes()) - 1;
587 }
Paul Burton0ee958e2014-01-15 10:31:53 +0000588#endif
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100589}
590
Ralf Baechle02cf2112005-10-01 13:06:32 +0100591#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 | MIPS_CPU_COUNTER)
593
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000594static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595{
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100596 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 case PRID_IMP_R2000:
598 c->cputype = CPU_R2000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000599 __cpu_name[cpu] = "R2000";
Ralf Baechle02cf2112005-10-01 13:06:32 +0100600 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
Steven J. Hill03751e72012-05-10 23:21:18 -0500601 MIPS_CPU_NOFPUEX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 if (__cpu_has_fpu())
603 c->options |= MIPS_CPU_FPU;
604 c->tlbsize = 64;
605 break;
606 case PRID_IMP_R3000:
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100607 if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) {
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000608 if (cpu_has_confreg()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 c->cputype = CPU_R3081E;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000610 __cpu_name[cpu] = "R3081";
611 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 c->cputype = CPU_R3000A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000613 __cpu_name[cpu] = "R3000A";
614 }
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000615 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 c->cputype = CPU_R3000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000617 __cpu_name[cpu] = "R3000";
618 }
Ralf Baechle02cf2112005-10-01 13:06:32 +0100619 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
Steven J. Hill03751e72012-05-10 23:21:18 -0500620 MIPS_CPU_NOFPUEX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 if (__cpu_has_fpu())
622 c->options |= MIPS_CPU_FPU;
623 c->tlbsize = 64;
624 break;
625 case PRID_IMP_R4000:
626 if (read_c0_config() & CONF_SC) {
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100627 if ((c->processor_id & PRID_REV_MASK) >=
628 PRID_REV_R4400) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 c->cputype = CPU_R4400PC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000630 __cpu_name[cpu] = "R4400PC";
631 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632 c->cputype = CPU_R4000PC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000633 __cpu_name[cpu] = "R4000PC";
634 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635 } else {
Maciej W. Rozycki7f177a52013-09-23 14:01:53 +0100636 int cca = read_c0_config() & CONF_CM_CMASK;
637 int mc;
638
639 /*
640 * SC and MC versions can't be reliably told apart,
641 * but only the latter support coherent caching
642 * modes so assume the firmware has set the KSEG0
643 * coherency attribute reasonably (if uncached, we
644 * assume SC).
645 */
646 switch (cca) {
647 case CONF_CM_CACHABLE_CE:
648 case CONF_CM_CACHABLE_COW:
649 case CONF_CM_CACHABLE_CUW:
650 mc = 1;
651 break;
652 default:
653 mc = 0;
654 break;
655 }
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100656 if ((c->processor_id & PRID_REV_MASK) >=
657 PRID_REV_R4400) {
Maciej W. Rozycki7f177a52013-09-23 14:01:53 +0100658 c->cputype = mc ? CPU_R4400MC : CPU_R4400SC;
659 __cpu_name[cpu] = mc ? "R4400MC" : "R4400SC";
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000660 } else {
Maciej W. Rozycki7f177a52013-09-23 14:01:53 +0100661 c->cputype = mc ? CPU_R4000MC : CPU_R4000SC;
662 __cpu_name[cpu] = mc ? "R4000MC" : "R4000SC";
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000663 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 }
665
Steven J. Hilla96102b2012-12-07 04:31:36 +0000666 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500668 MIPS_CPU_WATCH | MIPS_CPU_VCE |
669 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 c->tlbsize = 48;
671 break;
672 case PRID_IMP_VR41XX:
Yoichi Yuasa9f91e502013-02-21 15:38:19 +0900673 set_isa(c, MIPS_CPU_ISA_III);
674 c->options = R4K_OPTS;
675 c->tlbsize = 32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676 switch (c->processor_id & 0xf0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 case PRID_REV_VR4111:
678 c->cputype = CPU_VR4111;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000679 __cpu_name[cpu] = "NEC VR4111";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 case PRID_REV_VR4121:
682 c->cputype = CPU_VR4121;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000683 __cpu_name[cpu] = "NEC VR4121";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 break;
685 case PRID_REV_VR4122:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000686 if ((c->processor_id & 0xf) < 0x3) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 c->cputype = CPU_VR4122;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000688 __cpu_name[cpu] = "NEC VR4122";
689 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 c->cputype = CPU_VR4181A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000691 __cpu_name[cpu] = "NEC VR4181A";
692 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 break;
694 case PRID_REV_VR4130:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000695 if ((c->processor_id & 0xf) < 0x4) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 c->cputype = CPU_VR4131;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000697 __cpu_name[cpu] = "NEC VR4131";
698 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699 c->cputype = CPU_VR4133;
Yoichi Yuasa9f91e502013-02-21 15:38:19 +0900700 c->options |= MIPS_CPU_LLSC;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000701 __cpu_name[cpu] = "NEC VR4133";
702 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703 break;
704 default:
705 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
706 c->cputype = CPU_VR41XX;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000707 __cpu_name[cpu] = "NEC Vr41xx";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 break;
709 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710 break;
711 case PRID_IMP_R4300:
712 c->cputype = CPU_R4300;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000713 __cpu_name[cpu] = "R4300";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000714 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500716 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 c->tlbsize = 32;
718 break;
719 case PRID_IMP_R4600:
720 c->cputype = CPU_R4600;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000721 __cpu_name[cpu] = "R4600";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000722 set_isa(c, MIPS_CPU_ISA_III);
Thiemo Seufer075e7502005-07-27 21:48:12 +0000723 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
724 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725 c->tlbsize = 48;
726 break;
727 #if 0
Steven J. Hill03751e72012-05-10 23:21:18 -0500728 case PRID_IMP_R4650:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729 /*
730 * This processor doesn't have an MMU, so it's not
731 * "real easy" to run Linux on it. It is left purely
732 * for documentation. Commented out because it shares
733 * it's c0_prid id number with the TX3900.
734 */
Ralf Baechlea3dddd52006-03-11 08:18:41 +0000735 c->cputype = CPU_R4650;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000736 __cpu_name[cpu] = "R4650";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000737 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
Steven J. Hill03751e72012-05-10 23:21:18 -0500739 c->tlbsize = 48;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 break;
741 #endif
742 case PRID_IMP_TX39:
Ralf Baechle02cf2112005-10-01 13:06:32 +0100743 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744
745 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
746 c->cputype = CPU_TX3927;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000747 __cpu_name[cpu] = "TX3927";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 c->tlbsize = 64;
749 } else {
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100750 switch (c->processor_id & PRID_REV_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 case PRID_REV_TX3912:
752 c->cputype = CPU_TX3912;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000753 __cpu_name[cpu] = "TX3912";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754 c->tlbsize = 32;
755 break;
756 case PRID_REV_TX3922:
757 c->cputype = CPU_TX3922;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000758 __cpu_name[cpu] = "TX3922";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 c->tlbsize = 64;
760 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761 }
762 }
763 break;
764 case PRID_IMP_R4700:
765 c->cputype = CPU_R4700;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000766 __cpu_name[cpu] = "R4700";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000767 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500769 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 c->tlbsize = 48;
771 break;
772 case PRID_IMP_TX49:
773 c->cputype = CPU_TX49XX;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000774 __cpu_name[cpu] = "R49XX";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000775 set_isa(c, MIPS_CPU_ISA_III);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776 c->options = R4K_OPTS | MIPS_CPU_LLSC;
777 if (!(c->processor_id & 0x08))
778 c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
779 c->tlbsize = 48;
780 break;
781 case PRID_IMP_R5000:
782 c->cputype = CPU_R5000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000783 __cpu_name[cpu] = "R5000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000784 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500786 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 c->tlbsize = 48;
788 break;
789 case PRID_IMP_R5432:
790 c->cputype = CPU_R5432;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000791 __cpu_name[cpu] = "R5432";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000792 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500794 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 c->tlbsize = 48;
796 break;
797 case PRID_IMP_R5500:
798 c->cputype = CPU_R5500;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000799 __cpu_name[cpu] = "R5500";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000800 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500802 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 c->tlbsize = 48;
804 break;
805 case PRID_IMP_NEVADA:
806 c->cputype = CPU_NEVADA;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000807 __cpu_name[cpu] = "Nevada";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000808 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500810 MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 c->tlbsize = 48;
812 break;
813 case PRID_IMP_R6000:
814 c->cputype = CPU_R6000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000815 __cpu_name[cpu] = "R6000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000816 set_isa(c, MIPS_CPU_ISA_II);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
Steven J. Hill03751e72012-05-10 23:21:18 -0500818 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 c->tlbsize = 32;
820 break;
821 case PRID_IMP_R6000A:
822 c->cputype = CPU_R6000A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000823 __cpu_name[cpu] = "R6000A";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000824 set_isa(c, MIPS_CPU_ISA_II);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
Steven J. Hill03751e72012-05-10 23:21:18 -0500826 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 c->tlbsize = 32;
828 break;
829 case PRID_IMP_RM7000:
830 c->cputype = CPU_RM7000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000831 __cpu_name[cpu] = "RM7000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000832 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
Steven J. Hill03751e72012-05-10 23:21:18 -0500834 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 /*
Ralf Baechle70342282013-01-22 12:59:30 +0100836 * Undocumented RM7000: Bit 29 in the info register of
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837 * the RM7000 v2.0 indicates if the TLB has 48 or 64
838 * entries.
839 *
Ralf Baechle70342282013-01-22 12:59:30 +0100840 * 29 1 => 64 entry JTLB
841 * 0 => 48 entry JTLB
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 */
843 c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
844 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845 case PRID_IMP_R8000:
846 c->cputype = CPU_R8000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000847 __cpu_name[cpu] = "RM8000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000848 set_isa(c, MIPS_CPU_ISA_IV);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500850 MIPS_CPU_FPU | MIPS_CPU_32FPR |
851 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852 c->tlbsize = 384; /* has weird TLB: 3-way x 128 */
853 break;
854 case PRID_IMP_R10000:
855 c->cputype = CPU_R10000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000856 __cpu_name[cpu] = "R10000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000857 set_isa(c, MIPS_CPU_ISA_IV);
Ralf Baechle8b366122005-11-22 17:53:59 +0000858 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500859 MIPS_CPU_FPU | MIPS_CPU_32FPR |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
Steven J. Hill03751e72012-05-10 23:21:18 -0500861 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 c->tlbsize = 64;
863 break;
864 case PRID_IMP_R12000:
865 c->cputype = CPU_R12000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000866 __cpu_name[cpu] = "R12000";
Steven J. Hilla96102b2012-12-07 04:31:36 +0000867 set_isa(c, MIPS_CPU_ISA_IV);
Ralf Baechle8b366122005-11-22 17:53:59 +0000868 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500869 MIPS_CPU_FPU | MIPS_CPU_32FPR |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
Steven J. Hill03751e72012-05-10 23:21:18 -0500871 MIPS_CPU_LLSC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700872 c->tlbsize = 64;
873 break;
Kumba44d921b2006-05-16 22:23:59 -0400874 case PRID_IMP_R14000:
Joshua Kinard30577392015-01-21 07:59:45 -0500875 if (((c->processor_id >> 4) & 0x0f) > 2) {
876 c->cputype = CPU_R16000;
877 __cpu_name[cpu] = "R16000";
878 } else {
879 c->cputype = CPU_R14000;
880 __cpu_name[cpu] = "R14000";
881 }
Steven J. Hilla96102b2012-12-07 04:31:36 +0000882 set_isa(c, MIPS_CPU_ISA_IV);
Kumba44d921b2006-05-16 22:23:59 -0400883 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
Steven J. Hill03751e72012-05-10 23:21:18 -0500884 MIPS_CPU_FPU | MIPS_CPU_32FPR |
Kumba44d921b2006-05-16 22:23:59 -0400885 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
Steven J. Hill03751e72012-05-10 23:21:18 -0500886 MIPS_CPU_LLSC;
Kumba44d921b2006-05-16 22:23:59 -0400887 c->tlbsize = 64;
888 break;
Huacai Chen26859192014-02-16 16:01:18 +0800889 case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */
Robert Millan5aac1e82011-04-16 11:29:29 -0700890 switch (c->processor_id & PRID_REV_MASK) {
891 case PRID_REV_LOONGSON2E:
Huacai Chenc579d312014-03-21 18:44:00 +0800892 c->cputype = CPU_LOONGSON2;
893 __cpu_name[cpu] = "ICT Loongson-2";
Robert Millan5aac1e82011-04-16 11:29:29 -0700894 set_elf_platform(cpu, "loongson2e");
Huacai Chen7352c8b2014-11-04 14:13:23 +0800895 set_isa(c, MIPS_CPU_ISA_III);
Robert Millan5aac1e82011-04-16 11:29:29 -0700896 break;
897 case PRID_REV_LOONGSON2F:
Huacai Chenc579d312014-03-21 18:44:00 +0800898 c->cputype = CPU_LOONGSON2;
899 __cpu_name[cpu] = "ICT Loongson-2";
Robert Millan5aac1e82011-04-16 11:29:29 -0700900 set_elf_platform(cpu, "loongson2f");
Huacai Chen7352c8b2014-11-04 14:13:23 +0800901 set_isa(c, MIPS_CPU_ISA_III);
Robert Millan5aac1e82011-04-16 11:29:29 -0700902 break;
Huacai Chenc579d312014-03-21 18:44:00 +0800903 case PRID_REV_LOONGSON3A:
904 c->cputype = CPU_LOONGSON3;
905 __cpu_name[cpu] = "ICT Loongson-3";
906 set_elf_platform(cpu, "loongson3a");
Huacai Chen7352c8b2014-11-04 14:13:23 +0800907 set_isa(c, MIPS_CPU_ISA_M64R1);
Huacai Chenc579d312014-03-21 18:44:00 +0800908 break;
Huacai Chene7841be2014-06-26 11:41:30 +0800909 case PRID_REV_LOONGSON3B_R1:
910 case PRID_REV_LOONGSON3B_R2:
911 c->cputype = CPU_LOONGSON3;
912 __cpu_name[cpu] = "ICT Loongson-3";
913 set_elf_platform(cpu, "loongson3b");
Huacai Chen7352c8b2014-11-04 14:13:23 +0800914 set_isa(c, MIPS_CPU_ISA_M64R1);
Huacai Chene7841be2014-06-26 11:41:30 +0800915 break;
Robert Millan5aac1e82011-04-16 11:29:29 -0700916 }
917
Fuxin Zhang2a21c732007-06-06 14:52:43 +0800918 c->options = R4K_OPTS |
919 MIPS_CPU_FPU | MIPS_CPU_LLSC |
920 MIPS_CPU_32FPR;
921 c->tlbsize = 64;
Huacai Chencc94ea32014-11-04 14:13:22 +0800922 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
Fuxin Zhang2a21c732007-06-06 14:52:43 +0800923 break;
Huacai Chen26859192014-02-16 16:01:18 +0800924 case PRID_IMP_LOONGSON_32: /* Loongson-1 */
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100925 decode_configs(c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700926
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100927 c->cputype = CPU_LOONGSON1;
Ralf Baechleb4672d32005-12-08 14:04:24 +0000928
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100929 switch (c->processor_id & PRID_REV_MASK) {
930 case PRID_REV_LOONGSON1B:
931 __cpu_name[cpu] = "Loongson 1B";
Ralf Baechleb4672d32005-12-08 14:04:24 +0000932 break;
Ralf Baechleb4672d32005-12-08 14:04:24 +0000933 }
Kelvin Cheung2fa36392012-06-20 20:05:32 +0100934
Ralf Baechle41943182005-05-05 16:45:59 +0000935 break;
Ralf Baechle41943182005-05-05 16:45:59 +0000936 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700937}
938
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000939static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940{
Markos Chandras4f12b912014-07-18 10:51:32 +0100941 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +0100942 switch (c->processor_id & PRID_IMP_MASK) {
Leonid Yegoshinb2498af2014-11-24 12:59:44 +0000943 case PRID_IMP_QEMU_GENERIC:
944 c->writecombine = _CACHE_UNCACHED;
945 c->cputype = CPU_QEMU_GENERIC;
946 __cpu_name[cpu] = "MIPS GENERIC QEMU";
947 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700948 case PRID_IMP_4KC:
949 c->cputype = CPU_4KC;
Markos Chandras4f12b912014-07-18 10:51:32 +0100950 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000951 __cpu_name[cpu] = "MIPS 4Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700952 break;
953 case PRID_IMP_4KEC:
Ralf Baechle2b07bd02005-04-08 20:36:05 +0000954 case PRID_IMP_4KECR2:
955 c->cputype = CPU_4KEC;
Markos Chandras4f12b912014-07-18 10:51:32 +0100956 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000957 __cpu_name[cpu] = "MIPS 4KEc";
Ralf Baechle2b07bd02005-04-08 20:36:05 +0000958 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700959 case PRID_IMP_4KSC:
Ralf Baechle8afcb5d2005-10-04 15:01:26 +0100960 case PRID_IMP_4KSD:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700961 c->cputype = CPU_4KSC;
Markos Chandras4f12b912014-07-18 10:51:32 +0100962 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000963 __cpu_name[cpu] = "MIPS 4KSc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700964 break;
965 case PRID_IMP_5KC:
966 c->cputype = CPU_5KC;
Markos Chandras4f12b912014-07-18 10:51:32 +0100967 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000968 __cpu_name[cpu] = "MIPS 5Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700969 break;
Leonid Yegoshin78d48032012-07-06 21:56:01 +0200970 case PRID_IMP_5KE:
971 c->cputype = CPU_5KE;
Markos Chandras4f12b912014-07-18 10:51:32 +0100972 c->writecombine = _CACHE_UNCACHED;
Leonid Yegoshin78d48032012-07-06 21:56:01 +0200973 __cpu_name[cpu] = "MIPS 5KE";
974 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700975 case PRID_IMP_20KC:
976 c->cputype = CPU_20KC;
Markos Chandras4f12b912014-07-18 10:51:32 +0100977 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000978 __cpu_name[cpu] = "MIPS 20Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700979 break;
980 case PRID_IMP_24K:
981 c->cputype = CPU_24K;
Markos Chandras4f12b912014-07-18 10:51:32 +0100982 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000983 __cpu_name[cpu] = "MIPS 24Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700984 break;
John Crispin42f3cae2013-01-11 22:44:10 +0100985 case PRID_IMP_24KE:
986 c->cputype = CPU_24K;
Markos Chandras4f12b912014-07-18 10:51:32 +0100987 c->writecombine = _CACHE_UNCACHED;
John Crispin42f3cae2013-01-11 22:44:10 +0100988 __cpu_name[cpu] = "MIPS 24KEc";
989 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700990 case PRID_IMP_25KF:
991 c->cputype = CPU_25KF;
Markos Chandras4f12b912014-07-18 10:51:32 +0100992 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000993 __cpu_name[cpu] = "MIPS 25Kc";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700994 break;
Ralf Baechlebbc7f222005-07-12 16:12:05 +0000995 case PRID_IMP_34K:
996 c->cputype = CPU_34K;
Markos Chandras4f12b912014-07-18 10:51:32 +0100997 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +0000998 __cpu_name[cpu] = "MIPS 34Kc";
Ralf Baechlebbc7f222005-07-12 16:12:05 +0000999 break;
Chris Dearmanc6209532006-05-02 14:08:46 +01001000 case PRID_IMP_74K:
1001 c->cputype = CPU_74K;
Markos Chandras4f12b912014-07-18 10:51:32 +01001002 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001003 __cpu_name[cpu] = "MIPS 74Kc";
Chris Dearmanc6209532006-05-02 14:08:46 +01001004 break;
Steven J. Hill113c62d2012-07-06 23:56:00 +02001005 case PRID_IMP_M14KC:
1006 c->cputype = CPU_M14KC;
Markos Chandras4f12b912014-07-18 10:51:32 +01001007 c->writecombine = _CACHE_UNCACHED;
Steven J. Hill113c62d2012-07-06 23:56:00 +02001008 __cpu_name[cpu] = "MIPS M14Kc";
1009 break;
Steven J. Hillf8fa4812012-12-07 03:51:35 +00001010 case PRID_IMP_M14KEC:
1011 c->cputype = CPU_M14KEC;
Markos Chandras4f12b912014-07-18 10:51:32 +01001012 c->writecombine = _CACHE_UNCACHED;
Steven J. Hillf8fa4812012-12-07 03:51:35 +00001013 __cpu_name[cpu] = "MIPS M14KEc";
1014 break;
Ralf Baechle39b8d522008-04-28 17:14:26 +01001015 case PRID_IMP_1004K:
1016 c->cputype = CPU_1004K;
Markos Chandras4f12b912014-07-18 10:51:32 +01001017 c->writecombine = _CACHE_UNCACHED;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001018 __cpu_name[cpu] = "MIPS 1004Kc";
Ralf Baechle39b8d522008-04-28 17:14:26 +01001019 break;
Steven J. Hill006a8512012-06-26 04:11:03 +00001020 case PRID_IMP_1074K:
Steven J. Hill442e14a2014-01-17 15:03:50 -06001021 c->cputype = CPU_1074K;
Markos Chandras4f12b912014-07-18 10:51:32 +01001022 c->writecombine = _CACHE_UNCACHED;
Steven J. Hill006a8512012-06-26 04:11:03 +00001023 __cpu_name[cpu] = "MIPS 1074Kc";
1024 break;
Leonid Yegoshinb5f065e2013-11-20 10:46:02 +00001025 case PRID_IMP_INTERAPTIV_UP:
1026 c->cputype = CPU_INTERAPTIV;
1027 __cpu_name[cpu] = "MIPS interAptiv";
1028 break;
1029 case PRID_IMP_INTERAPTIV_MP:
1030 c->cputype = CPU_INTERAPTIV;
1031 __cpu_name[cpu] = "MIPS interAptiv (multi)";
1032 break;
Leonid Yegoshinb0d4d302013-11-14 16:12:28 +00001033 case PRID_IMP_PROAPTIV_UP:
1034 c->cputype = CPU_PROAPTIV;
1035 __cpu_name[cpu] = "MIPS proAptiv";
1036 break;
1037 case PRID_IMP_PROAPTIV_MP:
1038 c->cputype = CPU_PROAPTIV;
1039 __cpu_name[cpu] = "MIPS proAptiv (multi)";
1040 break;
James Hogan829dcc02014-01-22 16:19:39 +00001041 case PRID_IMP_P5600:
1042 c->cputype = CPU_P5600;
1043 __cpu_name[cpu] = "MIPS P5600";
1044 break;
Leonid Yegoshin9943ed92014-03-04 13:34:44 +00001045 case PRID_IMP_M5150:
1046 c->cputype = CPU_M5150;
1047 __cpu_name[cpu] = "MIPS M5150";
1048 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001049 }
Chris Dearman0b6d4972007-09-13 12:32:02 +01001050
Leonid Yegoshin75b5b5e2013-11-14 16:12:31 +00001051 decode_configs(c);
1052
Chris Dearman0b6d4972007-09-13 12:32:02 +01001053 spram_config();
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054}
1055
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001056static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001057{
Ralf Baechle41943182005-05-05 16:45:59 +00001058 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001059 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 case PRID_IMP_AU1_REV1:
1061 case PRID_IMP_AU1_REV2:
Manuel Lauss270717a2009-03-25 17:49:28 +01001062 c->cputype = CPU_ALCHEMY;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001063 switch ((c->processor_id >> 24) & 0xff) {
1064 case 0:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001065 __cpu_name[cpu] = "Au1000";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001066 break;
1067 case 1:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001068 __cpu_name[cpu] = "Au1500";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001069 break;
1070 case 2:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001071 __cpu_name[cpu] = "Au1100";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072 break;
1073 case 3:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001074 __cpu_name[cpu] = "Au1550";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001075 break;
Pete Popove3ad1c22005-03-01 06:33:16 +00001076 case 4:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001077 __cpu_name[cpu] = "Au1200";
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001078 if ((c->processor_id & PRID_REV_MASK) == 2)
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001079 __cpu_name[cpu] = "Au1250";
Manuel Lauss237cfee2007-12-06 09:07:55 +01001080 break;
1081 case 5:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001082 __cpu_name[cpu] = "Au1210";
Pete Popove3ad1c22005-03-01 06:33:16 +00001083 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001084 default:
Manuel Lauss270717a2009-03-25 17:49:28 +01001085 __cpu_name[cpu] = "Au1xxx";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001086 break;
1087 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001088 break;
1089 }
1090}
1091
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001092static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001093{
Ralf Baechle41943182005-05-05 16:45:59 +00001094 decode_configs(c);
Ralf Baechle02cf2112005-10-01 13:06:32 +01001095
Markos Chandras4f12b912014-07-18 10:51:32 +01001096 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001097 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098 case PRID_IMP_SB1:
1099 c->cputype = CPU_SB1;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001100 __cpu_name[cpu] = "SiByte SB1";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101 /* FPU in pass1 is known to have issues. */
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001102 if ((c->processor_id & PRID_REV_MASK) < 0x02)
Ralf Baechle010b8532006-01-29 18:42:08 +00001103 c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 break;
Andrew Isaacson93ce2f522005-10-19 23:56:20 -07001105 case PRID_IMP_SB1A:
1106 c->cputype = CPU_SB1A;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001107 __cpu_name[cpu] = "SiByte SB1A";
Andrew Isaacson93ce2f522005-10-19 23:56:20 -07001108 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 }
1110}
1111
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001112static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001113{
Ralf Baechle41943182005-05-05 16:45:59 +00001114 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001115 switch (c->processor_id & PRID_IMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 case PRID_IMP_SR71000:
1117 c->cputype = CPU_SR71000;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001118 __cpu_name[cpu] = "Sandcraft SR71000";
Linus Torvalds1da177e2005-04-16 15:20:36 -07001119 c->scache.ways = 8;
1120 c->tlbsize = 64;
1121 break;
1122 }
1123}
1124
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001125static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
Pete Popovbdf21b12005-07-14 17:47:57 +00001126{
1127 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001128 switch (c->processor_id & PRID_IMP_MASK) {
Pete Popovbdf21b12005-07-14 17:47:57 +00001129 case PRID_IMP_PR4450:
1130 c->cputype = CPU_PR4450;
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001131 __cpu_name[cpu] = "Philips PR4450";
Steven J. Hilla96102b2012-12-07 04:31:36 +00001132 set_isa(c, MIPS_CPU_ISA_M32R1);
Pete Popovbdf21b12005-07-14 17:47:57 +00001133 break;
Pete Popovbdf21b12005-07-14 17:47:57 +00001134 }
1135}
1136
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001137static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001138{
1139 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001140 switch (c->processor_id & PRID_IMP_MASK) {
Kevin Cernekee190fca32010-11-23 10:26:45 -08001141 case PRID_IMP_BMIPS32_REV4:
1142 case PRID_IMP_BMIPS32_REV8:
Kevin Cernekee602977b2010-10-16 14:22:30 -07001143 c->cputype = CPU_BMIPS32;
1144 __cpu_name[cpu] = "Broadcom BMIPS32";
Kevin Cernekee06785df2011-04-16 11:29:28 -07001145 set_elf_platform(cpu, "bmips32");
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001146 break;
Kevin Cernekee602977b2010-10-16 14:22:30 -07001147 case PRID_IMP_BMIPS3300:
1148 case PRID_IMP_BMIPS3300_ALT:
1149 case PRID_IMP_BMIPS3300_BUG:
1150 c->cputype = CPU_BMIPS3300;
1151 __cpu_name[cpu] = "Broadcom BMIPS3300";
Kevin Cernekee06785df2011-04-16 11:29:28 -07001152 set_elf_platform(cpu, "bmips3300");
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001153 break;
Kevin Cernekee602977b2010-10-16 14:22:30 -07001154 case PRID_IMP_BMIPS43XX: {
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001155 int rev = c->processor_id & PRID_REV_MASK;
Kevin Cernekee602977b2010-10-16 14:22:30 -07001156
1157 if (rev >= PRID_REV_BMIPS4380_LO &&
1158 rev <= PRID_REV_BMIPS4380_HI) {
1159 c->cputype = CPU_BMIPS4380;
1160 __cpu_name[cpu] = "Broadcom BMIPS4380";
Kevin Cernekee06785df2011-04-16 11:29:28 -07001161 set_elf_platform(cpu, "bmips4380");
Kevin Cernekee602977b2010-10-16 14:22:30 -07001162 } else {
1163 c->cputype = CPU_BMIPS4350;
1164 __cpu_name[cpu] = "Broadcom BMIPS4350";
Kevin Cernekee06785df2011-04-16 11:29:28 -07001165 set_elf_platform(cpu, "bmips4350");
Maxime Bizon0de663e2009-08-18 13:23:37 +01001166 }
1167 break;
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001168 }
Kevin Cernekee602977b2010-10-16 14:22:30 -07001169 case PRID_IMP_BMIPS5000:
Kevin Cernekee68e6a782014-10-20 21:28:01 -07001170 case PRID_IMP_BMIPS5200:
Kevin Cernekee602977b2010-10-16 14:22:30 -07001171 c->cputype = CPU_BMIPS5000;
1172 __cpu_name[cpu] = "Broadcom BMIPS5000";
Kevin Cernekee06785df2011-04-16 11:29:28 -07001173 set_elf_platform(cpu, "bmips5000");
Kevin Cernekee602977b2010-10-16 14:22:30 -07001174 c->options |= MIPS_CPU_ULRI;
1175 break;
Kevin Cernekee602977b2010-10-16 14:22:30 -07001176 }
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001177}
1178
David Daney0dd47812008-12-11 15:33:26 -08001179static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
1180{
1181 decode_configs(c);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001182 switch (c->processor_id & PRID_IMP_MASK) {
David Daney0dd47812008-12-11 15:33:26 -08001183 case PRID_IMP_CAVIUM_CN38XX:
1184 case PRID_IMP_CAVIUM_CN31XX:
1185 case PRID_IMP_CAVIUM_CN30XX:
David Daney6f329462010-02-10 15:12:48 -08001186 c->cputype = CPU_CAVIUM_OCTEON;
1187 __cpu_name[cpu] = "Cavium Octeon";
1188 goto platform;
David Daney0dd47812008-12-11 15:33:26 -08001189 case PRID_IMP_CAVIUM_CN58XX:
1190 case PRID_IMP_CAVIUM_CN56XX:
1191 case PRID_IMP_CAVIUM_CN50XX:
1192 case PRID_IMP_CAVIUM_CN52XX:
David Daney6f329462010-02-10 15:12:48 -08001193 c->cputype = CPU_CAVIUM_OCTEON_PLUS;
1194 __cpu_name[cpu] = "Cavium Octeon+";
1195platform:
Robert Millanc094c992011-04-18 11:37:55 -07001196 set_elf_platform(cpu, "octeon");
David Daney0dd47812008-12-11 15:33:26 -08001197 break;
David Daneya1431b62011-09-24 02:29:54 +02001198 case PRID_IMP_CAVIUM_CN61XX:
David Daney0e56b382010-10-07 16:03:45 -07001199 case PRID_IMP_CAVIUM_CN63XX:
David Daneya1431b62011-09-24 02:29:54 +02001200 case PRID_IMP_CAVIUM_CN66XX:
1201 case PRID_IMP_CAVIUM_CN68XX:
David Daneyaf04bb82013-07-29 15:07:01 -07001202 case PRID_IMP_CAVIUM_CNF71XX:
David Daney0e56b382010-10-07 16:03:45 -07001203 c->cputype = CPU_CAVIUM_OCTEON2;
1204 __cpu_name[cpu] = "Cavium Octeon II";
Robert Millanc094c992011-04-18 11:37:55 -07001205 set_elf_platform(cpu, "octeon2");
David Daney0e56b382010-10-07 16:03:45 -07001206 break;
David Daneyaf04bb82013-07-29 15:07:01 -07001207 case PRID_IMP_CAVIUM_CN70XX:
1208 case PRID_IMP_CAVIUM_CN78XX:
1209 c->cputype = CPU_CAVIUM_OCTEON3;
1210 __cpu_name[cpu] = "Cavium Octeon III";
1211 set_elf_platform(cpu, "octeon3");
1212 break;
David Daney0dd47812008-12-11 15:33:26 -08001213 default:
1214 printk(KERN_INFO "Unknown Octeon chip!\n");
1215 c->cputype = CPU_UNKNOWN;
1216 break;
1217 }
1218}
1219
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +00001220static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
1221{
1222 decode_configs(c);
1223 /* JZRISC does not implement the CP0 counter. */
1224 c->options &= ~MIPS_CPU_COUNTER;
Maciej W. Rozycki06947aa2014-04-06 21:31:29 +01001225 BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter);
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001226 switch (c->processor_id & PRID_IMP_MASK) {
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +00001227 case PRID_IMP_JZRISC:
1228 c->cputype = CPU_JZRISC;
Markos Chandras4f12b912014-07-18 10:51:32 +01001229 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +00001230 __cpu_name[cpu] = "Ingenic JZRISC";
1231 break;
1232 default:
1233 panic("Unknown Ingenic Processor ID!");
1234 break;
1235 }
1236}
1237
Jayachandran Ca7117c62011-05-11 12:04:58 +05301238static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
1239{
1240 decode_configs(c);
1241
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001242 if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) {
Manuel Lauss809f36c2011-11-01 20:03:30 +01001243 c->cputype = CPU_ALCHEMY;
1244 __cpu_name[cpu] = "Au1300";
1245 /* following stuff is not for Alchemy */
1246 return;
1247 }
1248
Ralf Baechle70342282013-01-22 12:59:30 +01001249 c->options = (MIPS_CPU_TLB |
1250 MIPS_CPU_4KEX |
Jayachandran Ca7117c62011-05-11 12:04:58 +05301251 MIPS_CPU_COUNTER |
Ralf Baechle70342282013-01-22 12:59:30 +01001252 MIPS_CPU_DIVEC |
1253 MIPS_CPU_WATCH |
1254 MIPS_CPU_EJTAG |
Jayachandran Ca7117c62011-05-11 12:04:58 +05301255 MIPS_CPU_LLSC);
1256
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001257 switch (c->processor_id & PRID_IMP_MASK) {
Jayachandran C4ca86a22013-08-11 14:43:54 +05301258 case PRID_IMP_NETLOGIC_XLP2XX:
Jayachandran C8907c552013-12-21 16:52:20 +05301259 case PRID_IMP_NETLOGIC_XLP9XX:
Yonghong Song1c983982014-04-29 20:07:53 +05301260 case PRID_IMP_NETLOGIC_XLP5XX:
Jayachandran C4ca86a22013-08-11 14:43:54 +05301261 c->cputype = CPU_XLP;
1262 __cpu_name[cpu] = "Broadcom XLPII";
1263 break;
1264
Jayachandran C2aa54b22011-11-16 00:21:29 +00001265 case PRID_IMP_NETLOGIC_XLP8XX:
1266 case PRID_IMP_NETLOGIC_XLP3XX:
Jayachandran Ca3d4fb22011-11-16 00:21:20 +00001267 c->cputype = CPU_XLP;
1268 __cpu_name[cpu] = "Netlogic XLP";
1269 break;
1270
Jayachandran Ca7117c62011-05-11 12:04:58 +05301271 case PRID_IMP_NETLOGIC_XLR732:
1272 case PRID_IMP_NETLOGIC_XLR716:
1273 case PRID_IMP_NETLOGIC_XLR532:
1274 case PRID_IMP_NETLOGIC_XLR308:
1275 case PRID_IMP_NETLOGIC_XLR532C:
1276 case PRID_IMP_NETLOGIC_XLR516C:
1277 case PRID_IMP_NETLOGIC_XLR508C:
1278 case PRID_IMP_NETLOGIC_XLR308C:
1279 c->cputype = CPU_XLR;
1280 __cpu_name[cpu] = "Netlogic XLR";
1281 break;
1282
1283 case PRID_IMP_NETLOGIC_XLS608:
1284 case PRID_IMP_NETLOGIC_XLS408:
1285 case PRID_IMP_NETLOGIC_XLS404:
1286 case PRID_IMP_NETLOGIC_XLS208:
1287 case PRID_IMP_NETLOGIC_XLS204:
1288 case PRID_IMP_NETLOGIC_XLS108:
1289 case PRID_IMP_NETLOGIC_XLS104:
1290 case PRID_IMP_NETLOGIC_XLS616B:
1291 case PRID_IMP_NETLOGIC_XLS608B:
1292 case PRID_IMP_NETLOGIC_XLS416B:
1293 case PRID_IMP_NETLOGIC_XLS412B:
1294 case PRID_IMP_NETLOGIC_XLS408B:
1295 case PRID_IMP_NETLOGIC_XLS404B:
1296 c->cputype = CPU_XLR;
1297 __cpu_name[cpu] = "Netlogic XLS";
1298 break;
1299
1300 default:
Jayachandran Ca3d4fb22011-11-16 00:21:20 +00001301 pr_info("Unknown Netlogic chip id [%02x]!\n",
Jayachandran Ca7117c62011-05-11 12:04:58 +05301302 c->processor_id);
1303 c->cputype = CPU_XLR;
1304 break;
1305 }
1306
Jayachandran Ca3d4fb22011-11-16 00:21:20 +00001307 if (c->cputype == CPU_XLP) {
Steven J. Hilla96102b2012-12-07 04:31:36 +00001308 set_isa(c, MIPS_CPU_ISA_M64R2);
Jayachandran Ca3d4fb22011-11-16 00:21:20 +00001309 c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK);
1310 /* This will be updated again after all threads are woken up */
1311 c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
1312 } else {
Steven J. Hilla96102b2012-12-07 04:31:36 +00001313 set_isa(c, MIPS_CPU_ISA_M64R1);
Jayachandran Ca3d4fb22011-11-16 00:21:20 +00001314 c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1;
1315 }
Jayachandran C7777b932013-06-11 14:41:35 +00001316 c->kscratch_mask = 0xf;
Jayachandran Ca7117c62011-05-11 12:04:58 +05301317}
1318
David Daney949e51b2010-10-14 11:32:33 -07001319#ifdef CONFIG_64BIT
1320/* For use by uaccess.h */
1321u64 __ua_limit;
1322EXPORT_SYMBOL(__ua_limit);
1323#endif
1324
Ralf Baechle9966db252007-10-11 23:46:17 +01001325const char *__cpu_name[NR_CPUS];
David Daney874fd3b2010-01-28 16:52:12 -08001326const char *__elf_platform;
Ralf Baechle9966db252007-10-11 23:46:17 +01001327
Paul Gortmaker078a55f2013-06-18 13:38:59 +00001328void cpu_probe(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001329{
1330 struct cpuinfo_mips *c = &current_cpu_data;
Ralf Baechle9966db252007-10-11 23:46:17 +01001331 unsigned int cpu = smp_processor_id();
Linus Torvalds1da177e2005-04-16 15:20:36 -07001332
Ralf Baechle70342282013-01-22 12:59:30 +01001333 c->processor_id = PRID_IMP_UNKNOWN;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001334 c->fpu_id = FPIR_IMP_NONE;
1335 c->cputype = CPU_UNKNOWN;
Markos Chandras4f12b912014-07-18 10:51:32 +01001336 c->writecombine = _CACHE_UNCACHED;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001337
1338 c->processor_id = read_c0_prid();
Maciej W. Rozycki8ff374b2013-09-17 16:58:10 +01001339 switch (c->processor_id & PRID_COMP_MASK) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001340 case PRID_COMP_LEGACY:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001341 cpu_probe_legacy(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001342 break;
1343 case PRID_COMP_MIPS:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001344 cpu_probe_mips(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001345 break;
1346 case PRID_COMP_ALCHEMY:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001347 cpu_probe_alchemy(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001348 break;
1349 case PRID_COMP_SIBYTE:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001350 cpu_probe_sibyte(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001351 break;
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001352 case PRID_COMP_BROADCOM:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001353 cpu_probe_broadcom(c, cpu);
Aurelien Jarno1c0c13e2007-09-25 15:40:12 +02001354 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001355 case PRID_COMP_SANDCRAFT:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001356 cpu_probe_sandcraft(c, cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001357 break;
Daniel Lairda92b0582008-03-06 09:07:18 +00001358 case PRID_COMP_NXP:
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001359 cpu_probe_nxp(c, cpu);
Ralf Baechlea3dddd52006-03-11 08:18:41 +00001360 break;
David Daney0dd47812008-12-11 15:33:26 -08001361 case PRID_COMP_CAVIUM:
1362 cpu_probe_cavium(c, cpu);
1363 break;
Lars-Peter Clausen83ccf692010-07-17 11:07:51 +00001364 case PRID_COMP_INGENIC:
1365 cpu_probe_ingenic(c, cpu);
1366 break;
Jayachandran Ca7117c62011-05-11 12:04:58 +05301367 case PRID_COMP_NETLOGIC:
1368 cpu_probe_netlogic(c, cpu);
1369 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001370 }
Franck Bui-Huudec8b1c2007-10-08 16:11:51 +02001371
Ralf Baechlecea7e2d2008-10-30 13:38:45 +00001372 BUG_ON(!__cpu_name[cpu]);
1373 BUG_ON(c->cputype == CPU_UNKNOWN);
1374
Franck Bui-Huudec8b1c2007-10-08 16:11:51 +02001375 /*
1376 * Platform code can force the cpu type to optimize code
1377 * generation. In that case be sure the cpu type is correctly
1378 * manually setup otherwise it could trigger some nasty bugs.
1379 */
1380 BUG_ON(current_cpu_type() != c->cputype);
1381
Kevin Cernekee0103d232010-05-02 14:43:52 -07001382 if (mips_fpu_disabled)
1383 c->options &= ~MIPS_CPU_FPU;
1384
1385 if (mips_dsp_disabled)
Steven J. Hillee80f7c72012-08-03 10:26:04 -05001386 c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
Kevin Cernekee0103d232010-05-02 14:43:52 -07001387
Markos Chandras3d528b32014-07-14 12:46:13 +01001388 if (mips_htw_disabled) {
1389 c->options &= ~MIPS_CPU_HTW;
1390 write_c0_pwctl(read_c0_pwctl() &
1391 ~(1 << MIPS_PWCTL_PWEN_SHIFT));
1392 }
1393
Ralf Baechle41943182005-05-05 16:45:59 +00001394 if (c->options & MIPS_CPU_FPU) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001395 c->fpu_id = cpu_get_fpu_id();
Ralf Baechle41943182005-05-05 16:45:59 +00001396
Maciej W. Rozycki9cb60e22015-04-03 23:27:21 +01001397 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
1398 MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
1399 MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
Ralf Baechle41943182005-05-05 16:45:59 +00001400 if (c->fpu_id & MIPS_FPIR_3D)
1401 c->ases |= MIPS_ASE_MIPS3D;
Paul Burtonadac5d52014-09-11 08:30:18 +01001402 if (c->fpu_id & MIPS_FPIR_FREP)
1403 c->options |= MIPS_CPU_FRE;
Ralf Baechle41943182005-05-05 16:45:59 +00001404 }
Maciej W. Rozyckif6843622015-04-03 23:27:26 +01001405 } else
1406 cpu_set_nofpu_id(c);
Ralf Baechle9966db252007-10-11 23:46:17 +01001407
Leonid Yegoshin8b8aa632014-11-13 13:51:51 +00001408 if (cpu_has_mips_r2_r6) {
Ralf Baechlef6771db2007-11-08 18:02:29 +00001409 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
Al Cooperda4b62c2012-07-13 16:44:51 -04001410 /* R2 has Performance Counter Interrupt indicator */
1411 c->options |= MIPS_CPU_PCI;
1412 }
Ralf Baechlef6771db2007-11-08 18:02:29 +00001413 else
1414 c->srsets = 1;
Guenter Roeck91dfc422010-02-02 08:52:20 -08001415
Paul Burtona8ad1362014-01-28 14:28:43 +00001416 if (cpu_has_msa) {
Paul Burtona5e9a692014-01-27 15:23:10 +00001417 c->msa_id = cpu_get_msa_id();
Paul Burtona8ad1362014-01-28 14:28:43 +00001418 WARN(c->msa_id & MSA_IR_WRPF,
1419 "Vector register partitioning unimplemented!");
1420 }
Paul Burtona5e9a692014-01-27 15:23:10 +00001421
Guenter Roeck91dfc422010-02-02 08:52:20 -08001422 cpu_probe_vmbits(c);
David Daney949e51b2010-10-14 11:32:33 -07001423
1424#ifdef CONFIG_64BIT
1425 if (cpu == 0)
1426 __ua_limit = ~((1ull << cpu_vmbits) - 1);
1427#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001428}
1429
Paul Gortmaker078a55f2013-06-18 13:38:59 +00001430void cpu_report(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431{
1432 struct cpuinfo_mips *c = &current_cpu_data;
1433
Leonid Yegoshind9f897c2013-10-07 10:43:32 +01001434 pr_info("CPU%d revision is: %08x (%s)\n",
1435 smp_processor_id(), c->processor_id, cpu_name_string());
Linus Torvalds1da177e2005-04-16 15:20:36 -07001436 if (c->options & MIPS_CPU_FPU)
Ralf Baechle9966db252007-10-11 23:46:17 +01001437 printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id);
Paul Burtona5e9a692014-01-27 15:23:10 +00001438 if (cpu_has_msa)
1439 pr_info("MSA revision is: %08x\n", c->msa_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440}