struct cpu_info: add a ci_feature2_flags member.
identcpu: print extended cpuid features with ci_feature2_flags. "Looks good" by christos and njoly.
This commit is contained in:
parent
ecde337fba
commit
868ef0036d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: identcpu.c,v 1.13 2007/03/15 00:28:58 xtraeme Exp $ */
|
||||
/* $NetBSD: identcpu.c,v 1.14 2007/03/16 18:52:03 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.13 2007/03/15 00:28:58 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.14 2007/03/16 18:52:03 xtraeme Exp $");
|
||||
|
||||
#include "opt_powernow_k8.h"
|
||||
|
||||
|
@ -60,9 +60,9 @@ identifycpu(struct cpu_info *ci)
|
|||
char buf[512];
|
||||
u_int32_t brand[12];
|
||||
int vendor;
|
||||
const char *feature_str[3];
|
||||
const char *feature_str[3], *feature2_str[1];
|
||||
|
||||
CPUID(1, ci->ci_signature, val, dummy, ci->ci_feature_flags);
|
||||
CPUID(1, ci->ci_signature, val, ci->ci_feature2_flags, ci->ci_feature_flags);
|
||||
CPUID(0x80000001, dummy, dummy, dummy, val);
|
||||
ci->ci_feature_flags |= val;
|
||||
|
||||
|
@ -84,12 +84,12 @@ identifycpu(struct cpu_info *ci)
|
|||
|
||||
amd_cpu_cacheinfo(ci);
|
||||
|
||||
printf("%s: %s", ci->ci_dev->dv_xname, cpu_model);
|
||||
aprint_normal("%s: %s", ci->ci_dev->dv_xname, cpu_model);
|
||||
|
||||
if (ci->ci_tsc_freq != 0)
|
||||
printf(", %lu.%02lu MHz", (ci->ci_tsc_freq + 4999) / 1000000,
|
||||
aprint_normal(", %lu.%02lu MHz", (ci->ci_tsc_freq + 4999) / 1000000,
|
||||
((ci->ci_tsc_freq + 4999) / 10000) % 100);
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
if (vendor == CPUVENDOR_INTEL) {
|
||||
feature_str[0] = CPUID_FLAGS1;
|
||||
|
@ -101,20 +101,28 @@ identifycpu(struct cpu_info *ci)
|
|||
feature_str[2] = CPUID_EXT_FLAGS3;
|
||||
}
|
||||
|
||||
feature2_str[0] = CPUID2_FLAGS;
|
||||
|
||||
if ((ci->ci_feature_flags & CPUID_MASK1) != 0) {
|
||||
bitmask_snprintf(ci->ci_feature_flags,
|
||||
feature_str[0], buf, sizeof(buf));
|
||||
printf("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
aprint_normal("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
}
|
||||
if ((ci->ci_feature_flags & CPUID_MASK2) != 0) {
|
||||
bitmask_snprintf(ci->ci_feature_flags,
|
||||
feature_str[1], buf, sizeof(buf));
|
||||
printf("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
aprint_normal("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
}
|
||||
if ((ci->ci_feature_flags & CPUID_MASK3) != 0) {
|
||||
bitmask_snprintf(ci->ci_feature_flags,
|
||||
feature_str[2], buf, sizeof(buf));
|
||||
printf("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
aprint_normal("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
}
|
||||
|
||||
if (ci->ci_feature2_flags) {
|
||||
bitmask_snprintf(ci->ci_feature2_flags,
|
||||
feature2_str[0], buf, sizeof(buf));
|
||||
aprint_normal("%s: features2: %s\n", ci->ci_dev->dv_xname, buf);
|
||||
}
|
||||
|
||||
x86_print_cacheinfo(ci);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.18 2007/03/16 06:20:36 xtraeme Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.19 2007/03/16 18:52:03 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -102,6 +102,7 @@ struct cpu_info {
|
|||
u_int32_t ci_ipis;
|
||||
|
||||
u_int32_t ci_feature_flags;
|
||||
uint32_t ci_feature2_flags;
|
||||
u_int32_t ci_signature;
|
||||
u_int64_t ci_tsc_freq;
|
||||
|
||||
|
|
Loading…
Reference in New Issue