cpu-probe.c 29 KB

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