2 * Processor capabilities determination functions.
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 MIPS Inc.
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.
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/module.h>
24 #include <asm/mipsregs.h>
25 #include <asm/system.h>
26 #include <asm/watch.h>
27 #include <asm/spram.h>
29 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover,
30 * the implementation of the "wait" feature differs between CPU families. This
31 * points to the function that implements CPU specific wait.
32 * The wait instruction stops the pipeline and reduces the power consumption of
35 void (*cpu_wait
)(void);
36 EXPORT_SYMBOL(cpu_wait
);
38 static void r3081_wait(void)
40 unsigned long cfg
= read_c0_conf();
41 write_c0_conf(cfg
| R30XX_CONF_HALT
);
44 static void r39xx_wait(void)
48 write_c0_conf(read_c0_conf() | TX39_CONF_HALT
);
52 extern void r4k_wait(void);
55 * This variant is preferable as it allows testing need_resched and going to
56 * sleep depending on the outcome atomically. Unfortunately the "It is
57 * implementation-dependent whether the pipeline restarts when a non-enabled
58 * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes
59 * using this version a gamble.
61 void r4k_wait_irqoff(void)
65 __asm__(" .set push \n"
70 __asm__(" .globl __pastwait \n"
76 * The RM7000 variant has to handle erratum 38. The workaround is to not
77 * have any pending stores when the WAIT instruction is executed.
79 static void rm7k_wait_irqoff(void)
89 " mtc0 $1, $12 # stalls until W stage \n"
91 " mtc0 $1, $12 # stalls until W stage \n"
97 * The Au1xxx wait is available only if using 32khz counter or
98 * external timer source, but specifically not CP0 Counter.
99 * alchemy/common/time.c may override cpu_wait!
101 static void au1k_wait(void)
103 __asm__(" .set mips3 \n"
104 " cache 0x14, 0(%0) \n"
105 " cache 0x14, 32(%0) \n"
114 : : "r" (au1k_wait
));
117 static int __initdata nowait
;
119 static int __init
wait_disable(char *s
)
126 __setup("nowait", wait_disable
);
128 void __init
check_wait(void)
130 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
133 printk("Wait instruction disabled.\n");
137 switch (c
->cputype
) {
140 cpu_wait
= r3081_wait
;
143 cpu_wait
= r39xx_wait
;
146 /* case CPU_R4300: */
164 case CPU_CAVIUM_OCTEON
:
169 cpu_wait
= rm7k_wait_irqoff
;
176 if (read_c0_config7() & MIPS_CONF7_WII
)
177 cpu_wait
= r4k_wait_irqoff
;
182 if ((c
->processor_id
& 0xff) >= PRID_REV_ENCODE_332(2, 1, 0))
183 cpu_wait
= r4k_wait_irqoff
;
187 cpu_wait
= r4k_wait_irqoff
;
190 cpu_wait
= au1k_wait
;
194 * WAIT on Rev1.0 has E1, E2, E3 and E16.
195 * WAIT on Rev2.0 and Rev3.0 has E16.
196 * Rev3.1 WAIT is nop, why bother
198 if ((c
->processor_id
& 0xff) <= 0x64)
202 * Another rev is incremeting c0_count at a reduced clock
203 * rate while in WAIT mode. So we basically have the choice
204 * between using the cp0 timer as clocksource or avoiding
205 * the WAIT instruction. Until more details are known,
206 * disable the use of WAIT for 20Kc entirely.
211 if ((c
->processor_id
& 0x00ff) >= 0x40)
219 static inline void check_errata(void)
221 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
223 switch (c
->cputype
) {
226 * Erratum "RPS May Cause Incorrect Instruction Execution"
227 * This code only handles VPE0, any SMP/SMTC/RTOS code
228 * making use of VPE1 will be responsable for that VPE.
230 if ((c
->processor_id
& PRID_REV_MASK
) <= PRID_REV_34K_V1_0_2
)
231 write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS
);
238 void __init
check_bugs32(void)
244 * Probe whether cpu has config register by trying to play with
245 * alternate cache bit and see whether it matters.
246 * It's used by cpu_probe to distinguish between R3000A and R3081.
248 static inline int cpu_has_confreg(void)
250 #ifdef CONFIG_CPU_R3000
251 extern unsigned long r3k_cache_size(unsigned long);
252 unsigned long size1
, size2
;
253 unsigned long cfg
= read_c0_conf();
255 size1
= r3k_cache_size(ST0_ISC
);
256 write_c0_conf(cfg
^ R30XX_CONF_AC
);
257 size2
= r3k_cache_size(ST0_ISC
);
259 return size1
!= size2
;
266 * Get the FPU Implementation/Revision.
268 static inline unsigned long cpu_get_fpu_id(void)
270 unsigned long tmp
, fpu_id
;
272 tmp
= read_c0_status();
274 fpu_id
= read_32bit_cp1_register(CP1_REVISION
);
275 write_c0_status(tmp
);
280 * Check the CPU has an FPU the official way.
282 static inline int __cpu_has_fpu(void)
284 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE
);
287 #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
290 static inline void cpu_probe_legacy(struct cpuinfo_mips
*c
, unsigned int cpu
)
292 switch (c
->processor_id
& 0xff00) {
294 c
->cputype
= CPU_R2000
;
295 __cpu_name
[cpu
] = "R2000";
296 c
->isa_level
= MIPS_CPU_ISA_I
;
297 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_3K_CACHE
|
300 c
->options
|= MIPS_CPU_FPU
;
304 if ((c
->processor_id
& 0xff) == PRID_REV_R3000A
) {
305 if (cpu_has_confreg()) {
306 c
->cputype
= CPU_R3081E
;
307 __cpu_name
[cpu
] = "R3081";
309 c
->cputype
= CPU_R3000A
;
310 __cpu_name
[cpu
] = "R3000A";
314 c
->cputype
= CPU_R3000
;
315 __cpu_name
[cpu
] = "R3000";
317 c
->isa_level
= MIPS_CPU_ISA_I
;
318 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_3K_CACHE
|
321 c
->options
|= MIPS_CPU_FPU
;
325 if (read_c0_config() & CONF_SC
) {
326 if ((c
->processor_id
& 0xff) >= PRID_REV_R4400
) {
327 c
->cputype
= CPU_R4400PC
;
328 __cpu_name
[cpu
] = "R4400PC";
330 c
->cputype
= CPU_R4000PC
;
331 __cpu_name
[cpu
] = "R4000PC";
334 if ((c
->processor_id
& 0xff) >= PRID_REV_R4400
) {
335 c
->cputype
= CPU_R4400SC
;
336 __cpu_name
[cpu
] = "R4400SC";
338 c
->cputype
= CPU_R4000SC
;
339 __cpu_name
[cpu
] = "R4000SC";
343 c
->isa_level
= MIPS_CPU_ISA_III
;
344 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
345 MIPS_CPU_WATCH
| MIPS_CPU_VCE
|
349 case PRID_IMP_VR41XX
:
350 switch (c
->processor_id
& 0xf0) {
351 case PRID_REV_VR4111
:
352 c
->cputype
= CPU_VR4111
;
353 __cpu_name
[cpu
] = "NEC VR4111";
355 case PRID_REV_VR4121
:
356 c
->cputype
= CPU_VR4121
;
357 __cpu_name
[cpu
] = "NEC VR4121";
359 case PRID_REV_VR4122
:
360 if ((c
->processor_id
& 0xf) < 0x3) {
361 c
->cputype
= CPU_VR4122
;
362 __cpu_name
[cpu
] = "NEC VR4122";
364 c
->cputype
= CPU_VR4181A
;
365 __cpu_name
[cpu
] = "NEC VR4181A";
368 case PRID_REV_VR4130
:
369 if ((c
->processor_id
& 0xf) < 0x4) {
370 c
->cputype
= CPU_VR4131
;
371 __cpu_name
[cpu
] = "NEC VR4131";
373 c
->cputype
= CPU_VR4133
;
374 __cpu_name
[cpu
] = "NEC VR4133";
378 printk(KERN_INFO
"Unexpected CPU of NEC VR4100 series\n");
379 c
->cputype
= CPU_VR41XX
;
380 __cpu_name
[cpu
] = "NEC Vr41xx";
383 c
->isa_level
= MIPS_CPU_ISA_III
;
384 c
->options
= R4K_OPTS
;
388 c
->cputype
= CPU_R4300
;
389 __cpu_name
[cpu
] = "R4300";
390 c
->isa_level
= MIPS_CPU_ISA_III
;
391 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
396 c
->cputype
= CPU_R4600
;
397 __cpu_name
[cpu
] = "R4600";
398 c
->isa_level
= MIPS_CPU_ISA_III
;
399 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
406 * This processor doesn't have an MMU, so it's not
407 * "real easy" to run Linux on it. It is left purely
408 * for documentation. Commented out because it shares
409 * it's c0_prid id number with the TX3900.
411 c
->cputype
= CPU_R4650
;
412 __cpu_name
[cpu
] = "R4650";
413 c
->isa_level
= MIPS_CPU_ISA_III
;
414 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_LLSC
;
419 c
->isa_level
= MIPS_CPU_ISA_I
;
420 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_TX39_CACHE
;
422 if ((c
->processor_id
& 0xf0) == (PRID_REV_TX3927
& 0xf0)) {
423 c
->cputype
= CPU_TX3927
;
424 __cpu_name
[cpu
] = "TX3927";
427 switch (c
->processor_id
& 0xff) {
428 case PRID_REV_TX3912
:
429 c
->cputype
= CPU_TX3912
;
430 __cpu_name
[cpu
] = "TX3912";
433 case PRID_REV_TX3922
:
434 c
->cputype
= CPU_TX3922
;
435 __cpu_name
[cpu
] = "TX3922";
442 c
->cputype
= CPU_R4700
;
443 __cpu_name
[cpu
] = "R4700";
444 c
->isa_level
= MIPS_CPU_ISA_III
;
445 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
450 c
->cputype
= CPU_TX49XX
;
451 __cpu_name
[cpu
] = "R49XX";
452 c
->isa_level
= MIPS_CPU_ISA_III
;
453 c
->options
= R4K_OPTS
| MIPS_CPU_LLSC
;
454 if (!(c
->processor_id
& 0x08))
455 c
->options
|= MIPS_CPU_FPU
| MIPS_CPU_32FPR
;
459 c
->cputype
= CPU_R5000
;
460 __cpu_name
[cpu
] = "R5000";
461 c
->isa_level
= MIPS_CPU_ISA_IV
;
462 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
467 c
->cputype
= CPU_R5432
;
468 __cpu_name
[cpu
] = "R5432";
469 c
->isa_level
= MIPS_CPU_ISA_IV
;
470 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
471 MIPS_CPU_WATCH
| MIPS_CPU_LLSC
;
475 c
->cputype
= CPU_R5500
;
476 __cpu_name
[cpu
] = "R5500";
477 c
->isa_level
= MIPS_CPU_ISA_IV
;
478 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
479 MIPS_CPU_WATCH
| MIPS_CPU_LLSC
;
482 case PRID_IMP_NEVADA
:
483 c
->cputype
= CPU_NEVADA
;
484 __cpu_name
[cpu
] = "Nevada";
485 c
->isa_level
= MIPS_CPU_ISA_IV
;
486 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
487 MIPS_CPU_DIVEC
| MIPS_CPU_LLSC
;
491 c
->cputype
= CPU_R6000
;
492 __cpu_name
[cpu
] = "R6000";
493 c
->isa_level
= MIPS_CPU_ISA_II
;
494 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_FPU
|
498 case PRID_IMP_R6000A
:
499 c
->cputype
= CPU_R6000A
;
500 __cpu_name
[cpu
] = "R6000A";
501 c
->isa_level
= MIPS_CPU_ISA_II
;
502 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_FPU
|
506 case PRID_IMP_RM7000
:
507 c
->cputype
= CPU_RM7000
;
508 __cpu_name
[cpu
] = "RM7000";
509 c
->isa_level
= MIPS_CPU_ISA_IV
;
510 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
513 * Undocumented RM7000: Bit 29 in the info register of
514 * the RM7000 v2.0 indicates if the TLB has 48 or 64
517 * 29 1 => 64 entry JTLB
520 c
->tlbsize
= (read_c0_info() & (1 << 29)) ? 64 : 48;
522 case PRID_IMP_RM9000
:
523 c
->cputype
= CPU_RM9000
;
524 __cpu_name
[cpu
] = "RM9000";
525 c
->isa_level
= MIPS_CPU_ISA_IV
;
526 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
529 * Bit 29 in the info register of the RM9000
530 * indicates if the TLB has 48 or 64 entries.
532 * 29 1 => 64 entry JTLB
535 c
->tlbsize
= (read_c0_info() & (1 << 29)) ? 64 : 48;
538 c
->cputype
= CPU_R8000
;
539 __cpu_name
[cpu
] = "RM8000";
540 c
->isa_level
= MIPS_CPU_ISA_IV
;
541 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4KEX
|
542 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
544 c
->tlbsize
= 384; /* has weird TLB: 3-way x 128 */
546 case PRID_IMP_R10000
:
547 c
->cputype
= CPU_R10000
;
548 __cpu_name
[cpu
] = "R10000";
549 c
->isa_level
= MIPS_CPU_ISA_IV
;
550 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
551 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
552 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
556 case PRID_IMP_R12000
:
557 c
->cputype
= CPU_R12000
;
558 __cpu_name
[cpu
] = "R12000";
559 c
->isa_level
= MIPS_CPU_ISA_IV
;
560 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
561 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
562 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
566 case PRID_IMP_R14000
:
567 c
->cputype
= CPU_R14000
;
568 __cpu_name
[cpu
] = "R14000";
569 c
->isa_level
= MIPS_CPU_ISA_IV
;
570 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
571 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
572 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
576 case PRID_IMP_LOONGSON2
:
577 c
->cputype
= CPU_LOONGSON2
;
578 __cpu_name
[cpu
] = "ICT Loongson-2";
579 c
->isa_level
= MIPS_CPU_ISA_III
;
580 c
->options
= R4K_OPTS
|
581 MIPS_CPU_FPU
| MIPS_CPU_LLSC
|
588 static char unknown_isa
[] __cpuinitdata
= KERN_ERR \
589 "Unsupported ISA type, c0.config0: %d.";
591 static inline unsigned int decode_config0(struct cpuinfo_mips
*c
)
593 unsigned int config0
;
596 config0
= read_c0_config();
598 if (((config0
& MIPS_CONF_MT
) >> 7) == 1)
599 c
->options
|= MIPS_CPU_TLB
;
600 isa
= (config0
& MIPS_CONF_AT
) >> 13;
603 switch ((config0
& MIPS_CONF_AR
) >> 10) {
605 c
->isa_level
= MIPS_CPU_ISA_M32R1
;
608 c
->isa_level
= MIPS_CPU_ISA_M32R2
;
615 switch ((config0
& MIPS_CONF_AR
) >> 10) {
617 c
->isa_level
= MIPS_CPU_ISA_M64R1
;
620 c
->isa_level
= MIPS_CPU_ISA_M64R2
;
630 return config0
& MIPS_CONF_M
;
633 panic(unknown_isa
, config0
);
636 static inline unsigned int decode_config1(struct cpuinfo_mips
*c
)
638 unsigned int config1
;
640 config1
= read_c0_config1();
642 if (config1
& MIPS_CONF1_MD
)
643 c
->ases
|= MIPS_ASE_MDMX
;
644 if (config1
& MIPS_CONF1_WR
)
645 c
->options
|= MIPS_CPU_WATCH
;
646 if (config1
& MIPS_CONF1_CA
)
647 c
->ases
|= MIPS_ASE_MIPS16
;
648 if (config1
& MIPS_CONF1_EP
)
649 c
->options
|= MIPS_CPU_EJTAG
;
650 if (config1
& MIPS_CONF1_FP
) {
651 c
->options
|= MIPS_CPU_FPU
;
652 c
->options
|= MIPS_CPU_32FPR
;
655 c
->tlbsize
= ((config1
& MIPS_CONF1_TLBS
) >> 25) + 1;
657 return config1
& MIPS_CONF_M
;
660 static inline unsigned int decode_config2(struct cpuinfo_mips
*c
)
662 unsigned int config2
;
664 config2
= read_c0_config2();
666 if (config2
& MIPS_CONF2_SL
)
667 c
->scache
.flags
&= ~MIPS_CACHE_NOT_PRESENT
;
669 return config2
& MIPS_CONF_M
;
672 static inline unsigned int decode_config3(struct cpuinfo_mips
*c
)
674 unsigned int config3
;
676 config3
= read_c0_config3();
678 if (config3
& MIPS_CONF3_SM
)
679 c
->ases
|= MIPS_ASE_SMARTMIPS
;
680 if (config3
& MIPS_CONF3_DSP
)
681 c
->ases
|= MIPS_ASE_DSP
;
682 if (config3
& MIPS_CONF3_VINT
)
683 c
->options
|= MIPS_CPU_VINT
;
684 if (config3
& MIPS_CONF3_VEIC
)
685 c
->options
|= MIPS_CPU_VEIC
;
686 if (config3
& MIPS_CONF3_MT
)
687 c
->ases
|= MIPS_ASE_MIPSMT
;
688 if (config3
& MIPS_CONF3_ULRI
)
689 c
->options
|= MIPS_CPU_ULRI
;
691 return config3
& MIPS_CONF_M
;
694 static void __cpuinit
decode_configs(struct cpuinfo_mips
*c
)
698 /* MIPS32 or MIPS64 compliant CPU. */
699 c
->options
= MIPS_CPU_4KEX
| MIPS_CPU_4K_CACHE
| MIPS_CPU_COUNTER
|
700 MIPS_CPU_DIVEC
| MIPS_CPU_LLSC
| MIPS_CPU_MCHECK
;
702 c
->scache
.flags
= MIPS_CACHE_NOT_PRESENT
;
704 ok
= decode_config0(c
); /* Read Config registers. */
705 BUG_ON(!ok
); /* Arch spec violation! */
707 ok
= decode_config1(c
);
709 ok
= decode_config2(c
);
711 ok
= decode_config3(c
);
713 mips_probe_watch_registers(c
);
716 static inline void cpu_probe_mips(struct cpuinfo_mips
*c
, unsigned int cpu
)
719 switch (c
->processor_id
& 0xff00) {
721 c
->cputype
= CPU_4KC
;
722 __cpu_name
[cpu
] = "MIPS 4Kc";
725 c
->cputype
= CPU_4KEC
;
726 __cpu_name
[cpu
] = "MIPS 4KEc";
728 case PRID_IMP_4KECR2
:
729 c
->cputype
= CPU_4KEC
;
730 __cpu_name
[cpu
] = "MIPS 4KEc";
734 c
->cputype
= CPU_4KSC
;
735 __cpu_name
[cpu
] = "MIPS 4KSc";
738 c
->cputype
= CPU_5KC
;
739 __cpu_name
[cpu
] = "MIPS 5Kc";
742 c
->cputype
= CPU_20KC
;
743 __cpu_name
[cpu
] = "MIPS 20Kc";
747 c
->cputype
= CPU_24K
;
748 __cpu_name
[cpu
] = "MIPS 24Kc";
751 c
->cputype
= CPU_25KF
;
752 __cpu_name
[cpu
] = "MIPS 25Kc";
755 c
->cputype
= CPU_34K
;
756 __cpu_name
[cpu
] = "MIPS 34Kc";
759 c
->cputype
= CPU_74K
;
760 __cpu_name
[cpu
] = "MIPS 74Kc";
763 c
->cputype
= CPU_1004K
;
764 __cpu_name
[cpu
] = "MIPS 1004Kc";
771 static inline void cpu_probe_alchemy(struct cpuinfo_mips
*c
, unsigned int cpu
)
774 switch (c
->processor_id
& 0xff00) {
775 case PRID_IMP_AU1_REV1
:
776 case PRID_IMP_AU1_REV2
:
777 c
->cputype
= CPU_ALCHEMY
;
778 switch ((c
->processor_id
>> 24) & 0xff) {
780 __cpu_name
[cpu
] = "Au1000";
783 __cpu_name
[cpu
] = "Au1500";
786 __cpu_name
[cpu
] = "Au1100";
789 __cpu_name
[cpu
] = "Au1550";
792 __cpu_name
[cpu
] = "Au1200";
793 if ((c
->processor_id
& 0xff) == 2)
794 __cpu_name
[cpu
] = "Au1250";
797 __cpu_name
[cpu
] = "Au1210";
800 __cpu_name
[cpu
] = "Au1xxx";
807 static inline void cpu_probe_sibyte(struct cpuinfo_mips
*c
, unsigned int cpu
)
811 switch (c
->processor_id
& 0xff00) {
813 c
->cputype
= CPU_SB1
;
814 __cpu_name
[cpu
] = "SiByte SB1";
815 /* FPU in pass1 is known to have issues. */
816 if ((c
->processor_id
& 0xff) < 0x02)
817 c
->options
&= ~(MIPS_CPU_FPU
| MIPS_CPU_32FPR
);
820 c
->cputype
= CPU_SB1A
;
821 __cpu_name
[cpu
] = "SiByte SB1A";
826 static inline void cpu_probe_sandcraft(struct cpuinfo_mips
*c
, unsigned int cpu
)
829 switch (c
->processor_id
& 0xff00) {
830 case PRID_IMP_SR71000
:
831 c
->cputype
= CPU_SR71000
;
832 __cpu_name
[cpu
] = "Sandcraft SR71000";
839 static inline void cpu_probe_nxp(struct cpuinfo_mips
*c
, unsigned int cpu
)
842 switch (c
->processor_id
& 0xff00) {
843 case PRID_IMP_PR4450
:
844 c
->cputype
= CPU_PR4450
;
845 __cpu_name
[cpu
] = "Philips PR4450";
846 c
->isa_level
= MIPS_CPU_ISA_M32R1
;
851 static inline void cpu_probe_broadcom(struct cpuinfo_mips
*c
, unsigned int cpu
)
854 switch (c
->processor_id
& 0xff00) {
855 case PRID_IMP_BCM3302
:
856 /* same as PRID_IMP_BCM6338 */
857 c
->cputype
= CPU_BCM3302
;
858 __cpu_name
[cpu
] = "Broadcom BCM3302";
860 case PRID_IMP_BCM4710
:
861 c
->cputype
= CPU_BCM4710
;
862 __cpu_name
[cpu
] = "Broadcom BCM4710";
864 case PRID_IMP_BCM6345
:
865 c
->cputype
= CPU_BCM6345
;
866 __cpu_name
[cpu
] = "Broadcom BCM6345";
868 case PRID_IMP_BCM6348
:
869 c
->cputype
= CPU_BCM6348
;
870 __cpu_name
[cpu
] = "Broadcom BCM6348";
872 case PRID_IMP_BCM4350
:
873 switch (c
->processor_id
& 0xf0) {
874 case PRID_REV_BCM6358
:
875 c
->cputype
= CPU_BCM6358
;
876 __cpu_name
[cpu
] = "Broadcom BCM6358";
879 c
->cputype
= CPU_UNKNOWN
;
886 static inline void cpu_probe_cavium(struct cpuinfo_mips
*c
, unsigned int cpu
)
889 switch (c
->processor_id
& 0xff00) {
890 case PRID_IMP_CAVIUM_CN38XX
:
891 case PRID_IMP_CAVIUM_CN31XX
:
892 case PRID_IMP_CAVIUM_CN30XX
:
893 case PRID_IMP_CAVIUM_CN58XX
:
894 case PRID_IMP_CAVIUM_CN56XX
:
895 case PRID_IMP_CAVIUM_CN50XX
:
896 case PRID_IMP_CAVIUM_CN52XX
:
897 c
->cputype
= CPU_CAVIUM_OCTEON
;
898 __cpu_name
[cpu
] = "Cavium Octeon";
901 printk(KERN_INFO
"Unknown Octeon chip!\n");
902 c
->cputype
= CPU_UNKNOWN
;
907 const char *__cpu_name
[NR_CPUS
];
909 __cpuinit
void cpu_probe(void)
911 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
912 unsigned int cpu
= smp_processor_id();
914 c
->processor_id
= PRID_IMP_UNKNOWN
;
915 c
->fpu_id
= FPIR_IMP_NONE
;
916 c
->cputype
= CPU_UNKNOWN
;
918 c
->processor_id
= read_c0_prid();
919 switch (c
->processor_id
& 0xff0000) {
920 case PRID_COMP_LEGACY
:
921 cpu_probe_legacy(c
, cpu
);
924 cpu_probe_mips(c
, cpu
);
926 case PRID_COMP_ALCHEMY
:
927 cpu_probe_alchemy(c
, cpu
);
929 case PRID_COMP_SIBYTE
:
930 cpu_probe_sibyte(c
, cpu
);
932 case PRID_COMP_BROADCOM
:
933 cpu_probe_broadcom(c
, cpu
);
935 case PRID_COMP_SANDCRAFT
:
936 cpu_probe_sandcraft(c
, cpu
);
939 cpu_probe_nxp(c
, cpu
);
941 case PRID_COMP_CAVIUM
:
942 cpu_probe_cavium(c
, cpu
);
946 BUG_ON(!__cpu_name
[cpu
]);
947 BUG_ON(c
->cputype
== CPU_UNKNOWN
);
950 * Platform code can force the cpu type to optimize code
951 * generation. In that case be sure the cpu type is correctly
952 * manually setup otherwise it could trigger some nasty bugs.
954 BUG_ON(current_cpu_type() != c
->cputype
);
956 if (c
->options
& MIPS_CPU_FPU
) {
957 c
->fpu_id
= cpu_get_fpu_id();
959 if (c
->isa_level
== MIPS_CPU_ISA_M32R1
||
960 c
->isa_level
== MIPS_CPU_ISA_M32R2
||
961 c
->isa_level
== MIPS_CPU_ISA_M64R1
||
962 c
->isa_level
== MIPS_CPU_ISA_M64R2
) {
963 if (c
->fpu_id
& MIPS_FPIR_3D
)
964 c
->ases
|= MIPS_ASE_MIPS3D
;
969 c
->srsets
= ((read_c0_srsctl() >> 26) & 0x0f) + 1;
974 __cpuinit
void cpu_report(void)
976 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
978 printk(KERN_INFO
"CPU revision is: %08x (%s)\n",
979 c
->processor_id
, cpu_name_string());
980 if (c
->options
& MIPS_CPU_FPU
)
981 printk(KERN_INFO
"FPU revision is: %08x\n", c
->fpu_id
);