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: */
159 case CPU_CAVIUM_OCTEON
:
164 cpu_wait
= rm7k_wait_irqoff
;
171 if (read_c0_config7() & MIPS_CONF7_WII
)
172 cpu_wait
= r4k_wait_irqoff
;
177 if ((c
->processor_id
& 0xff) >= PRID_REV_ENCODE_332(2, 1, 0))
178 cpu_wait
= r4k_wait_irqoff
;
182 cpu_wait
= r4k_wait_irqoff
;
185 cpu_wait
= au1k_wait
;
189 * WAIT on Rev1.0 has E1, E2, E3 and E16.
190 * WAIT on Rev2.0 and Rev3.0 has E16.
191 * Rev3.1 WAIT is nop, why bother
193 if ((c
->processor_id
& 0xff) <= 0x64)
197 * Another rev is incremeting c0_count at a reduced clock
198 * rate while in WAIT mode. So we basically have the choice
199 * between using the cp0 timer as clocksource or avoiding
200 * the WAIT instruction. Until more details are known,
201 * disable the use of WAIT for 20Kc entirely.
206 if ((c
->processor_id
& 0x00ff) >= 0x40)
214 static inline void check_errata(void)
216 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
218 switch (c
->cputype
) {
221 * Erratum "RPS May Cause Incorrect Instruction Execution"
222 * This code only handles VPE0, any SMP/SMTC/RTOS code
223 * making use of VPE1 will be responsable for that VPE.
225 if ((c
->processor_id
& PRID_REV_MASK
) <= PRID_REV_34K_V1_0_2
)
226 write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS
);
233 void __init
check_bugs32(void)
239 * Probe whether cpu has config register by trying to play with
240 * alternate cache bit and see whether it matters.
241 * It's used by cpu_probe to distinguish between R3000A and R3081.
243 static inline int cpu_has_confreg(void)
245 #ifdef CONFIG_CPU_R3000
246 extern unsigned long r3k_cache_size(unsigned long);
247 unsigned long size1
, size2
;
248 unsigned long cfg
= read_c0_conf();
250 size1
= r3k_cache_size(ST0_ISC
);
251 write_c0_conf(cfg
^ R30XX_CONF_AC
);
252 size2
= r3k_cache_size(ST0_ISC
);
254 return size1
!= size2
;
261 * Get the FPU Implementation/Revision.
263 static inline unsigned long cpu_get_fpu_id(void)
265 unsigned long tmp
, fpu_id
;
267 tmp
= read_c0_status();
269 fpu_id
= read_32bit_cp1_register(CP1_REVISION
);
270 write_c0_status(tmp
);
275 * Check the CPU has an FPU the official way.
277 static inline int __cpu_has_fpu(void)
279 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE
);
282 #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
285 static inline void cpu_probe_legacy(struct cpuinfo_mips
*c
, unsigned int cpu
)
287 switch (c
->processor_id
& 0xff00) {
289 c
->cputype
= CPU_R2000
;
290 __cpu_name
[cpu
] = "R2000";
291 c
->isa_level
= MIPS_CPU_ISA_I
;
292 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_3K_CACHE
|
295 c
->options
|= MIPS_CPU_FPU
;
299 if ((c
->processor_id
& 0xff) == PRID_REV_R3000A
) {
300 if (cpu_has_confreg()) {
301 c
->cputype
= CPU_R3081E
;
302 __cpu_name
[cpu
] = "R3081";
304 c
->cputype
= CPU_R3000A
;
305 __cpu_name
[cpu
] = "R3000A";
309 c
->cputype
= CPU_R3000
;
310 __cpu_name
[cpu
] = "R3000";
312 c
->isa_level
= MIPS_CPU_ISA_I
;
313 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_3K_CACHE
|
316 c
->options
|= MIPS_CPU_FPU
;
320 if (read_c0_config() & CONF_SC
) {
321 if ((c
->processor_id
& 0xff) >= PRID_REV_R4400
) {
322 c
->cputype
= CPU_R4400PC
;
323 __cpu_name
[cpu
] = "R4400PC";
325 c
->cputype
= CPU_R4000PC
;
326 __cpu_name
[cpu
] = "R4000PC";
329 if ((c
->processor_id
& 0xff) >= PRID_REV_R4400
) {
330 c
->cputype
= CPU_R4400SC
;
331 __cpu_name
[cpu
] = "R4400SC";
333 c
->cputype
= CPU_R4000SC
;
334 __cpu_name
[cpu
] = "R4000SC";
338 c
->isa_level
= MIPS_CPU_ISA_III
;
339 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
340 MIPS_CPU_WATCH
| MIPS_CPU_VCE
|
344 case PRID_IMP_VR41XX
:
345 switch (c
->processor_id
& 0xf0) {
346 case PRID_REV_VR4111
:
347 c
->cputype
= CPU_VR4111
;
348 __cpu_name
[cpu
] = "NEC VR4111";
350 case PRID_REV_VR4121
:
351 c
->cputype
= CPU_VR4121
;
352 __cpu_name
[cpu
] = "NEC VR4121";
354 case PRID_REV_VR4122
:
355 if ((c
->processor_id
& 0xf) < 0x3) {
356 c
->cputype
= CPU_VR4122
;
357 __cpu_name
[cpu
] = "NEC VR4122";
359 c
->cputype
= CPU_VR4181A
;
360 __cpu_name
[cpu
] = "NEC VR4181A";
363 case PRID_REV_VR4130
:
364 if ((c
->processor_id
& 0xf) < 0x4) {
365 c
->cputype
= CPU_VR4131
;
366 __cpu_name
[cpu
] = "NEC VR4131";
368 c
->cputype
= CPU_VR4133
;
369 __cpu_name
[cpu
] = "NEC VR4133";
373 printk(KERN_INFO
"Unexpected CPU of NEC VR4100 series\n");
374 c
->cputype
= CPU_VR41XX
;
375 __cpu_name
[cpu
] = "NEC Vr41xx";
378 c
->isa_level
= MIPS_CPU_ISA_III
;
379 c
->options
= R4K_OPTS
;
383 c
->cputype
= CPU_R4300
;
384 __cpu_name
[cpu
] = "R4300";
385 c
->isa_level
= MIPS_CPU_ISA_III
;
386 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
391 c
->cputype
= CPU_R4600
;
392 __cpu_name
[cpu
] = "R4600";
393 c
->isa_level
= MIPS_CPU_ISA_III
;
394 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
401 * This processor doesn't have an MMU, so it's not
402 * "real easy" to run Linux on it. It is left purely
403 * for documentation. Commented out because it shares
404 * it's c0_prid id number with the TX3900.
406 c
->cputype
= CPU_R4650
;
407 __cpu_name
[cpu
] = "R4650";
408 c
->isa_level
= MIPS_CPU_ISA_III
;
409 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_LLSC
;
414 c
->isa_level
= MIPS_CPU_ISA_I
;
415 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_TX39_CACHE
;
417 if ((c
->processor_id
& 0xf0) == (PRID_REV_TX3927
& 0xf0)) {
418 c
->cputype
= CPU_TX3927
;
419 __cpu_name
[cpu
] = "TX3927";
422 switch (c
->processor_id
& 0xff) {
423 case PRID_REV_TX3912
:
424 c
->cputype
= CPU_TX3912
;
425 __cpu_name
[cpu
] = "TX3912";
428 case PRID_REV_TX3922
:
429 c
->cputype
= CPU_TX3922
;
430 __cpu_name
[cpu
] = "TX3922";
437 c
->cputype
= CPU_R4700
;
438 __cpu_name
[cpu
] = "R4700";
439 c
->isa_level
= MIPS_CPU_ISA_III
;
440 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
445 c
->cputype
= CPU_TX49XX
;
446 __cpu_name
[cpu
] = "R49XX";
447 c
->isa_level
= MIPS_CPU_ISA_III
;
448 c
->options
= R4K_OPTS
| MIPS_CPU_LLSC
;
449 if (!(c
->processor_id
& 0x08))
450 c
->options
|= MIPS_CPU_FPU
| MIPS_CPU_32FPR
;
454 c
->cputype
= CPU_R5000
;
455 __cpu_name
[cpu
] = "R5000";
456 c
->isa_level
= MIPS_CPU_ISA_IV
;
457 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
462 c
->cputype
= CPU_R5432
;
463 __cpu_name
[cpu
] = "R5432";
464 c
->isa_level
= MIPS_CPU_ISA_IV
;
465 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
466 MIPS_CPU_WATCH
| MIPS_CPU_LLSC
;
470 c
->cputype
= CPU_R5500
;
471 __cpu_name
[cpu
] = "R5500";
472 c
->isa_level
= MIPS_CPU_ISA_IV
;
473 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
474 MIPS_CPU_WATCH
| MIPS_CPU_LLSC
;
477 case PRID_IMP_NEVADA
:
478 c
->cputype
= CPU_NEVADA
;
479 __cpu_name
[cpu
] = "Nevada";
480 c
->isa_level
= MIPS_CPU_ISA_IV
;
481 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
482 MIPS_CPU_DIVEC
| MIPS_CPU_LLSC
;
486 c
->cputype
= CPU_R6000
;
487 __cpu_name
[cpu
] = "R6000";
488 c
->isa_level
= MIPS_CPU_ISA_II
;
489 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_FPU
|
493 case PRID_IMP_R6000A
:
494 c
->cputype
= CPU_R6000A
;
495 __cpu_name
[cpu
] = "R6000A";
496 c
->isa_level
= MIPS_CPU_ISA_II
;
497 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_FPU
|
501 case PRID_IMP_RM7000
:
502 c
->cputype
= CPU_RM7000
;
503 __cpu_name
[cpu
] = "RM7000";
504 c
->isa_level
= MIPS_CPU_ISA_IV
;
505 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
508 * Undocumented RM7000: Bit 29 in the info register of
509 * the RM7000 v2.0 indicates if the TLB has 48 or 64
512 * 29 1 => 64 entry JTLB
515 c
->tlbsize
= (read_c0_info() & (1 << 29)) ? 64 : 48;
517 case PRID_IMP_RM9000
:
518 c
->cputype
= CPU_RM9000
;
519 __cpu_name
[cpu
] = "RM9000";
520 c
->isa_level
= MIPS_CPU_ISA_IV
;
521 c
->options
= R4K_OPTS
| MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
524 * Bit 29 in the info register of the RM9000
525 * indicates if the TLB has 48 or 64 entries.
527 * 29 1 => 64 entry JTLB
530 c
->tlbsize
= (read_c0_info() & (1 << 29)) ? 64 : 48;
533 c
->cputype
= CPU_R8000
;
534 __cpu_name
[cpu
] = "RM8000";
535 c
->isa_level
= MIPS_CPU_ISA_IV
;
536 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4KEX
|
537 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
539 c
->tlbsize
= 384; /* has weird TLB: 3-way x 128 */
541 case PRID_IMP_R10000
:
542 c
->cputype
= CPU_R10000
;
543 __cpu_name
[cpu
] = "R10000";
544 c
->isa_level
= MIPS_CPU_ISA_IV
;
545 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
546 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
547 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
551 case PRID_IMP_R12000
:
552 c
->cputype
= CPU_R12000
;
553 __cpu_name
[cpu
] = "R12000";
554 c
->isa_level
= MIPS_CPU_ISA_IV
;
555 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
556 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
557 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
561 case PRID_IMP_R14000
:
562 c
->cputype
= CPU_R14000
;
563 __cpu_name
[cpu
] = "R14000";
564 c
->isa_level
= MIPS_CPU_ISA_IV
;
565 c
->options
= MIPS_CPU_TLB
| MIPS_CPU_4K_CACHE
| MIPS_CPU_4KEX
|
566 MIPS_CPU_FPU
| MIPS_CPU_32FPR
|
567 MIPS_CPU_COUNTER
| MIPS_CPU_WATCH
|
571 case PRID_IMP_LOONGSON2
:
572 c
->cputype
= CPU_LOONGSON2
;
573 __cpu_name
[cpu
] = "ICT Loongson-2";
574 c
->isa_level
= MIPS_CPU_ISA_III
;
575 c
->options
= R4K_OPTS
|
576 MIPS_CPU_FPU
| MIPS_CPU_LLSC
|
583 static char unknown_isa
[] __cpuinitdata
= KERN_ERR \
584 "Unsupported ISA type, c0.config0: %d.";
586 static inline unsigned int decode_config0(struct cpuinfo_mips
*c
)
588 unsigned int config0
;
591 config0
= read_c0_config();
593 if (((config0
& MIPS_CONF_MT
) >> 7) == 1)
594 c
->options
|= MIPS_CPU_TLB
;
595 isa
= (config0
& MIPS_CONF_AT
) >> 13;
598 switch ((config0
& MIPS_CONF_AR
) >> 10) {
600 c
->isa_level
= MIPS_CPU_ISA_M32R1
;
603 c
->isa_level
= MIPS_CPU_ISA_M32R2
;
610 switch ((config0
& MIPS_CONF_AR
) >> 10) {
612 c
->isa_level
= MIPS_CPU_ISA_M64R1
;
615 c
->isa_level
= MIPS_CPU_ISA_M64R2
;
625 return config0
& MIPS_CONF_M
;
628 panic(unknown_isa
, config0
);
631 static inline unsigned int decode_config1(struct cpuinfo_mips
*c
)
633 unsigned int config1
;
635 config1
= read_c0_config1();
637 if (config1
& MIPS_CONF1_MD
)
638 c
->ases
|= MIPS_ASE_MDMX
;
639 if (config1
& MIPS_CONF1_WR
)
640 c
->options
|= MIPS_CPU_WATCH
;
641 if (config1
& MIPS_CONF1_CA
)
642 c
->ases
|= MIPS_ASE_MIPS16
;
643 if (config1
& MIPS_CONF1_EP
)
644 c
->options
|= MIPS_CPU_EJTAG
;
645 if (config1
& MIPS_CONF1_FP
) {
646 c
->options
|= MIPS_CPU_FPU
;
647 c
->options
|= MIPS_CPU_32FPR
;
650 c
->tlbsize
= ((config1
& MIPS_CONF1_TLBS
) >> 25) + 1;
652 return config1
& MIPS_CONF_M
;
655 static inline unsigned int decode_config2(struct cpuinfo_mips
*c
)
657 unsigned int config2
;
659 config2
= read_c0_config2();
661 if (config2
& MIPS_CONF2_SL
)
662 c
->scache
.flags
&= ~MIPS_CACHE_NOT_PRESENT
;
664 return config2
& MIPS_CONF_M
;
667 static inline unsigned int decode_config3(struct cpuinfo_mips
*c
)
669 unsigned int config3
;
671 config3
= read_c0_config3();
673 if (config3
& MIPS_CONF3_SM
)
674 c
->ases
|= MIPS_ASE_SMARTMIPS
;
675 if (config3
& MIPS_CONF3_DSP
)
676 c
->ases
|= MIPS_ASE_DSP
;
677 if (config3
& MIPS_CONF3_VINT
)
678 c
->options
|= MIPS_CPU_VINT
;
679 if (config3
& MIPS_CONF3_VEIC
)
680 c
->options
|= MIPS_CPU_VEIC
;
681 if (config3
& MIPS_CONF3_MT
)
682 c
->ases
|= MIPS_ASE_MIPSMT
;
683 if (config3
& MIPS_CONF3_ULRI
)
684 c
->options
|= MIPS_CPU_ULRI
;
686 return config3
& MIPS_CONF_M
;
689 static void __cpuinit
decode_configs(struct cpuinfo_mips
*c
)
693 /* MIPS32 or MIPS64 compliant CPU. */
694 c
->options
= MIPS_CPU_4KEX
| MIPS_CPU_4K_CACHE
| MIPS_CPU_COUNTER
|
695 MIPS_CPU_DIVEC
| MIPS_CPU_LLSC
| MIPS_CPU_MCHECK
;
697 c
->scache
.flags
= MIPS_CACHE_NOT_PRESENT
;
699 ok
= decode_config0(c
); /* Read Config registers. */
700 BUG_ON(!ok
); /* Arch spec violation! */
702 ok
= decode_config1(c
);
704 ok
= decode_config2(c
);
706 ok
= decode_config3(c
);
708 mips_probe_watch_registers(c
);
711 #ifdef CONFIG_CPU_MIPSR2
712 extern void spram_config(void);
714 static inline void spram_config(void) {}
717 static inline void cpu_probe_mips(struct cpuinfo_mips
*c
, unsigned int cpu
)
720 switch (c
->processor_id
& 0xff00) {
722 c
->cputype
= CPU_4KC
;
723 __cpu_name
[cpu
] = "MIPS 4Kc";
726 c
->cputype
= CPU_4KEC
;
727 __cpu_name
[cpu
] = "MIPS 4KEc";
729 case PRID_IMP_4KECR2
:
730 c
->cputype
= CPU_4KEC
;
731 __cpu_name
[cpu
] = "MIPS 4KEc";
735 c
->cputype
= CPU_4KSC
;
736 __cpu_name
[cpu
] = "MIPS 4KSc";
739 c
->cputype
= CPU_5KC
;
740 __cpu_name
[cpu
] = "MIPS 5Kc";
743 c
->cputype
= CPU_20KC
;
744 __cpu_name
[cpu
] = "MIPS 20Kc";
748 c
->cputype
= CPU_24K
;
749 __cpu_name
[cpu
] = "MIPS 24Kc";
752 c
->cputype
= CPU_25KF
;
753 __cpu_name
[cpu
] = "MIPS 25Kc";
756 c
->cputype
= CPU_34K
;
757 __cpu_name
[cpu
] = "MIPS 34Kc";
760 c
->cputype
= CPU_74K
;
761 __cpu_name
[cpu
] = "MIPS 74Kc";
764 c
->cputype
= CPU_1004K
;
765 __cpu_name
[cpu
] = "MIPS 1004Kc";
772 static inline void cpu_probe_alchemy(struct cpuinfo_mips
*c
, unsigned int cpu
)
775 switch (c
->processor_id
& 0xff00) {
776 case PRID_IMP_AU1_REV1
:
777 case PRID_IMP_AU1_REV2
:
778 c
->cputype
= CPU_ALCHEMY
;
779 switch ((c
->processor_id
>> 24) & 0xff) {
781 __cpu_name
[cpu
] = "Au1000";
784 __cpu_name
[cpu
] = "Au1500";
787 __cpu_name
[cpu
] = "Au1100";
790 __cpu_name
[cpu
] = "Au1550";
793 __cpu_name
[cpu
] = "Au1200";
794 if ((c
->processor_id
& 0xff) == 2)
795 __cpu_name
[cpu
] = "Au1250";
798 __cpu_name
[cpu
] = "Au1210";
801 __cpu_name
[cpu
] = "Au1xxx";
808 static inline void cpu_probe_sibyte(struct cpuinfo_mips
*c
, unsigned int cpu
)
812 switch (c
->processor_id
& 0xff00) {
814 c
->cputype
= CPU_SB1
;
815 __cpu_name
[cpu
] = "SiByte SB1";
816 /* FPU in pass1 is known to have issues. */
817 if ((c
->processor_id
& 0xff) < 0x02)
818 c
->options
&= ~(MIPS_CPU_FPU
| MIPS_CPU_32FPR
);
821 c
->cputype
= CPU_SB1A
;
822 __cpu_name
[cpu
] = "SiByte SB1A";
827 static inline void cpu_probe_sandcraft(struct cpuinfo_mips
*c
, unsigned int cpu
)
830 switch (c
->processor_id
& 0xff00) {
831 case PRID_IMP_SR71000
:
832 c
->cputype
= CPU_SR71000
;
833 __cpu_name
[cpu
] = "Sandcraft SR71000";
840 static inline void cpu_probe_nxp(struct cpuinfo_mips
*c
, unsigned int cpu
)
843 switch (c
->processor_id
& 0xff00) {
844 case PRID_IMP_PR4450
:
845 c
->cputype
= CPU_PR4450
;
846 __cpu_name
[cpu
] = "Philips PR4450";
847 c
->isa_level
= MIPS_CPU_ISA_M32R1
;
852 static inline void cpu_probe_broadcom(struct cpuinfo_mips
*c
, unsigned int cpu
)
855 switch (c
->processor_id
& 0xff00) {
856 case PRID_IMP_BCM3302
:
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";
867 static inline void cpu_probe_cavium(struct cpuinfo_mips
*c
, unsigned int cpu
)
870 switch (c
->processor_id
& 0xff00) {
871 case PRID_IMP_CAVIUM_CN38XX
:
872 case PRID_IMP_CAVIUM_CN31XX
:
873 case PRID_IMP_CAVIUM_CN30XX
:
874 case PRID_IMP_CAVIUM_CN58XX
:
875 case PRID_IMP_CAVIUM_CN56XX
:
876 case PRID_IMP_CAVIUM_CN50XX
:
877 case PRID_IMP_CAVIUM_CN52XX
:
878 c
->cputype
= CPU_CAVIUM_OCTEON
;
879 __cpu_name
[cpu
] = "Cavium Octeon";
882 printk(KERN_INFO
"Unknown Octeon chip!\n");
883 c
->cputype
= CPU_UNKNOWN
;
888 const char *__cpu_name
[NR_CPUS
];
890 __cpuinit
void cpu_probe(void)
892 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
893 unsigned int cpu
= smp_processor_id();
895 c
->processor_id
= PRID_IMP_UNKNOWN
;
896 c
->fpu_id
= FPIR_IMP_NONE
;
897 c
->cputype
= CPU_UNKNOWN
;
899 c
->processor_id
= read_c0_prid();
900 switch (c
->processor_id
& 0xff0000) {
901 case PRID_COMP_LEGACY
:
902 cpu_probe_legacy(c
, cpu
);
905 cpu_probe_mips(c
, cpu
);
907 case PRID_COMP_ALCHEMY
:
908 cpu_probe_alchemy(c
, cpu
);
910 case PRID_COMP_SIBYTE
:
911 cpu_probe_sibyte(c
, cpu
);
913 case PRID_COMP_BROADCOM
:
914 cpu_probe_broadcom(c
, cpu
);
916 case PRID_COMP_SANDCRAFT
:
917 cpu_probe_sandcraft(c
, cpu
);
920 cpu_probe_nxp(c
, cpu
);
922 case PRID_COMP_CAVIUM
:
923 cpu_probe_cavium(c
, cpu
);
927 BUG_ON(!__cpu_name
[cpu
]);
928 BUG_ON(c
->cputype
== CPU_UNKNOWN
);
931 * Platform code can force the cpu type to optimize code
932 * generation. In that case be sure the cpu type is correctly
933 * manually setup otherwise it could trigger some nasty bugs.
935 BUG_ON(current_cpu_type() != c
->cputype
);
937 if (c
->options
& MIPS_CPU_FPU
) {
938 c
->fpu_id
= cpu_get_fpu_id();
940 if (c
->isa_level
== MIPS_CPU_ISA_M32R1
||
941 c
->isa_level
== MIPS_CPU_ISA_M32R2
||
942 c
->isa_level
== MIPS_CPU_ISA_M64R1
||
943 c
->isa_level
== MIPS_CPU_ISA_M64R2
) {
944 if (c
->fpu_id
& MIPS_FPIR_3D
)
945 c
->ases
|= MIPS_ASE_MIPS3D
;
950 c
->srsets
= ((read_c0_srsctl() >> 26) & 0x0f) + 1;
955 __cpuinit
void cpu_report(void)
957 struct cpuinfo_mips
*c
= ¤t_cpu_data
;
959 printk(KERN_INFO
"CPU revision is: %08x (%s)\n",
960 c
->processor_id
, cpu_name_string());
961 if (c
->options
& MIPS_CPU_FPU
)
962 printk(KERN_INFO
"FPU revision is: %08x\n", c
->fpu_id
);