summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorEric Jackson <ericj@cvs.openbsd.org>2000-08-04 16:45:48 +0000
committerEric Jackson <ericj@cvs.openbsd.org>2000-08-04 16:45:48 +0000
commite640d975aff83d74ed898bc9958819ffef6d5024 (patch)
tree258685ed60b92e2309cf6b7e65e4bc0c32d0112c /sys/arch/alpha
parentb1ab130ebe1061631d5465253f2334914def8120 (diff)
convert sfb and cfb to use new wscons; from NetBSD.
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/tc/cfb.c187
-rw-r--r--sys/arch/alpha/tc/cfbvar.h9
-rw-r--r--sys/arch/alpha/tc/sfb.c185
-rw-r--r--sys/arch/alpha/tc/sfbvar.h9
4 files changed, 237 insertions, 153 deletions
diff --git a/sys/arch/alpha/tc/cfb.c b/sys/arch/alpha/tc/cfb.c
index 622aa607dc9..09a059f245d 100644
--- a/sys/arch/alpha/tc/cfb.c
+++ b/sys/arch/alpha/tc/cfb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfb.c,v 1.10 1998/11/21 18:13:03 millert Exp $ */
+/* $OpenBSD: cfb.c,v 1.11 2000/08/04 16:45:47 ericj Exp $ */
/* $NetBSD: cfb.c,v 1.7 1996/12/05 01:39:39 cgd Exp $ */
/*
@@ -43,13 +43,10 @@
#include <dev/tc/tcvar.h>
#include <machine/cfbreg.h>
#include <alpha/tc/cfbvar.h>
-#if 0
-#include <alpha/tc/bt459reg.h>
-#endif
#include <dev/rcons/raster.h>
#include <dev/wscons/wscons_raster.h>
-#include <dev/wscons/wsconsvar.h>
+#include <dev/wscons/wsdisplayvar.h>
#include <machine/fbio.h>
#include <machine/autoconf.h>
@@ -61,7 +58,6 @@ int cfbmatch __P((struct device *, void *, void *));
int cfbmatch __P((struct device *, struct cfdata *, void *));
#endif
void cfbattach __P((struct device *, struct device *, void *));
-int cfbprint __P((void *, const char *));
struct cfattach cfb_ca = {
sizeof(struct cfb_softc), cfbmatch, cfbattach,
@@ -73,21 +69,52 @@ struct cfdriver cfb_cd = {
void cfb_getdevconfig __P((tc_addr_t dense_addr, struct cfb_devconfig *dc));
struct cfb_devconfig cfb_console_dc;
+tc_addr_t cfb_consaddr;
-struct wscons_emulfuncs cfb_emulfuncs = {
+struct wsdisplay_emulops cfb_emulfuncs = {
rcons_cursor, /* could use hardware cursor; punt */
- rcons_putstr,
+ rcons_mapchar,
+ rcons_putchar,
rcons_copycols,
rcons_erasecols,
rcons_copyrows,
rcons_eraserows,
- rcons_setattr,
+ rcons_alloc_attr
+};
+
+struct wsscreen_descr cfb_stdscreen = {
+ "std",
+ 0, 0, /* will be filled in -- XXX shouldn't, it's global */
+ &cfb_emulfuncs,
+ 0, 0
+};
+
+const struct wsscreen_descr *_cfb_scrlist[] = {
+ &cfb_stdscreen,
+ /* XXX other formats, graphics screen? */
+};
+
+struct wsscreen_list cfb_screenlist = {
+ sizeof(_cfb_scrlist) / sizeof(struct wsscreen_descr *), _cfb_scrlist
};
int cfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
int cfbmmap __P((void *, off_t, int));
int cfbintr __P((void *));
+static int cfb_alloc_screen __P((void *, const struct wsscreen_descr *,
+ void **, int *, int *, long *));
+static void cfb_free_screen __P((void *, void *));
+static int cfb_show_screen __P((void *, void *, int,
+ void (*) (void *, int, int), void *));
+
+struct wsdisplay_accessops cfb_accessops = {
+ cfbioctl,
+ cfbmmap,
+ cfb_alloc_screen,
+ cfb_free_screen,
+ cfb_show_screen,
+};
int
cfbmatch(parent, match, aux)
@@ -166,6 +193,9 @@ cfb_getdevconfig(dense_addr, dc)
rcp->rc_crowp = &rcp->rc_crow;
rcp->rc_ccolp = &rcp->rc_ccol;
rcons_init(rcp, 34, 80);
+
+ cfb_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
+ cfb_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
}
void
@@ -175,14 +205,14 @@ cfbattach(parent, self, aux)
{
struct cfb_softc *sc = (struct cfb_softc *)self;
struct tc_attach_args *ta = aux;
- struct wscons_attach_args waa;
- struct wscons_odev_spec *wo;
+ struct wsemuldisplaydev_attach_args waa;
int console;
- console = 0; /* XXX */
- if (console)
+ console = (ta->ta_addr == cfb_consaddr);
+ if (console) {
sc->sc_dc = &cfb_console_dc;
- else {
+ sc->nscreens = 1;
+ } else {
sc->sc_dc = (struct cfb_devconfig *)
malloc(sizeof(struct cfb_devconfig), M_DEVBUF, M_WAITOK);
cfb_getdevconfig(ta->ta_addr, sc->sc_dc);
@@ -199,33 +229,12 @@ cfbattach(parent, self, aux)
*(volatile u_int32_t *)(sc->sc_dc->dc_vaddr + CFB_IREQCTRL_OFFSET) = 0;
/* initialize the raster */
- waa.waa_isconsole = console;
- wo = &waa.waa_odev_spec;
-
- wo->wo_emulfuncs = &cfb_emulfuncs;
- wo->wo_emulfuncs_cookie = &sc->sc_dc->dc_rcons;
+ waa.console = console;
+ waa.scrdata = &cfb_screenlist;
+ waa.accessops = &cfb_accessops;
+ waa.accesscookie = sc;
- wo->wo_ioctl = cfbioctl;
- wo->wo_mmap = cfbmmap;
- wo->wo_miscfuncs_cookie = sc;
-
- wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
- wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
- wo->wo_crow = 0;
- wo->wo_ccol = 0;
-
- config_found(self, &waa, cfbprint);
-}
-
-int
-cfbprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
-
- if (pnp)
- printf("wscons at %s", pnp);
- return (UNCONF);
+ config_found(self, &waa, wsemuldisplaydevprint);
}
int
@@ -303,7 +312,7 @@ cfbmmap(v, offset, prot)
{
struct cfb_softc *sc = v;
- if (offset >= CFB_SIZE || offset < 0)
+ if (offset > CFB_SIZE)
return (-1);
return alpha_btop(sc->sc_dc->dc_paddr + offset);
}
@@ -319,41 +328,69 @@ cfbintr(v)
return (1);
}
-#if 0
+int
+cfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
+ void *v;
+ const struct wsscreen_descr *type;
+ void **cookiep;
+ int *curxp, *curyp;
+ long *attrp;
+{
+ struct cfb_softc *sc = v;
+ long defattr;
+
+ if (sc->nscreens > 0)
+ return (ENOMEM);
+
+ *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
+ *curxp = 0;
+ *curyp = 0;
+ rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
+ *attrp = defattr;
+ sc->nscreens++;
+ return(0);
+}
+
void
-tga_console(bc, pc, bus, device, function)
- bus_chipset_tag_t bc;
- pci_chipset_tag_t pc;
- int bus, device, function;
+cfb_free_screen(v, cookie)
+ void *v;
+ void *cookie;
{
- struct tga_devconfig *dcp = &tga_console_dc;
- struct wscons_odev_spec wo;
-
- tga_getdevconfig(bc, pc, pci_make_tag(pc, bus, device, function), dcp);
-
- /* sanity checks */
- if (dcp->dc_vaddr == NULL)
- panic("tga_console(%d, %d): couldn't map memory space",
- device, function);
- if (dcp->dc_tgaconf == NULL)
- panic("tga_console(%d, %d): unknown board configuration",
- device, function);
-
- /*
- * Initialize the RAMDAC but DO NOT allocate any private storage.
- * Initialization includes disabling cursor, setting a sane
- * colormap, etc. It will be reinitialized in tgaattach().
- */
- (*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0);
-
- wo.wo_ef = &tga_emulfuncs;
- wo.wo_efa = &dcp->dc_rcons;
- wo.wo_nrows = dcp->dc_rcons.rc_maxrow;
- wo.wo_ncols = dcp->dc_rcons.rc_maxcol;
- wo.wo_crow = 0;
- wo.wo_ccol = 0;
- /* ioctl and mmap are unused until real attachment. */
-
- wscons_attach_console(&wo);
+ struct cfb_softc *sc = v;
+
+ if (sc->sc_dc == &cfb_console_dc)
+ panic("cfb_free_screen: console");
+
+ sc->nscreens--;
+}
+
+int
+cfb_show_screen(v, cookie, waitok, cb, cbarg)
+ void *v;
+ void *cookie;
+ int waitok;
+ void (*cb) __P((void *, int, int));
+ void *cbarg;
+{
+ return (0);
+}
+
+#if 0
+int
+cfb_cnattach(addr)
+ tc_addr_t addr;
+{
+ struct cfb_devconfig *dc = &cfb_console_dc;
+ long defattr;
+
+ cfb_getdevconfig(addr, dcp);
+
+ rcons_alloc_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
+
+ wsdisplay_cnattach(&cfb_stdscreen, &dcp->dc_rcons,
+ 0,0, defattr;);
+
+ cfb_consaddr = addr;
+ return (0);
}
#endif
diff --git a/sys/arch/alpha/tc/cfbvar.h b/sys/arch/alpha/tc/cfbvar.h
index 6bb6217d0c6..1eada4d768e 100644
--- a/sys/arch/alpha/tc/cfbvar.h
+++ b/sys/arch/alpha/tc/cfbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfbvar.h,v 1.4 1997/11/06 12:27:05 niklas Exp $ */
+/* $OpenBSD: cfbvar.h,v 1.5 2000/08/04 16:45:47 ericj Exp $ */
/* $NetBSD: cfbvar.h,v 1.1 1996/05/01 23:25:04 cgd Exp $ */
/*
@@ -30,7 +30,6 @@
#include <machine/cfbreg.h>
#include <dev/rcons/raster.h>
-#include <dev/wscons/wsconsvar.h>
#include <dev/wscons/wscons_raster.h>
struct cfb_devconfig;
@@ -60,4 +59,10 @@ struct cfb_softc {
struct device sc_dev;
struct cfb_devconfig *sc_dc; /* device configuration */
+
+ int nscreens;
};
+
+#if 0
+int cfb_cnattach __P((tc_addr_t));
+#endif
diff --git a/sys/arch/alpha/tc/sfb.c b/sys/arch/alpha/tc/sfb.c
index 5bb7cabd239..727af13cac4 100644
--- a/sys/arch/alpha/tc/sfb.c
+++ b/sys/arch/alpha/tc/sfb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sfb.c,v 1.10 1998/11/21 18:13:04 millert Exp $ */
+/* $OpenBSD: sfb.c,v 1.11 2000/08/04 16:45:47 ericj Exp $ */
/* $NetBSD: sfb.c,v 1.7 1996/12/05 01:39:44 cgd Exp $ */
/*
@@ -43,13 +43,10 @@
#include <dev/tc/tcvar.h>
#include <machine/sfbreg.h>
#include <alpha/tc/sfbvar.h>
-#if 0
-#include <alpha/tc/bt459reg.h>
-#endif
#include <dev/rcons/raster.h>
#include <dev/wscons/wscons_raster.h>
-#include <dev/wscons/wsconsvar.h>
+#include <dev/wscons/wsdisplayvar.h>
#include <machine/fbio.h>
#include <machine/autoconf.h>
@@ -61,7 +58,6 @@ int sfbmatch __P((struct device *, void *, void *));
int sfbmatch __P((struct device *, struct cfdata *, void *));
#endif
void sfbattach __P((struct device *, struct device *, void *));
-int sfbprint __P((void *, const char *));
struct cfattach sfb_ca = {
sizeof(struct sfb_softc), sfbmatch, sfbattach,
@@ -73,25 +69,56 @@ struct cfdriver sfb_cd = {
void sfb_getdevconfig __P((tc_addr_t dense_addr, struct sfb_devconfig *dc));
struct sfb_devconfig sfb_console_dc;
+tc_addr_t sfb_consaddr;
+
+struct wsdisplay_emulops sfb_emulfuncs = {
+ rcons_cursor, /* could use hardware cursor; punt */
+ rcons_mapchar,
+ rcons_putchar,
+ rcons_copycols,
+ rcons_erasecols,
+ rcons_copyrows,
+ rcons_eraserows,
+ rcons_alloc_attr
+};
-struct wscons_emulfuncs sfb_emulfuncs = {
- rcons_cursor, /* could use hardware cursor; punt */
- rcons_putstr,
- rcons_copycols,
- rcons_erasecols,
- rcons_copyrows,
- rcons_eraserows,
- rcons_setattr,
+struct wsscreen_descr sfb_stdscreen = {
+ "std",
+ 0, 0, /* will be filled in -- XXX shouldn't, it's global */
+ &sfb_emulfuncs,
+ 0, 0
+};
+const struct wsscreen_descr *_sfb_scrlist[] = {
+ &sfb_stdscreen,
+ /* XXX other formats, graphics screen? */
+};
+
+struct wsscreen_list sfb_screenlist = {
+ sizeof(_sfb_scrlist) / sizeof(struct wsscreen_descr *), _sfb_scrlist
};
int sfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
int sfbmmap __P((void *, off_t, int));
+static int sfb_alloc_screen __P((void *, const struct wsscreen_descr *,
+ void **, int *, int *, long *));
+static void sfb_free_screen __P((void *, void *));
+static int sfb_show_screen __P((void *, void *, int,
+ void (*) (void *, int, int), void *));
+
#if 0
void sfb_blank __P((struct sfb_devconfig *));
void sfb_unblank __P((struct sfb_devconfig *));
#endif
+struct wsdisplay_accessops sfb_accessops = {
+ sfbioctl,
+ sfbmmap,
+ sfb_alloc_screen,
+ sfb_free_screen,
+ sfb_show_screen,
+};
+
int
sfbmatch(parent, match, aux)
struct device *parent;
@@ -206,6 +233,9 @@ sfb_getdevconfig(dense_addr, dc)
rcp->rc_crowp = &rcp->rc_crow;
rcp->rc_ccolp = &rcp->rc_ccol;
rcons_init(rcp, 34, 80);
+
+ sfb_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
+ sfb_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
}
void
@@ -215,14 +245,14 @@ sfbattach(parent, self, aux)
{
struct sfb_softc *sc = (struct sfb_softc *)self;
struct tc_attach_args *ta = aux;
- struct wscons_attach_args waa;
- struct wscons_odev_spec *wo;
+ struct wsemuldisplaydev_attach_args waa;
int console;
- console = 0; /* XXX */
- if (console)
+ console = (ta->ta_addr == sfb_consaddr);
+ if (console) {
sc->sc_dc = &sfb_console_dc;
- else {
+ sc->nscreens = 1;
+ } else {
sc->sc_dc = (struct sfb_devconfig *)
malloc(sizeof(struct sfb_devconfig), M_DEVBUF, M_WAITOK);
sfb_getdevconfig(ta->ta_addr, sc->sc_dc);
@@ -244,33 +274,12 @@ sfbattach(parent, self, aux)
*(u_int32_t *)(x + SFB_ASIC_VIDEO_VSETUP));
#endif
- waa.waa_isconsole = console;
- wo = &waa.waa_odev_spec;
-
- wo->wo_emulfuncs = &sfb_emulfuncs;
- wo->wo_emulfuncs_cookie = &sc->sc_dc->dc_rcons;
-
- wo->wo_ioctl = sfbioctl;
- wo->wo_mmap = sfbmmap;
- wo->wo_miscfuncs_cookie = sc;
-
- wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
- wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
- wo->wo_crow = 0;
- wo->wo_ccol = 0;
-
- config_found(self, &waa, sfbprint);
-}
-
-int
-sfbprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
+ waa.console = console;
+ waa.scrdata = &sfb_screenlist;
+ waa.accessops = &sfb_accessops;
+ waa.accesscookie = sc;
- if (pnp)
- printf("wscons at %s", pnp);
- return (UNCONF);
+ config_found(self, &waa, wsemuldisplaydevprint);
}
int
@@ -353,42 +362,70 @@ sfbmmap(v, offset, prot)
return alpha_btop(sc->sc_dc->dc_paddr + offset);
}
-#if 0
+int
+sfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
+ void *v;
+ const struct wsscreen_descr *type;
+ void **cookiep;
+ int *curxp, *curyp;
+ long *attrp;
+{
+ struct sfb_softc *sc = v;
+ long defattr;
+
+ if (sc->nscreens > 0)
+ return (ENOMEM);
+
+ *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
+ *curxp = 0;
+ *curyp = 0;
+ rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
+ *attrp = defattr;
+ sc->nscreens++;
+ return (0);
+}
+
void
-tga_console(bc, pc, bus, device, function)
- bus_chipset_tag_t bc;
- pci_chipset_tag_t pc;
- int bus, device, function;
+sfb_free_screen(v, cookie)
+ void *v;
+ void *cookie;
{
- struct tga_devconfig *dcp = &tga_console_dc;
- struct wscons_odev_spec wo;
+ struct sfb_softc *sc = v;
- tga_getdevconfig(bc, pc, pci_make_tag(pc, bus, device, function), dcp);
+ if (sc->sc_dc == &sfb_console_dc)
+ panic("sfb_free_screen: console");
- /* sanity checks */
- if (dcp->dc_vaddr == NULL)
- panic("tga_console(%d, %d): couldn't map memory space",
- device, function);
- if (dcp->dc_tgaconf == NULL)
- panic("tga_console(%d, %d): unknown board configuration",
- device, function);
+ sc->nscreens--;
+}
- /*
- * Initialize the RAMDAC but DO NOT allocate any private storage.
- * Initialization includes disabling cursor, setting a sane
- * colormap, etc. It will be reinitialized in tgaattach().
- */
- (*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0);
+int
+sfb_show_screen(v, cookie, waitok, cb, cbarg)
+ void *v;
+ void *cookie;
+ int waitok;
+ void (*cb) __P((void *, int, int));
+ void *cbarg;
+{
- wo.wo_ef = &tga_emulfuncs;
- wo.wo_efa = &dcp->dc_rcons;
- wo.wo_nrows = dcp->dc_rcons.rc_maxrow;
- wo.wo_ncols = dcp->dc_rcons.rc_maxcol;
- wo.wo_crow = 0;
- wo.wo_ccol = 0;
- /* ioctl and mmap are unused until real attachment. */
+ return (0);
+}
+
+#if 0
+int
+sfb_cnattach(addr)
+ tc_addr_t addr;
+{
+ struct sfb_devconfig *dcp = &sfb_console_dc;
+ long defattr;
+
+ sfb_getdevconfig(addr, dcp);
+
+ rcons_alloc_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
- wscons_attach_console(&wo);
+ wsdisplay_cnattach(&sfb_stdscreen, &dcp->dc_rcons,
+ 0, 0, defattr);
+ sfb_consaddr = addr;
+ return(0);
}
#endif
diff --git a/sys/arch/alpha/tc/sfbvar.h b/sys/arch/alpha/tc/sfbvar.h
index 3c228e65d46..1eaefccb89e 100644
--- a/sys/arch/alpha/tc/sfbvar.h
+++ b/sys/arch/alpha/tc/sfbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sfbvar.h,v 1.4 1997/11/06 12:27:06 niklas Exp $ */
+/* $OpenBSD: sfbvar.h,v 1.5 2000/08/04 16:45:47 ericj Exp $ */
/* $NetBSD: sfbvar.h,v 1.1 1996/05/01 21:15:51 cgd Exp $ */
/*
@@ -30,7 +30,6 @@
#include <machine/sfbreg.h>
#include <dev/rcons/raster.h>
-#include <dev/wscons/wsconsvar.h>
#include <dev/wscons/wscons_raster.h>
struct sfb_devconfig;
@@ -60,4 +59,10 @@ struct sfb_softc {
struct device sc_dev;
struct sfb_devconfig *sc_dc; /* device configuration */
+
+ int nscreens;
};
+
+#if 0
+int sfb_cnattach __P((tc_addr_t));
+#endif