cpu_32.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /* cpu.c: Dinky routines to look for the kind of Sparc cpu
  2. * we are on.
  3. *
  4. * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/init.h>
  8. #include <linux/smp.h>
  9. #include <linux/threads.h>
  10. #include <asm/oplib.h>
  11. #include <asm/page.h>
  12. #include <asm/head.h>
  13. #include <asm/psr.h>
  14. #include <asm/mbus.h>
  15. #include <asm/cpudata.h>
  16. #include "kernel.h"
  17. DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
  18. struct cpu_info {
  19. int psr_vers;
  20. const char *name;
  21. };
  22. struct fpu_info {
  23. int fp_vers;
  24. const char *name;
  25. };
  26. #define NOCPU 8
  27. #define NOFPU 8
  28. struct manufacturer_info {
  29. int psr_impl;
  30. struct cpu_info cpu_info[NOCPU];
  31. struct fpu_info fpu_info[NOFPU];
  32. };
  33. #define CPU(ver, _name) \
  34. { .psr_vers = ver, .name = _name }
  35. #define FPU(ver, _name) \
  36. { .fp_vers = ver, .name = _name }
  37. static const struct manufacturer_info __initconst manufacturer_info[] = {
  38. {
  39. 0,
  40. /* Sun4/100, 4/200, SLC */
  41. .cpu_info = {
  42. CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"),
  43. /* borned STP1012PGA */
  44. CPU(4, "Fujitsu MB86904"),
  45. CPU(5, "Fujitsu TurboSparc MB86907"),
  46. CPU(-1, NULL)
  47. },
  48. .fpu_info = {
  49. FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
  50. FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
  51. FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
  52. /* SparcStation SLC, SparcStation1 */
  53. FPU(3, "Weitek WTL3170/2"),
  54. /* SPARCstation-5 */
  55. FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
  56. FPU(-1, NULL)
  57. }
  58. },{
  59. 1,
  60. .cpu_info = {
  61. /* SparcStation2, SparcServer 490 & 690 */
  62. CPU(0, "LSI Logic Corporation - L64811"),
  63. /* SparcStation2 */
  64. CPU(1, "Cypress/ROSS CY7C601"),
  65. /* Embedded controller */
  66. CPU(3, "Cypress/ROSS CY7C611"),
  67. /* Ross Technologies HyperSparc */
  68. CPU(0xf, "ROSS HyperSparc RT620"),
  69. CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
  70. CPU(-1, NULL)
  71. },
  72. .fpu_info = {
  73. FPU(0, "ROSS HyperSparc combined IU/FPU"),
  74. FPU(1, "Lsi Logic L64814"),
  75. FPU(2, "Texas Instruments TMS390-C602A"),
  76. FPU(3, "Cypress CY7C602 FPU"),
  77. FPU(-1, NULL)
  78. }
  79. },{
  80. 2,
  81. .cpu_info = {
  82. /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
  83. /* Someone please write the code to support this beast! ;) */
  84. CPU(0, "Bipolar Integrated Technology - B5010"),
  85. CPU(-1, NULL)
  86. },
  87. .fpu_info = {
  88. FPU(-1, NULL)
  89. }
  90. },{
  91. 3,
  92. .cpu_info = {
  93. CPU(0, "LSI Logic Corporation - unknown-type"),
  94. CPU(-1, NULL)
  95. },
  96. .fpu_info = {
  97. FPU(-1, NULL)
  98. }
  99. },{
  100. 4,
  101. .cpu_info = {
  102. CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
  103. /* SparcClassic -- borned STP1010TAB-50*/
  104. CPU(1, "Texas Instruments, Inc. - MicroSparc"),
  105. CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
  106. CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
  107. CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
  108. CPU(5, "Texas Instruments, Inc. - unknown"),
  109. CPU(-1, NULL)
  110. },
  111. .fpu_info = {
  112. /* SuperSparc 50 module */
  113. FPU(0, "SuperSparc on-chip FPU"),
  114. /* SparcClassic */
  115. FPU(4, "TI MicroSparc on chip FPU"),
  116. FPU(-1, NULL)
  117. }
  118. },{
  119. 5,
  120. .cpu_info = {
  121. CPU(0, "Matsushita - MN10501"),
  122. CPU(-1, NULL)
  123. },
  124. .fpu_info = {
  125. FPU(0, "Matsushita MN10501"),
  126. FPU(-1, NULL)
  127. }
  128. },{
  129. 6,
  130. .cpu_info = {
  131. CPU(0, "Philips Corporation - unknown"),
  132. CPU(-1, NULL)
  133. },
  134. .fpu_info = {
  135. FPU(-1, NULL)
  136. }
  137. },{
  138. 7,
  139. .cpu_info = {
  140. CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
  141. CPU(-1, NULL)
  142. },
  143. .fpu_info = {
  144. FPU(-1, NULL)
  145. }
  146. },{
  147. 8,
  148. .cpu_info = {
  149. CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
  150. CPU(-1, NULL)
  151. },
  152. .fpu_info = {
  153. FPU(-1, NULL)
  154. }
  155. },{
  156. 9,
  157. .cpu_info = {
  158. /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
  159. CPU(0, "Fujitsu or Weitek Power-UP"),
  160. CPU(1, "Fujitsu or Weitek Power-UP"),
  161. CPU(2, "Fujitsu or Weitek Power-UP"),
  162. CPU(3, "Fujitsu or Weitek Power-UP"),
  163. CPU(-1, NULL)
  164. },
  165. .fpu_info = {
  166. FPU(3, "Fujitsu or Weitek on-chip FPU"),
  167. FPU(-1, NULL)
  168. }
  169. }};
  170. /* In order to get the fpu type correct, you need to take the IDPROM's
  171. * machine type value into consideration too. I will fix this.
  172. */
  173. const char *sparc_cpu_type;
  174. const char *sparc_fpu_type;
  175. unsigned int fsr_storage;
  176. static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
  177. {
  178. sparc_cpu_type = NULL;
  179. sparc_fpu_type = NULL;
  180. if (psr_impl < ARRAY_SIZE(manufacturer_info))
  181. {
  182. const struct cpu_info *cpu;
  183. const struct fpu_info *fpu;
  184. cpu = &manufacturer_info[psr_impl].cpu_info[0];
  185. while (cpu->psr_vers != -1)
  186. {
  187. if (cpu->psr_vers == psr_vers) {
  188. sparc_cpu_type = cpu->name;
  189. sparc_fpu_type = "No FPU";
  190. break;
  191. }
  192. cpu++;
  193. }
  194. fpu = &manufacturer_info[psr_impl].fpu_info[0];
  195. while (fpu->fp_vers != -1)
  196. {
  197. if (fpu->fp_vers == fpu_vers) {
  198. sparc_fpu_type = fpu->name;
  199. break;
  200. }
  201. fpu++;
  202. }
  203. }
  204. if (sparc_cpu_type == NULL)
  205. {
  206. printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
  207. psr_impl, psr_vers);
  208. sparc_cpu_type = "Unknown CPU";
  209. }
  210. if (sparc_fpu_type == NULL)
  211. {
  212. printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
  213. psr_impl, fpu_vers);
  214. sparc_fpu_type = "Unknown FPU";
  215. }
  216. }
  217. void __cpuinit cpu_probe(void)
  218. {
  219. int psr_impl, psr_vers, fpu_vers;
  220. int psr;
  221. psr_impl = ((get_psr() >> 28) & 0xf);
  222. psr_vers = ((get_psr() >> 24) & 0xf);
  223. psr = get_psr();
  224. put_psr(psr | PSR_EF);
  225. fpu_vers = ((get_fsr() >> 17) & 0x7);
  226. put_psr(psr);
  227. set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
  228. }