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>
23 #include <asm/mipsregs.h>
24 #include <asm/system.h>
25 #include <asm/watch.h>
28 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover,
29 * the implementation of the "wait" feature differs between CPU families. This
30 * points to the function that implements CPU specific wait.
31 * The wait instruction stops the pipeline and reduces the power consumption of
34 void (*cpu_wait
)(void);
36 static void r3081_wait(void)
38 unsigned long cfg
= read_c0_conf();
39 write_c0_conf(cfg
| R30XX_CONF_HALT
);
42 static void r39xx_wait(void)
46 write_c0_conf(read_c0_conf() | TX39_CONF_HALT
);
50 extern void r4k_wait(void);
53 * This variant is preferable as it allows testing need_resched and going to
54 * sleep depending on the outcome atomically. Unfortunately the "It is
55 * implementation-dependent whether the pipeline restarts when a non-enabled
56 * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes
57 * using this version a gamble.
59 void r4k_wait_irqoff(void)
63 __asm__(" .set push \n"
68 __asm__(" .globl __pastwait \n"
74 * The RM7000 variant has to handle erratum 38. The workaround is to not
75 * have any pending stores when the WAIT instruction is executed.
77 static void rm7k_wait_irqoff(void)
87 " mtc0 $1, $12 # stalls until W stage \n"
89 " mtc0 $1, $12 # stalls until W stage \n"
95 * The Au1xxx wait is available only if using 32khz counter or
96 * external timer source, but specifically not CP0 Counter.
97 * alchemy/common/time.c may override cpu_wait!
99 static void au1k_wait(void)
101 __asm__(" .set mips3 \n"
102 " cache 0x14, 0(%0) \n"
103 " cache 0x14, 32(%0) \n"
112 : : "r" (au1k_wait
));
115 static int __initdata nowait
;
117 static int __init
wait_disable(char *s
)
124 __setup("nowait", wait_disable
);
126 void __init
check_wait(void)
128 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
131 printk("Wait instruction disabled.\n");
135 switch (c
->cputype
) {
138 cpu_wait
= r3081_wait
;
141 cpu_wait
= r39xx_wait
;
144 /* case CPU_R4300: */
162 case CPU_CAVIUM_OCTEON
:
167 cpu_wait
= rm7k_wait_irqoff
;
174 if (read_c0_config7() & MIPS_CONF7_WII
)
175 cpu_wait
= r4k_wait_irqoff
;
180 if ((c
->processor_id
& 0xff) >= PRID_REV_ENCODE_332(2, 1, 0))
181 cpu_wait
= r4k_wait_irqoff
;
185 cpu_wait
= r4k_wait_irqoff
;
188 cpu_wait
= au1k_wait
;
192 * WAIT on Rev1.0 has E1, E2, E3 and E16.
193 * WAIT on Rev2.0 and Rev3.0 has E16.
194 * Rev3.1 WAIT is nop, why bother
196 if ((c
->processor_id
& 0xff) <= 0x64)
200 * Another rev is incremeting c0_count at a reduced clock
201 * rate while in WAIT mode. So we basically have the choice
202 * between using the cp0 timer as clocksource or avoiding
203 * the WAIT instruction. Until more details are known,
204 * disable the use of WAIT for 20Kc entirely.
209 if ((c
->processor_id
& 0x00ff) >= 0x40)
217 static inline void check_errata(void)
219 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
221 switch (c
->cputype
) {
224 * Erratum "RPS May Cause Incorrect Instruction Execution"
225 * This code only handles VPE0, any SMP/SMTC/RTOS code
226 * making use of VPE1 will be responsable for that VPE.
228 if ((c
->processor_id
& PRID_REV_MASK
) <= PRID_REV_34K_V1_0_2
)
229 write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS
);
236 void __init
check_bugs32(void)
242 * Probe whether cpu has config register by trying to play with
243 * alternate cache bit and see whether it matters.
244 * It's used by cpu_probe to distinguish between R3000A and R3081.
246 static inline int cpu_has_confreg(void)
248 #ifdef CONFIG_CPU_R3000
249 extern unsigned long r3k_cache_size(unsigned long);
250 unsigned long size1
, size2
;
251 unsigned long cfg
= read_c0_conf();
253 size1
= r3k_cache_size(ST0_ISC
);
254 write_c0_conf(cfg
^ R30XX_CONF_AC
);
255 size2
= r3k_cache_size(ST0_ISC
);
257 return size1
!= size2
;
264 * Get the FPU Implementation/Revision.
266 static inline unsigned long cpu_get_fpu_id(void)
268 unsigned long tmp
, fpu_id
;
270 tmp
= read_c0_status();
272 fpu_id
= read_32bit_cp1_register(CP1_REVISION
);
273 write_c0_status(tmp
);
278 * Check the CPU has an FPU the official way.
280 static inline int __cpu_has_fpu(void)
282 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE
);
285 #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
288 static inline void cpu_probe_legacy(struct cpuinfo_mips
*c
, unsigned int cpu
)
290 switch (c
->processor_id
& 0xff00) {
292 c
->cputype
= CPU_R2000
;
293 __cpu_name
[cpu
] = "R2000";
294 c
->isa_level
= MIPS_CPU_ISA_I
;
295 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_3K_CACHE
|
298 c
->options
|= MIPS_CPU_FPU
;
302 if ((c
->processor_id
& 0xff) == PRID_REV_R3000A
) {
303 if (cpu_has_confreg()) {
304 c
->cputype
= CPU_R3081E
;
305 __cpu_name
[cpu
] = "R3081";
307 c
->cputype
= CPU_R3000A
;
308 __cpu_name
[cpu
] = "R3000A";
312 c
->cputype
= CPU_R3000
;
313 __cpu_name
[cpu
] = "R3000";
315 c
->isa_level
= MIPS_CPU_ISA_I
;
316 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_3K_CACHE
|
319 c
->options
|= MIPS_CPU_FPU
;
323 if (read_c0_config() & CONF_SC
) {
324 if ((c
->processor_id
& 0xff) >= PRID_REV_R4400
) {
325 c
->cputype
= CPU_R4400PC
;
326 __cpu_name
[cpu
] = "R4400PC";
328 c
->cputype
= CPU_R4000PC
;
329 __cpu_name
[cpu
] = "R4000PC";
332 if ((c
->processor_id
& 0xff) >= PRID_REV_R4400
) {
333 c
->cputype
= CPU_R4400SC
;
334 __cpu_name
[cpu
] = "R4400SC";
336 c
->cputype
= CPU_R4000SC
;
337 __cpu_name
[cpu
] = "R4000SC";
341 c
->isa_level
= MIPS_CPU_ISA_III
;
342 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
343 MIPS_CPU_WATCH
| MIPS_CPU_VCE
|
347 case PRID_IMP_VR41XX
:
348 switch (c
->processor_id
& 0xf0) {
349 case PRID_REV_VR4111
:
350 c
->cputype
= CPU_VR4111
;
351 __cpu_name
[cpu
] = "NEC VR4111";
353 case PRID_REV_VR4121
:
354 c
->cputype
= CPU_VR4121
;
355 __cpu_name
[cpu
] = "NEC VR4121";
357 case PRID_REV_VR4122
:
358 if ((c
->processor_id
& 0xf) < 0x3) {
359 c
->cputype
= CPU_VR4122
;
360 __cpu_name
[cpu
] = "NEC VR4122";
362 c
->cputype
= CPU_VR4181A
;
363 __cpu_name
[cpu
] = "NEC VR4181A";
366 case PRID_REV_VR4130
:
367 if ((c
->processor_id
& 0xf) < 0x4) {
368 c
->cputype
= CPU_VR4131
;
369 __cpu_name
[cpu
] = "NEC VR4131";
371 c
->cputype
= CPU_VR4133
;
372 __cpu_name
[cpu
] = "NEC VR4133";
376 printk(KERN_INFO
"Unexpected CPU of NEC VR4100 series\n");
377 c
->cputype
= CPU_VR41XX
;
378 __cpu_name
[cpu
] = "NEC Vr41xx";
381 c
->isa_level
= MIPS_CPU_ISA_III
;
382 c
->options
= R4K_OPTS
;
386 c
->cputype
= CPU_R4300
;
387 __cpu_name
[cpu
] = "R4300";
388 c
->isa_level
= MIPS_CPU_ISA_III
;
389 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
394 c
->cputype
= CPU_R4600
;
395 __cpu_name
[cpu
] = "R4600";
396 c
->isa_level
= MIPS_CPU_ISA_III
;
397 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
404 * This processor doesn't have an MMU, so it's not
405 * "real easy" to run Linux on it. It is left purely
406 * for documentation. Commented out because it shares
407 * it's c0_prid id number with the TX3900.
409 c
->cputype
= CPU_R4650
;
410 __cpu_name
[cpu
] = "R4650";
411 c
->isa_level
= MIPS_CPU_ISA_III
;
412 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_LLSC
;
417 c
->isa_level
= MIPS_CPU_ISA_I
;
418 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_TX39_CACHE
;
420 if ((c
->processor_id
& 0xf0) == (PRID_REV_TX3927
& 0xf0)) {
421 c
->cputype
= CPU_TX3927
;
422 __cpu_name
[cpu
] = "TX3927";
425 switch (c
->processor_id
& 0xff) {
426 case PRID_REV_TX3912
:
427 c
->cputype
= CPU_TX3912
;
428 __cpu_name
[cpu
] = "TX3912";
431 case PRID_REV_TX3922
:
432 c
->cputype
= CPU_TX3922
;
433 __cpu_name
[cpu
] = "TX3922";
440 c
->cputype
= CPU_R4700
;
441 __cpu_name
[cpu
] = "R4700";
442 c
->isa_level
= MIPS_CPU_ISA_III
;
443 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
448 c
->cputype
= CPU_TX49XX
;
449 __cpu_name
[cpu
] = "R49XX";
450 c
->isa_level
= MIPS_CPU_ISA_III
;
451 c
->options
= R4K_OPTS
| MIPS_CPU_LLSC
;
452 if (!(c
->processor_id
& 0x08))
453 c
->options
|= MIPS_CPU_FPU
| MIPS_CPU_32FPR
;
457 c
->cputype
= CPU_R5000
;
458 __cpu_name
[cpu
] = "R5000";
459 c
->isa_level
= MIPS_CPU_ISA_IV
;
460 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
465 c
->cputype
= CPU_R5432
;
466 __cpu_name
[cpu
] = "R5432";
467 c
->isa_level
= MIPS_CPU_ISA_IV
;
468 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
469 MIPS_CPU_WATCH
| MIPS_CPU_LLSC
;
473 c
->cputype
= CPU_R5500
;
474 __cpu_name
[cpu
] = "R5500";
475 c
->isa_level
= MIPS_CPU_ISA_IV
;
476 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
477 MIPS_CPU_WATCH
| MIPS_CPU_LLSC
;
480 case PRID_IMP_NEVADA
:
481 c
->cputype
= CPU_NEVADA
;
482 __cpu_name
[cpu
] = "Nevada";
483 c
->isa_level
= MIPS_CPU_ISA_IV
;
484 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
485 MIPS_CPU_DIVEC
| MIPS_CPU_LLSC
;
489 c
->cputype
= CPU_R6000
;
490 __cpu_name
[cpu
] = "R6000";
491 c
->isa_level
= MIPS_CPU_ISA_II
;
492 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_FPU
|
496 case PRID_IMP_R6000A
:
497 c
->cputype
= CPU_R6000A
;
498 __cpu_name
[cpu
] = "R6000A";
499 c
->isa_level
= MIPS_CPU_ISA_II
;
500 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_FPU
|
504 case PRID_IMP_RM7000
:
505 c
->cputype
= CPU_RM7000
;
506 __cpu_name
[cpu
] = "RM7000";
507 c
->isa_level
= MIPS_CPU_ISA_IV
;
508 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
511 * Undocumented RM7000: Bit 29 in the info register of
512 * the RM7000 v2.0 indicates if the TLB has 48 or 64
515 * 29 1 => 64 entry JTLB
518 c
->tlbsize
= (read_c0_info() & (1 << 29)) ? 64 : 48;
520 case PRID_IMP_RM9000
:
521 c
->cputype
= CPU_RM9000
;
522 __cpu_name
[cpu
] = "RM9000";
523 c
->isa_level
= MIPS_CPU_ISA_IV
;
524 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
527 * Bit 29 in the info register of the RM9000
528 * indicates if the TLB has 48 or 64 entries.
530 * 29 1 => 64 entry JTLB
533 c
->tlbsize
= (read_c0_info() & (1 << 29)) ? 64 : 48;
536 c
->cputype
= CPU_R8000
;
537 __cpu_name
[cpu
] = "RM8000";
538 c
->isa_level
= MIPS_CPU_ISA_IV
;
539 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4KEX
|
540 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
542 c
->tlbsize
= 384; /* has weird TLB: 3-way x 128 */
544 case PRID_IMP_R10000
:
545 c
->cputype
= CPU_R10000
;
546 __cpu_name
[cpu
] = "R10000";
547 c
->isa_level
= MIPS_CPU_ISA_IV
;
548 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
549 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
550 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
554 case PRID_IMP_R12000
:
555 c
->cputype
= CPU_R12000
;
556 __cpu_name
[cpu
] = "R12000";
557 c
->isa_level
= MIPS_CPU_ISA_IV
;
558 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
559 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
560 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
564 case PRID_IMP_R14000
:
565 c
->cputype
= CPU_R14000
;
566 __cpu_name
[cpu
] = "R14000";
567 c
->isa_level
= MIPS_CPU_ISA_IV
;
568 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
569 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
570 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
574 case PRID_IMP_LOONGSON2
:
575 c
->cputype
= CPU_LOONGSON2
;
576 __cpu_name
[cpu
] = "ICT Loongson-2";
577 c
->isa_level
= MIPS_CPU_ISA_III
;
578 c
->options
= R4K_OPTS
|
579 MIPS_CPU_FPU
| MIPS_CPU_LLSC
|
586 static char unknown_isa
[] __cpuinitdata
= KERN_ERR \
587 "Unsupported ISA type, c0.config0: %d.";
589 static inline unsigned int decode_config0(struct cpuinfo_mips
*c
)
591 unsigned int config0
;
594 config0
= read_c0_config();
596 if (((config0
& MIPS_CONF_MT
) >> 7) == 1)
597 c
->options
|= MIPS_CPU_TLB
;
598 isa
= (config0
& MIPS_CONF_AT
) >> 13;
601 switch ((config0
& MIPS_CONF_AR
) >> 10) {
603 c
->isa_level
= MIPS_CPU_ISA_M32R1
;
606 c
->isa_level
= MIPS_CPU_ISA_M32R2
;
613 switch ((config0
& MIPS_CONF_AR
) >> 10) {
615 c
->isa_level
= MIPS_CPU_ISA_M64R1
;
618 c
->isa_level
= MIPS_CPU_ISA_M64R2
;
628 return config0
& MIPS_CONF_M
;
631 panic(unknown_isa
, config0
);
634 static inline unsigned int decode_config1(struct cpuinfo_mips
*c
)
636 unsigned int config1
;
638 config1
= read_c0_config1();
640 if (config1
& MIPS_CONF1_MD
)
641 c
->ases
|= MIPS_ASE_MDMX
;
642 if (config1
& MIPS_CONF1_WR
)
643 c
->options
|= MIPS_CPU_WATCH
;
644 if (config1
& MIPS_CONF1_CA
)
645 c
->ases
|= MIPS_ASE_MIPS16
;
646 if (config1
& MIPS_CONF1_EP
)
647 c
->options
|= MIPS_CPU_EJTAG
;
648 if (config1
& MIPS_CONF1_FP
) {
649 c
->options
|= MIPS_CPU_FPU
;
650 c
->options
|= MIPS_CPU_32FPR
;
653 c
->tlbsize
= ((config1
& MIPS_CONF1_TLBS
) >> 25) + 1;
655 return config1
& MIPS_CONF_M
;
658 static inline unsigned int decode_config2(struct cpuinfo_mips
*c
)
660 unsigned int config2
;
662 config2
= read_c0_config2();
664 if (config2
& MIPS_CONF2_SL
)
665 c
->scache
.flags
&= ~MIPS_CACHE_NOT_PRESENT
;
667 return config2
& MIPS_CONF_M
;
670 static inline unsigned int decode_config3(struct cpuinfo_mips
*c
)
672 unsigned int config3
;
674 config3
= read_c0_config3();
676 if (config3
& MIPS_CONF3_SM
)
677 c
->ases
|= MIPS_ASE_SMARTMIPS
;
678 if (config3
& MIPS_CONF3_DSP
)
679 c
->ases
|= MIPS_ASE_DSP
;
680 if (config3
& MIPS_CONF3_VINT
)
681 c
->options
|= MIPS_CPU_VINT
;
682 if (config3
& MIPS_CONF3_VEIC
)
683 c
->options
|= MIPS_CPU_VEIC
;
684 if (config3
& MIPS_CONF3_MT
)
685 c
->ases
|= MIPS_ASE_MIPSMT
;
686 if (config3
& MIPS_CONF3_ULRI
)
687 c
->options
|= MIPS_CPU_ULRI
;
689 return config3
& MIPS_CONF_M
;
692 static void __cpuinit
decode_configs(struct cpuinfo_mips
*c
)
696 /* MIPS32 or MIPS64 compliant CPU. */
697 c
->options
= MIPS_CPU_4KEX
| MIPS_CPU_4K_CACHE
| MIPS_CPU_COUNTER
|
698 MIPS_CPU_DIVEC
| MIPS_CPU_LLSC
| MIPS_CPU_MCHECK
;
700 c
->scache
.flags
= MIPS_CACHE_NOT_PRESENT
;
702 ok
= decode_config0(c
); /* Read Config registers. */
703 BUG_ON(!ok
); /* Arch spec violation! */
705 ok
= decode_config1(c
);
707 ok
= decode_config2(c
);
709 ok
= decode_config3(c
);
711 mips_probe_watch_registers(c
);
714 #ifdef CONFIG_CPU_MIPSR2
715 extern void spram_config(void);
717 static inline void spram_config(void) {}
720 static inline void cpu_probe_mips(struct cpuinfo_mips
*c
, unsigned int cpu
)
723 switch (c
->processor_id
& 0xff00) {
725 c
->cputype
= CPU_4KC
;
726 __cpu_name
[cpu
] = "MIPS 4Kc";
729 c
->cputype
= CPU_4KEC
;
730 __cpu_name
[cpu
] = "MIPS 4KEc";
732 case PRID_IMP_4KECR2
:
733 c
->cputype
= CPU_4KEC
;
734 __cpu_name
[cpu
] = "MIPS 4KEc";
738 c
->cputype
= CPU_4KSC
;
739 __cpu_name
[cpu
] = "MIPS 4KSc";
742 c
->cputype
= CPU_5KC
;
743 __cpu_name
[cpu
] = "MIPS 5Kc";
746 c
->cputype
= CPU_20KC
;
747 __cpu_name
[cpu
] = "MIPS 20Kc";
751 c
->cputype
= CPU_24K
;
752 __cpu_name
[cpu
] = "MIPS 24Kc";
755 c
->cputype
= CPU_25KF
;
756 __cpu_name
[cpu
] = "MIPS 25Kc";
759 c
->cputype
= CPU_34K
;
760 __cpu_name
[cpu
] = "MIPS 34Kc";
763 c
->cputype
= CPU_74K
;
764 __cpu_name
[cpu
] = "MIPS 74Kc";
767 c
->cputype
= CPU_1004K
;
768 __cpu_name
[cpu
] = "MIPS 1004Kc";
775 static inline void cpu_probe_alchemy(struct cpuinfo_mips
*c
, unsigned int cpu
)
778 switch (c
->processor_id
& 0xff00) {
779 case PRID_IMP_AU1_REV1
:
780 case PRID_IMP_AU1_REV2
:
781 c
->cputype
= CPU_ALCHEMY
;
782 switch ((c
->processor_id
>> 24) & 0xff) {
784 __cpu_name
[cpu
] = "Au1000";
787 __cpu_name
[cpu
] = "Au1500";
790 __cpu_name
[cpu
] = "Au1100";
793 __cpu_name
[cpu
] = "Au1550";
796 __cpu_name
[cpu
] = "Au1200";
797 if ((c
->processor_id
& 0xff) == 2)
798 __cpu_name
[cpu
] = "Au1250";
801 __cpu_name
[cpu
] = "Au1210";
804 __cpu_name
[cpu
] = "Au1xxx";
811 static inline void cpu_probe_sibyte(struct cpuinfo_mips
*c
, unsigned int cpu
)
815 switch (c
->processor_id
& 0xff00) {
817 c
->cputype
= CPU_SB1
;
818 __cpu_name
[cpu
] = "SiByte SB1";
819 /* FPU in pass1 is known to have issues. */
820 if ((c
->processor_id
& 0xff) < 0x02)
821 c
->options
&= ~(MIPS_CPU_FPU
| MIPS_CPU_32FPR
);
824 c
->cputype
= CPU_SB1A
;
825 __cpu_name
[cpu
] = "SiByte SB1A";
830 static inline void cpu_probe_sandcraft(struct cpuinfo_mips
*c
, unsigned int cpu
)
833 switch (c
->processor_id
& 0xff00) {
834 case PRID_IMP_SR71000
:
835 c
->cputype
= CPU_SR71000
;
836 __cpu_name
[cpu
] = "Sandcraft SR71000";
843 static inline void cpu_probe_nxp(struct cpuinfo_mips
*c
, unsigned int cpu
)
846 switch (c
->processor_id
& 0xff00) {
847 case PRID_IMP_PR4450
:
848 c
->cputype
= CPU_PR4450
;
849 __cpu_name
[cpu
] = "Philips PR4450";
850 c
->isa_level
= MIPS_CPU_ISA_M32R1
;
855 static inline void cpu_probe_broadcom(struct cpuinfo_mips
*c
, unsigned int cpu
)
858 switch (c
->processor_id
& 0xff00) {
859 case PRID_IMP_BCM3302
:
860 /* same as PRID_IMP_BCM6338 */
861 c
->cputype
= CPU_BCM3302
;
862 __cpu_name
[cpu
] = "Broadcom BCM3302";
864 case PRID_IMP_BCM4710
:
865 c
->cputype
= CPU_BCM4710
;
866 __cpu_name
[cpu
] = "Broadcom BCM4710";
868 case PRID_IMP_BCM6345
:
869 c
->cputype
= CPU_BCM6345
;
870 __cpu_name
[cpu
] = "Broadcom BCM6345";
872 case PRID_IMP_BCM6348
:
873 c
->cputype
= CPU_BCM6348
;
874 __cpu_name
[cpu
] = "Broadcom BCM6348";
876 case PRID_IMP_BCM4350
:
877 switch (c
->processor_id
& 0xf0) {
878 case PRID_REV_BCM6358
:
879 c
->cputype
= CPU_BCM6358
;
880 __cpu_name
[cpu
] = "Broadcom BCM6358";
883 c
->cputype
= CPU_UNKNOWN
;
890 static inline void cpu_probe_cavium(struct cpuinfo_mips
*c
, unsigned int cpu
)
893 switch (c
->processor_id
& 0xff00) {
894 case PRID_IMP_CAVIUM_CN38XX
:
895 case PRID_IMP_CAVIUM_CN31XX
:
896 case PRID_IMP_CAVIUM_CN30XX
:
897 case PRID_IMP_CAVIUM_CN58XX
:
898 case PRID_IMP_CAVIUM_CN56XX
:
899 case PRID_IMP_CAVIUM_CN50XX
:
900 case PRID_IMP_CAVIUM_CN52XX
:
901 c
->cputype
= CPU_CAVIUM_OCTEON
;
902 __cpu_name
[cpu
] = "Cavium Octeon";
905 printk(KERN_INFO
"Unknown Octeon chip!\n");
906 c
->cputype
= CPU_UNKNOWN
;
911 const char *__cpu_name
[NR_CPUS
];
913 __cpuinit
void cpu_probe(void)
915 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
916 unsigned int cpu
= smp_processor_id();
918 c
->processor_id
= PRID_IMP_UNKNOWN
;
919 c
->fpu_id
= FPIR_IMP_NONE
;
920 c
->cputype
= CPU_UNKNOWN
;
922 c
->processor_id
= read_c0_prid();
923 switch (c
->processor_id
& 0xff0000) {
924 case PRID_COMP_LEGACY
:
925 cpu_probe_legacy(c
, cpu
);
928 cpu_probe_mips(c
, cpu
);
930 case PRID_COMP_ALCHEMY
:
931 cpu_probe_alchemy(c
, cpu
);
933 case PRID_COMP_SIBYTE
:
934 cpu_probe_sibyte(c
, cpu
);
936 case PRID_COMP_BROADCOM
:
937 cpu_probe_broadcom(c
, cpu
);
939 case PRID_COMP_SANDCRAFT
:
940 cpu_probe_sandcraft(c
, cpu
);
943 cpu_probe_nxp(c
, cpu
);
945 case PRID_COMP_CAVIUM
:
946 cpu_probe_cavium(c
, cpu
);
950 BUG_ON(!__cpu_name
[cpu
]);
951 BUG_ON(c
->cputype
== CPU_UNKNOWN
);
954 * Platform code can force the cpu type to optimize code
955 * generation. In that case be sure the cpu type is correctly
956 * manually setup otherwise it could trigger some nasty bugs.
958 BUG_ON(current_cpu_type() != c
->cputype
);
960 if (c
->options
& MIPS_CPU_FPU
) {
961 c
->fpu_id
= cpu_get_fpu_id();
963 if (c
->isa_level
== MIPS_CPU_ISA_M32R1
||
964 c
->isa_level
== MIPS_CPU_ISA_M32R2
||
965 c
->isa_level
== MIPS_CPU_ISA_M64R1
||
966 c
->isa_level
== MIPS_CPU_ISA_M64R2
) {
967 if (c
->fpu_id
& MIPS_FPIR_3D
)
968 c
->ases
|= MIPS_ASE_MIPS3D
;
973 c
->srsets
= ((read_c0_srsctl() >> 26) & 0x0f) + 1;
978 __cpuinit
void cpu_report(void)
980 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
982 printk(KERN_INFO
"CPU revision is: %08x (%s)\n",
983 c
->processor_id
, cpu_name_string());
984 if (c
->options
& MIPS_CPU_FPU
)
985 printk(KERN_INFO
"FPU revision is: %08x\n", c
->fpu_id
);