* by the fact that they preserve the flags across the division of 5/2.
* PII and PPro exhibit this behavior too, but they have cpuid available.
*/
-
+
/*
* Perform the Cyrix 5/2 test. A Cyrix won't change
* the flags, while other 486 chips will.
* Detect a NexGen CPU running without BIOS hypercode new enough
* to have CPUID. (Thanks to Herbert Oppmann)
*/
-
+
static int deep_magic_nexgen_probe(void)
{
int ret;
-
+
__asm__ __volatile__ (
" movw $0x5555, %%ax\n"
" xorw %%dx,%%dx\n"
" movl $0, %%eax\n"
" jnz 1f\n"
" movl $1, %%eax\n"
- "1:\n"
+ "1:\n"
: "=a" (ret) : : "cx", "dx" );
return ret;
}
} x86_vendors[] = {
{ X86_VENDOR_INTEL, "GenuineIntel", },
{ X86_VENDOR_CYRIX, "CyrixInstead", },
- { X86_VENDOR_AMD, "AuthenticAMD", },
+ { X86_VENDOR_AMD, "AuthenticAMD", },
{ X86_VENDOR_UMC, "UMC UMC UMC ", },
{ X86_VENDOR_NEXGEN, "NexGenDriven", },
{ X86_VENDOR_CENTAUR, "CentaurHauls", },
{
const char *name;
name = "<invalid cpu vendor>";
- if ((vendor < (sizeof(x86_vendor_name)/sizeof(x86_vendor_name[0]))) &&
- (x86_vendor_name[vendor] != 0))
+ if ((vendor < (ARRAY_SIZE(x86_vendor_name))) &&
+ (x86_vendor_name[vendor] != 0))
{
name = x86_vendor_name[vendor];
}
static void identify_cpu(struct device *cpu)
{
char vendor_name[16];
- int cpuid_level;
int i;
vendor_name[0] = '\0'; /* Unset */
- cpuid_level = -1; /* Maximum supported CPUID level, -1=no CPUID */
/* Find the id and vendor_name */
if (!have_cpuid_p()) {
}
}
if (have_cpuid_p()) {
+ int cpuid_level;
struct cpuid_result result;
result = cpuid(0x00000000);
cpuid_level = result.eax;
vendor_name[10] = (result.ecx >> 16) & 0xff;
vendor_name[11] = (result.ecx >> 24) & 0xff;
vendor_name[12] = '\0';
-
+
/* Intel-defined flags: level 0x00000001 */
if (cpuid_level >= 0x00000001) {
cpu->device = cpuid_eax(0x00000001);
}
}
cpu->vendor = X86_VENDOR_UNKNOWN;
- for(i = 0; i < sizeof(x86_vendors)/sizeof(x86_vendors[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(x86_vendors); i++) {
if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) {
cpu->vendor = x86_vendors[i].vendor;
break;
struct cpu_device_id *id;
for(id = driver->id_table; id->vendor != X86_VENDOR_INVALID; id++) {
if ((cpu->vendor == id->vendor) &&
- (cpu->device == id->device))
+ (cpu->device == id->device))
{
goto found;
}
}
}
- die("Unknown cpu");
return;
found:
cpu->ops = driver->ops;
*/
struct device *cpu;
struct cpu_info *info;
+ struct cpuinfo_x86 c;
+
info = cpu_info();
- printk_notice("Initializing CPU #%d\n", info->index);
+ printk(BIOS_INFO, "Initializing CPU #%ld\n", info->index);
cpu = info->cpu;
if (!cpu) {
/* Find what type of cpu we are dealing with */
identify_cpu(cpu);
- printk_debug("CPU: vendor %s device %x\n",
+ printk(BIOS_DEBUG, "CPU: vendor %s device %x\n",
cpu_vendor_name(cpu->vendor), cpu->device);
-
+
+ get_fms(&c, cpu->device);
+
+ printk(BIOS_DEBUG, "CPU: family %02x, model %02x, stepping %02x\n",
+ c.x86, c.x86_model, c.x86_mask);
+
/* Lookup the cpu's operations */
set_cpu_ops(cpu);
+ if(!cpu->ops) {
+ /* mask out the stepping and try again */
+ cpu->device -= c.x86_mask;
+ set_cpu_ops(cpu);
+ cpu->device += c.x86_mask;
+ if(!cpu->ops) die("Unknown cpu");
+ printk(BIOS_DEBUG, "Using generic cpu ops (good)\n");
+ }
+
+
/* Initialize the cpu */
if (cpu->ops && cpu->ops->init) {
cpu->enabled = 1;
cpu->ops->init(cpu);
}
- printk_info("CPU #%d Initialized\n", info->index);
+ printk(BIOS_INFO, "CPU #%ld initialized\n", info->index);
+
return;
}