Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sun - re-initialize only when we're really going bac...
details: https://anonhg.NetBSD.org/src/rev/d596b9f3ed9c
branches: trunk
changeset: 780071:d596b9f3ed9c
user: macallan <macallan%NetBSD.org@localhost>
date: Tue Jul 10 22:33:15 2012 +0000
description:
- re-initialize only when we're really going back to terminal emulation
- don't try to redraw a non-existing screen
- don't try to mmap sbus ranges through /dev/ttyE*
diffstat:
sys/dev/sun/cgsix.c | 44 ++++++++++++++++++++++++++++----------------
1 files changed, 28 insertions(+), 16 deletions(-)
diffs (121 lines):
diff -r 797e2a1fc0a0 -r d596b9f3ed9c sys/dev/sun/cgsix.c
--- a/sys/dev/sun/cgsix.c Tue Jul 10 22:30:23 2012 +0000
+++ b/sys/dev/sun/cgsix.c Tue Jul 10 22:33:15 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgsix.c,v 1.51 2012/01/11 16:10:13 macallan Exp $ */
+/* $NetBSD: cgsix.c,v 1.52 2012/07/10 22:33:15 macallan Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.51 2012/01/11 16:10:13 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.52 2012/07/10 22:33:15 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -609,6 +609,7 @@
cg6_ras_init(sc);
sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
sc->sc_bg = WS_DEFAULT_BG;
+ sc->sc_fb_is_open = FALSE;
vcons_init(&sc->vd, sc, &cgsix_defaultscreen, &cgsix_accessops);
sc->vd.init_screen = cgsix_init_screen;
@@ -653,10 +654,13 @@
int
cgsixopen(dev_t dev, int flags, int mode, struct lwp *l)
{
- int unit = minor(dev);
+ device_t dv = device_lookup(&cgsix_cd, minor(dev));
+ struct cgsix_softc *sc = device_private(dv);
- if (device_lookup(&cgsix_cd, unit) == NULL)
+ if (dv == NULL)
return ENXIO;
+ sc->sc_fb_is_open = TRUE;
+
return 0;
}
@@ -667,9 +671,19 @@
struct cgsix_softc *sc = device_private(dv);
cg6_reset(sc);
+ sc->sc_fb_is_open = FALSE;
#if NWSDISPLAY > 0
- cg6_setup_palette(sc);
+ if (IS_IN_EMUL_MODE(sc)) {
+ struct vcons_screen *ms = sc->vd.active;
+
+ cg6_ras_init(sc);
+ cg6_setup_palette(sc);
+
+ /* we don't know if the screen exists */
+ if (ms != NULL)
+ vcons_redraw_screen(ms);
+ }
#else
/* (re-)initialize the default color map */
bt_initcmap(&sc->sc_cmap, 256);
@@ -689,7 +703,7 @@
int v, error;
#ifdef CGSIX_DEBUG
- printf("cgsixioctl(%ld)\n",cmd);
+ printf("cgsixioctl(%lx)\n",cmd);
#endif
switch (cmd) {
@@ -1114,7 +1128,7 @@
struct rasops_info *ri = &sc->sc_fb.fb_rinfo;
struct vcons_screen *ms = sc->vd.active;
#ifdef CGSIX_DEBUG
- printf("cgsix_ioctl(%ld)\n",cmd);
+ printf("cgsix_ioctl(%lx)\n",cmd);
#endif
switch (cmd) {
case WSDISPLAYIO_GTYPE:
@@ -1142,11 +1156,10 @@
case WSDISPLAYIO_SMODE:
{
int new_mode = *(int*)data;
- if (new_mode != sc->sc_mode)
- {
+
+ if (new_mode != sc->sc_mode) {
sc->sc_mode = new_mode;
- if(new_mode == WSDISPLAYIO_MODE_EMUL)
- {
+ if (IS_IN_EMUL_MODE(sc)) {
cg6_reset(sc);
cg6_ras_init(sc);
cg6_setup_palette(sc);
@@ -1164,12 +1177,11 @@
struct vcons_data *vd = v;
struct cgsix_softc *sc = vd->cookie;
- if(offset<sc->sc_ramsize) {
+ if (offset < sc->sc_ramsize) {
return bus_space_mmap(sc->sc_bustag, sc->sc_paddr,
- CGSIX_RAM_OFFSET+offset, prot, BUS_SPACE_MAP_LINEAR);
+ CGSIX_RAM_OFFSET + offset, prot, BUS_SPACE_MAP_LINEAR);
}
- /* I'm not at all sure this is the right thing to do */
- return cgsixmmap(0, offset, prot); /* assume minor dev 0 for now */
+ return -1;
}
int
@@ -1385,7 +1397,7 @@
/* put the chip back to normal */
fbc->fbc_incy = 0;
/* nosrc, color8 */
- fbc->fbc_mode = 0x00120000;
+ fbc->fbc_mode = 0x00120000;
/*fbc->fbc_mode &= ~CG6_MODE_MASK;
fbc->fbc_mode |= CG6_MODE;*/
}
Home |
Main Index |
Thread Index |
Old Index