Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64 add a sysctl.vis node that indicated which ...



details:   https://anonhg.NetBSD.org/src/rev/68ecc4f6506f
branches:  trunk
changeset: 784648:68ecc4f6506f
user:      macallan <macallan%NetBSD.org@localhost>
date:      Mon Feb 04 22:19:43 2013 +0000

description:
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

diffstat:

 sys/arch/sparc64/include/cpu.h     |   5 +++--
 sys/arch/sparc64/sparc64/machdep.c |  35 +++++++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 4 deletions(-)

diffs (82 lines):

diff -r b2c221f317a9 -r 68ecc4f6506f sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h    Mon Feb 04 21:46:14 2013 +0000
+++ b/sys/arch/sparc64/include/cpu.h    Mon Feb 04 22:19:43 2013 +0000
@@ -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)
 /*
diff -r b2c221f317a9 -r 68ecc4f6506f sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Mon Feb 04 21:46:14 2013 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Mon Feb 04 22:19:43 2013 +0000
@@ -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 @@
        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 @@
                       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 *



Home | Main Index | Thread Index | Old Index