]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] CPU detection fixes...
authorH. Peter Anvin <hpa@zytor.com>
Mon, 16 Sep 2002 04:27:07 +0000 (21:27 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Mon, 16 Sep 2002 04:27:07 +0000 (21:27 -0700)
I noticed a kluge had been put into 2.5.35, to cover up *one* of the
errors caused by a particular bug that was introduced when Patrick
Mochel split up arch/i386/kernel/setup.c: he incorrectly thought the
AMD-defined CPUID levels were AMD-specific; they're not -- every other
x86 vendors *including* Intel uses them as well.

This also adds the "i686" hack for TM5xxx that was added in 2.4 recently.

arch/i386/kernel/cpu/amd.c
arch/i386/kernel/cpu/common.c
arch/i386/kernel/cpu/intel.c
arch/i386/kernel/cpu/transmeta.c

index 9c7f94037fdaa342ed7f4926c4712b8b3301507f..00b09cc403a20aadbd822a562ec1038bc5c7ac1e 100644 (file)
@@ -157,24 +157,6 @@ static void __init init_amd(struct cpuinfo_x86 *c)
 //     return r;
 }
 
-static void amd_identify(struct cpuinfo_x86 * c)
-{
-       u32 xlvl;
-
-       if (have_cpuid_p()) {
-               generic_identify(c);
-
-               /* AMD-defined flags: level 0x80000001 */
-               xlvl = cpuid_eax(0x80000000);
-               if ( (xlvl & 0xffff0000) == 0x80000000 ) {
-                       if ( xlvl >= 0x80000001 )
-                               c->x86_capability[1] = cpuid_edx(0x80000001);
-                       if ( xlvl >= 0x80000004 )
-                               get_model_name(c); /* Default name */
-               }
-       }
-}
-
 static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
 {
        /* AMD errata T13 (order #21922) */
@@ -204,7 +186,7 @@ static struct cpu_dev amd_cpu_dev __initdata = {
                },
        },
        .c_init         = init_amd,
-       .c_identify     = amd_identify,
+       .c_identify     = generic_identify,
        .c_size_cache   = amd_size_cache,
 };
 
index 88041a31ce5d2e1aa26f5168d725cb829394ab22..2af5a1fa3e7299a72f01c901f1c2ae6a9f3e6382 100644 (file)
@@ -204,7 +204,7 @@ int __init have_cpuid_p(void)
 
 void __init generic_identify(struct cpuinfo_x86 * c)
 {
-       u32 tfms;
+       u32 tfms, xlvl;
        int junk;
 
        if (have_cpuid_p()) {
@@ -230,6 +230,15 @@ void __init generic_identify(struct cpuinfo_x86 * c)
                        /* Have CPUID level 0 only - unheard of */
                        c->x86 = 4;
                }
+
+               /* AMD-defined flags: level 0x80000001 */
+               xlvl = cpuid_eax(0x80000000);
+               if ( (xlvl & 0xffff0000) == 0x80000000 ) {
+                       if ( xlvl >= 0x80000001 )
+                               c->x86_capability[1] = cpuid_edx(0x80000001);
+                       if ( xlvl >= 0x80000004 )
+                               get_model_name(c); /* Default name */
+               }
        }
 }
 
index 6aa1e33becaf828145f692f06aef32b37d72c9c1..ff98d996d336653b3b79c42ce2bef7d81cb31597 100644 (file)
@@ -156,7 +156,6 @@ static void __init init_intel(struct cpuinfo_x86 *c)
        }
 #endif
 
-       get_model_name(c);
 
        if (c->cpuid_level > 1) {
                /* supports eax=2  call */
index 2314da6f8421370bce34dda43df9fbd0cebee69b..4bb3c5633b1f1583a5c230a0ba7d5e4939b06b94 100644 (file)
@@ -64,6 +64,11 @@ static void __init init_transmeta(struct cpuinfo_x86 *c)
        wrmsr(0x80860004, ~0, uk);
        c->x86_capability[0] = cpuid_edx(0x00000001);
        wrmsr(0x80860004, cap_mask, uk);
+       
+       /* If we can run i686 user-space code, call us an i686 */
+#define USER686 (X86_FEATURE_TSC|X86_FEATURE_CX8|X86_FEATURE_CMOV)
+        if ( c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686 )
+               c->x86 = 6;
 }
 
 static void transmeta_identify(struct cpuinfo_x86 * c)