cpu.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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/config.h>
  7. #include <linux/kernel.h>
  8. #include <linux/init.h>
  9. #include <linux/smp.h>
  10. #include <linux/threads.h>
  11. #include <asm/oplib.h>
  12. #include <asm/page.h>
  13. #include <asm/head.h>
  14. #include <asm/psr.h>
  15. #include <asm/mbus.h>
  16. #include <asm/cpudata.h>
  17. DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
  18. struct cpu_iu_info {
  19. int psr_impl;
  20. int psr_vers;
  21. char* cpu_name; /* should be enough I hope... */
  22. };
  23. struct cpu_fp_info {
  24. int psr_impl;
  25. int fp_vers;
  26. char* fp_name;
  27. };
  28. /* In order to get the fpu type correct, you need to take the IDPROM's
  29. * machine type value into consideration too. I will fix this.
  30. */
  31. struct cpu_fp_info linux_sparc_fpu[] = {
  32. { 0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"},
  33. { 0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"},
  34. { 0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"},
  35. /* SparcStation SLC, SparcStation1 */
  36. { 0, 3, "Weitek WTL3170/2"},
  37. /* SPARCstation-5 */
  38. { 0, 4, "Lsi Logic/Meiko L64804 or compatible"},
  39. { 0, 5, "reserved"},
  40. { 0, 6, "reserved"},
  41. { 0, 7, "No FPU"},
  42. { 1, 0, "ROSS HyperSparc combined IU/FPU"},
  43. { 1, 1, "Lsi Logic L64814"},
  44. { 1, 2, "Texas Instruments TMS390-C602A"},
  45. { 1, 3, "Cypress CY7C602 FPU"},
  46. { 1, 4, "reserved"},
  47. { 1, 5, "reserved"},
  48. { 1, 6, "reserved"},
  49. { 1, 7, "No FPU"},
  50. { 2, 0, "BIT B5010 or B5110/20 or B5210"},
  51. { 2, 1, "reserved"},
  52. { 2, 2, "reserved"},
  53. { 2, 3, "reserved"},
  54. { 2, 4, "reserved"},
  55. { 2, 5, "reserved"},
  56. { 2, 6, "reserved"},
  57. { 2, 7, "No FPU"},
  58. /* SuperSparc 50 module */
  59. { 4, 0, "SuperSparc on-chip FPU"},
  60. /* SparcClassic */
  61. { 4, 4, "TI MicroSparc on chip FPU"},
  62. { 5, 0, "Matsushita MN10501"},
  63. { 5, 1, "reserved"},
  64. { 5, 2, "reserved"},
  65. { 5, 3, "reserved"},
  66. { 5, 4, "reserved"},
  67. { 5, 5, "reserved"},
  68. { 5, 6, "reserved"},
  69. { 5, 7, "No FPU"},
  70. { 9, 3, "Fujitsu or Weitek on-chip FPU"},
  71. };
  72. #define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info))
  73. struct cpu_iu_info linux_sparc_chips[] = {
  74. /* Sun4/100, 4/200, SLC */
  75. { 0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"},
  76. /* borned STP1012PGA */
  77. { 0, 4, "Fujitsu MB86904"},
  78. { 0, 5, "Fujitsu TurboSparc MB86907"},
  79. /* SparcStation2, SparcServer 490 & 690 */
  80. { 1, 0, "LSI Logic Corporation - L64811"},
  81. /* SparcStation2 */
  82. { 1, 1, "Cypress/ROSS CY7C601"},
  83. /* Embedded controller */
  84. { 1, 3, "Cypress/ROSS CY7C611"},
  85. /* Ross Technologies HyperSparc */
  86. { 1, 0xf, "ROSS HyperSparc RT620"},
  87. { 1, 0xe, "ROSS HyperSparc RT625 or RT626"},
  88. /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
  89. /* Someone please write the code to support this beast! ;) */
  90. { 2, 0, "Bipolar Integrated Technology - B5010"},
  91. { 3, 0, "LSI Logic Corporation - unknown-type"},
  92. { 4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"},
  93. /* SparcClassic -- borned STP1010TAB-50*/
  94. { 4, 1, "Texas Instruments, Inc. - MicroSparc"},
  95. { 4, 2, "Texas Instruments, Inc. - MicroSparc II"},
  96. { 4, 3, "Texas Instruments, Inc. - SuperSparc 51"},
  97. { 4, 4, "Texas Instruments, Inc. - SuperSparc 61"},
  98. { 4, 5, "Texas Instruments, Inc. - unknown"},
  99. { 5, 0, "Matsushita - MN10501"},
  100. { 6, 0, "Philips Corporation - unknown"},
  101. { 7, 0, "Harvest VLSI Design Center, Inc. - unknown"},
  102. /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
  103. { 8, 0, "Systems and Processes Engineering Corporation (SPEC)"},
  104. { 9, 0, "Fujitsu or Weitek Power-UP"},
  105. { 9, 1, "Fujitsu or Weitek Power-UP"},
  106. { 9, 2, "Fujitsu or Weitek Power-UP"},
  107. { 9, 3, "Fujitsu or Weitek Power-UP"},
  108. { 0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"},
  109. { 0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"},
  110. { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"},
  111. { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"},
  112. { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"},
  113. { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"},
  114. };
  115. #define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info))
  116. char *sparc_cpu_type;
  117. char *sparc_fpu_type;
  118. unsigned int fsr_storage;
  119. void __init cpu_probe(void)
  120. {
  121. int psr_impl, psr_vers, fpu_vers;
  122. int i, psr;
  123. psr_impl = ((get_psr()>>28)&0xf);
  124. psr_vers = ((get_psr()>>24)&0xf);
  125. psr = get_psr();
  126. put_psr(psr | PSR_EF);
  127. fpu_vers = ((get_fsr()>>17)&0x7);
  128. put_psr(psr);
  129. for(i = 0; i<NSPARCCHIPS; i++) {
  130. if(linux_sparc_chips[i].psr_impl == psr_impl)
  131. if(linux_sparc_chips[i].psr_vers == psr_vers) {
  132. sparc_cpu_type = linux_sparc_chips[i].cpu_name;
  133. break;
  134. }
  135. }
  136. if(i==NSPARCCHIPS)
  137. printk("DEBUG: psr.impl = 0x%x psr.vers = 0x%x\n", psr_impl,
  138. psr_vers);
  139. for(i = 0; i<NSPARCFPU; i++) {
  140. if(linux_sparc_fpu[i].psr_impl == psr_impl)
  141. if(linux_sparc_fpu[i].fp_vers == fpu_vers) {
  142. sparc_fpu_type = linux_sparc_fpu[i].fp_name;
  143. break;
  144. }
  145. }
  146. if(i == NSPARCFPU) {
  147. printk("DEBUG: psr.impl = 0x%x fsr.vers = 0x%x\n", psr_impl,
  148. fpu_vers);
  149. sparc_fpu_type = linux_sparc_fpu[31].fp_name;
  150. }
  151. }