transmeta.c 2.9 KB

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