diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-08-21 20:27:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-08-21 20:27:36 +0000 |
commit | ae3237c0d267df3bb60e0c3e3e208ff037ec51a4 (patch) | |
tree | 93773db94320394c253a6cf4eb8554dfe4cc5896 | |
parent | 5e7ab34758e8f9770a097f605bd2e240ddd648e2 (diff) |
Correctly map the video memory, for proper operation.
-rw-r--r-- | sys/arch/sparc/dev/cgfourteen.c | 22 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgfourteenreg.h | 8 |
2 files changed, 18 insertions, 12 deletions
diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c index bd5de10f91b..83423798ff2 100644 --- a/sys/arch/sparc/dev/cgfourteen.c +++ b/sys/arch/sparc/dev/cgfourteen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfourteen.c,v 1.11 2002/08/12 10:44:03 miod Exp $ */ +/* $OpenBSD: cgfourteen.c,v 1.12 2002/08/21 20:27:35 miod Exp $ */ /* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */ /* @@ -116,7 +116,6 @@ #include <dev/rasops/rasops.h> #include <machine/fbvar.h> -#define CG3REG_MEM 0x800000 #include <sparc/dev/cgfourteenreg.h> /* @@ -248,6 +247,8 @@ cgfourteenattach(parent, self, args) node = ca->ca_ra.ra_node; nam = getpropstring(node, "model"); + if (*nam == '\0') + nam = getpropstring(node, "name"); printf(": %s", nam); isconsole = node == fbnode; @@ -259,8 +260,8 @@ cgfourteenattach(parent, self, args) panic("\ncgfourteen: expected %x bytes of registers, got %x", 0x10000, ca->ca_ra.ra_len); } - sc->sc_ctl = (struct cg14ctl *) mapiodev(ca->ca_ra.ra_reg, 0, - ca->ca_ra.ra_len); + sc->sc_ctl = (struct cg14ctl *) mapiodev( + &ca->ca_ra.ra_reg[CG14_REG_CONTROL], 0, ca->ca_ra.ra_len); sc->sc_hwc = (struct cg14curs *) ((u_int)sc->sc_ctl + CG14_OFFSET_CURS); @@ -280,10 +281,10 @@ cgfourteenattach(parent, self, args) /* * Stash the physical address of the framebuffer for use by mmap */ - if (ca->ca_ra.ra_nreg < 2) - panic("\ncgfourteen: expected 2 registers, got %d", - ca->ca_ra.ra_nreg); - sc->sc_phys = ca->ca_ra.ra_reg[1]; + if (ca->ca_ra.ra_nreg < CG14_NREG) + panic("\ncgfourteen: expected %d registers, got %d", + CG14_NREG, ca->ca_ra.ra_nreg); + sc->sc_phys = ca->ca_ra.ra_reg[CG14_REG_VRAM]; /* * Reset frame buffer controls @@ -308,9 +309,8 @@ cgfourteenattach(parent, self, args) depth = 8; #endif fb_setsize(&sc->sc_sunfb, depth, 1152, 900, node, ca->ca_bustype); - /* XXX is this right? */ - sc->sc_sunfb.sf_ro.ri_bits = mapiodev(ca->ca_ra.ra_reg, - CG3REG_MEM, round_page(sc->sc_sunfb.sf_fbsize)); + sc->sc_sunfb.sf_ro.ri_bits = mapiodev(&ca->ca_ra.ra_reg[CG14_REG_VRAM], + 0, round_page(sc->sc_sunfb.sf_fbsize)); sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); diff --git a/sys/arch/sparc/dev/cgfourteenreg.h b/sys/arch/sparc/dev/cgfourteenreg.h index 30b541894b2..e8e3bcffd82 100644 --- a/sys/arch/sparc/dev/cgfourteenreg.h +++ b/sys/arch/sparc/dev/cgfourteenreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfourteenreg.h,v 1.2 2002/08/12 10:44:03 miod Exp $ */ +/* $OpenBSD: cgfourteenreg.h,v 1.3 2002/08/21 20:27:35 miod Exp $ */ /* $NetBSD: cgfourteenreg.h,v 1.1 1996/09/30 22:41:02 abrown Exp $ */ /* @@ -38,6 +38,12 @@ * Register/dac/clut/cursor definitions for cgfourteen frame buffer */ +/* Control registers */ +#define CG14_REG_CONTROL 0 +#define CG14_REG_VRAM 1 + +#define CG14_NREG 2 + /* Locations of control registers in cg14 register set */ #define CG14_OFFSET_CURS 0x1000 #define CG14_OFFSET_DAC 0x2000 |