summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc/sparc/cache.c44
-rw-r--r--sys/arch/sparc/sparc/cache.h13
-rw-r--r--sys/arch/sparc/sparc/cpu.c22
-rw-r--r--sys/arch/sparc/sparc/cpuvar.h6
-rw-r--r--sys/arch/sparc/sparc/locore.s10
5 files changed, 89 insertions, 6 deletions
diff --git a/sys/arch/sparc/sparc/cache.c b/sys/arch/sparc/sparc/cache.c
index baf46bae8c9..98d6a1505fc 100644
--- a/sys/arch/sparc/sparc/cache.c
+++ b/sys/arch/sparc/sparc/cache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cache.c,v 1.9 1999/07/20 11:07:09 art Exp $ */
+/* $OpenBSD: cache.c,v 1.10 2000/02/19 21:45:55 art Exp $ */
/* $NetBSD: cache.c,v 1.34 1997/09/26 22:17:23 pk Exp $ */
/*
@@ -615,6 +615,12 @@ srmmu_vcache_flush_page(va)
sta(p, ASI_IDCACHELFP, 0);
}
+void
+srmmu_cache_flush_all()
+{
+ srmmu_vcache_flush_context();
+}
+
/*
* Flush a range of virtual addresses (in the current context).
* The first byte is at (base&~PGOFSET) and the last one is just
@@ -697,6 +703,42 @@ ms1_cache_flush(base, len)
sta(0, ASI_DCACHECLR, 0);
}
+/*
+ * Flush entire cache.
+ */
+void
+ms1_cache_flush_all()
+{
+
+ /* Flash-clear both caches */
+ sta(0, ASI_ICACHECLR, 0);
+ sta(0, ASI_DCACHECLR, 0);
+}
+
+void
+hypersparc_cache_flush_all()
+{
+
+ srmmu_vcache_flush_context();
+ /* Flush instruction cache */
+ hypersparc_pure_vcache_flush();
+}
+
+void
+cypress_cache_flush_all()
+{
+ extern char kernel_text[];
+ char *p;
+ int i, ls;
+
+ /* Fill the cache with known read-only content */
+ p = (char *)kernel_text;
+ ls = CACHEINFO.c_linesize;
+ i = CACHEINFO.c_totalsize >> CACHEINFO.c_l2linesize;
+ for (; --i >= 0; p += ls)
+ (*(volatile char *)p);
+}
+
void
viking_cache_flush(base, len)
caddr_t base;
diff --git a/sys/arch/sparc/sparc/cache.h b/sys/arch/sparc/sparc/cache.h
index 1eef90e5d67..58b7ef7f743 100644
--- a/sys/arch/sparc/sparc/cache.h
+++ b/sys/arch/sparc/sparc/cache.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cache.h,v 1.3 1997/08/08 08:27:04 downsj Exp $ */
+/* $OpenBSD: cache.h,v 1.4 2000/02/19 21:45:56 art Exp $ */
/* $NetBSD: cache.h,v 1.16 1997/07/06 21:15:14 pk Exp $ */
/*
@@ -169,6 +169,12 @@ void srmmu_vcache_flush_region __P((int)); /* flush region in cur ctx */
void srmmu_vcache_flush_segment __P((int, int));/* flush seg in cur ctx */
void srmmu_vcache_flush_page __P((int va)); /* flush page in cur ctx */
void srmmu_cache_flush __P((caddr_t, u_int));/* flush region */
+void hypersparc_pure_vcache_flush __P((void));
+
+void ms1_cache_flush_all __P((void));
+void srmmu_cache_flush_all __P((void));
+void cypress_cache_flush_all __P((void));
+void hypersparc_cache_flush_all __P((void));
void ms1_cache_flush __P((caddr_t, u_int));
void viking_cache_flush __P((caddr_t, u_int));
@@ -189,7 +195,10 @@ extern void sparc_noop __P((void));
(void (*)__P((caddr_t, u_int))) sparc_noop
#define noop_pcache_flush_line \
(void (*)__P((int, int))) sparc_noop
-
+#define noop_pure_vcache_flush \
+ (void (*)__P((void))) sparc_noop
+#define noop_cache_flush_all \
+ (void (*)__P((void))) sparc_noop
#define cache_flush_page(va) cpuinfo.vcache_flush_page(va)
#define cache_flush_segment(vr,vs) cpuinfo.vcache_flush_segment(vr,vs)
diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c
index ff6f5317b74..cd4de969103 100644
--- a/sys/arch/sparc/sparc/cpu.c
+++ b/sys/arch/sparc/sparc/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.23 2000/02/18 18:57:14 art Exp $ */
+/* $OpenBSD: cpu.c,v 1.24 2000/02/19 21:45:56 art Exp $ */
/* $NetBSD: cpu.c,v 1.56 1997/09/15 20:52:36 pk Exp $ */
/*
@@ -425,6 +425,8 @@ struct module_info module_sun4 = {
sun4_vcache_flush_region,
sun4_vcache_flush_context,
noop_pcache_flush_line,
+ noop_pure_vcache_flush,
+ noop_cache_flush_all,
0
};
@@ -548,6 +550,8 @@ struct module_info module_sun4c = {
sun4_vcache_flush_region,
sun4_vcache_flush_context,
noop_pcache_flush_line,
+ noop_pure_vcache_flush,
+ noop_cache_flush_all,
0
};
@@ -743,6 +747,8 @@ struct module_info module_ms1 = {
noop_vcache_flush_region,
noop_vcache_flush_context,
noop_pcache_flush_line,
+ noop_pure_vcache_flush,
+ ms1_cache_flush_all,
memerr4m
};
@@ -768,6 +774,8 @@ struct module_info module_ms2 = { /* UNTESTED */
srmmu_vcache_flush_region,
srmmu_vcache_flush_context,
noop_pcache_flush_line,
+ noop_pure_vcache_flush,
+ srmmu_cache_flush_all,
memerr4m
};
@@ -788,6 +796,8 @@ struct module_info module_swift = { /* UNTESTED */
srmmu_vcache_flush_region,
srmmu_vcache_flush_context,
srmmu_pcache_flush_line,
+ noop_pure_vcache_flush,
+ srmmu_cache_flush_all,
memerr4m
};
@@ -833,6 +843,8 @@ struct module_info module_viking = { /* UNTESTED */
noop_vcache_flush_region,
noop_vcache_flush_context,
viking_pcache_flush_line,
+ noop_pure_vcache_flush,
+ noop_cache_flush_all,
viking_memerr
};
@@ -913,6 +925,8 @@ struct module_info module_hypersparc = { /* UNTESTED */
srmmu_vcache_flush_region,
srmmu_vcache_flush_context,
srmmu_pcache_flush_line,
+ hypersparc_pure_vcache_flush,
+ hypersparc_cache_flush_all,
hypersparc_memerr
};
@@ -959,6 +973,8 @@ struct module_info module_cypress = { /* UNTESTED */
srmmu_vcache_flush_region,
srmmu_vcache_flush_context,
srmmu_pcache_flush_line,
+ noop_pure_vcache_flush,
+ cypress_cache_flush_all,
memerr4m
};
@@ -979,6 +995,8 @@ struct module_info module_turbosparc = { /* UNTESTED */
srmmu_vcache_flush_region,
srmmu_vcache_flush_context,
srmmu_pcache_flush_line,
+ noop_pure_vcache_flush,
+ srmmu_cache_flush_all,
memerr4m
};
@@ -1201,6 +1219,8 @@ getcpuinfo(sc, node)
MPCOPY(vcache_flush_region);
MPCOPY(vcache_flush_context);
MPCOPY(pcache_flush_line);
+ MPCOPY(pure_vcache_flush);
+ MPCOPY(cache_flush_all);
MPCOPY(memerr);
#undef MPCOPY
return;
diff --git a/sys/arch/sparc/sparc/cpuvar.h b/sys/arch/sparc/sparc/cpuvar.h
index 8f3e436b0d8..6585ddec3b9 100644
--- a/sys/arch/sparc/sparc/cpuvar.h
+++ b/sys/arch/sparc/sparc/cpuvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpuvar.h,v 1.2 2000/01/31 16:06:58 art Exp $ */
+/* $OpenBSD: cpuvar.h,v 1.3 2000/02/19 21:45:56 art Exp $ */
/* $NetBSD: cpuvar.h,v 1.4 1997/07/06 21:14:25 pk Exp $ */
/*
@@ -70,6 +70,8 @@ struct module_info {
void (*vcache_flush_region) __P((int));
void (*vcache_flush_context) __P((void));
void (*pcache_flush_line) __P((int, int));
+ void (*pure_vcache_flush) __P((void));
+ void (*cache_flush_all)__P((void));
void (*memerr) __P((unsigned, u_int, u_int, u_int, u_int,
struct trapframe *));
};
@@ -175,6 +177,8 @@ struct cpu_softc {
void (*vcache_flush_region)__P((int));
void (*vcache_flush_context)__P((void));
void (*pcache_flush_line)__P((int, int));
+ void (*pure_vcache_flush) __P((void));
+ void (*cache_flush_all)__P((void));
#ifdef SUN4M
/* hardware-assisted block operation routines */
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s
index 4f34f686cb1..a3d722c790c 100644
--- a/sys/arch/sparc/sparc/locore.s
+++ b/sys/arch/sparc/sparc/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.31 2000/02/18 18:57:13 art Exp $ */
+/* $OpenBSD: locore.s,v 1.32 2000/02/19 21:45:56 art Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */
/*
@@ -5828,6 +5828,14 @@ ALTENTRY(hypersparc_get_fltstatus)
retl
lda [%o4] ASI_SRMMU, %o4 ! get async fault address
+ALTENTRY(hypersparc_pure_vcache_flush)
+ /*
+ * Flush entire on-chip instruction cache, which is
+ * a pure vitually-indexed/virtually-tagged cache.
+ */
+ retl
+ sta %g0, [%g0] ASI_HICACHECLR
+
#endif /* SUN4M */
/*