Newer Intel PIII processors also make available Brand ID value through

cpuid instruction, which is used to differentiate between Celeron, common PIII
and PIII Xeon; recognize it and print appropriate info if applicable

Information taken from Intel's (R)
Intel Processor Identification and the CPUID Instruction, AP-485
This commit is contained in:
jdolecek 2000-11-16 10:19:02 +00:00
parent a9ad986a90
commit def6d1b4ac
2 changed files with 31 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.225 2000/09/07 18:46:19 thorpej Exp $ */
/* $NetBSD: locore.s,v 1.226 2000/11/16 10:19:02 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -217,6 +217,7 @@
.globl _C_LABEL(cpu),_C_LABEL(cpu_id),_C_LABEL(cpu_vendor)
.globl _C_LABEL(cpuid_level),_C_LABEL(cpu_feature)
.globl _C_LABEL(cpu_brand_id)
.globl _C_LABEL(esym),_C_LABEL(boothowto)
.globl _C_LABEL(bootinfo),_C_LABEL(atdevbase)
#ifdef COMPAT_OLDBOOT
@ -237,6 +238,7 @@ _C_LABEL(cpuid_level): .long -1 # max. level accepted by 'cpuid'
# instruction
_C_LABEL(cpu_vendor): .space 16 # vendor string returned by `cpuid'
# instruction
_C_LABEL(cpu_brand_id): .long 0 # brand ID from 'cpuid' instruction
_C_LABEL(esym): .long 0 # ptr to end of syms
_C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual
_C_LABEL(proc0paddr): .long 0
@ -499,6 +501,10 @@ try586: /* Use the `cpuid' instruction. */
movl %eax,RELOC(cpu_id) # store cpu_id and features
movl %edx,RELOC(cpu_feature)
/* Brand ID is bits 0-7 of %ebx */
andl $255,%ebx
movl %ebx,RELOC(cpu_brand_id)
2:
/*
* Finished with old stack; load new %esp now instead of later so we

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.416 2000/11/16 09:06:17 jdolecek Exp $ */
/* $NetBSD: machdep.c,v 1.417 2000/11/16 10:19:02 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -281,6 +281,17 @@ const struct i386_cache_info {
const struct i386_cache_info *i386_cache_info_lookup __P((u_int8_t));
/*
* Map Brand ID from cpuid instruction to brand name.
* Source: Intel Processor Identification and the CPUID Instruction, AP-485
*/
const char * const i386_p3_brand[] = {
NULL, /* Unsupported */
"Celeron", /* Intel (R) Celeron (TM) processor */
"", /* Intel (R) Pentium (R) III processor */
"Xeon", /* Intel (R) Pentium (R) III Xeon (TM) processor */
};
#ifdef COMPAT_NOMID
static int exec_nomid __P((struct proc *, struct exec_package *));
#endif
@ -863,7 +874,8 @@ identifycpu()
{
extern char cpu_vendor[];
extern int cpu_id;
const char *name, *modifier, *vendorname;
extern int cpu_brand_id;
const char *name, *modifier, *vendorname, *brand = "";
int class = CPUCLASS_386, vendor, i, max;
int family, model, step, modif;
struct cpu_cpuid_nameclass *cpup = NULL;
@ -929,10 +941,19 @@ identifycpu()
name = cpup->cpu_family[i].cpu_models[CPU_DEFMODEL];
class = cpup->cpu_family[i].cpu_class;
cpu_setup = cpup->cpu_family[i].cpu_setup;
/*
* Intel processors family >= 6, model 8 allow to
* recognize brand by Brand ID value.
*/
if (vendor == CPUVENDOR_INTEL && family >= 6
&& model >= 8 && cpu_brand_id && cpu_brand_id <= 3)
brand = i386_p3_brand[cpu_brand_id];
}
}
sprintf(cpu_model, "%s %s%s (%s-class)", vendorname, modifier, name,
sprintf(cpu_model, "%s %s%s%s%s (%s-class)", vendorname, modifier, name,
(brand && *brand) ? " " : "", brand,
classnames[class]);
cpu_class = class;