Module Name: src
Committed By: msaitoh
Date: Thu Nov 20 10:31:10 UTC 2014
Modified Files:
src/usr.sbin/cpuctl/arch: i386.c
Log Message:
Move some printf()s from cpu_probe_base_features() to identifycpu().
Those printf()s are used for "identify" command but cpu_probe_base_features()
is shared by ucodeupdate_check(), too. This change fixes a problem that
the "ucode" command print extra output.
To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/cpuctl/arch/i386.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.61 src/usr.sbin/cpuctl/arch/i386.c:1.62
--- src/usr.sbin/cpuctl/arch/i386.c:1.61 Tue Nov 11 08:23:17 2014
+++ src/usr.sbin/cpuctl/arch/i386.c Thu Nov 20 10:31:10 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: i386.c,v 1.61 2014/11/11 08:23:17 skrll Exp $ */
+/* $NetBSD: i386.c,v 1.62 2014/11/20 10:31:10 msaitoh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.61 2014/11/11 08:23:17 skrll Exp $");
+__RCSID("$NetBSD: i386.c,v 1.62 2014/11/20 10:31:10 msaitoh Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -1444,40 +1444,17 @@ cpu_probe_base_features(struct cpu_info
ci->ci_vendor[1] = descs[3];
ci->ci_vendor[3] = 0;
- aprint_verbose("%s: highest basic info %08x\n", cpuname,
- ci->ci_cpuid_level);
- if (verbose) {
- int bf;
-
- for (bf = 0; bf <= ci->ci_cpuid_level; bf++) {
- x86_cpuid(bf, descs);
- printf("%s: %08x: %08x %08x %08x %08x\n", cpuname,
- bf, descs[0], descs[1], descs[2], descs[3]);
- }
- }
-
/*
* Fn8000_0000:
* - Get cpuid extended function's max level.
*/
x86_cpuid(0x80000000, descs);
- if (descs[0] >= 0x80000000) {
+ if (descs[0] >= 0x80000000)
ci->ci_cpuid_extlevel = descs[0];
- aprint_verbose("%s: highest extended info %08x\n", cpuname,
- ci->ci_cpuid_extlevel);
- } else {
+ else {
/* Set lower value than 0x80000000 */
ci->ci_cpuid_extlevel = 0;
}
- if (verbose) {
- unsigned int ef;
-
- for (ef = 0x80000000; ef <= ci->ci_cpuid_extlevel; ef++) {
- x86_cpuid(ef, descs);
- printf("%s: %08x: %08x %08x %08x %08x\n", cpuname,
- ef, descs[0], descs[1], descs[2], descs[3]);
- }
- }
/*
* Fn8000_000[2-4]:
@@ -1706,6 +1683,7 @@ identifycpu(int fd, const char *cpuname)
const struct cpu_cpuid_nameclass *cpup = NULL;
const struct cpu_cpuid_family *cpufam;
struct cpu_info *ci, cistore;
+ u_int descs[4];
size_t sz;
struct cpu_ucode_version ucode;
union {
@@ -1715,6 +1693,30 @@ identifycpu(int fd, const char *cpuname)
ci = &cistore;
cpu_probe_base_features(ci, cpuname);
+ aprint_verbose("%s: highest basic info %08x\n", cpuname,
+ ci->ci_cpuid_level);
+ if (verbose) {
+ int bf;
+
+ for (bf = 0; bf <= ci->ci_cpuid_level; bf++) {
+ x86_cpuid(bf, descs);
+ printf("%s: %08x: %08x %08x %08x %08x\n", cpuname,
+ bf, descs[0], descs[1], descs[2], descs[3]);
+ }
+ }
+ if (ci->ci_cpuid_extlevel >= 0x80000000)
+ aprint_verbose("%s: highest extended info %08x\n", cpuname,
+ ci->ci_cpuid_extlevel);
+ if (verbose) {
+ unsigned int ef;
+
+ for (ef = 0x80000000; ef <= ci->ci_cpuid_extlevel; ef++) {
+ x86_cpuid(ef, descs);
+ printf("%s: %08x: %08x %08x %08x %08x\n", cpuname,
+ ef, descs[0], descs[1], descs[2], descs[3]);
+ }
+ }
+
cpu_probe_hv_features(ci, cpuname);
cpu_probe_features(ci);