xref: /openbmc/linux/arch/mips/kernel/cpu-probe.c (revision d2999e1b)
1 /*
2  * Processor capabilities determination functions.
3  *
4  * Copyright (C) xxxx  the Anonymous
5  * Copyright (C) 1994 - 2006 Ralf Baechle
6  * Copyright (C) 2003, 2004  Maciej W. Rozycki
7  * Copyright (C) 2001, 2004, 2011, 2012	 MIPS Technologies, Inc.
8  *
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  */
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/ptrace.h>
17 #include <linux/smp.h>
18 #include <linux/stddef.h>
19 #include <linux/export.h>
20 
21 #include <asm/bugs.h>
22 #include <asm/cpu.h>
23 #include <asm/cpu-type.h>
24 #include <asm/fpu.h>
25 #include <asm/mipsregs.h>
26 #include <asm/mipsmtregs.h>
27 #include <asm/msa.h>
28 #include <asm/watch.h>
29 #include <asm/elf.h>
30 #include <asm/spram.h>
31 #include <asm/uaccess.h>
32 
33 static int mips_fpu_disabled;
34 
35 static int __init fpu_disable(char *s)
36 {
37 	cpu_data[0].options &= ~MIPS_CPU_FPU;
38 	mips_fpu_disabled = 1;
39 
40 	return 1;
41 }
42 
43 __setup("nofpu", fpu_disable);
44 
45 int mips_dsp_disabled;
46 
47 static int __init dsp_disable(char *s)
48 {
49 	cpu_data[0].ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
50 	mips_dsp_disabled = 1;
51 
52 	return 1;
53 }
54 
55 __setup("nodsp", dsp_disable);
56 
57 static inline void check_errata(void)
58 {
59 	struct cpuinfo_mips *c = &current_cpu_data;
60 
61 	switch (current_cpu_type()) {
62 	case CPU_34K:
63 		/*
64 		 * Erratum "RPS May Cause Incorrect Instruction Execution"
65 		 * This code only handles VPE0, any SMP/RTOS code
66 		 * making use of VPE1 will be responsable for that VPE.
67 		 */
68 		if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2)
69 			write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS);
70 		break;
71 	default:
72 		break;
73 	}
74 }
75 
76 void __init check_bugs32(void)
77 {
78 	check_errata();
79 }
80 
81 /*
82  * Probe whether cpu has config register by trying to play with
83  * alternate cache bit and see whether it matters.
84  * It's used by cpu_probe to distinguish between R3000A and R3081.
85  */
86 static inline int cpu_has_confreg(void)
87 {
88 #ifdef CONFIG_CPU_R3000
89 	extern unsigned long r3k_cache_size(unsigned long);
90 	unsigned long size1, size2;
91 	unsigned long cfg = read_c0_conf();
92 
93 	size1 = r3k_cache_size(ST0_ISC);
94 	write_c0_conf(cfg ^ R30XX_CONF_AC);
95 	size2 = r3k_cache_size(ST0_ISC);
96 	write_c0_conf(cfg);
97 	return size1 != size2;
98 #else
99 	return 0;
100 #endif
101 }
102 
103 static inline void set_elf_platform(int cpu, const char *plat)
104 {
105 	if (cpu == 0)
106 		__elf_platform = plat;
107 }
108 
109 /*
110  * Get the FPU Implementation/Revision.
111  */
112 static inline unsigned long cpu_get_fpu_id(void)
113 {
114 	unsigned long tmp, fpu_id;
115 
116 	tmp = read_c0_status();
117 	__enable_fpu(FPU_AS_IS);
118 	fpu_id = read_32bit_cp1_register(CP1_REVISION);
119 	write_c0_status(tmp);
120 	return fpu_id;
121 }
122 
123 /*
124  * Check the CPU has an FPU the official way.
125  */
126 static inline int __cpu_has_fpu(void)
127 {
128 	return ((cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE);
129 }
130 
131 static inline unsigned long cpu_get_msa_id(void)
132 {
133 	unsigned long status, conf5, msa_id;
134 
135 	status = read_c0_status();
136 	__enable_fpu(FPU_64BIT);
137 	conf5 = read_c0_config5();
138 	enable_msa();
139 	msa_id = read_msa_ir();
140 	write_c0_config5(conf5);
141 	write_c0_status(status);
142 	return msa_id;
143 }
144 
145 static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
146 {
147 #ifdef __NEED_VMBITS_PROBE
148 	write_c0_entryhi(0x3fffffffffffe000ULL);
149 	back_to_back_c0_hazard();
150 	c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL);
151 #endif
152 }
153 
154 static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
155 {
156 	switch (isa) {
157 	case MIPS_CPU_ISA_M64R2:
158 		c->isa_level |= MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2;
159 	case MIPS_CPU_ISA_M64R1:
160 		c->isa_level |= MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1;
161 	case MIPS_CPU_ISA_V:
162 		c->isa_level |= MIPS_CPU_ISA_V;
163 	case MIPS_CPU_ISA_IV:
164 		c->isa_level |= MIPS_CPU_ISA_IV;
165 	case MIPS_CPU_ISA_III:
166 		c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III;
167 		break;
168 
169 	case MIPS_CPU_ISA_M32R2:
170 		c->isa_level |= MIPS_CPU_ISA_M32R2;
171 	case MIPS_CPU_ISA_M32R1:
172 		c->isa_level |= MIPS_CPU_ISA_M32R1;
173 	case MIPS_CPU_ISA_II:
174 		c->isa_level |= MIPS_CPU_ISA_II;
175 		break;
176 	}
177 }
178 
179 static char unknown_isa[] = KERN_ERR \
180 	"Unsupported ISA type, c0.config0: %d.";
181 
182 static void set_ftlb_enable(struct cpuinfo_mips *c, int enable)
183 {
184 	unsigned int config6;
185 
186 	/* It's implementation dependent how the FTLB can be enabled */
187 	switch (c->cputype) {
188 	case CPU_PROAPTIV:
189 	case CPU_P5600:
190 		/* proAptiv & related cores use Config6 to enable the FTLB */
191 		config6 = read_c0_config6();
192 		if (enable)
193 			/* Enable FTLB */
194 			write_c0_config6(config6 | MIPS_CONF6_FTLBEN);
195 		else
196 			/* Disable FTLB */
197 			write_c0_config6(config6 &  ~MIPS_CONF6_FTLBEN);
198 		back_to_back_c0_hazard();
199 		break;
200 	}
201 }
202 
203 static inline unsigned int decode_config0(struct cpuinfo_mips *c)
204 {
205 	unsigned int config0;
206 	int isa;
207 
208 	config0 = read_c0_config();
209 
210 	/*
211 	 * Look for Standard TLB or Dual VTLB and FTLB
212 	 */
213 	if ((((config0 & MIPS_CONF_MT) >> 7) == 1) ||
214 	    (((config0 & MIPS_CONF_MT) >> 7) == 4))
215 		c->options |= MIPS_CPU_TLB;
216 
217 	isa = (config0 & MIPS_CONF_AT) >> 13;
218 	switch (isa) {
219 	case 0:
220 		switch ((config0 & MIPS_CONF_AR) >> 10) {
221 		case 0:
222 			set_isa(c, MIPS_CPU_ISA_M32R1);
223 			break;
224 		case 1:
225 			set_isa(c, MIPS_CPU_ISA_M32R2);
226 			break;
227 		default:
228 			goto unknown;
229 		}
230 		break;
231 	case 2:
232 		switch ((config0 & MIPS_CONF_AR) >> 10) {
233 		case 0:
234 			set_isa(c, MIPS_CPU_ISA_M64R1);
235 			break;
236 		case 1:
237 			set_isa(c, MIPS_CPU_ISA_M64R2);
238 			break;
239 		default:
240 			goto unknown;
241 		}
242 		break;
243 	default:
244 		goto unknown;
245 	}
246 
247 	return config0 & MIPS_CONF_M;
248 
249 unknown:
250 	panic(unknown_isa, config0);
251 }
252 
253 static inline unsigned int decode_config1(struct cpuinfo_mips *c)
254 {
255 	unsigned int config1;
256 
257 	config1 = read_c0_config1();
258 
259 	if (config1 & MIPS_CONF1_MD)
260 		c->ases |= MIPS_ASE_MDMX;
261 	if (config1 & MIPS_CONF1_WR)
262 		c->options |= MIPS_CPU_WATCH;
263 	if (config1 & MIPS_CONF1_CA)
264 		c->ases |= MIPS_ASE_MIPS16;
265 	if (config1 & MIPS_CONF1_EP)
266 		c->options |= MIPS_CPU_EJTAG;
267 	if (config1 & MIPS_CONF1_FP) {
268 		c->options |= MIPS_CPU_FPU;
269 		c->options |= MIPS_CPU_32FPR;
270 	}
271 	if (cpu_has_tlb) {
272 		c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
273 		c->tlbsizevtlb = c->tlbsize;
274 		c->tlbsizeftlbsets = 0;
275 	}
276 
277 	return config1 & MIPS_CONF_M;
278 }
279 
280 static inline unsigned int decode_config2(struct cpuinfo_mips *c)
281 {
282 	unsigned int config2;
283 
284 	config2 = read_c0_config2();
285 
286 	if (config2 & MIPS_CONF2_SL)
287 		c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
288 
289 	return config2 & MIPS_CONF_M;
290 }
291 
292 static inline unsigned int decode_config3(struct cpuinfo_mips *c)
293 {
294 	unsigned int config3;
295 
296 	config3 = read_c0_config3();
297 
298 	if (config3 & MIPS_CONF3_SM) {
299 		c->ases |= MIPS_ASE_SMARTMIPS;
300 		c->options |= MIPS_CPU_RIXI;
301 	}
302 	if (config3 & MIPS_CONF3_RXI)
303 		c->options |= MIPS_CPU_RIXI;
304 	if (config3 & MIPS_CONF3_DSP)
305 		c->ases |= MIPS_ASE_DSP;
306 	if (config3 & MIPS_CONF3_DSP2P)
307 		c->ases |= MIPS_ASE_DSP2P;
308 	if (config3 & MIPS_CONF3_VINT)
309 		c->options |= MIPS_CPU_VINT;
310 	if (config3 & MIPS_CONF3_VEIC)
311 		c->options |= MIPS_CPU_VEIC;
312 	if (config3 & MIPS_CONF3_MT)
313 		c->ases |= MIPS_ASE_MIPSMT;
314 	if (config3 & MIPS_CONF3_ULRI)
315 		c->options |= MIPS_CPU_ULRI;
316 	if (config3 & MIPS_CONF3_ISA)
317 		c->options |= MIPS_CPU_MICROMIPS;
318 	if (config3 & MIPS_CONF3_VZ)
319 		c->ases |= MIPS_ASE_VZ;
320 	if (config3 & MIPS_CONF3_SC)
321 		c->options |= MIPS_CPU_SEGMENTS;
322 	if (config3 & MIPS_CONF3_MSA)
323 		c->ases |= MIPS_ASE_MSA;
324 
325 	return config3 & MIPS_CONF_M;
326 }
327 
328 static inline unsigned int decode_config4(struct cpuinfo_mips *c)
329 {
330 	unsigned int config4;
331 	unsigned int newcf4;
332 	unsigned int mmuextdef;
333 	unsigned int ftlb_page = MIPS_CONF4_FTLBPAGESIZE;
334 
335 	config4 = read_c0_config4();
336 
337 	if (cpu_has_tlb) {
338 		if (((config4 & MIPS_CONF4_IE) >> 29) == 2)
339 			c->options |= MIPS_CPU_TLBINV;
340 		mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF;
341 		switch (mmuextdef) {
342 		case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT:
343 			c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
344 			c->tlbsizevtlb = c->tlbsize;
345 			break;
346 		case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT:
347 			c->tlbsizevtlb +=
348 				((config4 & MIPS_CONF4_VTLBSIZEEXT) >>
349 				  MIPS_CONF4_VTLBSIZEEXT_SHIFT) * 0x40;
350 			c->tlbsize = c->tlbsizevtlb;
351 			ftlb_page = MIPS_CONF4_VFTLBPAGESIZE;
352 			/* fall through */
353 		case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT:
354 			newcf4 = (config4 & ~ftlb_page) |
355 				(page_size_ftlb(mmuextdef) <<
356 				 MIPS_CONF4_FTLBPAGESIZE_SHIFT);
357 			write_c0_config4(newcf4);
358 			back_to_back_c0_hazard();
359 			config4 = read_c0_config4();
360 			if (config4 != newcf4) {
361 				pr_err("PAGE_SIZE 0x%lx is not supported by FTLB (config4=0x%x)\n",
362 				       PAGE_SIZE, config4);
363 				/* Switch FTLB off */
364 				set_ftlb_enable(c, 0);
365 				break;
366 			}
367 			c->tlbsizeftlbsets = 1 <<
368 				((config4 & MIPS_CONF4_FTLBSETS) >>
369 				 MIPS_CONF4_FTLBSETS_SHIFT);
370 			c->tlbsizeftlbways = ((config4 & MIPS_CONF4_FTLBWAYS) >>
371 					      MIPS_CONF4_FTLBWAYS_SHIFT) + 2;
372 			c->tlbsize += c->tlbsizeftlbways * c->tlbsizeftlbsets;
373 			break;
374 		}
375 	}
376 
377 	c->kscratch_mask = (config4 >> 16) & 0xff;
378 
379 	return config4 & MIPS_CONF_M;
380 }
381 
382 static inline unsigned int decode_config5(struct cpuinfo_mips *c)
383 {
384 	unsigned int config5;
385 
386 	config5 = read_c0_config5();
387 	config5 &= ~MIPS_CONF5_UFR;
388 	write_c0_config5(config5);
389 
390 	if (config5 & MIPS_CONF5_EVA)
391 		c->options |= MIPS_CPU_EVA;
392 
393 	return config5 & MIPS_CONF_M;
394 }
395 
396 static void decode_configs(struct cpuinfo_mips *c)
397 {
398 	int ok;
399 
400 	/* MIPS32 or MIPS64 compliant CPU.  */
401 	c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
402 		     MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
403 
404 	c->scache.flags = MIPS_CACHE_NOT_PRESENT;
405 
406 	/* Enable FTLB if present */
407 	set_ftlb_enable(c, 1);
408 
409 	ok = decode_config0(c);			/* Read Config registers.  */
410 	BUG_ON(!ok);				/* Arch spec violation!	 */
411 	if (ok)
412 		ok = decode_config1(c);
413 	if (ok)
414 		ok = decode_config2(c);
415 	if (ok)
416 		ok = decode_config3(c);
417 	if (ok)
418 		ok = decode_config4(c);
419 	if (ok)
420 		ok = decode_config5(c);
421 
422 	mips_probe_watch_registers(c);
423 
424 #ifndef CONFIG_MIPS_CPS
425 	if (cpu_has_mips_r2) {
426 		c->core = get_ebase_cpunum();
427 		if (cpu_has_mipsmt)
428 			c->core >>= fls(core_nvpes()) - 1;
429 	}
430 #endif
431 }
432 
433 #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
434 		| MIPS_CPU_COUNTER)
435 
436 static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
437 {
438 	switch (c->processor_id & PRID_IMP_MASK) {
439 	case PRID_IMP_R2000:
440 		c->cputype = CPU_R2000;
441 		__cpu_name[cpu] = "R2000";
442 		c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
443 			     MIPS_CPU_NOFPUEX;
444 		if (__cpu_has_fpu())
445 			c->options |= MIPS_CPU_FPU;
446 		c->tlbsize = 64;
447 		break;
448 	case PRID_IMP_R3000:
449 		if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) {
450 			if (cpu_has_confreg()) {
451 				c->cputype = CPU_R3081E;
452 				__cpu_name[cpu] = "R3081";
453 			} else {
454 				c->cputype = CPU_R3000A;
455 				__cpu_name[cpu] = "R3000A";
456 			}
457 		} else {
458 			c->cputype = CPU_R3000;
459 			__cpu_name[cpu] = "R3000";
460 		}
461 		c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
462 			     MIPS_CPU_NOFPUEX;
463 		if (__cpu_has_fpu())
464 			c->options |= MIPS_CPU_FPU;
465 		c->tlbsize = 64;
466 		break;
467 	case PRID_IMP_R4000:
468 		if (read_c0_config() & CONF_SC) {
469 			if ((c->processor_id & PRID_REV_MASK) >=
470 			    PRID_REV_R4400) {
471 				c->cputype = CPU_R4400PC;
472 				__cpu_name[cpu] = "R4400PC";
473 			} else {
474 				c->cputype = CPU_R4000PC;
475 				__cpu_name[cpu] = "R4000PC";
476 			}
477 		} else {
478 			int cca = read_c0_config() & CONF_CM_CMASK;
479 			int mc;
480 
481 			/*
482 			 * SC and MC versions can't be reliably told apart,
483 			 * but only the latter support coherent caching
484 			 * modes so assume the firmware has set the KSEG0
485 			 * coherency attribute reasonably (if uncached, we
486 			 * assume SC).
487 			 */
488 			switch (cca) {
489 			case CONF_CM_CACHABLE_CE:
490 			case CONF_CM_CACHABLE_COW:
491 			case CONF_CM_CACHABLE_CUW:
492 				mc = 1;
493 				break;
494 			default:
495 				mc = 0;
496 				break;
497 			}
498 			if ((c->processor_id & PRID_REV_MASK) >=
499 			    PRID_REV_R4400) {
500 				c->cputype = mc ? CPU_R4400MC : CPU_R4400SC;
501 				__cpu_name[cpu] = mc ? "R4400MC" : "R4400SC";
502 			} else {
503 				c->cputype = mc ? CPU_R4000MC : CPU_R4000SC;
504 				__cpu_name[cpu] = mc ? "R4000MC" : "R4000SC";
505 			}
506 		}
507 
508 		set_isa(c, MIPS_CPU_ISA_III);
509 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
510 			     MIPS_CPU_WATCH | MIPS_CPU_VCE |
511 			     MIPS_CPU_LLSC;
512 		c->tlbsize = 48;
513 		break;
514 	case PRID_IMP_VR41XX:
515 		set_isa(c, MIPS_CPU_ISA_III);
516 		c->options = R4K_OPTS;
517 		c->tlbsize = 32;
518 		switch (c->processor_id & 0xf0) {
519 		case PRID_REV_VR4111:
520 			c->cputype = CPU_VR4111;
521 			__cpu_name[cpu] = "NEC VR4111";
522 			break;
523 		case PRID_REV_VR4121:
524 			c->cputype = CPU_VR4121;
525 			__cpu_name[cpu] = "NEC VR4121";
526 			break;
527 		case PRID_REV_VR4122:
528 			if ((c->processor_id & 0xf) < 0x3) {
529 				c->cputype = CPU_VR4122;
530 				__cpu_name[cpu] = "NEC VR4122";
531 			} else {
532 				c->cputype = CPU_VR4181A;
533 				__cpu_name[cpu] = "NEC VR4181A";
534 			}
535 			break;
536 		case PRID_REV_VR4130:
537 			if ((c->processor_id & 0xf) < 0x4) {
538 				c->cputype = CPU_VR4131;
539 				__cpu_name[cpu] = "NEC VR4131";
540 			} else {
541 				c->cputype = CPU_VR4133;
542 				c->options |= MIPS_CPU_LLSC;
543 				__cpu_name[cpu] = "NEC VR4133";
544 			}
545 			break;
546 		default:
547 			printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
548 			c->cputype = CPU_VR41XX;
549 			__cpu_name[cpu] = "NEC Vr41xx";
550 			break;
551 		}
552 		break;
553 	case PRID_IMP_R4300:
554 		c->cputype = CPU_R4300;
555 		__cpu_name[cpu] = "R4300";
556 		set_isa(c, MIPS_CPU_ISA_III);
557 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
558 			     MIPS_CPU_LLSC;
559 		c->tlbsize = 32;
560 		break;
561 	case PRID_IMP_R4600:
562 		c->cputype = CPU_R4600;
563 		__cpu_name[cpu] = "R4600";
564 		set_isa(c, MIPS_CPU_ISA_III);
565 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
566 			     MIPS_CPU_LLSC;
567 		c->tlbsize = 48;
568 		break;
569 	#if 0
570 	case PRID_IMP_R4650:
571 		/*
572 		 * This processor doesn't have an MMU, so it's not
573 		 * "real easy" to run Linux on it. It is left purely
574 		 * for documentation.  Commented out because it shares
575 		 * it's c0_prid id number with the TX3900.
576 		 */
577 		c->cputype = CPU_R4650;
578 		__cpu_name[cpu] = "R4650";
579 		set_isa(c, MIPS_CPU_ISA_III);
580 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
581 		c->tlbsize = 48;
582 		break;
583 	#endif
584 	case PRID_IMP_TX39:
585 		c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
586 
587 		if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
588 			c->cputype = CPU_TX3927;
589 			__cpu_name[cpu] = "TX3927";
590 			c->tlbsize = 64;
591 		} else {
592 			switch (c->processor_id & PRID_REV_MASK) {
593 			case PRID_REV_TX3912:
594 				c->cputype = CPU_TX3912;
595 				__cpu_name[cpu] = "TX3912";
596 				c->tlbsize = 32;
597 				break;
598 			case PRID_REV_TX3922:
599 				c->cputype = CPU_TX3922;
600 				__cpu_name[cpu] = "TX3922";
601 				c->tlbsize = 64;
602 				break;
603 			}
604 		}
605 		break;
606 	case PRID_IMP_R4700:
607 		c->cputype = CPU_R4700;
608 		__cpu_name[cpu] = "R4700";
609 		set_isa(c, MIPS_CPU_ISA_III);
610 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
611 			     MIPS_CPU_LLSC;
612 		c->tlbsize = 48;
613 		break;
614 	case PRID_IMP_TX49:
615 		c->cputype = CPU_TX49XX;
616 		__cpu_name[cpu] = "R49XX";
617 		set_isa(c, MIPS_CPU_ISA_III);
618 		c->options = R4K_OPTS | MIPS_CPU_LLSC;
619 		if (!(c->processor_id & 0x08))
620 			c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
621 		c->tlbsize = 48;
622 		break;
623 	case PRID_IMP_R5000:
624 		c->cputype = CPU_R5000;
625 		__cpu_name[cpu] = "R5000";
626 		set_isa(c, MIPS_CPU_ISA_IV);
627 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
628 			     MIPS_CPU_LLSC;
629 		c->tlbsize = 48;
630 		break;
631 	case PRID_IMP_R5432:
632 		c->cputype = CPU_R5432;
633 		__cpu_name[cpu] = "R5432";
634 		set_isa(c, MIPS_CPU_ISA_IV);
635 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
636 			     MIPS_CPU_WATCH | MIPS_CPU_LLSC;
637 		c->tlbsize = 48;
638 		break;
639 	case PRID_IMP_R5500:
640 		c->cputype = CPU_R5500;
641 		__cpu_name[cpu] = "R5500";
642 		set_isa(c, MIPS_CPU_ISA_IV);
643 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
644 			     MIPS_CPU_WATCH | MIPS_CPU_LLSC;
645 		c->tlbsize = 48;
646 		break;
647 	case PRID_IMP_NEVADA:
648 		c->cputype = CPU_NEVADA;
649 		__cpu_name[cpu] = "Nevada";
650 		set_isa(c, MIPS_CPU_ISA_IV);
651 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
652 			     MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
653 		c->tlbsize = 48;
654 		break;
655 	case PRID_IMP_R6000:
656 		c->cputype = CPU_R6000;
657 		__cpu_name[cpu] = "R6000";
658 		set_isa(c, MIPS_CPU_ISA_II);
659 		c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
660 			     MIPS_CPU_LLSC;
661 		c->tlbsize = 32;
662 		break;
663 	case PRID_IMP_R6000A:
664 		c->cputype = CPU_R6000A;
665 		__cpu_name[cpu] = "R6000A";
666 		set_isa(c, MIPS_CPU_ISA_II);
667 		c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
668 			     MIPS_CPU_LLSC;
669 		c->tlbsize = 32;
670 		break;
671 	case PRID_IMP_RM7000:
672 		c->cputype = CPU_RM7000;
673 		__cpu_name[cpu] = "RM7000";
674 		set_isa(c, MIPS_CPU_ISA_IV);
675 		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
676 			     MIPS_CPU_LLSC;
677 		/*
678 		 * Undocumented RM7000:	 Bit 29 in the info register of
679 		 * the RM7000 v2.0 indicates if the TLB has 48 or 64
680 		 * entries.
681 		 *
682 		 * 29	   1 =>	   64 entry JTLB
683 		 *	   0 =>	   48 entry JTLB
684 		 */
685 		c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
686 		break;
687 	case PRID_IMP_R8000:
688 		c->cputype = CPU_R8000;
689 		__cpu_name[cpu] = "RM8000";
690 		set_isa(c, MIPS_CPU_ISA_IV);
691 		c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
692 			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
693 			     MIPS_CPU_LLSC;
694 		c->tlbsize = 384;      /* has weird TLB: 3-way x 128 */
695 		break;
696 	case PRID_IMP_R10000:
697 		c->cputype = CPU_R10000;
698 		__cpu_name[cpu] = "R10000";
699 		set_isa(c, MIPS_CPU_ISA_IV);
700 		c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
701 			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
702 			     MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
703 			     MIPS_CPU_LLSC;
704 		c->tlbsize = 64;
705 		break;
706 	case PRID_IMP_R12000:
707 		c->cputype = CPU_R12000;
708 		__cpu_name[cpu] = "R12000";
709 		set_isa(c, MIPS_CPU_ISA_IV);
710 		c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
711 			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
712 			     MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
713 			     MIPS_CPU_LLSC;
714 		c->tlbsize = 64;
715 		break;
716 	case PRID_IMP_R14000:
717 		c->cputype = CPU_R14000;
718 		__cpu_name[cpu] = "R14000";
719 		set_isa(c, MIPS_CPU_ISA_IV);
720 		c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
721 			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
722 			     MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
723 			     MIPS_CPU_LLSC;
724 		c->tlbsize = 64;
725 		break;
726 	case PRID_IMP_LOONGSON_64:  /* Loongson-2/3 */
727 		switch (c->processor_id & PRID_REV_MASK) {
728 		case PRID_REV_LOONGSON2E:
729 			c->cputype = CPU_LOONGSON2;
730 			__cpu_name[cpu] = "ICT Loongson-2";
731 			set_elf_platform(cpu, "loongson2e");
732 			break;
733 		case PRID_REV_LOONGSON2F:
734 			c->cputype = CPU_LOONGSON2;
735 			__cpu_name[cpu] = "ICT Loongson-2";
736 			set_elf_platform(cpu, "loongson2f");
737 			break;
738 		case PRID_REV_LOONGSON3A:
739 			c->cputype = CPU_LOONGSON3;
740 			__cpu_name[cpu] = "ICT Loongson-3";
741 			set_elf_platform(cpu, "loongson3a");
742 			break;
743 		}
744 
745 		set_isa(c, MIPS_CPU_ISA_III);
746 		c->options = R4K_OPTS |
747 			     MIPS_CPU_FPU | MIPS_CPU_LLSC |
748 			     MIPS_CPU_32FPR;
749 		c->tlbsize = 64;
750 		break;
751 	case PRID_IMP_LOONGSON_32:  /* Loongson-1 */
752 		decode_configs(c);
753 
754 		c->cputype = CPU_LOONGSON1;
755 
756 		switch (c->processor_id & PRID_REV_MASK) {
757 		case PRID_REV_LOONGSON1B:
758 			__cpu_name[cpu] = "Loongson 1B";
759 			break;
760 		}
761 
762 		break;
763 	}
764 }
765 
766 static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
767 {
768 	switch (c->processor_id & PRID_IMP_MASK) {
769 	case PRID_IMP_4KC:
770 		c->cputype = CPU_4KC;
771 		__cpu_name[cpu] = "MIPS 4Kc";
772 		break;
773 	case PRID_IMP_4KEC:
774 	case PRID_IMP_4KECR2:
775 		c->cputype = CPU_4KEC;
776 		__cpu_name[cpu] = "MIPS 4KEc";
777 		break;
778 	case PRID_IMP_4KSC:
779 	case PRID_IMP_4KSD:
780 		c->cputype = CPU_4KSC;
781 		__cpu_name[cpu] = "MIPS 4KSc";
782 		break;
783 	case PRID_IMP_5KC:
784 		c->cputype = CPU_5KC;
785 		__cpu_name[cpu] = "MIPS 5Kc";
786 		break;
787 	case PRID_IMP_5KE:
788 		c->cputype = CPU_5KE;
789 		__cpu_name[cpu] = "MIPS 5KE";
790 		break;
791 	case PRID_IMP_20KC:
792 		c->cputype = CPU_20KC;
793 		__cpu_name[cpu] = "MIPS 20Kc";
794 		break;
795 	case PRID_IMP_24K:
796 		c->cputype = CPU_24K;
797 		__cpu_name[cpu] = "MIPS 24Kc";
798 		break;
799 	case PRID_IMP_24KE:
800 		c->cputype = CPU_24K;
801 		__cpu_name[cpu] = "MIPS 24KEc";
802 		break;
803 	case PRID_IMP_25KF:
804 		c->cputype = CPU_25KF;
805 		__cpu_name[cpu] = "MIPS 25Kc";
806 		break;
807 	case PRID_IMP_34K:
808 		c->cputype = CPU_34K;
809 		__cpu_name[cpu] = "MIPS 34Kc";
810 		break;
811 	case PRID_IMP_74K:
812 		c->cputype = CPU_74K;
813 		__cpu_name[cpu] = "MIPS 74Kc";
814 		break;
815 	case PRID_IMP_M14KC:
816 		c->cputype = CPU_M14KC;
817 		__cpu_name[cpu] = "MIPS M14Kc";
818 		break;
819 	case PRID_IMP_M14KEC:
820 		c->cputype = CPU_M14KEC;
821 		__cpu_name[cpu] = "MIPS M14KEc";
822 		break;
823 	case PRID_IMP_1004K:
824 		c->cputype = CPU_1004K;
825 		__cpu_name[cpu] = "MIPS 1004Kc";
826 		break;
827 	case PRID_IMP_1074K:
828 		c->cputype = CPU_1074K;
829 		__cpu_name[cpu] = "MIPS 1074Kc";
830 		break;
831 	case PRID_IMP_INTERAPTIV_UP:
832 		c->cputype = CPU_INTERAPTIV;
833 		__cpu_name[cpu] = "MIPS interAptiv";
834 		break;
835 	case PRID_IMP_INTERAPTIV_MP:
836 		c->cputype = CPU_INTERAPTIV;
837 		__cpu_name[cpu] = "MIPS interAptiv (multi)";
838 		break;
839 	case PRID_IMP_PROAPTIV_UP:
840 		c->cputype = CPU_PROAPTIV;
841 		__cpu_name[cpu] = "MIPS proAptiv";
842 		break;
843 	case PRID_IMP_PROAPTIV_MP:
844 		c->cputype = CPU_PROAPTIV;
845 		__cpu_name[cpu] = "MIPS proAptiv (multi)";
846 		break;
847 	case PRID_IMP_P5600:
848 		c->cputype = CPU_P5600;
849 		__cpu_name[cpu] = "MIPS P5600";
850 		break;
851 	case PRID_IMP_M5150:
852 		c->cputype = CPU_M5150;
853 		__cpu_name[cpu] = "MIPS M5150";
854 		break;
855 	}
856 
857 	decode_configs(c);
858 
859 	spram_config();
860 }
861 
862 static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
863 {
864 	decode_configs(c);
865 	switch (c->processor_id & PRID_IMP_MASK) {
866 	case PRID_IMP_AU1_REV1:
867 	case PRID_IMP_AU1_REV2:
868 		c->cputype = CPU_ALCHEMY;
869 		switch ((c->processor_id >> 24) & 0xff) {
870 		case 0:
871 			__cpu_name[cpu] = "Au1000";
872 			break;
873 		case 1:
874 			__cpu_name[cpu] = "Au1500";
875 			break;
876 		case 2:
877 			__cpu_name[cpu] = "Au1100";
878 			break;
879 		case 3:
880 			__cpu_name[cpu] = "Au1550";
881 			break;
882 		case 4:
883 			__cpu_name[cpu] = "Au1200";
884 			if ((c->processor_id & PRID_REV_MASK) == 2)
885 				__cpu_name[cpu] = "Au1250";
886 			break;
887 		case 5:
888 			__cpu_name[cpu] = "Au1210";
889 			break;
890 		default:
891 			__cpu_name[cpu] = "Au1xxx";
892 			break;
893 		}
894 		break;
895 	}
896 }
897 
898 static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
899 {
900 	decode_configs(c);
901 
902 	switch (c->processor_id & PRID_IMP_MASK) {
903 	case PRID_IMP_SB1:
904 		c->cputype = CPU_SB1;
905 		__cpu_name[cpu] = "SiByte SB1";
906 		/* FPU in pass1 is known to have issues. */
907 		if ((c->processor_id & PRID_REV_MASK) < 0x02)
908 			c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
909 		break;
910 	case PRID_IMP_SB1A:
911 		c->cputype = CPU_SB1A;
912 		__cpu_name[cpu] = "SiByte SB1A";
913 		break;
914 	}
915 }
916 
917 static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
918 {
919 	decode_configs(c);
920 	switch (c->processor_id & PRID_IMP_MASK) {
921 	case PRID_IMP_SR71000:
922 		c->cputype = CPU_SR71000;
923 		__cpu_name[cpu] = "Sandcraft SR71000";
924 		c->scache.ways = 8;
925 		c->tlbsize = 64;
926 		break;
927 	}
928 }
929 
930 static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
931 {
932 	decode_configs(c);
933 	switch (c->processor_id & PRID_IMP_MASK) {
934 	case PRID_IMP_PR4450:
935 		c->cputype = CPU_PR4450;
936 		__cpu_name[cpu] = "Philips PR4450";
937 		set_isa(c, MIPS_CPU_ISA_M32R1);
938 		break;
939 	}
940 }
941 
942 static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
943 {
944 	decode_configs(c);
945 	switch (c->processor_id & PRID_IMP_MASK) {
946 	case PRID_IMP_BMIPS32_REV4:
947 	case PRID_IMP_BMIPS32_REV8:
948 		c->cputype = CPU_BMIPS32;
949 		__cpu_name[cpu] = "Broadcom BMIPS32";
950 		set_elf_platform(cpu, "bmips32");
951 		break;
952 	case PRID_IMP_BMIPS3300:
953 	case PRID_IMP_BMIPS3300_ALT:
954 	case PRID_IMP_BMIPS3300_BUG:
955 		c->cputype = CPU_BMIPS3300;
956 		__cpu_name[cpu] = "Broadcom BMIPS3300";
957 		set_elf_platform(cpu, "bmips3300");
958 		break;
959 	case PRID_IMP_BMIPS43XX: {
960 		int rev = c->processor_id & PRID_REV_MASK;
961 
962 		if (rev >= PRID_REV_BMIPS4380_LO &&
963 				rev <= PRID_REV_BMIPS4380_HI) {
964 			c->cputype = CPU_BMIPS4380;
965 			__cpu_name[cpu] = "Broadcom BMIPS4380";
966 			set_elf_platform(cpu, "bmips4380");
967 		} else {
968 			c->cputype = CPU_BMIPS4350;
969 			__cpu_name[cpu] = "Broadcom BMIPS4350";
970 			set_elf_platform(cpu, "bmips4350");
971 		}
972 		break;
973 	}
974 	case PRID_IMP_BMIPS5000:
975 		c->cputype = CPU_BMIPS5000;
976 		__cpu_name[cpu] = "Broadcom BMIPS5000";
977 		set_elf_platform(cpu, "bmips5000");
978 		c->options |= MIPS_CPU_ULRI;
979 		break;
980 	}
981 }
982 
983 static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
984 {
985 	decode_configs(c);
986 	switch (c->processor_id & PRID_IMP_MASK) {
987 	case PRID_IMP_CAVIUM_CN38XX:
988 	case PRID_IMP_CAVIUM_CN31XX:
989 	case PRID_IMP_CAVIUM_CN30XX:
990 		c->cputype = CPU_CAVIUM_OCTEON;
991 		__cpu_name[cpu] = "Cavium Octeon";
992 		goto platform;
993 	case PRID_IMP_CAVIUM_CN58XX:
994 	case PRID_IMP_CAVIUM_CN56XX:
995 	case PRID_IMP_CAVIUM_CN50XX:
996 	case PRID_IMP_CAVIUM_CN52XX:
997 		c->cputype = CPU_CAVIUM_OCTEON_PLUS;
998 		__cpu_name[cpu] = "Cavium Octeon+";
999 platform:
1000 		set_elf_platform(cpu, "octeon");
1001 		break;
1002 	case PRID_IMP_CAVIUM_CN61XX:
1003 	case PRID_IMP_CAVIUM_CN63XX:
1004 	case PRID_IMP_CAVIUM_CN66XX:
1005 	case PRID_IMP_CAVIUM_CN68XX:
1006 	case PRID_IMP_CAVIUM_CNF71XX:
1007 		c->cputype = CPU_CAVIUM_OCTEON2;
1008 		__cpu_name[cpu] = "Cavium Octeon II";
1009 		set_elf_platform(cpu, "octeon2");
1010 		break;
1011 	case PRID_IMP_CAVIUM_CN70XX:
1012 	case PRID_IMP_CAVIUM_CN78XX:
1013 		c->cputype = CPU_CAVIUM_OCTEON3;
1014 		__cpu_name[cpu] = "Cavium Octeon III";
1015 		set_elf_platform(cpu, "octeon3");
1016 		break;
1017 	default:
1018 		printk(KERN_INFO "Unknown Octeon chip!\n");
1019 		c->cputype = CPU_UNKNOWN;
1020 		break;
1021 	}
1022 }
1023 
1024 static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
1025 {
1026 	decode_configs(c);
1027 	/* JZRISC does not implement the CP0 counter. */
1028 	c->options &= ~MIPS_CPU_COUNTER;
1029 	BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter);
1030 	switch (c->processor_id & PRID_IMP_MASK) {
1031 	case PRID_IMP_JZRISC:
1032 		c->cputype = CPU_JZRISC;
1033 		__cpu_name[cpu] = "Ingenic JZRISC";
1034 		break;
1035 	default:
1036 		panic("Unknown Ingenic Processor ID!");
1037 		break;
1038 	}
1039 }
1040 
1041 static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
1042 {
1043 	decode_configs(c);
1044 
1045 	if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) {
1046 		c->cputype = CPU_ALCHEMY;
1047 		__cpu_name[cpu] = "Au1300";
1048 		/* following stuff is not for Alchemy */
1049 		return;
1050 	}
1051 
1052 	c->options = (MIPS_CPU_TLB	 |
1053 			MIPS_CPU_4KEX	 |
1054 			MIPS_CPU_COUNTER |
1055 			MIPS_CPU_DIVEC	 |
1056 			MIPS_CPU_WATCH	 |
1057 			MIPS_CPU_EJTAG	 |
1058 			MIPS_CPU_LLSC);
1059 
1060 	switch (c->processor_id & PRID_IMP_MASK) {
1061 	case PRID_IMP_NETLOGIC_XLP2XX:
1062 	case PRID_IMP_NETLOGIC_XLP9XX:
1063 	case PRID_IMP_NETLOGIC_XLP5XX:
1064 		c->cputype = CPU_XLP;
1065 		__cpu_name[cpu] = "Broadcom XLPII";
1066 		break;
1067 
1068 	case PRID_IMP_NETLOGIC_XLP8XX:
1069 	case PRID_IMP_NETLOGIC_XLP3XX:
1070 		c->cputype = CPU_XLP;
1071 		__cpu_name[cpu] = "Netlogic XLP";
1072 		break;
1073 
1074 	case PRID_IMP_NETLOGIC_XLR732:
1075 	case PRID_IMP_NETLOGIC_XLR716:
1076 	case PRID_IMP_NETLOGIC_XLR532:
1077 	case PRID_IMP_NETLOGIC_XLR308:
1078 	case PRID_IMP_NETLOGIC_XLR532C:
1079 	case PRID_IMP_NETLOGIC_XLR516C:
1080 	case PRID_IMP_NETLOGIC_XLR508C:
1081 	case PRID_IMP_NETLOGIC_XLR308C:
1082 		c->cputype = CPU_XLR;
1083 		__cpu_name[cpu] = "Netlogic XLR";
1084 		break;
1085 
1086 	case PRID_IMP_NETLOGIC_XLS608:
1087 	case PRID_IMP_NETLOGIC_XLS408:
1088 	case PRID_IMP_NETLOGIC_XLS404:
1089 	case PRID_IMP_NETLOGIC_XLS208:
1090 	case PRID_IMP_NETLOGIC_XLS204:
1091 	case PRID_IMP_NETLOGIC_XLS108:
1092 	case PRID_IMP_NETLOGIC_XLS104:
1093 	case PRID_IMP_NETLOGIC_XLS616B:
1094 	case PRID_IMP_NETLOGIC_XLS608B:
1095 	case PRID_IMP_NETLOGIC_XLS416B:
1096 	case PRID_IMP_NETLOGIC_XLS412B:
1097 	case PRID_IMP_NETLOGIC_XLS408B:
1098 	case PRID_IMP_NETLOGIC_XLS404B:
1099 		c->cputype = CPU_XLR;
1100 		__cpu_name[cpu] = "Netlogic XLS";
1101 		break;
1102 
1103 	default:
1104 		pr_info("Unknown Netlogic chip id [%02x]!\n",
1105 		       c->processor_id);
1106 		c->cputype = CPU_XLR;
1107 		break;
1108 	}
1109 
1110 	if (c->cputype == CPU_XLP) {
1111 		set_isa(c, MIPS_CPU_ISA_M64R2);
1112 		c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK);
1113 		/* This will be updated again after all threads are woken up */
1114 		c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
1115 	} else {
1116 		set_isa(c, MIPS_CPU_ISA_M64R1);
1117 		c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1;
1118 	}
1119 	c->kscratch_mask = 0xf;
1120 }
1121 
1122 #ifdef CONFIG_64BIT
1123 /* For use by uaccess.h */
1124 u64 __ua_limit;
1125 EXPORT_SYMBOL(__ua_limit);
1126 #endif
1127 
1128 const char *__cpu_name[NR_CPUS];
1129 const char *__elf_platform;
1130 
1131 void cpu_probe(void)
1132 {
1133 	struct cpuinfo_mips *c = &current_cpu_data;
1134 	unsigned int cpu = smp_processor_id();
1135 
1136 	c->processor_id = PRID_IMP_UNKNOWN;
1137 	c->fpu_id	= FPIR_IMP_NONE;
1138 	c->cputype	= CPU_UNKNOWN;
1139 
1140 	c->processor_id = read_c0_prid();
1141 	switch (c->processor_id & PRID_COMP_MASK) {
1142 	case PRID_COMP_LEGACY:
1143 		cpu_probe_legacy(c, cpu);
1144 		break;
1145 	case PRID_COMP_MIPS:
1146 		cpu_probe_mips(c, cpu);
1147 		break;
1148 	case PRID_COMP_ALCHEMY:
1149 		cpu_probe_alchemy(c, cpu);
1150 		break;
1151 	case PRID_COMP_SIBYTE:
1152 		cpu_probe_sibyte(c, cpu);
1153 		break;
1154 	case PRID_COMP_BROADCOM:
1155 		cpu_probe_broadcom(c, cpu);
1156 		break;
1157 	case PRID_COMP_SANDCRAFT:
1158 		cpu_probe_sandcraft(c, cpu);
1159 		break;
1160 	case PRID_COMP_NXP:
1161 		cpu_probe_nxp(c, cpu);
1162 		break;
1163 	case PRID_COMP_CAVIUM:
1164 		cpu_probe_cavium(c, cpu);
1165 		break;
1166 	case PRID_COMP_INGENIC:
1167 		cpu_probe_ingenic(c, cpu);
1168 		break;
1169 	case PRID_COMP_NETLOGIC:
1170 		cpu_probe_netlogic(c, cpu);
1171 		break;
1172 	}
1173 
1174 	BUG_ON(!__cpu_name[cpu]);
1175 	BUG_ON(c->cputype == CPU_UNKNOWN);
1176 
1177 	/*
1178 	 * Platform code can force the cpu type to optimize code
1179 	 * generation. In that case be sure the cpu type is correctly
1180 	 * manually setup otherwise it could trigger some nasty bugs.
1181 	 */
1182 	BUG_ON(current_cpu_type() != c->cputype);
1183 
1184 	if (mips_fpu_disabled)
1185 		c->options &= ~MIPS_CPU_FPU;
1186 
1187 	if (mips_dsp_disabled)
1188 		c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
1189 
1190 	if (c->options & MIPS_CPU_FPU) {
1191 		c->fpu_id = cpu_get_fpu_id();
1192 
1193 		if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1194 				    MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
1195 			if (c->fpu_id & MIPS_FPIR_3D)
1196 				c->ases |= MIPS_ASE_MIPS3D;
1197 		}
1198 	}
1199 
1200 	if (cpu_has_mips_r2) {
1201 		c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
1202 		/* R2 has Performance Counter Interrupt indicator */
1203 		c->options |= MIPS_CPU_PCI;
1204 	}
1205 	else
1206 		c->srsets = 1;
1207 
1208 	if (cpu_has_msa) {
1209 		c->msa_id = cpu_get_msa_id();
1210 		WARN(c->msa_id & MSA_IR_WRPF,
1211 		     "Vector register partitioning unimplemented!");
1212 	}
1213 
1214 	cpu_probe_vmbits(c);
1215 
1216 #ifdef CONFIG_64BIT
1217 	if (cpu == 0)
1218 		__ua_limit = ~((1ull << cpu_vmbits) - 1);
1219 #endif
1220 }
1221 
1222 void cpu_report(void)
1223 {
1224 	struct cpuinfo_mips *c = &current_cpu_data;
1225 
1226 	pr_info("CPU%d revision is: %08x (%s)\n",
1227 		smp_processor_id(), c->processor_id, cpu_name_string());
1228 	if (c->options & MIPS_CPU_FPU)
1229 		printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id);
1230 	if (cpu_has_msa)
1231 		pr_info("MSA revision is: %08x\n", c->msa_id);
1232 }
1233