transmeta.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 init_transmeta(struct cpuinfo_x86 *c)
  8. {
  9. unsigned int cap_mask, uk, max, dummy;
  10. unsigned int cms_rev1, cms_rev2;
  11. unsigned int cpu_rev, cpu_freq = 0, cpu_flags, new_cpu_rev;
  12. char cpu_info[65];
  13. get_model_name(c); /* Same as AMD/Cyrix */
  14. display_cacheinfo(c);
  15. /* Print CMS and CPU revision */
  16. max = cpuid_eax(0x80860000);
  17. cpu_rev = 0;
  18. if ( max >= 0x80860001 ) {
  19. cpuid(0x80860001, &dummy, &cpu_rev, &cpu_freq, &cpu_flags);
  20. if (cpu_rev != 0x02000000) {
  21. printk(KERN_INFO "CPU: Processor revision %u.%u.%u.%u, %u MHz\n",
  22. (cpu_rev >> 24) & 0xff,
  23. (cpu_rev >> 16) & 0xff,
  24. (cpu_rev >> 8) & 0xff,
  25. cpu_rev & 0xff,
  26. cpu_freq);
  27. }
  28. }
  29. if ( max >= 0x80860002 ) {
  30. cpuid(0x80860002, &new_cpu_rev, &cms_rev1, &cms_rev2, &dummy);
  31. if (cpu_rev == 0x02000000) {
  32. printk(KERN_INFO "CPU: Processor revision %08X, %u MHz\n",
  33. new_cpu_rev, cpu_freq);
  34. }
  35. printk(KERN_INFO "CPU: Code Morphing Software revision %u.%u.%u-%u-%u\n",
  36. (cms_rev1 >> 24) & 0xff,
  37. (cms_rev1 >> 16) & 0xff,
  38. (cms_rev1 >> 8) & 0xff,
  39. cms_rev1 & 0xff,
  40. cms_rev2);
  41. }
  42. if ( max >= 0x80860006 ) {
  43. cpuid(0x80860003,
  44. (void *)&cpu_info[0],
  45. (void *)&cpu_info[4],
  46. (void *)&cpu_info[8],
  47. (void *)&cpu_info[12]);
  48. cpuid(0x80860004,
  49. (void *)&cpu_info[16],
  50. (void *)&cpu_info[20],
  51. (void *)&cpu_info[24],
  52. (void *)&cpu_info[28]);
  53. cpuid(0x80860005,
  54. (void *)&cpu_info[32],
  55. (void *)&cpu_info[36],
  56. (void *)&cpu_info[40],
  57. (void *)&cpu_info[44]);
  58. cpuid(0x80860006,
  59. (void *)&cpu_info[48],
  60. (void *)&cpu_info[52],
  61. (void *)&cpu_info[56],
  62. (void *)&cpu_info[60]);
  63. cpu_info[64] = '\0';
  64. printk(KERN_INFO "CPU: %s\n", cpu_info);
  65. }
  66. /* Unhide possibly hidden capability flags */
  67. rdmsr(0x80860004, cap_mask, uk);
  68. wrmsr(0x80860004, ~0, uk);
  69. c->x86_capability[0] = cpuid_edx(0x00000001);
  70. wrmsr(0x80860004, cap_mask, uk);
  71. /* All Transmeta CPUs have a constant TSC */
  72. set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
  73. /* If we can run i686 user-space code, call us an i686 */
  74. #define USER686 ((1 << X86_FEATURE_TSC)|\
  75. (1 << X86_FEATURE_CX8)|\
  76. (1 << X86_FEATURE_CMOV))
  77. if (c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686)
  78. c->x86 = 6;
  79. #ifdef CONFIG_SYSCTL
  80. /* randomize_va_space slows us down enormously;
  81. it probably triggers retranslation of x86->native bytecode */
  82. randomize_va_space = 0;
  83. #endif
  84. }
  85. static void __cpuinit transmeta_identify(struct cpuinfo_x86 * c)
  86. {
  87. u32 xlvl;
  88. /* Transmeta-defined flags: level 0x80860001 */
  89. xlvl = cpuid_eax(0x80860000);
  90. if ( (xlvl & 0xffff0000) == 0x80860000 ) {
  91. if ( xlvl >= 0x80860001 )
  92. c->x86_capability[2] = cpuid_edx(0x80860001);
  93. }
  94. }
  95. static struct cpu_dev transmeta_cpu_dev __cpuinitdata = {
  96. .c_vendor = "Transmeta",
  97. .c_ident = { "GenuineTMx86", "TransmetaCPU" },
  98. .c_init = init_transmeta,
  99. .c_identify = transmeta_identify,
  100. };
  101. int __init transmeta_init_cpu(void)
  102. {
  103. cpu_devs[X86_VENDOR_TRANSMETA] = &transmeta_cpu_dev;
  104. return 0;
  105. }