cpu-probe.c 29 KB

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