summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev/cgsix.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-03-23 17:16:37 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-03-23 17:16:37 +0000
commit9daadf6caedf1ac0590abd2f3f3a12e12ad0a8fb (patch)
tree8478d5d38d17f5a0c03c0d8e8dc8b56a796df73f /sys/arch/sparc/dev/cgsix.c
parentbba30e5a6b6f54b1e38fdec7a71f7cf273ac4b42 (diff)
Move the alloc_screen, free_screen and show_screen wsdisplay accessops to
the common frame buffer code, rather than duplicating it in every driver. No functional change.
Diffstat (limited to 'sys/arch/sparc/dev/cgsix.c')
-rw-r--r--sys/arch/sparc/dev/cgsix.c161
1 files changed, 35 insertions, 126 deletions
diff --git a/sys/arch/sparc/dev/cgsix.c b/sys/arch/sparc/dev/cgsix.c
index b3195816b2e..9c1fcde54da 100644
--- a/sys/arch/sparc/dev/cgsix.c
+++ b/sys/arch/sparc/dev/cgsix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgsix.c,v 1.32 2005/03/07 16:44:50 miod Exp $ */
+/* $OpenBSD: cgsix.c,v 1.33 2005/03/23 17:16:34 miod Exp $ */
/* $NetBSD: cgsix.c,v 1.33 1997/08/07 19:12:30 pk Exp $ */
/*
@@ -97,7 +97,6 @@
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wscons_raster.h>
#include <dev/rasops/rasops.h>
#include <machine/fbvar.h>
@@ -121,40 +120,35 @@ struct cgsix_softc {
volatile struct cgsix_tec_xxx *sc_tec; /* TEC registers */
union bt_cmap sc_cmap; /* Brooktree color map */
struct intrhand sc_ih;
- int sc_nscreens;
};
-int cgsix_ioctl(void *, u_long, caddr_t, int, struct proc *);
-int cgsix_alloc_screen(void *, const struct wsscreen_descr *, void **,
- int *, int *, long *);
-void cgsix_free_screen(void *, void *);
-int cgsix_show_screen(void *, void *, int, void (*cb)(void *, int, int),
- void *);
-paddr_t cgsix_mmap(void *, off_t, int);
-void cgsix_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
-static __inline__ void cgsix_loadcmap_deferred(struct cgsix_softc *,
- u_int, u_int);
-void cgsix_reset(struct cgsix_softc *, u_int);
-void cgsix_burner(void *, u_int, u_int);
-int cgsix_intr(void *);
-
-void cgsix_ras_init(struct cgsix_softc *);
-void cgsix_ras_copyrows(void *, int, int, int);
-void cgsix_ras_copycols(void *, int, int, int, int);
-void cgsix_ras_erasecols(void *, int, int, int, long int);
-void cgsix_ras_eraserows(void *, int, int, long int);
-void cgsix_ras_do_cursor(struct rasops_info *);
+void cgsix_burner(void *, u_int, u_int);
+int cgsix_intr(void *);
+int cgsix_ioctl(void *, u_long, caddr_t, int, struct proc *);
+static __inline__
+void cgsix_loadcmap_deferred(struct cgsix_softc *, u_int, u_int);
+paddr_t cgsix_mmap(void *, off_t, int);
+void cgsix_reset(struct cgsix_softc *, u_int);
+void cgsix_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t);
+
+void cgsix_ras_copyrows(void *, int, int, int);
+void cgsix_ras_copycols(void *, int, int, int, int);
+void cgsix_ras_do_cursor(struct rasops_info *);
+void cgsix_ras_erasecols(void *, int, int, int, long);
+void cgsix_ras_eraserows(void *, int, int, long);
+void cgsix_ras_init(struct cgsix_softc *);
struct wsdisplay_accessops cgsix_accessops = {
cgsix_ioctl,
cgsix_mmap,
- cgsix_alloc_screen,
- cgsix_free_screen,
- cgsix_show_screen,
+ NULL, /* alloc_screen */
+ NULL, /* free_screen */
+ NULL, /* show_screen */
NULL, /* load_font */
NULL, /* scrollback */
NULL, /* getchar */
cgsix_burner,
+ NULL /* pollc */
};
int cgsixmatch(struct device *, void *, void *);
@@ -168,13 +162,8 @@ struct cfdriver cgsix_cd = {
NULL, "cgsix", DV_DULL
};
-/*
- * Match a cgsix.
- */
int
-cgsixmatch(parent, vcf, aux)
- struct device *parent;
- void *vcf, *aux;
+cgsixmatch(struct device *parent, void *vcf, void *aux)
{
struct cfdata *cf = vcf;
struct confargs *ca = aux;
@@ -216,13 +205,8 @@ cgsixmatch(parent, vcf, aux)
return (0);
}
-/*
- * Attach a display.
- */
void
-cgsixattach(parent, self, args)
- struct device *parent, *self;
- void *args;
+cgsixattach(struct device *parent, struct device *self, void *args)
{
struct cgsix_softc *sc = (struct cgsix_softc *)self;
struct confargs *ca = args;
@@ -372,12 +356,7 @@ cgsixattach(parent, self, args)
}
int
-cgsix_ioctl(dev, cmd, data, flags, p)
- void *dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
+cgsix_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p)
{
struct cgsix_softc *sc = dev;
struct wsdisplay_cmap *cm;
@@ -430,56 +409,11 @@ cgsix_ioctl(dev, cmd, data, flags, p)
return (0);
}
-int
-cgsix_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
- void *v;
- const struct wsscreen_descr *type;
- void **cookiep;
- int *curxp, *curyp;
- long *attrp;
-{
- struct cgsix_softc *sc = v;
-
- if (sc->sc_nscreens > 0)
- return (ENOMEM);
-
- *cookiep = &sc->sc_sunfb.sf_ro;
- *curyp = 0;
- *curxp = 0;
- sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro,
- WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp);
- sc->sc_nscreens++;
- return (0);
-}
-
-void
-cgsix_free_screen(v, cookie)
- void *v;
- void *cookie;
-{
- struct cgsix_softc *sc = v;
-
- sc->sc_nscreens--;
-}
-
-int
-cgsix_show_screen(v, cookie, waitok, cb, cbarg)
- void *v;
- void *cookie;
- int waitok;
- void (*cb)(void *, int, int);
- void *cbarg;
-{
- return (0);
-}
-
/*
* Clean up hardware state (e.g., after bootup or after X crashes).
*/
void
-cgsix_reset(sc, fhcrev)
- struct cgsix_softc *sc;
- u_int fhcrev;
+cgsix_reset(struct cgsix_softc *sc, u_int fhcrev)
{
volatile struct cgsix_tec_xxx *tec;
int fhc;
@@ -514,15 +448,8 @@ cgsix_reset(sc, fhcrev)
bt->bt_ctrl |= 0x03 << 24;
}
-/*
- * Return the address that would map the given device at the given
- * offset, allowing for the given protection, or return -1 for error.
- */
paddr_t
-cgsix_mmap(v, offset, prot)
- void *v;
- off_t offset;
- int prot;
+cgsix_mmap(void *v, off_t offset, int prot)
{
struct cgsix_softc *sc = v;
@@ -535,14 +462,11 @@ cgsix_mmap(v, offset, prot)
PMAP_NC);
}
- return (-1); /* not a user-map offset */
+ return (-1);
}
void
-cgsix_setcolor(v, index, r, g, b)
- void *v;
- u_int index;
- u_int8_t r, g, b;
+cgsix_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b)
{
struct cgsix_softc *sc = v;
@@ -561,9 +485,7 @@ cgsix_loadcmap_deferred(struct cgsix_softc *sc, u_int start, u_int ncolors)
}
void
-cgsix_burner(v, on, flags)
- void *v;
- u_int on, flags;
+cgsix_burner(void *v, u_int on, u_int flags)
{
struct cgsix_softc *sc = v;
int s;
@@ -583,8 +505,7 @@ cgsix_burner(v, on, flags)
}
int
-cgsix_intr(v)
- void *v;
+cgsix_intr(void *v)
{
struct cgsix_softc *sc = v;
u_int32_t thcm;
@@ -618,8 +539,7 @@ cgsix_intr(v)
while ((fbc)->fbc_s & FBC_S_GXINPROGRESS)
void
-cgsix_ras_init(sc)
- struct cgsix_softc *sc;
+cgsix_ras_init(struct cgsix_softc *sc)
{
u_int32_t m;
@@ -631,9 +551,7 @@ cgsix_ras_init(sc)
}
void
-cgsix_ras_copyrows(cookie, src, dst, n)
- void *cookie;
- int src, dst, n;
+cgsix_ras_copyrows(void *cookie, int src, int dst, int n)
{
struct rasops_info *ri = cookie;
struct cgsix_softc *sc = ri->ri_hw;
@@ -681,9 +599,7 @@ cgsix_ras_copyrows(cookie, src, dst, n)
}
void
-cgsix_ras_copycols(cookie, row, src, dst, n)
- void *cookie;
- int row, src, dst, n;
+cgsix_ras_copycols(void *cookie, int row, int src, int dst, int n)
{
struct rasops_info *ri = cookie;
struct cgsix_softc *sc = ri->ri_hw;
@@ -734,10 +650,7 @@ cgsix_ras_copycols(cookie, row, src, dst, n)
}
void
-cgsix_ras_erasecols(cookie, row, col, n, attr)
- void *cookie;
- int row, col, n;
- long int attr;
+cgsix_ras_erasecols(void *cookie, int row, int col, int n, long attr)
{
struct rasops_info *ri = cookie;
struct cgsix_softc *sc = ri->ri_hw;
@@ -776,10 +689,7 @@ cgsix_ras_erasecols(cookie, row, col, n, attr)
}
void
-cgsix_ras_eraserows(cookie, row, n, attr)
- void *cookie;
- int row, n;
- long int attr;
+cgsix_ras_eraserows(void *cookie, int row, int n, long attr)
{
struct rasops_info *ri = cookie;
struct cgsix_softc *sc = ri->ri_hw;
@@ -823,8 +733,7 @@ cgsix_ras_eraserows(cookie, row, n, attr)
}
void
-cgsix_ras_do_cursor(ri)
- struct rasops_info *ri;
+cgsix_ras_do_cursor(struct rasops_info *ri)
{
struct cgsix_softc *sc = ri->ri_hw;
int row, col;