Module Name: src
Committed By: jmcneill
Date: Wed Feb 9 13:24:24 UTC 2011
Modified Files:
src/sys/arch/x86/include: genfb_machdep.h
src/sys/arch/x86/x86: genfb_machdep.c x86_autoconf.c
Log Message:
if genfb is attached, hook into db_trap_callback to switch in and out of
polling mode as necessary
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/x86/x86_autoconf.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/arch/x86/include/genfb_machdep.h
diff -u src/sys/arch/x86/include/genfb_machdep.h:1.2 src/sys/arch/x86/include/genfb_machdep.h:1.3
--- src/sys/arch/x86/include/genfb_machdep.h:1.2 Tue Feb 8 20:55:51 2011
+++ src/sys/arch/x86/include/genfb_machdep.h Wed Feb 9 13:24:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.h,v 1.2 2011/02/08 20:55:51 ahoka Exp $ */
+/* $NetBSD: genfb_machdep.h,v 1.3 2011/02/09 13:24:23 jmcneill Exp $ */
/*-
* Copyright (c) 2009 Jared D. McNeill <[email protected]>
@@ -31,5 +31,7 @@
int x86_genfb_cnattach(void);
void x86_genfb_mtrr_init(uint64_t, uint32_t);
+void x86_genfb_set_console_dev(device_t);
+void x86_genfb_ddb_trap_callback(int);
#endif /* !_X86_GENFB_MACHDEP_H */
Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.6 src/sys/arch/x86/x86/genfb_machdep.c:1.7
--- src/sys/arch/x86/x86/genfb_machdep.c:1.6 Wed Feb 9 02:30:09 2011
+++ src/sys/arch/x86/x86/genfb_machdep.c Wed Feb 9 13:24:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.6 2011/02/09 02:30:09 jmcneill Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.7 2011/02/09 13:24:24 jmcneill Exp $ */
/*-
* Copyright (c) 2009 Jared D. McNeill <[email protected]>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.6 2011/02/09 02:30:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.7 2011/02/09 13:24:24 jmcneill Exp $");
#include "opt_mtrr.h"
@@ -52,6 +52,7 @@
#include <dev/wsfont/wsfont.h>
#include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/wsfb/genfbvar.h>
#include <arch/x86/include/genfb_machdep.h>
#include "wsdisplay.h"
@@ -65,6 +66,8 @@
extern int acpi_md_vesa_modenum;
#endif
+static device_t x86_genfb_console_dev = NULL;
+
static struct wsscreen_descr x86_genfb_stdscreen = {
"std",
0, 0,
@@ -75,6 +78,26 @@
};
void
+x86_genfb_set_console_dev(device_t dev)
+{
+ KASSERT(x86_genfb_console_dev != NULL);
+ x86_genfb_console_dev = dev;
+}
+
+void
+x86_genfb_ddb_trap_callback(int where)
+{
+ if (x86_genfb_console_dev == NULL)
+ return;
+
+ if (where) {
+ genfb_enable_polling(x86_genfb_console_dev);
+ } else {
+ genfb_disable_polling(x86_genfb_console_dev);
+ }
+}
+
+void
x86_genfb_mtrr_init(uint64_t physaddr, uint32_t size)
{
#ifdef MTRR
Index: src/sys/arch/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.54 src/sys/arch/x86/x86/x86_autoconf.c:1.55
--- src/sys/arch/x86/x86/x86_autoconf.c:1.54 Tue Feb 8 10:52:56 2011
+++ src/sys/arch/x86/x86/x86_autoconf.c Wed Feb 9 13:24:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_autoconf.c,v 1.54 2011/02/08 10:52:56 jmcneill Exp $ */
+/* $NetBSD: x86_autoconf.c,v 1.55 2011/02/09 13:24:24 jmcneill Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.54 2011/02/08 10:52:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.55 2011/02/09 13:24:24 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -59,6 +59,13 @@
#include "genfb.h"
#include "wsdisplay.h"
#include "opt_vga.h"
+#include "opt_ddb.h"
+
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_extern.h>
+#endif
#if NACPICA > 0
#include <dev/acpi/acpivar.h>
@@ -692,6 +699,16 @@
"mode_callback",
(uint64_t)&mode_cb);
}
+
+#if NWSDISPLAY > 0 && NGENFB > 0
+ if (device_is_a(dev, "genfb")) {
+ x86_genfb_set_console_dev(dev);
+#ifdef DDB
+ db_trap_callback =
+ x86_genfb_ddb_trap_callback;
+#endif
+ }
+#endif
}
prop_dictionary_set_bool(dict, "is_console", true);
prop_dictionary_set_bool(dict, "clear-screen", false);