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 | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 7 | * Copyright (C) 2001, 2004 MIPS 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> |
Wu Zhangjin | f8ede0f | 2009-11-17 01:32:59 +0800 | [diff] [blame^] | 19 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Ralf Baechle | 5759906 | 2007-02-18 19:07:31 +0000 | [diff] [blame] | 21 | #include <asm/bugs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <asm/cpu.h> |
| 23 | #include <asm/fpu.h> |
| 24 | #include <asm/mipsregs.h> |
| 25 | #include <asm/system.h> |
David Daney | 654f57b | 2008-09-23 00:07:16 -0700 | [diff] [blame] | 26 | #include <asm/watch.h> |
Chris Dearman | a074f0e | 2009-07-10 01:51:27 -0700 | [diff] [blame] | 27 | #include <asm/spram.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | /* |
| 29 | * Not all of the MIPS CPUs have the "wait" instruction available. Moreover, |
| 30 | * the implementation of the "wait" feature differs between CPU families. This |
| 31 | * points to the function that implements CPU specific wait. |
| 32 | * The wait instruction stops the pipeline and reduces the power consumption of |
| 33 | * the CPU very much. |
| 34 | */ |
Ralf Baechle | 982f6ff | 2009-09-17 02:25:07 +0200 | [diff] [blame] | 35 | void (*cpu_wait)(void); |
Wu Zhangjin | f8ede0f | 2009-11-17 01:32:59 +0800 | [diff] [blame^] | 36 | EXPORT_SYMBOL(cpu_wait); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
| 38 | static void r3081_wait(void) |
| 39 | { |
| 40 | unsigned long cfg = read_c0_conf(); |
| 41 | write_c0_conf(cfg | R30XX_CONF_HALT); |
| 42 | } |
| 43 | |
| 44 | static void r39xx_wait(void) |
| 45 | { |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 46 | local_irq_disable(); |
| 47 | if (!need_resched()) |
| 48 | write_c0_conf(read_c0_conf() | TX39_CONF_HALT); |
| 49 | local_irq_enable(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Atsushi Nemoto | c65a548 | 2007-11-12 02:05:18 +0900 | [diff] [blame] | 52 | extern void r4k_wait(void); |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | * This variant is preferable as it allows testing need_resched and going to |
| 56 | * sleep depending on the outcome atomically. Unfortunately the "It is |
| 57 | * implementation-dependent whether the pipeline restarts when a non-enabled |
| 58 | * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes |
| 59 | * using this version a gamble. |
| 60 | */ |
Kevin D. Kissell | 8531a35 | 2008-09-09 21:48:52 +0200 | [diff] [blame] | 61 | void r4k_wait_irqoff(void) |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 62 | { |
| 63 | local_irq_disable(); |
| 64 | if (!need_resched()) |
Kevin D. Kissell | 8531a35 | 2008-09-09 21:48:52 +0200 | [diff] [blame] | 65 | __asm__(" .set push \n" |
| 66 | " .set mips3 \n" |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 67 | " wait \n" |
Kevin D. Kissell | 8531a35 | 2008-09-09 21:48:52 +0200 | [diff] [blame] | 68 | " .set pop \n"); |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 69 | local_irq_enable(); |
Kevin D. Kissell | 8531a35 | 2008-09-09 21:48:52 +0200 | [diff] [blame] | 70 | __asm__(" .globl __pastwait \n" |
| 71 | "__pastwait: \n"); |
| 72 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | } |
| 74 | |
Ralf Baechle | 5a81299 | 2007-07-17 18:49:48 +0100 | [diff] [blame] | 75 | /* |
| 76 | * The RM7000 variant has to handle erratum 38. The workaround is to not |
| 77 | * have any pending stores when the WAIT instruction is executed. |
| 78 | */ |
| 79 | static void rm7k_wait_irqoff(void) |
| 80 | { |
| 81 | local_irq_disable(); |
| 82 | if (!need_resched()) |
| 83 | __asm__( |
| 84 | " .set push \n" |
| 85 | " .set mips3 \n" |
| 86 | " .set noat \n" |
| 87 | " mfc0 $1, $12 \n" |
| 88 | " sync \n" |
| 89 | " mtc0 $1, $12 # stalls until W stage \n" |
| 90 | " wait \n" |
| 91 | " mtc0 $1, $12 # stalls until W stage \n" |
| 92 | " .set pop \n"); |
| 93 | local_irq_enable(); |
| 94 | } |
| 95 | |
Manuel Lauss | 2882b0c | 2009-08-22 18:09:27 +0200 | [diff] [blame] | 96 | /* |
| 97 | * The Au1xxx wait is available only if using 32khz counter or |
| 98 | * external timer source, but specifically not CP0 Counter. |
| 99 | * alchemy/common/time.c may override cpu_wait! |
| 100 | */ |
Pete Popov | 494900a | 2005-04-07 00:42:10 +0000 | [diff] [blame] | 101 | static void au1k_wait(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | { |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 103 | __asm__(" .set mips3 \n" |
| 104 | " cache 0x14, 0(%0) \n" |
| 105 | " cache 0x14, 32(%0) \n" |
| 106 | " sync \n" |
| 107 | " nop \n" |
| 108 | " wait \n" |
| 109 | " nop \n" |
| 110 | " nop \n" |
| 111 | " nop \n" |
| 112 | " nop \n" |
| 113 | " .set mips0 \n" |
Ralf Baechle | 10f650d | 2005-05-25 13:32:49 +0000 | [diff] [blame] | 114 | : : "r" (au1k_wait)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | } |
| 116 | |
Ralf Baechle | 982f6ff | 2009-09-17 02:25:07 +0200 | [diff] [blame] | 117 | static int __initdata nowait; |
Ralf Baechle | 55d04df | 2005-07-13 19:22:45 +0000 | [diff] [blame] | 118 | |
Atsushi Nemoto | f49a747 | 2007-02-18 01:02:14 +0900 | [diff] [blame] | 119 | static int __init wait_disable(char *s) |
Ralf Baechle | 55d04df | 2005-07-13 19:22:45 +0000 | [diff] [blame] | 120 | { |
| 121 | nowait = 1; |
| 122 | |
| 123 | return 1; |
| 124 | } |
| 125 | |
| 126 | __setup("nowait", wait_disable); |
| 127 | |
Atsushi Nemoto | c65a548 | 2007-11-12 02:05:18 +0900 | [diff] [blame] | 128 | void __init check_wait(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | { |
| 130 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| 131 | |
Ralf Baechle | 55d04df | 2005-07-13 19:22:45 +0000 | [diff] [blame] | 132 | if (nowait) { |
Ralf Baechle | c237923 | 2006-11-30 01:14:44 +0000 | [diff] [blame] | 133 | printk("Wait instruction disabled.\n"); |
Ralf Baechle | 55d04df | 2005-07-13 19:22:45 +0000 | [diff] [blame] | 134 | return; |
| 135 | } |
| 136 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | switch (c->cputype) { |
| 138 | case CPU_R3081: |
| 139 | case CPU_R3081E: |
| 140 | cpu_wait = r3081_wait; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | break; |
| 142 | case CPU_TX3927: |
| 143 | cpu_wait = r39xx_wait; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | break; |
| 145 | case CPU_R4200: |
| 146 | /* case CPU_R4300: */ |
| 147 | case CPU_R4600: |
| 148 | case CPU_R4640: |
| 149 | case CPU_R4650: |
| 150 | case CPU_R4700: |
| 151 | case CPU_R5000: |
Shinya Kuribayashi | a644b27 | 2009-03-03 18:05:51 +0900 | [diff] [blame] | 152 | case CPU_R5500: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | case CPU_NEVADA: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | case CPU_4KC: |
| 155 | case CPU_4KEC: |
| 156 | case CPU_4KSC: |
| 157 | case CPU_5KC: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | case CPU_25KF: |
Ralf Baechle | 4b3e975 | 2007-06-21 00:22:34 +0100 | [diff] [blame] | 159 | case CPU_PR4450: |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 160 | case CPU_BCM3302: |
Maxime Bizon | 0de663e | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 161 | case CPU_BCM6338: |
| 162 | case CPU_BCM6348: |
| 163 | case CPU_BCM6358: |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 164 | case CPU_CAVIUM_OCTEON: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | cpu_wait = r4k_wait; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | break; |
Ralf Baechle | 4b3e975 | 2007-06-21 00:22:34 +0100 | [diff] [blame] | 167 | |
Ralf Baechle | 5a81299 | 2007-07-17 18:49:48 +0100 | [diff] [blame] | 168 | case CPU_RM7000: |
| 169 | cpu_wait = rm7k_wait_irqoff; |
| 170 | break; |
| 171 | |
Ralf Baechle | 4b3e975 | 2007-06-21 00:22:34 +0100 | [diff] [blame] | 172 | case CPU_24K: |
| 173 | case CPU_34K: |
Ralf Baechle | 39b8d52 | 2008-04-28 17:14:26 +0100 | [diff] [blame] | 174 | case CPU_1004K: |
Ralf Baechle | 4b3e975 | 2007-06-21 00:22:34 +0100 | [diff] [blame] | 175 | cpu_wait = r4k_wait; |
| 176 | if (read_c0_config7() & MIPS_CONF7_WII) |
| 177 | cpu_wait = r4k_wait_irqoff; |
| 178 | break; |
| 179 | |
| 180 | case CPU_74K: |
| 181 | cpu_wait = r4k_wait; |
| 182 | if ((c->processor_id & 0xff) >= PRID_REV_ENCODE_332(2, 1, 0)) |
| 183 | cpu_wait = r4k_wait_irqoff; |
| 184 | break; |
| 185 | |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 186 | case CPU_TX49XX: |
| 187 | cpu_wait = r4k_wait_irqoff; |
Atsushi Nemoto | 60a6c37 | 2006-06-08 01:09:01 +0900 | [diff] [blame] | 188 | break; |
Manuel Lauss | 270717a | 2009-03-25 17:49:28 +0100 | [diff] [blame] | 189 | case CPU_ALCHEMY: |
Manuel Lauss | 0c694de | 2008-12-21 09:26:23 +0100 | [diff] [blame] | 190 | cpu_wait = au1k_wait; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | break; |
Ralf Baechle | c8eae71 | 2007-06-12 13:04:09 +0100 | [diff] [blame] | 192 | case CPU_20KC: |
| 193 | /* |
| 194 | * WAIT on Rev1.0 has E1, E2, E3 and E16. |
| 195 | * WAIT on Rev2.0 and Rev3.0 has E16. |
| 196 | * Rev3.1 WAIT is nop, why bother |
| 197 | */ |
| 198 | if ((c->processor_id & 0xff) <= 0x64) |
| 199 | break; |
| 200 | |
Ralf Baechle | 50da469 | 2007-09-14 19:08:43 +0100 | [diff] [blame] | 201 | /* |
| 202 | * Another rev is incremeting c0_count at a reduced clock |
| 203 | * rate while in WAIT mode. So we basically have the choice |
| 204 | * between using the cp0 timer as clocksource or avoiding |
| 205 | * the WAIT instruction. Until more details are known, |
| 206 | * disable the use of WAIT for 20Kc entirely. |
| 207 | cpu_wait = r4k_wait; |
| 208 | */ |
Ralf Baechle | c8eae71 | 2007-06-12 13:04:09 +0100 | [diff] [blame] | 209 | break; |
Ralf Baechle | 441ee34 | 2006-06-02 11:48:11 +0100 | [diff] [blame] | 210 | case CPU_RM9000: |
Ralf Baechle | c237923 | 2006-11-30 01:14:44 +0000 | [diff] [blame] | 211 | if ((c->processor_id & 0x00ff) >= 0x40) |
Ralf Baechle | 441ee34 | 2006-06-02 11:48:11 +0100 | [diff] [blame] | 212 | cpu_wait = r4k_wait; |
Ralf Baechle | 441ee34 | 2006-06-02 11:48:11 +0100 | [diff] [blame] | 213 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | default: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | break; |
| 216 | } |
| 217 | } |
| 218 | |
Marc St-Jean | 9267a30 | 2007-06-14 15:55:31 -0600 | [diff] [blame] | 219 | static inline void check_errata(void) |
| 220 | { |
| 221 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| 222 | |
| 223 | switch (c->cputype) { |
| 224 | case CPU_34K: |
| 225 | /* |
| 226 | * Erratum "RPS May Cause Incorrect Instruction Execution" |
| 227 | * This code only handles VPE0, any SMP/SMTC/RTOS code |
| 228 | * making use of VPE1 will be responsable for that VPE. |
| 229 | */ |
| 230 | if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2) |
| 231 | write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS); |
| 232 | break; |
| 233 | default: |
| 234 | break; |
| 235 | } |
| 236 | } |
| 237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | void __init check_bugs32(void) |
| 239 | { |
Marc St-Jean | 9267a30 | 2007-06-14 15:55:31 -0600 | [diff] [blame] | 240 | check_errata(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | /* |
| 244 | * Probe whether cpu has config register by trying to play with |
| 245 | * alternate cache bit and see whether it matters. |
| 246 | * It's used by cpu_probe to distinguish between R3000A and R3081. |
| 247 | */ |
| 248 | static inline int cpu_has_confreg(void) |
| 249 | { |
| 250 | #ifdef CONFIG_CPU_R3000 |
| 251 | extern unsigned long r3k_cache_size(unsigned long); |
| 252 | unsigned long size1, size2; |
| 253 | unsigned long cfg = read_c0_conf(); |
| 254 | |
| 255 | size1 = r3k_cache_size(ST0_ISC); |
| 256 | write_c0_conf(cfg ^ R30XX_CONF_AC); |
| 257 | size2 = r3k_cache_size(ST0_ISC); |
| 258 | write_c0_conf(cfg); |
| 259 | return size1 != size2; |
| 260 | #else |
| 261 | return 0; |
| 262 | #endif |
| 263 | } |
| 264 | |
| 265 | /* |
| 266 | * Get the FPU Implementation/Revision. |
| 267 | */ |
| 268 | static inline unsigned long cpu_get_fpu_id(void) |
| 269 | { |
| 270 | unsigned long tmp, fpu_id; |
| 271 | |
| 272 | tmp = read_c0_status(); |
| 273 | __enable_fpu(); |
| 274 | fpu_id = read_32bit_cp1_register(CP1_REVISION); |
| 275 | write_c0_status(tmp); |
| 276 | return fpu_id; |
| 277 | } |
| 278 | |
| 279 | /* |
| 280 | * Check the CPU has an FPU the official way. |
| 281 | */ |
| 282 | static inline int __cpu_has_fpu(void) |
| 283 | { |
| 284 | return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE); |
| 285 | } |
| 286 | |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 287 | #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] | 288 | | MIPS_CPU_COUNTER) |
| 289 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 290 | 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] | 291 | { |
| 292 | switch (c->processor_id & 0xff00) { |
| 293 | case PRID_IMP_R2000: |
| 294 | c->cputype = CPU_R2000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 295 | __cpu_name[cpu] = "R2000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | c->isa_level = MIPS_CPU_ISA_I; |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 297 | c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | |
| 298 | MIPS_CPU_NOFPUEX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | if (__cpu_has_fpu()) |
| 300 | c->options |= MIPS_CPU_FPU; |
| 301 | c->tlbsize = 64; |
| 302 | break; |
| 303 | case PRID_IMP_R3000: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 304 | if ((c->processor_id & 0xff) == PRID_REV_R3000A) { |
| 305 | if (cpu_has_confreg()) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | c->cputype = CPU_R3081E; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 307 | __cpu_name[cpu] = "R3081"; |
| 308 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | c->cputype = CPU_R3000A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 310 | __cpu_name[cpu] = "R3000A"; |
| 311 | } |
| 312 | break; |
| 313 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | c->cputype = CPU_R3000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 315 | __cpu_name[cpu] = "R3000"; |
| 316 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | c->isa_level = MIPS_CPU_ISA_I; |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 318 | c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | |
| 319 | MIPS_CPU_NOFPUEX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | if (__cpu_has_fpu()) |
| 321 | c->options |= MIPS_CPU_FPU; |
| 322 | c->tlbsize = 64; |
| 323 | break; |
| 324 | case PRID_IMP_R4000: |
| 325 | if (read_c0_config() & CONF_SC) { |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 326 | if ((c->processor_id & 0xff) >= PRID_REV_R4400) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | c->cputype = CPU_R4400PC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 328 | __cpu_name[cpu] = "R4400PC"; |
| 329 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | c->cputype = CPU_R4000PC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 331 | __cpu_name[cpu] = "R4000PC"; |
| 332 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | } else { |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 334 | if ((c->processor_id & 0xff) >= PRID_REV_R4400) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | c->cputype = CPU_R4400SC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 336 | __cpu_name[cpu] = "R4400SC"; |
| 337 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | c->cputype = CPU_R4000SC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 339 | __cpu_name[cpu] = "R4000SC"; |
| 340 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | c->isa_level = MIPS_CPU_ISA_III; |
| 344 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 345 | MIPS_CPU_WATCH | MIPS_CPU_VCE | |
| 346 | MIPS_CPU_LLSC; |
| 347 | c->tlbsize = 48; |
| 348 | break; |
| 349 | case PRID_IMP_VR41XX: |
| 350 | switch (c->processor_id & 0xf0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | case PRID_REV_VR4111: |
| 352 | c->cputype = CPU_VR4111; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 353 | __cpu_name[cpu] = "NEC VR4111"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | case PRID_REV_VR4121: |
| 356 | c->cputype = CPU_VR4121; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 357 | __cpu_name[cpu] = "NEC VR4121"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | break; |
| 359 | case PRID_REV_VR4122: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 360 | if ((c->processor_id & 0xf) < 0x3) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | c->cputype = CPU_VR4122; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 362 | __cpu_name[cpu] = "NEC VR4122"; |
| 363 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | c->cputype = CPU_VR4181A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 365 | __cpu_name[cpu] = "NEC VR4181A"; |
| 366 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | break; |
| 368 | case PRID_REV_VR4130: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 369 | if ((c->processor_id & 0xf) < 0x4) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | c->cputype = CPU_VR4131; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 371 | __cpu_name[cpu] = "NEC VR4131"; |
| 372 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | c->cputype = CPU_VR4133; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 374 | __cpu_name[cpu] = "NEC VR4133"; |
| 375 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | break; |
| 377 | default: |
| 378 | printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n"); |
| 379 | c->cputype = CPU_VR41XX; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 380 | __cpu_name[cpu] = "NEC Vr41xx"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | break; |
| 382 | } |
| 383 | c->isa_level = MIPS_CPU_ISA_III; |
| 384 | c->options = R4K_OPTS; |
| 385 | c->tlbsize = 32; |
| 386 | break; |
| 387 | case PRID_IMP_R4300: |
| 388 | c->cputype = CPU_R4300; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 389 | __cpu_name[cpu] = "R4300"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | c->isa_level = MIPS_CPU_ISA_III; |
| 391 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 392 | MIPS_CPU_LLSC; |
| 393 | c->tlbsize = 32; |
| 394 | break; |
| 395 | case PRID_IMP_R4600: |
| 396 | c->cputype = CPU_R4600; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 397 | __cpu_name[cpu] = "R4600"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | c->isa_level = MIPS_CPU_ISA_III; |
Thiemo Seufer | 075e750 | 2005-07-27 21:48:12 +0000 | [diff] [blame] | 399 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 400 | MIPS_CPU_LLSC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | c->tlbsize = 48; |
| 402 | break; |
| 403 | #if 0 |
| 404 | case PRID_IMP_R4650: |
| 405 | /* |
| 406 | * This processor doesn't have an MMU, so it's not |
| 407 | * "real easy" to run Linux on it. It is left purely |
| 408 | * for documentation. Commented out because it shares |
| 409 | * it's c0_prid id number with the TX3900. |
| 410 | */ |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 411 | c->cputype = CPU_R4650; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 412 | __cpu_name[cpu] = "R4650"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | c->isa_level = MIPS_CPU_ISA_III; |
| 414 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; |
| 415 | c->tlbsize = 48; |
| 416 | break; |
| 417 | #endif |
| 418 | case PRID_IMP_TX39: |
| 419 | c->isa_level = MIPS_CPU_ISA_I; |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 420 | c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | |
| 422 | if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { |
| 423 | c->cputype = CPU_TX3927; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 424 | __cpu_name[cpu] = "TX3927"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | c->tlbsize = 64; |
| 426 | } else { |
| 427 | switch (c->processor_id & 0xff) { |
| 428 | case PRID_REV_TX3912: |
| 429 | c->cputype = CPU_TX3912; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 430 | __cpu_name[cpu] = "TX3912"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | c->tlbsize = 32; |
| 432 | break; |
| 433 | case PRID_REV_TX3922: |
| 434 | c->cputype = CPU_TX3922; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 435 | __cpu_name[cpu] = "TX3922"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | c->tlbsize = 64; |
| 437 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | } |
| 439 | } |
| 440 | break; |
| 441 | case PRID_IMP_R4700: |
| 442 | c->cputype = CPU_R4700; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 443 | __cpu_name[cpu] = "R4700"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | c->isa_level = MIPS_CPU_ISA_III; |
| 445 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 446 | MIPS_CPU_LLSC; |
| 447 | c->tlbsize = 48; |
| 448 | break; |
| 449 | case PRID_IMP_TX49: |
| 450 | c->cputype = CPU_TX49XX; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 451 | __cpu_name[cpu] = "R49XX"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | c->isa_level = MIPS_CPU_ISA_III; |
| 453 | c->options = R4K_OPTS | MIPS_CPU_LLSC; |
| 454 | if (!(c->processor_id & 0x08)) |
| 455 | c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR; |
| 456 | c->tlbsize = 48; |
| 457 | break; |
| 458 | case PRID_IMP_R5000: |
| 459 | c->cputype = CPU_R5000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 460 | __cpu_name[cpu] = "R5000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | c->isa_level = MIPS_CPU_ISA_IV; |
| 462 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 463 | MIPS_CPU_LLSC; |
| 464 | c->tlbsize = 48; |
| 465 | break; |
| 466 | case PRID_IMP_R5432: |
| 467 | c->cputype = CPU_R5432; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 468 | __cpu_name[cpu] = "R5432"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | c->isa_level = MIPS_CPU_ISA_IV; |
| 470 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 471 | MIPS_CPU_WATCH | MIPS_CPU_LLSC; |
| 472 | c->tlbsize = 48; |
| 473 | break; |
| 474 | case PRID_IMP_R5500: |
| 475 | c->cputype = CPU_R5500; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 476 | __cpu_name[cpu] = "R5500"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | c->isa_level = MIPS_CPU_ISA_IV; |
| 478 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 479 | MIPS_CPU_WATCH | MIPS_CPU_LLSC; |
| 480 | c->tlbsize = 48; |
| 481 | break; |
| 482 | case PRID_IMP_NEVADA: |
| 483 | c->cputype = CPU_NEVADA; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 484 | __cpu_name[cpu] = "Nevada"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | c->isa_level = MIPS_CPU_ISA_IV; |
| 486 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 487 | MIPS_CPU_DIVEC | MIPS_CPU_LLSC; |
| 488 | c->tlbsize = 48; |
| 489 | break; |
| 490 | case PRID_IMP_R6000: |
| 491 | c->cputype = CPU_R6000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 492 | __cpu_name[cpu] = "R6000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | c->isa_level = MIPS_CPU_ISA_II; |
| 494 | c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | |
| 495 | MIPS_CPU_LLSC; |
| 496 | c->tlbsize = 32; |
| 497 | break; |
| 498 | case PRID_IMP_R6000A: |
| 499 | c->cputype = CPU_R6000A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 500 | __cpu_name[cpu] = "R6000A"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | c->isa_level = MIPS_CPU_ISA_II; |
| 502 | c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | |
| 503 | MIPS_CPU_LLSC; |
| 504 | c->tlbsize = 32; |
| 505 | break; |
| 506 | case PRID_IMP_RM7000: |
| 507 | c->cputype = CPU_RM7000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 508 | __cpu_name[cpu] = "RM7000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | c->isa_level = MIPS_CPU_ISA_IV; |
| 510 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 511 | MIPS_CPU_LLSC; |
| 512 | /* |
| 513 | * Undocumented RM7000: Bit 29 in the info register of |
| 514 | * the RM7000 v2.0 indicates if the TLB has 48 or 64 |
| 515 | * entries. |
| 516 | * |
| 517 | * 29 1 => 64 entry JTLB |
| 518 | * 0 => 48 entry JTLB |
| 519 | */ |
| 520 | c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48; |
| 521 | break; |
| 522 | case PRID_IMP_RM9000: |
| 523 | c->cputype = CPU_RM9000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 524 | __cpu_name[cpu] = "RM9000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | c->isa_level = MIPS_CPU_ISA_IV; |
| 526 | c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 527 | MIPS_CPU_LLSC; |
| 528 | /* |
| 529 | * Bit 29 in the info register of the RM9000 |
| 530 | * indicates if the TLB has 48 or 64 entries. |
| 531 | * |
| 532 | * 29 1 => 64 entry JTLB |
| 533 | * 0 => 48 entry JTLB |
| 534 | */ |
| 535 | c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48; |
| 536 | break; |
| 537 | case PRID_IMP_R8000: |
| 538 | c->cputype = CPU_R8000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 539 | __cpu_name[cpu] = "RM8000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | c->isa_level = MIPS_CPU_ISA_IV; |
| 541 | c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | |
| 542 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 543 | MIPS_CPU_LLSC; |
| 544 | c->tlbsize = 384; /* has weird TLB: 3-way x 128 */ |
| 545 | break; |
| 546 | case PRID_IMP_R10000: |
| 547 | c->cputype = CPU_R10000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 548 | __cpu_name[cpu] = "R10000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | c->isa_level = MIPS_CPU_ISA_IV; |
Ralf Baechle | 8b36612 | 2005-11-22 17:53:59 +0000 | [diff] [blame] | 550 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 552 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
| 553 | MIPS_CPU_LLSC; |
| 554 | c->tlbsize = 64; |
| 555 | break; |
| 556 | case PRID_IMP_R12000: |
| 557 | c->cputype = CPU_R12000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 558 | __cpu_name[cpu] = "R12000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | c->isa_level = MIPS_CPU_ISA_IV; |
Ralf Baechle | 8b36612 | 2005-11-22 17:53:59 +0000 | [diff] [blame] | 560 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 562 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
| 563 | MIPS_CPU_LLSC; |
| 564 | c->tlbsize = 64; |
| 565 | break; |
Kumba | 44d921b | 2006-05-16 22:23:59 -0400 | [diff] [blame] | 566 | case PRID_IMP_R14000: |
| 567 | c->cputype = CPU_R14000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 568 | __cpu_name[cpu] = "R14000"; |
Kumba | 44d921b | 2006-05-16 22:23:59 -0400 | [diff] [blame] | 569 | c->isa_level = MIPS_CPU_ISA_IV; |
| 570 | c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | |
| 571 | MIPS_CPU_FPU | MIPS_CPU_32FPR | |
| 572 | MIPS_CPU_COUNTER | MIPS_CPU_WATCH | |
| 573 | MIPS_CPU_LLSC; |
| 574 | c->tlbsize = 64; |
| 575 | break; |
Fuxin Zhang | 2a21c73 | 2007-06-06 14:52:43 +0800 | [diff] [blame] | 576 | case PRID_IMP_LOONGSON2: |
| 577 | c->cputype = CPU_LOONGSON2; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 578 | __cpu_name[cpu] = "ICT Loongson-2"; |
Fuxin Zhang | 2a21c73 | 2007-06-06 14:52:43 +0800 | [diff] [blame] | 579 | c->isa_level = MIPS_CPU_ISA_III; |
| 580 | c->options = R4K_OPTS | |
| 581 | MIPS_CPU_FPU | MIPS_CPU_LLSC | |
| 582 | MIPS_CPU_32FPR; |
| 583 | c->tlbsize = 64; |
| 584 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 585 | } |
| 586 | } |
| 587 | |
Ralf Baechle | 234fcd1 | 2008-03-08 09:56:28 +0000 | [diff] [blame] | 588 | static char unknown_isa[] __cpuinitdata = KERN_ERR \ |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 589 | "Unsupported ISA type, c0.config0: %d."; |
| 590 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 591 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 593 | unsigned int config0; |
| 594 | int isa; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 595 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 596 | config0 = read_c0_config(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 598 | if (((config0 & MIPS_CONF_MT) >> 7) == 1) |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 599 | c->options |= MIPS_CPU_TLB; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 600 | isa = (config0 & MIPS_CONF_AT) >> 13; |
| 601 | switch (isa) { |
| 602 | case 0: |
Thiemo Seufer | 3a01c49 | 2006-07-03 13:30:01 +0100 | [diff] [blame] | 603 | switch ((config0 & MIPS_CONF_AR) >> 10) { |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 604 | case 0: |
| 605 | c->isa_level = MIPS_CPU_ISA_M32R1; |
| 606 | break; |
| 607 | case 1: |
| 608 | c->isa_level = MIPS_CPU_ISA_M32R2; |
| 609 | break; |
| 610 | default: |
| 611 | goto unknown; |
| 612 | } |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 613 | break; |
| 614 | case 2: |
Thiemo Seufer | 3a01c49 | 2006-07-03 13:30:01 +0100 | [diff] [blame] | 615 | switch ((config0 & MIPS_CONF_AR) >> 10) { |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 616 | case 0: |
| 617 | c->isa_level = MIPS_CPU_ISA_M64R1; |
| 618 | break; |
| 619 | case 1: |
| 620 | c->isa_level = MIPS_CPU_ISA_M64R2; |
| 621 | break; |
| 622 | default: |
| 623 | goto unknown; |
| 624 | } |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 625 | break; |
| 626 | default: |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 627 | goto unknown; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 628 | } |
| 629 | |
| 630 | return config0 & MIPS_CONF_M; |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 631 | |
| 632 | unknown: |
| 633 | panic(unknown_isa, config0); |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | static inline unsigned int decode_config1(struct cpuinfo_mips *c) |
| 637 | { |
| 638 | unsigned int config1; |
| 639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | config1 = read_c0_config1(); |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 641 | |
| 642 | if (config1 & MIPS_CONF1_MD) |
| 643 | c->ases |= MIPS_ASE_MDMX; |
| 644 | if (config1 & MIPS_CONF1_WR) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | c->options |= MIPS_CPU_WATCH; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 646 | if (config1 & MIPS_CONF1_CA) |
| 647 | c->ases |= MIPS_ASE_MIPS16; |
| 648 | if (config1 & MIPS_CONF1_EP) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | c->options |= MIPS_CPU_EJTAG; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 650 | if (config1 & MIPS_CONF1_FP) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | c->options |= MIPS_CPU_FPU; |
| 652 | c->options |= MIPS_CPU_32FPR; |
| 653 | } |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 654 | if (cpu_has_tlb) |
| 655 | c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; |
| 656 | |
| 657 | return config1 & MIPS_CONF_M; |
| 658 | } |
| 659 | |
| 660 | static inline unsigned int decode_config2(struct cpuinfo_mips *c) |
| 661 | { |
| 662 | unsigned int config2; |
| 663 | |
| 664 | config2 = read_c0_config2(); |
| 665 | |
| 666 | if (config2 & MIPS_CONF2_SL) |
| 667 | c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT; |
| 668 | |
| 669 | return config2 & MIPS_CONF_M; |
| 670 | } |
| 671 | |
| 672 | static inline unsigned int decode_config3(struct cpuinfo_mips *c) |
| 673 | { |
| 674 | unsigned int config3; |
| 675 | |
| 676 | config3 = read_c0_config3(); |
| 677 | |
| 678 | if (config3 & MIPS_CONF3_SM) |
| 679 | c->ases |= MIPS_ASE_SMARTMIPS; |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 680 | if (config3 & MIPS_CONF3_DSP) |
| 681 | c->ases |= MIPS_ASE_DSP; |
Ralf Baechle | 8f40611 | 2005-07-14 07:34:18 +0000 | [diff] [blame] | 682 | if (config3 & MIPS_CONF3_VINT) |
| 683 | c->options |= MIPS_CPU_VINT; |
| 684 | if (config3 & MIPS_CONF3_VEIC) |
| 685 | c->options |= MIPS_CPU_VEIC; |
| 686 | if (config3 & MIPS_CONF3_MT) |
Ralf Baechle | e0daad4 | 2007-02-05 00:10:11 +0000 | [diff] [blame] | 687 | c->ases |= MIPS_ASE_MIPSMT; |
Ralf Baechle | a369202 | 2007-07-10 17:33:02 +0100 | [diff] [blame] | 688 | if (config3 & MIPS_CONF3_ULRI) |
| 689 | c->options |= MIPS_CPU_ULRI; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 690 | |
| 691 | return config3 & MIPS_CONF_M; |
| 692 | } |
| 693 | |
Ralf Baechle | 234fcd1 | 2008-03-08 09:56:28 +0000 | [diff] [blame] | 694 | static void __cpuinit decode_configs(struct cpuinfo_mips *c) |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 695 | { |
Ralf Baechle | 558ce12 | 2008-10-29 12:33:34 +0000 | [diff] [blame] | 696 | int ok; |
| 697 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 698 | /* MIPS32 or MIPS64 compliant CPU. */ |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 699 | c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | |
| 700 | MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 701 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | c->scache.flags = MIPS_CACHE_NOT_PRESENT; |
| 703 | |
Ralf Baechle | 558ce12 | 2008-10-29 12:33:34 +0000 | [diff] [blame] | 704 | ok = decode_config0(c); /* Read Config registers. */ |
| 705 | BUG_ON(!ok); /* Arch spec violation! */ |
| 706 | if (ok) |
| 707 | ok = decode_config1(c); |
| 708 | if (ok) |
| 709 | ok = decode_config2(c); |
| 710 | if (ok) |
| 711 | ok = decode_config3(c); |
| 712 | |
| 713 | mips_probe_watch_registers(c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | } |
| 715 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 716 | 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] | 717 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 718 | decode_configs(c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | switch (c->processor_id & 0xff00) { |
| 720 | case PRID_IMP_4KC: |
| 721 | c->cputype = CPU_4KC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 722 | __cpu_name[cpu] = "MIPS 4Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 723 | break; |
| 724 | case PRID_IMP_4KEC: |
| 725 | c->cputype = CPU_4KEC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 726 | __cpu_name[cpu] = "MIPS 4KEc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | break; |
Ralf Baechle | 2b07bd0 | 2005-04-08 20:36:05 +0000 | [diff] [blame] | 728 | case PRID_IMP_4KECR2: |
| 729 | c->cputype = CPU_4KEC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 730 | __cpu_name[cpu] = "MIPS 4KEc"; |
Ralf Baechle | 2b07bd0 | 2005-04-08 20:36:05 +0000 | [diff] [blame] | 731 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | case PRID_IMP_4KSC: |
Ralf Baechle | 8afcb5d | 2005-10-04 15:01:26 +0100 | [diff] [blame] | 733 | case PRID_IMP_4KSD: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 734 | c->cputype = CPU_4KSC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 735 | __cpu_name[cpu] = "MIPS 4KSc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | break; |
| 737 | case PRID_IMP_5KC: |
| 738 | c->cputype = CPU_5KC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 739 | __cpu_name[cpu] = "MIPS 5Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 740 | break; |
| 741 | case PRID_IMP_20KC: |
| 742 | c->cputype = CPU_20KC; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 743 | __cpu_name[cpu] = "MIPS 20Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 744 | break; |
| 745 | case PRID_IMP_24K: |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 746 | case PRID_IMP_24KE: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 747 | c->cputype = CPU_24K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 748 | __cpu_name[cpu] = "MIPS 24Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | break; |
| 750 | case PRID_IMP_25KF: |
| 751 | c->cputype = CPU_25KF; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 752 | __cpu_name[cpu] = "MIPS 25Kc"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 753 | break; |
Ralf Baechle | bbc7f22 | 2005-07-12 16:12:05 +0000 | [diff] [blame] | 754 | case PRID_IMP_34K: |
| 755 | c->cputype = CPU_34K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 756 | __cpu_name[cpu] = "MIPS 34Kc"; |
Ralf Baechle | bbc7f22 | 2005-07-12 16:12:05 +0000 | [diff] [blame] | 757 | break; |
Chris Dearman | c620953 | 2006-05-02 14:08:46 +0100 | [diff] [blame] | 758 | case PRID_IMP_74K: |
| 759 | c->cputype = CPU_74K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 760 | __cpu_name[cpu] = "MIPS 74Kc"; |
Chris Dearman | c620953 | 2006-05-02 14:08:46 +0100 | [diff] [blame] | 761 | break; |
Ralf Baechle | 39b8d52 | 2008-04-28 17:14:26 +0100 | [diff] [blame] | 762 | case PRID_IMP_1004K: |
| 763 | c->cputype = CPU_1004K; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 764 | __cpu_name[cpu] = "MIPS 1004Kc"; |
Ralf Baechle | 39b8d52 | 2008-04-28 17:14:26 +0100 | [diff] [blame] | 765 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 766 | } |
Chris Dearman | 0b6d497 | 2007-09-13 12:32:02 +0100 | [diff] [blame] | 767 | |
| 768 | spram_config(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 769 | } |
| 770 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 771 | 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] | 772 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 773 | decode_configs(c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 774 | switch (c->processor_id & 0xff00) { |
| 775 | case PRID_IMP_AU1_REV1: |
| 776 | case PRID_IMP_AU1_REV2: |
Manuel Lauss | 270717a | 2009-03-25 17:49:28 +0100 | [diff] [blame] | 777 | c->cputype = CPU_ALCHEMY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 778 | switch ((c->processor_id >> 24) & 0xff) { |
| 779 | case 0: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 780 | __cpu_name[cpu] = "Au1000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 781 | break; |
| 782 | case 1: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 783 | __cpu_name[cpu] = "Au1500"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 784 | break; |
| 785 | case 2: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 786 | __cpu_name[cpu] = "Au1100"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | break; |
| 788 | case 3: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 789 | __cpu_name[cpu] = "Au1550"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 790 | break; |
Pete Popov | e3ad1c2 | 2005-03-01 06:33:16 +0000 | [diff] [blame] | 791 | case 4: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 792 | __cpu_name[cpu] = "Au1200"; |
Manuel Lauss | 270717a | 2009-03-25 17:49:28 +0100 | [diff] [blame] | 793 | if ((c->processor_id & 0xff) == 2) |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 794 | __cpu_name[cpu] = "Au1250"; |
Manuel Lauss | 237cfee | 2007-12-06 09:07:55 +0100 | [diff] [blame] | 795 | break; |
| 796 | case 5: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 797 | __cpu_name[cpu] = "Au1210"; |
Pete Popov | e3ad1c2 | 2005-03-01 06:33:16 +0000 | [diff] [blame] | 798 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 799 | default: |
Manuel Lauss | 270717a | 2009-03-25 17:49:28 +0100 | [diff] [blame] | 800 | __cpu_name[cpu] = "Au1xxx"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 801 | break; |
| 802 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 803 | break; |
| 804 | } |
| 805 | } |
| 806 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 807 | 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] | 808 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 809 | decode_configs(c); |
Ralf Baechle | 02cf211 | 2005-10-01 13:06:32 +0100 | [diff] [blame] | 810 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 811 | switch (c->processor_id & 0xff00) { |
| 812 | case PRID_IMP_SB1: |
| 813 | c->cputype = CPU_SB1; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 814 | __cpu_name[cpu] = "SiByte SB1"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 815 | /* FPU in pass1 is known to have issues. */ |
Ralf Baechle | aa32374 | 2006-05-29 00:02:12 +0100 | [diff] [blame] | 816 | if ((c->processor_id & 0xff) < 0x02) |
Ralf Baechle | 010b853 | 2006-01-29 18:42:08 +0000 | [diff] [blame] | 817 | c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 818 | break; |
Andrew Isaacson | 93ce2f52 | 2005-10-19 23:56:20 -0700 | [diff] [blame] | 819 | case PRID_IMP_SB1A: |
| 820 | c->cputype = CPU_SB1A; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 821 | __cpu_name[cpu] = "SiByte SB1A"; |
Andrew Isaacson | 93ce2f52 | 2005-10-19 23:56:20 -0700 | [diff] [blame] | 822 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 823 | } |
| 824 | } |
| 825 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 826 | 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] | 827 | { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 828 | decode_configs(c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 829 | switch (c->processor_id & 0xff00) { |
| 830 | case PRID_IMP_SR71000: |
| 831 | c->cputype = CPU_SR71000; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 832 | __cpu_name[cpu] = "Sandcraft SR71000"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 833 | c->scache.ways = 8; |
| 834 | c->tlbsize = 64; |
| 835 | break; |
| 836 | } |
| 837 | } |
| 838 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 839 | 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] | 840 | { |
| 841 | decode_configs(c); |
| 842 | switch (c->processor_id & 0xff00) { |
| 843 | case PRID_IMP_PR4450: |
| 844 | c->cputype = CPU_PR4450; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 845 | __cpu_name[cpu] = "Philips PR4450"; |
Ralf Baechle | e7958bb | 2005-12-08 13:00:20 +0000 | [diff] [blame] | 846 | c->isa_level = MIPS_CPU_ISA_M32R1; |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 847 | break; |
Pete Popov | bdf21b1 | 2005-07-14 17:47:57 +0000 | [diff] [blame] | 848 | } |
| 849 | } |
| 850 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 851 | 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] | 852 | { |
| 853 | decode_configs(c); |
| 854 | switch (c->processor_id & 0xff00) { |
| 855 | case PRID_IMP_BCM3302: |
Maxime Bizon | 0de663e | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 856 | /* same as PRID_IMP_BCM6338 */ |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 857 | c->cputype = CPU_BCM3302; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 858 | __cpu_name[cpu] = "Broadcom BCM3302"; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 859 | break; |
| 860 | case PRID_IMP_BCM4710: |
| 861 | c->cputype = CPU_BCM4710; |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 862 | __cpu_name[cpu] = "Broadcom BCM4710"; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 863 | break; |
Maxime Bizon | 0de663e | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 864 | case PRID_IMP_BCM6345: |
| 865 | c->cputype = CPU_BCM6345; |
| 866 | __cpu_name[cpu] = "Broadcom BCM6345"; |
| 867 | break; |
| 868 | case PRID_IMP_BCM6348: |
| 869 | c->cputype = CPU_BCM6348; |
| 870 | __cpu_name[cpu] = "Broadcom BCM6348"; |
| 871 | break; |
| 872 | case PRID_IMP_BCM4350: |
| 873 | switch (c->processor_id & 0xf0) { |
| 874 | case PRID_REV_BCM6358: |
| 875 | c->cputype = CPU_BCM6358; |
| 876 | __cpu_name[cpu] = "Broadcom BCM6358"; |
| 877 | break; |
| 878 | default: |
| 879 | c->cputype = CPU_UNKNOWN; |
| 880 | break; |
| 881 | } |
| 882 | break; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 883 | } |
| 884 | } |
| 885 | |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 886 | static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) |
| 887 | { |
| 888 | decode_configs(c); |
| 889 | switch (c->processor_id & 0xff00) { |
| 890 | case PRID_IMP_CAVIUM_CN38XX: |
| 891 | case PRID_IMP_CAVIUM_CN31XX: |
| 892 | case PRID_IMP_CAVIUM_CN30XX: |
| 893 | case PRID_IMP_CAVIUM_CN58XX: |
| 894 | case PRID_IMP_CAVIUM_CN56XX: |
| 895 | case PRID_IMP_CAVIUM_CN50XX: |
| 896 | case PRID_IMP_CAVIUM_CN52XX: |
| 897 | c->cputype = CPU_CAVIUM_OCTEON; |
| 898 | __cpu_name[cpu] = "Cavium Octeon"; |
| 899 | break; |
| 900 | default: |
| 901 | printk(KERN_INFO "Unknown Octeon chip!\n"); |
| 902 | c->cputype = CPU_UNKNOWN; |
| 903 | break; |
| 904 | } |
| 905 | } |
| 906 | |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 907 | const char *__cpu_name[NR_CPUS]; |
| 908 | |
Ralf Baechle | 234fcd1 | 2008-03-08 09:56:28 +0000 | [diff] [blame] | 909 | __cpuinit void cpu_probe(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 910 | { |
| 911 | struct cpuinfo_mips *c = ¤t_cpu_data; |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 912 | unsigned int cpu = smp_processor_id(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 913 | |
| 914 | c->processor_id = PRID_IMP_UNKNOWN; |
| 915 | c->fpu_id = FPIR_IMP_NONE; |
| 916 | c->cputype = CPU_UNKNOWN; |
| 917 | |
| 918 | c->processor_id = read_c0_prid(); |
| 919 | switch (c->processor_id & 0xff0000) { |
| 920 | case PRID_COMP_LEGACY: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 921 | cpu_probe_legacy(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 922 | break; |
| 923 | case PRID_COMP_MIPS: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 924 | cpu_probe_mips(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 925 | break; |
| 926 | case PRID_COMP_ALCHEMY: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 927 | cpu_probe_alchemy(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 928 | break; |
| 929 | case PRID_COMP_SIBYTE: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 930 | cpu_probe_sibyte(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 931 | break; |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 932 | case PRID_COMP_BROADCOM: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 933 | cpu_probe_broadcom(c, cpu); |
Aurelien Jarno | 1c0c13e | 2007-09-25 15:40:12 +0200 | [diff] [blame] | 934 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 935 | case PRID_COMP_SANDCRAFT: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 936 | cpu_probe_sandcraft(c, cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 937 | break; |
Daniel Laird | a92b058 | 2008-03-06 09:07:18 +0000 | [diff] [blame] | 938 | case PRID_COMP_NXP: |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 939 | cpu_probe_nxp(c, cpu); |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 940 | break; |
David Daney | 0dd4781 | 2008-12-11 15:33:26 -0800 | [diff] [blame] | 941 | case PRID_COMP_CAVIUM: |
| 942 | cpu_probe_cavium(c, cpu); |
| 943 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 944 | } |
Franck Bui-Huu | dec8b1c | 2007-10-08 16:11:51 +0200 | [diff] [blame] | 945 | |
Ralf Baechle | cea7e2d | 2008-10-30 13:38:45 +0000 | [diff] [blame] | 946 | BUG_ON(!__cpu_name[cpu]); |
| 947 | BUG_ON(c->cputype == CPU_UNKNOWN); |
| 948 | |
Franck Bui-Huu | dec8b1c | 2007-10-08 16:11:51 +0200 | [diff] [blame] | 949 | /* |
| 950 | * Platform code can force the cpu type to optimize code |
| 951 | * generation. In that case be sure the cpu type is correctly |
| 952 | * manually setup otherwise it could trigger some nasty bugs. |
| 953 | */ |
| 954 | BUG_ON(current_cpu_type() != c->cputype); |
| 955 | |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 956 | if (c->options & MIPS_CPU_FPU) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 957 | c->fpu_id = cpu_get_fpu_id(); |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 958 | |
Ralf Baechle | e7958bb | 2005-12-08 13:00:20 +0000 | [diff] [blame] | 959 | if (c->isa_level == MIPS_CPU_ISA_M32R1 || |
Ralf Baechle | b4672d3 | 2005-12-08 14:04:24 +0000 | [diff] [blame] | 960 | c->isa_level == MIPS_CPU_ISA_M32R2 || |
| 961 | c->isa_level == MIPS_CPU_ISA_M64R1 || |
| 962 | c->isa_level == MIPS_CPU_ISA_M64R2) { |
Ralf Baechle | 4194318 | 2005-05-05 16:45:59 +0000 | [diff] [blame] | 963 | if (c->fpu_id & MIPS_FPIR_3D) |
| 964 | c->ases |= MIPS_ASE_MIPS3D; |
| 965 | } |
| 966 | } |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 967 | |
Ralf Baechle | f6771db | 2007-11-08 18:02:29 +0000 | [diff] [blame] | 968 | if (cpu_has_mips_r2) |
| 969 | c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; |
| 970 | else |
| 971 | c->srsets = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 972 | } |
| 973 | |
Ralf Baechle | 234fcd1 | 2008-03-08 09:56:28 +0000 | [diff] [blame] | 974 | __cpuinit void cpu_report(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 975 | { |
| 976 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| 977 | |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 978 | printk(KERN_INFO "CPU revision is: %08x (%s)\n", |
| 979 | c->processor_id, cpu_name_string()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 980 | if (c->options & MIPS_CPU_FPU) |
Ralf Baechle | 9966db25 | 2007-10-11 23:46:17 +0100 | [diff] [blame] | 981 | printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 982 | } |