diff options
Diffstat (limited to 'arch/mips/kernel/cpu-probe.c')
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 74 |
1 files changed, 62 insertions, 12 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 530f832de02c..6e8fb85ce7c3 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <asm/cpu-type.h> | 23 | #include <asm/cpu-type.h> |
24 | #include <asm/fpu.h> | 24 | #include <asm/fpu.h> |
25 | #include <asm/mipsregs.h> | 25 | #include <asm/mipsregs.h> |
26 | #include <asm/mipsmtregs.h> | ||
27 | #include <asm/msa.h> | ||
26 | #include <asm/watch.h> | 28 | #include <asm/watch.h> |
27 | #include <asm/elf.h> | 29 | #include <asm/elf.h> |
28 | #include <asm/spram.h> | 30 | #include <asm/spram.h> |
@@ -126,6 +128,20 @@ static inline int __cpu_has_fpu(void) | |||
126 | return ((cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE); | 128 | return ((cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE); |
127 | } | 129 | } |
128 | 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 | |||
129 | static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) | 145 | static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) |
130 | { | 146 | { |
131 | #ifdef __NEED_VMBITS_PROBE | 147 | #ifdef __NEED_VMBITS_PROBE |
@@ -166,11 +182,12 @@ static char unknown_isa[] = KERN_ERR \ | |||
166 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) | 182 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) |
167 | { | 183 | { |
168 | unsigned int config6; | 184 | unsigned int config6; |
169 | /* | 185 | |
170 | * Config6 is implementation dependent and it's currently only | 186 | /* It's implementation dependent how the FTLB can be enabled */ |
171 | * used by proAptiv | 187 | switch (c->cputype) { |
172 | */ | 188 | case CPU_PROAPTIV: |
173 | if (c->cputype == CPU_PROAPTIV) { | 189 | case CPU_P5600: |
190 | /* proAptiv & related cores use Config6 to enable the FTLB */ | ||
174 | config6 = read_c0_config6(); | 191 | config6 = read_c0_config6(); |
175 | if (enable) | 192 | if (enable) |
176 | /* Enable FTLB */ | 193 | /* Enable FTLB */ |
@@ -179,6 +196,7 @@ static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) | |||
179 | /* Disable FTLB */ | 196 | /* Disable FTLB */ |
180 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); | 197 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); |
181 | back_to_back_c0_hazard(); | 198 | back_to_back_c0_hazard(); |
199 | break; | ||
182 | } | 200 | } |
183 | } | 201 | } |
184 | 202 | ||
@@ -301,6 +319,8 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c) | |||
301 | c->ases |= MIPS_ASE_VZ; | 319 | c->ases |= MIPS_ASE_VZ; |
302 | if (config3 & MIPS_CONF3_SC) | 320 | if (config3 & MIPS_CONF3_SC) |
303 | c->options |= MIPS_CPU_SEGMENTS; | 321 | c->options |= MIPS_CPU_SEGMENTS; |
322 | if (config3 & MIPS_CONF3_MSA) | ||
323 | c->ases |= MIPS_ASE_MSA; | ||
304 | 324 | ||
305 | return config3 & MIPS_CONF_M; | 325 | return config3 & MIPS_CONF_M; |
306 | } | 326 | } |
@@ -367,6 +387,9 @@ static inline unsigned int decode_config5(struct cpuinfo_mips *c) | |||
367 | config5 &= ~MIPS_CONF5_UFR; | 387 | config5 &= ~MIPS_CONF5_UFR; |
368 | write_c0_config5(config5); | 388 | write_c0_config5(config5); |
369 | 389 | ||
390 | if (config5 & MIPS_CONF5_EVA) | ||
391 | c->options |= MIPS_CPU_EVA; | ||
392 | |||
370 | return config5 & MIPS_CONF_M; | 393 | return config5 & MIPS_CONF_M; |
371 | } | 394 | } |
372 | 395 | ||
@@ -398,8 +421,13 @@ static void decode_configs(struct cpuinfo_mips *c) | |||
398 | 421 | ||
399 | mips_probe_watch_registers(c); | 422 | mips_probe_watch_registers(c); |
400 | 423 | ||
401 | if (cpu_has_mips_r2) | 424 | #ifndef CONFIG_MIPS_CPS |
425 | if (cpu_has_mips_r2) { | ||
402 | c->core = read_c0_ebase() & 0x3ff; | 426 | c->core = read_c0_ebase() & 0x3ff; |
427 | if (cpu_has_mipsmt) | ||
428 | c->core >>= fls(core_nvpes()) - 1; | ||
429 | } | ||
430 | #endif | ||
403 | } | 431 | } |
404 | 432 | ||
405 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ | 433 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ |
@@ -710,17 +738,23 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
710 | MIPS_CPU_LLSC; | 738 | MIPS_CPU_LLSC; |
711 | c->tlbsize = 64; | 739 | c->tlbsize = 64; |
712 | break; | 740 | break; |
713 | case PRID_IMP_LOONGSON2: | 741 | case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ |
714 | c->cputype = CPU_LOONGSON2; | ||
715 | __cpu_name[cpu] = "ICT Loongson-2"; | ||
716 | |||
717 | switch (c->processor_id & PRID_REV_MASK) { | 742 | switch (c->processor_id & PRID_REV_MASK) { |
718 | case PRID_REV_LOONGSON2E: | 743 | case PRID_REV_LOONGSON2E: |
744 | c->cputype = CPU_LOONGSON2; | ||
745 | __cpu_name[cpu] = "ICT Loongson-2"; | ||
719 | set_elf_platform(cpu, "loongson2e"); | 746 | set_elf_platform(cpu, "loongson2e"); |
720 | break; | 747 | break; |
721 | case PRID_REV_LOONGSON2F: | 748 | case PRID_REV_LOONGSON2F: |
749 | c->cputype = CPU_LOONGSON2; | ||
750 | __cpu_name[cpu] = "ICT Loongson-2"; | ||
722 | set_elf_platform(cpu, "loongson2f"); | 751 | set_elf_platform(cpu, "loongson2f"); |
723 | break; | 752 | break; |
753 | case PRID_REV_LOONGSON3A: | ||
754 | c->cputype = CPU_LOONGSON3; | ||
755 | __cpu_name[cpu] = "ICT Loongson-3"; | ||
756 | set_elf_platform(cpu, "loongson3a"); | ||
757 | break; | ||
724 | } | 758 | } |
725 | 759 | ||
726 | set_isa(c, MIPS_CPU_ISA_III); | 760 | set_isa(c, MIPS_CPU_ISA_III); |
@@ -729,7 +763,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
729 | MIPS_CPU_32FPR; | 763 | MIPS_CPU_32FPR; |
730 | c->tlbsize = 64; | 764 | c->tlbsize = 64; |
731 | break; | 765 | break; |
732 | case PRID_IMP_LOONGSON1: | 766 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ |
733 | decode_configs(c); | 767 | decode_configs(c); |
734 | 768 | ||
735 | c->cputype = CPU_LOONGSON1; | 769 | c->cputype = CPU_LOONGSON1; |
@@ -806,7 +840,7 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) | |||
806 | __cpu_name[cpu] = "MIPS 1004Kc"; | 840 | __cpu_name[cpu] = "MIPS 1004Kc"; |
807 | break; | 841 | break; |
808 | case PRID_IMP_1074K: | 842 | case PRID_IMP_1074K: |
809 | c->cputype = CPU_74K; | 843 | c->cputype = CPU_1074K; |
810 | __cpu_name[cpu] = "MIPS 1074Kc"; | 844 | __cpu_name[cpu] = "MIPS 1074Kc"; |
811 | break; | 845 | break; |
812 | case PRID_IMP_INTERAPTIV_UP: | 846 | case PRID_IMP_INTERAPTIV_UP: |
@@ -825,6 +859,14 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) | |||
825 | c->cputype = CPU_PROAPTIV; | 859 | c->cputype = CPU_PROAPTIV; |
826 | __cpu_name[cpu] = "MIPS proAptiv (multi)"; | 860 | __cpu_name[cpu] = "MIPS proAptiv (multi)"; |
827 | break; | 861 | break; |
862 | case PRID_IMP_P5600: | ||
863 | c->cputype = CPU_P5600; | ||
864 | __cpu_name[cpu] = "MIPS P5600"; | ||
865 | break; | ||
866 | case PRID_IMP_M5150: | ||
867 | c->cputype = CPU_M5150; | ||
868 | __cpu_name[cpu] = "MIPS M5150"; | ||
869 | break; | ||
828 | } | 870 | } |
829 | 871 | ||
830 | decode_configs(c); | 872 | decode_configs(c); |
@@ -1176,6 +1218,12 @@ void cpu_probe(void) | |||
1176 | else | 1218 | else |
1177 | c->srsets = 1; | 1219 | c->srsets = 1; |
1178 | 1220 | ||
1221 | if (cpu_has_msa) { | ||
1222 | c->msa_id = cpu_get_msa_id(); | ||
1223 | WARN(c->msa_id & MSA_IR_WRPF, | ||
1224 | "Vector register partitioning unimplemented!"); | ||
1225 | } | ||
1226 | |||
1179 | cpu_probe_vmbits(c); | 1227 | cpu_probe_vmbits(c); |
1180 | 1228 | ||
1181 | #ifdef CONFIG_64BIT | 1229 | #ifdef CONFIG_64BIT |
@@ -1192,4 +1240,6 @@ void cpu_report(void) | |||
1192 | smp_processor_id(), c->processor_id, cpu_name_string()); | 1240 | smp_processor_id(), c->processor_id, cpu_name_string()); |
1193 | if (c->options & MIPS_CPU_FPU) | 1241 | if (c->options & MIPS_CPU_FPU) |
1194 | printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id); | 1242 | printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id); |
1243 | if (cpu_has_msa) | ||
1244 | pr_info("MSA revision is: %08x\n", c->msa_id); | ||
1195 | } | 1245 | } |