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