Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Processor capabilities determination functions. |
| 3 | * |
| 4 | * Copyright (C) xxxx the Anonymous |
Ralf Baechle | 010b853 | 2006-01-29 18:42:08 +0000 | [diff] [blame] | 5 | * Copyright (C) 1994 - 2006 Ralf Baechle |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 6 | * Copyright (C) 2003, 2004 Maciej W. Rozycki |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 7 | * Copyright (C) 2001, 2004, 2011, 2012 MIPS Technologies, Inc. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * |
| 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. |
| 13 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/init.h> |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/ptrace.h> |
Ralf Baechle | 631330f | 2009-06-19 14:05:26 +0100 | [diff] [blame] | 17 | #include <linux/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/stddef.h> |
Paul Gortmaker | 73bc256 | 2011-07-23 16:30:40 -0400 | [diff] [blame] | 19 | #include <linux/export.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Ralf Baechle | 5759906 | 2007-02-18 19:07:31 +0000 | [diff] [blame] | 21 | #include <asm/bugs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <asm/cpu.h> |
Ralf Baechle | 69f24d1 | 2013-09-17 10:25:47 +0200 | [diff] [blame] | 23 | #include <asm/cpu-type.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <asm/fpu.h> |
| 25 | #include <asm/mipsregs.h> |
Paul Burton | 30ee615 | 2014-03-27 10:57:30 +0000 | [diff] [blame] | 26 | #include <asm/mipsmtregs.h> |
Paul Burton | a5e9a69 | 2014-01-27 15:23:10 +0000 | [diff] [blame] | 27 | #include <asm/msa.h> |
David Daney | 654f57b | 2008-09-23 00:07:16 -0700 | [diff] [blame] | 28 | #include <asm/watch.h> |
Paul Gortmaker | 06372a6 | 2011-07-23 16:26:41 -0400 | [diff] [blame] | 29 | #include <asm/elf.h> |
Chris Dearman | a074f0e | 2009-07-10 01:51:27 -0700 | [diff] [blame] | 30 | #include <asm/spram.h> |
David Daney | 949e51b | 2010-10-14 11:32:33 -0700 | [diff] [blame] | 31 | #include <asm/uaccess.h> |
| 32 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 33 | static int mips_fpu_disabled; |
Kevin Cernekee | 0103d23 | 2010-05-02 14:43:52 -0700 | [diff] [blame] | 34 | |
| 35 | static int __init fpu_disable(char *s) |
| 36 | { |
| 37 | cpu_data[0].options &= ~MIPS_CPU_FPU; |
| 38 | mips_fpu_disabled = 1; |
| 39 | |
| 40 | return 1; |
| 41 | } |
| 42 | |
| 43 | __setup("nofpu", fpu_disable); |
| 44 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 45 | int mips_dsp_disabled; |
Kevin Cernekee | 0103d23 | 2010-05-02 14:43:52 -0700 | [diff] [blame] | 46 | |
| 47 | static int __init dsp_disable(char *s) |
| 48 | { |
Steven J. Hill | ee80f7c7 | 2012-08-03 10:26:04 -0500 | [diff] [blame] | 49 | cpu_data[0].ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P); |
Kevin Cernekee | 0103d23 | 2010-05-02 14:43:52 -0700 | [diff] [blame] | 50 | mips_dsp_disabled = 1; |
| 51 | |
| 52 | return 1; |
| 53 | } |
| 54 | |
| 55 | __setup("nodsp", dsp_disable); |
| 56 | |
Marc St-Jean | 9267a30 | 2007-06-14 15:55:31 -0600 | [diff] [blame] | 57 | static inline void check_errata(void) |
| 58 | { |
| 59 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| 60 | |
Ralf Baechle | 69f24d1 | 2013-09-17 10:25:47 +0200 | [diff] [blame] | 61 | switch (current_cpu_type()) { |
Marc St-Jean | 9267a30 | 2007-06-14 15:55:31 -0600 | [diff] [blame] | 62 | case CPU_34K: |
| 63 | /* |
| 64 | * Erratum "RPS May Cause Incorrect Instruction Execution" |
Ralf Baechle | b633648c5 | 2014-05-23 16:29:44 +0200 | [diff] [blame] | 65 | * This code only handles VPE0, any SMP/RTOS code |
Marc St-Jean | 9267a30 | 2007-06-14 15:55:31 -0600 | [diff] [blame] | 66 | * making use of VPE1 will be responsable for that VPE. |
| 67 | */ |
| 68 | if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2) |
| 69 | write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS); |
| 70 | break; |
| 71 | default: |
| 72 | break; |
| 73 | } |
| 74 | } |
| 75 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | void __init check_bugs32(void) |
| 77 | { |
Marc St-Jean | 9267a30 | 2007-06-14 15:55:31 -0600 | [diff] [blame] | 78 | check_errata(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | /* |
| 82 | * Probe whether cpu has config register by trying to play with |
| 83 | * alternate cache bit and see whether it matters. |
| 84 | * It's used by cpu_probe to distinguish between R3000A and R3081. |
| 85 | */ |
| 86 | static inline int cpu_has_confreg(void) |
| 87 | { |
| 88 | #ifdef CONFIG_CPU_R3000 |
| 89 | extern unsigned long r3k_cache_size(unsigned long); |
| 90 | unsigned long size1, size2; |
| 91 | unsigned long cfg = read_c0_conf(); |
| 92 | |
| 93 | size1 = r3k_cache_size(ST0_ISC); |
| 94 | write_c0_conf(cfg ^ R30XX_CONF_AC); |
| 95 | size2 = r3k_cache_size(ST0_ISC); |
| 96 | write_c0_conf(cfg); |
| 97 | return size1 != size2; |
| 98 | #else |
| 99 | return 0; |
| 100 | #endif |
| 101 | } |
| 102 | |
Robert Millan | c094c99 | 2011-04-18 11:37:55 -0700 | [diff] [blame] | 103 | static inline void set_elf_platform(int cpu, const char *plat) |
| 104 | { |
| 105 | if (cpu == 0) |
| 106 | __elf_platform = plat; |
| 107 | } |
| 108 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | /* |
| 110 | * Get the FPU Implementation/Revision. |
| 111 | */ |
| 112 | static inline unsigned long cpu_get_fpu_id(void) |
| 113 | { |
| 114 | unsigned long tmp, fpu_id; |
| 115 | |
| 116 | tmp = read_c0_status(); |
Paul Burton | 597ce17 | 2013-11-22 13:12:07 +0000 | [diff] [blame] | 117 | __enable_fpu(FPU_AS_IS); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | fpu_id = read_32bit_cp1_register(CP1_REVISION); |
| 119 | write_c0_status(tmp); |
| 120 | return fpu_id; |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | * Check the CPU has an FPU the official way. |
| 125 | */ |
| 126 | static inline int __cpu_has_fpu(void) |
| 127 | { |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 128 | return ((cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | } |
| 130 | |
Paul Burton | a5e9a69 | 2014-01-27 15:23:10 +0000 | [diff] [blame] | 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 | |
Guenter Roeck | 91dfc42 | 2010-02-02 08:52:20 -0800 | [diff] [blame] | 145 | static inline void cpu_probe_vmbits(struct cpuinfo_mips *c) |
| 146 | { |
| 147 | #ifdef __NEED_VMBITS_PROBE |
David Daney | 5b7efa8 | 2010-02-08 12:27:00 -0800 | [diff] [blame] | 148 | write_c0_entryhi(0x3fffffffffffe000ULL); |
Guenter Roeck | 91dfc42 | 2010-02-02 08:52:20 -0800 | [diff] [blame] | 149 | back_to_back_c0_hazard(); |
David Daney | 5b7efa8 | 2010-02-08 12:27:00 -0800 | [diff] [blame] | 150 | c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL); |
Guenter Roeck | 91dfc42 | 2010-02-02 08:52:20 -0800 | [diff] [blame] | 151 | #endif |
| 152 | } |
| 153 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 154 | static void set_isa(struct cpuinfo_mips *c, unsigned int isa) |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 155 | { |
| 156 | switch (isa) { |
| 157 | case MIPS_CPU_ISA_M64R2: |
| 158 | c->isa_level |= MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2; |
| 159 | case MIPS_CPU_ISA_M64R1: |
| 160 | c->isa_level |= MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1; |
| 161 | case MIPS_CPU_ISA_V: |
| 162 | c->isa_level |= MIPS_CPU_ISA_V; |
| 163 | case MIPS_CPU_ISA_IV: |
| 164 | c->isa_level |= MIPS_CPU_ISA_IV; |
| 165 | case MIPS_CPU_ISA_III: |
Ralf Baechle | 1990e54 | 2013-06-26 17:06:34 +0200 | [diff] [blame] | 166 | c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 167 | break; |
| 168 | |
| 169 | case MIPS_CPU_ISA_M32R2: |
| 170 | c->isa_level |= MIPS_CPU_ISA_M32R2; |
| 171 | case MIPS_CPU_ISA_M32R1: |
| 172 | c->isa_level |= MIPS_CPU_ISA_M32R1; |
| 173 | case MIPS_CPU_ISA_II: |
| 174 | c->isa_level |= MIPS_CPU_ISA_II; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 175 | break; |
| 176 | } |
| 177 | } |
| 178 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 179 | static char unknown_isa[] = KERN_ERR \ |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 180 | "Unsupported ISA type, c0.config0: %d."; |
| 181 | |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 182 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) |
| 183 | { |
| 184 | unsigned int config6; |
James Hogan | d83b0e8 | 2014-01-22 16:19:40 +0000 | [diff] [blame] | 185 | |
| 186 | /* It's implementation dependent how the FTLB can be enabled */ |
| 187 | switch (c->cputype) { |
| 188 | case CPU_PROAPTIV: |
| 189 | case CPU_P5600: |
| 190 | /* proAptiv & related cores use Config6 to enable the FTLB */ |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 191 | config6 = read_c0_config6(); |
| 192 | if (enable) |
| 193 | /* Enable FTLB */ |
| 194 | write_c0_config6(config6 | MIPS_CONF6_FTLBEN); |
| 195 | else |
| 196 | /* Disable FTLB */ |
| 197 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); |
| 198 | back_to_back_c0_hazard(); |
James Hogan | d83b0e8 | 2014-01-22 16:19:40 +0000 | [diff] [blame] | 199 | break; |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 200 | } |
| 201 | } |
| 202 | |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 203 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) |
| 204 | { |
| 205 | unsigned int config0; |
| 206 | int isa; |
| 207 | |
| 208 | config0 = read_c0_config(); |
| 209 | |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 210 | /* |
| 211 | * Look for Standard TLB or Dual VTLB and FTLB |
| 212 | */ |
| 213 | if ((((config0 & MIPS_CONF_MT) >> 7) == 1) || |
| 214 | (((config0 & MIPS_CONF_MT) >> 7) == 4)) |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 215 | c->options |= MIPS_CPU_TLB; |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 216 | |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 217 | isa = (config0 & MIPS_CONF_AT) >> 13; |
| 218 | switch (isa) { |
| 219 | case 0: |
| 220 | switch ((config0 & MIPS_CONF_AR) >> 10) { |
| 221 | case 0: |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 222 | set_isa(c, MIPS_CPU_ISA_M32R1); |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 223 | break; |
| 224 | case 1: |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 225 | set_isa(c, MIPS_CPU_ISA_M32R2); |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 226 | break; |
| 227 | default: |
| 228 | goto unknown; |
| 229 | } |
| 230 | break; |
| 231 | case 2: |
| 232 | switch ((config0 & MIPS_CONF_AR) >> 10) { |
| 233 | case 0: |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 234 | set_isa(c, MIPS_CPU_ISA_M64R1); |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 235 | break; |
| 236 | case 1: |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 237 | set_isa(c, MIPS_CPU_ISA_M64R2); |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 238 | break; |
| 239 | default: |
| 240 | goto unknown; |
| 241 | } |
| 242 | break; |
| 243 | default: |
| 244 | goto unknown; |
| 245 | } |
| 246 | |
| 247 | return config0 & MIPS_CONF_M; |
| 248 | |
| 249 | unknown: |
| 250 | panic(unknown_isa, config0); |
| 251 | } |
| 252 | |
| 253 | static inline unsigned int decode_config1(struct cpuinfo_mips *c) |
| 254 | { |
| 255 | unsigned int config1; |
| 256 | |
| 257 | config1 = read_c0_config1(); |
| 258 | |
| 259 | if (config1 & MIPS_CONF1_MD) |
| 260 | c->ases |= MIPS_ASE_MDMX; |
| 261 | if (config1 & MIPS_CONF1_WR) |
| 262 | c->options |= MIPS_CPU_WATCH; |
| 263 | if (config1 & MIPS_CONF1_CA) |
| 264 | c->ases |= MIPS_ASE_MIPS16; |
| 265 | if (config1 & MIPS_CONF1_EP) |
| 266 | c->options |= MIPS_CPU_EJTAG; |
| 267 | if (config1 & MIPS_CONF1_FP) { |
| 268 | c->options |= MIPS_CPU_FPU; |
| 269 | c->options |= MIPS_CPU_32FPR; |
| 270 | } |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 271 | if (cpu_has_tlb) { |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 272 | c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 273 | c->tlbsizevtlb = c->tlbsize; |
| 274 | c->tlbsizeftlbsets = 0; |
| 275 | } |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 276 | |
| 277 | return config1 & MIPS_CONF_M; |
| 278 | } |
| 279 | |
| 280 | static inline unsigned int decode_config2(struct cpuinfo_mips *c) |
| 281 | { |
| 282 | unsigned int config2; |
| 283 | |
| 284 | config2 = read_c0_config2(); |
| 285 | |
| 286 | if (config2 & MIPS_CONF2_SL) |
| 287 | c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; |
| 288 | |
| 289 | return config2 & MIPS_CONF_M; |
| 290 | } |
| 291 | |
| 292 | static inline unsigned int decode_config3(struct cpuinfo_mips *c) |
| 293 | { |
| 294 | unsigned int config3; |
| 295 | |
| 296 | config3 = read_c0_config3(); |
| 297 | |
Steven J. Hill | b2ab4f0 | 2012-09-13 16:47:58 -0500 | [diff] [blame] | 298 | if (config3 & MIPS_CONF3_SM) { |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 299 | c->ases |= MIPS_ASE_SMARTMIPS; |
Steven J. Hill | b2ab4f0 | 2012-09-13 16:47:58 -0500 | [diff] [blame] | 300 | c->options |= MIPS_CPU_RIXI; |
| 301 | } |
| 302 | if (config3 & MIPS_CONF3_RXI) |
| 303 | c->options |= MIPS_CPU_RIXI; |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 304 | if (config3 & MIPS_CONF3_DSP) |
| 305 | c->ases |= MIPS_ASE_DSP; |
Steven J. Hill | ee80f7c7 | 2012-08-03 10:26:04 -0500 | [diff] [blame] | 306 | if (config3 & MIPS_CONF3_DSP2P) |
| 307 | c->ases |= MIPS_ASE_DSP2P; |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 308 | if (config3 & MIPS_CONF3_VINT) |
| 309 | c->options |= MIPS_CPU_VINT; |
| 310 | if (config3 & MIPS_CONF3_VEIC) |
| 311 | c->options |= MIPS_CPU_VEIC; |
| 312 | if (config3 & MIPS_CONF3_MT) |
| 313 | c->ases |= MIPS_ASE_MIPSMT; |
| 314 | if (config3 & MIPS_CONF3_ULRI) |
| 315 | c->options |= MIPS_CPU_ULRI; |
Steven J. Hill | f8fa481 | 2012-12-07 03:51:35 +0000 | [diff] [blame] | 316 | if (config3 & MIPS_CONF3_ISA) |
| 317 | c->options |= MIPS_CPU_MICROMIPS; |
David Daney | 1e7decd | 2013-02-16 23:42:43 +0100 | [diff] [blame] | 318 | if (config3 & MIPS_CONF3_VZ) |
| 319 | c->ases |= MIPS_ASE_VZ; |
Steven J. Hill | 4a0156f | 2013-11-14 16:12:24 +0000 | [diff] [blame] | 320 | if (config3 & MIPS_CONF3_SC) |
| 321 | c->options |= MIPS_CPU_SEGMENTS; |
Paul Burton | a5e9a69 | 2014-01-27 15:23:10 +0000 | [diff] [blame] | 322 | if (config3 & MIPS_CONF3_MSA) |
| 323 | c->ases |= MIPS_ASE_MSA; |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 324 | |
| 325 | return config3 & MIPS_CONF_M; |
| 326 | } |
| 327 | |
| 328 | static inline unsigned int decode_config4(struct cpuinfo_mips *c) |
| 329 | { |
| 330 | unsigned int config4; |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 331 | unsigned int newcf4; |
| 332 | unsigned int mmuextdef; |
| 333 | unsigned int ftlb_page = MIPS_CONF4_FTLBPAGESIZE; |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 334 | |
| 335 | config4 = read_c0_config4(); |
| 336 | |
Leonid Yegoshin | 1745c1e | 2013-11-14 16:12:23 +0000 | [diff] [blame] | 337 | if (cpu_has_tlb) { |
| 338 | if (((config4 & MIPS_CONF4_IE) >> 29) == 2) |
| 339 | c->options |= MIPS_CPU_TLBINV; |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 340 | mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF; |
| 341 | switch (mmuextdef) { |
| 342 | case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT: |
| 343 | c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; |
| 344 | c->tlbsizevtlb = c->tlbsize; |
| 345 | break; |
| 346 | case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT: |
| 347 | c->tlbsizevtlb += |
| 348 | ((config4 & MIPS_CONF4_VTLBSIZEEXT) >> |
| 349 | MIPS_CONF4_VTLBSIZEEXT_SHIFT) * 0x40; |
| 350 | c->tlbsize = c->tlbsizevtlb; |
| 351 | ftlb_page = MIPS_CONF4_VFTLBPAGESIZE; |
| 352 | /* fall through */ |
| 353 | case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT: |
| 354 | newcf4 = (config4 & ~ftlb_page) | |
| 355 | (page_size_ftlb(mmuextdef) << |
| 356 | MIPS_CONF4_FTLBPAGESIZE_SHIFT); |
| 357 | write_c0_config4(newcf4); |
| 358 | back_to_back_c0_hazard(); |
| 359 | config4 = read_c0_config4(); |
| 360 | if (config4 != newcf4) { |
| 361 | pr_err("PAGE_SIZE 0x%lx is not supported by FTLB (config4=0x%x)\n", |
| 362 | PAGE_SIZE, config4); |
| 363 | /* Switch FTLB off */ |
| 364 | set_ftlb_enable(c, 0); |
| 365 | break; |
| 366 | } |
| 367 | c->tlbsizeftlbsets = 1 << |
| 368 | ((config4 & MIPS_CONF4_FTLBSETS) >> |
| 369 | MIPS_CONF4_FTLBSETS_SHIFT); |
| 370 | c->tlbsizeftlbways = ((config4 & MIPS_CONF4_FTLBWAYS) >> |
| 371 | MIPS_CONF4_FTLBWAYS_SHIFT) + 2; |
| 372 | c->tlbsize += c->tlbsizeftlbways * c->tlbsizeftlbsets; |
| 373 | break; |
| 374 | } |
Leonid Yegoshin | 1745c1e | 2013-11-14 16:12:23 +0000 | [diff] [blame] | 375 | } |
| 376 | |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 377 | c->kscratch_mask = (config4 >> 16) & 0xff; |
| 378 | |
| 379 | return config4 & MIPS_CONF_M; |
| 380 | } |
| 381 | |
Ralf Baechle | 8b8a7634 | 2013-09-19 11:15:49 +0200 | [diff] [blame] | 382 | static inline unsigned int decode_config5(struct cpuinfo_mips *c) |
| 383 | { |
| 384 | unsigned int config5; |
| 385 | |
| 386 | config5 = read_c0_config5(); |
| 387 | config5 &= ~MIPS_CONF5_UFR; |
| 388 | write_c0_config5(config5); |
| 389 | |
Markos Chandras | 4901674 | 2014-01-09 16:04:51 +0000 | [diff] [blame] | 390 | if (config5 & MIPS_CONF5_EVA) |
| 391 | c->options |= MIPS_CPU_EVA; |
| 392 | |
Ralf Baechle | 8b8a7634 | 2013-09-19 11:15:49 +0200 | [diff] [blame] | 393 | return config5 & MIPS_CONF_M; |
| 394 | } |
| 395 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 396 | static void decode_configs(struct cpuinfo_mips *c) |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 397 | { |
| 398 | int ok; |
| 399 | |
| 400 | /* MIPS32 or MIPS64 compliant CPU. */ |
| 401 | c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | |
| 402 | MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; |
| 403 | |
| 404 | c->scache.flags = MIPS_CACHE_NOT_PRESENT; |
| 405 | |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 406 | /* Enable FTLB if present */ |
| 407 | set_ftlb_enable(c, 1); |
| 408 | |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 409 | ok = decode_config0(c); /* Read Config registers. */ |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 410 | BUG_ON(!ok); /* Arch spec violation! */ |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 411 | if (ok) |
| 412 | ok = decode_config1(c); |
| 413 | if (ok) |
| 414 | ok = decode_config2(c); |
| 415 | if (ok) |
| 416 | ok = decode_config3(c); |
| 417 | if (ok) |
| 418 | ok = decode_config4(c); |
Ralf Baechle | 8b8a7634 | 2013-09-19 11:15:49 +0200 | [diff] [blame] | 419 | if (ok) |
| 420 | ok = decode_config5(c); |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 421 | |
| 422 | mips_probe_watch_registers(c); |
| 423 | |
Paul Burton | 0ee958e | 2014-01-15 10:31:53 +0000 | [diff] [blame] | 424 | #ifndef CONFIG_MIPS_CPS |
Paul Burton | 30ee615 | 2014-03-27 10:57:30 +0000 | [diff] [blame] | 425 | if (cpu_has_mips_r2) { |
David Daney | 45b585c | 2014-05-28 23:52:10 +0200 | [diff] [blame] | 426 | c->core = get_ebase_cpunum(); |
Paul Burton | 30ee615 | 2014-03-27 10:57:30 +0000 | [diff] [blame] | 427 | if (cpu_has_mipsmt) |
| 428 | c->core >>= fls(core_nvpes()) - 1; |
| 429 | } |
Paul Burton | 0ee958e | 2014-01-15 10:31:53 +0000 | [diff] [blame] | 430 | #endif |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 431 | } |
| 432 | |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 433 | #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | | MIPS_CPU_COUNTER) |
| 435 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 436 | static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | { |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 438 | switch (c->processor_id & PRID_IMP_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | case PRID_IMP_R2000: |
| 440 | c->cputype = CPU_R2000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 441 | __cpu_name[cpu] = "R2000"; |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 442 | c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 443 | MIPS_CPU_NOFPUEX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | if (__cpu_has_fpu()) |
| 445 | c->options |= MIPS_CPU_FPU; |
| 446 | c->tlbsize = 64; |
| 447 | break; |
| 448 | case PRID_IMP_R3000: |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 449 | if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) { |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 450 | if (cpu_has_confreg()) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | c->cputype = CPU_R3081E; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 452 | __cpu_name[cpu] = "R3081"; |
| 453 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | c->cputype = CPU_R3000A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 455 | __cpu_name[cpu] = "R3000A"; |
| 456 | } |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 457 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | c->cputype = CPU_R3000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 459 | __cpu_name[cpu] = "R3000"; |
| 460 | } |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 461 | c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 462 | MIPS_CPU_NOFPUEX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | if (__cpu_has_fpu()) |
| 464 | c->options |= MIPS_CPU_FPU; |
| 465 | c->tlbsize = 64; |
| 466 | break; |
| 467 | case PRID_IMP_R4000: |
| 468 | if (read_c0_config() & CONF_SC) { |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 469 | if ((c->processor_id & PRID_REV_MASK) >= |
| 470 | PRID_REV_R4400) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | c->cputype = CPU_R4400PC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 472 | __cpu_name[cpu] = "R4400PC"; |
| 473 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | c->cputype = CPU_R4000PC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 475 | __cpu_name[cpu] = "R4000PC"; |
| 476 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | } else { |
Maciej W. Rozycki | 7f177a5 | 2013-09-23 14:01:53 +0100 | [diff] [blame] | 478 | int cca = read_c0_config() & CONF_CM_CMASK; |
| 479 | int mc; |
| 480 | |
| 481 | /* |
| 482 | * SC and MC versions can't be reliably told apart, |
| 483 | * but only the latter support coherent caching |
| 484 | * modes so assume the firmware has set the KSEG0 |
| 485 | * coherency attribute reasonably (if uncached, we |
| 486 | * assume SC). |
| 487 | */ |
| 488 | switch (cca) { |
| 489 | case CONF_CM_CACHABLE_CE: |
| 490 | case CONF_CM_CACHABLE_COW: |
| 491 | case CONF_CM_CACHABLE_CUW: |
| 492 | mc = 1; |
| 493 | break; |
| 494 | default: |
| 495 | mc = 0; |
| 496 | break; |
| 497 | } |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 498 | if ((c->processor_id & PRID_REV_MASK) >= |
| 499 | PRID_REV_R4400) { |
Maciej W. Rozycki | 7f177a5 | 2013-09-23 14:01:53 +0100 | [diff] [blame] | 500 | c->cputype = mc ? CPU_R4400MC : CPU_R4400SC; |
| 501 | __cpu_name[cpu] = mc ? "R4400MC" : "R4400SC"; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 502 | } else { |
Maciej W. Rozycki | 7f177a5 | 2013-09-23 14:01:53 +0100 | [diff] [blame] | 503 | c->cputype = mc ? CPU_R4000MC : CPU_R4000SC; |
| 504 | __cpu_name[cpu] = mc ? "R4000MC" : "R4000SC"; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 505 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | } |
| 507 | |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 508 | set_isa(c, MIPS_CPU_ISA_III); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 510 | MIPS_CPU_WATCH | MIPS_CPU_VCE | |
| 511 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | c->tlbsize = 48; |
| 513 | break; |
| 514 | case PRID_IMP_VR41XX: |
Yoichi Yuasa | 9f91e50 | 2013-02-21 15:38:19 +0900 | [diff] [blame] | 515 | set_isa(c, MIPS_CPU_ISA_III); |
| 516 | c->options = R4K_OPTS; |
| 517 | c->tlbsize = 32; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | switch (c->processor_id & 0xf0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | case PRID_REV_VR4111: |
| 520 | c->cputype = CPU_VR4111; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 521 | __cpu_name[cpu] = "NEC VR4111"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | case PRID_REV_VR4121: |
| 524 | c->cputype = CPU_VR4121; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 525 | __cpu_name[cpu] = "NEC VR4121"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | break; |
| 527 | case PRID_REV_VR4122: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 528 | if ((c->processor_id & 0xf) < 0x3) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | c->cputype = CPU_VR4122; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 530 | __cpu_name[cpu] = "NEC VR4122"; |
| 531 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | c->cputype = CPU_VR4181A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 533 | __cpu_name[cpu] = "NEC VR4181A"; |
| 534 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | break; |
| 536 | case PRID_REV_VR4130: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 537 | if ((c->processor_id & 0xf) < 0x4) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | c->cputype = CPU_VR4131; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 539 | __cpu_name[cpu] = "NEC VR4131"; |
| 540 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | c->cputype = CPU_VR4133; |
Yoichi Yuasa | 9f91e50 | 2013-02-21 15:38:19 +0900 | [diff] [blame] | 542 | c->options |= MIPS_CPU_LLSC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 543 | __cpu_name[cpu] = "NEC VR4133"; |
| 544 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | break; |
| 546 | default: |
| 547 | printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n"); |
| 548 | c->cputype = CPU_VR41XX; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 549 | __cpu_name[cpu] = "NEC Vr41xx"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | break; |
| 551 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | break; |
| 553 | case PRID_IMP_R4300: |
| 554 | c->cputype = CPU_R4300; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 555 | __cpu_name[cpu] = "R4300"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 556 | set_isa(c, MIPS_CPU_ISA_III); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 558 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | c->tlbsize = 32; |
| 560 | break; |
| 561 | case PRID_IMP_R4600: |
| 562 | c->cputype = CPU_R4600; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 563 | __cpu_name[cpu] = "R4600"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 564 | set_isa(c, MIPS_CPU_ISA_III); |
Thiemo Seufer | 075e750 | 2005-07-27 21:48:12 +0000 | [diff] [blame] | 565 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 566 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | c->tlbsize = 48; |
| 568 | break; |
| 569 | #if 0 |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 570 | case PRID_IMP_R4650: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | /* |
| 572 | * This processor doesn't have an MMU, so it's not |
| 573 | * "real easy" to run Linux on it. It is left purely |
| 574 | * for documentation. Commented out because it shares |
| 575 | * it's c0_prid id number with the TX3900. |
| 576 | */ |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 577 | c->cputype = CPU_R4650; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 578 | __cpu_name[cpu] = "R4650"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 579 | set_isa(c, MIPS_CPU_ISA_III); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 581 | c->tlbsize = 48; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | break; |
| 583 | #endif |
| 584 | case PRID_IMP_TX39: |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 585 | c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | |
| 587 | if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { |
| 588 | c->cputype = CPU_TX3927; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 589 | __cpu_name[cpu] = "TX3927"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | c->tlbsize = 64; |
| 591 | } else { |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 592 | switch (c->processor_id & PRID_REV_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | case PRID_REV_TX3912: |
| 594 | c->cputype = CPU_TX3912; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 595 | __cpu_name[cpu] = "TX3912"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | c->tlbsize = 32; |
| 597 | break; |
| 598 | case PRID_REV_TX3922: |
| 599 | c->cputype = CPU_TX3922; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 600 | __cpu_name[cpu] = "TX3922"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | c->tlbsize = 64; |
| 602 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | } |
| 604 | } |
| 605 | break; |
| 606 | case PRID_IMP_R4700: |
| 607 | c->cputype = CPU_R4700; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 608 | __cpu_name[cpu] = "R4700"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 609 | set_isa(c, MIPS_CPU_ISA_III); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 610 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 611 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | c->tlbsize = 48; |
| 613 | break; |
| 614 | case PRID_IMP_TX49: |
| 615 | c->cputype = CPU_TX49XX; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 616 | __cpu_name[cpu] = "R49XX"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 617 | set_isa(c, MIPS_CPU_ISA_III); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | c->options = R4K_OPTS | MIPS_CPU_LLSC; |
| 619 | if (!(c->processor_id & 0x08)) |
| 620 | c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR; |
| 621 | c->tlbsize = 48; |
| 622 | break; |
| 623 | case PRID_IMP_R5000: |
| 624 | c->cputype = CPU_R5000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 625 | __cpu_name[cpu] = "R5000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 626 | set_isa(c, MIPS_CPU_ISA_IV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 627 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 628 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | c->tlbsize = 48; |
| 630 | break; |
| 631 | case PRID_IMP_R5432: |
| 632 | c->cputype = CPU_R5432; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 633 | __cpu_name[cpu] = "R5432"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 634 | set_isa(c, MIPS_CPU_ISA_IV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 636 | MIPS_CPU_WATCH | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 | c->tlbsize = 48; |
| 638 | break; |
| 639 | case PRID_IMP_R5500: |
| 640 | c->cputype = CPU_R5500; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 641 | __cpu_name[cpu] = "R5500"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 642 | set_isa(c, MIPS_CPU_ISA_IV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 644 | MIPS_CPU_WATCH | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | c->tlbsize = 48; |
| 646 | break; |
| 647 | case PRID_IMP_NEVADA: |
| 648 | c->cputype = CPU_NEVADA; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 649 | __cpu_name[cpu] = "Nevada"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 650 | set_isa(c, MIPS_CPU_ISA_IV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 652 | MIPS_CPU_DIVEC | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 653 | c->tlbsize = 48; |
| 654 | break; |
| 655 | case PRID_IMP_R6000: |
| 656 | c->cputype = CPU_R6000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 657 | __cpu_name[cpu] = "R6000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 658 | set_isa(c, MIPS_CPU_ISA_II); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 660 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | c->tlbsize = 32; |
| 662 | break; |
| 663 | case PRID_IMP_R6000A: |
| 664 | c->cputype = CPU_R6000A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 665 | __cpu_name[cpu] = "R6000A"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 666 | set_isa(c, MIPS_CPU_ISA_II); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 667 | c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 668 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 669 | c->tlbsize = 32; |
| 670 | break; |
| 671 | case PRID_IMP_RM7000: |
| 672 | c->cputype = CPU_RM7000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 673 | __cpu_name[cpu] = "RM7000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 674 | set_isa(c, MIPS_CPU_ISA_IV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 676 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | /* |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 678 | * Undocumented RM7000: Bit 29 in the info register of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | * the RM7000 v2.0 indicates if the TLB has 48 or 64 |
| 680 | * entries. |
| 681 | * |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 682 | * 29 1 => 64 entry JTLB |
| 683 | * 0 => 48 entry JTLB |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | */ |
| 685 | c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48; |
| 686 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 687 | case PRID_IMP_R8000: |
| 688 | c->cputype = CPU_R8000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 689 | __cpu_name[cpu] = "RM8000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 690 | set_isa(c, MIPS_CPU_ISA_IV); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 692 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 693 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 694 | c->tlbsize = 384; /* has weird TLB: 3-way x 128 */ |
| 695 | break; |
| 696 | case PRID_IMP_R10000: |
| 697 | c->cputype = CPU_R10000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 698 | __cpu_name[cpu] = "R10000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 699 | set_isa(c, MIPS_CPU_ISA_IV); |
Ralf Baechle | 8b36612 | 2005-11-22 17:53:59 +0000 | [diff] [blame] | 700 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 701 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 703 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | c->tlbsize = 64; |
| 705 | break; |
| 706 | case PRID_IMP_R12000: |
| 707 | c->cputype = CPU_R12000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 708 | __cpu_name[cpu] = "R12000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 709 | set_isa(c, MIPS_CPU_ISA_IV); |
Ralf Baechle | 8b36612 | 2005-11-22 17:53:59 +0000 | [diff] [blame] | 710 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 711 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 713 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | c->tlbsize = 64; |
| 715 | break; |
Kumba | 44d921b | 2006-05-16 22:23:59 -0400 | [diff] [blame] | 716 | case PRID_IMP_R14000: |
| 717 | c->cputype = CPU_R14000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 718 | __cpu_name[cpu] = "R14000"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 719 | set_isa(c, MIPS_CPU_ISA_IV); |
Kumba | 44d921b | 2006-05-16 22:23:59 -0400 | [diff] [blame] | 720 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 721 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
Kumba | 44d921b | 2006-05-16 22:23:59 -0400 | [diff] [blame] | 722 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
Steven J. Hill | 03751e7 | 2012-05-10 23:21:18 -0500 | [diff] [blame] | 723 | MIPS_CPU_LLSC; |
Kumba | 44d921b | 2006-05-16 22:23:59 -0400 | [diff] [blame] | 724 | c->tlbsize = 64; |
| 725 | break; |
Huacai Chen | 2685919 | 2014-02-16 16:01:18 +0800 | [diff] [blame] | 726 | case PRID_IMP_LOONGSON_64: /* Loongson-2/3 */ |
Robert Millan | 5aac1e8 | 2011-04-16 11:29:29 -0700 | [diff] [blame] | 727 | switch (c->processor_id & PRID_REV_MASK) { |
| 728 | case PRID_REV_LOONGSON2E: |
Huacai Chen | c579d31 | 2014-03-21 18:44:00 +0800 | [diff] [blame] | 729 | c->cputype = CPU_LOONGSON2; |
| 730 | __cpu_name[cpu] = "ICT Loongson-2"; |
Robert Millan | 5aac1e8 | 2011-04-16 11:29:29 -0700 | [diff] [blame] | 731 | set_elf_platform(cpu, "loongson2e"); |
| 732 | break; |
| 733 | case PRID_REV_LOONGSON2F: |
Huacai Chen | c579d31 | 2014-03-21 18:44:00 +0800 | [diff] [blame] | 734 | c->cputype = CPU_LOONGSON2; |
| 735 | __cpu_name[cpu] = "ICT Loongson-2"; |
Robert Millan | 5aac1e8 | 2011-04-16 11:29:29 -0700 | [diff] [blame] | 736 | set_elf_platform(cpu, "loongson2f"); |
| 737 | break; |
Huacai Chen | c579d31 | 2014-03-21 18:44:00 +0800 | [diff] [blame] | 738 | case PRID_REV_LOONGSON3A: |
| 739 | c->cputype = CPU_LOONGSON3; |
| 740 | __cpu_name[cpu] = "ICT Loongson-3"; |
| 741 | set_elf_platform(cpu, "loongson3a"); |
| 742 | break; |
Huacai Chen | e7841be | 2014-06-26 11:41:30 +0800 | [diff] [blame^] | 743 | case PRID_REV_LOONGSON3B_R1: |
| 744 | case PRID_REV_LOONGSON3B_R2: |
| 745 | c->cputype = CPU_LOONGSON3; |
| 746 | __cpu_name[cpu] = "ICT Loongson-3"; |
| 747 | set_elf_platform(cpu, "loongson3b"); |
| 748 | break; |
Robert Millan | 5aac1e8 | 2011-04-16 11:29:29 -0700 | [diff] [blame] | 749 | } |
| 750 | |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 751 | set_isa(c, MIPS_CPU_ISA_III); |
Fuxin Zhang | 2a21c73 | 2007-06-06 14:52:43 +0800 | [diff] [blame] | 752 | c->options = R4K_OPTS | |
| 753 | MIPS_CPU_FPU | MIPS_CPU_LLSC | |
| 754 | MIPS_CPU_32FPR; |
| 755 | c->tlbsize = 64; |
| 756 | break; |
Huacai Chen | 2685919 | 2014-02-16 16:01:18 +0800 | [diff] [blame] | 757 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 758 | decode_configs(c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 759 | |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 760 | c->cputype = CPU_LOONGSON1; |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 761 | |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 762 | switch (c->processor_id & PRID_REV_MASK) { |
| 763 | case PRID_REV_LOONGSON1B: |
| 764 | __cpu_name[cpu] = "Loongson 1B"; |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 765 | break; |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 766 | } |
Kelvin Cheung | 2fa3639 | 2012-06-20 20:05:32 +0100 | [diff] [blame] | 767 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 768 | break; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 769 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 770 | } |
| 771 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 772 | static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | { |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 774 | switch (c->processor_id & PRID_IMP_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | case PRID_IMP_4KC: |
| 776 | c->cputype = CPU_4KC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 777 | __cpu_name[cpu] = "MIPS 4Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 778 | break; |
| 779 | case PRID_IMP_4KEC: |
Ralf Baechle | 2b07bd0 | 2005-04-08 20:36:05 +0000 | [diff] [blame] | 780 | case PRID_IMP_4KECR2: |
| 781 | c->cputype = CPU_4KEC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 782 | __cpu_name[cpu] = "MIPS 4KEc"; |
Ralf Baechle | 2b07bd0 | 2005-04-08 20:36:05 +0000 | [diff] [blame] | 783 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 784 | case PRID_IMP_4KSC: |
Ralf Baechle | 8afcb5d | 2005-10-04 15:01:26 +0100 | [diff] [blame] | 785 | case PRID_IMP_4KSD: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 786 | c->cputype = CPU_4KSC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 787 | __cpu_name[cpu] = "MIPS 4KSc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 788 | break; |
| 789 | case PRID_IMP_5KC: |
| 790 | c->cputype = CPU_5KC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 791 | __cpu_name[cpu] = "MIPS 5Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 | break; |
Leonid Yegoshin | 78d4803 | 2012-07-06 21:56:01 +0200 | [diff] [blame] | 793 | case PRID_IMP_5KE: |
| 794 | c->cputype = CPU_5KE; |
| 795 | __cpu_name[cpu] = "MIPS 5KE"; |
| 796 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | case PRID_IMP_20KC: |
| 798 | c->cputype = CPU_20KC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 799 | __cpu_name[cpu] = "MIPS 20Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | break; |
| 801 | case PRID_IMP_24K: |
| 802 | c->cputype = CPU_24K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 803 | __cpu_name[cpu] = "MIPS 24Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 804 | break; |
John Crispin | 42f3cae | 2013-01-11 22:44:10 +0100 | [diff] [blame] | 805 | case PRID_IMP_24KE: |
| 806 | c->cputype = CPU_24K; |
| 807 | __cpu_name[cpu] = "MIPS 24KEc"; |
| 808 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 809 | case PRID_IMP_25KF: |
| 810 | c->cputype = CPU_25KF; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 811 | __cpu_name[cpu] = "MIPS 25Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 812 | break; |
Ralf Baechle | bbc7f22 | 2005-07-12 16:12:05 +0000 | [diff] [blame] | 813 | case PRID_IMP_34K: |
| 814 | c->cputype = CPU_34K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 815 | __cpu_name[cpu] = "MIPS 34Kc"; |
Ralf Baechle | bbc7f22 | 2005-07-12 16:12:05 +0000 | [diff] [blame] | 816 | break; |
Chris Dearman | c620953 | 2006-05-02 14:08:46 +0100 | [diff] [blame] | 817 | case PRID_IMP_74K: |
| 818 | c->cputype = CPU_74K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 819 | __cpu_name[cpu] = "MIPS 74Kc"; |
Chris Dearman | c620953 | 2006-05-02 14:08:46 +0100 | [diff] [blame] | 820 | break; |
Steven J. Hill | 113c62d | 2012-07-06 23:56:00 +0200 | [diff] [blame] | 821 | case PRID_IMP_M14KC: |
| 822 | c->cputype = CPU_M14KC; |
| 823 | __cpu_name[cpu] = "MIPS M14Kc"; |
| 824 | break; |
Steven J. Hill | f8fa481 | 2012-12-07 03:51:35 +0000 | [diff] [blame] | 825 | case PRID_IMP_M14KEC: |
| 826 | c->cputype = CPU_M14KEC; |
| 827 | __cpu_name[cpu] = "MIPS M14KEc"; |
| 828 | break; |
Ralf Baechle | 39b8d52 | 2008-04-28 17:14:26 +0100 | [diff] [blame] | 829 | case PRID_IMP_1004K: |
| 830 | c->cputype = CPU_1004K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 831 | __cpu_name[cpu] = "MIPS 1004Kc"; |
Ralf Baechle | 39b8d52 | 2008-04-28 17:14:26 +0100 | [diff] [blame] | 832 | break; |
Steven J. Hill | 006a851 | 2012-06-26 04:11:03 +0000 | [diff] [blame] | 833 | case PRID_IMP_1074K: |
Steven J. Hill | 442e14a | 2014-01-17 15:03:50 -0600 | [diff] [blame] | 834 | c->cputype = CPU_1074K; |
Steven J. Hill | 006a851 | 2012-06-26 04:11:03 +0000 | [diff] [blame] | 835 | __cpu_name[cpu] = "MIPS 1074Kc"; |
| 836 | break; |
Leonid Yegoshin | b5f065e | 2013-11-20 10:46:02 +0000 | [diff] [blame] | 837 | case PRID_IMP_INTERAPTIV_UP: |
| 838 | c->cputype = CPU_INTERAPTIV; |
| 839 | __cpu_name[cpu] = "MIPS interAptiv"; |
| 840 | break; |
| 841 | case PRID_IMP_INTERAPTIV_MP: |
| 842 | c->cputype = CPU_INTERAPTIV; |
| 843 | __cpu_name[cpu] = "MIPS interAptiv (multi)"; |
| 844 | break; |
Leonid Yegoshin | b0d4d30 | 2013-11-14 16:12:28 +0000 | [diff] [blame] | 845 | case PRID_IMP_PROAPTIV_UP: |
| 846 | c->cputype = CPU_PROAPTIV; |
| 847 | __cpu_name[cpu] = "MIPS proAptiv"; |
| 848 | break; |
| 849 | case PRID_IMP_PROAPTIV_MP: |
| 850 | c->cputype = CPU_PROAPTIV; |
| 851 | __cpu_name[cpu] = "MIPS proAptiv (multi)"; |
| 852 | break; |
James Hogan | 829dcc0 | 2014-01-22 16:19:39 +0000 | [diff] [blame] | 853 | case PRID_IMP_P5600: |
| 854 | c->cputype = CPU_P5600; |
| 855 | __cpu_name[cpu] = "MIPS P5600"; |
| 856 | break; |
Leonid Yegoshin | 9943ed9 | 2014-03-04 13:34:44 +0000 | [diff] [blame] | 857 | case PRID_IMP_M5150: |
| 858 | c->cputype = CPU_M5150; |
| 859 | __cpu_name[cpu] = "MIPS M5150"; |
| 860 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 861 | } |
Chris Dearman | 0b6d497 | 2007-09-13 12:32:02 +0100 | [diff] [blame] | 862 | |
Leonid Yegoshin | 75b5b5e | 2013-11-14 16:12:31 +0000 | [diff] [blame] | 863 | decode_configs(c); |
| 864 | |
Chris Dearman | 0b6d497 | 2007-09-13 12:32:02 +0100 | [diff] [blame] | 865 | spram_config(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 866 | } |
| 867 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 868 | static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 869 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 870 | decode_configs(c); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 871 | switch (c->processor_id & PRID_IMP_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 872 | case PRID_IMP_AU1_REV1: |
| 873 | case PRID_IMP_AU1_REV2: |
Manuel Lauss | 270717a | 2009-03-25 17:49:28 +0100 | [diff] [blame] | 874 | c->cputype = CPU_ALCHEMY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 875 | switch ((c->processor_id >> 24) & 0xff) { |
| 876 | case 0: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 877 | __cpu_name[cpu] = "Au1000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 878 | break; |
| 879 | case 1: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 880 | __cpu_name[cpu] = "Au1500"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 881 | break; |
| 882 | case 2: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 883 | __cpu_name[cpu] = "Au1100"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 884 | break; |
| 885 | case 3: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 886 | __cpu_name[cpu] = "Au1550"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | break; |
Pete Popov | e3ad1c2 | 2005-03-01 06:33:16 +0000 | [diff] [blame] | 888 | case 4: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 889 | __cpu_name[cpu] = "Au1200"; |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 890 | if ((c->processor_id & PRID_REV_MASK) == 2) |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 891 | __cpu_name[cpu] = "Au1250"; |
Manuel Lauss | 237cfee | 2007-12-06 09:07:55 +0100 | [diff] [blame] | 892 | break; |
| 893 | case 5: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 894 | __cpu_name[cpu] = "Au1210"; |
Pete Popov | e3ad1c2 | 2005-03-01 06:33:16 +0000 | [diff] [blame] | 895 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | default: |
Manuel Lauss | 270717a | 2009-03-25 17:49:28 +0100 | [diff] [blame] | 897 | __cpu_name[cpu] = "Au1xxx"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 898 | break; |
| 899 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 900 | break; |
| 901 | } |
| 902 | } |
| 903 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 904 | static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 905 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 906 | decode_configs(c); |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 907 | |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 908 | switch (c->processor_id & PRID_IMP_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | case PRID_IMP_SB1: |
| 910 | c->cputype = CPU_SB1; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 911 | __cpu_name[cpu] = "SiByte SB1"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 912 | /* FPU in pass1 is known to have issues. */ |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 913 | if ((c->processor_id & PRID_REV_MASK) < 0x02) |
Ralf Baechle | 010b853 | 2006-01-29 18:42:08 +0000 | [diff] [blame] | 914 | c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 915 | break; |
Andrew Isaacson | 93ce2f52 | 2005-10-19 23:56:20 -0700 | [diff] [blame] | 916 | case PRID_IMP_SB1A: |
| 917 | c->cputype = CPU_SB1A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 918 | __cpu_name[cpu] = "SiByte SB1A"; |
Andrew Isaacson | 93ce2f52 | 2005-10-19 23:56:20 -0700 | [diff] [blame] | 919 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 920 | } |
| 921 | } |
| 922 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 923 | static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 924 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 925 | decode_configs(c); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 926 | switch (c->processor_id & PRID_IMP_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 927 | case PRID_IMP_SR71000: |
| 928 | c->cputype = CPU_SR71000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 929 | __cpu_name[cpu] = "Sandcraft SR71000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 930 | c->scache.ways = 8; |
| 931 | c->tlbsize = 64; |
| 932 | break; |
| 933 | } |
| 934 | } |
| 935 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 936 | static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu) |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 937 | { |
| 938 | decode_configs(c); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 939 | switch (c->processor_id & PRID_IMP_MASK) { |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 940 | case PRID_IMP_PR4450: |
| 941 | c->cputype = CPU_PR4450; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 942 | __cpu_name[cpu] = "Philips PR4450"; |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 943 | set_isa(c, MIPS_CPU_ISA_M32R1); |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 944 | break; |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 945 | } |
| 946 | } |
| 947 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 948 | static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 949 | { |
| 950 | decode_configs(c); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 951 | switch (c->processor_id & PRID_IMP_MASK) { |
Kevin Cernekee | 190fca3 | 2010-11-23 10:26:45 -0800 | [diff] [blame] | 952 | case PRID_IMP_BMIPS32_REV4: |
| 953 | case PRID_IMP_BMIPS32_REV8: |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 954 | c->cputype = CPU_BMIPS32; |
| 955 | __cpu_name[cpu] = "Broadcom BMIPS32"; |
Kevin Cernekee | 06785df | 2011-04-16 11:29:28 -0700 | [diff] [blame] | 956 | set_elf_platform(cpu, "bmips32"); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 957 | break; |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 958 | case PRID_IMP_BMIPS3300: |
| 959 | case PRID_IMP_BMIPS3300_ALT: |
| 960 | case PRID_IMP_BMIPS3300_BUG: |
| 961 | c->cputype = CPU_BMIPS3300; |
| 962 | __cpu_name[cpu] = "Broadcom BMIPS3300"; |
Kevin Cernekee | 06785df | 2011-04-16 11:29:28 -0700 | [diff] [blame] | 963 | set_elf_platform(cpu, "bmips3300"); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 964 | break; |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 965 | case PRID_IMP_BMIPS43XX: { |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 966 | int rev = c->processor_id & PRID_REV_MASK; |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 967 | |
| 968 | if (rev >= PRID_REV_BMIPS4380_LO && |
| 969 | rev <= PRID_REV_BMIPS4380_HI) { |
| 970 | c->cputype = CPU_BMIPS4380; |
| 971 | __cpu_name[cpu] = "Broadcom BMIPS4380"; |
Kevin Cernekee | 06785df | 2011-04-16 11:29:28 -0700 | [diff] [blame] | 972 | set_elf_platform(cpu, "bmips4380"); |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 973 | } else { |
| 974 | c->cputype = CPU_BMIPS4350; |
| 975 | __cpu_name[cpu] = "Broadcom BMIPS4350"; |
Kevin Cernekee | 06785df | 2011-04-16 11:29:28 -0700 | [diff] [blame] | 976 | set_elf_platform(cpu, "bmips4350"); |
Maxime Bizon | 0de663e | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 977 | } |
| 978 | break; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 979 | } |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 980 | case PRID_IMP_BMIPS5000: |
| 981 | c->cputype = CPU_BMIPS5000; |
| 982 | __cpu_name[cpu] = "Broadcom BMIPS5000"; |
Kevin Cernekee | 06785df | 2011-04-16 11:29:28 -0700 | [diff] [blame] | 983 | set_elf_platform(cpu, "bmips5000"); |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 984 | c->options |= MIPS_CPU_ULRI; |
| 985 | break; |
Kevin Cernekee | 602977b | 2010-10-16 14:22:30 -0700 | [diff] [blame] | 986 | } |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 987 | } |
| 988 | |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 989 | static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) |
| 990 | { |
| 991 | decode_configs(c); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 992 | switch (c->processor_id & PRID_IMP_MASK) { |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 993 | case PRID_IMP_CAVIUM_CN38XX: |
| 994 | case PRID_IMP_CAVIUM_CN31XX: |
| 995 | case PRID_IMP_CAVIUM_CN30XX: |
David Daney | 6f32946 | 2010-02-10 15:12:48 -0800 | [diff] [blame] | 996 | c->cputype = CPU_CAVIUM_OCTEON; |
| 997 | __cpu_name[cpu] = "Cavium Octeon"; |
| 998 | goto platform; |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 999 | case PRID_IMP_CAVIUM_CN58XX: |
| 1000 | case PRID_IMP_CAVIUM_CN56XX: |
| 1001 | case PRID_IMP_CAVIUM_CN50XX: |
| 1002 | case PRID_IMP_CAVIUM_CN52XX: |
David Daney | 6f32946 | 2010-02-10 15:12:48 -0800 | [diff] [blame] | 1003 | c->cputype = CPU_CAVIUM_OCTEON_PLUS; |
| 1004 | __cpu_name[cpu] = "Cavium Octeon+"; |
| 1005 | platform: |
Robert Millan | c094c99 | 2011-04-18 11:37:55 -0700 | [diff] [blame] | 1006 | set_elf_platform(cpu, "octeon"); |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 1007 | break; |
David Daney | a1431b6 | 2011-09-24 02:29:54 +0200 | [diff] [blame] | 1008 | case PRID_IMP_CAVIUM_CN61XX: |
David Daney | 0e56b38 | 2010-10-07 16:03:45 -0700 | [diff] [blame] | 1009 | case PRID_IMP_CAVIUM_CN63XX: |
David Daney | a1431b6 | 2011-09-24 02:29:54 +0200 | [diff] [blame] | 1010 | case PRID_IMP_CAVIUM_CN66XX: |
| 1011 | case PRID_IMP_CAVIUM_CN68XX: |
David Daney | af04bb8 | 2013-07-29 15:07:01 -0700 | [diff] [blame] | 1012 | case PRID_IMP_CAVIUM_CNF71XX: |
David Daney | 0e56b38 | 2010-10-07 16:03:45 -0700 | [diff] [blame] | 1013 | c->cputype = CPU_CAVIUM_OCTEON2; |
| 1014 | __cpu_name[cpu] = "Cavium Octeon II"; |
Robert Millan | c094c99 | 2011-04-18 11:37:55 -0700 | [diff] [blame] | 1015 | set_elf_platform(cpu, "octeon2"); |
David Daney | 0e56b38 | 2010-10-07 16:03:45 -0700 | [diff] [blame] | 1016 | break; |
David Daney | af04bb8 | 2013-07-29 15:07:01 -0700 | [diff] [blame] | 1017 | case PRID_IMP_CAVIUM_CN70XX: |
| 1018 | case PRID_IMP_CAVIUM_CN78XX: |
| 1019 | c->cputype = CPU_CAVIUM_OCTEON3; |
| 1020 | __cpu_name[cpu] = "Cavium Octeon III"; |
| 1021 | set_elf_platform(cpu, "octeon3"); |
| 1022 | break; |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 1023 | default: |
| 1024 | printk(KERN_INFO "Unknown Octeon chip!\n"); |
| 1025 | c->cputype = CPU_UNKNOWN; |
| 1026 | break; |
| 1027 | } |
| 1028 | } |
| 1029 | |
Lars-Peter Clausen | 83ccf69 | 2010-07-17 11:07:51 +0000 | [diff] [blame] | 1030 | static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) |
| 1031 | { |
| 1032 | decode_configs(c); |
| 1033 | /* JZRISC does not implement the CP0 counter. */ |
| 1034 | c->options &= ~MIPS_CPU_COUNTER; |
Maciej W. Rozycki | 06947aa | 2014-04-06 21:31:29 +0100 | [diff] [blame] | 1035 | BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 1036 | switch (c->processor_id & PRID_IMP_MASK) { |
Lars-Peter Clausen | 83ccf69 | 2010-07-17 11:07:51 +0000 | [diff] [blame] | 1037 | case PRID_IMP_JZRISC: |
| 1038 | c->cputype = CPU_JZRISC; |
| 1039 | __cpu_name[cpu] = "Ingenic JZRISC"; |
| 1040 | break; |
| 1041 | default: |
| 1042 | panic("Unknown Ingenic Processor ID!"); |
| 1043 | break; |
| 1044 | } |
| 1045 | } |
| 1046 | |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1047 | static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu) |
| 1048 | { |
| 1049 | decode_configs(c); |
| 1050 | |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 1051 | if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) { |
Manuel Lauss | 809f36c | 2011-11-01 20:03:30 +0100 | [diff] [blame] | 1052 | c->cputype = CPU_ALCHEMY; |
| 1053 | __cpu_name[cpu] = "Au1300"; |
| 1054 | /* following stuff is not for Alchemy */ |
| 1055 | return; |
| 1056 | } |
| 1057 | |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 1058 | c->options = (MIPS_CPU_TLB | |
| 1059 | MIPS_CPU_4KEX | |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1060 | MIPS_CPU_COUNTER | |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 1061 | MIPS_CPU_DIVEC | |
| 1062 | MIPS_CPU_WATCH | |
| 1063 | MIPS_CPU_EJTAG | |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1064 | MIPS_CPU_LLSC); |
| 1065 | |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 1066 | switch (c->processor_id & PRID_IMP_MASK) { |
Jayachandran C | 4ca86a2 | 2013-08-11 14:43:54 +0530 | [diff] [blame] | 1067 | case PRID_IMP_NETLOGIC_XLP2XX: |
Jayachandran C | 8907c55 | 2013-12-21 16:52:20 +0530 | [diff] [blame] | 1068 | case PRID_IMP_NETLOGIC_XLP9XX: |
Yonghong Song | 1c98398 | 2014-04-29 20:07:53 +0530 | [diff] [blame] | 1069 | case PRID_IMP_NETLOGIC_XLP5XX: |
Jayachandran C | 4ca86a2 | 2013-08-11 14:43:54 +0530 | [diff] [blame] | 1070 | c->cputype = CPU_XLP; |
| 1071 | __cpu_name[cpu] = "Broadcom XLPII"; |
| 1072 | break; |
| 1073 | |
Jayachandran C | 2aa54b2 | 2011-11-16 00:21:29 +0000 | [diff] [blame] | 1074 | case PRID_IMP_NETLOGIC_XLP8XX: |
| 1075 | case PRID_IMP_NETLOGIC_XLP3XX: |
Jayachandran C | a3d4fb2 | 2011-11-16 00:21:20 +0000 | [diff] [blame] | 1076 | c->cputype = CPU_XLP; |
| 1077 | __cpu_name[cpu] = "Netlogic XLP"; |
| 1078 | break; |
| 1079 | |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1080 | case PRID_IMP_NETLOGIC_XLR732: |
| 1081 | case PRID_IMP_NETLOGIC_XLR716: |
| 1082 | case PRID_IMP_NETLOGIC_XLR532: |
| 1083 | case PRID_IMP_NETLOGIC_XLR308: |
| 1084 | case PRID_IMP_NETLOGIC_XLR532C: |
| 1085 | case PRID_IMP_NETLOGIC_XLR516C: |
| 1086 | case PRID_IMP_NETLOGIC_XLR508C: |
| 1087 | case PRID_IMP_NETLOGIC_XLR308C: |
| 1088 | c->cputype = CPU_XLR; |
| 1089 | __cpu_name[cpu] = "Netlogic XLR"; |
| 1090 | break; |
| 1091 | |
| 1092 | case PRID_IMP_NETLOGIC_XLS608: |
| 1093 | case PRID_IMP_NETLOGIC_XLS408: |
| 1094 | case PRID_IMP_NETLOGIC_XLS404: |
| 1095 | case PRID_IMP_NETLOGIC_XLS208: |
| 1096 | case PRID_IMP_NETLOGIC_XLS204: |
| 1097 | case PRID_IMP_NETLOGIC_XLS108: |
| 1098 | case PRID_IMP_NETLOGIC_XLS104: |
| 1099 | case PRID_IMP_NETLOGIC_XLS616B: |
| 1100 | case PRID_IMP_NETLOGIC_XLS608B: |
| 1101 | case PRID_IMP_NETLOGIC_XLS416B: |
| 1102 | case PRID_IMP_NETLOGIC_XLS412B: |
| 1103 | case PRID_IMP_NETLOGIC_XLS408B: |
| 1104 | case PRID_IMP_NETLOGIC_XLS404B: |
| 1105 | c->cputype = CPU_XLR; |
| 1106 | __cpu_name[cpu] = "Netlogic XLS"; |
| 1107 | break; |
| 1108 | |
| 1109 | default: |
Jayachandran C | a3d4fb2 | 2011-11-16 00:21:20 +0000 | [diff] [blame] | 1110 | pr_info("Unknown Netlogic chip id [%02x]!\n", |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1111 | c->processor_id); |
| 1112 | c->cputype = CPU_XLR; |
| 1113 | break; |
| 1114 | } |
| 1115 | |
Jayachandran C | a3d4fb2 | 2011-11-16 00:21:20 +0000 | [diff] [blame] | 1116 | if (c->cputype == CPU_XLP) { |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 1117 | set_isa(c, MIPS_CPU_ISA_M64R2); |
Jayachandran C | a3d4fb2 | 2011-11-16 00:21:20 +0000 | [diff] [blame] | 1118 | c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK); |
| 1119 | /* This will be updated again after all threads are woken up */ |
| 1120 | c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1; |
| 1121 | } else { |
Steven J. Hill | a96102b | 2012-12-07 04:31:36 +0000 | [diff] [blame] | 1122 | set_isa(c, MIPS_CPU_ISA_M64R1); |
Jayachandran C | a3d4fb2 | 2011-11-16 00:21:20 +0000 | [diff] [blame] | 1123 | c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1; |
| 1124 | } |
Jayachandran C | 7777b93 | 2013-06-11 14:41:35 +0000 | [diff] [blame] | 1125 | c->kscratch_mask = 0xf; |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1126 | } |
| 1127 | |
David Daney | 949e51b | 2010-10-14 11:32:33 -0700 | [diff] [blame] | 1128 | #ifdef CONFIG_64BIT |
| 1129 | /* For use by uaccess.h */ |
| 1130 | u64 __ua_limit; |
| 1131 | EXPORT_SYMBOL(__ua_limit); |
| 1132 | #endif |
| 1133 | |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 1134 | const char *__cpu_name[NR_CPUS]; |
David Daney | 874fd3b | 2010-01-28 16:52:12 -0800 | [diff] [blame] | 1135 | const char *__elf_platform; |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 1136 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 1137 | void cpu_probe(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1138 | { |
| 1139 | struct cpuinfo_mips *c = ¤t_cpu_data; |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 1140 | unsigned int cpu = smp_processor_id(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1141 | |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 1142 | c->processor_id = PRID_IMP_UNKNOWN; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1143 | c->fpu_id = FPIR_IMP_NONE; |
| 1144 | c->cputype = CPU_UNKNOWN; |
| 1145 | |
| 1146 | c->processor_id = read_c0_prid(); |
Maciej W. Rozycki | 8ff374b | 2013-09-17 16:58:10 +0100 | [diff] [blame] | 1147 | switch (c->processor_id & PRID_COMP_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1148 | case PRID_COMP_LEGACY: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1149 | cpu_probe_legacy(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1150 | break; |
| 1151 | case PRID_COMP_MIPS: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1152 | cpu_probe_mips(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1153 | break; |
| 1154 | case PRID_COMP_ALCHEMY: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1155 | cpu_probe_alchemy(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1156 | break; |
| 1157 | case PRID_COMP_SIBYTE: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1158 | cpu_probe_sibyte(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1159 | break; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 1160 | case PRID_COMP_BROADCOM: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1161 | cpu_probe_broadcom(c, cpu); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 1162 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1163 | case PRID_COMP_SANDCRAFT: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1164 | cpu_probe_sandcraft(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1165 | break; |
Daniel Laird | a92b058 | 2008-03-06 09:07:18 +0000 | [diff] [blame] | 1166 | case PRID_COMP_NXP: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1167 | cpu_probe_nxp(c, cpu); |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 1168 | break; |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 1169 | case PRID_COMP_CAVIUM: |
| 1170 | cpu_probe_cavium(c, cpu); |
| 1171 | break; |
Lars-Peter Clausen | 83ccf69 | 2010-07-17 11:07:51 +0000 | [diff] [blame] | 1172 | case PRID_COMP_INGENIC: |
| 1173 | cpu_probe_ingenic(c, cpu); |
| 1174 | break; |
Jayachandran C | a7117c6 | 2011-05-11 12:04:58 +0530 | [diff] [blame] | 1175 | case PRID_COMP_NETLOGIC: |
| 1176 | cpu_probe_netlogic(c, cpu); |
| 1177 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1178 | } |
Franck Bui-Huu | dec8b1c | 2007-10-08 16:11:51 +0200 | [diff] [blame] | 1179 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 1180 | BUG_ON(!__cpu_name[cpu]); |
| 1181 | BUG_ON(c->cputype == CPU_UNKNOWN); |
| 1182 | |
Franck Bui-Huu | dec8b1c | 2007-10-08 16:11:51 +0200 | [diff] [blame] | 1183 | /* |
| 1184 | * Platform code can force the cpu type to optimize code |
| 1185 | * generation. In that case be sure the cpu type is correctly |
| 1186 | * manually setup otherwise it could trigger some nasty bugs. |
| 1187 | */ |
| 1188 | BUG_ON(current_cpu_type() != c->cputype); |
| 1189 | |
Kevin Cernekee | 0103d23 | 2010-05-02 14:43:52 -0700 | [diff] [blame] | 1190 | if (mips_fpu_disabled) |
| 1191 | c->options &= ~MIPS_CPU_FPU; |
| 1192 | |
| 1193 | if (mips_dsp_disabled) |
Steven J. Hill | ee80f7c7 | 2012-08-03 10:26:04 -0500 | [diff] [blame] | 1194 | c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P); |
Kevin Cernekee | 0103d23 | 2010-05-02 14:43:52 -0700 | [diff] [blame] | 1195 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 1196 | if (c->options & MIPS_CPU_FPU) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1197 | c->fpu_id = cpu_get_fpu_id(); |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 1198 | |
Deng-Cheng Zhu | adb3789 | 2013-04-01 18:14:28 +0000 | [diff] [blame] | 1199 | if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 | |
| 1200 | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 1201 | if (c->fpu_id & MIPS_FPIR_3D) |
| 1202 | c->ases |= MIPS_ASE_MIPS3D; |
| 1203 | } |
| 1204 | } |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 1205 | |
Al Cooper | da4b62c | 2012-07-13 16:44:51 -0400 | [diff] [blame] | 1206 | if (cpu_has_mips_r2) { |
Ralf Baechle | f6771db | 2007-11-08 18:02:29 +0000 | [diff] [blame] | 1207 | c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; |
Al Cooper | da4b62c | 2012-07-13 16:44:51 -0400 | [diff] [blame] | 1208 | /* R2 has Performance Counter Interrupt indicator */ |
| 1209 | c->options |= MIPS_CPU_PCI; |
| 1210 | } |
Ralf Baechle | f6771db | 2007-11-08 18:02:29 +0000 | [diff] [blame] | 1211 | else |
| 1212 | c->srsets = 1; |
Guenter Roeck | 91dfc42 | 2010-02-02 08:52:20 -0800 | [diff] [blame] | 1213 | |
Paul Burton | a8ad136 | 2014-01-28 14:28:43 +0000 | [diff] [blame] | 1214 | if (cpu_has_msa) { |
Paul Burton | a5e9a69 | 2014-01-27 15:23:10 +0000 | [diff] [blame] | 1215 | c->msa_id = cpu_get_msa_id(); |
Paul Burton | a8ad136 | 2014-01-28 14:28:43 +0000 | [diff] [blame] | 1216 | WARN(c->msa_id & MSA_IR_WRPF, |
| 1217 | "Vector register partitioning unimplemented!"); |
| 1218 | } |
Paul Burton | a5e9a69 | 2014-01-27 15:23:10 +0000 | [diff] [blame] | 1219 | |
Guenter Roeck | 91dfc42 | 2010-02-02 08:52:20 -0800 | [diff] [blame] | 1220 | cpu_probe_vmbits(c); |
David Daney | 949e51b | 2010-10-14 11:32:33 -0700 | [diff] [blame] | 1221 | |
| 1222 | #ifdef CONFIG_64BIT |
| 1223 | if (cpu == 0) |
| 1224 | __ua_limit = ~((1ull << cpu_vmbits) - 1); |
| 1225 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1226 | } |
| 1227 | |
Paul Gortmaker | 078a55f | 2013-06-18 13:38:59 +0000 | [diff] [blame] | 1228 | void cpu_report(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1229 | { |
| 1230 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| 1231 | |
Leonid Yegoshin | d9f897c | 2013-10-07 10:43:32 +0100 | [diff] [blame] | 1232 | pr_info("CPU%d revision is: %08x (%s)\n", |
| 1233 | smp_processor_id(), c->processor_id, cpu_name_string()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1234 | if (c->options & MIPS_CPU_FPU) |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 1235 | printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id); |
Paul Burton | a5e9a69 | 2014-01-27 15:23:10 +0000 | [diff] [blame] | 1236 | if (cpu_has_msa) |
| 1237 | pr_info("MSA revision is: %08x\n", c->msa_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1238 | } |