Module Name: src
Committed By: macallan
Date: Wed May 23 18:39:31 UTC 2012
Modified Files:
src/sys/dev/ic: ct65550.c
src/sys/dev/pci: pm2fb.c r128fb.c
src/sys/dev/pci/voyager: voyagerfb.c
Log Message:
first step to fix PR 46461 - don't jump through a NULL pointer when we're
not the console but the firmware set up the graphics hardware anyway
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/ct65550.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/pm2fb.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/r128fb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/voyager/voyagerfb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/ct65550.c
diff -u src/sys/dev/ic/ct65550.c:1.4 src/sys/dev/ic/ct65550.c:1.5
--- src/sys/dev/ic/ct65550.c:1.4 Tue Mar 13 18:40:31 2012
+++ src/sys/dev/ic/ct65550.c Wed May 23 18:39:30 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ct65550.c,v 1.4 2012/03/13 18:40:31 elad Exp $ */
+/* $NetBSD: ct65550.c,v 1.5 2012/05/23 18:39:30 macallan Exp $ */
/*
* Copyright (c) 2006 Michael Lorenz
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ct65550.c,v 1.4 2012/03/13 18:40:31 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ct65550.c,v 1.5 2012/05/23 18:39:30 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -254,10 +254,11 @@ chipsfb_do_attach(struct chipsfb_softc *
chipsfb_defaultscreen.ncols = ri->ri_cols;
wsdisplay_cnattach(&chipsfb_defaultscreen, ri, 0, 0, defattr);
} else {
- /*
- * since we're not the console we can postpone the rest
- * until someone actually allocates a screen for us
- */
+ if (chipsfb_console_screen.scr_ri.ri_rows == 0) {
+ /* do some minimal setup to avoid weirdnesses later */
+ vcons_init_screen(&sc->vd, &chipsfb_console_screen, 1,
+ &defattr);
+ }
}
rasops_unpack_attr(defattr, &fg, &bg, &ul);
Index: src/sys/dev/pci/pm2fb.c
diff -u src/sys/dev/pci/pm2fb.c:1.13 src/sys/dev/pci/pm2fb.c:1.14
--- src/sys/dev/pci/pm2fb.c:1.13 Tue Mar 13 18:40:33 2012
+++ src/sys/dev/pci/pm2fb.c Wed May 23 18:39:30 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pm2fb.c,v 1.13 2012/03/13 18:40:33 elad Exp $ */
+/* $NetBSD: pm2fb.c,v 1.14 2012/05/23 18:39:30 macallan Exp $ */
/*
* Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.13 2012/03/13 18:40:33 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.14 2012/05/23 18:39:30 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -326,11 +326,11 @@ pm2fb_attach(device_t parent, device_t s
defattr);
vcons_replay_msgbuf(&sc->sc_console_screen);
} else {
- /*
- * since we're not the console we can postpone the rest
- * until someone actually allocates a screen for us
- */
- (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
+ if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
+ /* do some minimal setup to avoid weirdnesses later */
+ vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
+ &defattr);
+ }
}
aa.console = is_console;
Index: src/sys/dev/pci/r128fb.c
diff -u src/sys/dev/pci/r128fb.c:1.34 src/sys/dev/pci/r128fb.c:1.35
--- src/sys/dev/pci/r128fb.c:1.34 Thu Apr 19 08:59:42 2012
+++ src/sys/dev/pci/r128fb.c Wed May 23 18:39:30 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: r128fb.c,v 1.34 2012/04/19 08:59:42 macallan Exp $ */
+/* $NetBSD: r128fb.c,v 1.35 2012/05/23 18:39:30 macallan Exp $ */
/*
* Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.34 2012/04/19 08:59:42 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.35 2012/05/23 18:39:30 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -307,7 +307,11 @@ r128fb_attach(device_t parent, device_t
* since we're not the console we can postpone the rest
* until someone actually allocates a screen for us
*/
- (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
+ if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
+ /* do some minimal setup to avoid weirdnesses later */
+ vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
+ &defattr);
+ }
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
(0x800000 / sc->sc_stride) - sc->sc_height - 5,
sc->sc_width,
Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.20 src/sys/dev/pci/voyager/voyagerfb.c:1.21
--- src/sys/dev/pci/voyager/voyagerfb.c:1.20 Thu Apr 19 09:03:01 2012
+++ src/sys/dev/pci/voyager/voyagerfb.c Wed May 23 18:39:30 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: voyagerfb.c,v 1.20 2012/04/19 09:03:01 macallan Exp $ */
+/* $NetBSD: voyagerfb.c,v 1.21 2012/05/23 18:39:30 macallan Exp $ */
/*
* Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.20 2012/04/19 09:03:01 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.21 2012/05/23 18:39:30 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -290,11 +290,10 @@ voyagerfb_attach(device_t parent, device
sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
} else {
- /*
- * since we're not the console we can postpone the rest
- * until someone actually allocates a screen for us
- */
- (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
+ if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
+ /* do some minimal setup to avoid weirdnesses later */
+ vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1, &defattr);
+ }
}
glyphcache_init(&sc->sc_gc, sc->sc_height,
(sc->sc_fbsize / sc->sc_stride) - sc->sc_height,