diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-09-20 11:17:57 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-09-20 11:17:57 +0000 |
commit | a225d04b41d8ff57daa1a4c95a57ba73a4b71132 (patch) | |
tree | fa1b5a7ac0eae77915ff4a23aeabdb83505f35b9 /sys/arch/sparc | |
parent | fb296632222a96f6a8f92af4df98bf43a4a71f83 (diff) |
Support to run the 24 bit fb in 8 bit mode or cg12 in 1 bit mode
via flags, using 0x0001.
miod@ ok.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/conf/GENERIC | 10 | ||||
-rw-r--r-- | sys/arch/sparc/conf/RAMDISK | 10 | ||||
-rw-r--r-- | sys/arch/sparc/conf/SUN4C | 4 | ||||
-rw-r--r-- | sys/arch/sparc/conf/SUN4M | 10 | ||||
-rw-r--r-- | sys/arch/sparc/conf/files.sparc | 4 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgfourteen.c | 46 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgtwelve.c | 168 | ||||
-rw-r--r-- | sys/arch/sparc/dev/tcx.c | 32 | ||||
-rw-r--r-- | sys/arch/sparc/include/fbvar.h | 8 |
9 files changed, 134 insertions, 158 deletions
diff --git a/sys/arch/sparc/conf/GENERIC b/sys/arch/sparc/conf/GENERIC index 3c31a82c92b..629b8cdcea2 100644 --- a/sys/arch/sparc/conf/GENERIC +++ b/sys/arch/sparc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.55 2002/08/31 10:47:18 miod Exp $ +# $OpenBSD: GENERIC,v 1.56 2002/09/20 11:17:55 fgsch Exp $ # $NetBSD: GENERIC,v 1.48 1997/08/23 19:19:01 mjacob Exp $ # Machine architecture; required by config(8) @@ -256,16 +256,16 @@ cgeight0 at obio0 addr 0x0b300000 level 4 # sun4/100 P4 wsdisplay* at cgeight? # Sun "tcx" accelerated color framebuffer. -tcx* at sbus? slot ? offset ? +tcx* at sbus? slot ? offset ? flags 0x0000 wsdisplay* at tcx? # Sun "cgfourteen" accelerated 24-bit framebuffer. -cgfourteen0 at obio0 addr 0x9c000000 # sun4m -cgfourteen1 at obio0 addr 0x90000000 # sun4m +cgfourteen0 at obio0 addr 0x9c000000 flags 0x0000 # sun4m +cgfourteen1 at obio0 addr 0x90000000 flags 0x0000 # sun4m wsdisplay* at cgfourteen? # Sun "cgtwelve" (GS) accelerated 24-bit framebuffer. -cgtwelve* at sbus? slot ? offset ? +cgtwelve* at sbus? slot ? offset ? flags 0x0000 wsdisplay* at cgtwelve? # Vigra VS10 or VS12 framebuffer. diff --git a/sys/arch/sparc/conf/RAMDISK b/sys/arch/sparc/conf/RAMDISK index 8127fbb3bcb..4b5e44e1dce 100644 --- a/sys/arch/sparc/conf/RAMDISK +++ b/sys/arch/sparc/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.34 2002/08/31 10:47:18 miod Exp $ +# $OpenBSD: RAMDISK,v 1.35 2002/09/20 11:17:55 fgsch Exp $ # $NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $ # Machine architecture; required by config(8) @@ -250,16 +250,16 @@ cgeight0 at obio0 addr 0x0b300000 level 4 # sun4/100 P4 wsdisplay* at cgeight? # Sun "tcx" accelerated color framebuffer. -tcx* at sbus? slot ? offset ? +tcx* at sbus? slot ? offset ? flags 0x0001 wsdisplay* at tcx? # Sun "cgfourteen" accelerated 24-bit framebuffer. -cgfourteen0 at obio0 addr 0x9c000000 # sun4m -cgfourteen1 at obio0 addr 0x90000000 # sun4m +cgfourteen0 at obio0 addr 0x9c000000 flags 0x0001 # sun4m +cgfourteen1 at obio0 addr 0x90000000 flags 0x0001 # sun4m wsdisplay* at cgfourteen? # Sun "cgtwelve" (GS) accelerated 24-bit framebuffer. -cgtwelve* at sbus? slot ? offset ? +cgtwelve* at sbus? slot ? offset ? flags 0x0001 wsdisplay* at cgtwelve? # Vigra VS10 or VS12 framebuffer. diff --git a/sys/arch/sparc/conf/SUN4C b/sys/arch/sparc/conf/SUN4C index 707dd77a495..3c518242a1b 100644 --- a/sys/arch/sparc/conf/SUN4C +++ b/sys/arch/sparc/conf/SUN4C @@ -1,4 +1,4 @@ -# $OpenBSD: SUN4C,v 1.33 2002/08/31 10:47:18 miod Exp $ +# $OpenBSD: SUN4C,v 1.34 2002/09/20 11:17:55 fgsch Exp $ # $NetBSD: GENERIC,v 1.19 1995/10/08 11:45:39 pk Exp $ machine sparc @@ -162,7 +162,7 @@ bwtwo* at sbus? slot ? offset ? #cgnine0 at vmel0 addr 0x08000000 level 4 cgthree* at sbus? slot ? offset ? cgsix* at sbus? slot ? offset ? -cgtwelve* at sbus? slot ? offset ? +cgtwelve* at sbus? slot ? offset ? flags 0x0000 vigra* at sbus? slot ? offset ? wsdisplay* at bwtwo? diff --git a/sys/arch/sparc/conf/SUN4M b/sys/arch/sparc/conf/SUN4M index b1743a953e3..00fa731424e 100644 --- a/sys/arch/sparc/conf/SUN4M +++ b/sys/arch/sparc/conf/SUN4M @@ -1,4 +1,4 @@ -# $OpenBSD: SUN4M,v 1.43 2002/08/31 10:47:18 miod Exp $ +# $OpenBSD: SUN4M,v 1.44 2002/09/20 11:17:55 fgsch Exp $ # $NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $ # Machine architecture; required by config(8) @@ -140,16 +140,16 @@ cgsix* at sbus? slot ? offset ? wsdisplay* at cgsix? # Sun "tcx" accelerated color framebuffer. -tcx* at sbus? slot ? offset ? +tcx* at sbus? slot ? offset ? flags 0x0000 wsdisplay* at tcx? # Sun "cgfourteen" accelerated 24-bit framebuffer. -cgfourteen0 at obio0 addr 0x9c000000 # sun4m -cgfourteen1 at obio0 addr 0x90000000 # sun4m +cgfourteen0 at obio0 addr 0x9c000000 flags 0x0000 # sun4m +cgfourteen1 at obio0 addr 0x90000000 flags 0x0000 # sun4m wsdisplay* at cgfourteen? # Sun "cgtwelve" (GS) accelerated 24-bit framebuffer. -cgtwelve* at sbus? slot ? offset ? +cgtwelve* at sbus? slot ? offset ? flags 0x0000 wsdisplay* at cgtwelve? # Vigra VS10 or VS12 framebuffer. diff --git a/sys/arch/sparc/conf/files.sparc b/sys/arch/sparc/conf/files.sparc index 1b1819f08e9..d5808db3e42 100644 --- a/sys/arch/sparc/conf/files.sparc +++ b/sys/arch/sparc/conf/files.sparc @@ -1,4 +1,4 @@ -# $OpenBSD: files.sparc,v 1.44 2002/08/31 10:47:18 miod Exp $ +# $OpenBSD: files.sparc,v 1.45 2002/09/20 11:17:55 fgsch Exp $ # $NetBSD: files.sparc,v 1.44 1997/08/31 21:29:16 pk Exp $ # @(#)files.sparc 8.1 (Berkeley) 7/19/93 @@ -186,7 +186,7 @@ device cgfourteen: wsemuldisplaydev, rasops8, rasops32, wsemul_sun attach cgfourteen at obio file arch/sparc/dev/cgfourteen.c cgfourteen -device cgtwelve: wsemuldisplaydev, rasops32, wsemul_sun +device cgtwelve: wsemuldisplaydev, rasops1, rasops32, wsemul_sun attach cgtwelve at sbus file arch/sparc/dev/cgtwelve.c cgtwelve diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c index f0d8793b223..0e747f8ca6d 100644 --- a/sys/arch/sparc/dev/cgfourteen.c +++ b/sys/arch/sparc/dev/cgfourteen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfourteen.c,v 1.14 2002/09/09 22:15:16 miod Exp $ */ +/* $OpenBSD: cgfourteen.c,v 1.15 2002/09/20 11:17:56 fgsch Exp $ */ /* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */ /* @@ -88,13 +88,6 @@ * XXX should bring hardware cursor code back */ -/* - * Define CG14_LOWCOLOR to stick to 8 bit mode, thus having a faster console. - */ -#ifdef SMALL_KERNEL -#define CG14_LOWCOLOR -#endif - #include <sys/param.h> #include <sys/systm.h> #include <sys/buf.h> @@ -210,11 +203,6 @@ cgfourteenmatch(parent, vcf, aux) struct confargs *ca = aux; struct romaux *ra = &ca->ca_ra; - /* - * Mask out invalid flags from the user. - */ - cf->cf_flags &= FB_USERMASK; - if (strcmp(cf->cf_driver->cd_name, ra->ra_name)) return (0); @@ -241,12 +229,12 @@ cgfourteenattach(parent, self, args) struct cgfourteen_softc *sc = (struct cgfourteen_softc *)self; struct confargs *ca = args; struct wsemuldisplaydev_attach_args waa; - int node, i; + int fb_depth, node, i; u_int32_t *lut; int isconsole = 0; char *nam; - sc->sc_sunfb.sf_flags = self->dv_cfdata->cf_flags; + sc->sc_sunfb.sf_flags = self->dv_cfdata->cf_flags & FB_USERMASK; node = ca->ca_ra.ra_node; nam = getpropstring(node, "model"); @@ -260,8 +248,8 @@ cgfourteenattach(parent, self, args) * Sanity checks */ if (ca->ca_ra.ra_len < 0x10000) - panic("\ncgfourteen: expected %x bytes of control registers, got %x", - 0x10000, ca->ca_ra.ra_len); + panic("\ncgfourteen: expected %x bytes of control " + "registers, got %x", 0x10000, ca->ca_ra.ra_len); if (ca->ca_ra.ra_nreg < CG14_NREG) panic("\ncgfourteen: expected %d registers, got %d", CG14_NREG, ca->ca_ra.ra_nreg); @@ -294,25 +282,27 @@ cgfourteenattach(parent, self, args) */ sc->sc_phys = ca->ca_ra.ra_reg[CG14_REG_VRAM]; -#ifdef CG14_LOWCOLOR - fb_setsize(&sc->sc_sunfb, 8, 1152, 900, node, ca->ca_bustype); -#else - fb_setsize(&sc->sc_sunfb, 32, 1152, 900, node, ca->ca_bustype); + if (ISSET(sc->sc_sunfb.sf_flags, FB_FORCELOW)) + fb_depth = 8; + else + fb_depth = 32; + + fb_setsize(&sc->sc_sunfb, fb_depth, 1152, 900, node, ca->ca_bustype); /* - * The prom will report depth == 8, since this is the mode it will get - * initialized in. - * Try to compensate and enable 32 bit mode, unless it would not fit in - * the video memory. Note that, in this case, the VSIMM will usually - * not appear in the OBP device tree! + * The prom will report depth == 8, since this is the mode + * it will get initialized in. + * Try to compensate and enable 32 bit mode, unless it would + * not fit in the video memory. Note that, in this case, the + * VSIMM will usually not appear in the OBP device tree! */ - if (sc->sc_sunfb.sf_depth == 8 && sc->sc_sunfb.sf_fbsize * 4 <= + if (fb_depth == 32 && sc->sc_sunfb.sf_depth == 8 && + sc->sc_sunfb.sf_fbsize * 4 <= ca->ca_ra.ra_reg[CG14_REG_VRAM].rr_len) { sc->sc_sunfb.sf_depth = 32; sc->sc_sunfb.sf_linebytes *= 4; sc->sc_sunfb.sf_fbsize *= 4; } -#endif sc->sc_sunfb.sf_ro.ri_bits = mapiodev(&ca->ca_ra.ra_reg[CG14_REG_VRAM], 0, /* CHUNKY_XBGR */ diff --git a/sys/arch/sparc/dev/cgtwelve.c b/sys/arch/sparc/dev/cgtwelve.c index 3cae5ba9ca4..0b036b3f71c 100644 --- a/sys/arch/sparc/dev/cgtwelve.c +++ b/sys/arch/sparc/dev/cgtwelve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwelve.c,v 1.2 2002/09/09 22:15:16 miod Exp $ */ +/* $OpenBSD: cgtwelve.c,v 1.3 2002/09/20 11:17:56 fgsch Exp $ */ /* * Copyright (c) 2002 Miodrag Vallat. All rights reserved. @@ -74,14 +74,6 @@ #include <dev/cons.h> /* for prom console hook */ -/* - * Define CG12_MONO to only use the overlay plane of the CG12, thus having - * a very fast, though monochrome, framebuffer. - */ -#ifdef SMALL_KERNEL -#define CG12_MONO -#endif - /* per-display variables */ struct cgtwelve_softc { struct sunfb sc_sunfb; /* common base device */ @@ -92,9 +84,7 @@ struct cgtwelve_softc { volatile struct cgtwelve_apu *sc_apu; volatile struct cgtwelve_dac *sc_ramdac; /* RAMDAC registers */ volatile u_char *sc_overlay; /* overlay or enable plane */ -#ifndef CG12_MONO volatile u_long *sc_inten; /* true color plane */ -#endif int sc_highres; int sc_nscreens; @@ -105,20 +95,34 @@ struct wsscreen_descr cgtwelve_stdscreen = { 0, 0, /* will be filled in */ 0, 0, 0, -#ifdef CG12_MONO - WSSCREEN_UNDERLINE | WSSCREEN_REVERSE -#else WSSCREEN_UNDERLINE | WSSCREEN_HILIT | WSSCREEN_REVERSE | WSSCREEN_WSCOLORS -#endif +}; + +struct wsscreen_descr cgtwelve_monoscreen = { + "std", + 0, 0, /* will be filled in */ + 0, + 0, 0, + WSSCREEN_UNDERLINE | WSSCREEN_REVERSE }; const struct wsscreen_descr *cgtwelve_scrlist[] = { &cgtwelve_stdscreen, }; +const struct wsscreen_descr *cgtwelve_monoscrlist[] = { + &cgtwelve_monoscreen, +}; + struct wsscreen_list cgtwelve_screenlist = { - sizeof(cgtwelve_scrlist) / sizeof(struct wsscreen_descr *), cgtwelve_scrlist + sizeof(cgtwelve_scrlist) / sizeof(struct wsscreen_descr *), + cgtwelve_scrlist +}; + +struct wsscreen_list cgtwelve_monoscreenlist = { + sizeof(cgtwelve_monoscrlist) / sizeof(struct wsscreen_descr *), + cgtwelve_monoscrlist }; int cgtwelve_ioctl(void *, u_long, caddr_t, int, struct proc *); @@ -129,7 +133,6 @@ 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 *); -#ifndef CG12_MONO void cgtwelve_burner(void *, u_int, u_int); void cgtwelve_prom(void *); @@ -137,7 +140,6 @@ static __inline__ void cgtwelve_ramdac_wraddr(struct cgtwelve_softc *sc, u_int32_t addr); void cgtwelve_initcmap(struct cgtwelve_softc *); void cgtwelve_darkcmap(struct cgtwelve_softc *); -#endif struct wsdisplay_accessops cgtwelve_accessops = { cgtwelve_ioctl, @@ -145,12 +147,10 @@ struct wsdisplay_accessops cgtwelve_accessops = { cgtwelve_alloc_screen, cgtwelve_free_screen, cgtwelve_show_screen, -#ifndef CG12_MONO NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ - cgtwelve_burner, -#endif + cgtwelve_burner }; int cgtwelvematch(struct device *, void *, void *); @@ -177,11 +177,6 @@ cgtwelvematch(parent, vcf, aux) struct confargs *ca = aux; struct romaux *ra = &ca->ca_ra; - /* - * Mask out invalid flags from the user. - */ - cf->cf_flags &= FB_USERMASK; - if (strcmp(cf->cf_driver->cd_name, ra->ra_name)) return (0); @@ -202,11 +197,11 @@ cgtwelveattach(parent, self, args) struct cgtwelve_softc *sc = (struct cgtwelve_softc *)self; struct confargs *ca = args; struct wsemuldisplaydev_attach_args waa; - int node; + int fb_depth, node; int isconsole = 0; char *ps; - sc->sc_sunfb.sf_flags = self->dv_cfdata->cf_flags; + sc->sc_sunfb.sf_flags = self->dv_cfdata->cf_flags & FB_USERMASK; node = ca->ca_ra.ra_node; printf(": %s", getpropstring(node, "model")); @@ -232,19 +227,21 @@ cgtwelveattach(parent, self, args) /* * Compute framebuffer size */ -#ifdef CG12_MONO - fb_setsize(&sc->sc_sunfb, 1, CG12_WIDTH, CG12_HEIGHT, - node, ca->ca_bustype); + if (ISSET(sc->sc_sunfb.sf_flags, FB_FORCELOW)) + fb_depth = 1; + else + fb_depth = 32; - /* the prom will report depth == 32, so compensate */ - sc->sc_sunfb.sf_depth = 1; - sc->sc_sunfb.sf_linebytes = sc->sc_sunfb.sf_width / 8; - sc->sc_sunfb.sf_fbsize = sc->sc_sunfb.sf_height * - sc->sc_sunfb.sf_linebytes; -#else - fb_setsize(&sc->sc_sunfb, 32, CG12_WIDTH, CG12_HEIGHT, + fb_setsize(&sc->sc_sunfb, fb_depth, CG12_WIDTH, CG12_HEIGHT, node, ca->ca_bustype); -#endif + + if (fb_depth == 1 && sc->sc_sunfb.sf_depth == 32) { + /* the prom will report depth == 32, so compensate */ + sc->sc_sunfb.sf_depth = 1; + sc->sc_sunfb.sf_linebytes = sc->sc_sunfb.sf_width / 8; + sc->sc_sunfb.sf_fbsize = sc->sc_sunfb.sf_height * + sc->sc_sunfb.sf_linebytes; + } sc->sc_highres = sc->sc_sunfb.sf_width == CG12_WIDTH_HR; @@ -255,26 +252,25 @@ cgtwelveattach(parent, self, args) sc->sc_highres ? CG12_OFF_OVERLAY0_HR : CG12_OFF_OVERLAY0, round_page(sc->sc_highres ? CG12_SIZE_OVERLAY_HR : CG12_SIZE_OVERLAY)); -#ifndef CG12_MONO - sc->sc_inten = mapiodev(ca->ca_ra.ra_reg, - sc->sc_highres ? CG12_OFF_INTEN_HR : CG12_OFF_INTEN, - round_page(sc->sc_highres ? CG12_SIZE_COLOR24_HR : - CG12_SIZE_COLOR24)); -#endif + if (sc->sc_sunfb.sf_depth != 1) + sc->sc_inten = mapiodev(ca->ca_ra.ra_reg, + sc->sc_highres ? CG12_OFF_INTEN_HR : CG12_OFF_INTEN, + round_page(sc->sc_highres ? CG12_SIZE_COLOR24_HR : + CG12_SIZE_COLOR24)); /* reset cursor & frame buffer controls */ cgtwelve_reset(sc); -#ifndef CG12_MONO - /* enable video */ - cgtwelve_burner(sc, 1, 0); -#endif + if (sc->sc_sunfb.sf_depth != 1) { + /* enable video */ + cgtwelve_burner(sc, 1, 0); + } + + if (sc->sc_sunfb.sf_depth == 1) + sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_overlay; + else + sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_inten; -#ifdef CG12_MONO - sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_overlay; -#else - sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_inten; -#endif sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); @@ -283,17 +279,17 @@ cgtwelveattach(parent, self, args) cgtwelve_stdscreen.textops = &sc->sc_sunfb.sf_ro.ri_ops; if (isconsole) { -#ifdef CG12_MONO - fbwscons_console_init(&sc->sc_sunfb, &cgtwelve_stdscreen, -1, - NULL, NULL); -#else - /* - * Since the screen has been cleared, restart at the top - * of the screen. - */ - fbwscons_console_init(&sc->sc_sunfb, &cgtwelve_stdscreen, 0, - NULL, cgtwelve_burner); -#endif + if (sc->sc_sunfb.sf_depth == 1) { + fbwscons_console_init(&sc->sc_sunfb, + &cgtwelve_stdscreen, -1, NULL, NULL); + } else { + /* + * Since the screen has been cleared, restart at the + * top of the screen. + */ + fbwscons_console_init(&sc->sc_sunfb, + &cgtwelve_stdscreen, 0, NULL, cgtwelve_burner); + } } sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev); @@ -306,7 +302,10 @@ cgtwelveattach(parent, self, args) printf("\n"); waa.console = isconsole; - waa.scrdata = &cgtwelve_screenlist; + if (sc->sc_sunfb.sf_depth == 1) + waa.scrdata = &cgtwelve_monoscreenlist; + else + waa.scrdata = &cgtwelve_screenlist; waa.accessops = &cgtwelve_accessops; waa.accesscookie = sc; config_found(self, &waa, wsemuldisplaydevprint); @@ -325,11 +324,10 @@ cgtwelve_ioctl(dev, cmd, data, flags, p) switch (cmd) { case WSDISPLAYIO_GTYPE: -#ifdef CG12_MONO - *(u_int *)data = WSDISPLAY_TYPE_SUNBW; -#else - *(u_int *)data = WSDISPLAY_TYPE_SUN24; -#endif + if (sc->sc_sunfb.sf_depth == 1) + *(u_int *)data = WSDISPLAY_TYPE_SUNBW; + else + *(u_int *)data = WSDISPLAY_TYPE_SUN24; break; case WSDISPLAYIO_GINFO: wdf = (struct wsdisplay_fbinfo *)data; @@ -367,7 +365,9 @@ void cgtwelve_reset(sc) struct cgtwelve_softc *sc; { -#ifndef CG12_MONO + if (sc->sc_sunfb.sf_depth == 1) + return; + /* * Select the overlay plane as sc_overlay. */ @@ -414,7 +414,6 @@ cgtwelve_reset(sc) sc->sc_highres ? CG12_SIZE_COLOR24_HR : CG12_SIZE_COLOR24); shutdownhook_establish(cgtwelve_prom, sc); -#endif } /* @@ -434,15 +433,15 @@ cgtwelve_mmap(v, offset, prot) /* Allow mapping as a dumb framebuffer from offset 0 */ if (offset >= 0 && offset < sc->sc_sunfb.sf_fbsize) { -#ifdef CG12_MONO - return (REG2PHYS(&sc->sc_phys, - (sc->sc_highres ? CG12_OFF_OVERLAY0_HR : - CG12_OFF_OVERLAY0) + offset) | PMAP_NC); -#else - return (REG2PHYS(&sc->sc_phys, - (sc->sc_highres ? CG12_OFF_INTEN_HR : - CG12_OFF_INTEN) + offset) | PMAP_NC); -#endif + if (sc->sc_sunfb.sf_depth == 1) { + return (REG2PHYS(&sc->sc_phys, + (sc->sc_highres ? CG12_OFF_OVERLAY0_HR : + CG12_OFF_OVERLAY0) + offset) | PMAP_NC); + } else { + return (REG2PHYS(&sc->sc_phys, + (sc->sc_highres ? CG12_OFF_INTEN_HR : + CG12_OFF_INTEN) + offset) | PMAP_NC); + } } return (-1); /* not a user-map offset */ @@ -491,7 +490,6 @@ cgtwelve_show_screen(v, cookie, waitok, cb, cbarg) return (0); } -#ifndef CG12_MONO /* * Simple Bt462 programming routines. */ @@ -538,6 +536,9 @@ void cgtwelve_burner(v, on, flags) { struct cgtwelve_softc *sc = v; + if (sc->sc_sunfb.sf_depth == 1) + return; + if (on) cgtwelve_initcmap(sc); else @@ -583,4 +584,3 @@ cgtwelve_prom(v) */ cn_tab = &consdev_prom; } -#endif diff --git a/sys/arch/sparc/dev/tcx.c b/sys/arch/sparc/dev/tcx.c index eea32134cfd..a0bfbb93611 100644 --- a/sys/arch/sparc/dev/tcx.c +++ b/sys/arch/sparc/dev/tcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcx.c,v 1.8 2002/09/09 22:15:16 miod Exp $ */ +/* $OpenBSD: tcx.c,v 1.9 2002/09/20 11:17:56 fgsch Exp $ */ /* $NetBSD: tcx.c,v 1.8 1997/07/29 09:58:14 fair Exp $ */ /* @@ -95,14 +95,6 @@ #include <dev/cons.h> /* for prom console hook */ -/* - * Define TCX_LOWDEPTH to only use the 8 bit color mode of the S24, for faster - * console output. - */ -#ifdef SMALL_KERNEL -#define TCX_LOWDEPTH -#endif - /* per-display variables */ struct tcx_softc { struct sunfb sc_sunfb; /* common base part */ @@ -197,15 +189,9 @@ tcxmatch(parent, vcf, aux) struct device *parent; void *vcf, *aux; { - struct cfdata *cf = vcf; struct confargs *ca = aux; struct romaux *ra = &ca->ca_ra; - /* - * Mask out invalid flags from the user. - */ - cf->cf_flags &= FB_USERMASK; - if (strcmp(ra->ra_name, "SUNW,tcx")) return (0); @@ -226,12 +212,12 @@ tcxattach(parent, self, args) struct tcx_softc *sc = (struct tcx_softc *)self; struct confargs *ca = args; struct wsemuldisplaydev_attach_args waa; - int node = 0, i; + int fb_depth, node = 0, i; volatile struct bt_regs *bt; int isconsole = 0; char *nam = NULL; - sc->sc_sunfb.sf_flags = self->dv_cfdata->cf_flags; + sc->sc_sunfb.sf_flags = self->dv_cfdata->cf_flags & FB_USERMASK; if (ca->ca_ra.ra_nreg < TCX_NREG) panic("\ntcx: expected %d registers, got %d", TCX_NREG, @@ -262,12 +248,12 @@ tcxattach(parent, self, args) isconsole = node == fbnode; -#ifdef TCX_LOWDEPTH - fb_setsize(&sc->sc_sunfb, 8, 1152, 900, node, ca->ca_bustype); -#else - fb_setsize(&sc->sc_sunfb, node_has_property(node, "tcx-8-bit") ? - 8 : 32, 1152, 900, node, ca->ca_bustype); -#endif + if (ISSET(sc->sc_sunfb.sf_flags, FB_FORCELOW)) + fb_depth = 8; + else + fb_depth = node_has_property(node, "tcx-8-bit") ? 8 : 32, + + fb_setsize(&sc->sc_sunfb, fb_depth, 1152, 900, node, ca->ca_bustype); sc->sc_sunfb.sf_ro.ri_bits = mapiodev(&ca->ca_ra.ra_reg[ sc->sc_sunfb.sf_depth == 8 ? TCX_REG_DFB8 : TCX_REG_DFB24], diff --git a/sys/arch/sparc/include/fbvar.h b/sys/arch/sparc/include/fbvar.h index f8b9e1028d6..27d0b9f3eb1 100644 --- a/sys/arch/sparc/include/fbvar.h +++ b/sys/arch/sparc/include/fbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fbvar.h,v 1.6 2002/08/12 10:44:04 miod Exp $ */ +/* $OpenBSD: fbvar.h,v 1.7 2002/09/20 11:17:56 fgsch Exp $ */ /* $NetBSD: fbvar.h,v 1.9 1997/07/07 23:31:30 pk Exp $ */ /* @@ -47,12 +47,12 @@ /* * Frame buffer device flags. - * - * XXX add flags to run 24 bit framebuffers in 8 bit mode if possible? */ #define FB_PFOUR 0x00010000 /* indicates fb is a pfour fb */ -#define FB_USERMASK (0) /* flags that the user can set */ +#define FB_FORCELOW 0x00000001 /* run 24 bit fb in 8 bit mode */ + /* or cg12 in 1 bit mode */ +#define FB_USERMASK (0xffff) /* flags that the user can set */ /* * Common frame buffer variables. |