cpu-probe.c 28 KB

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