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