cpu-probe.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * Processor capabilities determination functions.
  3. *
  4. * Copyright (C) xxxx the Anonymous
  5. * Copyright (C) 2003, 2004 Maciej W. Rozycki
  6. * Copyright (C) 1994 - 2003 Ralf Baechle
  7. * Copyright (C) 2001, 2004 MIPS 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/config.h>
  15. #include <linux/init.h>
  16. #include <linux/kernel.h>
  17. #include <linux/ptrace.h>
  18. #include <linux/stddef.h>
  19. #include <asm/cpu.h>
  20. #include <asm/fpu.h>
  21. #include <asm/mipsregs.h>
  22. #include <asm/system.h>
  23. /*
  24. * Not all of the MIPS CPUs have the "wait" instruction available. Moreover,
  25. * the implementation of the "wait" feature differs between CPU families. This
  26. * points to the function that implements CPU specific wait.
  27. * The wait instruction stops the pipeline and reduces the power consumption of
  28. * the CPU very much.
  29. */
  30. void (*cpu_wait)(void) = NULL;
  31. static void r3081_wait(void)
  32. {
  33. unsigned long cfg = read_c0_conf();
  34. write_c0_conf(cfg | R30XX_CONF_HALT);
  35. }
  36. static void r39xx_wait(void)
  37. {
  38. unsigned long cfg = read_c0_conf();
  39. write_c0_conf(cfg | TX39_CONF_HALT);
  40. }
  41. static void r4k_wait(void)
  42. {
  43. __asm__(".set\tmips3\n\t"
  44. "wait\n\t"
  45. ".set\tmips0");
  46. }
  47. /* The Au1xxx wait is available only if using 32khz counter or
  48. * external timer source, but specifically not CP0 Counter. */
  49. int allow_au1k_wait;
  50. static void au1k_wait(void)
  51. {
  52. /* using the wait instruction makes CP0 counter unusable */
  53. __asm__(".set mips3\n\t"
  54. "cache 0x14, 0(%0)\n\t"
  55. "cache 0x14, 32(%0)\n\t"
  56. "sync\n\t"
  57. "nop\n\t"
  58. "wait\n\t"
  59. "nop\n\t"
  60. "nop\n\t"
  61. "nop\n\t"
  62. "nop\n\t"
  63. ".set mips0\n\t"
  64. : : "r" (au1k_wait));
  65. }
  66. static int __initdata nowait = 0;
  67. int __init wait_disable(char *s)
  68. {
  69. nowait = 1;
  70. return 1;
  71. }
  72. __setup("nowait", wait_disable);
  73. static inline void check_wait(void)
  74. {
  75. struct cpuinfo_mips *c = &current_cpu_data;
  76. printk("Checking for 'wait' instruction... ");
  77. if (nowait) {
  78. printk (" disabled.\n");
  79. return;
  80. }
  81. switch (c->cputype) {
  82. case CPU_R3081:
  83. case CPU_R3081E:
  84. cpu_wait = r3081_wait;
  85. printk(" available.\n");
  86. break;
  87. case CPU_TX3927:
  88. cpu_wait = r39xx_wait;
  89. printk(" available.\n");
  90. break;
  91. case CPU_R4200:
  92. /* case CPU_R4300: */
  93. case CPU_R4600:
  94. case CPU_R4640:
  95. case CPU_R4650:
  96. case CPU_R4700:
  97. case CPU_R5000:
  98. case CPU_NEVADA:
  99. case CPU_RM7000:
  100. case CPU_RM9000:
  101. case CPU_TX49XX:
  102. case CPU_4KC:
  103. case CPU_4KEC:
  104. case CPU_4KSC:
  105. case CPU_5KC:
  106. /* case CPU_20KC:*/
  107. case CPU_24K:
  108. case CPU_25KF:
  109. case CPU_34K:
  110. case CPU_PR4450:
  111. cpu_wait = r4k_wait;
  112. printk(" available.\n");
  113. break;
  114. case CPU_AU1000:
  115. case CPU_AU1100:
  116. case CPU_AU1500:
  117. case CPU_AU1550:
  118. case CPU_AU1200:
  119. if (allow_au1k_wait) {
  120. cpu_wait = au1k_wait;
  121. printk(" available.\n");
  122. } else
  123. printk(" unavailable.\n");
  124. break;
  125. default:
  126. printk(" unavailable.\n");
  127. break;
  128. }
  129. }
  130. void __init check_bugs32(void)
  131. {
  132. check_wait();
  133. }
  134. /*
  135. * Probe whether cpu has config register by trying to play with
  136. * alternate cache bit and see whether it matters.
  137. * It's used by cpu_probe to distinguish between R3000A and R3081.
  138. */
  139. static inline int cpu_has_confreg(void)
  140. {
  141. #ifdef CONFIG_CPU_R3000
  142. extern unsigned long r3k_cache_size(unsigned long);
  143. unsigned long size1, size2;
  144. unsigned long cfg = read_c0_conf();
  145. size1 = r3k_cache_size(ST0_ISC);
  146. write_c0_conf(cfg ^ R30XX_CONF_AC);
  147. size2 = r3k_cache_size(ST0_ISC);
  148. write_c0_conf(cfg);
  149. return size1 != size2;
  150. #else
  151. return 0;
  152. #endif
  153. }
  154. /*
  155. * Get the FPU Implementation/Revision.
  156. */
  157. static inline unsigned long cpu_get_fpu_id(void)
  158. {
  159. unsigned long tmp, fpu_id;
  160. tmp = read_c0_status();
  161. __enable_fpu();
  162. fpu_id = read_32bit_cp1_register(CP1_REVISION);
  163. write_c0_status(tmp);
  164. return fpu_id;
  165. }
  166. /*
  167. * Check the CPU has an FPU the official way.
  168. */
  169. static inline int __cpu_has_fpu(void)
  170. {
  171. return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE);
  172. }
  173. #define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4KTLB \
  174. | MIPS_CPU_COUNTER)
  175. static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
  176. {
  177. switch (c->processor_id & 0xff00) {
  178. case PRID_IMP_R2000:
  179. c->cputype = CPU_R2000;
  180. c->isa_level = MIPS_CPU_ISA_I;
  181. c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX;
  182. if (__cpu_has_fpu())
  183. c->options |= MIPS_CPU_FPU;
  184. c->tlbsize = 64;
  185. break;
  186. case PRID_IMP_R3000:
  187. if ((c->processor_id & 0xff) == PRID_REV_R3000A)
  188. if (cpu_has_confreg())
  189. c->cputype = CPU_R3081E;
  190. else
  191. c->cputype = CPU_R3000A;
  192. else
  193. c->cputype = CPU_R3000;
  194. c->isa_level = MIPS_CPU_ISA_I;
  195. c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX;
  196. if (__cpu_has_fpu())
  197. c->options |= MIPS_CPU_FPU;
  198. c->tlbsize = 64;
  199. break;
  200. case PRID_IMP_R4000:
  201. if (read_c0_config() & CONF_SC) {
  202. if ((c->processor_id & 0xff) >= PRID_REV_R4400)
  203. c->cputype = CPU_R4400PC;
  204. else
  205. c->cputype = CPU_R4000PC;
  206. } else {
  207. if ((c->processor_id & 0xff) >= PRID_REV_R4400)
  208. c->cputype = CPU_R4400SC;
  209. else
  210. c->cputype = CPU_R4000SC;
  211. }
  212. c->isa_level = MIPS_CPU_ISA_III;
  213. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  214. MIPS_CPU_WATCH | MIPS_CPU_VCE |
  215. MIPS_CPU_LLSC;
  216. c->tlbsize = 48;
  217. break;
  218. case PRID_IMP_VR41XX:
  219. switch (c->processor_id & 0xf0) {
  220. case PRID_REV_VR4111:
  221. c->cputype = CPU_VR4111;
  222. break;
  223. case PRID_REV_VR4121:
  224. c->cputype = CPU_VR4121;
  225. break;
  226. case PRID_REV_VR4122:
  227. if ((c->processor_id & 0xf) < 0x3)
  228. c->cputype = CPU_VR4122;
  229. else
  230. c->cputype = CPU_VR4181A;
  231. break;
  232. case PRID_REV_VR4130:
  233. if ((c->processor_id & 0xf) < 0x4)
  234. c->cputype = CPU_VR4131;
  235. else
  236. c->cputype = CPU_VR4133;
  237. break;
  238. default:
  239. printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
  240. c->cputype = CPU_VR41XX;
  241. break;
  242. }
  243. c->isa_level = MIPS_CPU_ISA_III;
  244. c->options = R4K_OPTS;
  245. c->tlbsize = 32;
  246. break;
  247. case PRID_IMP_R4300:
  248. c->cputype = CPU_R4300;
  249. c->isa_level = MIPS_CPU_ISA_III;
  250. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  251. MIPS_CPU_LLSC;
  252. c->tlbsize = 32;
  253. break;
  254. case PRID_IMP_R4600:
  255. c->cputype = CPU_R4600;
  256. c->isa_level = MIPS_CPU_ISA_III;
  257. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  258. MIPS_CPU_LLSC;
  259. c->tlbsize = 48;
  260. break;
  261. #if 0
  262. case PRID_IMP_R4650:
  263. /*
  264. * This processor doesn't have an MMU, so it's not
  265. * "real easy" to run Linux on it. It is left purely
  266. * for documentation. Commented out because it shares
  267. * it's c0_prid id number with the TX3900.
  268. */
  269. c->cputype = CPU_R4650;
  270. c->isa_level = MIPS_CPU_ISA_III;
  271. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
  272. c->tlbsize = 48;
  273. break;
  274. #endif
  275. case PRID_IMP_TX39:
  276. c->isa_level = MIPS_CPU_ISA_I;
  277. c->options = MIPS_CPU_TLB;
  278. if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
  279. c->cputype = CPU_TX3927;
  280. c->tlbsize = 64;
  281. } else {
  282. switch (c->processor_id & 0xff) {
  283. case PRID_REV_TX3912:
  284. c->cputype = CPU_TX3912;
  285. c->tlbsize = 32;
  286. break;
  287. case PRID_REV_TX3922:
  288. c->cputype = CPU_TX3922;
  289. c->tlbsize = 64;
  290. break;
  291. default:
  292. c->cputype = CPU_UNKNOWN;
  293. break;
  294. }
  295. }
  296. break;
  297. case PRID_IMP_R4700:
  298. c->cputype = CPU_R4700;
  299. c->isa_level = MIPS_CPU_ISA_III;
  300. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  301. MIPS_CPU_LLSC;
  302. c->tlbsize = 48;
  303. break;
  304. case PRID_IMP_TX49:
  305. c->cputype = CPU_TX49XX;
  306. c->isa_level = MIPS_CPU_ISA_III;
  307. c->options = R4K_OPTS | MIPS_CPU_LLSC;
  308. if (!(c->processor_id & 0x08))
  309. c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
  310. c->tlbsize = 48;
  311. break;
  312. case PRID_IMP_R5000:
  313. c->cputype = CPU_R5000;
  314. c->isa_level = MIPS_CPU_ISA_IV;
  315. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  316. MIPS_CPU_LLSC;
  317. c->tlbsize = 48;
  318. break;
  319. case PRID_IMP_R5432:
  320. c->cputype = CPU_R5432;
  321. c->isa_level = MIPS_CPU_ISA_IV;
  322. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  323. MIPS_CPU_WATCH | MIPS_CPU_LLSC;
  324. c->tlbsize = 48;
  325. break;
  326. case PRID_IMP_R5500:
  327. c->cputype = CPU_R5500;
  328. c->isa_level = MIPS_CPU_ISA_IV;
  329. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  330. MIPS_CPU_WATCH | MIPS_CPU_LLSC;
  331. c->tlbsize = 48;
  332. break;
  333. case PRID_IMP_NEVADA:
  334. c->cputype = CPU_NEVADA;
  335. c->isa_level = MIPS_CPU_ISA_IV;
  336. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  337. MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
  338. c->tlbsize = 48;
  339. break;
  340. case PRID_IMP_R6000:
  341. c->cputype = CPU_R6000;
  342. c->isa_level = MIPS_CPU_ISA_II;
  343. c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
  344. MIPS_CPU_LLSC;
  345. c->tlbsize = 32;
  346. break;
  347. case PRID_IMP_R6000A:
  348. c->cputype = CPU_R6000A;
  349. c->isa_level = MIPS_CPU_ISA_II;
  350. c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
  351. MIPS_CPU_LLSC;
  352. c->tlbsize = 32;
  353. break;
  354. case PRID_IMP_RM7000:
  355. c->cputype = CPU_RM7000;
  356. c->isa_level = MIPS_CPU_ISA_IV;
  357. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  358. MIPS_CPU_LLSC;
  359. /*
  360. * Undocumented RM7000: Bit 29 in the info register of
  361. * the RM7000 v2.0 indicates if the TLB has 48 or 64
  362. * entries.
  363. *
  364. * 29 1 => 64 entry JTLB
  365. * 0 => 48 entry JTLB
  366. */
  367. c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
  368. break;
  369. case PRID_IMP_RM9000:
  370. c->cputype = CPU_RM9000;
  371. c->isa_level = MIPS_CPU_ISA_IV;
  372. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  373. MIPS_CPU_LLSC;
  374. /*
  375. * Bit 29 in the info register of the RM9000
  376. * indicates if the TLB has 48 or 64 entries.
  377. *
  378. * 29 1 => 64 entry JTLB
  379. * 0 => 48 entry JTLB
  380. */
  381. c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
  382. break;
  383. case PRID_IMP_R8000:
  384. c->cputype = CPU_R8000;
  385. c->isa_level = MIPS_CPU_ISA_IV;
  386. c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
  387. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  388. MIPS_CPU_LLSC;
  389. c->tlbsize = 384; /* has weird TLB: 3-way x 128 */
  390. break;
  391. case PRID_IMP_R10000:
  392. c->cputype = CPU_R10000;
  393. c->isa_level = MIPS_CPU_ISA_IV;
  394. c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
  395. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  396. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  397. MIPS_CPU_LLSC;
  398. c->tlbsize = 64;
  399. break;
  400. case PRID_IMP_R12000:
  401. c->cputype = CPU_R12000;
  402. c->isa_level = MIPS_CPU_ISA_IV;
  403. c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
  404. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  405. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  406. MIPS_CPU_LLSC;
  407. c->tlbsize = 64;
  408. break;
  409. }
  410. }
  411. static inline unsigned int decode_config0(struct cpuinfo_mips *c)
  412. {
  413. unsigned int config0;
  414. int isa;
  415. config0 = read_c0_config();
  416. if (((config0 & MIPS_CONF_MT) >> 7) == 1)
  417. c->options |= MIPS_CPU_TLB | MIPS_CPU_4KTLB;
  418. isa = (config0 & MIPS_CONF_AT) >> 13;
  419. switch (isa) {
  420. case 0:
  421. c->isa_level = MIPS_CPU_ISA_M32;
  422. break;
  423. case 2:
  424. c->isa_level = MIPS_CPU_ISA_M64;
  425. break;
  426. default:
  427. panic("Unsupported ISA type, cp0.config0.at: %d.", isa);
  428. }
  429. return config0 & MIPS_CONF_M;
  430. }
  431. static inline unsigned int decode_config1(struct cpuinfo_mips *c)
  432. {
  433. unsigned int config1;
  434. config1 = read_c0_config1();
  435. if (config1 & MIPS_CONF1_MD)
  436. c->ases |= MIPS_ASE_MDMX;
  437. if (config1 & MIPS_CONF1_WR)
  438. c->options |= MIPS_CPU_WATCH;
  439. if (config1 & MIPS_CONF1_CA)
  440. c->ases |= MIPS_ASE_MIPS16;
  441. if (config1 & MIPS_CONF1_EP)
  442. c->options |= MIPS_CPU_EJTAG;
  443. if (config1 & MIPS_CONF1_FP) {
  444. c->options |= MIPS_CPU_FPU;
  445. c->options |= MIPS_CPU_32FPR;
  446. }
  447. if (cpu_has_tlb)
  448. c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
  449. return config1 & MIPS_CONF_M;
  450. }
  451. static inline unsigned int decode_config2(struct cpuinfo_mips *c)
  452. {
  453. unsigned int config2;
  454. config2 = read_c0_config2();
  455. if (config2 & MIPS_CONF2_SL)
  456. c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
  457. return config2 & MIPS_CONF_M;
  458. }
  459. static inline unsigned int decode_config3(struct cpuinfo_mips *c)
  460. {
  461. unsigned int config3;
  462. config3 = read_c0_config3();
  463. if (config3 & MIPS_CONF3_SM)
  464. c->ases |= MIPS_ASE_SMARTMIPS;
  465. if (config3 & MIPS_CONF3_DSP)
  466. c->ases |= MIPS_ASE_DSP;
  467. if (config3 & MIPS_CONF3_VINT)
  468. c->options |= MIPS_CPU_VINT;
  469. if (config3 & MIPS_CONF3_VEIC)
  470. c->options |= MIPS_CPU_VEIC;
  471. if (config3 & MIPS_CONF3_MT)
  472. c->ases |= MIPS_ASE_MIPSMT;
  473. return config3 & MIPS_CONF_M;
  474. }
  475. static inline void decode_configs(struct cpuinfo_mips *c)
  476. {
  477. /* MIPS32 or MIPS64 compliant CPU. */
  478. c->options = MIPS_CPU_4KEX | MIPS_CPU_COUNTER | MIPS_CPU_DIVEC |
  479. MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
  480. c->scache.flags = MIPS_CACHE_NOT_PRESENT;
  481. /* Read Config registers. */
  482. if (!decode_config0(c))
  483. return; /* actually worth a panic() */
  484. if (!decode_config1(c))
  485. return;
  486. if (!decode_config2(c))
  487. return;
  488. if (!decode_config3(c))
  489. return;
  490. }
  491. static inline void cpu_probe_mips(struct cpuinfo_mips *c)
  492. {
  493. decode_configs(c);
  494. switch (c->processor_id & 0xff00) {
  495. case PRID_IMP_4KC:
  496. c->cputype = CPU_4KC;
  497. break;
  498. case PRID_IMP_4KEC:
  499. c->cputype = CPU_4KEC;
  500. break;
  501. case PRID_IMP_4KECR2:
  502. c->cputype = CPU_4KEC;
  503. break;
  504. case PRID_IMP_4KSC:
  505. c->cputype = CPU_4KSC;
  506. break;
  507. case PRID_IMP_5KC:
  508. c->cputype = CPU_5KC;
  509. break;
  510. case PRID_IMP_20KC:
  511. c->cputype = CPU_20KC;
  512. break;
  513. case PRID_IMP_24K:
  514. case PRID_IMP_24KE:
  515. c->cputype = CPU_24K;
  516. break;
  517. case PRID_IMP_25KF:
  518. c->cputype = CPU_25KF;
  519. /* Probe for L2 cache */
  520. c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
  521. break;
  522. case PRID_IMP_34K:
  523. c->cputype = CPU_34K;
  524. c->isa_level = MIPS_CPU_ISA_M32;
  525. break;
  526. }
  527. }
  528. static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
  529. {
  530. decode_configs(c);
  531. switch (c->processor_id & 0xff00) {
  532. case PRID_IMP_AU1_REV1:
  533. case PRID_IMP_AU1_REV2:
  534. switch ((c->processor_id >> 24) & 0xff) {
  535. case 0:
  536. c->cputype = CPU_AU1000;
  537. break;
  538. case 1:
  539. c->cputype = CPU_AU1500;
  540. break;
  541. case 2:
  542. c->cputype = CPU_AU1100;
  543. break;
  544. case 3:
  545. c->cputype = CPU_AU1550;
  546. break;
  547. case 4:
  548. c->cputype = CPU_AU1200;
  549. break;
  550. default:
  551. panic("Unknown Au Core!");
  552. break;
  553. }
  554. break;
  555. }
  556. }
  557. static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
  558. {
  559. decode_configs(c);
  560. switch (c->processor_id & 0xff00) {
  561. case PRID_IMP_SB1:
  562. c->cputype = CPU_SB1;
  563. #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
  564. /* FPU in pass1 is known to have issues. */
  565. c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
  566. #endif
  567. break;
  568. }
  569. }
  570. static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
  571. {
  572. decode_configs(c);
  573. switch (c->processor_id & 0xff00) {
  574. case PRID_IMP_SR71000:
  575. c->cputype = CPU_SR71000;
  576. c->scache.ways = 8;
  577. c->tlbsize = 64;
  578. break;
  579. }
  580. }
  581. static inline void cpu_probe_philips(struct cpuinfo_mips *c)
  582. {
  583. decode_configs(c);
  584. switch (c->processor_id & 0xff00) {
  585. case PRID_IMP_PR4450:
  586. c->cputype = CPU_PR4450;
  587. c->isa_level = MIPS_CPU_ISA_M32;
  588. break;
  589. default:
  590. panic("Unknown Philips Core!"); /* REVISIT: die? */
  591. break;
  592. }
  593. }
  594. __init void cpu_probe(void)
  595. {
  596. struct cpuinfo_mips *c = &current_cpu_data;
  597. c->processor_id = PRID_IMP_UNKNOWN;
  598. c->fpu_id = FPIR_IMP_NONE;
  599. c->cputype = CPU_UNKNOWN;
  600. c->processor_id = read_c0_prid();
  601. switch (c->processor_id & 0xff0000) {
  602. case PRID_COMP_LEGACY:
  603. cpu_probe_legacy(c);
  604. break;
  605. case PRID_COMP_MIPS:
  606. cpu_probe_mips(c);
  607. break;
  608. case PRID_COMP_ALCHEMY:
  609. cpu_probe_alchemy(c);
  610. break;
  611. case PRID_COMP_SIBYTE:
  612. cpu_probe_sibyte(c);
  613. break;
  614. case PRID_COMP_SANDCRAFT:
  615. cpu_probe_sandcraft(c);
  616. break;
  617. case PRID_COMP_PHILIPS:
  618. cpu_probe_philips(c);
  619. break;
  620. default:
  621. c->cputype = CPU_UNKNOWN;
  622. }
  623. if (c->options & MIPS_CPU_FPU) {
  624. c->fpu_id = cpu_get_fpu_id();
  625. if (c->isa_level == MIPS_CPU_ISA_M32 ||
  626. c->isa_level == MIPS_CPU_ISA_M64) {
  627. if (c->fpu_id & MIPS_FPIR_3D)
  628. c->ases |= MIPS_ASE_MIPS3D;
  629. }
  630. }
  631. }
  632. __init void cpu_report(void)
  633. {
  634. struct cpuinfo_mips *c = &current_cpu_data;
  635. printk("CPU revision is: %08x\n", c->processor_id);
  636. if (c->options & MIPS_CPU_FPU)
  637. printk("FPU revision is: %08x\n", c->fpu_id);
  638. }