summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-07-26 16:57:17 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-07-26 16:57:17 +0000
commit0056750d63637635ec4c4aee5c628d172fc1b8f3 (patch)
tree8615aa0c1fd36624f9264274661dc8c6fe331250 /sys/arch/sparc64/dev
parent3f31a1e527df0783d3959dbd99bdc24bcf8b65f7 (diff)
- remove duplicate defns
- start at some utility functions for the FBC handling
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r--sys/arch/sparc64/dev/creator.c37
-rw-r--r--sys/arch/sparc64/dev/creatorvar.h24
2 files changed, 38 insertions, 23 deletions
diff --git a/sys/arch/sparc64/dev/creator.c b/sys/arch/sparc64/dev/creator.c
index 01f4872afd1..c4e4f51d4eb 100644
--- a/sys/arch/sparc64/dev/creator.c
+++ b/sys/arch/sparc64/dev/creator.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: creator.c,v 1.13 2002/07/25 19:04:43 miod Exp $ */
+/* $OpenBSD: creator.c,v 1.14 2002/07/26 16:57:16 jason Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -48,6 +48,7 @@
#include <dev/wscons/wscons_raster.h>
#include <dev/rasops/rasops.h>
+#include <sparc64/dev/creatorreg.h>
#include <sparc64/dev/creatorvar.h>
struct wsscreen_descr creator_stdscreen = {
@@ -76,6 +77,8 @@ int creator_show_screen(void *, void *, int, void (*cb)(void *, int, int),
void *);
paddr_t creator_mmap(void *, off_t, int);
static int a2int(char *, int);
+void creator_ras_fifo_wait(struct creator_softc *, int);
+void creator_ras_wait(struct creator_softc *);
struct wsdisplay_accessops creator_accessops = {
creator_ioctl,
@@ -308,3 +311,35 @@ a2int(char *cp, int deflt)
i = i * 10 + *cp++ - '0';
return (i);
}
+
+void
+creator_ras_fifo_wait(sc, n)
+ struct creator_softc *sc;
+ int n;
+{
+ int32_t cache = sc->sc_fifo_cache;
+
+ if (cache < n) {
+ do {
+ cache = FBC_READ(sc, FFB_FBC_UCSR);
+ cache = (cache & FBC_UCSR_FIFO_MASK) - 8;
+ } while (cache < n);
+ }
+ sc->sc_fifo_cache = cache - n;
+}
+
+void
+creator_ras_wait(sc)
+ struct creator_softc *sc;
+{
+ u_int32_t ucsr, r;
+
+ while (1) {
+ ucsr = FBC_READ(sc, FFB_FBC_UCSR);
+ if ((ucsr & (FBC_UCSR_FB_BUSY|FBC_UCSR_RP_BUSY)) == 0)
+ break;
+ r = ucsr & (FFB_UCSR_READ_ERR | FFB_UCSR_FIFO_OVFL);
+ if (r != 0)
+ FBC_WRITE(sc, FFB_FBC_UCSR, r);
+ }
+}
diff --git a/sys/arch/sparc64/dev/creatorvar.h b/sys/arch/sparc64/dev/creatorvar.h
index b00775defe5..9ce4fe80f8c 100644
--- a/sys/arch/sparc64/dev/creatorvar.h
+++ b/sys/arch/sparc64/dev/creatorvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: creatorvar.h,v 1.3 2002/07/26 16:39:04 jason Exp $ */
+/* $OpenBSD: creatorvar.h,v 1.4 2002/07/26 16:57:16 jason Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net),
@@ -32,27 +32,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/* Number of register sets */
-#define FFB_NREGS 24
-
-/* Register set numbers */
-#define FFB_REG_PROM 0
-#define FFB_REG_DAC 1
-#define FFB_REG_FBC 2
-#define FFB_REG_DFB8R 3
-#define FFB_REG_DFB8G 4
-#define FFB_REG_DFB8B 5
-#define FFB_REG_DFB8X 6
-#define FFB_REG_DFB24 7
-#define FFB_REG_DFB32 8
-#define FFB_REG_SFB8R 9
-#define FFB_REG_SFB8G 10
-#define FFB_REG_SFB8B 11
-#define FFB_REG_SFB8X 12
-#define FFB_REG_SFB32 13
-#define FFB_REG_SFB64 14
-#define FFB_REG_DFB422A 15
-
#define FFB_CREATOR 0
#define FFB_AFB 1
@@ -70,6 +49,7 @@ struct creator_softc {
int sc_type;
u_int sc_mode;
struct rasops_info sc_rasops;
+ int32_t sc_fifo_cache;
};
#define FBC_WRITE(sc,r,v) \