summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2016-05-07 22:46:55 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2016-05-07 22:46:55 +0000
commit10eb8d43895504cd22def3c6f7ec6598f8c467b2 (patch)
tree0df915e840ffa5870bddc1ef69c952704bfc506b /sys/arch
parent650facc722a5d25a565fc27ea364e14296322daa (diff)
Flush page (through the direct map) before mapping it into AGP. Fixes
artifacts seen in X on some G5 machines. Unfortunately not enough to fix G4 machines. With help from Marcus Glocker. ok mpi@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/include/cpu.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h
index 8efe02d895b..494dccb3b1a 100644
--- a/sys/arch/powerpc/include/cpu.h
+++ b/sys/arch/powerpc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.62 2015/07/02 01:33:59 dlg Exp $ */
+/* $OpenBSD: cpu.h,v 1.63 2016/05/07 22:46:54 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
@@ -232,6 +232,22 @@ invdcache(void *from, int len)
__asm volatile ("sync");
}
+static __inline void
+flushdcache(void *from, int len)
+{
+ int l;
+ char *p = from;
+
+ len = len + (((u_int32_t) from) & (CACHELINESIZE - 1));
+ l = len;
+
+ do {
+ __asm volatile ("dcbf 0,%0" :: "r"(p));
+ p += CACHELINESIZE;
+ } while ((l -= CACHELINESIZE) > 0);
+ __asm volatile ("sync");
+}
+
#define FUNC_SPR(n, name) \
static __inline u_int32_t ppc_mf ## name (void) \
{ \