summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-03-22 21:10:30 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-03-22 21:10:30 +0000
commit3c6f9968d7697098e3bb739e4db6c68987719be4 (patch)
treedc15340c663d8d7240b1d6d16347b75a0a9fe937 /sys/arch/sparc64
parent8bcea748342c762f9f9a5b2dbd961a3e4843ea04 (diff)
Reintroduce the cputyp variable, and use it to distinguish between sun4u and
sun4v.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/include/param.h13
-rw-r--r--sys/arch/sparc64/sparc64/autoconf.c11
-rw-r--r--sys/arch/sparc64/sparc64/genassym.cf5
-rw-r--r--sys/arch/sparc64/sparc64/locore.s11
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c4
5 files changed, 38 insertions, 6 deletions
diff --git a/sys/arch/sparc64/include/param.h b/sys/arch/sparc64/include/param.h
index 07e9d24c34e..77dddc430fc 100644
--- a/sys/arch/sparc64/include/param.h
+++ b/sys/arch/sparc64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.29 2007/10/27 22:20:16 martin Exp $ */
+/* $OpenBSD: param.h,v 1.30 2008/03/22 21:10:28 kettenis Exp $ */
/* $NetBSD: param.h,v 1.25 2001/05/30 12:28:51 mrg Exp $ */
/*
@@ -188,6 +188,16 @@
extern void delay(unsigned int);
#define DELAY(n) delay(n)
+extern int cputyp;
+
+#ifdef SUN4V
+#define CPU_ISSUN4V (cputyp == CPU_SUN4V)
+#define CPU_ISSUN4U (cputyp == CPU_SUN4U)
+#else
+#define CPU_ISSUN4V (0)
+#define CPU_ISSUN4U (1)
+#endif
+
#endif /* _LOCORE */
#endif /* _KERNEL */
@@ -198,6 +208,7 @@ extern void delay(unsigned int);
#define CPU_SUN4C 1
#define CPU_SUN4M 2
#define CPU_SUN4U 3
+#define CPU_SUN4V 4
/*
* On a sun4u machine, the page size is 8192.
diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c
index c28e66226a3..86550c9f9c2 100644
--- a/sys/arch/sparc64/sparc64/autoconf.c
+++ b/sys/arch/sparc64/sparc64/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.82 2008/03/17 23:10:21 kettenis Exp $ */
+/* $OpenBSD: autoconf.c,v 1.83 2008/03/22 21:10:28 kettenis Exp $ */
/* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */
/*
@@ -254,6 +254,9 @@ bootstrap(nctx)
int nctx;
{
extern int end; /* End of kernel */
+#ifdef SUN4V
+ char buf[32];
+#endif
int ncpus;
/* Initialize the PROM console so printf will not panic. */
@@ -275,6 +278,12 @@ bootstrap(nctx)
OF_set_symbol_lookup(OF_sym2val, OF_val2sym);
#endif
+#ifdef SUN4V
+ if (OF_getprop(findroot(), "compatible", buf, sizeof(buf)) > 0 &&
+ strcmp(buf, "sun4v") == 0)
+ cputyp = CPU_SUN4V;
+#endif
+
ncpus = get_ncpus();
pmap_bootstrap(KERNBASE, (u_long)&end, nctx, ncpus);
}
diff --git a/sys/arch/sparc64/sparc64/genassym.cf b/sys/arch/sparc64/sparc64/genassym.cf
index bc83da2fe83..ec7e419cdb7 100644
--- a/sys/arch/sparc64/sparc64/genassym.cf
+++ b/sys/arch/sparc64/sparc64/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.27 2008/03/12 20:52:36 kettenis Exp $
+# $OpenBSD: genassym.cf,v 1.28 2008/03/22 21:10:29 kettenis Exp $
# $NetBSD: genassym.cf,v 1.23 2001/08/08 00:09:30 eeh Exp $
#
@@ -284,3 +284,6 @@ struct mutex
member mtx_wantipl
member mtx_oldipl
member mtx_owner
+
+export CPU_SUN4U
+export CPU_SUN4V
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 522cc0e9e19..84ddad3e9d1 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.123 2008/03/22 17:15:42 kettenis Exp $ */
+/* $OpenBSD: locore.s,v 1.124 2008/03/22 21:10:29 kettenis Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -304,6 +304,15 @@ panicstack:
.globl romp
romp: .xword 0
+/*
+ * cputyp is the current cpu type, used to distinguish between
+ * the many variations of different sun4* machines. It contains
+ * the value CPU_SUN4U or CPU_SUN4V.
+ */
+ .globl _C_LABEL(cputyp)
+_C_LABEL(cputyp):
+ .word CPU_SUN4U
+
.globl _C_LABEL(cold)
_C_LABEL(cold):
.word 1
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index e4a8665d455..b0623d98bc2 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.105 2008/01/04 00:40:38 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.106 2008/03/22 21:10:29 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -465,7 +465,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_rdint(oldp, oldlenp, newp, 0));
#endif
case CPU_CPUTYPE:
- return (sysctl_rdint(oldp, oldlenp, newp, CPU_SUN4U));
+ return (sysctl_rdint(oldp, oldlenp, newp, cputyp));
case CPU_CECCERRORS:
return (sysctl_rdint(oldp, oldlenp, newp, ceccerrs));
case CPU_CECCLAST: