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