Commit 49cda8eb authored by H. Peter Anvin's avatar H. Peter Anvin Committed by Linus Torvalds

[PATCH] CPU detection fixes...

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.
parent d8795878
......@@ -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,
};
......
......@@ -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 */
}
}
}
......
......@@ -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 */
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment