cpu-probe.c 51.3 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4
/*
 * Processor capabilities determination functions.
 *
 * Copyright (C) xxxx  the Anonymous
5
 * Copyright (C) 1994 - 2006 Ralf Baechle
6
 * Copyright (C) 2003, 2004  Maciej W. Rozycki
R
Ralf Baechle 已提交
7
 * Copyright (C) 2001, 2004, 2011, 2012	 MIPS Technologies, Inc.
L
Linus Torvalds 已提交
8 9 10 11 12 13 14 15 16
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
17
#include <linux/smp.h>
L
Linus Torvalds 已提交
18
#include <linux/stddef.h>
19
#include <linux/export.h>
L
Linus Torvalds 已提交
20

21
#include <asm/bugs.h>
L
Linus Torvalds 已提交
22
#include <asm/cpu.h>
23
#include <asm/cpu-features.h>
24
#include <asm/cpu-type.h>
L
Linus Torvalds 已提交
25 26
#include <asm/fpu.h>
#include <asm/mipsregs.h>
27
#include <asm/mipsmtregs.h>
P
Paul Burton 已提交
28
#include <asm/msa.h>
29
#include <asm/watch.h>
30
#include <asm/elf.h>
31
#include <asm/pgtable-bits.h>
32
#include <asm/spram.h>
33 34
#include <asm/uaccess.h>

35 36 37
/* Hardware capabilities */
unsigned int elf_hwcap __read_mostly;

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
/*
 * Get the FPU Implementation/Revision.
 */
static inline unsigned long cpu_get_fpu_id(void)
{
	unsigned long tmp, fpu_id;

	tmp = read_c0_status();
	__enable_fpu(FPU_AS_IS);
	fpu_id = read_32bit_cp1_register(CP1_REVISION);
	write_c0_status(tmp);
	return fpu_id;
}

/*
 * Check if the CPU has an external FPU.
 */
static inline int __cpu_has_fpu(void)
{
	return (cpu_get_fpu_id() & FPIR_IMP_MASK) != FPIR_IMP_NONE;
}

static inline unsigned long cpu_get_msa_id(void)
{
	unsigned long status, msa_id;

	status = read_c0_status();
	__enable_fpu(FPU_64BIT);
	enable_msa();
	msa_id = read_msa_ir();
	disable_msa();
	write_c0_status(status);
	return msa_id;
}

73 74 75 76 77 78 79
/*
 * Determine the FCSR mask for FPU hardware.
 */
static inline void cpu_set_fpu_fcsr_mask(struct cpuinfo_mips *c)
{
	unsigned long sr, mask, fcsr, fcsr0, fcsr1;

80
	fcsr = c->fpu_csr31;
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
	mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM;

	sr = read_c0_status();
	__enable_fpu(FPU_AS_IS);

	fcsr0 = fcsr & mask;
	write_32bit_cp1_register(CP1_STATUS, fcsr0);
	fcsr0 = read_32bit_cp1_register(CP1_STATUS);

	fcsr1 = fcsr | ~mask;
	write_32bit_cp1_register(CP1_STATUS, fcsr1);
	fcsr1 = read_32bit_cp1_register(CP1_STATUS);

	write_32bit_cp1_register(CP1_STATUS, fcsr);

	write_c0_status(sr);

	c->fpu_msk31 = ~(fcsr0 ^ fcsr1) & ~mask;
}

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
/*
 * Determine the IEEE 754 NaN encodings and ABS.fmt/NEG.fmt execution modes
 * supported by FPU hardware.
 */
static void cpu_set_fpu_2008(struct cpuinfo_mips *c)
{
	if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
			    MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
			    MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
		unsigned long sr, fir, fcsr, fcsr0, fcsr1;

		sr = read_c0_status();
		__enable_fpu(FPU_AS_IS);

		fir = read_32bit_cp1_register(CP1_REVISION);
		if (fir & MIPS_FPIR_HAS2008) {
			fcsr = read_32bit_cp1_register(CP1_STATUS);

			fcsr0 = fcsr & ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);
			write_32bit_cp1_register(CP1_STATUS, fcsr0);
			fcsr0 = read_32bit_cp1_register(CP1_STATUS);

			fcsr1 = fcsr | FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
			write_32bit_cp1_register(CP1_STATUS, fcsr1);
			fcsr1 = read_32bit_cp1_register(CP1_STATUS);

			write_32bit_cp1_register(CP1_STATUS, fcsr);

			if (!(fcsr0 & FPU_CSR_NAN2008))
				c->options |= MIPS_CPU_NAN_LEGACY;
			if (fcsr1 & FPU_CSR_NAN2008)
				c->options |= MIPS_CPU_NAN_2008;

			if ((fcsr0 ^ fcsr1) & FPU_CSR_ABS2008)
				c->fpu_msk31 &= ~FPU_CSR_ABS2008;
			else
				c->fpu_csr31 |= fcsr & FPU_CSR_ABS2008;

			if ((fcsr0 ^ fcsr1) & FPU_CSR_NAN2008)
				c->fpu_msk31 &= ~FPU_CSR_NAN2008;
			else
				c->fpu_csr31 |= fcsr & FPU_CSR_NAN2008;
		} else {
			c->options |= MIPS_CPU_NAN_LEGACY;
		}

		write_c0_status(sr);
	} else {
		c->options |= MIPS_CPU_NAN_LEGACY;
	}
}

/*
154 155 156 157 158 159 160 161 162 163
 * IEEE 754 conformance mode to use.  Affects the NaN encoding and the
 * ABS.fmt/NEG.fmt execution mode.
 */
static enum { STRICT, LEGACY, STD2008, RELAXED } ieee754 = STRICT;

/*
 * Set the IEEE 754 NaN encodings and the ABS.fmt/NEG.fmt execution modes
 * to support by the FPU emulator according to the IEEE 754 conformance
 * mode selected.  Note that "relaxed" straps the emulator so that it
 * allows 2008-NaN binaries even for legacy processors.
164 165 166
 */
static void cpu_set_nofpu_2008(struct cpuinfo_mips *c)
{
167
	c->options &= ~(MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY);
168
	c->fpu_csr31 &= ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);
169 170 171 172 173 174 175 176 177 178 179 180 181 182
	c->fpu_msk31 &= ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);

	switch (ieee754) {
	case STRICT:
		if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
				    MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
				    MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
			c->options |= MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY;
		} else {
			c->options |= MIPS_CPU_NAN_LEGACY;
			c->fpu_msk31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
		}
		break;
	case LEGACY:
183 184
		c->options |= MIPS_CPU_NAN_LEGACY;
		c->fpu_msk31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
185 186 187 188 189 190 191 192 193
		break;
	case STD2008:
		c->options |= MIPS_CPU_NAN_2008;
		c->fpu_csr31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
		c->fpu_msk31 |= FPU_CSR_ABS2008 | FPU_CSR_NAN2008;
		break;
	case RELAXED:
		c->options |= MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY;
		break;
194 195 196
	}
}

197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
/*
 * Override the IEEE 754 NaN encoding and ABS.fmt/NEG.fmt execution mode
 * according to the "ieee754=" parameter.
 */
static void cpu_set_nan_2008(struct cpuinfo_mips *c)
{
	switch (ieee754) {
	case STRICT:
		mips_use_nan_legacy = !!cpu_has_nan_legacy;
		mips_use_nan_2008 = !!cpu_has_nan_2008;
		break;
	case LEGACY:
		mips_use_nan_legacy = !!cpu_has_nan_legacy;
		mips_use_nan_2008 = !cpu_has_nan_legacy;
		break;
	case STD2008:
		mips_use_nan_legacy = !cpu_has_nan_2008;
		mips_use_nan_2008 = !!cpu_has_nan_2008;
		break;
	case RELAXED:
		mips_use_nan_legacy = true;
		mips_use_nan_2008 = true;
		break;
	}
}

/*
 * IEEE 754 NaN encoding and ABS.fmt/NEG.fmt execution mode override
 * settings:
 *
 * strict:  accept binaries that request a NaN encoding supported by the FPU
 * legacy:  only accept legacy-NaN binaries
 * 2008:    only accept 2008-NaN binaries
 * relaxed: accept any binaries regardless of whether supported by the FPU
 */
static int __init ieee754_setup(char *s)
{
	if (!s)
		return -1;
	else if (!strcmp(s, "strict"))
		ieee754 = STRICT;
	else if (!strcmp(s, "legacy"))
		ieee754 = LEGACY;
	else if (!strcmp(s, "2008"))
		ieee754 = STD2008;
	else if (!strcmp(s, "relaxed"))
		ieee754 = RELAXED;
	else
		return -1;

	if (!(boot_cpu_data.options & MIPS_CPU_FPU))
		cpu_set_nofpu_2008(&boot_cpu_data);
	cpu_set_nan_2008(&boot_cpu_data);

	return 0;
}

early_param("ieee754", ieee754_setup);

256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
/*
 * Set the FIR feature flags for the FPU emulator.
 */
static void cpu_set_nofpu_id(struct cpuinfo_mips *c)
{
	u32 value;

	value = 0;
	if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
			    MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
			    MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
		value |= MIPS_FPIR_D | MIPS_FPIR_S;
	if (c->isa_level & (MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
			    MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
		value |= MIPS_FPIR_F64 | MIPS_FPIR_L | MIPS_FPIR_W;
271 272
	if (c->options & MIPS_CPU_NAN_2008)
		value |= MIPS_FPIR_HAS2008;
273 274 275
	c->fpu_id = value;
}

276 277 278
/* Determined FPU emulator mask to use for the boot CPU with "nofpu".  */
static unsigned int mips_nofpu_msk31;

279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
/*
 * Set options for FPU hardware.
 */
static void cpu_set_fpu_opts(struct cpuinfo_mips *c)
{
	c->fpu_id = cpu_get_fpu_id();
	mips_nofpu_msk31 = c->fpu_msk31;

	if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
			    MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
			    MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) {
		if (c->fpu_id & MIPS_FPIR_3D)
			c->ases |= MIPS_ASE_MIPS3D;
		if (c->fpu_id & MIPS_FPIR_FREP)
			c->options |= MIPS_CPU_FRE;
	}

	cpu_set_fpu_fcsr_mask(c);
297
	cpu_set_fpu_2008(c);
298
	cpu_set_nan_2008(c);
299 300 301 302 303 304 305 306 307 308
}

/*
 * Set options for the FPU emulator.
 */
static void cpu_set_nofpu_opts(struct cpuinfo_mips *c)
{
	c->options &= ~MIPS_CPU_FPU;
	c->fpu_msk31 = mips_nofpu_msk31;

309
	cpu_set_nofpu_2008(c);
310
	cpu_set_nan_2008(c);
311 312 313
	cpu_set_nofpu_id(c);
}

314
static int mips_fpu_disabled;
315 316 317

static int __init fpu_disable(char *s)
{
318
	cpu_set_nofpu_opts(&boot_cpu_data);
319 320 321 322 323 324 325
	mips_fpu_disabled = 1;

	return 1;
}

__setup("nofpu", fpu_disable);

326
int mips_dsp_disabled;
327 328 329

static int __init dsp_disable(char *s)
{
330
	cpu_data[0].ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
331 332 333 334 335 336 337
	mips_dsp_disabled = 1;

	return 1;
}

__setup("nodsp", dsp_disable);

338 339 340 341 342 343 344 345 346 347 348 349 350 351
static int mips_htw_disabled;

static int __init htw_disable(char *s)
{
	mips_htw_disabled = 1;
	cpu_data[0].options &= ~MIPS_CPU_HTW;
	write_c0_pwctl(read_c0_pwctl() &
		       ~(1 << MIPS_PWCTL_PWEN_SHIFT));

	return 1;
}

__setup("nohtw", htw_disable);

352 353 354
static int mips_ftlb_disabled;
static int mips_has_ftlb_configured;

355 356 357 358 359 360
enum ftlb_flags {
	FTLB_EN		= 1 << 0,
	FTLB_SET_PROB	= 1 << 1,
};

static int set_ftlb_enable(struct cpuinfo_mips *c, enum ftlb_flags flags);
361 362 363 364 365 366 367 368 369 370 371 372 373

static int __init ftlb_disable(char *s)
{
	unsigned int config4, mmuextdef;

	/*
	 * If the core hasn't done any FTLB configuration, there is nothing
	 * for us to do here.
	 */
	if (!mips_has_ftlb_configured)
		return 1;

	/* Disable it in the boot cpu */
374 375 376 377
	if (set_ftlb_enable(&cpu_data[0], 0)) {
		pr_warn("Can't turn FTLB off\n");
		return 1;
	}
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416

	back_to_back_c0_hazard();

	config4 = read_c0_config4();

	/* Check that FTLB has been disabled */
	mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF;
	/* MMUSIZEEXT == VTLB ON, FTLB OFF */
	if (mmuextdef == MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT) {
		/* This should never happen */
		pr_warn("FTLB could not be disabled!\n");
		return 1;
	}

	mips_ftlb_disabled = 1;
	mips_has_ftlb_configured = 0;

	/*
	 * noftlb is mainly used for debug purposes so print
	 * an informative message instead of using pr_debug()
	 */
	pr_info("FTLB has been disabled\n");

	/*
	 * Some of these bits are duplicated in the decode_config4.
	 * MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT is the only possible case
	 * once FTLB has been disabled so undo what decode_config4 did.
	 */
	cpu_data[0].tlbsize -= cpu_data[0].tlbsizeftlbways *
			       cpu_data[0].tlbsizeftlbsets;
	cpu_data[0].tlbsizeftlbsets = 0;
	cpu_data[0].tlbsizeftlbways = 0;

	return 1;
}

__setup("noftlb", ftlb_disable);


M
Marc St-Jean 已提交
417 418 419 420
static inline void check_errata(void)
{
	struct cpuinfo_mips *c = &current_cpu_data;

421
	switch (current_cpu_type()) {
M
Marc St-Jean 已提交
422 423 424
	case CPU_34K:
		/*
		 * Erratum "RPS May Cause Incorrect Instruction Execution"
R
Ralf Baechle 已提交
425
		 * This code only handles VPE0, any SMP/RTOS code
M
Marc St-Jean 已提交
426 427 428 429 430 431 432 433 434 435
		 * making use of VPE1 will be responsable for that VPE.
		 */
		if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2)
			write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS);
		break;
	default:
		break;
	}
}

L
Linus Torvalds 已提交
436 437
void __init check_bugs32(void)
{
M
Marc St-Jean 已提交
438
	check_errata();
L
Linus Torvalds 已提交
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
}

/*
 * Probe whether cpu has config register by trying to play with
 * alternate cache bit and see whether it matters.
 * It's used by cpu_probe to distinguish between R3000A and R3081.
 */
static inline int cpu_has_confreg(void)
{
#ifdef CONFIG_CPU_R3000
	extern unsigned long r3k_cache_size(unsigned long);
	unsigned long size1, size2;
	unsigned long cfg = read_c0_conf();

	size1 = r3k_cache_size(ST0_ISC);
	write_c0_conf(cfg ^ R30XX_CONF_AC);
	size2 = r3k_cache_size(ST0_ISC);
	write_c0_conf(cfg);
	return size1 != size2;
#else
	return 0;
#endif
}

463 464 465 466 467 468
static inline void set_elf_platform(int cpu, const char *plat)
{
	if (cpu == 0)
		__elf_platform = plat;
}

469 470 471
static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
{
#ifdef __NEED_VMBITS_PROBE
472
	write_c0_entryhi(0x3fffffffffffe000ULL);
473
	back_to_back_c0_hazard();
474
	c->vmbits = fls64(read_c0_entryhi() & 0x3fffffffffffe000ULL);
475 476 477
#endif
}

478
static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
479 480 481 482 483 484 485 486 487 488 489
{
	switch (isa) {
	case MIPS_CPU_ISA_M64R2:
		c->isa_level |= MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2;
	case MIPS_CPU_ISA_M64R1:
		c->isa_level |= MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1;
	case MIPS_CPU_ISA_V:
		c->isa_level |= MIPS_CPU_ISA_V;
	case MIPS_CPU_ISA_IV:
		c->isa_level |= MIPS_CPU_ISA_IV;
	case MIPS_CPU_ISA_III:
490
		c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III;
491 492
		break;

493 494 495 496 497 498 499
	/* R6 incompatible with everything else */
	case MIPS_CPU_ISA_M64R6:
		c->isa_level |= MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6;
	case MIPS_CPU_ISA_M32R6:
		c->isa_level |= MIPS_CPU_ISA_M32R6;
		/* Break here so we don't add incompatible ISAs */
		break;
500 501 502 503 504 505 506 507 508 509
	case MIPS_CPU_ISA_M32R2:
		c->isa_level |= MIPS_CPU_ISA_M32R2;
	case MIPS_CPU_ISA_M32R1:
		c->isa_level |= MIPS_CPU_ISA_M32R1;
	case MIPS_CPU_ISA_II:
		c->isa_level |= MIPS_CPU_ISA_II;
		break;
	}
}

510
static char unknown_isa[] = KERN_ERR \
511 512
	"Unsupported ISA type, c0.config0: %d.";

513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
static unsigned int calculate_ftlb_probability(struct cpuinfo_mips *c)
{

	unsigned int probability = c->tlbsize / c->tlbsizevtlb;

	/*
	 * 0 = All TLBWR instructions go to FTLB
	 * 1 = 15:1: For every 16 TBLWR instructions, 15 go to the
	 * FTLB and 1 goes to the VTLB.
	 * 2 = 7:1: As above with 7:1 ratio.
	 * 3 = 3:1: As above with 3:1 ratio.
	 *
	 * Use the linear midpoint as the probability threshold.
	 */
	if (probability >= 12)
		return 1;
	else if (probability >= 6)
		return 2;
	else
		/*
		 * So FTLB is less than 4 times bigger than VTLB.
		 * A 3:1 ratio can still be useful though.
		 */
		return 3;
}

539
static int set_ftlb_enable(struct cpuinfo_mips *c, enum ftlb_flags flags)
L
Leonid Yegoshin 已提交
540
{
541
	unsigned int config;
542 543 544 545 546

	/* It's implementation dependent how the FTLB can be enabled */
	switch (c->cputype) {
	case CPU_PROAPTIV:
	case CPU_P5600:
547
	case CPU_P6600:
548
		/* proAptiv & related cores use Config6 to enable the FTLB */
549
		config = read_c0_config6();
550 551 552

		if (flags & FTLB_EN)
			config |= MIPS_CONF6_FTLBEN;
L
Leonid Yegoshin 已提交
553
		else
554 555 556 557 558 559 560 561 562
			config &= ~MIPS_CONF6_FTLBEN;

		if (flags & FTLB_SET_PROB) {
			config &= ~(3 << MIPS_CONF6_FTLBP_SHIFT);
			config |= calculate_ftlb_probability(c)
				  << MIPS_CONF6_FTLBP_SHIFT;
		}

		write_c0_config6(config);
563 564
		break;
	case CPU_I6400:
P
Paul Burton 已提交
565
		/* There's no way to disable the FTLB */
566 567 568
		if (!(flags & FTLB_EN))
			return 1;
		return 0;
569
	case CPU_LOONGSON3:
570 571 572
		/* Flush ITLB, DTLB, VTLB and FTLB */
		write_c0_diag(LOONGSON_DIAG_ITLB | LOONGSON_DIAG_DTLB |
			      LOONGSON_DIAG_VTLB | LOONGSON_DIAG_FTLB);
573 574
		/* Loongson-3 cores use Config6 to enable the FTLB */
		config = read_c0_config6();
575
		if (flags & FTLB_EN)
576 577 578 579 580 581
			/* Enable FTLB */
			write_c0_config6(config & ~MIPS_CONF6_FTLBDIS);
		else
			/* Disable FTLB */
			write_c0_config6(config | MIPS_CONF6_FTLBDIS);
		break;
582 583
	default:
		return 1;
L
Leonid Yegoshin 已提交
584
	}
585 586

	return 0;
L
Leonid Yegoshin 已提交
587 588
}

589 590 591
static inline unsigned int decode_config0(struct cpuinfo_mips *c)
{
	unsigned int config0;
592
	int isa, mt;
593 594 595

	config0 = read_c0_config();

L
Leonid Yegoshin 已提交
596 597 598
	/*
	 * Look for Standard TLB or Dual VTLB and FTLB
	 */
599 600
	mt = config0 & MIPS_CONF_MT;
	if (mt == MIPS_CONF_MT_TLB)
601
		c->options |= MIPS_CPU_TLB;
602 603
	else if (mt == MIPS_CONF_MT_FTLB)
		c->options |= MIPS_CPU_TLB | MIPS_CPU_FTLB;
L
Leonid Yegoshin 已提交
604

605 606 607 608 609
	isa = (config0 & MIPS_CONF_AT) >> 13;
	switch (isa) {
	case 0:
		switch ((config0 & MIPS_CONF_AR) >> 10) {
		case 0:
610
			set_isa(c, MIPS_CPU_ISA_M32R1);
611 612
			break;
		case 1:
613
			set_isa(c, MIPS_CPU_ISA_M32R2);
614
			break;
615 616 617
		case 2:
			set_isa(c, MIPS_CPU_ISA_M32R6);
			break;
618 619 620 621 622 623 624
		default:
			goto unknown;
		}
		break;
	case 2:
		switch ((config0 & MIPS_CONF_AR) >> 10) {
		case 0:
625
			set_isa(c, MIPS_CPU_ISA_M64R1);
626 627
			break;
		case 1:
628
			set_isa(c, MIPS_CPU_ISA_M64R2);
629
			break;
630 631 632
		case 2:
			set_isa(c, MIPS_CPU_ISA_M64R6);
			break;
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
		default:
			goto unknown;
		}
		break;
	default:
		goto unknown;
	}

	return config0 & MIPS_CONF_M;

unknown:
	panic(unknown_isa, config0);
}

static inline unsigned int decode_config1(struct cpuinfo_mips *c)
{
	unsigned int config1;

	config1 = read_c0_config1();

	if (config1 & MIPS_CONF1_MD)
		c->ases |= MIPS_ASE_MDMX;
J
James Hogan 已提交
655 656
	if (config1 & MIPS_CONF1_PC)
		c->options |= MIPS_CPU_PERF;
657 658 659 660 661 662 663 664 665 666
	if (config1 & MIPS_CONF1_WR)
		c->options |= MIPS_CPU_WATCH;
	if (config1 & MIPS_CONF1_CA)
		c->ases |= MIPS_ASE_MIPS16;
	if (config1 & MIPS_CONF1_EP)
		c->options |= MIPS_CPU_EJTAG;
	if (config1 & MIPS_CONF1_FP) {
		c->options |= MIPS_CPU_FPU;
		c->options |= MIPS_CPU_32FPR;
	}
L
Leonid Yegoshin 已提交
667
	if (cpu_has_tlb) {
668
		c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
L
Leonid Yegoshin 已提交
669 670 671
		c->tlbsizevtlb = c->tlbsize;
		c->tlbsizeftlbsets = 0;
	}
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693

	return config1 & MIPS_CONF_M;
}

static inline unsigned int decode_config2(struct cpuinfo_mips *c)
{
	unsigned int config2;

	config2 = read_c0_config2();

	if (config2 & MIPS_CONF2_SL)
		c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;

	return config2 & MIPS_CONF_M;
}

static inline unsigned int decode_config3(struct cpuinfo_mips *c)
{
	unsigned int config3;

	config3 = read_c0_config3();

694
	if (config3 & MIPS_CONF3_SM) {
695
		c->ases |= MIPS_ASE_SMARTMIPS;
696
		c->options |= MIPS_CPU_RIXI | MIPS_CPU_CTXTC;
697 698 699
	}
	if (config3 & MIPS_CONF3_RXI)
		c->options |= MIPS_CPU_RIXI;
700 701
	if (config3 & MIPS_CONF3_CTXTC)
		c->options |= MIPS_CPU_CTXTC;
702 703
	if (config3 & MIPS_CONF3_DSP)
		c->ases |= MIPS_ASE_DSP;
704
	if (config3 & MIPS_CONF3_DSP2P) {
705
		c->ases |= MIPS_ASE_DSP2P;
706 707 708
		if (cpu_has_mips_r6)
			c->ases |= MIPS_ASE_DSP3;
	}
709 710 711 712
	if (config3 & MIPS_CONF3_VINT)
		c->options |= MIPS_CPU_VINT;
	if (config3 & MIPS_CONF3_VEIC)
		c->options |= MIPS_CPU_VEIC;
713 714
	if (config3 & MIPS_CONF3_LPA)
		c->options |= MIPS_CPU_LPA;
715 716 717 718
	if (config3 & MIPS_CONF3_MT)
		c->ases |= MIPS_ASE_MIPSMT;
	if (config3 & MIPS_CONF3_ULRI)
		c->options |= MIPS_CPU_ULRI;
719 720
	if (config3 & MIPS_CONF3_ISA)
		c->options |= MIPS_CPU_MICROMIPS;
721 722
	if (config3 & MIPS_CONF3_VZ)
		c->ases |= MIPS_ASE_VZ;
723 724
	if (config3 & MIPS_CONF3_SC)
		c->options |= MIPS_CPU_SEGMENTS;
725 726 727 728
	if (config3 & MIPS_CONF3_BI)
		c->options |= MIPS_CPU_BADINSTR;
	if (config3 & MIPS_CONF3_BP)
		c->options |= MIPS_CPU_BADINSTRP;
P
Paul Burton 已提交
729 730
	if (config3 & MIPS_CONF3_MSA)
		c->ases |= MIPS_ASE_MSA;
731
	if (config3 & MIPS_CONF3_PW) {
732
		c->htw_seq = 0;
733
		c->options |= MIPS_CPU_HTW;
734
	}
735 736
	if (config3 & MIPS_CONF3_CDMM)
		c->options |= MIPS_CPU_CDMM;
737 738
	if (config3 & MIPS_CONF3_SP)
		c->options |= MIPS_CPU_SP;
739 740 741 742 743 744 745

	return config3 & MIPS_CONF_M;
}

static inline unsigned int decode_config4(struct cpuinfo_mips *c)
{
	unsigned int config4;
L
Leonid Yegoshin 已提交
746 747 748
	unsigned int newcf4;
	unsigned int mmuextdef;
	unsigned int ftlb_page = MIPS_CONF4_FTLBPAGESIZE;
P
Paul Burton 已提交
749
	unsigned long asid_mask;
750 751 752

	config4 = read_c0_config4();

753 754 755
	if (cpu_has_tlb) {
		if (((config4 & MIPS_CONF4_IE) >> 29) == 2)
			c->options |= MIPS_CPU_TLBINV;
J
James Hogan 已提交
756

757
		/*
J
James Hogan 已提交
758 759 760
		 * R6 has dropped the MMUExtDef field from config4.
		 * On R6 the fields always describe the FTLB, and only if it is
		 * present according to Config.MT.
761
		 */
J
James Hogan 已提交
762 763 764
		if (!cpu_has_mips_r6)
			mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF;
		else if (cpu_has_ftlb)
765 766
			mmuextdef = MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT;
		else
J
James Hogan 已提交
767
			mmuextdef = 0;
768

L
Leonid Yegoshin 已提交
769 770 771 772 773 774 775 776 777 778 779 780 781
		switch (mmuextdef) {
		case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT:
			c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
			c->tlbsizevtlb = c->tlbsize;
			break;
		case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT:
			c->tlbsizevtlb +=
				((config4 & MIPS_CONF4_VTLBSIZEEXT) >>
				  MIPS_CONF4_VTLBSIZEEXT_SHIFT) * 0x40;
			c->tlbsize = c->tlbsizevtlb;
			ftlb_page = MIPS_CONF4_VFTLBPAGESIZE;
			/* fall through */
		case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT:
782 783
			if (mips_ftlb_disabled)
				break;
L
Leonid Yegoshin 已提交
784 785 786 787 788 789 790 791 792 793 794
			newcf4 = (config4 & ~ftlb_page) |
				(page_size_ftlb(mmuextdef) <<
				 MIPS_CONF4_FTLBPAGESIZE_SHIFT);
			write_c0_config4(newcf4);
			back_to_back_c0_hazard();
			config4 = read_c0_config4();
			if (config4 != newcf4) {
				pr_err("PAGE_SIZE 0x%lx is not supported by FTLB (config4=0x%x)\n",
				       PAGE_SIZE, config4);
				/* Switch FTLB off */
				set_ftlb_enable(c, 0);
795
				mips_ftlb_disabled = 1;
L
Leonid Yegoshin 已提交
796 797 798 799 800 801 802 803
				break;
			}
			c->tlbsizeftlbsets = 1 <<
				((config4 & MIPS_CONF4_FTLBSETS) >>
				 MIPS_CONF4_FTLBSETS_SHIFT);
			c->tlbsizeftlbways = ((config4 & MIPS_CONF4_FTLBWAYS) >>
					      MIPS_CONF4_FTLBWAYS_SHIFT) + 2;
			c->tlbsize += c->tlbsizeftlbways * c->tlbsizeftlbsets;
804
			mips_has_ftlb_configured = 1;
L
Leonid Yegoshin 已提交
805 806
			break;
		}
807 808
	}

809 810
	c->kscratch_mask = (config4 & MIPS_CONF4_KSCREXIST)
				>> MIPS_CONF4_KSCREXIST_SHIFT;
811

P
Paul Burton 已提交
812 813 814 815 816 817 818 819 820 821 822 823
	asid_mask = MIPS_ENTRYHI_ASID;
	if (config4 & MIPS_CONF4_AE)
		asid_mask |= MIPS_ENTRYHI_ASIDX;
	set_cpu_asid_mask(c, asid_mask);

	/*
	 * Warn if the computed ASID mask doesn't match the mask the kernel
	 * is built for. This may indicate either a serious problem or an
	 * easy optimisation opportunity, but either way should be addressed.
	 */
	WARN_ON(asid_mask != cpu_asid_mask(c));

824 825 826
	return config4 & MIPS_CONF_M;
}

827 828 829 830 831
static inline unsigned int decode_config5(struct cpuinfo_mips *c)
{
	unsigned int config5;

	config5 = read_c0_config5();
832
	config5 &= ~(MIPS_CONF5_UFR | MIPS_CONF5_UFE);
833 834
	write_c0_config5(config5);

835 836
	if (config5 & MIPS_CONF5_EVA)
		c->options |= MIPS_CPU_EVA;
P
Paul Burton 已提交
837 838
	if (config5 & MIPS_CONF5_MRP)
		c->options |= MIPS_CPU_MAAR;
839 840
	if (config5 & MIPS_CONF5_LLB)
		c->options |= MIPS_CPU_RW_LLB;
S
Steven J. Hill 已提交
841
	if (config5 & MIPS_CONF5_MVH)
842
		c->options |= MIPS_CPU_MVH;
843 844
	if (cpu_has_mips_r6 && (config5 & MIPS_CONF5_VP))
		c->options |= MIPS_CPU_VP;
845

846 847 848
	return config5 & MIPS_CONF_M;
}

849
static void decode_configs(struct cpuinfo_mips *c)
850 851 852 853 854 855 856 857 858
{
	int ok;

	/* MIPS32 or MIPS64 compliant CPU.  */
	c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
		     MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;

	c->scache.flags = MIPS_CACHE_NOT_PRESENT;

859
	/* Enable FTLB if present and not disabled */
860
	set_ftlb_enable(c, mips_ftlb_disabled ? 0 : FTLB_EN);
L
Leonid Yegoshin 已提交
861

862
	ok = decode_config0(c);			/* Read Config registers.  */
R
Ralf Baechle 已提交
863
	BUG_ON(!ok);				/* Arch spec violation!	 */
864 865 866 867 868 869 870 871
	if (ok)
		ok = decode_config1(c);
	if (ok)
		ok = decode_config2(c);
	if (ok)
		ok = decode_config3(c);
	if (ok)
		ok = decode_config4(c);
872 873
	if (ok)
		ok = decode_config5(c);
874

875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909
	/* Probe the EBase.WG bit */
	if (cpu_has_mips_r2_r6) {
		u64 ebase;
		unsigned int status;

		/* {read,write}_c0_ebase_64() may be UNDEFINED prior to r6 */
		ebase = cpu_has_mips64r6 ? read_c0_ebase_64()
					 : (s32)read_c0_ebase();
		if (ebase & MIPS_EBASE_WG) {
			/* WG bit already set, we can avoid the clumsy probe */
			c->options |= MIPS_CPU_EBASE_WG;
		} else {
			/* Its UNDEFINED to change EBase while BEV=0 */
			status = read_c0_status();
			write_c0_status(status | ST0_BEV);
			irq_enable_hazard();
			/*
			 * On pre-r6 cores, this may well clobber the upper bits
			 * of EBase. This is hard to avoid without potentially
			 * hitting UNDEFINED dm*c0 behaviour if EBase is 32-bit.
			 */
			if (cpu_has_mips64r6)
				write_c0_ebase_64(ebase | MIPS_EBASE_WG);
			else
				write_c0_ebase(ebase | MIPS_EBASE_WG);
			back_to_back_c0_hazard();
			/* Restore BEV */
			write_c0_status(status);
			if (read_c0_ebase() & MIPS_EBASE_WG) {
				c->options |= MIPS_CPU_EBASE_WG;
				write_c0_ebase(ebase);
			}
		}
	}

910 911 912
	/* configure the FTLB write probability */
	set_ftlb_enable(c, (mips_ftlb_disabled ? 0 : FTLB_EN) | FTLB_SET_PROB);

913 914
	mips_probe_watch_registers(c);

915
#ifndef CONFIG_MIPS_CPS
916
	if (cpu_has_mips_r2_r6) {
917
		c->core = get_ebase_cpunum();
918 919 920
		if (cpu_has_mipsmt)
			c->core >>= fls(core_nvpes()) - 1;
	}
921
#endif
922 923
}

924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
/*
 * Probe for certain guest capabilities by writing config bits and reading back.
 * Finally write back the original value.
 */
#define probe_gc0_config(name, maxconf, bits)				\
do {									\
	unsigned int tmp;						\
	tmp = read_gc0_##name();					\
	write_gc0_##name(tmp | (bits));					\
	back_to_back_c0_hazard();					\
	maxconf = read_gc0_##name();					\
	write_gc0_##name(tmp);						\
} while (0)

/*
 * Probe for dynamic guest capabilities by changing certain config bits and
 * reading back to see if they change. Finally write back the original value.
 */
#define probe_gc0_config_dyn(name, maxconf, dynconf, bits)		\
do {									\
	maxconf = read_gc0_##name();					\
	write_gc0_##name(maxconf ^ (bits));				\
	back_to_back_c0_hazard();					\
	dynconf = maxconf ^ read_gc0_##name();				\
	write_gc0_##name(maxconf);					\
	maxconf |= dynconf;						\
} while (0)

static inline unsigned int decode_guest_config0(struct cpuinfo_mips *c)
{
	unsigned int config0;

	probe_gc0_config(config, config0, MIPS_CONF_M);

	if (config0 & MIPS_CONF_M)
		c->guest.conf |= BIT(1);
	return config0 & MIPS_CONF_M;
}

static inline unsigned int decode_guest_config1(struct cpuinfo_mips *c)
{
	unsigned int config1, config1_dyn;

	probe_gc0_config_dyn(config1, config1, config1_dyn,
			     MIPS_CONF_M | MIPS_CONF1_PC | MIPS_CONF1_WR |
			     MIPS_CONF1_FP);

	if (config1 & MIPS_CONF1_FP)
		c->guest.options |= MIPS_CPU_FPU;
	if (config1_dyn & MIPS_CONF1_FP)
		c->guest.options_dyn |= MIPS_CPU_FPU;

	if (config1 & MIPS_CONF1_WR)
		c->guest.options |= MIPS_CPU_WATCH;
	if (config1_dyn & MIPS_CONF1_WR)
		c->guest.options_dyn |= MIPS_CPU_WATCH;

	if (config1 & MIPS_CONF1_PC)
		c->guest.options |= MIPS_CPU_PERF;
	if (config1_dyn & MIPS_CONF1_PC)
		c->guest.options_dyn |= MIPS_CPU_PERF;

	if (config1 & MIPS_CONF_M)
		c->guest.conf |= BIT(2);
	return config1 & MIPS_CONF_M;
}

static inline unsigned int decode_guest_config2(struct cpuinfo_mips *c)
{
	unsigned int config2;

	probe_gc0_config(config2, config2, MIPS_CONF_M);

	if (config2 & MIPS_CONF_M)
		c->guest.conf |= BIT(3);
	return config2 & MIPS_CONF_M;
}

static inline unsigned int decode_guest_config3(struct cpuinfo_mips *c)
{
	unsigned int config3, config3_dyn;

	probe_gc0_config_dyn(config3, config3, config3_dyn,
			     MIPS_CONF_M | MIPS_CONF3_MSA | MIPS_CONF3_CTXTC);

	if (config3 & MIPS_CONF3_CTXTC)
		c->guest.options |= MIPS_CPU_CTXTC;
	if (config3_dyn & MIPS_CONF3_CTXTC)
		c->guest.options_dyn |= MIPS_CPU_CTXTC;

	if (config3 & MIPS_CONF3_PW)
		c->guest.options |= MIPS_CPU_HTW;

	if (config3 & MIPS_CONF3_SC)
		c->guest.options |= MIPS_CPU_SEGMENTS;

	if (config3 & MIPS_CONF3_BI)
		c->guest.options |= MIPS_CPU_BADINSTR;
	if (config3 & MIPS_CONF3_BP)
		c->guest.options |= MIPS_CPU_BADINSTRP;

	if (config3 & MIPS_CONF3_MSA)
		c->guest.ases |= MIPS_ASE_MSA;
	if (config3_dyn & MIPS_CONF3_MSA)
		c->guest.ases_dyn |= MIPS_ASE_MSA;

	if (config3 & MIPS_CONF_M)
		c->guest.conf |= BIT(4);
	return config3 & MIPS_CONF_M;
}

static inline unsigned int decode_guest_config4(struct cpuinfo_mips *c)
{
	unsigned int config4;

	probe_gc0_config(config4, config4,
			 MIPS_CONF_M | MIPS_CONF4_KSCREXIST);

	c->guest.kscratch_mask = (config4 & MIPS_CONF4_KSCREXIST)
				>> MIPS_CONF4_KSCREXIST_SHIFT;

	if (config4 & MIPS_CONF_M)
		c->guest.conf |= BIT(5);
	return config4 & MIPS_CONF_M;
}

static inline unsigned int decode_guest_config5(struct cpuinfo_mips *c)
{
	unsigned int config5, config5_dyn;

	probe_gc0_config_dyn(config5, config5, config5_dyn,
			 MIPS_CONF_M | MIPS_CONF5_MRP);

	if (config5 & MIPS_CONF5_MRP)
		c->guest.options |= MIPS_CPU_MAAR;
	if (config5_dyn & MIPS_CONF5_MRP)
		c->guest.options_dyn |= MIPS_CPU_MAAR;

	if (config5 & MIPS_CONF5_LLB)
		c->guest.options |= MIPS_CPU_RW_LLB;

	if (config5 & MIPS_CONF_M)
		c->guest.conf |= BIT(6);
	return config5 & MIPS_CONF_M;
}

static inline void decode_guest_configs(struct cpuinfo_mips *c)
{
	unsigned int ok;

	ok = decode_guest_config0(c);
	if (ok)
		ok = decode_guest_config1(c);
	if (ok)
		ok = decode_guest_config2(c);
	if (ok)
		ok = decode_guest_config3(c);
	if (ok)
		ok = decode_guest_config4(c);
	if (ok)
		decode_guest_config5(c);
}

static inline void cpu_probe_guestctl0(struct cpuinfo_mips *c)
{
	unsigned int guestctl0, temp;

	guestctl0 = read_c0_guestctl0();

	if (guestctl0 & MIPS_GCTL0_G0E)
		c->options |= MIPS_CPU_GUESTCTL0EXT;
	if (guestctl0 & MIPS_GCTL0_G1)
		c->options |= MIPS_CPU_GUESTCTL1;
	if (guestctl0 & MIPS_GCTL0_G2)
		c->options |= MIPS_CPU_GUESTCTL2;
	if (!(guestctl0 & MIPS_GCTL0_RAD)) {
		c->options |= MIPS_CPU_GUESTID;

		/*
		 * Probe for Direct Root to Guest (DRG). Set GuestCtl1.RID = 0
		 * first, otherwise all data accesses will be fully virtualised
		 * as if they were performed by guest mode.
		 */
		write_c0_guestctl1(0);
		tlbw_use_hazard();

		write_c0_guestctl0(guestctl0 | MIPS_GCTL0_DRG);
		back_to_back_c0_hazard();
		temp = read_c0_guestctl0();

		if (temp & MIPS_GCTL0_DRG) {
			write_c0_guestctl0(guestctl0);
			c->options |= MIPS_CPU_DRG;
		}
	}
}

static inline void cpu_probe_guestctl1(struct cpuinfo_mips *c)
{
	if (cpu_has_guestid) {
		/* determine the number of bits of GuestID available */
		write_c0_guestctl1(MIPS_GCTL1_ID);
		back_to_back_c0_hazard();
		c->guestid_mask = (read_c0_guestctl1() & MIPS_GCTL1_ID)
						>> MIPS_GCTL1_ID_SHIFT;
		write_c0_guestctl1(0);
	}
}

static inline void cpu_probe_gtoffset(struct cpuinfo_mips *c)
{
	/* determine the number of bits of GTOffset available */
	write_c0_gtoffset(0xffffffff);
	back_to_back_c0_hazard();
	c->gtoffset_mask = read_c0_gtoffset();
	write_c0_gtoffset(0);
}

static inline void cpu_probe_vz(struct cpuinfo_mips *c)
{
	cpu_probe_guestctl0(c);
	if (cpu_has_guestctl1)
		cpu_probe_guestctl1(c);

	cpu_probe_gtoffset(c);

	decode_guest_configs(c);
}

R
Ralf Baechle 已提交
1153
#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
L
Linus Torvalds 已提交
1154 1155
		| MIPS_CPU_COUNTER)

1156
static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
L
Linus Torvalds 已提交
1157
{
1158
	switch (c->processor_id & PRID_IMP_MASK) {
L
Linus Torvalds 已提交
1159 1160
	case PRID_IMP_R2000:
		c->cputype = CPU_R2000;
1161
		__cpu_name[cpu] = "R2000";
1162
		c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS;
R
Ralf Baechle 已提交
1163
		c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
S
Steven J. Hill 已提交
1164
			     MIPS_CPU_NOFPUEX;
L
Linus Torvalds 已提交
1165 1166 1167 1168 1169
		if (__cpu_has_fpu())
			c->options |= MIPS_CPU_FPU;
		c->tlbsize = 64;
		break;
	case PRID_IMP_R3000:
1170
		if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) {
1171
			if (cpu_has_confreg()) {
L
Linus Torvalds 已提交
1172
				c->cputype = CPU_R3081E;
1173 1174
				__cpu_name[cpu] = "R3081";
			} else {
L
Linus Torvalds 已提交
1175
				c->cputype = CPU_R3000A;
1176 1177 1178
				__cpu_name[cpu] = "R3000A";
			}
		} else {
L
Linus Torvalds 已提交
1179
			c->cputype = CPU_R3000;
1180 1181
			__cpu_name[cpu] = "R3000";
		}
1182
		c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS;
R
Ralf Baechle 已提交
1183
		c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
S
Steven J. Hill 已提交
1184
			     MIPS_CPU_NOFPUEX;
L
Linus Torvalds 已提交
1185 1186 1187 1188 1189 1190
		if (__cpu_has_fpu())
			c->options |= MIPS_CPU_FPU;
		c->tlbsize = 64;
		break;
	case PRID_IMP_R4000:
		if (read_c0_config() & CONF_SC) {
1191 1192
			if ((c->processor_id & PRID_REV_MASK) >=
			    PRID_REV_R4400) {
L
Linus Torvalds 已提交
1193
				c->cputype = CPU_R4400PC;
1194 1195
				__cpu_name[cpu] = "R4400PC";
			} else {
L
Linus Torvalds 已提交
1196
				c->cputype = CPU_R4000PC;
1197 1198
				__cpu_name[cpu] = "R4000PC";
			}
L
Linus Torvalds 已提交
1199
		} else {
1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219
			int cca = read_c0_config() & CONF_CM_CMASK;
			int mc;

			/*
			 * SC and MC versions can't be reliably told apart,
			 * but only the latter support coherent caching
			 * modes so assume the firmware has set the KSEG0
			 * coherency attribute reasonably (if uncached, we
			 * assume SC).
			 */
			switch (cca) {
			case CONF_CM_CACHABLE_CE:
			case CONF_CM_CACHABLE_COW:
			case CONF_CM_CACHABLE_CUW:
				mc = 1;
				break;
			default:
				mc = 0;
				break;
			}
1220 1221
			if ((c->processor_id & PRID_REV_MASK) >=
			    PRID_REV_R4400) {
1222 1223
				c->cputype = mc ? CPU_R4400MC : CPU_R4400SC;
				__cpu_name[cpu] = mc ? "R4400MC" : "R4400SC";
1224
			} else {
1225 1226
				c->cputype = mc ? CPU_R4000MC : CPU_R4000SC;
				__cpu_name[cpu] = mc ? "R4000MC" : "R4000SC";
1227
			}
L
Linus Torvalds 已提交
1228 1229
		}

1230
		set_isa(c, MIPS_CPU_ISA_III);
1231
		c->fpu_msk31 |= FPU_CSR_CONDX;
L
Linus Torvalds 已提交
1232
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1233 1234
			     MIPS_CPU_WATCH | MIPS_CPU_VCE |
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1235 1236 1237
		c->tlbsize = 48;
		break;
	case PRID_IMP_VR41XX:
1238
		set_isa(c, MIPS_CPU_ISA_III);
1239
		c->fpu_msk31 |= FPU_CSR_CONDX;
1240 1241
		c->options = R4K_OPTS;
		c->tlbsize = 32;
L
Linus Torvalds 已提交
1242 1243 1244
		switch (c->processor_id & 0xf0) {
		case PRID_REV_VR4111:
			c->cputype = CPU_VR4111;
1245
			__cpu_name[cpu] = "NEC VR4111";
L
Linus Torvalds 已提交
1246 1247 1248
			break;
		case PRID_REV_VR4121:
			c->cputype = CPU_VR4121;
1249
			__cpu_name[cpu] = "NEC VR4121";
L
Linus Torvalds 已提交
1250 1251
			break;
		case PRID_REV_VR4122:
1252
			if ((c->processor_id & 0xf) < 0x3) {
L
Linus Torvalds 已提交
1253
				c->cputype = CPU_VR4122;
1254 1255
				__cpu_name[cpu] = "NEC VR4122";
			} else {
L
Linus Torvalds 已提交
1256
				c->cputype = CPU_VR4181A;
1257 1258
				__cpu_name[cpu] = "NEC VR4181A";
			}
L
Linus Torvalds 已提交
1259 1260
			break;
		case PRID_REV_VR4130:
1261
			if ((c->processor_id & 0xf) < 0x4) {
L
Linus Torvalds 已提交
1262
				c->cputype = CPU_VR4131;
1263 1264
				__cpu_name[cpu] = "NEC VR4131";
			} else {
L
Linus Torvalds 已提交
1265
				c->cputype = CPU_VR4133;
1266
				c->options |= MIPS_CPU_LLSC;
1267 1268
				__cpu_name[cpu] = "NEC VR4133";
			}
L
Linus Torvalds 已提交
1269 1270 1271 1272
			break;
		default:
			printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
			c->cputype = CPU_VR41XX;
1273
			__cpu_name[cpu] = "NEC Vr41xx";
L
Linus Torvalds 已提交
1274 1275 1276 1277 1278
			break;
		}
		break;
	case PRID_IMP_R4300:
		c->cputype = CPU_R4300;
1279
		__cpu_name[cpu] = "R4300";
1280
		set_isa(c, MIPS_CPU_ISA_III);
1281
		c->fpu_msk31 |= FPU_CSR_CONDX;
L
Linus Torvalds 已提交
1282
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1283
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1284 1285 1286 1287
		c->tlbsize = 32;
		break;
	case PRID_IMP_R4600:
		c->cputype = CPU_R4600;
1288
		__cpu_name[cpu] = "R4600";
1289
		set_isa(c, MIPS_CPU_ISA_III);
1290
		c->fpu_msk31 |= FPU_CSR_CONDX;
T
Thiemo Seufer 已提交
1291 1292
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1293 1294 1295
		c->tlbsize = 48;
		break;
	#if 0
S
Steven J. Hill 已提交
1296
	case PRID_IMP_R4650:
L
Linus Torvalds 已提交
1297 1298 1299 1300 1301 1302
		/*
		 * This processor doesn't have an MMU, so it's not
		 * "real easy" to run Linux on it. It is left purely
		 * for documentation.  Commented out because it shares
		 * it's c0_prid id number with the TX3900.
		 */
1303
		c->cputype = CPU_R4650;
1304
		__cpu_name[cpu] = "R4650";
1305
		set_isa(c, MIPS_CPU_ISA_III);
1306
		c->fpu_msk31 |= FPU_CSR_CONDX;
L
Linus Torvalds 已提交
1307
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
S
Steven J. Hill 已提交
1308
		c->tlbsize = 48;
L
Linus Torvalds 已提交
1309 1310 1311
		break;
	#endif
	case PRID_IMP_TX39:
1312
		c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS;
R
Ralf Baechle 已提交
1313
		c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
L
Linus Torvalds 已提交
1314 1315 1316

		if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
			c->cputype = CPU_TX3927;
1317
			__cpu_name[cpu] = "TX3927";
L
Linus Torvalds 已提交
1318 1319
			c->tlbsize = 64;
		} else {
1320
			switch (c->processor_id & PRID_REV_MASK) {
L
Linus Torvalds 已提交
1321 1322
			case PRID_REV_TX3912:
				c->cputype = CPU_TX3912;
1323
				__cpu_name[cpu] = "TX3912";
L
Linus Torvalds 已提交
1324 1325 1326 1327
				c->tlbsize = 32;
				break;
			case PRID_REV_TX3922:
				c->cputype = CPU_TX3922;
1328
				__cpu_name[cpu] = "TX3922";
L
Linus Torvalds 已提交
1329 1330 1331 1332 1333 1334 1335
				c->tlbsize = 64;
				break;
			}
		}
		break;
	case PRID_IMP_R4700:
		c->cputype = CPU_R4700;
1336
		__cpu_name[cpu] = "R4700";
1337
		set_isa(c, MIPS_CPU_ISA_III);
1338
		c->fpu_msk31 |= FPU_CSR_CONDX;
L
Linus Torvalds 已提交
1339
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1340
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1341 1342 1343 1344
		c->tlbsize = 48;
		break;
	case PRID_IMP_TX49:
		c->cputype = CPU_TX49XX;
1345
		__cpu_name[cpu] = "R49XX";
1346
		set_isa(c, MIPS_CPU_ISA_III);
1347
		c->fpu_msk31 |= FPU_CSR_CONDX;
L
Linus Torvalds 已提交
1348 1349 1350 1351 1352 1353 1354
		c->options = R4K_OPTS | MIPS_CPU_LLSC;
		if (!(c->processor_id & 0x08))
			c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
		c->tlbsize = 48;
		break;
	case PRID_IMP_R5000:
		c->cputype = CPU_R5000;
1355
		__cpu_name[cpu] = "R5000";
1356
		set_isa(c, MIPS_CPU_ISA_IV);
L
Linus Torvalds 已提交
1357
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1358
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1359 1360 1361 1362
		c->tlbsize = 48;
		break;
	case PRID_IMP_R5432:
		c->cputype = CPU_R5432;
1363
		__cpu_name[cpu] = "R5432";
1364
		set_isa(c, MIPS_CPU_ISA_IV);
L
Linus Torvalds 已提交
1365
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1366
			     MIPS_CPU_WATCH | MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1367 1368 1369 1370
		c->tlbsize = 48;
		break;
	case PRID_IMP_R5500:
		c->cputype = CPU_R5500;
1371
		__cpu_name[cpu] = "R5500";
1372
		set_isa(c, MIPS_CPU_ISA_IV);
L
Linus Torvalds 已提交
1373
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1374
			     MIPS_CPU_WATCH | MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1375 1376 1377 1378
		c->tlbsize = 48;
		break;
	case PRID_IMP_NEVADA:
		c->cputype = CPU_NEVADA;
1379
		__cpu_name[cpu] = "Nevada";
1380
		set_isa(c, MIPS_CPU_ISA_IV);
L
Linus Torvalds 已提交
1381
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1382
			     MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1383 1384 1385 1386
		c->tlbsize = 48;
		break;
	case PRID_IMP_R6000:
		c->cputype = CPU_R6000;
1387
		__cpu_name[cpu] = "R6000";
1388
		set_isa(c, MIPS_CPU_ISA_II);
1389
		c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS;
L
Linus Torvalds 已提交
1390
		c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
S
Steven J. Hill 已提交
1391
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1392 1393 1394 1395
		c->tlbsize = 32;
		break;
	case PRID_IMP_R6000A:
		c->cputype = CPU_R6000A;
1396
		__cpu_name[cpu] = "R6000A";
1397
		set_isa(c, MIPS_CPU_ISA_II);
1398
		c->fpu_msk31 |= FPU_CSR_CONDX | FPU_CSR_FS;
L
Linus Torvalds 已提交
1399
		c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
S
Steven J. Hill 已提交
1400
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1401 1402 1403 1404
		c->tlbsize = 32;
		break;
	case PRID_IMP_RM7000:
		c->cputype = CPU_RM7000;
1405
		__cpu_name[cpu] = "RM7000";
1406
		set_isa(c, MIPS_CPU_ISA_IV);
L
Linus Torvalds 已提交
1407
		c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
S
Steven J. Hill 已提交
1408
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1409
		/*
R
Ralf Baechle 已提交
1410
		 * Undocumented RM7000:	 Bit 29 in the info register of
L
Linus Torvalds 已提交
1411 1412 1413
		 * the RM7000 v2.0 indicates if the TLB has 48 or 64
		 * entries.
		 *
R
Ralf Baechle 已提交
1414 1415
		 * 29	   1 =>	   64 entry JTLB
		 *	   0 =>	   48 entry JTLB
L
Linus Torvalds 已提交
1416 1417 1418 1419 1420
		 */
		c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
		break;
	case PRID_IMP_R8000:
		c->cputype = CPU_R8000;
1421
		__cpu_name[cpu] = "RM8000";
1422
		set_isa(c, MIPS_CPU_ISA_IV);
L
Linus Torvalds 已提交
1423
		c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
S
Steven J. Hill 已提交
1424 1425
			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1426 1427 1428 1429
		c->tlbsize = 384;      /* has weird TLB: 3-way x 128 */
		break;
	case PRID_IMP_R10000:
		c->cputype = CPU_R10000;
1430
		__cpu_name[cpu] = "R10000";
1431
		set_isa(c, MIPS_CPU_ISA_IV);
1432
		c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
S
Steven J. Hill 已提交
1433
			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
L
Linus Torvalds 已提交
1434
			     MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
S
Steven J. Hill 已提交
1435
			     MIPS_CPU_LLSC;
L
Linus Torvalds 已提交
1436 1437 1438 1439
		c->tlbsize = 64;
		break;
	case PRID_IMP_R12000:
		c->cputype = CPU_R12000;
1440
		__cpu_name[cpu] = "R12000";
1441
		set_isa(c, MIPS_CPU_ISA_IV);
1442
		c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
S
Steven J. Hill 已提交
1443
			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
L
Linus Torvalds 已提交
1444
			     MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
1445
			     MIPS_CPU_LLSC | MIPS_CPU_BP_GHIST;
L
Linus Torvalds 已提交
1446 1447
		c->tlbsize = 64;
		break;
K
Kumba 已提交
1448
	case PRID_IMP_R14000:
J
Joshua Kinard 已提交
1449 1450 1451 1452 1453 1454 1455
		if (((c->processor_id >> 4) & 0x0f) > 2) {
			c->cputype = CPU_R16000;
			__cpu_name[cpu] = "R16000";
		} else {
			c->cputype = CPU_R14000;
			__cpu_name[cpu] = "R14000";
		}
1456
		set_isa(c, MIPS_CPU_ISA_IV);
K
Kumba 已提交
1457
		c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
S
Steven J. Hill 已提交
1458
			     MIPS_CPU_FPU | MIPS_CPU_32FPR |
K
Kumba 已提交
1459
			     MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
1460
			     MIPS_CPU_LLSC | MIPS_CPU_BP_GHIST;
K
Kumba 已提交
1461 1462
		c->tlbsize = 64;
		break;
1463
	case PRID_IMP_LOONGSON_64:  /* Loongson-2/3 */
1464 1465
		switch (c->processor_id & PRID_REV_MASK) {
		case PRID_REV_LOONGSON2E:
1466 1467
			c->cputype = CPU_LOONGSON2;
			__cpu_name[cpu] = "ICT Loongson-2";
1468
			set_elf_platform(cpu, "loongson2e");
1469
			set_isa(c, MIPS_CPU_ISA_III);
1470
			c->fpu_msk31 |= FPU_CSR_CONDX;
1471 1472
			break;
		case PRID_REV_LOONGSON2F:
1473 1474
			c->cputype = CPU_LOONGSON2;
			__cpu_name[cpu] = "ICT Loongson-2";
1475
			set_elf_platform(cpu, "loongson2f");
1476
			set_isa(c, MIPS_CPU_ISA_III);
1477
			c->fpu_msk31 |= FPU_CSR_CONDX;
1478
			break;
1479
		case PRID_REV_LOONGSON3A_R1:
1480 1481 1482
			c->cputype = CPU_LOONGSON3;
			__cpu_name[cpu] = "ICT Loongson-3";
			set_elf_platform(cpu, "loongson3a");
1483
			set_isa(c, MIPS_CPU_ISA_M64R1);
1484
			break;
H
Huacai Chen 已提交
1485 1486 1487 1488 1489
		case PRID_REV_LOONGSON3B_R1:
		case PRID_REV_LOONGSON3B_R2:
			c->cputype = CPU_LOONGSON3;
			__cpu_name[cpu] = "ICT Loongson-3";
			set_elf_platform(cpu, "loongson3b");
1490
			set_isa(c, MIPS_CPU_ISA_M64R1);
H
Huacai Chen 已提交
1491
			break;
1492 1493
		}

1494 1495 1496 1497
		c->options = R4K_OPTS |
			     MIPS_CPU_FPU | MIPS_CPU_LLSC |
			     MIPS_CPU_32FPR;
		c->tlbsize = 64;
1498
		c->writecombine = _CACHE_UNCACHED_ACCELERATED;
1499
		break;
1500
	case PRID_IMP_LOONGSON_32:  /* Loongson-1 */
1501
		decode_configs(c);
1502

1503
		c->cputype = CPU_LOONGSON1;
L
Linus Torvalds 已提交
1504

1505 1506 1507
		switch (c->processor_id & PRID_REV_MASK) {
		case PRID_REV_LOONGSON1B:
			__cpu_name[cpu] = "Loongson 1B";
1508 1509
			break;
		}
1510

1511
		break;
L
Linus Torvalds 已提交
1512 1513 1514
	}
}

1515
static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
L
Linus Torvalds 已提交
1516
{
1517
	c->writecombine = _CACHE_UNCACHED_ACCELERATED;
1518
	switch (c->processor_id & PRID_IMP_MASK) {
1519 1520 1521 1522 1523
	case PRID_IMP_QEMU_GENERIC:
		c->writecombine = _CACHE_UNCACHED;
		c->cputype = CPU_QEMU_GENERIC;
		__cpu_name[cpu] = "MIPS GENERIC QEMU";
		break;
L
Linus Torvalds 已提交
1524 1525
	case PRID_IMP_4KC:
		c->cputype = CPU_4KC;
1526
		c->writecombine = _CACHE_UNCACHED;
1527
		__cpu_name[cpu] = "MIPS 4Kc";
L
Linus Torvalds 已提交
1528 1529
		break;
	case PRID_IMP_4KEC:
1530 1531
	case PRID_IMP_4KECR2:
		c->cputype = CPU_4KEC;
1532
		c->writecombine = _CACHE_UNCACHED;
1533
		__cpu_name[cpu] = "MIPS 4KEc";
1534
		break;
L
Linus Torvalds 已提交
1535
	case PRID_IMP_4KSC:
R
Ralf Baechle 已提交
1536
	case PRID_IMP_4KSD:
L
Linus Torvalds 已提交
1537
		c->cputype = CPU_4KSC;
1538
		c->writecombine = _CACHE_UNCACHED;
1539
		__cpu_name[cpu] = "MIPS 4KSc";
L
Linus Torvalds 已提交
1540 1541 1542
		break;
	case PRID_IMP_5KC:
		c->cputype = CPU_5KC;
1543
		c->writecombine = _CACHE_UNCACHED;
1544
		__cpu_name[cpu] = "MIPS 5Kc";
L
Linus Torvalds 已提交
1545
		break;
L
Leonid Yegoshin 已提交
1546 1547
	case PRID_IMP_5KE:
		c->cputype = CPU_5KE;
1548
		c->writecombine = _CACHE_UNCACHED;
L
Leonid Yegoshin 已提交
1549 1550
		__cpu_name[cpu] = "MIPS 5KE";
		break;
L
Linus Torvalds 已提交
1551 1552
	case PRID_IMP_20KC:
		c->cputype = CPU_20KC;
1553
		c->writecombine = _CACHE_UNCACHED;
1554
		__cpu_name[cpu] = "MIPS 20Kc";
L
Linus Torvalds 已提交
1555 1556 1557
		break;
	case PRID_IMP_24K:
		c->cputype = CPU_24K;
1558
		c->writecombine = _CACHE_UNCACHED;
1559
		__cpu_name[cpu] = "MIPS 24Kc";
L
Linus Torvalds 已提交
1560
		break;
1561 1562
	case PRID_IMP_24KE:
		c->cputype = CPU_24K;
1563
		c->writecombine = _CACHE_UNCACHED;
1564 1565
		__cpu_name[cpu] = "MIPS 24KEc";
		break;
L
Linus Torvalds 已提交
1566 1567
	case PRID_IMP_25KF:
		c->cputype = CPU_25KF;
1568
		c->writecombine = _CACHE_UNCACHED;
1569
		__cpu_name[cpu] = "MIPS 25Kc";
L
Linus Torvalds 已提交
1570
		break;
R
Ralf Baechle 已提交
1571 1572
	case PRID_IMP_34K:
		c->cputype = CPU_34K;
1573
		c->writecombine = _CACHE_UNCACHED;
1574
		__cpu_name[cpu] = "MIPS 34Kc";
R
Ralf Baechle 已提交
1575
		break;
1576 1577
	case PRID_IMP_74K:
		c->cputype = CPU_74K;
1578
		c->writecombine = _CACHE_UNCACHED;
1579
		__cpu_name[cpu] = "MIPS 74Kc";
1580
		break;
1581 1582
	case PRID_IMP_M14KC:
		c->cputype = CPU_M14KC;
1583
		c->writecombine = _CACHE_UNCACHED;
1584 1585
		__cpu_name[cpu] = "MIPS M14Kc";
		break;
1586 1587
	case PRID_IMP_M14KEC:
		c->cputype = CPU_M14KEC;
1588
		c->writecombine = _CACHE_UNCACHED;
1589 1590
		__cpu_name[cpu] = "MIPS M14KEc";
		break;
1591 1592
	case PRID_IMP_1004K:
		c->cputype = CPU_1004K;
1593
		c->writecombine = _CACHE_UNCACHED;
1594
		__cpu_name[cpu] = "MIPS 1004Kc";
1595
		break;
1596
	case PRID_IMP_1074K:
1597
		c->cputype = CPU_1074K;
1598
		c->writecombine = _CACHE_UNCACHED;
1599 1600
		__cpu_name[cpu] = "MIPS 1074Kc";
		break;
1601 1602 1603 1604 1605 1606 1607 1608
	case PRID_IMP_INTERAPTIV_UP:
		c->cputype = CPU_INTERAPTIV;
		__cpu_name[cpu] = "MIPS interAptiv";
		break;
	case PRID_IMP_INTERAPTIV_MP:
		c->cputype = CPU_INTERAPTIV;
		__cpu_name[cpu] = "MIPS interAptiv (multi)";
		break;
1609 1610 1611 1612 1613 1614 1615 1616
	case PRID_IMP_PROAPTIV_UP:
		c->cputype = CPU_PROAPTIV;
		__cpu_name[cpu] = "MIPS proAptiv";
		break;
	case PRID_IMP_PROAPTIV_MP:
		c->cputype = CPU_PROAPTIV;
		__cpu_name[cpu] = "MIPS proAptiv (multi)";
		break;
J
James Hogan 已提交
1617 1618 1619 1620
	case PRID_IMP_P5600:
		c->cputype = CPU_P5600;
		__cpu_name[cpu] = "MIPS P5600";
		break;
P
Paul Burton 已提交
1621 1622 1623 1624
	case PRID_IMP_P6600:
		c->cputype = CPU_P6600;
		__cpu_name[cpu] = "MIPS P6600";
		break;
1625 1626 1627 1628
	case PRID_IMP_I6400:
		c->cputype = CPU_I6400;
		__cpu_name[cpu] = "MIPS I6400";
		break;
1629 1630 1631 1632
	case PRID_IMP_M5150:
		c->cputype = CPU_M5150;
		__cpu_name[cpu] = "MIPS M5150";
		break;
P
Paul Burton 已提交
1633 1634 1635 1636
	case PRID_IMP_M6250:
		c->cputype = CPU_M6250;
		__cpu_name[cpu] = "MIPS M6250";
		break;
L
Linus Torvalds 已提交
1637
	}
C
Chris Dearman 已提交
1638

L
Leonid Yegoshin 已提交
1639 1640
	decode_configs(c);

C
Chris Dearman 已提交
1641
	spram_config();
L
Linus Torvalds 已提交
1642 1643
}

1644
static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
L
Linus Torvalds 已提交
1645
{
1646
	decode_configs(c);
1647
	switch (c->processor_id & PRID_IMP_MASK) {
L
Linus Torvalds 已提交
1648 1649
	case PRID_IMP_AU1_REV1:
	case PRID_IMP_AU1_REV2:
1650
		c->cputype = CPU_ALCHEMY;
L
Linus Torvalds 已提交
1651 1652
		switch ((c->processor_id >> 24) & 0xff) {
		case 0:
1653
			__cpu_name[cpu] = "Au1000";
L
Linus Torvalds 已提交
1654 1655
			break;
		case 1:
1656
			__cpu_name[cpu] = "Au1500";
L
Linus Torvalds 已提交
1657 1658
			break;
		case 2:
1659
			__cpu_name[cpu] = "Au1100";
L
Linus Torvalds 已提交
1660 1661
			break;
		case 3:
1662
			__cpu_name[cpu] = "Au1550";
L
Linus Torvalds 已提交
1663
			break;
P
Pete Popov 已提交
1664
		case 4:
1665
			__cpu_name[cpu] = "Au1200";
1666
			if ((c->processor_id & PRID_REV_MASK) == 2)
1667
				__cpu_name[cpu] = "Au1250";
1668 1669
			break;
		case 5:
1670
			__cpu_name[cpu] = "Au1210";
P
Pete Popov 已提交
1671
			break;
L
Linus Torvalds 已提交
1672
		default:
1673
			__cpu_name[cpu] = "Au1xxx";
L
Linus Torvalds 已提交
1674 1675 1676 1677 1678 1679
			break;
		}
		break;
	}
}

1680
static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
L
Linus Torvalds 已提交
1681
{
1682
	decode_configs(c);
R
Ralf Baechle 已提交
1683

1684
	c->writecombine = _CACHE_UNCACHED_ACCELERATED;
1685
	switch (c->processor_id & PRID_IMP_MASK) {
L
Linus Torvalds 已提交
1686 1687
	case PRID_IMP_SB1:
		c->cputype = CPU_SB1;
1688
		__cpu_name[cpu] = "SiByte SB1";
L
Linus Torvalds 已提交
1689
		/* FPU in pass1 is known to have issues. */
1690
		if ((c->processor_id & PRID_REV_MASK) < 0x02)
1691
			c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
L
Linus Torvalds 已提交
1692
		break;
A
Andrew Isaacson 已提交
1693 1694
	case PRID_IMP_SB1A:
		c->cputype = CPU_SB1A;
1695
		__cpu_name[cpu] = "SiByte SB1A";
A
Andrew Isaacson 已提交
1696
		break;
L
Linus Torvalds 已提交
1697 1698 1699
	}
}

1700
static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
L
Linus Torvalds 已提交
1701
{
1702
	decode_configs(c);
1703
	switch (c->processor_id & PRID_IMP_MASK) {
L
Linus Torvalds 已提交
1704 1705
	case PRID_IMP_SR71000:
		c->cputype = CPU_SR71000;
1706
		__cpu_name[cpu] = "Sandcraft SR71000";
L
Linus Torvalds 已提交
1707 1708 1709 1710 1711 1712
		c->scache.ways = 8;
		c->tlbsize = 64;
		break;
	}
}

1713
static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
1714 1715
{
	decode_configs(c);
1716
	switch (c->processor_id & PRID_IMP_MASK) {
1717 1718
	case PRID_IMP_PR4450:
		c->cputype = CPU_PR4450;
1719
		__cpu_name[cpu] = "Philips PR4450";
1720
		set_isa(c, MIPS_CPU_ISA_M32R1);
1721 1722 1723 1724
		break;
	}
}

1725
static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
1726 1727
{
	decode_configs(c);
1728
	switch (c->processor_id & PRID_IMP_MASK) {
1729 1730
	case PRID_IMP_BMIPS32_REV4:
	case PRID_IMP_BMIPS32_REV8:
1731 1732
		c->cputype = CPU_BMIPS32;
		__cpu_name[cpu] = "Broadcom BMIPS32";
1733
		set_elf_platform(cpu, "bmips32");
1734 1735 1736 1737 1738 1739
		break;
	case PRID_IMP_BMIPS3300:
	case PRID_IMP_BMIPS3300_ALT:
	case PRID_IMP_BMIPS3300_BUG:
		c->cputype = CPU_BMIPS3300;
		__cpu_name[cpu] = "Broadcom BMIPS3300";
1740
		set_elf_platform(cpu, "bmips3300");
1741 1742
		break;
	case PRID_IMP_BMIPS43XX: {
1743
		int rev = c->processor_id & PRID_REV_MASK;
1744 1745 1746 1747 1748

		if (rev >= PRID_REV_BMIPS4380_LO &&
				rev <= PRID_REV_BMIPS4380_HI) {
			c->cputype = CPU_BMIPS4380;
			__cpu_name[cpu] = "Broadcom BMIPS4380";
1749
			set_elf_platform(cpu, "bmips4380");
1750
			c->options |= MIPS_CPU_RIXI;
1751 1752 1753
		} else {
			c->cputype = CPU_BMIPS4350;
			__cpu_name[cpu] = "Broadcom BMIPS4350";
1754
			set_elf_platform(cpu, "bmips4350");
1755
		}
1756
		break;
1757 1758
	}
	case PRID_IMP_BMIPS5000:
1759
	case PRID_IMP_BMIPS5200:
1760
		c->cputype = CPU_BMIPS5000;
1761 1762 1763 1764
		if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_BMIPS5200)
			__cpu_name[cpu] = "Broadcom BMIPS5200";
		else
			__cpu_name[cpu] = "Broadcom BMIPS5000";
1765
		set_elf_platform(cpu, "bmips5000");
1766
		c->options |= MIPS_CPU_ULRI | MIPS_CPU_RIXI;
1767
		break;
1768 1769 1770
	}
}

1771 1772 1773
static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
{
	decode_configs(c);
1774
	switch (c->processor_id & PRID_IMP_MASK) {
1775 1776 1777
	case PRID_IMP_CAVIUM_CN38XX:
	case PRID_IMP_CAVIUM_CN31XX:
	case PRID_IMP_CAVIUM_CN30XX:
1778 1779 1780
		c->cputype = CPU_CAVIUM_OCTEON;
		__cpu_name[cpu] = "Cavium Octeon";
		goto platform;
1781 1782 1783 1784
	case PRID_IMP_CAVIUM_CN58XX:
	case PRID_IMP_CAVIUM_CN56XX:
	case PRID_IMP_CAVIUM_CN50XX:
	case PRID_IMP_CAVIUM_CN52XX:
1785 1786 1787
		c->cputype = CPU_CAVIUM_OCTEON_PLUS;
		__cpu_name[cpu] = "Cavium Octeon+";
platform:
1788
		set_elf_platform(cpu, "octeon");
1789
		break;
1790
	case PRID_IMP_CAVIUM_CN61XX:
1791
	case PRID_IMP_CAVIUM_CN63XX:
1792 1793
	case PRID_IMP_CAVIUM_CN66XX:
	case PRID_IMP_CAVIUM_CN68XX:
1794
	case PRID_IMP_CAVIUM_CNF71XX:
1795 1796
		c->cputype = CPU_CAVIUM_OCTEON2;
		__cpu_name[cpu] = "Cavium Octeon II";
1797
		set_elf_platform(cpu, "octeon2");
1798
		break;
1799
	case PRID_IMP_CAVIUM_CN70XX:
1800 1801
	case PRID_IMP_CAVIUM_CN73XX:
	case PRID_IMP_CAVIUM_CNF75XX:
1802 1803 1804 1805 1806
	case PRID_IMP_CAVIUM_CN78XX:
		c->cputype = CPU_CAVIUM_OCTEON3;
		__cpu_name[cpu] = "Cavium Octeon III";
		set_elf_platform(cpu, "octeon3");
		break;
1807 1808 1809 1810 1811 1812 1813
	default:
		printk(KERN_INFO "Unknown Octeon chip!\n");
		c->cputype = CPU_UNKNOWN;
		break;
	}
}

1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827
static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
{
	switch (c->processor_id & PRID_IMP_MASK) {
	case PRID_IMP_LOONGSON_64:  /* Loongson-2/3 */
		switch (c->processor_id & PRID_REV_MASK) {
		case PRID_REV_LOONGSON3A_R2:
			c->cputype = CPU_LOONGSON3;
			__cpu_name[cpu] = "ICT Loongson-3";
			set_elf_platform(cpu, "loongson3a");
			set_isa(c, MIPS_CPU_ISA_M64R2);
			break;
		}

		decode_configs(c);
1828
		c->options |= MIPS_CPU_TLBINV | MIPS_CPU_LDPTE;
1829 1830 1831 1832 1833 1834 1835 1836
		c->writecombine = _CACHE_UNCACHED_ACCELERATED;
		break;
	default:
		panic("Unknown Loongson Processor ID!");
		break;
	}
}

1837 1838 1839 1840 1841
static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
{
	decode_configs(c);
	/* JZRISC does not implement the CP0 counter. */
	c->options &= ~MIPS_CPU_COUNTER;
1842
	BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter);
1843
	switch (c->processor_id & PRID_IMP_MASK) {
1844 1845
	case PRID_IMP_JZRISC:
		c->cputype = CPU_JZRISC;
1846
		c->writecombine = _CACHE_UNCACHED_ACCELERATED;
1847 1848 1849 1850 1851 1852 1853 1854
		__cpu_name[cpu] = "Ingenic JZRISC";
		break;
	default:
		panic("Unknown Ingenic Processor ID!");
		break;
	}
}

1855 1856 1857 1858
static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
{
	decode_configs(c);

1859
	if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_NETLOGIC_AU13XX) {
M
Manuel Lauss 已提交
1860 1861 1862 1863 1864 1865
		c->cputype = CPU_ALCHEMY;
		__cpu_name[cpu] = "Au1300";
		/* following stuff is not for Alchemy */
		return;
	}

R
Ralf Baechle 已提交
1866 1867
	c->options = (MIPS_CPU_TLB	 |
			MIPS_CPU_4KEX	 |
1868
			MIPS_CPU_COUNTER |
R
Ralf Baechle 已提交
1869 1870 1871
			MIPS_CPU_DIVEC	 |
			MIPS_CPU_WATCH	 |
			MIPS_CPU_EJTAG	 |
1872 1873
			MIPS_CPU_LLSC);

1874
	switch (c->processor_id & PRID_IMP_MASK) {
1875
	case PRID_IMP_NETLOGIC_XLP2XX:
1876
	case PRID_IMP_NETLOGIC_XLP9XX:
1877
	case PRID_IMP_NETLOGIC_XLP5XX:
1878 1879 1880 1881
		c->cputype = CPU_XLP;
		__cpu_name[cpu] = "Broadcom XLPII";
		break;

1882 1883
	case PRID_IMP_NETLOGIC_XLP8XX:
	case PRID_IMP_NETLOGIC_XLP3XX:
J
Jayachandran C 已提交
1884 1885 1886 1887
		c->cputype = CPU_XLP;
		__cpu_name[cpu] = "Netlogic XLP";
		break;

1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917
	case PRID_IMP_NETLOGIC_XLR732:
	case PRID_IMP_NETLOGIC_XLR716:
	case PRID_IMP_NETLOGIC_XLR532:
	case PRID_IMP_NETLOGIC_XLR308:
	case PRID_IMP_NETLOGIC_XLR532C:
	case PRID_IMP_NETLOGIC_XLR516C:
	case PRID_IMP_NETLOGIC_XLR508C:
	case PRID_IMP_NETLOGIC_XLR308C:
		c->cputype = CPU_XLR;
		__cpu_name[cpu] = "Netlogic XLR";
		break;

	case PRID_IMP_NETLOGIC_XLS608:
	case PRID_IMP_NETLOGIC_XLS408:
	case PRID_IMP_NETLOGIC_XLS404:
	case PRID_IMP_NETLOGIC_XLS208:
	case PRID_IMP_NETLOGIC_XLS204:
	case PRID_IMP_NETLOGIC_XLS108:
	case PRID_IMP_NETLOGIC_XLS104:
	case PRID_IMP_NETLOGIC_XLS616B:
	case PRID_IMP_NETLOGIC_XLS608B:
	case PRID_IMP_NETLOGIC_XLS416B:
	case PRID_IMP_NETLOGIC_XLS412B:
	case PRID_IMP_NETLOGIC_XLS408B:
	case PRID_IMP_NETLOGIC_XLS404B:
		c->cputype = CPU_XLR;
		__cpu_name[cpu] = "Netlogic XLS";
		break;

	default:
J
Jayachandran C 已提交
1918
		pr_info("Unknown Netlogic chip id [%02x]!\n",
1919 1920 1921 1922 1923
		       c->processor_id);
		c->cputype = CPU_XLR;
		break;
	}

J
Jayachandran C 已提交
1924
	if (c->cputype == CPU_XLP) {
1925
		set_isa(c, MIPS_CPU_ISA_M64R2);
J
Jayachandran C 已提交
1926 1927 1928 1929
		c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK);
		/* This will be updated again after all threads are woken up */
		c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
	} else {
1930
		set_isa(c, MIPS_CPU_ISA_M64R1);
J
Jayachandran C 已提交
1931 1932
		c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1;
	}
1933
	c->kscratch_mask = 0xf;
1934 1935
}

1936 1937 1938 1939 1940 1941
#ifdef CONFIG_64BIT
/* For use by uaccess.h */
u64 __ua_limit;
EXPORT_SYMBOL(__ua_limit);
#endif

1942
const char *__cpu_name[NR_CPUS];
1943
const char *__elf_platform;
1944

1945
void cpu_probe(void)
L
Linus Torvalds 已提交
1946 1947
{
	struct cpuinfo_mips *c = &current_cpu_data;
1948
	unsigned int cpu = smp_processor_id();
L
Linus Torvalds 已提交
1949

R
Ralf Baechle 已提交
1950
	c->processor_id = PRID_IMP_UNKNOWN;
L
Linus Torvalds 已提交
1951 1952
	c->fpu_id	= FPIR_IMP_NONE;
	c->cputype	= CPU_UNKNOWN;
1953
	c->writecombine = _CACHE_UNCACHED;
L
Linus Torvalds 已提交
1954

1955 1956 1957
	c->fpu_csr31	= FPU_CSR_RN;
	c->fpu_msk31	= FPU_CSR_RSVD | FPU_CSR_ABS2008 | FPU_CSR_NAN2008;

L
Linus Torvalds 已提交
1958
	c->processor_id = read_c0_prid();
1959
	switch (c->processor_id & PRID_COMP_MASK) {
L
Linus Torvalds 已提交
1960
	case PRID_COMP_LEGACY:
1961
		cpu_probe_legacy(c, cpu);
L
Linus Torvalds 已提交
1962 1963
		break;
	case PRID_COMP_MIPS:
1964
		cpu_probe_mips(c, cpu);
L
Linus Torvalds 已提交
1965 1966
		break;
	case PRID_COMP_ALCHEMY:
1967
		cpu_probe_alchemy(c, cpu);
L
Linus Torvalds 已提交
1968 1969
		break;
	case PRID_COMP_SIBYTE:
1970
		cpu_probe_sibyte(c, cpu);
L
Linus Torvalds 已提交
1971
		break;
1972
	case PRID_COMP_BROADCOM:
1973
		cpu_probe_broadcom(c, cpu);
1974
		break;
L
Linus Torvalds 已提交
1975
	case PRID_COMP_SANDCRAFT:
1976
		cpu_probe_sandcraft(c, cpu);
L
Linus Torvalds 已提交
1977
		break;
1978
	case PRID_COMP_NXP:
1979
		cpu_probe_nxp(c, cpu);
1980
		break;
1981 1982 1983
	case PRID_COMP_CAVIUM:
		cpu_probe_cavium(c, cpu);
		break;
1984 1985 1986
	case PRID_COMP_LOONGSON:
		cpu_probe_loongson(c, cpu);
		break;
1987 1988 1989
	case PRID_COMP_INGENIC_D0:
	case PRID_COMP_INGENIC_D1:
	case PRID_COMP_INGENIC_E1:
1990 1991
		cpu_probe_ingenic(c, cpu);
		break;
1992 1993 1994
	case PRID_COMP_NETLOGIC:
		cpu_probe_netlogic(c, cpu);
		break;
L
Linus Torvalds 已提交
1995
	}
1996

1997 1998 1999
	BUG_ON(!__cpu_name[cpu]);
	BUG_ON(c->cputype == CPU_UNKNOWN);

2000 2001 2002 2003 2004 2005 2006
	/*
	 * Platform code can force the cpu type to optimize code
	 * generation. In that case be sure the cpu type is correctly
	 * manually setup otherwise it could trigger some nasty bugs.
	 */
	BUG_ON(current_cpu_type() != c->cputype);

2007 2008 2009 2010 2011 2012 2013 2014 2015
	if (cpu_has_rixi) {
		/* Enable the RIXI exceptions */
		set_c0_pagegrain(PG_IEC);
		back_to_back_c0_hazard();
		/* Verify the IEC bit is set */
		if (read_c0_pagegrain() & PG_IEC)
			c->options |= MIPS_CPU_RIXIEX;
	}

2016 2017 2018 2019
	if (mips_fpu_disabled)
		c->options &= ~MIPS_CPU_FPU;

	if (mips_dsp_disabled)
2020
		c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
2021

2022 2023 2024 2025 2026 2027
	if (mips_htw_disabled) {
		c->options &= ~MIPS_CPU_HTW;
		write_c0_pwctl(read_c0_pwctl() &
			       ~(1 << MIPS_PWCTL_PWEN_SHIFT));
	}

2028 2029 2030 2031
	if (c->options & MIPS_CPU_FPU)
		cpu_set_fpu_opts(c);
	else
		cpu_set_nofpu_opts(c);
2032

2033 2034 2035 2036
	if (cpu_has_bp_ghist)
		write_c0_r10k_diag(read_c0_r10k_diag() |
				   R10K_DIAG_E_GHIST);

2037
	if (cpu_has_mips_r2_r6) {
R
Ralf Baechle 已提交
2038
		c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
2039 2040 2041
		/* R2 has Performance Counter Interrupt indicator */
		c->options |= MIPS_CPU_PCI;
	}
R
Ralf Baechle 已提交
2042 2043
	else
		c->srsets = 1;
2044

2045 2046 2047
	if (cpu_has_mips_r6)
		elf_hwcap |= HWCAP_MIPS_R6;

2048
	if (cpu_has_msa) {
P
Paul Burton 已提交
2049
		c->msa_id = cpu_get_msa_id();
2050 2051
		WARN(c->msa_id & MSA_IR_WRPF,
		     "Vector register partitioning unimplemented!");
2052
		elf_hwcap |= HWCAP_MIPS_MSA;
2053
	}
P
Paul Burton 已提交
2054

2055 2056 2057
	if (cpu_has_vz)
		cpu_probe_vz(c);

2058
	cpu_probe_vmbits(c);
2059 2060 2061 2062 2063

#ifdef CONFIG_64BIT
	if (cpu == 0)
		__ua_limit = ~((1ull << cpu_vmbits) - 1);
#endif
L
Linus Torvalds 已提交
2064 2065
}

2066
void cpu_report(void)
L
Linus Torvalds 已提交
2067 2068 2069
{
	struct cpuinfo_mips *c = &current_cpu_data;

2070 2071
	pr_info("CPU%d revision is: %08x (%s)\n",
		smp_processor_id(), c->processor_id, cpu_name_string());
L
Linus Torvalds 已提交
2072
	if (c->options & MIPS_CPU_FPU)
2073
		printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id);
P
Paul Burton 已提交
2074 2075
	if (cpu_has_msa)
		pr_info("MSA revision is: %08x\n", c->msa_id);
L
Linus Torvalds 已提交
2076
}