transmeta.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #include <linux/kernel.h>
  2. #include <linux/mm.h>
  3. #include <asm/cpufeature.h>
  4. #include <asm/msr.h>
  5. #include "cpu.h"
  6. static void early_init_transmeta(struct cpuinfo_x86 *c)
  7. {
  8. u32 xlvl;
  9. /* Transmeta-defined flags: level 0x80860001 */
  10. xlvl = cpuid_eax(0x80860000);
  11. if ((xlvl & 0xffff0000) == 0x80860000) {
  12. if (xlvl >= 0x80860001)
  13. c->x86_capability[CPUID_8086_0001_EDX] = cpuid_edx(0x80860001);
  14. }
  15. }
  16. static void init_transmeta(struct cpuinfo_x86 *c)
  17. {
  18. unsigned int cap_mask, uk, max, dummy;
  19. unsigned int cms_rev1, cms_rev2;
  20. unsigned int cpu_rev, cpu_freq = 0, cpu_flags, new_cpu_rev;
  21. char cpu_info[65];
  22. early_init_transmeta(c);
  23. cpu_detect_cache_sizes(c);
  24. /* Print CMS and CPU revision */
  25. max = cpuid_eax(0x80860000);
  26. cpu_rev = 0;
  27. if (max >= 0x80860001) {
  28. cpuid(0x80860001, &dummy, &cpu_rev, &cpu_freq, &cpu_flags);
  29. if (cpu_rev != 0x02000000) {
  30. printk(KERN_INFO "CPU: Processor revision %u.%u.%u.%u, %u MHz\n",
  31. (cpu_rev >> 24) & 0xff,
  32. (cpu_rev >> 16) & 0xff,
  33. (cpu_rev >> 8) & 0xff,
  34. cpu_rev & 0xff,
  35. cpu_freq);
  36. }
  37. }
  38. if (max >= 0x80860002) {
  39. cpuid(0x80860002, &new_cpu_rev, &cms_rev1, &cms_rev2, &dummy);
  40. if (cpu_rev == 0x02000000) {
  41. printk(KERN_INFO "CPU: Processor revision %08X, %u MHz\n",
  42. new_cpu_rev, cpu_freq);
  43. }
  44. printk(KERN_INFO "CPU: Code Morphing Software revision %u.%u.%u-%u-%u\n",
  45. (cms_rev1 >> 24) & 0xff,
  46. (cms_rev1 >> 16) & 0xff,
  47. (cms_rev1 >> 8) & 0xff,
  48. cms_rev1 & 0xff,
  49. cms_rev2);
  50. }
  51. if (max >= 0x80860006) {
  52. cpuid(0x80860003,
  53. (void *)&cpu_info[0],
  54. (void *)&cpu_info[4],
  55. (void *)&cpu_info[8],
  56. (void *)&cpu_info[12]);
  57. cpuid(0x80860004,
  58. (void *)&cpu_info[16],
  59. (void *)&cpu_info[20],
  60. (void *)&cpu_info[24],
  61. (void *)&cpu_info[28]);
  62. cpuid(0x80860005,
  63. (void *)&cpu_info[32],
  64. (void *)&cpu_info[36],
  65. (void *)&cpu_info[40],
  66. (void *)&cpu_info[44]);
  67. cpuid(0x80860006,
  68. (void *)&cpu_info[48],
  69. (void *)&cpu_info[52],
  70. (void *)&cpu_info[56],
  71. (void *)&cpu_info[60]);
  72. cpu_info[64] = '\0';
  73. printk(KERN_INFO "CPU: %s\n", cpu_info);
  74. }
  75. /* Unhide possibly hidden capability flags */
  76. rdmsr(0x80860004, cap_mask, uk);
  77. wrmsr(0x80860004, ~0, uk);
  78. c->x86_capability[CPUID_1_EDX] = cpuid_edx(0x00000001);
  79. wrmsr(0x80860004, cap_mask, uk);
  80. /* All Transmeta CPUs have a constant TSC */
  81. set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
  82. #ifdef CONFIG_SYSCTL
  83. /*
  84. * randomize_va_space slows us down enormously;
  85. * it probably triggers retranslation of x86->native bytecode
  86. */
  87. randomize_va_space = 0;
  88. #endif
  89. }
  90. static const struct cpu_dev transmeta_cpu_dev = {
  91. .c_vendor = "Transmeta",
  92. .c_ident = { "GenuineTMx86", "TransmetaCPU" },
  93. .c_early_init = early_init_transmeta,
  94. .c_init = init_transmeta,
  95. .c_x86_vendor = X86_VENDOR_TRANSMETA,
  96. };
  97. cpu_dev_register(transmeta_cpu_dev);