cpu-probe.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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 char unknown_isa[] __initdata = KERN_ERR \
  414. "Unsupported ISA type, c0.config0: %d.";
  415. static inline unsigned int decode_config0(struct cpuinfo_mips *c)
  416. {
  417. unsigned int config0;
  418. int isa;
  419. config0 = read_c0_config();
  420. if (((config0 & MIPS_CONF_MT) >> 7) == 1)
  421. c->options |= MIPS_CPU_TLB;
  422. isa = (config0 & MIPS_CONF_AT) >> 13;
  423. switch (isa) {
  424. case 0:
  425. switch ((config0 >> 10) & 7) {
  426. case 0:
  427. c->isa_level = MIPS_CPU_ISA_M32R1;
  428. break;
  429. case 1:
  430. c->isa_level = MIPS_CPU_ISA_M32R2;
  431. break;
  432. default:
  433. goto unknown;
  434. }
  435. break;
  436. case 2:
  437. switch ((config0 >> 10) & 7) {
  438. case 0:
  439. c->isa_level = MIPS_CPU_ISA_M64R1;
  440. break;
  441. case 1:
  442. c->isa_level = MIPS_CPU_ISA_M64R2;
  443. break;
  444. default:
  445. goto unknown;
  446. }
  447. break;
  448. default:
  449. goto unknown;
  450. }
  451. return config0 & MIPS_CONF_M;
  452. unknown:
  453. panic(unknown_isa, config0);
  454. }
  455. static inline unsigned int decode_config1(struct cpuinfo_mips *c)
  456. {
  457. unsigned int config1;
  458. config1 = read_c0_config1();
  459. if (config1 & MIPS_CONF1_MD)
  460. c->ases |= MIPS_ASE_MDMX;
  461. if (config1 & MIPS_CONF1_WR)
  462. c->options |= MIPS_CPU_WATCH;
  463. if (config1 & MIPS_CONF1_CA)
  464. c->ases |= MIPS_ASE_MIPS16;
  465. if (config1 & MIPS_CONF1_EP)
  466. c->options |= MIPS_CPU_EJTAG;
  467. if (config1 & MIPS_CONF1_FP) {
  468. c->options |= MIPS_CPU_FPU;
  469. c->options |= MIPS_CPU_32FPR;
  470. }
  471. if (cpu_has_tlb)
  472. c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
  473. return config1 & MIPS_CONF_M;
  474. }
  475. static inline unsigned int decode_config2(struct cpuinfo_mips *c)
  476. {
  477. unsigned int config2;
  478. config2 = read_c0_config2();
  479. if (config2 & MIPS_CONF2_SL)
  480. c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
  481. return config2 & MIPS_CONF_M;
  482. }
  483. static inline unsigned int decode_config3(struct cpuinfo_mips *c)
  484. {
  485. unsigned int config3;
  486. config3 = read_c0_config3();
  487. if (config3 & MIPS_CONF3_SM)
  488. c->ases |= MIPS_ASE_SMARTMIPS;
  489. if (config3 & MIPS_CONF3_DSP)
  490. c->ases |= MIPS_ASE_DSP;
  491. if (config3 & MIPS_CONF3_VINT)
  492. c->options |= MIPS_CPU_VINT;
  493. if (config3 & MIPS_CONF3_VEIC)
  494. c->options |= MIPS_CPU_VEIC;
  495. if (config3 & MIPS_CONF3_MT)
  496. c->ases |= MIPS_ASE_MIPSMT;
  497. return config3 & MIPS_CONF_M;
  498. }
  499. static inline void decode_configs(struct cpuinfo_mips *c)
  500. {
  501. /* MIPS32 or MIPS64 compliant CPU. */
  502. c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
  503. MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
  504. c->scache.flags = MIPS_CACHE_NOT_PRESENT;
  505. /* Read Config registers. */
  506. if (!decode_config0(c))
  507. return; /* actually worth a panic() */
  508. if (!decode_config1(c))
  509. return;
  510. if (!decode_config2(c))
  511. return;
  512. if (!decode_config3(c))
  513. return;
  514. }
  515. static inline void cpu_probe_mips(struct cpuinfo_mips *c)
  516. {
  517. decode_configs(c);
  518. switch (c->processor_id & 0xff00) {
  519. case PRID_IMP_4KC:
  520. c->cputype = CPU_4KC;
  521. break;
  522. case PRID_IMP_4KEC:
  523. c->cputype = CPU_4KEC;
  524. break;
  525. case PRID_IMP_4KECR2:
  526. c->cputype = CPU_4KEC;
  527. break;
  528. case PRID_IMP_4KSC:
  529. case PRID_IMP_4KSD:
  530. c->cputype = CPU_4KSC;
  531. break;
  532. case PRID_IMP_5KC:
  533. c->cputype = CPU_5KC;
  534. break;
  535. case PRID_IMP_20KC:
  536. c->cputype = CPU_20KC;
  537. break;
  538. case PRID_IMP_24K:
  539. case PRID_IMP_24KE:
  540. c->cputype = CPU_24K;
  541. break;
  542. case PRID_IMP_25KF:
  543. c->cputype = CPU_25KF;
  544. /* Probe for L2 cache */
  545. c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
  546. break;
  547. case PRID_IMP_34K:
  548. c->cputype = CPU_34K;
  549. break;
  550. }
  551. }
  552. static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
  553. {
  554. decode_configs(c);
  555. switch (c->processor_id & 0xff00) {
  556. case PRID_IMP_AU1_REV1:
  557. case PRID_IMP_AU1_REV2:
  558. switch ((c->processor_id >> 24) & 0xff) {
  559. case 0:
  560. c->cputype = CPU_AU1000;
  561. break;
  562. case 1:
  563. c->cputype = CPU_AU1500;
  564. break;
  565. case 2:
  566. c->cputype = CPU_AU1100;
  567. break;
  568. case 3:
  569. c->cputype = CPU_AU1550;
  570. break;
  571. case 4:
  572. c->cputype = CPU_AU1200;
  573. break;
  574. default:
  575. panic("Unknown Au Core!");
  576. break;
  577. }
  578. break;
  579. }
  580. }
  581. static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
  582. {
  583. decode_configs(c);
  584. /*
  585. * For historical reasons the SB1 comes with it's own variant of
  586. * cache code which eventually will be folded into c-r4k.c. Until
  587. * then we pretend it's got it's own cache architecture.
  588. */
  589. c->options &= ~MIPS_CPU_4K_CACHE;
  590. c->options |= MIPS_CPU_SB1_CACHE;
  591. switch (c->processor_id & 0xff00) {
  592. case PRID_IMP_SB1:
  593. c->cputype = CPU_SB1;
  594. #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
  595. /* FPU in pass1 is known to have issues. */
  596. c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
  597. #endif
  598. break;
  599. case PRID_IMP_SB1A:
  600. c->cputype = CPU_SB1A;
  601. break;
  602. }
  603. }
  604. static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
  605. {
  606. decode_configs(c);
  607. switch (c->processor_id & 0xff00) {
  608. case PRID_IMP_SR71000:
  609. c->cputype = CPU_SR71000;
  610. c->scache.ways = 8;
  611. c->tlbsize = 64;
  612. break;
  613. }
  614. }
  615. static inline void cpu_probe_philips(struct cpuinfo_mips *c)
  616. {
  617. decode_configs(c);
  618. switch (c->processor_id & 0xff00) {
  619. case PRID_IMP_PR4450:
  620. c->cputype = CPU_PR4450;
  621. c->isa_level = MIPS_CPU_ISA_M32R1;
  622. break;
  623. default:
  624. panic("Unknown Philips Core!"); /* REVISIT: die? */
  625. break;
  626. }
  627. }
  628. __init void cpu_probe(void)
  629. {
  630. struct cpuinfo_mips *c = &current_cpu_data;
  631. c->processor_id = PRID_IMP_UNKNOWN;
  632. c->fpu_id = FPIR_IMP_NONE;
  633. c->cputype = CPU_UNKNOWN;
  634. c->processor_id = read_c0_prid();
  635. switch (c->processor_id & 0xff0000) {
  636. case PRID_COMP_LEGACY:
  637. cpu_probe_legacy(c);
  638. break;
  639. case PRID_COMP_MIPS:
  640. cpu_probe_mips(c);
  641. break;
  642. case PRID_COMP_ALCHEMY:
  643. cpu_probe_alchemy(c);
  644. break;
  645. case PRID_COMP_SIBYTE:
  646. cpu_probe_sibyte(c);
  647. break;
  648. case PRID_COMP_SANDCRAFT:
  649. cpu_probe_sandcraft(c);
  650. break;
  651. case PRID_COMP_PHILIPS:
  652. cpu_probe_philips(c);
  653. break;
  654. default:
  655. c->cputype = CPU_UNKNOWN;
  656. }
  657. if (c->options & MIPS_CPU_FPU) {
  658. c->fpu_id = cpu_get_fpu_id();
  659. if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
  660. c->isa_level == MIPS_CPU_ISA_M32R2 ||
  661. c->isa_level == MIPS_CPU_ISA_M64R1 ||
  662. c->isa_level == MIPS_CPU_ISA_M64R2) {
  663. if (c->fpu_id & MIPS_FPIR_3D)
  664. c->ases |= MIPS_ASE_MIPS3D;
  665. }
  666. }
  667. }
  668. __init void cpu_report(void)
  669. {
  670. struct cpuinfo_mips *c = &current_cpu_data;
  671. printk("CPU revision is: %08x\n", c->processor_id);
  672. if (c->options & MIPS_CPU_FPU)
  673. printk("FPU revision is: %08x\n", c->fpu_id);
  674. }