From 9daadf6caedf1ac0590abd2f3f3a12e12ad0a8fb Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Wed, 23 Mar 2005 17:16:37 +0000 Subject: 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. --- sys/arch/sparc/dev/agten.c | 111 ++++++--------------------- sys/arch/sparc/dev/bwtwo.c | 103 ++++--------------------- sys/arch/sparc/dev/cgeight.c | 112 ++++------------------------ sys/arch/sparc/dev/cgfour.c | 116 ++++------------------------- sys/arch/sparc/dev/cgfourteen.c | 49 ++---------- sys/arch/sparc/dev/cgsix.c | 161 +++++++++------------------------------- sys/arch/sparc/dev/cgthree.c | 115 +++++----------------------- sys/arch/sparc/dev/cgtwelve.c | 115 +++++----------------------- sys/arch/sparc/dev/cgtwo.c | 130 ++++++-------------------------- sys/arch/sparc/dev/fb.c | 83 +++++++++++++++------ sys/arch/sparc/dev/mgx.c | 70 ++++------------- sys/arch/sparc/dev/p9000.c | 61 +++------------ sys/arch/sparc/dev/p9100.c | 70 +++-------------- sys/arch/sparc/dev/rfx.c | 55 ++------------ sys/arch/sparc/dev/tcx.c | 144 ++++++++--------------------------- sys/arch/sparc/dev/tvtwo.c | 56 ++------------ sys/arch/sparc/dev/vigra.c | 73 ++++-------------- sys/arch/sparc/dev/zx.c | 89 +++++++--------------- sys/arch/sparc/include/fbvar.h | 6 +- 19 files changed, 349 insertions(+), 1370 deletions(-) diff --git a/sys/arch/sparc/dev/agten.c b/sys/arch/sparc/dev/agten.c index 5ed2ac2492d..955d4df2420 100644 --- a/sys/arch/sparc/dev/agten.c +++ b/sys/arch/sparc/dev/agten.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agten.c,v 1.8 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: agten.c,v 1.9 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2002, 2003, Miodrag Vallat. * All rights reserved. @@ -74,7 +74,6 @@ #include #include -#include #include #include @@ -101,39 +100,34 @@ struct agten_softc { struct agten_cmap sc_cmap; /* shadow color map */ volatile u_int32_t *sc_i128_fb; - - int sc_nscreens; }; -int agten_ioctl(void *, u_long, caddr_t, int, struct proc *); -int agten_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void agten_free_screen(void *, void *); -int agten_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t agten_mmap(void *, off_t, int); -void agten_reset(struct agten_softc *); -void agten_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); - -static __inline__ void ibm561_write(struct agten_softc *, u_int32_t, u_int32_t); -int agten_getcmap(struct agten_cmap *, struct wsdisplay_cmap *); -int agten_putcmap(struct agten_cmap *, struct wsdisplay_cmap *); -void agten_loadcmap(struct agten_softc *, u_int, u_int); +int agten_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t agten_mmap(void *, off_t, int); +void agten_reset(struct agten_softc *); +void agten_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); + +static __inline__ +void ibm561_write(struct agten_softc *, u_int32_t, u_int32_t); +int agten_getcmap(struct agten_cmap *, struct wsdisplay_cmap *); +int agten_putcmap(struct agten_cmap *, struct wsdisplay_cmap *); +void agten_loadcmap(struct agten_softc *, u_int, u_int); struct wsdisplay_accessops agten_accessops = { agten_ioctl, agten_mmap, - agten_alloc_screen, - agten_free_screen, - agten_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ NULL, /* burner */ + NULL /* pollc */ }; -int agtenmatch(struct device *, void *, void *); -void agtenattach(struct device *, struct device *, void *); +int agtenmatch(struct device *, void *, void *); +void agtenattach(struct device *, struct device *, void *); struct cfattach agten_ca = { sizeof(struct agten_softc), agtenmatch, agtenattach @@ -224,12 +218,7 @@ agtenattach(struct device *parent, struct device *self, void *args) } int -agten_ioctl(dev, cmd, data, flags, p) - void *dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +agten_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) { struct agten_softc *sc = dev; struct wsdisplay_cmap *cm; @@ -285,15 +274,8 @@ agten_ioctl(dev, cmd, data, flags, p) return (0); } -/* - * 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 -agten_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +agten_mmap(void *v, off_t offset, int prot) { struct agten_softc *sc = v; @@ -306,14 +288,11 @@ agten_mmap(v, offset, prot) PMAP_NC); } - return (-1); /* not a user-map offset */ + return (-1); } void -agten_setcolor(v, index, r, g, b) - void *v; - u_int index; - u_int8_t r, g, b; +agten_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) { struct agten_softc *sc = v; @@ -324,54 +303,6 @@ agten_setcolor(v, index, r, g, b) agten_loadcmap(sc, index, 1); } -int -agten_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct agten_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - if (sc->sc_sunfb.sf_depth == 8) { - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - } else { - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - 0, 0, 0, attrp); - } - sc->sc_nscreens++; - return (0); -} - -void -agten_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct agten_softc *sc = v; - - sc->sc_nscreens--; -} - -int -agten_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - int agten_getcmap(struct agten_cmap *cm, struct wsdisplay_cmap *rcm) { diff --git a/sys/arch/sparc/dev/bwtwo.c b/sys/arch/sparc/dev/bwtwo.c index e520df2d46d..3f137ed8746 100644 --- a/sys/arch/sparc/dev/bwtwo.c +++ b/sys/arch/sparc/dev/bwtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwtwo.c,v 1.31 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: bwtwo.c,v 1.32 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: bwtwo.c,v 1.33 1997/05/24 20:16:02 pk Exp $ */ /* @@ -76,7 +76,6 @@ #include #include -#include #include #include @@ -90,29 +89,24 @@ struct bwtwo_softc { struct rom_reg sc_phys; /* phys address description */ int sc_bustype; /* type of bus we live on */ int sc_pixeloffset; /* offset to framebuffer */ - int sc_nscreens; }; -int bwtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); -int bwtwo_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void bwtwo_free_screen(void *, void *); -int bwtwo_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t bwtwo_mmap(void *, off_t, int); -void bwtwo_burner(void *, u_int, u_int); -int bwtwo_intr(void *); +void bwtwo_burner(void *, u_int, u_int); +int bwtwo_intr(void *); +int bwtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t bwtwo_mmap(void *, off_t, int); struct wsdisplay_accessops bwtwo_accessops = { bwtwo_ioctl, bwtwo_mmap, - bwtwo_alloc_screen, - bwtwo_free_screen, - bwtwo_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ bwtwo_burner, + NULL /* pollc */ }; @@ -128,13 +122,8 @@ struct cfdriver bwtwo_cd = { NULL, "bwtwo", DV_DULL }; -/* - * Match a bwtwo. - */ int -bwtwomatch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +bwtwomatch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; @@ -185,13 +174,8 @@ bwtwomatch(parent, vcf, aux) return (0); } -/* - * Attach a display. - */ void -bwtwoattach(parent, self, args) - struct device *parent, *self; - void *args; +bwtwoattach(struct device *parent, struct device *self, void *args) { struct bwtwo_softc *sc = (struct bwtwo_softc *)self; struct confargs *ca = args; @@ -307,12 +291,7 @@ obp_name: } int -bwtwo_ioctl(v, cmd, data, flags, p) - void *v; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +bwtwo_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct bwtwo_softc *sc = v; struct wsdisplay_fbinfo *wdf; @@ -352,15 +331,8 @@ bwtwo_ioctl(v, cmd, data, flags, p) return (0); } -/* - * 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 -bwtwo_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +bwtwo_mmap(void *v, off_t offset, int prot) { struct bwtwo_softc *sc = v; @@ -376,9 +348,7 @@ bwtwo_mmap(v, offset, prot) } void -bwtwo_burner(v, on, flags) - void *v; - u_int on, flags; +bwtwo_burner(void *v, u_int on, u_int flags) { struct bwtwo_softc *sc = v; int s; @@ -386,7 +356,7 @@ bwtwo_burner(v, on, flags) #if defined(SUN4) if (CPU_ISSUN4 && (sc->sc_bustype == BUS_OBIO)) { if (ISSET(sc->sc_sunfb.sf_flags, FB_PFOUR)) { - fb_pfour_set_video(&sc->sc_sunfb, on); + fb_pfour_burner(v, on, flags); return; } if (on) @@ -410,46 +380,3 @@ bwtwo_burner(v, on, flags) } splx(s); } - -int -bwtwo_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct bwtwo_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, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -bwtwo_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct bwtwo_softc *sc = v; - - sc->sc_nscreens--; -} - -int -bwtwo_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} diff --git a/sys/arch/sparc/dev/cgeight.c b/sys/arch/sparc/dev/cgeight.c index 987b579cfae..3cb06994848 100644 --- a/sys/arch/sparc/dev/cgeight.c +++ b/sys/arch/sparc/dev/cgeight.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgeight.c,v 1.24 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: cgeight.c,v 1.25 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: cgeight.c,v 1.13 1997/05/24 20:16:04 pk Exp $ */ /* @@ -71,7 +71,6 @@ #include #include -#include #include #include @@ -85,29 +84,23 @@ struct cgeight_softc { struct rom_reg sc_phys; /* display RAM (phys addr) */ volatile struct fbcontrol *sc_fbc; /* Brooktree registers */ union bt_cmap sc_cmap; /* Brooktree color map */ - int sc_nscreens; }; -int cgeight_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgeight_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgeight_free_screen(void *, void *); -int cgeight_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t cgeight_mmap(void *, off_t, int); -void cgeight_reset(struct cgeight_softc *); -void cgeight_burner(void *, u_int, u_int); +int cgeight_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t cgeight_mmap(void *, off_t, int); +void cgeight_reset(struct cgeight_softc *); struct wsdisplay_accessops cgeight_accessops = { cgeight_ioctl, cgeight_mmap, - cgeight_alloc_screen, - cgeight_free_screen, - cgeight_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ - cgeight_burner, + fb_pfour_burner, + NULL /* pollc */ }; void cgeightattach(struct device *, struct device *, void *); @@ -121,13 +114,8 @@ struct cfdriver cgeight_cd = { NULL, "cgeight", DV_DULL }; -/* - * Match a cgeight. - */ int -cgeightmatch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +cgeightmatch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; @@ -161,13 +149,8 @@ cgeightmatch(parent, vcf, aux) return (0); } -/* - * Attach a display. - */ void -cgeightattach(parent, self, args) - struct device *parent, *self; - void *args; +cgeightattach(struct device *parent, struct device *self, void *args) { struct cgeight_softc *sc = (struct cgeight_softc *)self; struct confargs *ca = args; @@ -206,7 +189,7 @@ cgeightattach(parent, self, args) sc->sc_cmap.cm_chip[i] = bt->bt_cmap; /* enable video */ - cgeight_burner(sc, 1, 0); + fb_pfour_burner(sc, 1, 0); BT_INIT(bt, 0); fb_setsize(&sc->sc_sunfb, 24, 1152, 900, node, ca->ca_bustype); @@ -226,12 +209,7 @@ cgeightattach(parent, self, args) } int -cgeight_ioctl(v, cmd, data, flags, p) - void *v; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +cgeight_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct cgeight_softc *sc = v; struct wsdisplay_cmap *cm; @@ -281,58 +259,8 @@ cgeight_ioctl(v, cmd, data, flags, p) return (0); } -int -cgeight_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct cgeight_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, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -cgeight_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct cgeight_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgeight_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - -/* - * 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 -cgeight_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +cgeight_mmap(void *v, off_t offset, int prot) { struct cgeight_softc *sc = v; @@ -345,15 +273,5 @@ cgeight_mmap(v, offset, prot) PFOUR_COLOR_OFF_OVERLAY) | PMAP_NC); } - return (-1); /* not a user-map offset */ -} - -void -cgeight_burner(v, on, flags) - void *v; - u_int on, flags; -{ - struct cgeight_softc *sc = v; - - fb_pfour_set_video(&sc->sc_sunfb, on); + return (-1); } diff --git a/sys/arch/sparc/dev/cgfour.c b/sys/arch/sparc/dev/cgfour.c index f1a44e4207d..c263608affa 100644 --- a/sys/arch/sparc/dev/cgfour.c +++ b/sys/arch/sparc/dev/cgfour.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfour.c,v 1.24 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: cgfour.c,v 1.25 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: cgfour.c,v 1.13 1997/05/24 20:16:06 pk Exp $ */ /* @@ -71,7 +71,6 @@ #include #include -#include #include #include @@ -85,29 +84,23 @@ struct cgfour_softc { struct rom_reg sc_phys; /* display RAM (phys addr) */ volatile struct fbcontrol *sc_fbc; /* Brooktree registers */ union bt_cmap sc_cmap; /* Brooktree color map */ - int sc_nscreens; }; -int cgfour_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgfour_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgfour_free_screen(void *, void *); -int cgfour_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t cgfour_mmap(void *, off_t, int); -void cgfour_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -void cgfour_burner(void *, u_int, u_int); +int cgfour_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t cgfour_mmap(void *, off_t, int); +void cgfour_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops cgfour_accessops = { cgfour_ioctl, cgfour_mmap, - cgfour_alloc_screen, - cgfour_free_screen, - cgfour_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ - cgfour_burner, + fb_pfour_burner, + NULL /* pollc */ }; void cgfourattach(struct device *, struct device *, void *); @@ -121,13 +114,8 @@ struct cfdriver cgfour_cd = { NULL, "cgfour", DV_DULL }; -/* - * Match a cgfour. - */ int -cgfourmatch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +cgfourmatch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; @@ -158,13 +146,8 @@ cgfourmatch(parent, vcf, aux) return (0); } -/* - * Attach a display. - */ void -cgfourattach(parent, self, args) - struct device *parent, *self; - void *args; +cgfourattach(struct device *parent, struct device *self, void *args) { struct cgfour_softc *sc = (struct cgfour_softc *)self; struct confargs *ca = args; @@ -207,7 +190,7 @@ cgfourattach(parent, self, args) ((char *)&sc->sc_cmap)[i] = bt->bt_cmap >> 24; /* enable video */ - cgfour_burner(sc, 1, 0); + fb_pfour_burner(sc, 1, 0); BT_INIT(bt, 24); /* @@ -236,12 +219,7 @@ cgfourattach(parent, self, args) } int -cgfour_ioctl(v, cmd, data, flags, p) - void *v; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +cgfour_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct cgfour_softc *sc = v; struct wsdisplay_fbinfo *wdf; @@ -295,59 +273,8 @@ cgfour_ioctl(v, cmd, data, flags, p) return (0); } -int -cgfour_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct cgfour_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 -cgfour_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct cgfour_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgfour_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - - -/* - * 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 -cgfour_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +cgfour_mmap(void *v, off_t offset, int prot) { struct cgfour_softc *sc = v; @@ -363,22 +290,9 @@ cgfour_mmap(v, offset, prot) } void -cgfour_setcolor(v, index, r, g, b) - void *v; - u_int index; - u_int8_t r, g, b; +cgfour_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) { struct cgfour_softc *sc = v; bt_setcolor(&sc->sc_cmap, &sc->sc_fbc->fbc_dac, index, r, g, b, 1); } - -void -cgfour_burner(v, on, flags) - void *v; - u_int on, flags; -{ - struct cgfour_softc *sc = v; - - fb_pfour_set_video(&sc->sc_sunfb, on); -} diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c index d51df479f5c..5422fed082b 100644 --- a/sys/arch/sparc/dev/cgfourteen.c +++ b/sys/arch/sparc/dev/cgfourteen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfourteen.c,v 1.30 2005/03/15 18:50:43 miod Exp $ */ +/* $OpenBSD: cgfourteen.c,v 1.31 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */ /* @@ -101,7 +101,6 @@ #include #include -#include #include #include @@ -140,15 +139,9 @@ struct cgfourteen_softc { size_t sc_vramsize; /* total video memory size */ struct intrhand sc_ih; - int sc_nscreens; }; int cgfourteen_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgfourteen_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgfourteen_free_screen(void *, void *); -int cgfourteen_show_screen(void *, void *, int, void (*)(void *, int, int), - void *); paddr_t cgfourteen_mmap(void *, off_t, int); void cgfourteen_reset(struct cgfourteen_softc *, int); void cgfourteen_burner(void *, u_int, u_int); @@ -164,13 +157,14 @@ void cgfourteen_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops cgfourteen_accessops = { cgfourteen_ioctl, cgfourteen_mmap, - cgfourteen_alloc_screen, - cgfourteen_free_screen, - cgfourteen_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ cgfourteen_burner, + NULL /* pollc */ }; void cgfourteenattach(struct device *, struct device *, void *); @@ -411,39 +405,6 @@ cgfourteen_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -cgfourteen_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct cgfourteen_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 -cgfourteen_free_screen(void *v, void *cookie) -{ - struct cgfourteen_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgfourteen_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - /* * Return the address that would map the given device at the given * offset, allowing for the given protection, or return -1 for error. 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 #include -#include #include #include @@ -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; diff --git a/sys/arch/sparc/dev/cgthree.c b/sys/arch/sparc/dev/cgthree.c index 949098ddc52..e14ce681908 100644 --- a/sys/arch/sparc/dev/cgthree.c +++ b/sys/arch/sparc/dev/cgthree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgthree.c,v 1.28 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: cgthree.c,v 1.29 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: cgthree.c,v 1.33 1997/05/24 20:16:11 pk Exp $ */ /* @@ -96,7 +96,6 @@ #include #include -#include #include #include @@ -113,32 +112,27 @@ struct cgthree_softc { volatile struct fbcontrol *sc_fbc; /* Brooktree registers */ union bt_cmap sc_cmap; /* Brooktree color map */ struct intrhand sc_ih; - int sc_nscreens; }; -int cgthree_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgthree_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgthree_free_screen(void *, void *); -int cgthree_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t cgthree_mmap(void *, off_t, int); -void cgthree_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -static __inline__ void cgthree_loadcmap_deferred(struct cgthree_softc *, - u_int, u_int); -void cgthree_burner(void *, u_int, u_int); -int cgthree_intr(void *); +void cgthree_burner(void *, u_int, u_int); +int cgthree_intr(void *); +int cgthree_ioctl(void *, u_long, caddr_t, int, struct proc *); +static __inline__ +void cgthree_loadcmap_deferred(struct cgthree_softc *, u_int, u_int); +paddr_t cgthree_mmap(void *, off_t, int); +void cgthree_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops cgthree_accessops = { cgthree_ioctl, cgthree_mmap, - cgthree_alloc_screen, - cgthree_free_screen, - cgthree_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ cgthree_burner, + NULL /* pollc */ }; int cgthreematch(struct device *, void *, void *); @@ -174,13 +168,8 @@ struct cg3_videoctrl { }, }; -/* - * Match a cgthree. - */ int -cgthreematch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +cgthreematch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; @@ -197,13 +186,8 @@ cgthreematch(parent, vcf, aux) return (probeget(ra->ra_vaddr, 4) != -1); } -/* - * Attach a display. - */ void -cgthreeattach(parent, self, args) - struct device *parent, *self; - void *args; +cgthreeattach(struct device *parent, struct device *self, void *args) { struct cgthree_softc *sc = (struct cgthree_softc *)self; struct confargs *ca = args; @@ -323,12 +307,7 @@ cgthreeattach(parent, self, args) } int -cgthree_ioctl(v, cmd, data, flags, p) - void *v; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +cgthree_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct cgthree_softc *sc = v; struct wsdisplay_fbinfo *wdf; @@ -381,58 +360,8 @@ cgthree_ioctl(v, cmd, data, flags, p) return (0); } -int -cgthree_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct cgthree_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 -cgthree_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct cgthree_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgthree_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - -/* - * 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 -cgthree_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +cgthree_mmap(void *v, off_t offset, int prot) { struct cgthree_softc *sc = v; @@ -448,10 +377,7 @@ cgthree_mmap(v, offset, prot) } void -cgthree_setcolor(v, index, r, g, b) - void *v; - u_int index; - u_int8_t r, g, b; +cgthree_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) { struct cgthree_softc *sc = v; @@ -466,9 +392,7 @@ cgthree_loadcmap_deferred(struct cgthree_softc *sc, u_int start, u_int ncolors) } void -cgthree_burner(v, on, flags) - void *v; - u_int on, flags; +cgthree_burner(void *v, u_int on, u_int flags) { struct cgthree_softc *sc = v; int s; @@ -485,8 +409,7 @@ cgthree_burner(v, on, flags) } int -cgthree_intr(v) - void *v; +cgthree_intr(void *v) { struct cgthree_softc *sc = v; diff --git a/sys/arch/sparc/dev/cgtwelve.c b/sys/arch/sparc/dev/cgtwelve.c index 5f4a7b70033..c641d3cc80b 100644 --- a/sys/arch/sparc/dev/cgtwelve.c +++ b/sys/arch/sparc/dev/cgtwelve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwelve.c,v 1.13 2005/03/13 23:05:22 miod Exp $ */ +/* $OpenBSD: cgtwelve.c,v 1.14 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2002, 2003 Miodrag Vallat. All rights reserved. @@ -65,7 +65,6 @@ #include #include -#include #include #include @@ -87,36 +86,30 @@ struct cgtwelve_softc { volatile u_long *sc_inten; /* true color plane */ int sc_highres; - int sc_nscreens; }; -int cgtwelve_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgtwelve_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgtwelve_free_screen(void *, void *); -int cgtwelve_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t cgtwelve_mmap(void *, off_t, int); -void cgtwelve_reset(struct cgtwelve_softc *, int); -void cgtwelve_prom(void *); - -static __inline__ void cgtwelve_ramdac_wraddr(struct cgtwelve_softc *sc, - u_int32_t addr); +int cgtwelve_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t cgtwelve_mmap(void *, off_t, int); +void cgtwelve_prom(void *); +static __inline__ +void cgtwelve_ramdac_wraddr(struct cgtwelve_softc *, u_int32_t); +void cgtwelve_reset(struct cgtwelve_softc *, int); struct wsdisplay_accessops cgtwelve_accessops = { cgtwelve_ioctl, cgtwelve_mmap, - cgtwelve_alloc_screen, - cgtwelve_free_screen, - cgtwelve_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ NULL, /* burner */ + NULL /* pollc */ }; -int cgtwelvematch(struct device *, void *, void *); -void cgtwelveattach(struct device *, struct device *, void *); +int cgtwelvematch(struct device *, void *, void *); +void cgtwelveattach(struct device *, struct device *, void *); struct cfattach cgtwelve_ca = { sizeof(struct cgtwelve_softc), cgtwelvematch, cgtwelveattach @@ -127,13 +120,8 @@ struct cfdriver cgtwelve_cd = { }; -/* - * Match a cgtwelve. - */ int -cgtwelvematch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +cgtwelvematch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; @@ -145,13 +133,8 @@ cgtwelvematch(parent, vcf, aux) return (1); } -/* - * Attach a display. - */ void -cgtwelveattach(parent, self, args) - struct device *parent, *self; - void *args; +cgtwelveattach(struct device *parent, struct device *self, void *args) { struct cgtwelve_softc *sc = (struct cgtwelve_softc *)self; struct confargs *ca = args; @@ -232,12 +215,7 @@ cgtwelveattach(parent, self, args) } int -cgtwelve_ioctl(dev, cmd, data, flags, p) - void *dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +cgtwelve_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) { struct cgtwelve_softc *sc = dev; struct wsdisplay_fbinfo *wdf; @@ -287,13 +265,8 @@ cgtwelve_ioctl(dev, cmd, data, flags, p) return (0); } -/* - * Clean up hardware state (e.g., after bootup or after X crashes). - */ void -cgtwelve_reset(sc, depth) - struct cgtwelve_softc *sc; - int depth; +cgtwelve_reset(struct cgtwelve_softc *sc, int depth) { u_int32_t c; @@ -391,15 +364,8 @@ cgtwelve_reset(sc, depth) sc->sc_sunfb.sf_depth = depth; } -/* - * 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 -cgtwelve_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +cgtwelve_mmap(void *v, off_t offset, int prot) { struct cgtwelve_softc *sc = v; @@ -416,50 +382,7 @@ cgtwelve_mmap(v, offset, prot) CG12_OFF_INTEN) + offset) | PMAP_NC); } - return (-1); /* not a user-map offset */ -} - -int -cgtwelve_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct cgtwelve_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, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -cgtwelve_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct cgtwelve_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgtwelve_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); + return (-1); } /* diff --git a/sys/arch/sparc/dev/cgtwo.c b/sys/arch/sparc/dev/cgtwo.c index d6da8228a8e..156d77dd3b8 100644 --- a/sys/arch/sparc/dev/cgtwo.c +++ b/sys/arch/sparc/dev/cgtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwo.c,v 1.32 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: cgtwo.c,v 1.33 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: cgtwo.c,v 1.22 1997/05/24 20:16:12 pk Exp $ */ /* @@ -96,7 +96,6 @@ #include #include -#include #include #include @@ -110,34 +109,30 @@ struct cgtwo_softc { #define sc_redmap(cmap) ((u_short *)(cmap)) #define sc_greenmap(cmap) ((u_short *)(cmap) + CG2_CMSIZE) #define sc_bluemap(cmap) ((u_short *)(cmap) + 2 * CG2_CMSIZE) - int sc_nscreens; }; -int cgtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgtwo_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgtwo_free_screen(void *, void *); -int cgtwo_show_screen(void *, void *, int, void (*)(void *, int, int), void *); -paddr_t cgtwo_mmap(void *, off_t, int); -int cgtwo_putcmap(volatile u_short *, struct wsdisplay_cmap *); -int cgtwo_getcmap(volatile u_short *, struct wsdisplay_cmap *); -void cgtwo_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -void cgtwo_burner(void *, u_int, u_int); +void cgtwo_burner(void *, u_int, u_int); +int cgtwo_getcmap(volatile u_short *, struct wsdisplay_cmap *); +int cgtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t cgtwo_mmap(void *, off_t, int); +int cgtwo_putcmap(volatile u_short *, struct wsdisplay_cmap *); +void cgtwo_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops cgtwo_accessops = { cgtwo_ioctl, cgtwo_mmap, - cgtwo_alloc_screen, - cgtwo_free_screen, - cgtwo_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ cgtwo_burner, + NULL /* pollc */ }; -int cgtwomatch(struct device *, void *, void *); -void cgtwoattach(struct device *, struct device *, void *); +int cgtwomatch(struct device *, void *, void *); +void cgtwoattach(struct device *, struct device *, void *); struct cfattach cgtwo_ca = { sizeof(struct cgtwo_softc), cgtwomatch, cgtwoattach @@ -147,13 +142,8 @@ struct cfdriver cgtwo_cd = { NULL, "cgtwo", DV_DULL }; -/* - * Match a cgtwo. - */ int -cgtwomatch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +cgtwomatch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; struct confargs *ca = aux; @@ -175,13 +165,8 @@ cgtwomatch(parent, vcf, aux) return (0); } -/* - * Attach a display. - */ void -cgtwoattach(parent, self, args) - struct device *parent, *self; - void *args; +cgtwoattach(struct device *parent, struct device *self, void *args) { struct cgtwo_softc *sc = (struct cgtwo_softc *)self; struct confargs *ca = args; @@ -251,12 +236,7 @@ cgtwoattach(parent, self, args) } int -cgtwo_ioctl(v, cmd, data, flags, p) - void *v; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +cgtwo_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct cgtwo_softc *sc = v; struct wsdisplay_fbinfo *wdf; @@ -308,54 +288,8 @@ cgtwo_ioctl(v, cmd, data, flags, p) return (0); } -int -cgtwo_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct cgtwo_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 -cgtwo_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct cgtwo_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgtwo_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - paddr_t -cgtwo_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +cgtwo_mmap(void *v, off_t offset, int prot) { struct cgtwo_softc *sc = v; @@ -371,9 +305,7 @@ cgtwo_mmap(v, offset, prot) } void -cgtwo_burner(v, on, flags) - void *v; - u_int on, flags; +cgtwo_burner(void *v, u_int on, u_int flags) { struct cgtwo_softc *sc = v; int s; @@ -387,9 +319,7 @@ cgtwo_burner(v, on, flags) } int -cgtwo_getcmap(hwcmap, cmap) - volatile u_short *hwcmap; - struct wsdisplay_cmap *cmap; +cgtwo_getcmap(volatile u_short *hwcmap, struct wsdisplay_cmap *cmap) { u_int index = cmap->index, count = cmap->count, i; u_char red[CG2_CMSIZE], green[CG2_CMSIZE], blue[CG2_CMSIZE]; @@ -425,9 +355,7 @@ cgtwo_getcmap(hwcmap, cmap) } int -cgtwo_putcmap(hwcmap, cmap) - volatile u_short *hwcmap; - struct wsdisplay_cmap *cmap; +cgtwo_putcmap(volatile u_short *hwcmap, struct wsdisplay_cmap *cmap) { u_int index = cmap->index, count = cmap->count, i; u_char red[CG2_CMSIZE], green[CG2_CMSIZE], blue[CG2_CMSIZE]; @@ -462,28 +390,12 @@ cgtwo_putcmap(hwcmap, cmap) } void -cgtwo_setcolor(v, index, r, g, b) - void *v; - u_int index; - u_int8_t r, g, b; +cgtwo_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) { struct cgtwo_softc *sc = v; -#if 0 - struct wsdisplay_cmap cm; - - cm.red = &r; - cm.green = &g; - cm.blue = &b; - cm.index = index; - cm.count = 1; - - cgtwo_putcmap(sc->sc_cmap, &cm); -#else /* XXX - Wait for retrace? */ - sc_redmap(sc->sc_cmap)[index] = r; sc_greenmap(sc->sc_cmap)[index] = g; sc_bluemap(sc->sc_cmap)[index] = b; -#endif } diff --git a/sys/arch/sparc/dev/fb.c b/sys/arch/sparc/dev/fb.c index c323338b8a2..d3fef4d283a 100644 --- a/sys/arch/sparc/dev/fb.c +++ b/sys/arch/sparc/dev/fb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fb.c,v 1.33 2005/03/15 18:40:12 miod Exp $ */ +/* $OpenBSD: fb.c,v 1.34 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: fb.c,v 1.23 1997/07/07 23:30:22 pk Exp $ */ /* @@ -111,6 +111,11 @@ static int a2int(char *, int); #endif static void fb_initwsd(struct sunfb *); static void fb_updatecursor(struct rasops_info *); +int fb_alloc_screen(void *, const struct wsscreen_descr *, void **, + int *, int *, long *); +void fb_free_screen(void *, void *); +int fb_show_screen(void *, void *, int, void (*)(void *, int, int), + void *); void fb_setsize(struct sunfb *sf, int def_depth, int def_width, int def_height, @@ -470,6 +475,13 @@ fbwscons_attach(struct sunfb *sf, struct wsdisplay_accessops *op, int isconsole) fb_cookie = sf; } + /* plug common wsdisplay_accessops if necessary */ + if (op->alloc_screen == NULL) { + op->alloc_screen = fb_alloc_screen; + op->free_screen = fb_free_screen; + op->show_screen = fb_show_screen; + } + scrlist[0] = &sf->sf_wsd; screenlist.nscreens = 1; screenlist.screens = (const struct wsscreen_descr **)scrlist; @@ -481,18 +493,57 @@ fbwscons_attach(struct sunfb *sf, struct wsdisplay_accessops *op, int isconsole) config_found(&sf->sf_dev, &waa, wsemuldisplaydevprint); } +/* + * Common wsdisplay_accessops routines. + */ +int +fb_alloc_screen(void *v, const struct wsscreen_descr *type, + void **cookiep, int *curxp, int *curyp, long *attrp) +{ + struct sunfb *sf = v; + + if (sf->sf_nscreens > 0) + return (ENOMEM); + + *cookiep = &sf->sf_ro; + *curyp = 0; + *curxp = 0; + if (sf->sf_depth == 8) { + sf->sf_ro.ri_ops.alloc_attr(&sf->sf_ro, + WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); + } else { + sf->sf_ro.ri_ops.alloc_attr(&sf->sf_ro, + 0, 0, 0, attrp); + } + sf->sf_nscreens++; + return (0); +} + +void +fb_free_screen(void *v, void *cookie) +{ + struct sunfb *sf = v; + + sf->sf_nscreens--; +} + +int +fb_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), + void *cbarg) +{ + return (0); +} + #if defined(SUN4) + /* - * Support routines for pfour framebuffers. + * Support routines for P4 framebuffers. */ /* - * Probe for a pfour framebuffer. Return values: - * - * PFOUR_NOTPFOUR framebuffer is not a pfour - * framebuffer - * - * otherwise returns pfour ID + * Probe for a P4 framebuffer. Return values: + * PFOUR_NOTPFOUR framebuffer is not a P4 framebuffer + * otherwise returns P4 ID */ int fb_pfour_id(void *va) @@ -517,23 +568,13 @@ fb_pfour_id(void *va) return (PFOUR_ID(val)); } - -/* - * Return the status of the video enable. - */ -int -fb_pfour_get_video(struct sunfb *sf) -{ - - return ((*sf->sf_pfour & PFOUR_REG_VIDEO) != 0); -} - /* - * Enable or disable the framebuffer. + * Screen burner routine for P4 */ void -fb_pfour_set_video(struct sunfb *sf, int enable) +fb_pfour_burner(void *v, u_int enable, u_int flags) { + struct sunfb *sf = (struct sunfb *)v; volatile u_int32_t pfour; pfour = *sf->sf_pfour & ~(PFOUR_REG_INTCLR | PFOUR_REG_VIDEO); diff --git a/sys/arch/sparc/dev/mgx.c b/sys/arch/sparc/dev/mgx.c index 94b3c8fa4b0..0ef96cbbb68 100644 --- a/sys/arch/sparc/dev/mgx.c +++ b/sys/arch/sparc/dev/mgx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mgx.c,v 1.9 2005/03/13 23:05:22 miod Exp $ */ +/* $OpenBSD: mgx.c,v 1.10 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -54,7 +54,6 @@ #include #include -#include #include #include @@ -85,37 +84,31 @@ struct mgx_softc { struct rom_reg sc_phys; u_int8_t sc_cmap[256 * 3]; /* shadow colormap */ volatile u_int8_t *sc_vidc; /* ramdac registers */ - - int sc_nscreens; }; -int mgx_ioctl(void *, u_long, caddr_t, int, struct proc *); -int mgx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void mgx_free_screen(void *, void *); -int mgx_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t mgx_mmap(void *, off_t, int); -void mgx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -int mgx_getcmap(u_int8_t *, struct wsdisplay_cmap *); -int mgx_putcmap(u_int8_t *, struct wsdisplay_cmap *); -void mgx_loadcmap(struct mgx_softc *, int, int); -void mgx_burner(void *, u_int ,u_int); +void mgx_burner(void *, u_int ,u_int); +int mgx_getcmap(u_int8_t *, struct wsdisplay_cmap *); +int mgx_ioctl(void *, u_long, caddr_t, int, struct proc *); +void mgx_loadcmap(struct mgx_softc *, int, int); +paddr_t mgx_mmap(void *, off_t, int); +int mgx_putcmap(u_int8_t *, struct wsdisplay_cmap *); +void mgx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops mgx_accessops = { mgx_ioctl, mgx_mmap, - mgx_alloc_screen, - mgx_free_screen, - mgx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ - mgx_burner + mgx_burner, + NULL /* pollc */ }; -int mgxmatch(struct device *, void *, void *); -void mgxattach(struct device *, struct device *, void *); +int mgxmatch(struct device *, void *, void *); +void mgxattach(struct device *, struct device *, void *); struct cfattach mgx_ca = { sizeof(struct mgx_softc), mgxmatch, mgxattach @@ -275,39 +268,6 @@ mgx_mmap(void *v, off_t offset, int prot) return (-1); } -int -mgx_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct mgx_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, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -mgx_free_screen(void *v, void *cookie) -{ - struct mgx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -mgx_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - void mgx_burner(void *v, u_int on, u_int flags) { diff --git a/sys/arch/sparc/dev/p9000.c b/sys/arch/sparc/dev/p9000.c index 93fe1a9bee7..550471fc7a1 100644 --- a/sys/arch/sparc/dev/p9000.c +++ b/sys/arch/sparc/dev/p9000.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p9000.c,v 1.13 2005/03/23 17:15:44 miod Exp $ */ +/* $OpenBSD: p9000.c,v 1.14 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. @@ -49,7 +49,6 @@ #include #include -#include #include #include @@ -76,20 +75,14 @@ struct p9000_softc { union bt_cmap sc_cmap; /* Brooktree color map */ volatile u_int8_t *sc_ramdac; /* BT445 registers */ struct intrhand sc_ih; - int sc_nscreens; u_int32_t sc_junk; /* throwaway value */ }; int p9000_ioctl(void *, u_long, caddr_t, int, struct proc *); -int p9000_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void p9000_free_screen(void *, void *); -int p9000_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t p9000_mmap(void *, off_t, int); -static __inline__ void p9000_loadcmap_deferred(struct p9000_softc *, - u_int, u_int); +static __inline__ +void p9000_loadcmap_deferred(struct p9000_softc *, u_int, u_int); void p9000_loadcmap_immediate(struct p9000_softc *, u_int, u_int); +paddr_t p9000_mmap(void *, off_t, int); void p9000_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); void p9000_burner(void *, u_int, u_int); int p9000_intr(void *); @@ -97,21 +90,22 @@ int p9000_intr(void *); struct wsdisplay_accessops p9000_accessops = { p9000_ioctl, p9000_mmap, - p9000_alloc_screen, - p9000_free_screen, - p9000_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ p9000_burner, + NULL /* pollc */ }; -void p9000_ras_init(struct p9000_softc *); void p9000_ras_copycols(void *, int, int, int, int); void p9000_ras_copyrows(void *, int, int, int); void p9000_ras_do_cursor(struct rasops_info *); void p9000_ras_erasecols(void *, int, int, int, long int); void p9000_ras_eraserows(void *, int, int, long int); +void p9000_ras_init(struct p9000_softc *); int p9000match(struct device *, void *, void *); void p9000attach(struct device *, struct device *, void *); @@ -390,43 +384,6 @@ p9000_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -p9000_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct p9000_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 -p9000_free_screen(void *v, void *cookie) -{ - struct p9000_softc *sc = v; - - sc->sc_nscreens--; -} - -int -p9000_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - -/* - * 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 p9000_mmap(void *v, off_t offset, int prot) { diff --git a/sys/arch/sparc/dev/p9100.c b/sys/arch/sparc/dev/p9100.c index 0f487f9fa6a..b8f5aca9970 100644 --- a/sys/arch/sparc/dev/p9100.c +++ b/sys/arch/sparc/dev/p9100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p9100.c,v 1.34 2005/03/23 17:15:44 miod Exp $ */ +/* $OpenBSD: p9100.c,v 1.35 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. @@ -52,7 +52,6 @@ #include #include -#include #include #include @@ -76,42 +75,37 @@ struct p9100_softc { volatile u_int8_t *sc_ctl; /* control registers (draw engine) */ union bt_cmap sc_cmap; /* Brooktree color map */ struct intrhand sc_ih; - int sc_nscreens; u_int32_t sc_junk; /* throwaway value */ }; +void p9100_burner(void *, u_int, u_int); +int p9100_intr(void *); int p9100_ioctl(void *, u_long, caddr_t, int, struct proc *); -int p9100_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void p9100_free_screen(void *, void *); -int p9100_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t p9100_mmap(void *, off_t, int); -static __inline__ void p9100_loadcmap_deferred(struct p9100_softc *, - u_int, u_int); +static __inline__ +void p9100_loadcmap_deferred(struct p9100_softc *, u_int, u_int); void p9100_loadcmap_immediate(struct p9100_softc *, u_int, u_int); +paddr_t p9100_mmap(void *, off_t, int); void p9100_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -void p9100_burner(void *, u_int, u_int); -int p9100_intr(void *); struct wsdisplay_accessops p9100_accessops = { p9100_ioctl, p9100_mmap, - p9100_alloc_screen, - p9100_free_screen, - p9100_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ p9100_burner, + NULL /* pollc */ }; -void p9100_ras_init(struct p9100_softc *); void p9100_ras_copycols(void *, int, int, int, int); void p9100_ras_copyrows(void *, int, int, int); void p9100_ras_do_cursor(struct rasops_info *); void p9100_ras_erasecols(void *, int, int, int, long int); void p9100_ras_eraserows(void *, int, int, long int); +void p9100_ras_init(struct p9100_softc *); int p9100match(struct device *, void *, void *); void p9100attach(struct device *, struct device *, void *); @@ -434,48 +428,6 @@ p9100_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -p9100_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct p9100_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - if (sc->sc_sunfb.sf_depth == 8) { - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - } else { - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - 0, 0, 0, attrp); - } - sc->sc_nscreens++; - return (0); -} - -void -p9100_free_screen(void *v, void *cookie) -{ - struct p9100_softc *sc = v; - - sc->sc_nscreens--; -} - -int -p9100_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - -/* - * 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 p9100_mmap(void *v, off_t offset, int prot) { diff --git a/sys/arch/sparc/dev/rfx.c b/sys/arch/sparc/dev/rfx.c index d79e4c9acd4..41fcaa42351 100644 --- a/sys/arch/sparc/dev/rfx.c +++ b/sys/arch/sparc/dev/rfx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfx.c,v 1.9 2005/03/13 23:05:22 miod Exp $ */ +/* $OpenBSD: rfx.c,v 1.10 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. @@ -51,7 +51,6 @@ #include #include -#include #include #include @@ -114,17 +113,10 @@ struct rfx_softc { struct rfx_cmap sc_cmap; volatile u_int8_t *sc_ramdac; volatile u_int32_t *sc_ctrl; - - int sc_nscreens; }; -int rfx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); void rfx_burner(void *, u_int, u_int); -void rfx_free_screen(void *, void *); int rfx_ioctl(void *, u_long, caddr_t, int, struct proc *); -int rfx_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t rfx_mmap(void *, off_t, int); int rfx_getcmap(struct rfx_cmap *, struct wsdisplay_cmap *); @@ -137,13 +129,14 @@ void rfx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops rfx_accessops = { rfx_ioctl, rfx_mmap, - rfx_alloc_screen, - rfx_free_screen, - rfx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ rfx_burner, + NULL /* pollc */ }; int rfxmatch(struct device *, void *, void *); @@ -368,39 +361,6 @@ rfx_mmap(void *v, off_t offset, int prot) return (-1); } -int -rfx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct rfx_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 -rfx_free_screen(void *v, void *cookie) -{ - struct rfx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -rfx_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - void rfx_burner(void *v, u_int on, u_int flags) { @@ -547,9 +507,4 @@ rfx_initialize(struct rfx_softc *sc, struct rfx_config *cf) cnt--; } - -#ifdef DEBUG - if (cnt != 0) - printf("%s: incoherent initialization data!\n"); -#endif } diff --git a/sys/arch/sparc/dev/tcx.c b/sys/arch/sparc/dev/tcx.c index b27df78657d..4b1e5c5e4ac 100644 --- a/sys/arch/sparc/dev/tcx.c +++ b/sys/arch/sparc/dev/tcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcx.c,v 1.24 2005/03/13 23:05:22 miod Exp $ */ +/* $OpenBSD: tcx.c,v 1.25 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: tcx.c,v 1.8 1997/07/29 09:58:14 fair Exp $ */ /* @@ -84,7 +84,6 @@ #include #include -#include #include #include @@ -107,37 +106,33 @@ struct tcx_softc { volatile u_int32_t *sc_cplane; /* S24 control plane */ union bt_cmap sc_cmap; /* Brooktree color map */ struct intrhand sc_ih; - int sc_nscreens; }; -int tcx_ioctl(void *, u_long, caddr_t, int, struct proc *); -int tcx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void tcx_free_screen(void *, void *); -int tcx_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t tcx_mmap(void *, off_t, int); -void tcx_reset(struct tcx_softc *, int); -void tcx_burner(void *, u_int, u_int); -void tcx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -static __inline__ void tcx_loadcmap_deferred(struct tcx_softc *, u_int, u_int); -int tcx_intr(void *); -void tcx_prom(void *); +void tcx_burner(void *, u_int, u_int); +int tcx_intr(void *); +int tcx_ioctl(void *, u_long, caddr_t, int, struct proc *); +static __inline__ +void tcx_loadcmap_deferred(struct tcx_softc *, u_int, u_int); +paddr_t tcx_mmap(void *, off_t, int); +void tcx_reset(struct tcx_softc *, int); +void tcx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); +void tcx_prom(void *); struct wsdisplay_accessops tcx_accessops = { tcx_ioctl, tcx_mmap, - tcx_alloc_screen, - tcx_free_screen, - tcx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ tcx_burner, + NULL /* pollc */ }; -int tcxmatch(struct device *, void *, void *); -void tcxattach(struct device *, struct device *, void *); +int tcxmatch(struct device *, void *, void *); +void tcxattach(struct device *, struct device *, void *); struct cfattach tcx_ca = { sizeof(struct tcx_softc), tcxmatch, tcxattach @@ -165,13 +160,8 @@ struct cfdriver tcx_cd = { #define TCX_CTL_24_LEVEL 0x03000000 /* 24 bits, true color */ #define TCX_CTL_PIXELMASK 0x00ffffff /* mask for index/level */ -/* - * Match a tcx. - */ int -tcxmatch(parent, vcf, aux) - struct device *parent; - void *vcf, *aux; +tcxmatch(struct device *parent, void *vcf, void *aux) { struct confargs *ca = aux; struct romaux *ra = &ca->ca_ra; @@ -182,13 +172,8 @@ tcxmatch(parent, vcf, aux) return (1); } -/* - * Attach a display. - */ void -tcxattach(parent, self, args) - struct device *parent, *self; - void *args; +tcxattach(struct device *parent, struct device *self, void *args) { struct tcx_softc *sc = (struct tcx_softc *)self; struct confargs *ca = args; @@ -277,12 +262,7 @@ tcxattach(parent, self, args) } int -tcx_ioctl(dev, cmd, data, flags, p) - void *dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +tcx_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) { struct tcx_softc *sc = dev; struct wsdisplay_cmap *cm; @@ -355,13 +335,8 @@ tcx_ioctl(dev, cmd, data, flags, p) return (0); } -/* - * Clean up hardware state (e.g., after bootup or after X crashes). - */ void -tcx_reset(sc, depth) - struct tcx_softc *sc; - int depth; +tcx_reset(struct tcx_softc *sc, int depth) { volatile struct bt_regs *bt; @@ -405,30 +380,27 @@ tcx_reset(sc, depth) } void -tcx_prom(v) - void *v; +tcx_prom(void *v) { struct tcx_softc *sc = v; extern struct consdev consdev_prom; if (sc->sc_sunfb.sf_depth != 8) { /* - * Select 8-bit mode. - */ + * Select 8-bit mode. + */ tcx_reset(sc, 8); /* - * Go back to prom output for the last few messages, so they - * will be displayed correctly. - */ + * Go back to prom output for the last few messages, so they + * will be displayed correctly. + */ cn_tab = &consdev_prom; } } void -tcx_burner(v, on, flags) - void *v; - u_int on, flags; +tcx_burner(void *v, u_int on, u_int flags) { struct tcx_softc *sc = v; int s; @@ -448,15 +420,8 @@ tcx_burner(v, on, flags) splx(s); } -/* - * 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 -tcx_mmap(v, offset, prot) - void *v; - off_t offset; - int prot; +tcx_mmap(void *v, off_t offset, int prot) { struct tcx_softc *sc = v; @@ -471,63 +436,17 @@ tcx_mmap(v, offset, prot) return (REG2PHYS(&sc->sc_phys[TCX_REG_DFB24], offset) | PMAP_NC); - return (-1); /* not a user-map offset */ + return (-1); } void -tcx_setcolor(v, index, r, g, b) - void *v; - u_int index; - u_int8_t r, g, b; +tcx_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) { struct tcx_softc *sc = v; bt_setcolor(&sc->sc_cmap, sc->sc_bt, index, r, g, b, 1); } -int -tcx_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct tcx_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 -tcx_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct tcx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -tcx_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - static __inline__ void tcx_loadcmap_deferred(struct tcx_softc *sc, u_int start, u_int ncolors) { @@ -539,8 +458,7 @@ tcx_loadcmap_deferred(struct tcx_softc *sc, u_int start, u_int ncolors) } int -tcx_intr(v) - void *v; +tcx_intr(void *v) { struct tcx_softc *sc = v; u_int32_t thcm; diff --git a/sys/arch/sparc/dev/tvtwo.c b/sys/arch/sparc/dev/tvtwo.c index de2b3bd1da5..01060ec0261 100644 --- a/sys/arch/sparc/dev/tvtwo.c +++ b/sys/arch/sparc/dev/tvtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tvtwo.c,v 1.7 2005/03/07 21:21:03 miod Exp $ */ +/* $OpenBSD: tvtwo.c,v 1.8 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -126,16 +126,9 @@ struct tvtwo_softc { struct rom_reg sc_phys; volatile u_int8_t *sc_regs; - - int sc_nscreens; }; int tvtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); -int tvtwo_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void tvtwo_free_screen(void *, void *); -int tvtwo_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t tvtwo_mmap(void *, off_t, int); void tvtwo_burner(void *, u_int, u_int); @@ -146,13 +139,14 @@ void tvtwo_initcmap(struct tvtwo_softc *); struct wsdisplay_accessops tvtwo_accessops = { tvtwo_ioctl, tvtwo_mmap, - tvtwo_alloc_screen, - tvtwo_free_screen, - tvtwo_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ tvtwo_burner, + NULL /* pollc */ }; int tvtwomatch(struct device *, void *, void *); @@ -189,9 +183,6 @@ tvtwomatch(struct device *parent, void *vcf, void *aux) return (0); } -/* - * Attach a display. - */ void tvtwoattach(struct device *parent, struct device *self, void *args) { @@ -302,10 +293,6 @@ tvtwo_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -/* - * 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 tvtwo_mmap(void *v, off_t offset, int prot) { @@ -323,39 +310,6 @@ tvtwo_mmap(void *v, off_t offset, int prot) return (-1); } -int -tvtwo_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct tvtwo_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, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -tvtwo_free_screen(void *v, void *cookie) -{ - struct tvtwo_softc *sc = v; - - sc->sc_nscreens--; -} - -int -tvtwo_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - /* * Simple Bt463 programming routines. */ diff --git a/sys/arch/sparc/dev/vigra.c b/sys/arch/sparc/dev/vigra.c index 3df2c6f4644..645a42da79f 100644 --- a/sys/arch/sparc/dev/vigra.c +++ b/sys/arch/sparc/dev/vigra.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vigra.c,v 1.14 2005/03/07 16:44:50 miod Exp $ */ +/* $OpenBSD: vigra.c,v 1.15 2005/03/23 17:16:34 miod Exp $ */ /* * Copyright (c) 2002, 2003, Miodrag Vallat. @@ -55,7 +55,6 @@ #include #include -#include #include #include @@ -181,35 +180,30 @@ struct vigra_softc { union vigracmap sc_cmap; /* current colormap */ int sc_g300; struct intrhand sc_ih; - int sc_nscreens; }; -int vigra_ioctl(void *, u_long, caddr_t, int, struct proc *); -int vigra_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void vigra_free_screen(void *, void *); -int vigra_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); -paddr_t vigra_mmap(void *, off_t, int); -void vigra_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -int vigra_getcmap(union vigracmap *, struct wsdisplay_cmap *, int); -int vigra_putcmap(union vigracmap *, struct wsdisplay_cmap *, int); -void vigra_loadcmap_immediate(struct vigra_softc *, int, int); -static __inline__ void vigra_loadcmap_deferred(struct vigra_softc *, - u_int, u_int); -void vigra_burner(void *, u_int, u_int); -int vigra_intr(void *); +void vigra_burner(void *, u_int, u_int); +int vigra_getcmap(union vigracmap *, struct wsdisplay_cmap *, int); +int vigra_intr(void *); +int vigra_ioctl(void *, u_long, caddr_t, int, struct proc *); +static __inline__ +void vigra_loadcmap_deferred(struct vigra_softc *, u_int, u_int); +void vigra_loadcmap_immediate(struct vigra_softc *, int, int); +paddr_t vigra_mmap(void *, off_t, int); +int vigra_putcmap(union vigracmap *, struct wsdisplay_cmap *, int); +void vigra_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops vigra_accessops = { vigra_ioctl, vigra_mmap, - vigra_alloc_screen, - vigra_free_screen, - vigra_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ vigra_burner, + NULL /* pollc */ }; int vigramatch(struct device *, void *, void *); @@ -386,43 +380,6 @@ vigra_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -vigra_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct vigra_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 -vigra_free_screen(void *v, void *cookie) -{ - struct vigra_softc *sc = v; - - sc->sc_nscreens--; -} - -int -vigra_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - -/* - * 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 vigra_mmap(void *v, off_t offset, int prot) { diff --git a/sys/arch/sparc/dev/zx.c b/sys/arch/sparc/dev/zx.c index 81df452e679..9398deaaefe 100644 --- a/sys/arch/sparc/dev/zx.c +++ b/sys/arch/sparc/dev/zx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zx.c,v 1.11 2005/03/13 23:05:22 miod Exp $ */ +/* $OpenBSD: zx.c,v 1.12 2005/03/23 17:16:34 miod Exp $ */ /* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */ /* @@ -88,7 +88,6 @@ #include #include -#include #include #include @@ -123,29 +122,25 @@ struct zx_softc { volatile struct zx_draw_ss1 *sc_zd_ss1; volatile struct zx_cursor *sc_zcu; - int sc_nscreens; }; -int zx_ioctl(void *, u_long, caddr_t, int, struct proc *); -int zx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void zx_free_screen(void *, void *); -int zx_show_screen(void *, void *, int, void (*)(void *, int, int), void *); -paddr_t zx_mmap(void *, off_t, int); -void zx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); -void zx_reset(struct zx_softc *, u_int); -void zx_burner(void *, u_int, u_int); +void zx_burner(void *, u_int, u_int); +int zx_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t zx_mmap(void *v, off_t offset, int prot); +void zx_reset(struct zx_softc *, u_int); +void zx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops zx_accessops = { zx_ioctl, zx_mmap, - zx_alloc_screen, - zx_free_screen, - zx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ - zx_burner + zx_burner, + NULL /* pollc */ }; /* Force 32-bit writes. */ @@ -162,20 +157,19 @@ struct wsdisplay_accessops zx_accessops = { void zx_attach(struct device *, struct device *, void *); int zx_match(struct device *, void *, void *); -int zx_putcmap(struct zx_softc *); void zx_copyrect(struct rasops_info *, int, int, int, int, int, int); int zx_cross_loadwid(struct zx_softc *, u_int, u_int, u_int); int zx_cross_wait(struct zx_softc *); void zx_fillrect(struct rasops_info *, int, int, int, int, long, int); int zx_intr(void *); -void zx_prom(void *); +int zx_putcmap(struct zx_softc *); -void zx_putchar(void *, int, int, u_int, long); void zx_copycols(void *, int, int, int, int); -void zx_erasecols(void *, int, int, int, long); void zx_copyrows(void *, int, int, int); -void zx_eraserows(void *, int, int, long); void zx_do_cursor(struct rasops_info *); +void zx_erasecols(void *, int, int, int, long); +void zx_eraserows(void *, int, int, long); +void zx_putchar(void *, int, int, u_int, long); struct cfattach zx_ca = { sizeof(struct zx_softc), zx_match, zx_attach @@ -259,11 +253,11 @@ zx_attach(struct device *parent, struct device *self, void *args) /* * Watch out! rasops_init() invoked via fbwscons_init() would - * not compute ri_bits correctly, if it had been tricked with the - * low depth value. So masquerade as 32 bits for the call. This - * will invoke rasops32_init() instead of rasops8_init(), but this - * doesn't matter as we will override all the rasops functions - * below. + * not compute ri_bits correctly when centering the display, if + * it had been tricked with the low depth value. So masquerade as + * 32 bits for the call. This will invoke rasops32_init() instead + * of rasops8_init(), but this doesn't matter as we will override + * all the rasops functions below. */ sc->sc_sunfb.sf_depth = 32; fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR); @@ -282,6 +276,7 @@ zx_attach(struct device *parent, struct device *self, void *args) } /* reset cursor & frame buffer controls */ + sc->sc_mode = ~WSDISPLAYIO_MODE_EMUL; /* force action */ zx_reset(sc, WSDISPLAYIO_MODE_EMUL); /* enable video */ @@ -337,39 +332,6 @@ zx_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -zx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct zx_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 -zx_free_screen(void *v, void *cookie) -{ - struct zx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -zx_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), - void *cbarg) -{ - return (0); -} - /* * Return the address that would map the given device at the given * offset, allowing for the given protection, or return -1 for error. @@ -409,6 +371,9 @@ zx_reset(struct zx_softc *sc, u_int mode) const u_char *color; u_int8_t *r, *g, *b; + if (mode == sc->sc_mode) + return; + zd = sc->sc_zd_ss0; zc = sc->sc_zc; @@ -478,6 +443,8 @@ zx_reset(struct zx_softc *sc, u_int mode) SETREG(zd->zd_rop, ZX_ATTR_RGBE_ENABLE | ZX_ROP_NEW /* | ZX_ATTR_FORCE_WID */); } + + sc->sc_mode = mode; } int @@ -576,7 +543,7 @@ zx_burner(void *v, u_int on, u_int flags) void zx_fillrect(struct rasops_info *ri, int x, int y, int w, int h, long attr, - int rop) + int rop) { struct zx_softc *sc; volatile struct zx_command *zc; @@ -604,7 +571,7 @@ zx_fillrect(struct rasops_info *ri, int x, int y, int w, int h, long attr, void zx_copyrect(struct rasops_info *ri, int sx, int sy, int dx, int dy, int w, - int h) + int h) { struct zx_softc *sc; volatile struct zx_command *zc; diff --git a/sys/arch/sparc/include/fbvar.h b/sys/arch/sparc/include/fbvar.h index 9bb3e9636d7..ae15a42f13d 100644 --- a/sys/arch/sparc/include/fbvar.h +++ b/sys/arch/sparc/include/fbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fbvar.h,v 1.13 2005/03/07 16:44:52 miod Exp $ */ +/* $OpenBSD: fbvar.h,v 1.14 2005/03/23 17:16:36 miod Exp $ */ /* $NetBSD: fbvar.h,v 1.9 1997/07/07 23:31:30 pk Exp $ */ /* @@ -70,6 +70,7 @@ struct sunfb { struct rasops_info sf_ro; struct wsscreen_descr sf_wsd; + int sf_nscreens; }; /* @@ -86,6 +87,5 @@ void fbwscons_attach(struct sunfb *, struct wsdisplay_accessops *, int); #if defined(SUN4) int fb_pfour_id(void *); -int fb_pfour_get_video(struct sunfb *); -void fb_pfour_set_video(struct sunfb *, int); +void fb_pfour_burner(void *, u_int, u_int); #endif -- cgit v1.2.3