Module Name: src
Committed By: macallan
Date: Mon Feb 4 22:19:43 UTC 2013
Modified Files:
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/sparc64/sparc64: machdep.c
Log Message:
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up
To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.271 -r1.272 src/sys/arch/sparc64/sparc64/machdep.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/sparc64/include/cpu.h
diff -u src/sys/arch/sparc64/include/cpu.h:1.100 src/sys/arch/sparc64/include/cpu.h:1.101
--- src/sys/arch/sparc64/include/cpu.h:1.100 Fri Nov 9 10:05:59 2012
+++ src/sys/arch/sparc64/include/cpu.h Mon Feb 4 22:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.100 2012/11/09 10:05:59 nakayama Exp $ */
+/* $NetBSD: cpu.h,v 1.101 2013/02/04 22:19:43 macallan Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -50,7 +50,8 @@
#define CPU_BOOTED_DEVICE 2 /* string: device booted from */
#define CPU_BOOT_ARGS 3 /* string: args booted with */
#define CPU_ARCH 4 /* integer: cpu architecture version */
-#define CPU_MAXID 5 /* number of valid machdep ids */
+#define CPU_VIS 5 /* 0 - no VIS, 1 - VIS 1.0, etc. */
+#define CPU_MAXID 6 /* number of valid machdep ids */
#if defined(_KERNEL) || defined(_KMEMUSER)
/*
Index: src/sys/arch/sparc64/sparc64/machdep.c
diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.271 src/sys/arch/sparc64/sparc64/machdep.c:1.272
--- src/sys/arch/sparc64/sparc64/machdep.c:1.271 Sat Dec 8 11:43:27 2012
+++ src/sys/arch/sparc64/sparc64/machdep.c Mon Feb 4 22:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.271 2012/12/08 11:43:27 kiyohara Exp $ */
+/* $NetBSD: machdep.c,v 1.272 2013/02/04 22:19:43 macallan Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.271 2012/12/08 11:43:27 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.272 2013/02/04 22:19:43 macallan Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -395,6 +395,32 @@ sysctl_machdep_boot(SYSCTLFN_ARGS)
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
}
+/*
+ * figure out which VIS version the CPU supports
+ * this assumes all CPUs in the system are the same
+ */
+static int
+get_vis(void)
+{
+ int vis = 0;
+
+ if (GETVER_CPU_MANUF() == MANUF_FUJITSU) {
+ /* as far as I can tell SPARC64-III and up have VIS 1.0 */
+ if (GETVER_CPU_IMPL() >= IMPL_SPARC64_III) {
+ vis = 1;
+ }
+ /* XXX - which, if any, SPARC64 support VIS 2.0? */
+ } else {
+ /* this better be Sun */
+ vis = 1; /* all UltraSPARCs support at least VIS 1.0 */
+ if (CPU_IS_USIII_UP()) {
+ vis = 2;
+ }
+ /* UltraSPARC T4 supports VIS 3.0 */
+ }
+ return vis;
+}
+
SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
{
@@ -424,6 +450,11 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
CTLTYPE_INT, "cpu_arch", NULL,
NULL, 9, NULL, 0,
CTL_MACHDEP, CPU_ARCH, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_INT, "vis", NULL,
+ NULL, get_vis(), NULL, 0,
+ CTL_MACHDEP, CPU_VIS, CTL_EOL);
}
void *