Display the extended feature flags with non-Intel processors rather than
the standard flags. See also PR#19163. Before: cpu0: AMD Athlon XP 1800+ (686-class), 1532.11 MHz cpu0: features 383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR> cpu0: features 383f9ff<PGE,MCA,CMOV,FGPAT,PSE36,MMX> cpu0: features 383f9ff<FXSR,SSE> After: cpu0: AMD Athlon XP 1800+ (686-class), 1532.11 MHz cpu0: features c3cbf9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR> cpu0: features c3cbf9ff<PGE,MCA,CMOV,PAT,PSE36,MPC,MMXX,MMX> cpu0: features c3cbf9ff<FXSR,SSE,3DNOW2,3DNOW> While I'm here, amd_cpuid_cpu_cacheinfo() is an info function rather than a probe function.
This commit is contained in:
parent
7ae2f112dd
commit
281fa073dc
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: machdep.c,v 1.500 2002/12/05 16:19:08 junyoung Exp $ */
|
/* $NetBSD: machdep.c,v 1.501 2002/12/06 02:38:25 junyoung Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.500 2002/12/05 16:19:08 junyoung Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.501 2002/12/06 02:38:25 junyoung Exp $");
|
||||||
|
|
||||||
#include "opt_cputype.h"
|
#include "opt_cputype.h"
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
|
@ -341,6 +341,7 @@ void winchip_cpu_setup __P((struct cpu_info *));
|
||||||
void amd_family5_setup __P((struct cpu_info *));
|
void amd_family5_setup __P((struct cpu_info *));
|
||||||
void transmeta_cpu_setup __P((struct cpu_info *));
|
void transmeta_cpu_setup __P((struct cpu_info *));
|
||||||
|
|
||||||
|
static void via_cpu_probe __P((struct cpu_info *));
|
||||||
static void amd_family6_probe __P((struct cpu_info *));
|
static void amd_family6_probe __P((struct cpu_info *));
|
||||||
|
|
||||||
static void transmeta_cpu_info __P((struct cpu_info *));
|
static void transmeta_cpu_info __P((struct cpu_info *));
|
||||||
|
@ -792,8 +793,8 @@ const struct cpu_cpuid_nameclass i386_cpuid_cpus[] = {
|
||||||
"K5 or K6" /* Default */
|
"K5 or K6" /* Default */
|
||||||
},
|
},
|
||||||
amd_family5_setup,
|
amd_family5_setup,
|
||||||
amd_cpuid_cpu_cacheinfo,
|
|
||||||
NULL,
|
NULL,
|
||||||
|
amd_cpuid_cpu_cacheinfo,
|
||||||
},
|
},
|
||||||
/* Family 6 */
|
/* Family 6 */
|
||||||
{
|
{
|
||||||
|
@ -818,7 +819,7 @@ const struct cpu_cpuid_nameclass i386_cpuid_cpus[] = {
|
||||||
"Unknown K7 (Athlon)" /* Default */
|
"Unknown K7 (Athlon)" /* Default */
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
amd_cpuid_cpu_cacheinfo,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
} }
|
} }
|
||||||
},
|
},
|
||||||
|
@ -969,7 +970,7 @@ const struct cpu_cpuid_nameclass i386_cpuid_cpus[] = {
|
||||||
"C3" /* Default */
|
"C3" /* Default */
|
||||||
},
|
},
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
via_cpu_probe,
|
||||||
NULL,
|
NULL,
|
||||||
},
|
},
|
||||||
/* Family > 6, not yet available from VIA */
|
/* Family > 6, not yet available from VIA */
|
||||||
|
@ -1098,6 +1099,29 @@ winchip_cpu_setup(ci)
|
||||||
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
|
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
|
||||||
: "a" (code));
|
: "a" (code));
|
||||||
|
|
||||||
|
void
|
||||||
|
via_cpu_probe(struct cpu_info *ci)
|
||||||
|
{
|
||||||
|
u_int descs[4];
|
||||||
|
u_int lfunc;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determine the largest extended function value.
|
||||||
|
*/
|
||||||
|
CPUID(0x80000000, descs[0], descs[1], descs[2], descs[3]);
|
||||||
|
lfunc = descs[0];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determine the extended feature flags.
|
||||||
|
*/
|
||||||
|
if (lfunc >= 0x80000001) {
|
||||||
|
CPUID(0x80000001, descs[0], descs[1], descs[2], descs[3]);
|
||||||
|
ci->ci_feature_flags = descs[3];
|
||||||
|
ci->ci_feature_str2 = CPUID_EXT_FLAGS2;
|
||||||
|
ci->ci_feature_str3 = CPUID_EXT_FLAGS3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cpu_probe_base_features(struct cpu_info *ci)
|
cpu_probe_base_features(struct cpu_info *ci)
|
||||||
{
|
{
|
||||||
|
@ -1121,6 +1145,13 @@ cpu_probe_base_features(struct cpu_info *ci)
|
||||||
|
|
||||||
CPUID(1, ci->ci_signature, miscbytes, dummy1, ci->ci_feature_flags);
|
CPUID(1, ci->ci_signature, miscbytes, dummy1, ci->ci_feature_flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These may be overridden with vendor specific strings later.
|
||||||
|
*/
|
||||||
|
ci->ci_feature_str1 = CPUID_FLAGS1;
|
||||||
|
ci->ci_feature_str2 = CPUID_FLAGS2;
|
||||||
|
ci->ci_feature_str3 = CPUID_FLAGS3;
|
||||||
|
|
||||||
/* Brand is low order 8 bits of ebx */
|
/* Brand is low order 8 bits of ebx */
|
||||||
ci->ci_brand_id = miscbytes & 0xff;
|
ci->ci_brand_id = miscbytes & 0xff;
|
||||||
|
|
||||||
|
@ -1213,14 +1244,25 @@ cpu_probe_features(struct cpu_info *ci)
|
||||||
void
|
void
|
||||||
amd_family6_probe(struct cpu_info *ci)
|
amd_family6_probe(struct cpu_info *ci)
|
||||||
{
|
{
|
||||||
u_int32_t eax;
|
u_int32_t lfunc;
|
||||||
u_int32_t dummy1, dummy2, dummy3;
|
u_int32_t descs[4];
|
||||||
u_int32_t brand[12];
|
u_int32_t brand[12];
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
CPUID(0x80000000, eax, dummy1, dummy2, dummy3);
|
CPUID(0x80000000, lfunc, descs[1], descs[2], descs[3]);
|
||||||
if (eax < 0x80000004)
|
|
||||||
|
/*
|
||||||
|
* Determine the extended feature flags.
|
||||||
|
*/
|
||||||
|
if (lfunc >= 0x80000001) {
|
||||||
|
CPUID(0x80000001, descs[0], descs[1], descs[2], descs[3]);
|
||||||
|
ci->ci_feature_flags |= descs[3];
|
||||||
|
ci->ci_feature_str2 = CPUID_EXT_FLAGS2;
|
||||||
|
ci->ci_feature_str3 = CPUID_EXT_FLAGS3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lfunc < 0x80000004)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CPUID(0x80000002, brand[0], brand[1], brand[2], brand[3]);
|
CPUID(0x80000002, brand[0], brand[1], brand[2], brand[3]);
|
||||||
|
@ -1795,18 +1837,18 @@ identifycpu(struct cpu_info *ci)
|
||||||
|
|
||||||
if (ci->ci_feature_flags) {
|
if (ci->ci_feature_flags) {
|
||||||
if ((ci->ci_feature_flags & CPUID_MASK1) != 0) {
|
if ((ci->ci_feature_flags & CPUID_MASK1) != 0) {
|
||||||
bitmask_snprintf(ci->ci_feature_flags, CPUID_FLAGS1,
|
bitmask_snprintf(ci->ci_feature_flags,
|
||||||
buf, sizeof(buf));
|
ci->ci_feature_str1, buf, sizeof(buf));
|
||||||
printf("%s: features %s\n", cpuname, buf);
|
printf("%s: features %s\n", cpuname, buf);
|
||||||
}
|
}
|
||||||
if ((ci->ci_feature_flags & CPUID_MASK2) != 0) {
|
if ((ci->ci_feature_flags & CPUID_MASK2) != 0) {
|
||||||
bitmask_snprintf(ci->ci_feature_flags, CPUID_FLAGS2,
|
bitmask_snprintf(ci->ci_feature_flags,
|
||||||
buf, sizeof(buf));
|
ci->ci_feature_str2, buf, sizeof(buf));
|
||||||
printf("%s: features %s\n", cpuname, buf);
|
printf("%s: features %s\n", cpuname, buf);
|
||||||
}
|
}
|
||||||
if ((ci->ci_feature_flags & CPUID_MASK3) != 0) {
|
if ((ci->ci_feature_flags & CPUID_MASK3) != 0) {
|
||||||
bitmask_snprintf(ci->ci_feature_flags, CPUID_FLAGS3,
|
bitmask_snprintf(ci->ci_feature_flags,
|
||||||
buf, sizeof(buf));
|
ci->ci_feature_str3, buf, sizeof(buf));
|
||||||
printf("%s: features %s\n", cpuname, buf);
|
printf("%s: features %s\n", cpuname, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: cpu.h,v 1.90 2002/11/28 21:43:55 fvdl Exp $ */
|
/* $NetBSD: cpu.h,v 1.91 2002/12/06 02:38:27 junyoung Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
* Copyright (c) 1990 The Regents of the University of California.
|
||||||
|
@ -127,6 +127,9 @@ struct cpu_info {
|
||||||
int32_t ci_cpuid_level;
|
int32_t ci_cpuid_level;
|
||||||
u_int32_t ci_signature; /* X86 cpuid type */
|
u_int32_t ci_signature; /* X86 cpuid type */
|
||||||
u_int32_t ci_feature_flags;/* X86 CPUID feature bits */
|
u_int32_t ci_feature_flags;/* X86 CPUID feature bits */
|
||||||
|
char * ci_feature_str1; /* Vendor specific feature strings */
|
||||||
|
char * ci_feature_str2;
|
||||||
|
char * ci_feature_str3;
|
||||||
u_int32_t ci_cpu_class; /* CPU class */
|
u_int32_t ci_cpu_class; /* CPU class */
|
||||||
u_int32_t ci_brand_id; /* Intel brand id */
|
u_int32_t ci_brand_id; /* Intel brand id */
|
||||||
u_int32_t ci_vendor[4]; /* vendor string */
|
u_int32_t ci_vendor[4]; /* vendor string */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: specialreg.h,v 1.25 2002/12/05 17:25:26 junyoung Exp $ */
|
/* $NetBSD: specialreg.h,v 1.26 2002/12/06 02:38:28 junyoung Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991 The Regents of the University of California.
|
* Copyright (c) 1991 The Regents of the University of California.
|
||||||
|
@ -133,6 +133,20 @@
|
||||||
#define CPUID_FLAGS3 "\20\31FXSR\32SSE\33SSE2\34SS\35HTT\36TM\37B30\40SBF"
|
#define CPUID_FLAGS3 "\20\31FXSR\32SSE\33SSE2\34SS\35HTT\36TM\37B30\40SBF"
|
||||||
#define CPUID_MASK3 0xff000000
|
#define CPUID_MASK3 0xff000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AMD/VIA processor specific flags.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CPUID_MPC 0x00080000 /* Multiprocessing Capable */
|
||||||
|
#define CPUID_MMXX 0x00400000 /* AMD MMX Extensions */
|
||||||
|
#define CPUID_3DNOW2 0x40000000 /* 3DNow! Instruction Extension */
|
||||||
|
#define CPUID_3DNOW 0x80000000 /* 3DNow! Instructions */
|
||||||
|
|
||||||
|
#define CPUID_EXT_FLAGS2 "\20\16PGE\17MCA\20CMOV\21PAT\22PSE36\23PN" \
|
||||||
|
"\24MPC\25B20\26B21\27MMXX\30MMX"
|
||||||
|
#define CPUID_EXT_FLAGS3 "\20\31FXSR\32SSE\33B26\34B27\35B28\36B29" \
|
||||||
|
"\0373DNOW2\0403DNOW"
|
||||||
|
|
||||||
#define CPUID2FAMILY(cpuid) (((cpuid) >> 8) & 15)
|
#define CPUID2FAMILY(cpuid) (((cpuid) >> 8) & 15)
|
||||||
#define CPUID2MODEL(cpuid) (((cpuid) >> 4) & 15)
|
#define CPUID2MODEL(cpuid) (((cpuid) >> 4) & 15)
|
||||||
#define CPUID2STEPPING(cpuid) ((cpuid) & 15)
|
#define CPUID2STEPPING(cpuid) ((cpuid) & 15)
|
||||||
|
|
Loading…
Reference in New Issue