cpu-probe.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  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_4K_CACHE \
  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_3K_CACHE |
  182. MIPS_CPU_NOFPUEX;
  183. if (__cpu_has_fpu())
  184. c->options |= MIPS_CPU_FPU;
  185. c->tlbsize = 64;
  186. break;
  187. case PRID_IMP_R3000:
  188. if ((c->processor_id & 0xff) == PRID_REV_R3000A)
  189. if (cpu_has_confreg())
  190. c->cputype = CPU_R3081E;
  191. else
  192. c->cputype = CPU_R3000A;
  193. else
  194. c->cputype = CPU_R3000;
  195. c->isa_level = MIPS_CPU_ISA_I;
  196. c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
  197. MIPS_CPU_NOFPUEX;
  198. if (__cpu_has_fpu())
  199. c->options |= MIPS_CPU_FPU;
  200. c->tlbsize = 64;
  201. break;
  202. case PRID_IMP_R4000:
  203. if (read_c0_config() & CONF_SC) {
  204. if ((c->processor_id & 0xff) >= PRID_REV_R4400)
  205. c->cputype = CPU_R4400PC;
  206. else
  207. c->cputype = CPU_R4000PC;
  208. } else {
  209. if ((c->processor_id & 0xff) >= PRID_REV_R4400)
  210. c->cputype = CPU_R4400SC;
  211. else
  212. c->cputype = CPU_R4000SC;
  213. }
  214. c->isa_level = MIPS_CPU_ISA_III;
  215. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  216. MIPS_CPU_WATCH | MIPS_CPU_VCE |
  217. MIPS_CPU_LLSC;
  218. c->tlbsize = 48;
  219. break;
  220. case PRID_IMP_VR41XX:
  221. switch (c->processor_id & 0xf0) {
  222. case PRID_REV_VR4111:
  223. c->cputype = CPU_VR4111;
  224. break;
  225. case PRID_REV_VR4121:
  226. c->cputype = CPU_VR4121;
  227. break;
  228. case PRID_REV_VR4122:
  229. if ((c->processor_id & 0xf) < 0x3)
  230. c->cputype = CPU_VR4122;
  231. else
  232. c->cputype = CPU_VR4181A;
  233. break;
  234. case PRID_REV_VR4130:
  235. if ((c->processor_id & 0xf) < 0x4)
  236. c->cputype = CPU_VR4131;
  237. else
  238. c->cputype = CPU_VR4133;
  239. break;
  240. default:
  241. printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
  242. c->cputype = CPU_VR41XX;
  243. break;
  244. }
  245. c->isa_level = MIPS_CPU_ISA_III;
  246. c->options = R4K_OPTS;
  247. c->tlbsize = 32;
  248. break;
  249. case PRID_IMP_R4300:
  250. c->cputype = CPU_R4300;
  251. c->isa_level = MIPS_CPU_ISA_III;
  252. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  253. MIPS_CPU_LLSC;
  254. c->tlbsize = 32;
  255. break;
  256. case PRID_IMP_R4600:
  257. c->cputype = CPU_R4600;
  258. c->isa_level = MIPS_CPU_ISA_III;
  259. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  260. MIPS_CPU_LLSC;
  261. c->tlbsize = 48;
  262. break;
  263. #if 0
  264. case PRID_IMP_R4650:
  265. /*
  266. * This processor doesn't have an MMU, so it's not
  267. * "real easy" to run Linux on it. It is left purely
  268. * for documentation. Commented out because it shares
  269. * it's c0_prid id number with the TX3900.
  270. */
  271. c->cputype = CPU_R4650;
  272. c->isa_level = MIPS_CPU_ISA_III;
  273. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
  274. c->tlbsize = 48;
  275. break;
  276. #endif
  277. case PRID_IMP_TX39:
  278. c->isa_level = MIPS_CPU_ISA_I;
  279. c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
  280. if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
  281. c->cputype = CPU_TX3927;
  282. c->tlbsize = 64;
  283. } else {
  284. switch (c->processor_id & 0xff) {
  285. case PRID_REV_TX3912:
  286. c->cputype = CPU_TX3912;
  287. c->tlbsize = 32;
  288. break;
  289. case PRID_REV_TX3922:
  290. c->cputype = CPU_TX3922;
  291. c->tlbsize = 64;
  292. break;
  293. default:
  294. c->cputype = CPU_UNKNOWN;
  295. break;
  296. }
  297. }
  298. break;
  299. case PRID_IMP_R4700:
  300. c->cputype = CPU_R4700;
  301. c->isa_level = MIPS_CPU_ISA_III;
  302. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  303. MIPS_CPU_LLSC;
  304. c->tlbsize = 48;
  305. break;
  306. case PRID_IMP_TX49:
  307. c->cputype = CPU_TX49XX;
  308. c->isa_level = MIPS_CPU_ISA_III;
  309. c->options = R4K_OPTS | MIPS_CPU_LLSC;
  310. if (!(c->processor_id & 0x08))
  311. c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
  312. c->tlbsize = 48;
  313. break;
  314. case PRID_IMP_R5000:
  315. c->cputype = CPU_R5000;
  316. c->isa_level = MIPS_CPU_ISA_IV;
  317. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  318. MIPS_CPU_LLSC;
  319. c->tlbsize = 48;
  320. break;
  321. case PRID_IMP_R5432:
  322. c->cputype = CPU_R5432;
  323. c->isa_level = MIPS_CPU_ISA_IV;
  324. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  325. MIPS_CPU_WATCH | MIPS_CPU_LLSC;
  326. c->tlbsize = 48;
  327. break;
  328. case PRID_IMP_R5500:
  329. c->cputype = CPU_R5500;
  330. c->isa_level = MIPS_CPU_ISA_IV;
  331. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  332. MIPS_CPU_WATCH | MIPS_CPU_LLSC;
  333. c->tlbsize = 48;
  334. break;
  335. case PRID_IMP_NEVADA:
  336. c->cputype = CPU_NEVADA;
  337. c->isa_level = MIPS_CPU_ISA_IV;
  338. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  339. MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
  340. c->tlbsize = 48;
  341. break;
  342. case PRID_IMP_R6000:
  343. c->cputype = CPU_R6000;
  344. c->isa_level = MIPS_CPU_ISA_II;
  345. c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
  346. MIPS_CPU_LLSC;
  347. c->tlbsize = 32;
  348. break;
  349. case PRID_IMP_R6000A:
  350. c->cputype = CPU_R6000A;
  351. c->isa_level = MIPS_CPU_ISA_II;
  352. c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
  353. MIPS_CPU_LLSC;
  354. c->tlbsize = 32;
  355. break;
  356. case PRID_IMP_RM7000:
  357. c->cputype = CPU_RM7000;
  358. c->isa_level = MIPS_CPU_ISA_IV;
  359. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  360. MIPS_CPU_LLSC;
  361. /*
  362. * Undocumented RM7000: Bit 29 in the info register of
  363. * the RM7000 v2.0 indicates if the TLB has 48 or 64
  364. * entries.
  365. *
  366. * 29 1 => 64 entry JTLB
  367. * 0 => 48 entry JTLB
  368. */
  369. c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
  370. break;
  371. case PRID_IMP_RM9000:
  372. c->cputype = CPU_RM9000;
  373. c->isa_level = MIPS_CPU_ISA_IV;
  374. c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
  375. MIPS_CPU_LLSC;
  376. /*
  377. * Bit 29 in the info register of the RM9000
  378. * indicates if the TLB has 48 or 64 entries.
  379. *
  380. * 29 1 => 64 entry JTLB
  381. * 0 => 48 entry JTLB
  382. */
  383. c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
  384. break;
  385. case PRID_IMP_R8000:
  386. c->cputype = CPU_R8000;
  387. c->isa_level = MIPS_CPU_ISA_IV;
  388. c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
  389. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  390. MIPS_CPU_LLSC;
  391. c->tlbsize = 384; /* has weird TLB: 3-way x 128 */
  392. break;
  393. case PRID_IMP_R10000:
  394. c->cputype = CPU_R10000;
  395. c->isa_level = MIPS_CPU_ISA_IV;
  396. c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
  397. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  398. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  399. MIPS_CPU_LLSC;
  400. c->tlbsize = 64;
  401. break;
  402. case PRID_IMP_R12000:
  403. c->cputype = CPU_R12000;
  404. c->isa_level = MIPS_CPU_ISA_IV;
  405. c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
  406. MIPS_CPU_FPU | MIPS_CPU_32FPR |
  407. MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
  408. MIPS_CPU_LLSC;
  409. c->tlbsize = 64;
  410. break;
  411. }
  412. }
  413. static inline unsigned int decode_config0(struct cpuinfo_mips *c)
  414. {
  415. unsigned int config0;
  416. int isa;
  417. config0 = read_c0_config();
  418. if (((config0 & MIPS_CONF_MT) >> 7) == 1)
  419. c->options |= MIPS_CPU_TLB;
  420. isa = (config0 & MIPS_CONF_AT) >> 13;
  421. switch (isa) {
  422. case 0:
  423. c->isa_level = MIPS_CPU_ISA_M32;
  424. break;
  425. case 2:
  426. c->isa_level = MIPS_CPU_ISA_M64;
  427. break;
  428. default:
  429. panic("Unsupported ISA type, cp0.config0.at: %d.", isa);
  430. }
  431. return config0 & MIPS_CONF_M;
  432. }
  433. static inline unsigned int decode_config1(struct cpuinfo_mips *c)
  434. {
  435. unsigned int config1;
  436. config1 = read_c0_config1();
  437. if (config1 & MIPS_CONF1_MD)
  438. c->ases |= MIPS_ASE_MDMX;
  439. if (config1 & MIPS_CONF1_WR)
  440. c->options |= MIPS_CPU_WATCH;
  441. if (config1 & MIPS_CONF1_CA)
  442. c->ases |= MIPS_ASE_MIPS16;
  443. if (config1 & MIPS_CONF1_EP)
  444. c->options |= MIPS_CPU_EJTAG;
  445. if (config1 & MIPS_CONF1_FP) {
  446. c->options |= MIPS_CPU_FPU;
  447. c->options |= MIPS_CPU_32FPR;
  448. }
  449. if (cpu_has_tlb)
  450. c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
  451. return config1 & MIPS_CONF_M;
  452. }
  453. static inline unsigned int decode_config2(struct cpuinfo_mips *c)
  454. {
  455. unsigned int config2;
  456. config2 = read_c0_config2();
  457. if (config2 & MIPS_CONF2_SL)
  458. c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
  459. return config2 & MIPS_CONF_M;
  460. }
  461. static inline unsigned int decode_config3(struct cpuinfo_mips *c)
  462. {
  463. unsigned int config3;
  464. config3 = read_c0_config3();
  465. if (config3 & MIPS_CONF3_SM)
  466. c->ases |= MIPS_ASE_SMARTMIPS;
  467. if (config3 & MIPS_CONF3_DSP)
  468. c->ases |= MIPS_ASE_DSP;
  469. if (config3 & MIPS_CONF3_VINT)
  470. c->options |= MIPS_CPU_VINT;
  471. if (config3 & MIPS_CONF3_VEIC)
  472. c->options |= MIPS_CPU_VEIC;
  473. if (config3 & MIPS_CONF3_MT)
  474. c->ases |= MIPS_ASE_MIPSMT;
  475. return config3 & MIPS_CONF_M;
  476. }
  477. static inline void decode_configs(struct cpuinfo_mips *c)
  478. {
  479. /* MIPS32 or MIPS64 compliant CPU. */
  480. c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
  481. MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
  482. c->scache.flags = MIPS_CACHE_NOT_PRESENT;
  483. /* Read Config registers. */
  484. if (!decode_config0(c))
  485. return; /* actually worth a panic() */
  486. if (!decode_config1(c))
  487. return;
  488. if (!decode_config2(c))
  489. return;
  490. if (!decode_config3(c))
  491. return;
  492. }
  493. static inline void cpu_probe_mips(struct cpuinfo_mips *c)
  494. {
  495. decode_configs(c);
  496. switch (c->processor_id & 0xff00) {
  497. case PRID_IMP_4KC:
  498. c->cputype = CPU_4KC;
  499. break;
  500. case PRID_IMP_4KEC:
  501. c->cputype = CPU_4KEC;
  502. break;
  503. case PRID_IMP_4KECR2:
  504. c->cputype = CPU_4KEC;
  505. break;
  506. case PRID_IMP_4KSC:
  507. case PRID_IMP_4KSD:
  508. c->cputype = CPU_4KSC;
  509. break;
  510. case PRID_IMP_5KC:
  511. c->cputype = CPU_5KC;
  512. break;
  513. case PRID_IMP_20KC:
  514. c->cputype = CPU_20KC;
  515. break;
  516. case PRID_IMP_24K:
  517. case PRID_IMP_24KE:
  518. c->cputype = CPU_24K;
  519. break;
  520. case PRID_IMP_25KF:
  521. c->cputype = CPU_25KF;
  522. /* Probe for L2 cache */
  523. c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
  524. break;
  525. case PRID_IMP_34K:
  526. c->cputype = CPU_34K;
  527. c->isa_level = MIPS_CPU_ISA_M32;
  528. break;
  529. }
  530. }
  531. static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
  532. {
  533. decode_configs(c);
  534. switch (c->processor_id & 0xff00) {
  535. case PRID_IMP_AU1_REV1:
  536. case PRID_IMP_AU1_REV2:
  537. switch ((c->processor_id >> 24) & 0xff) {
  538. case 0:
  539. c->cputype = CPU_AU1000;
  540. break;
  541. case 1:
  542. c->cputype = CPU_AU1500;
  543. break;
  544. case 2:
  545. c->cputype = CPU_AU1100;
  546. break;
  547. case 3:
  548. c->cputype = CPU_AU1550;
  549. break;
  550. case 4:
  551. c->cputype = CPU_AU1200;
  552. break;
  553. default:
  554. panic("Unknown Au Core!");
  555. break;
  556. }
  557. break;
  558. }
  559. }
  560. static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
  561. {
  562. decode_configs(c);
  563. /*
  564. * For historical reasons the SB1 comes with it's own variant of
  565. * cache code which eventually will be folded into c-r4k.c. Until
  566. * then we pretend it's got it's own cache architecture.
  567. */
  568. c->options &= ~MIPS_CPU_4K_CACHE;
  569. c->options |= MIPS_CPU_SB1_CACHE;
  570. switch (c->processor_id & 0xff00) {
  571. case PRID_IMP_SB1:
  572. c->cputype = CPU_SB1;
  573. #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
  574. /* FPU in pass1 is known to have issues. */
  575. c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
  576. #endif
  577. break;
  578. case PRID_IMP_SB1A:
  579. c->cputype = CPU_SB1A;
  580. break;
  581. }
  582. }
  583. static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
  584. {
  585. decode_configs(c);
  586. switch (c->processor_id & 0xff00) {
  587. case PRID_IMP_SR71000:
  588. c->cputype = CPU_SR71000;
  589. c->scache.ways = 8;
  590. c->tlbsize = 64;
  591. break;
  592. }
  593. }
  594. static inline void cpu_probe_philips(struct cpuinfo_mips *c)
  595. {
  596. decode_configs(c);
  597. switch (c->processor_id & 0xff00) {
  598. case PRID_IMP_PR4450:
  599. c->cputype = CPU_PR4450;
  600. c->isa_level = MIPS_CPU_ISA_M32;
  601. break;
  602. default:
  603. panic("Unknown Philips Core!"); /* REVISIT: die? */
  604. break;
  605. }
  606. }
  607. __init void cpu_probe(void)
  608. {
  609. struct cpuinfo_mips *c = &current_cpu_data;
  610. c->processor_id = PRID_IMP_UNKNOWN;
  611. c->fpu_id = FPIR_IMP_NONE;
  612. c->cputype = CPU_UNKNOWN;
  613. c->processor_id = read_c0_prid();
  614. switch (c->processor_id & 0xff0000) {
  615. case PRID_COMP_LEGACY:
  616. cpu_probe_legacy(c);
  617. break;
  618. case PRID_COMP_MIPS:
  619. cpu_probe_mips(c);
  620. break;
  621. case PRID_COMP_ALCHEMY:
  622. cpu_probe_alchemy(c);
  623. break;
  624. case PRID_COMP_SIBYTE:
  625. cpu_probe_sibyte(c);
  626. break;
  627. case PRID_COMP_SANDCRAFT:
  628. cpu_probe_sandcraft(c);
  629. break;
  630. case PRID_COMP_PHILIPS:
  631. cpu_probe_philips(c);
  632. break;
  633. default:
  634. c->cputype = CPU_UNKNOWN;
  635. }
  636. if (c->options & MIPS_CPU_FPU) {
  637. c->fpu_id = cpu_get_fpu_id();
  638. if (c->isa_level == MIPS_CPU_ISA_M32 ||
  639. c->isa_level == MIPS_CPU_ISA_M64) {
  640. if (c->fpu_id & MIPS_FPIR_3D)
  641. c->ases |= MIPS_ASE_MIPS3D;
  642. }
  643. }
  644. }
  645. __init void cpu_report(void)
  646. {
  647. struct cpuinfo_mips *c = &current_cpu_data;
  648. printk("CPU revision is: %08x\n", c->processor_id);
  649. if (c->options & MIPS_CPU_FPU)
  650. printk("FPU revision is: %08x\n", c->fpu_id);
  651. }