summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-12-23 12:28:12 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-12-23 12:28:12 +0000
commitb926997314d9f2a23f4e9e0ae4c7e33e94e996fa (patch)
tree8a5cf3f09c1fd29fae96545e469e8b452ba9a36c /sys/arch/sparc64
parentfaae9278bde601d9d87acbb5cf8490bfc1d252cc (diff)
On UltraSPARC-III, patch some crucial D-cache flush instructions, and
enable the cache. ok jason@, miod@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/cpu.c19
-rw-r--r--sys/arch/sparc64/sparc64/locore.s22
2 files changed, 28 insertions, 13 deletions
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c
index 5b7fdd1c659..4e5d82a093c 100644
--- a/sys/arch/sparc64/sparc64/cpu.c
+++ b/sys/arch/sparc64/sparc64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.14 2005/08/06 14:26:52 miod Exp $ */
+/* $OpenBSD: cpu.c,v 1.15 2006/12/23 12:28:11 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */
/*
@@ -261,6 +261,23 @@ cpu_attach(parent, dev, aux)
}
printf("\n");
cache_enable();
+
+ if (impl >= IMPL_CHEETAH) {
+ extern vaddr_t ktext, dlflush_start;
+ extern paddr_t ktextp;
+ vaddr_t *pva;
+ paddr_t pa;
+ u_int32_t inst;
+
+ for (pva = &dlflush_start; *pva; pva++) {
+ inst = *(u_int32_t *)(*pva);
+ inst &= ~(ASI_DCACHE_TAG << 5);
+ inst |= (ASI_DCACHE_INVALIDATE << 5);
+ pa = (paddr_t) (ktextp - ktext + *pva);
+ stwa(pa, ASI_PHYS_CACHED, inst);
+ flush((void *)KERNBASE);
+ }
+ }
}
/*
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index af6a7f4b946..73c151c9040 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.64 2006/12/12 20:15:13 kettenis Exp $ */
+/* $OpenBSD: locore.s,v 1.65 2006/12/23 12:28:11 kettenis Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -2195,6 +2195,7 @@ winfixsave:
1:
#if 1
/* Now we need to blast away the D$ to make sure we're in sync */
+dlflush1:
stxa %g0, [%g7] ASI_DCACHE_TAG
brnz,pt %g7, 1b
dec 8, %g7
@@ -4094,17 +4095,7 @@ dostart:
sethi %hi(_C_LABEL(nwindows)), %o1 ! may as well tell everyone
st %o0, [%o1 + %lo(_C_LABEL(nwindows))]
-#if defined(HORRID_III_HACK)
- /*
- * Check for UltraSPARC III
- */
- rdpr %ver, %g1
- srlx %g1, 32, %g1
- sll %g1, 16, %g1
- srl %g1, 16, %g1
- cmp %g1, 0x0014
- bl,pt %icc, 1f
- nop
+#if 0
/*
* Disable the DCACHE entirely for debug.
*/
@@ -4246,6 +4237,7 @@ _C_LABEL(cpu_initialize):
set (1<<14)-8, %o0 ! Clear out DCACHE
1:
+dlflush2:
stxa %g0, [%o0] ASI_DCACHE_TAG ! clear DCACHE line
membar #Sync
brnz,pt %o0, 1b
@@ -9621,3 +9613,9 @@ _C_LABEL(proc0paddr):
.comm _C_LABEL(trapdebug), 4
.comm _C_LABEL(pmapdebug), 4
#endif /* DEBUG */
+
+ .globl _C_LABEL(dlflush_start)
+_C_LABEL(dlflush_start):
+ .xword dlflush1
+ .xword dlflush2
+ .xword 0