Module Name: src
Committed By: martin
Date: Sun Mar 6 17:53:27 UTC 2016
Modified Files:
src/sys/arch/x86/include [netbsd-7]: cpu.h cpuvar.h
src/sys/arch/x86/x86 [netbsd-7]: cpu.c identcpu.c
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1118):
sys/arch/x86/include/cpuvar.h: revision 1.47
sys/arch/x86/x86/cpu.c: revision 1.117
sys/arch/x86/x86/identcpu.c: revision 1.49
sys/arch/x86/include/cpu.h: revision 1.67
Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.
To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.66.4.1 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.46 -r1.46.14.1 src/sys/arch/x86/include/cpuvar.h
cvs rdiff -u -r1.111.2.2 -r1.111.2.3 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.45.2.1 -r1.45.2.2 src/sys/arch/x86/x86/identcpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.66 src/sys/arch/x86/include/cpu.h:1.66.4.1
--- src/sys/arch/x86/include/cpu.h:1.66 Sun Feb 23 22:38:40 2014
+++ src/sys/arch/x86/include/cpu.h Sun Mar 6 17:53:26 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.66 2014/02/23 22:38:40 dsl Exp $ */
+/* $NetBSD: cpu.h,v 1.66.4.1 2016/03/06 17:53:26 martin Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -157,12 +157,14 @@ struct cpu_info {
uint32_t ci_max_ext_cpuid; /* cpuid.80000000:%eax */
volatile uint32_t ci_lapic_counter;
- uint32_t ci_feat_val[5]; /* X86 CPUID feature bits */
+ uint32_t ci_feat_val[7]; /* X86 CPUID feature bits */
/* [0] basic features cpuid.1:%edx
* [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
* [2] extended features cpuid:80000001:%edx
* [3] extended features cpuid:80000001:%ecx
* [4] VIA padlock features
+ * [5] structured extended features cpuid.7:%ebx
+ * [6] structured extended features cpuid.7:%ecx
*/
const struct cpu_functions *ci_func; /* start/stop functions */
Index: src/sys/arch/x86/include/cpuvar.h
diff -u src/sys/arch/x86/include/cpuvar.h:1.46 src/sys/arch/x86/include/cpuvar.h:1.46.14.1
--- src/sys/arch/x86/include/cpuvar.h:1.46 Fri Apr 20 22:23:24 2012
+++ src/sys/arch/x86/include/cpuvar.h Sun Mar 6 17:53:26 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuvar.h,v 1.46 2012/04/20 22:23:24 rmind Exp $ */
+/* $NetBSD: cpuvar.h,v 1.46.14.1 2016/03/06 17:53:26 martin Exp $ */
/*-
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@ void pat_init(struct cpu_info *);
extern int cpu_vendor;
extern bool x86_mp_online;
-extern uint32_t cpu_feature[5];
+extern uint32_t cpu_feature[7];
#endif /* _KERNEL */
Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.111.2.2 src/sys/arch/x86/x86/cpu.c:1.111.2.3
--- src/sys/arch/x86/x86/cpu.c:1.111.2.2 Fri Nov 6 00:40:02 2015
+++ src/sys/arch/x86/x86/cpu.c Sun Mar 6 17:53:26 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.111.2.2 2015/11/06 00:40:02 riz Exp $ */
+/* $NetBSD: cpu.c,v 1.111.2.3 2016/03/06 17:53:26 martin Exp $ */
/*-
* Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.2 2015/11/06 00:40:02 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.3 2016/03/06 17:53:26 martin Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@@ -177,13 +177,15 @@ static void tss_init(struct i386tss *, v
static void cpu_init_idle_lwp(struct cpu_info *);
-uint32_t cpu_feature[5]; /* X86 CPUID feature bits
- * [0] basic features %edx
- * [1] basic features %ecx
- * [2] extended features %edx
- * [3] extended features %ecx
- * [4] VIA padlock features
- */
+uint32_t cpu_feature[7]; /* X86 CPUID feature bits */
+ /* [0] basic features cpuid.1:%edx
+ * [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
+ * [2] extended features cpuid:80000001:%edx
+ * [3] extended features cpuid:80000001:%ecx
+ * [4] VIA padlock features
+ * [5] structured extended features cpuid.7:%ebx
+ * [6] structured extended features cpuid.7:%ecx
+ */
extern char x86_64_doubleflt_stack[];
@@ -784,7 +786,7 @@ cpu_boot_secondary(struct cpu_info *ci)
}
/*
- * The CPU ends up here when its ready to run
+ * The CPU ends up here when it's ready to run.
* This is called from code in mptramp.s; at this point, we are running
* in the idle pcb/idle stack of the new CPU. When this function returns,
* this processor will enter the idle loop and start looking for work.
Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.45.2.1 src/sys/arch/x86/x86/identcpu.c:1.45.2.2
--- src/sys/arch/x86/x86/identcpu.c:1.45.2.1 Thu Oct 30 18:58:45 2014
+++ src/sys/arch/x86/x86/identcpu.c Sun Mar 6 17:53:26 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: identcpu.c,v 1.45.2.1 2014/10/30 18:58:45 martin Exp $ */
+/* $NetBSD: identcpu.c,v 1.45.2.2 2016/03/06 17:53:26 martin Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.45.2.1 2014/10/30 18:58:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.45.2.2 2016/03/06 17:53:26 martin Exp $");
#include "opt_xen.h"
@@ -858,6 +858,15 @@ cpu_probe(struct cpu_info *ci)
memcpy(cpu_brand_string, ((char *) brand) + i, 48 - i);
}
+ /*
+ * Get the structured extended features.
+ */
+ if (cpuid_level >= 7) {
+ x86_cpuid(7, descs);
+ ci->ci_feat_val[5] = descs[1]; /* %ebx */
+ ci->ci_feat_val[6] = descs[2]; /* %ecx */
+ }
+
cpu_probe_intel(ci);
cpu_probe_k5(ci);
cpu_probe_k678(ci);