diff options
Diffstat (limited to 'arch/mips/kernel/cpu-probe.c')
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 7a51866068a4..be5bb16be4e0 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/stddef.h> | 18 | #include <linux/stddef.h> |
19 | #include <linux/module.h> | ||
19 | 20 | ||
20 | #include <asm/bugs.h> | 21 | #include <asm/bugs.h> |
21 | #include <asm/cpu.h> | 22 | #include <asm/cpu.h> |
@@ -32,6 +33,7 @@ | |||
32 | * the CPU very much. | 33 | * the CPU very much. |
33 | */ | 34 | */ |
34 | void (*cpu_wait)(void); | 35 | void (*cpu_wait)(void); |
36 | EXPORT_SYMBOL(cpu_wait); | ||
35 | 37 | ||
36 | static void r3081_wait(void) | 38 | static void r3081_wait(void) |
37 | { | 39 | { |
@@ -160,6 +162,7 @@ void __init check_wait(void) | |||
160 | case CPU_BCM6348: | 162 | case CPU_BCM6348: |
161 | case CPU_BCM6358: | 163 | case CPU_BCM6358: |
162 | case CPU_CAVIUM_OCTEON: | 164 | case CPU_CAVIUM_OCTEON: |
165 | case CPU_CAVIUM_OCTEON_PLUS: | ||
163 | cpu_wait = r4k_wait; | 166 | cpu_wait = r4k_wait; |
164 | break; | 167 | break; |
165 | 168 | ||
@@ -282,6 +285,15 @@ static inline int __cpu_has_fpu(void) | |||
282 | return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE); | 285 | return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE); |
283 | } | 286 | } |
284 | 287 | ||
288 | static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) | ||
289 | { | ||
290 | #ifdef __NEED_VMBITS_PROBE | ||
291 | write_c0_entryhi(0x3fffffffffffe000ULL); | ||
292 | back_to_back_c0_hazard(); | ||
293 | c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL); | ||
294 | #endif | ||
295 | } | ||
296 | |||
285 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ | 297 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ |
286 | | MIPS_CPU_COUNTER) | 298 | | MIPS_CPU_COUNTER) |
287 | 299 | ||
@@ -689,6 +701,19 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c) | |||
689 | return config3 & MIPS_CONF_M; | 701 | return config3 & MIPS_CONF_M; |
690 | } | 702 | } |
691 | 703 | ||
704 | static inline unsigned int decode_config4(struct cpuinfo_mips *c) | ||
705 | { | ||
706 | unsigned int config4; | ||
707 | |||
708 | config4 = read_c0_config4(); | ||
709 | |||
710 | if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT | ||
711 | && cpu_has_tlb) | ||
712 | c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; | ||
713 | |||
714 | return config4 & MIPS_CONF_M; | ||
715 | } | ||
716 | |||
692 | static void __cpuinit decode_configs(struct cpuinfo_mips *c) | 717 | static void __cpuinit decode_configs(struct cpuinfo_mips *c) |
693 | { | 718 | { |
694 | int ok; | 719 | int ok; |
@@ -707,6 +732,8 @@ static void __cpuinit decode_configs(struct cpuinfo_mips *c) | |||
707 | ok = decode_config2(c); | 732 | ok = decode_config2(c); |
708 | if (ok) | 733 | if (ok) |
709 | ok = decode_config3(c); | 734 | ok = decode_config3(c); |
735 | if (ok) | ||
736 | ok = decode_config4(c); | ||
710 | 737 | ||
711 | mips_probe_watch_registers(c); | 738 | mips_probe_watch_registers(c); |
712 | } | 739 | } |
@@ -720,9 +747,6 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) | |||
720 | __cpu_name[cpu] = "MIPS 4Kc"; | 747 | __cpu_name[cpu] = "MIPS 4Kc"; |
721 | break; | 748 | break; |
722 | case PRID_IMP_4KEC: | 749 | case PRID_IMP_4KEC: |
723 | c->cputype = CPU_4KEC; | ||
724 | __cpu_name[cpu] = "MIPS 4KEc"; | ||
725 | break; | ||
726 | case PRID_IMP_4KECR2: | 750 | case PRID_IMP_4KECR2: |
727 | c->cputype = CPU_4KEC; | 751 | c->cputype = CPU_4KEC; |
728 | __cpu_name[cpu] = "MIPS 4KEc"; | 752 | __cpu_name[cpu] = "MIPS 4KEc"; |
@@ -888,12 +912,18 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) | |||
888 | case PRID_IMP_CAVIUM_CN38XX: | 912 | case PRID_IMP_CAVIUM_CN38XX: |
889 | case PRID_IMP_CAVIUM_CN31XX: | 913 | case PRID_IMP_CAVIUM_CN31XX: |
890 | case PRID_IMP_CAVIUM_CN30XX: | 914 | case PRID_IMP_CAVIUM_CN30XX: |
915 | c->cputype = CPU_CAVIUM_OCTEON; | ||
916 | __cpu_name[cpu] = "Cavium Octeon"; | ||
917 | goto platform; | ||
891 | case PRID_IMP_CAVIUM_CN58XX: | 918 | case PRID_IMP_CAVIUM_CN58XX: |
892 | case PRID_IMP_CAVIUM_CN56XX: | 919 | case PRID_IMP_CAVIUM_CN56XX: |
893 | case PRID_IMP_CAVIUM_CN50XX: | 920 | case PRID_IMP_CAVIUM_CN50XX: |
894 | case PRID_IMP_CAVIUM_CN52XX: | 921 | case PRID_IMP_CAVIUM_CN52XX: |
895 | c->cputype = CPU_CAVIUM_OCTEON; | 922 | c->cputype = CPU_CAVIUM_OCTEON_PLUS; |
896 | __cpu_name[cpu] = "Cavium Octeon"; | 923 | __cpu_name[cpu] = "Cavium Octeon+"; |
924 | platform: | ||
925 | if (cpu == 0) | ||
926 | __elf_platform = "octeon"; | ||
897 | break; | 927 | break; |
898 | default: | 928 | default: |
899 | printk(KERN_INFO "Unknown Octeon chip!\n"); | 929 | printk(KERN_INFO "Unknown Octeon chip!\n"); |
@@ -903,6 +933,7 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) | |||
903 | } | 933 | } |
904 | 934 | ||
905 | const char *__cpu_name[NR_CPUS]; | 935 | const char *__cpu_name[NR_CPUS]; |
936 | const char *__elf_platform; | ||
906 | 937 | ||
907 | __cpuinit void cpu_probe(void) | 938 | __cpuinit void cpu_probe(void) |
908 | { | 939 | { |
@@ -967,6 +998,8 @@ __cpuinit void cpu_probe(void) | |||
967 | c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; | 998 | c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; |
968 | else | 999 | else |
969 | c->srsets = 1; | 1000 | c->srsets = 1; |
1001 | |||
1002 | cpu_probe_vmbits(c); | ||
970 | } | 1003 | } |
971 | 1004 | ||
972 | __cpuinit void cpu_report(void) | 1005 | __cpuinit void cpu_report(void) |