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