From e4e83e0395766865b32e31ffd4c99492e95021a9 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 15 Dec 1995 13:56:49 +0000 Subject: new mapdev/()/mapiodev() calling convention uses "struct rom_reg *" to supply base plus an offset new dvma routines --- sys/arch/sparc/dev/cgthree.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'sys/arch/sparc/dev/cgthree.c') diff --git a/sys/arch/sparc/dev/cgthree.c b/sys/arch/sparc/dev/cgthree.c index ae5949225b9..06c62b15e91 100644 --- a/sys/arch/sparc/dev/cgthree.c +++ b/sys/arch/sparc/dev/cgthree.c @@ -78,7 +78,8 @@ struct cgthree_softc { struct sbusdev sc_sd; /* sbus device */ struct fbdevice sc_fb; /* frame buffer device */ volatile struct bt_regs *sc_bt; /* Brooktree registers */ - caddr_t sc_phys; /* display RAM (phys addr) */ + struct rom_reg sc_phys; /* display RAM (phys addr) */ + int sc_bustype; /* type of bus we live on */ int sc_blanked; /* true if blanked */ union bt_cmap sc_cmap; /* Brooktree color map */ }; @@ -137,7 +138,7 @@ cgthreeattach(parent, self, args) { register struct cgthree_softc *sc = (struct cgthree_softc *)self; register struct confargs *ca = args; - register int node, ramsize, i; + register int node = ca->ca_ra.ra_node, ramsize, i; register volatile struct bt_regs *bt; register struct cgthree_all *p; int isconsole; @@ -151,12 +152,18 @@ cgthreeattach(parent, self, args) */ sc->sc_fb.fb_type.fb_type = FBTYPE_SUN3COLOR; switch (ca->ca_bustype) { +#if defined(SUN4M) + case BUS_OBIO: + if (cputyp == CPU_SUN4M) /* 4m has framebuffer on obio */ + nam = getpropstring(node, "model"); + break; +#endif + case BUS_VME32: node = 0; nam = "cgthree"; break; case BUS_SBUS: - node = ca->ca_ra.ra_node; nam = getpropstring(node, "model"); break; } @@ -182,11 +189,14 @@ cgthreeattach(parent, self, args) p = (struct cgthree_all *)ca->ca_ra.ra_paddr; if ((sc->sc_fb.fb_pixels = ca->ca_ra.ra_vaddr) == NULL && isconsole) { /* this probably cannot happen, but what the heck */ - sc->sc_fb.fb_pixels = mapiodev(p->ba_ram, ramsize, ca->ca_bustype); + sc->sc_fb.fb_pixels = mapiodev(ca->ca_ra.ra_reg, CG3REG_MEM, + ramsize, ca->ca_bustype); } - sc->sc_bt = bt = (volatile struct bt_regs *) - mapiodev((caddr_t)&p->ba_btreg, sizeof(p->ba_btreg), ca->ca_bustype); - sc->sc_phys = p->ba_ram; + sc->sc_bt = bt = (volatile struct bt_regs *)mapiodev(ca->ca_ra.ra_reg, + CG3REG_REG, sizeof(struct bt_regs), ca->ca_bustype); + + sc->sc_phys = ca->ca_ra.ra_reg[0]; + sc->sc_bustype = ca->ca_bustype; /* grab initial (current) color map */ bt->bt_addr = 0; @@ -395,5 +405,5 @@ cgthreemmap(dev, off, prot) * I turned on PMAP_NC here to disable the cache as I was * getting horribly broken behaviour with it on. */ - return ((int)sc->sc_phys + off + PMAP_OBIO + PMAP_NC); + return (REG2PHYS(&sc->sc_phys, CG3REG_MEM+off, sc->sc_bustype) | PMAP_NC); } -- cgit v1.2.3