aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-12-08 09:04:24 -0500
committer <ralf@denk.linux-mips.net>2006-01-10 08:39:06 -0500
commitb4672d37293cb045ec4d57e8b76a62810c96da71 (patch)
tree21ba827850d7bc7c36d7009575b979d12b35227c /arch
parente7958bb90d57f0da073cbd031a1808de51d1de15 (diff)
MIPS: Introduce machinery for testing for MIPSxxR1/2.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/kernel/cpu-probe.c35
-rw-r--r--arch/mips/kernel/time.c6
2 files changed, 33 insertions, 8 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index d00f8768e2a0..fac48ad27b34 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -435,6 +435,9 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
435 } 435 }
436} 436}
437 437
438static char unknown_isa[] __initdata = KERN_ERR \
439 "Unsupported ISA type, c0.config0: %d.";
440
438static inline unsigned int decode_config0(struct cpuinfo_mips *c) 441static inline unsigned int decode_config0(struct cpuinfo_mips *c)
439{ 442{
440 unsigned int config0; 443 unsigned int config0;
@@ -447,16 +450,37 @@ static inline unsigned int decode_config0(struct cpuinfo_mips *c)
447 isa = (config0 & MIPS_CONF_AT) >> 13; 450 isa = (config0 & MIPS_CONF_AT) >> 13;
448 switch (isa) { 451 switch (isa) {
449 case 0: 452 case 0:
450 c->isa_level = MIPS_CPU_ISA_M32R1; 453 switch ((config0 >> 10) & 7) {
454 case 0:
455 c->isa_level = MIPS_CPU_ISA_M32R1;
456 break;
457 case 1:
458 c->isa_level = MIPS_CPU_ISA_M32R2;
459 break;
460 default:
461 goto unknown;
462 }
451 break; 463 break;
452 case 2: 464 case 2:
453 c->isa_level = MIPS_CPU_ISA_M64R1; 465 switch ((config0 >> 10) & 7) {
466 case 0:
467 c->isa_level = MIPS_CPU_ISA_M64R1;
468 break;
469 case 1:
470 c->isa_level = MIPS_CPU_ISA_M64R2;
471 break;
472 default:
473 goto unknown;
474 }
454 break; 475 break;
455 default: 476 default:
456 panic("Unsupported ISA type, cp0.config0.at: %d.", isa); 477 goto unknown;
457 } 478 }
458 479
459 return config0 & MIPS_CONF_M; 480 return config0 & MIPS_CONF_M;
481
482unknown:
483 panic(unknown_isa, config0);
460} 484}
461 485
462static inline unsigned int decode_config1(struct cpuinfo_mips *c) 486static inline unsigned int decode_config1(struct cpuinfo_mips *c)
@@ -568,7 +592,6 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c)
568 break; 592 break;
569 case PRID_IMP_34K: 593 case PRID_IMP_34K:
570 c->cputype = CPU_34K; 594 c->cputype = CPU_34K;
571 c->isa_level = MIPS_CPU_ISA_M32R1;
572 break; 595 break;
573 } 596 }
574} 597}
@@ -691,7 +714,9 @@ __init void cpu_probe(void)
691 c->fpu_id = cpu_get_fpu_id(); 714 c->fpu_id = cpu_get_fpu_id();
692 715
693 if (c->isa_level == MIPS_CPU_ISA_M32R1 || 716 if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
694 c->isa_level == MIPS_CPU_ISA_M64R1) { 717 c->isa_level == MIPS_CPU_ISA_M32R2 ||
718 c->isa_level == MIPS_CPU_ISA_M64R1 ||
719 c->isa_level == MIPS_CPU_ISA_M64R2) {
695 if (c->fpu_id & MIPS_FPIR_3D) 720 if (c->fpu_id & MIPS_FPIR_3D)
696 c->ases |= MIPS_ASE_MIPS3D; 721 c->ases |= MIPS_ASE_MIPS3D;
697 } 722 }
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 174959bf1d59..07e125c027b2 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -628,9 +628,9 @@ void __init time_init(void)
628 mips_hpt_init = c0_hpt_init; 628 mips_hpt_init = c0_hpt_init;
629 } 629 }
630 630
631 if ((current_cpu_data.isa_level == MIPS_CPU_ISA_M32R1) || 631 if (cpu_has_mips32r1 || cpu_has_mips32r2 ||
632 (current_cpu_data.isa_level == MIPS_CPU_ISA_I) || 632 (current_cpu_data.isa_level == MIPS_CPU_ISA_I) ||
633 (current_cpu_data.isa_level == MIPS_CPU_ISA_II)) 633 (current_cpu_data.isa_level == MIPS_CPU_ISA_II))
634 /* 634 /*
635 * We need to calibrate the counter but we don't have 635 * We need to calibrate the counter but we don't have
636 * 64-bit division. 636 * 64-bit division.