cpu-probe.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221
  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;
  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_VINT)
  378. c->options |= MIPS_CPU_VINT;
  379. if (config3 & MIPS_CONF3_VEIC)
  380. c->options |= MIPS_CPU_VEIC;
  381. if (config3 & MIPS_CONF3_MT)
  382. c->ases |= MIPS_ASE_MIPSMT;
  383. if (config3 & MIPS_CONF3_ULRI)
  384. c->options |= MIPS_CPU_ULRI;
  385. return config3 & MIPS_CONF_M;
  386. }
  387. static inline unsigned int decode_config4(struct cpuinfo_mips *c)
  388. {
  389. unsigned int config4;
  390. config4 = read_c0_config4();
  391. if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT
  392. && cpu_has_tlb)
  393. c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
  394. c->kscratch_mask = (config4 >> 16) & 0xff;
  395. return config4 & MIPS_CONF_M;
  396. }
  397. static void __cpuinit decode_configs(struct cpuinfo_mips *c)
  398. {
  399. int ok;
  400. /* MIPS32 or MIPS64 compliant CPU. */
  401. c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
  402. MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
  403. c->scache.flags = MIPS_CACHE_NOT_PRESENT;
  404. ok = decode_config0(c); /* Read Config registers. */
  405. BUG_ON(!ok); /* Arch spec violation! */
  406. if (ok)
  407. ok = decode_config1(c);
  408. if (ok)
  409. ok = decode_config2(c);
  410. if (ok)
  411. ok = decode_config3(c);
  412. if (ok)
  413. ok = decode_config4(c);
  414. mips_probe_watch_registers(c);
  415. if (cpu_has_mips_r2)
  416. c->core = read_c0_ebase() & 0x3ff;
  417. }
  418. #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
  419. | MIPS_CPU_COUNTER)
  420. static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
  421. {
  422. switch (c->processor_id & 0xff00) {
  423. case PRID_IMP_R2000:
  424. c->cputype = CPU_R2000;
  425. __cpu_name[cpu] = "R2000";
  426. c->isa_level = MIPS_CPU_ISA_I;
  427. c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
  428. MIPS_CPU_NOFPUEX;
  429. if (__cpu_has_fpu())
  430. c->options |= MIPS_CPU_FPU;
  431. c->tlbsize = 64;
  432. break;
  433. case PRID_IMP_R3000:
  434. if ((c->processor_id & 0xff) == PRID_REV_R3000A) {
  435. if (cpu_has_confreg()) {
  436. c->cputype = CPU_R3081E;
  437. __cpu_name[cpu] = "R3081";
  438. } else {
  439. c->cputype = CPU_R3000A;
  440. __cpu_name[cpu] = "R3000A";
  441. }
  442. break;
  443. } else {
  444. c->cputype = CPU_R3000;
  445. __cpu_name[cpu] = "R3000";
  446. }
  447. c->isa_level = MIPS_CPU_ISA_I;
  448. c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
  449. MIPS_CPU_NOFPUEX;
  450. if (__cpu_has_fpu())
  451. c->options |= MIPS_CPU_FPU;
  452. c->tlbsize = 64;
  453. break;
  454. case PRID_IMP_R4000:
  455. if (read_c0_config() & CONF_SC) {
  456. if ((c->processor_id & 0xff) >= PRID_REV_R4400) {
  457. c->cputype = CPU_R4400PC;
  458. __cpu_name[cpu] = "R4400PC";
  459. } else {
  460. c->cputype = CPU_R4000PC;
  461. __cpu_name[cpu] = "R4000PC";
  462. }
  463. } else {
  464. if ((c->processor_id & 0xff) >= PRID_REV_R4400) {
  465. c->cputype = CPU_R4400SC;
  466. __cpu_name[cpu] = "R4400SC";
  467. } else {
  468. c->cputype = CPU_R4000SC;
  469. __cpu_name[cpu] = "R4000SC";
  470. }
  471. }
  472. c->isa_level = MIPS_CPU_ISA_III;
  473. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  474. MIPS_CPU_WATCH | MIPS_CPU_VCE |
  475. MIPS_CPU_LLSC;
  476. c->tlbsize = 48;
  477. break;
  478. case PRID_IMP_VR41XX:
  479. switch (c->processor_id & 0xf0) {
  480. case PRID_REV_VR4111:
  481. c->cputype = CPU_VR4111;
  482. __cpu_name[cpu] = "NEC VR4111";
  483. break;
  484. case PRID_REV_VR4121:
  485. c->cputype = CPU_VR4121;
  486. __cpu_name[cpu] = "NEC VR4121";
  487. break;
  488. case PRID_REV_VR4122:
  489. if ((c->processor_id & 0xf) < 0x3) {
  490. c->cputype = CPU_VR4122;
  491. __cpu_name[cpu] = "NEC VR4122";
  492. } else {
  493. c->cputype = CPU_VR4181A;
  494. __cpu_name[cpu] = "NEC VR4181A";
  495. }
  496. break;
  497. case PRID_REV_VR4130:
  498. if ((c->processor_id & 0xf) < 0x4) {
  499. c->cputype = CPU_VR4131;
  500. __cpu_name[cpu] = "NEC VR4131";
  501. } else {
  502. c->cputype = CPU_VR4133;
  503. __cpu_name[cpu] = "NEC VR4133";
  504. }
  505. break;
  506. default:
  507. printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
  508. c->cputype = CPU_VR41XX;
  509. __cpu_name[cpu] = "NEC Vr41xx";
  510. break;
  511. }
  512. c->isa_level = MIPS_CPU_ISA_III;
  513. c->options = R4K_OPTS;
  514. c->tlbsize = 32;
  515. break;
  516. case PRID_IMP_R4300:
  517. c->cputype = CPU_R4300;
  518. __cpu_name[cpu] = "R4300";
  519. c->isa_level = MIPS_CPU_ISA_III;
  520. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  521. MIPS_CPU_LLSC;
  522. c->tlbsize = 32;
  523. break;
  524. case PRID_IMP_R4600:
  525. c->cputype = CPU_R4600;
  526. __cpu_name[cpu] = "R4600";
  527. c->isa_level = MIPS_CPU_ISA_III;
  528. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  529. MIPS_CPU_LLSC;
  530. c->tlbsize = 48;
  531. break;
  532. #if 0
  533. case PRID_IMP_R4650:
  534. /*
  535. * This processor doesn't have an MMU, so it's not
  536. * "real easy" to run Linux on it. It is left purely
  537. * for documentation. Commented out because it shares
  538. * it's c0_prid id number with the TX3900.
  539. */
  540. c->cputype = CPU_R4650;
  541. __cpu_name[cpu] = "R4650";
  542. c->isa_level = MIPS_CPU_ISA_III;
  543. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
  544. c->tlbsize = 48;
  545. break;
  546. #endif
  547. case PRID_IMP_TX39:
  548. c->isa_level = MIPS_CPU_ISA_I;
  549. c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
  550. if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
  551. c->cputype = CPU_TX3927;
  552. __cpu_name[cpu] = "TX3927";
  553. c->tlbsize = 64;
  554. } else {
  555. switch (c->processor_id & 0xff) {
  556. case PRID_REV_TX3912:
  557. c->cputype = CPU_TX3912;
  558. __cpu_name[cpu] = "TX3912";
  559. c->tlbsize = 32;
  560. break;
  561. case PRID_REV_TX3922:
  562. c->cputype = CPU_TX3922;
  563. __cpu_name[cpu] = "TX3922";
  564. c->tlbsize = 64;
  565. break;
  566. }
  567. }
  568. break;
  569. case PRID_IMP_R4700:
  570. c->cputype = CPU_R4700;
  571. __cpu_name[cpu] = "R4700";
  572. c->isa_level = MIPS_CPU_ISA_III;
  573. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  574. MIPS_CPU_LLSC;
  575. c->tlbsize = 48;
  576. break;
  577. case PRID_IMP_TX49:
  578. c->cputype = CPU_TX49XX;
  579. __cpu_name[cpu] = "R49XX";
  580. c->isa_level = MIPS_CPU_ISA_III;
  581. c->options = R4K_OPTS | MIPS_CPU_LLSC;
  582. if (!(c->processor_id & 0x08))
  583. c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
  584. c->tlbsize = 48;
  585. break;
  586. case PRID_IMP_R5000:
  587. c->cputype = CPU_R5000;
  588. __cpu_name[cpu] = "R5000";
  589. c->isa_level = MIPS_CPU_ISA_IV;
  590. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  591. MIPS_CPU_LLSC;
  592. c->tlbsize = 48;
  593. break;
  594. case PRID_IMP_R5432:
  595. c->cputype = CPU_R5432;
  596. __cpu_name[cpu] = "R5432";
  597. c->isa_level = MIPS_CPU_ISA_IV;
  598. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  599. MIPS_CPU_WATCH | MIPS_CPU_LLSC;
  600. c->tlbsize = 48;
  601. break;
  602. case PRID_IMP_R5500:
  603. c->cputype = CPU_R5500;
  604. __cpu_name[cpu] = "R5500";
  605. c->isa_level = MIPS_CPU_ISA_IV;
  606. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  607. MIPS_CPU_WATCH | MIPS_CPU_LLSC;
  608. c->tlbsize = 48;
  609. break;
  610. case PRID_IMP_NEVADA:
  611. c->cputype = CPU_NEVADA;
  612. __cpu_name[cpu] = "Nevada";
  613. c->isa_level = MIPS_CPU_ISA_IV;
  614. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  615. MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
  616. c->tlbsize = 48;
  617. break;
  618. case PRID_IMP_R6000:
  619. c->cputype = CPU_R6000;
  620. __cpu_name[cpu] = "R6000";
  621. c->isa_level = MIPS_CPU_ISA_II;
  622. c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
  623. MIPS_CPU_LLSC;
  624. c->tlbsize = 32;
  625. break;
  626. case PRID_IMP_R6000A:
  627. c->cputype = CPU_R6000A;
  628. __cpu_name[cpu] = "R6000A";
  629. c->isa_level = MIPS_CPU_ISA_II;
  630. c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
  631. MIPS_CPU_LLSC;
  632. c->tlbsize = 32;
  633. break;
  634. case PRID_IMP_RM7000:
  635. c->cputype = CPU_RM7000;
  636. __cpu_name[cpu] = "RM7000";
  637. c->isa_level = MIPS_CPU_ISA_IV;
  638. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  639. MIPS_CPU_LLSC;
  640. /*
  641. * Undocumented RM7000: Bit 29 in the info register of
  642. * the RM7000 v2.0 indicates if the TLB has 48 or 64
  643. * entries.
  644. *
  645. * 29 1 => 64 entry JTLB
  646. * 0 => 48 entry JTLB
  647. */
  648. c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
  649. break;
  650. case PRID_IMP_RM9000:
  651. c->cputype = CPU_RM9000;
  652. __cpu_name[cpu] = "RM9000";
  653. c->isa_level = MIPS_CPU_ISA_IV;
  654. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  655. MIPS_CPU_LLSC;
  656. /*
  657. * Bit 29 in the info register of the RM9000
  658. * indicates if the TLB has 48 or 64 entries.
  659. *
  660. * 29 1 => 64 entry JTLB
  661. * 0 => 48 entry JTLB
  662. */
  663. c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
  664. break;
  665. case PRID_IMP_R8000:
  666. c->cputype = CPU_R8000;
  667. __cpu_name[cpu] = "RM8000";
  668. c->isa_level = MIPS_CPU_ISA_IV;
  669. c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
  670. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  671. MIPS_CPU_LLSC;
  672. c->tlbsize = 384; /* has weird TLB: 3-way x 128 */
  673. break;
  674. case PRID_IMP_R10000:
  675. c->cputype = CPU_R10000;
  676. __cpu_name[cpu] = "R10000";
  677. c->isa_level = MIPS_CPU_ISA_IV;
  678. c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
  679. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  680. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  681. MIPS_CPU_LLSC;
  682. c->tlbsize = 64;
  683. break;
  684. case PRID_IMP_R12000:
  685. c->cputype = CPU_R12000;
  686. __cpu_name[cpu] = "R12000";
  687. c->isa_level = MIPS_CPU_ISA_IV;
  688. c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
  689. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  690. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  691. MIPS_CPU_LLSC;
  692. c->tlbsize = 64;
  693. break;
  694. case PRID_IMP_R14000:
  695. c->cputype = CPU_R14000;
  696. __cpu_name[cpu] = "R14000";
  697. c->isa_level = MIPS_CPU_ISA_IV;
  698. c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
  699. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  700. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  701. MIPS_CPU_LLSC;
  702. c->tlbsize = 64;
  703. break;
  704. case PRID_IMP_LOONGSON2:
  705. c->cputype = CPU_LOONGSON2;
  706. __cpu_name[cpu] = "ICT Loongson-2";
  707. switch (c->processor_id & PRID_REV_MASK) {
  708. case PRID_REV_LOONGSON2E:
  709. set_elf_platform(cpu, "loongson2e");
  710. break;
  711. case PRID_REV_LOONGSON2F:
  712. set_elf_platform(cpu, "loongson2f");
  713. break;
  714. }
  715. c->isa_level = MIPS_CPU_ISA_III;
  716. c->options = R4K_OPTS |
  717. MIPS_CPU_FPU | MIPS_CPU_LLSC |
  718. MIPS_CPU_32FPR;
  719. c->tlbsize = 64;
  720. break;
  721. case PRID_IMP_LOONGSON1:
  722. decode_configs(c);
  723. c->cputype = CPU_LOONGSON1;
  724. switch (c->processor_id & PRID_REV_MASK) {
  725. case PRID_REV_LOONGSON1B:
  726. __cpu_name[cpu] = "Loongson 1B";
  727. break;
  728. }
  729. break;
  730. }
  731. }
  732. static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
  733. {
  734. decode_configs(c);
  735. switch (c->processor_id & 0xff00) {
  736. case PRID_IMP_4KC:
  737. c->cputype = CPU_4KC;
  738. __cpu_name[cpu] = "MIPS 4Kc";
  739. break;
  740. case PRID_IMP_4KEC:
  741. case PRID_IMP_4KECR2:
  742. c->cputype = CPU_4KEC;
  743. __cpu_name[cpu] = "MIPS 4KEc";
  744. break;
  745. case PRID_IMP_4KSC:
  746. case PRID_IMP_4KSD:
  747. c->cputype = CPU_4KSC;
  748. __cpu_name[cpu] = "MIPS 4KSc";
  749. break;
  750. case PRID_IMP_5KC:
  751. c->cputype = CPU_5KC;
  752. __cpu_name[cpu] = "MIPS 5Kc";
  753. break;
  754. case PRID_IMP_5KE:
  755. c->cputype = CPU_5KE;
  756. __cpu_name[cpu] = "MIPS 5KE";
  757. break;
  758. case PRID_IMP_20KC:
  759. c->cputype = CPU_20KC;
  760. __cpu_name[cpu] = "MIPS 20Kc";
  761. break;
  762. case PRID_IMP_24K:
  763. case PRID_IMP_24KE:
  764. c->cputype = CPU_24K;
  765. __cpu_name[cpu] = "MIPS 24Kc";
  766. break;
  767. case PRID_IMP_25KF:
  768. c->cputype = CPU_25KF;
  769. __cpu_name[cpu] = "MIPS 25Kc";
  770. break;
  771. case PRID_IMP_34K:
  772. c->cputype = CPU_34K;
  773. __cpu_name[cpu] = "MIPS 34Kc";
  774. break;
  775. case PRID_IMP_74K:
  776. c->cputype = CPU_74K;
  777. __cpu_name[cpu] = "MIPS 74Kc";
  778. break;
  779. case PRID_IMP_M14KC:
  780. c->cputype = CPU_M14KC;
  781. __cpu_name[cpu] = "MIPS M14Kc";
  782. break;
  783. case PRID_IMP_1004K:
  784. c->cputype = CPU_1004K;
  785. __cpu_name[cpu] = "MIPS 1004Kc";
  786. break;
  787. case PRID_IMP_1074K:
  788. c->cputype = CPU_74K;
  789. __cpu_name[cpu] = "MIPS 1074Kc";
  790. break;
  791. }
  792. spram_config();
  793. }
  794. static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
  795. {
  796. decode_configs(c);
  797. switch (c->processor_id & 0xff00) {
  798. case PRID_IMP_AU1_REV1:
  799. case PRID_IMP_AU1_REV2:
  800. c->cputype = CPU_ALCHEMY;
  801. switch ((c->processor_id >> 24) & 0xff) {
  802. case 0:
  803. __cpu_name[cpu] = "Au1000";
  804. break;
  805. case 1:
  806. __cpu_name[cpu] = "Au1500";
  807. break;
  808. case 2:
  809. __cpu_name[cpu] = "Au1100";
  810. break;
  811. case 3:
  812. __cpu_name[cpu] = "Au1550";
  813. break;
  814. case 4:
  815. __cpu_name[cpu] = "Au1200";
  816. if ((c->processor_id & 0xff) == 2)
  817. __cpu_name[cpu] = "Au1250";
  818. break;
  819. case 5:
  820. __cpu_name[cpu] = "Au1210";
  821. break;
  822. default:
  823. __cpu_name[cpu] = "Au1xxx";
  824. break;
  825. }
  826. break;
  827. }
  828. }
  829. static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
  830. {
  831. decode_configs(c);
  832. switch (c->processor_id & 0xff00) {
  833. case PRID_IMP_SB1:
  834. c->cputype = CPU_SB1;
  835. __cpu_name[cpu] = "SiByte SB1";
  836. /* FPU in pass1 is known to have issues. */
  837. if ((c->processor_id & 0xff) < 0x02)
  838. c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
  839. break;
  840. case PRID_IMP_SB1A:
  841. c->cputype = CPU_SB1A;
  842. __cpu_name[cpu] = "SiByte SB1A";
  843. break;
  844. }
  845. }
  846. static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c, unsigned int cpu)
  847. {
  848. decode_configs(c);
  849. switch (c->processor_id & 0xff00) {
  850. case PRID_IMP_SR71000:
  851. c->cputype = CPU_SR71000;
  852. __cpu_name[cpu] = "Sandcraft SR71000";
  853. c->scache.ways = 8;
  854. c->tlbsize = 64;
  855. break;
  856. }
  857. }
  858. static inline void cpu_probe_nxp(struct cpuinfo_mips *c, unsigned int cpu)
  859. {
  860. decode_configs(c);
  861. switch (c->processor_id & 0xff00) {
  862. case PRID_IMP_PR4450:
  863. c->cputype = CPU_PR4450;
  864. __cpu_name[cpu] = "Philips PR4450";
  865. c->isa_level = MIPS_CPU_ISA_M32R1;
  866. break;
  867. }
  868. }
  869. static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
  870. {
  871. decode_configs(c);
  872. switch (c->processor_id & 0xff00) {
  873. case PRID_IMP_BMIPS32_REV4:
  874. case PRID_IMP_BMIPS32_REV8:
  875. c->cputype = CPU_BMIPS32;
  876. __cpu_name[cpu] = "Broadcom BMIPS32";
  877. set_elf_platform(cpu, "bmips32");
  878. break;
  879. case PRID_IMP_BMIPS3300:
  880. case PRID_IMP_BMIPS3300_ALT:
  881. case PRID_IMP_BMIPS3300_BUG:
  882. c->cputype = CPU_BMIPS3300;
  883. __cpu_name[cpu] = "Broadcom BMIPS3300";
  884. set_elf_platform(cpu, "bmips3300");
  885. break;
  886. case PRID_IMP_BMIPS43XX: {
  887. int rev = c->processor_id & 0xff;
  888. if (rev >= PRID_REV_BMIPS4380_LO &&
  889. rev <= PRID_REV_BMIPS4380_HI) {
  890. c->cputype = CPU_BMIPS4380;
  891. __cpu_name[cpu] = "Broadcom BMIPS4380";
  892. set_elf_platform(cpu, "bmips4380");
  893. } else {
  894. c->cputype = CPU_BMIPS4350;
  895. __cpu_name[cpu] = "Broadcom BMIPS4350";
  896. set_elf_platform(cpu, "bmips4350");
  897. }
  898. break;
  899. }
  900. case PRID_IMP_BMIPS5000:
  901. c->cputype = CPU_BMIPS5000;
  902. __cpu_name[cpu] = "Broadcom BMIPS5000";
  903. set_elf_platform(cpu, "bmips5000");
  904. c->options |= MIPS_CPU_ULRI;
  905. break;
  906. }
  907. }
  908. static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
  909. {
  910. decode_configs(c);
  911. switch (c->processor_id & 0xff00) {
  912. case PRID_IMP_CAVIUM_CN38XX:
  913. case PRID_IMP_CAVIUM_CN31XX:
  914. case PRID_IMP_CAVIUM_CN30XX:
  915. c->cputype = CPU_CAVIUM_OCTEON;
  916. __cpu_name[cpu] = "Cavium Octeon";
  917. goto platform;
  918. case PRID_IMP_CAVIUM_CN58XX:
  919. case PRID_IMP_CAVIUM_CN56XX:
  920. case PRID_IMP_CAVIUM_CN50XX:
  921. case PRID_IMP_CAVIUM_CN52XX:
  922. c->cputype = CPU_CAVIUM_OCTEON_PLUS;
  923. __cpu_name[cpu] = "Cavium Octeon+";
  924. platform:
  925. set_elf_platform(cpu, "octeon");
  926. break;
  927. case PRID_IMP_CAVIUM_CN61XX:
  928. case PRID_IMP_CAVIUM_CN63XX:
  929. case PRID_IMP_CAVIUM_CN66XX:
  930. case PRID_IMP_CAVIUM_CN68XX:
  931. c->cputype = CPU_CAVIUM_OCTEON2;
  932. __cpu_name[cpu] = "Cavium Octeon II";
  933. set_elf_platform(cpu, "octeon2");
  934. break;
  935. default:
  936. printk(KERN_INFO "Unknown Octeon chip!\n");
  937. c->cputype = CPU_UNKNOWN;
  938. break;
  939. }
  940. }
  941. static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
  942. {
  943. decode_configs(c);
  944. /* JZRISC does not implement the CP0 counter. */
  945. c->options &= ~MIPS_CPU_COUNTER;
  946. switch (c->processor_id & 0xff00) {
  947. case PRID_IMP_JZRISC:
  948. c->cputype = CPU_JZRISC;
  949. __cpu_name[cpu] = "Ingenic JZRISC";
  950. break;
  951. default:
  952. panic("Unknown Ingenic Processor ID!");
  953. break;
  954. }
  955. }
  956. static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
  957. {
  958. decode_configs(c);
  959. if ((c->processor_id & 0xff00) == PRID_IMP_NETLOGIC_AU13XX) {
  960. c->cputype = CPU_ALCHEMY;
  961. __cpu_name[cpu] = "Au1300";
  962. /* following stuff is not for Alchemy */
  963. return;
  964. }
  965. c->options = (MIPS_CPU_TLB |
  966. MIPS_CPU_4KEX |
  967. MIPS_CPU_COUNTER |
  968. MIPS_CPU_DIVEC |
  969. MIPS_CPU_WATCH |
  970. MIPS_CPU_EJTAG |
  971. MIPS_CPU_LLSC);
  972. switch (c->processor_id & 0xff00) {
  973. case PRID_IMP_NETLOGIC_XLP8XX:
  974. case PRID_IMP_NETLOGIC_XLP3XX:
  975. c->cputype = CPU_XLP;
  976. __cpu_name[cpu] = "Netlogic XLP";
  977. break;
  978. case PRID_IMP_NETLOGIC_XLR732:
  979. case PRID_IMP_NETLOGIC_XLR716:
  980. case PRID_IMP_NETLOGIC_XLR532:
  981. case PRID_IMP_NETLOGIC_XLR308:
  982. case PRID_IMP_NETLOGIC_XLR532C:
  983. case PRID_IMP_NETLOGIC_XLR516C:
  984. case PRID_IMP_NETLOGIC_XLR508C:
  985. case PRID_IMP_NETLOGIC_XLR308C:
  986. c->cputype = CPU_XLR;
  987. __cpu_name[cpu] = "Netlogic XLR";
  988. break;
  989. case PRID_IMP_NETLOGIC_XLS608:
  990. case PRID_IMP_NETLOGIC_XLS408:
  991. case PRID_IMP_NETLOGIC_XLS404:
  992. case PRID_IMP_NETLOGIC_XLS208:
  993. case PRID_IMP_NETLOGIC_XLS204:
  994. case PRID_IMP_NETLOGIC_XLS108:
  995. case PRID_IMP_NETLOGIC_XLS104:
  996. case PRID_IMP_NETLOGIC_XLS616B:
  997. case PRID_IMP_NETLOGIC_XLS608B:
  998. case PRID_IMP_NETLOGIC_XLS416B:
  999. case PRID_IMP_NETLOGIC_XLS412B:
  1000. case PRID_IMP_NETLOGIC_XLS408B:
  1001. case PRID_IMP_NETLOGIC_XLS404B:
  1002. c->cputype = CPU_XLR;
  1003. __cpu_name[cpu] = "Netlogic XLS";
  1004. break;
  1005. default:
  1006. pr_info("Unknown Netlogic chip id [%02x]!\n",
  1007. c->processor_id);
  1008. c->cputype = CPU_XLR;
  1009. break;
  1010. }
  1011. if (c->cputype == CPU_XLP) {
  1012. c->isa_level = MIPS_CPU_ISA_M64R2;
  1013. c->options |= (MIPS_CPU_FPU | MIPS_CPU_ULRI | MIPS_CPU_MCHECK);
  1014. /* This will be updated again after all threads are woken up */
  1015. c->tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
  1016. } else {
  1017. c->isa_level = MIPS_CPU_ISA_M64R1;
  1018. c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1;
  1019. }
  1020. }
  1021. #ifdef CONFIG_64BIT
  1022. /* For use by uaccess.h */
  1023. u64 __ua_limit;
  1024. EXPORT_SYMBOL(__ua_limit);
  1025. #endif
  1026. const char *__cpu_name[NR_CPUS];
  1027. const char *__elf_platform;
  1028. __cpuinit void cpu_probe(void)
  1029. {
  1030. struct cpuinfo_mips *c = &current_cpu_data;
  1031. unsigned int cpu = smp_processor_id();
  1032. c->processor_id = PRID_IMP_UNKNOWN;
  1033. c->fpu_id = FPIR_IMP_NONE;
  1034. c->cputype = CPU_UNKNOWN;
  1035. c->processor_id = read_c0_prid();
  1036. switch (c->processor_id & 0xff0000) {
  1037. case PRID_COMP_LEGACY:
  1038. cpu_probe_legacy(c, cpu);
  1039. break;
  1040. case PRID_COMP_MIPS:
  1041. cpu_probe_mips(c, cpu);
  1042. break;
  1043. case PRID_COMP_ALCHEMY:
  1044. cpu_probe_alchemy(c, cpu);
  1045. break;
  1046. case PRID_COMP_SIBYTE:
  1047. cpu_probe_sibyte(c, cpu);
  1048. break;
  1049. case PRID_COMP_BROADCOM:
  1050. cpu_probe_broadcom(c, cpu);
  1051. break;
  1052. case PRID_COMP_SANDCRAFT:
  1053. cpu_probe_sandcraft(c, cpu);
  1054. break;
  1055. case PRID_COMP_NXP:
  1056. cpu_probe_nxp(c, cpu);
  1057. break;
  1058. case PRID_COMP_CAVIUM:
  1059. cpu_probe_cavium(c, cpu);
  1060. break;
  1061. case PRID_COMP_INGENIC:
  1062. cpu_probe_ingenic(c, cpu);
  1063. break;
  1064. case PRID_COMP_NETLOGIC:
  1065. cpu_probe_netlogic(c, cpu);
  1066. break;
  1067. }
  1068. BUG_ON(!__cpu_name[cpu]);
  1069. BUG_ON(c->cputype == CPU_UNKNOWN);
  1070. /*
  1071. * Platform code can force the cpu type to optimize code
  1072. * generation. In that case be sure the cpu type is correctly
  1073. * manually setup otherwise it could trigger some nasty bugs.
  1074. */
  1075. BUG_ON(current_cpu_type() != c->cputype);
  1076. if (mips_fpu_disabled)
  1077. c->options &= ~MIPS_CPU_FPU;
  1078. if (mips_dsp_disabled)
  1079. c->ases &= ~MIPS_ASE_DSP;
  1080. if (c->options & MIPS_CPU_FPU) {
  1081. c->fpu_id = cpu_get_fpu_id();
  1082. if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
  1083. c->isa_level == MIPS_CPU_ISA_M32R2 ||
  1084. c->isa_level == MIPS_CPU_ISA_M64R1 ||
  1085. c->isa_level == MIPS_CPU_ISA_M64R2) {
  1086. if (c->fpu_id & MIPS_FPIR_3D)
  1087. c->ases |= MIPS_ASE_MIPS3D;
  1088. }
  1089. }
  1090. if (cpu_has_mips_r2) {
  1091. c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
  1092. /* R2 has Performance Counter Interrupt indicator */
  1093. c->options |= MIPS_CPU_PCI;
  1094. }
  1095. else
  1096. c->srsets = 1;
  1097. cpu_probe_vmbits(c);
  1098. #ifdef CONFIG_64BIT
  1099. if (cpu == 0)
  1100. __ua_limit = ~((1ull << cpu_vmbits) - 1);
  1101. #endif
  1102. }
  1103. __cpuinit void cpu_report(void)
  1104. {
  1105. struct cpuinfo_mips *c = &current_cpu_data;
  1106. printk(KERN_INFO "CPU revision is: %08x (%s)\n",
  1107. c->processor_id, cpu_name_string());
  1108. if (c->options & MIPS_CPU_FPU)
  1109. printk(KERN_INFO "FPU revision is: %08x\n", c->fpu_id);
  1110. }