transmeta.c 3.1 KB

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