summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-05-21 19:23:16 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-05-21 19:23:16 +0000
commit05e301b5904460d65558cad0636d46a26624dcd9 (patch)
tree0767f01689571b9da46f2603da4a038bbbf74fcb
parentee3c57e97e26e0f2f5154a46c04f5ed9fd8b3c2f (diff)
First step towards supporting sun4us machines with Fujitsu's SPARC64-V CPU.
-rw-r--r--sys/arch/sparc64/conf/GENERIC3
-rw-r--r--sys/arch/sparc64/conf/RAMDISK3
-rw-r--r--sys/arch/sparc64/include/param.h13
-rw-r--r--sys/arch/sparc64/sparc64/autoconf.c31
-rw-r--r--sys/arch/sparc64/sparc64/cpu.c6
-rw-r--r--sys/arch/sparc64/sparc64/pmap.c6
6 files changed, 38 insertions, 24 deletions
diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC
index 645e6b9a45f..b6a7c04ce0f 100644
--- a/sys/arch/sparc64/conf/GENERIC
+++ b/sys/arch/sparc64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.201 2008/05/14 18:47:10 brad Exp $
+# $OpenBSD: GENERIC,v 1.202 2008/05/21 19:23:14 kettenis Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -13,6 +13,7 @@ machine sparc64
include "../../../conf/GENERIC"
maxusers 64 # estimated number of users
+option SUN4US
option SUN4V
option PCIVERBOSE
diff --git a/sys/arch/sparc64/conf/RAMDISK b/sys/arch/sparc64/conf/RAMDISK
index b03a9ee12c3..8881a01eeb5 100644
--- a/sys/arch/sparc64/conf/RAMDISK
+++ b/sys/arch/sparc64/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.70 2008/04/02 22:32:43 kettenis Exp $
+# $OpenBSD: RAMDISK,v 1.71 2008/05/21 19:23:15 kettenis Exp $
# Machine architecture; required by config(8)
machine sparc64
@@ -9,6 +9,7 @@ maxusers 2
option RAMDISK_HOOKS
option MINIROOTSIZE=6144
+option SUN4US
option SUN4V
option PCIVERBOSE
diff --git a/sys/arch/sparc64/include/param.h b/sys/arch/sparc64/include/param.h
index 77dddc430fc..064eccfbaff 100644
--- a/sys/arch/sparc64/include/param.h
+++ b/sys/arch/sparc64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.30 2008/03/22 21:10:28 kettenis Exp $ */
+/* $OpenBSD: param.h,v 1.31 2008/05/21 19:23:15 kettenis Exp $ */
/* $NetBSD: param.h,v 1.25 2001/05/30 12:28:51 mrg Exp $ */
/*
@@ -190,12 +190,14 @@ extern void delay(unsigned int);
extern int cputyp;
-#ifdef SUN4V
-#define CPU_ISSUN4V (cputyp == CPU_SUN4V)
+#if defined (SUN4US) || defined (SUN4V)
#define CPU_ISSUN4U (cputyp == CPU_SUN4U)
+#define CPU_ISSUN4US (cputyp == CPU_SUN4US)
+#define CPU_ISSUN4V (cputyp == CPU_SUN4V)
#else
-#define CPU_ISSUN4V (0)
#define CPU_ISSUN4U (1)
+#define CPU_ISSUN4US (0)
+#define CPU_ISSUN4V (0)
#endif
#endif /* _LOCORE */
@@ -208,7 +210,8 @@ extern int cputyp;
#define CPU_SUN4C 1
#define CPU_SUN4M 2
#define CPU_SUN4U 3
-#define CPU_SUN4V 4
+#define CPU_SUN4US 4
+#define CPU_SUN4V 5
/*
* 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 8e8a065ed4d..57ef3792583 100644
--- a/sys/arch/sparc64/sparc64/autoconf.c
+++ b/sys/arch/sparc64/sparc64/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.87 2008/04/14 21:04:56 kettenis Exp $ */
+/* $OpenBSD: autoconf.c,v 1.88 2008/05/21 19:23:15 kettenis Exp $ */
/* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */
/*
@@ -256,7 +256,7 @@ bootstrap(nctx)
int nctx;
{
extern int end; /* End of kernel */
-#ifdef SUN4V
+#if defined(SUN4US) || defined(SUN4V)
char buf[32];
#endif
int ncpus;
@@ -280,24 +280,34 @@ 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;
+#if defined (SUN4US) || defined(SUN4V)
+ if (OF_getprop(findroot(), "compatible", buf, sizeof(buf)) > 0) {
+ if (strcmp(buf, "sun4us") == 0)
+ cputyp = CPU_SUN4US;
+ if (strcmp(buf, "sun4v") == 0)
+ cputyp = CPU_SUN4V;
+}
#endif
-#ifdef SUN4V
- if (CPU_ISSUN4V) {
+#if defined (SUN4US) || defined(SUN4V)
+ if (CPU_ISSUN4US || CPU_ISSUN4V) {
extern vaddr_t dlflush_start;
vaddr_t *pva;
- u_int32_t insn;
- int32_t disp;
for (pva = &dlflush_start; *pva; pva++) {
*(u_int32_t *)(*pva) = 0x01000000; /* nop */
flush((void *)(*pva));
}
+ cacheinfo.c_dcache_flush_page = no_dcache_flush_page;
+ }
+#endif
+
+#ifdef SUN4V
+ if (CPU_ISSUN4V) {
+ u_int32_t insn;
+ int32_t disp;
+
disp = (vaddr_t)hv_mmu_demap_page - (vaddr_t)sp_tlb_flush_pte;
insn = 0x10800000 | disp >> 2; /* ba hv_mmu_demap_page */
((u_int32_t *)sp_tlb_flush_pte)[0] = insn;
@@ -335,7 +345,6 @@ bootstrap(nctx)
#endif
}
- cacheinfo.c_dcache_flush_page = no_dcache_flush_page;
}
#endif
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c
index 3191483e933..a497f47112c 100644
--- a/sys/arch/sparc64/sparc64/cpu.c
+++ b/sys/arch/sparc64/sparc64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.37 2008/03/24 11:49:25 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.38 2008/05/21 19:23:15 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */
/*
@@ -233,7 +233,7 @@ cpu_attach(parent, dev, aux)
u_int64_t ver = 0;
extern u_int64_t cpu_clockrate[];
- if (CPU_ISSUN4U)
+ if (CPU_ISSUN4U || CPU_ISSUN4US)
ver = getver();
impl = IU_IMPL(ver);
vers = IU_VERS(ver);
@@ -404,7 +404,7 @@ cpu_init(struct cpu_info *ci)
paddr_t pa = ci->ci_paddr;
int err;
- if (CPU_ISSUN4U)
+ if (CPU_ISSUN4U || CPU_ISSUN4US)
return;
#define MONDO_QUEUE_SIZE 32
diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c
index b4ebb568355..835430c0028 100644
--- a/sys/arch/sparc64/sparc64/pmap.c
+++ b/sys/arch/sparc64/sparc64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.59 2008/04/03 23:10:25 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.60 2008/05/21 19:23:15 kettenis Exp $ */
/* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
/*
@@ -1318,7 +1318,7 @@ remap_data:
BDPRINTF(PDB_BOOT1, ("Inserting PROM mappings into pmap_kernel()\r\n"));
data = 0;
- if (CPU_ISSUN4U)
+ if (CPU_ISSUN4U || CPU_ISSUN4US)
data = SUN4U_TLB_EXEC;
for (i = 0; i < prom_map_size; i++)
if (prom_map[i].vstart && ((prom_map[i].vstart>>32) == 0))
@@ -3535,7 +3535,7 @@ pmap_page_cache(pm, pa, mode)
pv_entry_t pv;
int s;
- if (CPU_ISSUN4V)
+ if (CPU_ISSUN4US || CPU_ISSUN4V)
return;
#ifdef DEBUG