cpu-probe.c 28 KB

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