Module Name:    src
Committed By:   phx
Date:           Sun Jan 31 19:56:19 UTC 2010

Modified Files:
        src/sys/arch/amiga/dev: grf_cv.c grf_cvreg.h

Log Message:
Fixed for amigappc by executing eieio after writing to a vga register.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amiga/dev/grf_cv.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amiga/dev/grf_cvreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/dev/grf_cv.c
diff -u src/sys/arch/amiga/dev/grf_cv.c:1.49 src/sys/arch/amiga/dev/grf_cv.c:1.50
--- src/sys/arch/amiga/dev/grf_cv.c:1.49	Sat Jan 30 16:49:14 2010
+++ src/sys/arch/amiga/dev/grf_cv.c	Sun Jan 31 19:56:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cv.c,v 1.49 2010/01/30 16:49:14 phx Exp $ */
+/*	$NetBSD: grf_cv.c,v 1.50 2010/01/31 19:56:19 phx Exp $ */
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.49 2010/01/30 16:49:14 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.50 2010/01/31 19:56:19 phx Exp $");
 
 #include "grfcv.h"
 #if NGRFCV > 0
@@ -68,16 +68,6 @@
 #include <amiga/dev/grf_cvreg.h>
 #include <amiga/dev/zbusvar.h>
 
-/*
- * finish all bus operations, flush pipelines
- * XXX is this really needed?
- */
-#if defined(__m68k__)
-#define cpu_sync() __asm volatile ("nop")
-#elif defined(__powerpc__)
-#define cpu_sync() __asm volatile ("sync; isync")
-#endif
-
 int	grfcvmatch(struct device *, struct cfdata *, void *);
 void	grfcvattach(struct device *, struct device *, void *);
 int	grfcvprint(void *, const char *);

Index: src/sys/arch/amiga/dev/grf_cvreg.h
diff -u src/sys/arch/amiga/dev/grf_cvreg.h:1.13 src/sys/arch/amiga/dev/grf_cvreg.h:1.14
--- src/sys/arch/amiga/dev/grf_cvreg.h:1.13	Thu Dec 18 05:04:22 2008
+++ src/sys/arch/amiga/dev/grf_cvreg.h	Sun Jan 31 19:56:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cvreg.h,v 1.13 2008/12/18 05:04:22 mhitch Exp $	*/
+/*	$NetBSD: grf_cvreg.h,v 1.14 2010/01/31 19:56:19 phx Exp $	*/
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -59,12 +59,25 @@
 #define MAXROWS 200
 #define MAXCOLS 200
 
+/*
+ * macros for
+ * finishing all bus operations and flush pipelines: cpu_sync()
+ * barrier to ensure in order execution: barrier()
+ */
+#if defined(__m68k__)
+#define cpu_sync() __asm volatile ("nop")
+#define barrier()
+#elif defined(__powerpc__)
+#define cpu_sync() __asm volatile ("sync; isync")
+#define barrier() __asm volatile ("eieio")
+#endif
+
 /* read VGA register */
 #define vgar(ba, reg) (*(((volatile char *)ba)+reg))
 
 /* write VGA register */
 #define vgaw(ba, reg, val) \
-	*(((volatile char *)ba)+reg) = ((val) & 0xff)
+	*(((volatile char *)ba)+reg) = ((val) & 0xff); barrier()
 
 
 /* read 32 Bit VGA register */
@@ -73,7 +86,7 @@
 
 /* write 32 Bit VGA register */
 #define vgaw32(ba, reg, val) \
-	*((unsigned long *)  (((volatile char *)ba)+reg)) = val
+	*((unsigned long *)  (((volatile char *)ba)+reg)) = val; barrier()
 
 /* read 16 Bit VGA register */
 #define vgar16(ba, reg) \
@@ -81,7 +94,7 @@
 
 /* write 16 Bit VGA register */
 #define vgaw16(ba, reg, val) \
-	*((volatile unsigned short *)  (((volatile char *)ba)+reg)) = val
+	*((volatile unsigned short *) (((volatile char *)ba)+reg)) = val; barrier()
 
 #ifdef _KERNEL
 int grfcv_cnprobe(void);
@@ -374,7 +387,7 @@
 
 	do {
 		test = vgar16 (ba, ECR_GP_STAT);
-		__asm volatile ("nop");
+		cpu_sync();
 	} while (test & (1 << 9));
 }
 

Reply via email to