summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/dev/grf_ul.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-30 08:22:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-30 08:22:47 +0000
commiteff8e624a5ebaf739619318313065de8f3e71723 (patch)
tree8d0ca371d5816cc8489d32cbccd4de7fa94404e0 /sys/arch/amiga/dev/grf_ul.c
parent97c2d55ac39ce30a998e77483b2f9815f28167a8 (diff)
from netbsd:
fix initialization (pr#1853) from Ignatios Souvatzis add support for GRFIOCBLANK (pr#1810) from Ignatios Souvatzis rename grf_ul.gsp
Diffstat (limited to 'sys/arch/amiga/dev/grf_ul.c')
-rw-r--r--sys/arch/amiga/dev/grf_ul.c76
1 files changed, 68 insertions, 8 deletions
diff --git a/sys/arch/amiga/dev/grf_ul.c b/sys/arch/amiga/dev/grf_ul.c
index 6e6c36401d7..919c074946f 100644
--- a/sys/arch/amiga/dev/grf_ul.c
+++ b/sys/arch/amiga/dev/grf_ul.c
@@ -1,4 +1,4 @@
-/* $NetBSD: grf_ul.c,v 1.7.2.1 1995/11/10 19:29:54 chopps Exp $ */
+/* $NetBSD: grf_ul.c,v 1.10 1995/12/27 07:24:27 chopps Exp $ */
#define UL_DEBUG
/*
@@ -59,6 +59,7 @@ int ul_ioctl __P((struct grf_softc *, u_long, void *, dev_t));
int ul_getcmap __P((struct grf_softc *, struct grf_colormap *, dev_t));
int ul_putcmap __P((struct grf_softc *, struct grf_colormap *, dev_t));
int ul_bitblt __P((struct grf_softc *, struct grf_bitblt *, dev_t));
+int ul_blank __P((struct grf_softc *, int *, dev_t));
/*
* marked true early so that ulowell_cnprobe() can tell if we are alive.
@@ -273,10 +274,7 @@ ul_load_code(gp)
/* font info was uploaded in ite_ul.c(ite_ulinit). */
- /* unflush cache, unhalt cpu -> nmi starts to run */
- ba->ctrl &= ~(HLT|CF);
-
-#if 0
+#if 1
/* XXX load image palette with some initial values, slightly hacky */
ba->hstadrh = 0xfe80;
@@ -293,17 +291,50 @@ ul_load_code(gp)
/*
* XXX load shadow overlay palette with what the TMS code will load
- * into the real one some time after the TMS code is started above.
- * This is a rude hack.
+ * into the real one some time after the TMS code is started below.
+ * This might be considered a rude hack.
*/
bcopy(ul_ovl_palette, gup->gus_ovcmap, 3*4);
+
+ /*
+ * Unflush cache, unhalt cpu -> nmi starts to run. This MUST NOT BE
+ * DONE before the image color map initialization above, to guarantee
+ * the index register in the bt478 is not used by more than one CPU
+ * at once.
+ *
+ * XXX For the same reason, we'll have to rething ul_putcmap(). For
+ * details, look at comment there.
+ */
+ ba->ctrl &= ~(HLT|CF);
+
#else
- /* XXX This version will work for the overlay, if our queue codes
+ /*
+ * XXX I wonder why this partially ever worked.
+ *
+ * This can't possibly work this way, as we are copyin()ing data in
+ * ul_putcmap.
+ *
+ * I guess this partially worked because SFC happened to point to
+ * to supervisor data space on 68030 machines coming from the old
+ * boot loader.
+ *
+ * While this looks more correct than the hack in the other part of the
+ * loop, we would have to do our own version of the loop through
+ * colormap entries, set up command buffer, and call gsp_write(), or
+ * factor out some code.
+ */
+
+ /*
+ * XXX This version will work for the overlay, if our queue codes
* initial conditions are set at load time (not start time).
* It further assumes that ul_putcmap only uses the
* GRFIMDEV/GRFOVDEV bits of the dev parameter.
*/
+
+ /* unflush cache, unhalt cpu first -> nmi starts to run */
+ ba->ctrl &= ~(HLT|CF);
+
gcm.index = 0;
gcm.count = 16;
gcm.red = ul_std_palette + 0;
@@ -721,6 +752,9 @@ ul_ioctl (gp, cmd, data, dev)
case GRFIOCBITBLT:
return ul_bitblt (gp, (struct grf_bitblt *) data, dev);
+
+ case GRFIOCBLANK:
+ return ul_blank (gp, (int *) data, dev);
}
return EINVAL;
@@ -810,6 +844,14 @@ ul_putcmap (gp, cmap, dev)
/* then write from there to the hardware */
ba = (struct gspregs *)gp->g_regkva;
+ /*
+ * XXX This is a bad thing to do.
+ * We should always use the gsp call, or have a means to arbitrate
+ * the usage of the BT478 index register. Else there might be a
+ * race condition (when writing both colormaps at nearly the same
+ * time), where one CPU changes the index register when the other
+ * one has not finished using it.
+ */
if (mxidx > 4) {
/* image color map: we can write, with a hack, directly */
ba->ctrl = LBL;
@@ -840,6 +882,24 @@ ul_putcmap (gp, cmap, dev)
return 0;
}
+int
+ul_blank(gp, onoff, dev)
+ struct grf_softc *gp;
+ int *onoff;
+ dev_t dev;
+{
+ struct gspregs *gsp;
+ gsp = (struct gspregs *)gp->g_regkva;
+ gsp->ctrl = (gsp->ctrl & ~(INCR|INCW) | LBL);
+ gsp->hstadrh = 0xC000;
+ gsp->hstadrl = 0x0080;
+ if (*onoff)
+ gsp->data |= 0x9000;
+ else
+ gsp->data &= ~0x9000;
+
+ return 0;
+}
/*
* !!! THIS AREA UNDER CONSTRUCTION !!!
*/