transmeta.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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, 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. /* If we can run i686 user-space code, call us an i686 */
  72. #define USER686 (X86_FEATURE_TSC|X86_FEATURE_CX8|X86_FEATURE_CMOV)
  73. if ( c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686 )
  74. c->x86 = 6;
  75. #ifdef CONFIG_SYSCTL
  76. /* randomize_va_space slows us down enormously;
  77. it probably triggers retranslation of x86->native bytecode */
  78. randomize_va_space = 0;
  79. #endif
  80. }
  81. static void __cpuinit transmeta_identify(struct cpuinfo_x86 * c)
  82. {
  83. u32 xlvl;
  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 __cpuinitdata = {
  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);
  103. static int __init transmeta_exit_cpu(void)
  104. {
  105. cpu_devs[X86_VENDOR_TRANSMETA] = NULL;
  106. return 0;
  107. }
  108. late_initcall(transmeta_exit_cpu);