diff options
Diffstat (limited to 'sys/arch/hp300/dev/grf_rb.c')
-rw-r--r-- | sys/arch/hp300/dev/grf_rb.c | 124 |
1 files changed, 108 insertions, 16 deletions
diff --git a/sys/arch/hp300/dev/grf_rb.c b/sys/arch/hp300/dev/grf_rb.c index d06d7d72f79..ba5e98f0313 100644 --- a/sys/arch/hp300/dev/grf_rb.c +++ b/sys/arch/hp300/dev/grf_rb.c @@ -1,4 +1,5 @@ -/* $NetBSD: grf_rb.c,v 1.7 1996/03/03 16:49:02 thorpej Exp $ */ +/* $OpenBSD: grf_rb.c,v 1.3 1997/01/12 15:12:36 downsj Exp $ */ +/* $NetBSD: grf_rb.c,v 1.9 1996/12/17 08:41:10 thorpej Exp $ */ /* * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. @@ -43,9 +44,6 @@ * @(#)grf_rb.c 8.4 (Berkeley) 1/12/94 */ -#include "grf.h" -#if NGRF > 0 - /* * Graphics routines for the Renaissance, HP98720 Graphics system. */ @@ -56,12 +54,17 @@ #include <sys/ioctl.h> #include <sys/tty.h> #include <sys/systm.h> +#include <sys/device.h> #include <machine/autoconf.h> #include <machine/cpu.h> #include <dev/cons.h> +#include <hp300/dev/diovar.h> +#include <hp300/dev/diodevs.h> +#include <hp300/dev/intiovar.h> + #include <hp300/dev/grfioctl.h> #include <hp300/dev/grfvar.h> #include <hp300/dev/grfreg.h> @@ -75,6 +78,26 @@ int rb_init __P((struct grf_data *gp, int, caddr_t)); int rb_mode __P((struct grf_data *gp, int, caddr_t)); +#ifdef NEWCONFIG +int rbox_intio_match __P((struct device *, struct cfdata *, void *)); +void rbox_intio_attach __P((struct device *, struct device *, void *)); + +int rbox_dio_match __P((struct device *, struct cfdata *, void *)); +void rbox_dio_attach __P((struct device *, struct device *, void *)); + +struct cfattach rbox_intio_ca = { + sizeof(struct grfdev_softc), rbox_intio_match, rbox_intio_attach +}; + +struct cfattach rbox_dio_ca = { + sizeof(struct grfdev_softc), rbox_dio_match, rbox_dio_attach +}; + +struct cfdriver rbox_cd = { + NULL, "rbox", DV_DULL +}; +#endif /* NEWCONFIG */ + /* Renaissance grf switch */ struct grfsw rbox_grfsw = { GID_RENAISSANCE, GRFRBOX, "renaissance", rb_init, rb_mode @@ -97,6 +120,83 @@ struct itesw rbox_itesw = { }; #endif /* NITE > 0 */ +#ifdef NEWCONFIG +int +rbox_intio_match(parent, match, aux) + struct device *parent; + struct cfdata *match; + void *aux; +{ + struct intio_attach_args *ia = aux; + struct grfreg *grf; + + grf = (struct grfreg *)IIOV(GRFIADDR); + if (badaddr((caddr_t)grf)) + return (0); + + if (grf->gr_id == DIO_DEVICE_ID_FRAMEBUFFER && + grf->gr_id2 == DIO_DEVICE_SECID_RENASSIANCE) { + ia->ia_addr = (caddr_t)GRFIADDR; + return (1); + } + + return (0); +} + +void +rbox_intio_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct grfdev_softc *sc = (struct grfdev_softc *)self; + caddr_t grf; + + grf = (caddr_t)IIOV(GRFIADDR); + sc->sc_scode = -1; /* XXX internal i/o */ + + grfdev_attach(sc, rb_init, grf, &rbox_grfsw); +} + +int +rbox_dio_match(parent, match, aux) + struct device *parent; + struct cfdata *match; + void *aux; +{ + struct dio_attach_args *da = aux; + + if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER && + da->da_secid == DIO_DEVICE_SECID_RENASSIANCE) + return (1); + + return (0); +} + +void +rbox_dio_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct grfdev_softc *sc = (struct grfdev_softc *)self; + struct dio_attach_args *da = aux; + caddr_t grf; + + sc->sc_scode = da->da_scode; + if (sc->sc_scode == conscode) + grf = conaddr; + else { + grf = iomap(dio_scodetopa(sc->sc_scode), da->da_size); + if (grf == 0) { + printf("%s: can't map framebuffer\n", + sc->sc_dev.dv_xname); + return; + } + } + + grfdev_attach(sc, rb_init, grf, &rbox_grfsw); +} +#endif /* NEWCONFIG */ + /* * Initialize hardware. * Must point g_display at a grfinfo structure describing the hardware. @@ -111,7 +211,7 @@ rb_init(gp, scode, addr) register struct rboxfb *rbp; struct grfinfo *gi = &gp->g_display; int fboff; - extern caddr_t sctopa(), iomap(); + extern caddr_t iomap(); /* * If the console has been initialized, and it was us, there's @@ -122,7 +222,7 @@ rb_init(gp, scode, addr) if (ISIIOVA(addr)) gi->gd_regaddr = (caddr_t) IIOP(addr); else - gi->gd_regaddr = sctopa(scode); + gi->gd_regaddr = dio_scodetopa(scode); gi->gd_regsize = 0x20000; gi->gd_fbwidth = (rbp->fbwmsb << 8) | rbp->fbwlsb; gi->gd_fbheight = (rbp->fbhmsb << 8) | rbp->fbhlsb; @@ -565,7 +665,6 @@ void rboxcninit(cp) struct consdev *cp; { - struct ite_data *ip = &ite_cn; struct grf_data *gp = &grf_cn; /* @@ -581,16 +680,9 @@ rboxcninit(cp) gp->g_flags = GF_ALIVE; /* - * Set up required ite data and initialize ite. + * Initialize the terminal emulator. */ - ip->isw = &rbox_itesw; - ip->grf = gp; - ip->flags = ITE_ALIVE|ITE_CONSOLE|ITE_ACTIVE|ITE_ISCONS; - ip->attrbuf = console_attributes; - iteinit(ip); - - kbd_ite = ip; /* XXX */ + itecninit(gp, &rbox_itesw); } #endif /* NITE > 0 */ -#endif /* NGRF > 0 */ |