summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormacallan <macallan@NetBSD.org>2005-06-28 20:55:21 +0000
committermacallan <macallan@NetBSD.org>2005-06-28 20:55:21 +0000
commitc3d39ccf44d9dcbfe4f2ac9f008289c26ea3a99e (patch)
treeae50ce1e98489d934dbd6713fb5c5c7bed461307 /sys/dev
parent886a08c2476d4ced3ada1463ebfd6978b2d2c4bd (diff)
deal with more than one cgsix, make sure to get things right even when none
of them is the console.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sun/cgsix.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/sys/dev/sun/cgsix.c b/sys/dev/sun/cgsix.c
index 84da8cacd34..46789a5e0b1 100644
--- a/sys/dev/sun/cgsix.c
+++ b/sys/dev/sun/cgsix.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cgsix.c,v 1.26 2005/06/21 01:12:17 thorpej Exp $ */
+/* $NetBSD: cgsix.c,v 1.27 2005/06/28 20:55:21 macallan Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.26 2005/06/21 01:12:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.27 2005/06/28 20:55:21 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -689,26 +689,45 @@ cg6attach(struct cgsix_softc *sc, const char *name, int isconsole)
LIST_INIT(&sc->screens);
sc->active = NULL;
sc->currenttype = &cgsix_defaultscreen;
- callout_init(&sc->switch_callout);
-
- cgsix_init_screen(sc, &cg6_console_screen, 1, &defattr);
- cg6_console_screen.active = 1;
- sc->active = &cg6_console_screen;
-
- cgsix_defaultscreen.nrows = ri->ri_rows;
- cgsix_defaultscreen.ncols = ri->ri_cols;
- cgsix_defaultscreen.textops = &ri->ri_ops;
- cgsix_defaultscreen.capabilities = ri->ri_caps;
-
- cg6_setup_palette(sc);
-
- if (isconsole) {
- wsdisplay_cnattach(&cgsix_defaultscreen, ri, 0, 0, defattr);
+ callout_init(&sc->switch_callout);
+
+ if(isconsole) {
+ /* we mess with cg6_console_screen only once */
+ cgsix_init_screen(sc, &cg6_console_screen, 1, &defattr);
+ cgsix_defaultscreen.textops = &ri->ri_ops;
+ cgsix_defaultscreen.capabilities = ri->ri_caps;
+ cgsix_defaultscreen.nrows = ri->ri_rows;
+ cgsix_defaultscreen.ncols = ri->ri_cols;
+ cg6_console_screen.active = 1;
+ sc->active = &cg6_console_screen;
+ wsdisplay_cnattach(&cgsix_defaultscreen, ri, 0, 0, defattr);
+ } else {
+ /*
+ * we're not the console so we just clear the screen and don't
+ * set up any sort of text display
+ */
+ if (cgsix_defaultscreen.textops == NULL) {
+ /*
+ * ugly, but...
+ * we want the console settings to win, so we only
+ * touch anything when we find an untouched screen
+ * definition. In this case we fill it from fb to
+ * avoid problems in case no cgsix is the console
+ */
+ ri = &sc->sc_fb.fb_rinfo;
+ cgsix_defaultscreen.textops = &ri->ri_ops;
+ cgsix_defaultscreen.capabilities = ri->ri_caps;
+ cgsix_defaultscreen.nrows = ri->ri_rows;
+ cgsix_defaultscreen.ncols = ri->ri_cols;
+ }
+ sc->active = NULL;
+ cgsix_clearscreen(sc);
}
-
- aa.console = isconsole;
+ cg6_setup_palette(sc);
+
aa.scrdata = &cgsix_screenlist;
+ aa.console = isconsole;
aa.accessops = &cgsix_accessops;
aa.accesscookie = sc;
config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);