Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86 if genfb is attached, hook into db_trap_callbac...



details:   https://anonhg.NetBSD.org/src/rev/aaa451e9905a
branches:  trunk
changeset: 761853:aaa451e9905a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Feb 09 13:24:23 2011 +0000

description:
if genfb is attached, hook into db_trap_callback to switch in and out of
polling mode as necessary

diffstat:

 sys/arch/x86/include/genfb_machdep.h |   4 +++-
 sys/arch/x86/x86/genfb_machdep.c     |  27 +++++++++++++++++++++++++--
 sys/arch/x86/x86/x86_autoconf.c      |  21 +++++++++++++++++++--
 3 files changed, 47 insertions(+), 5 deletions(-)

diffs (128 lines):

diff -r ca224cdd75ef -r aaa451e9905a sys/arch/x86/include/genfb_machdep.h
--- a/sys/arch/x86/include/genfb_machdep.h      Wed Feb 09 13:19:53 2011 +0000
+++ b/sys/arch/x86/include/genfb_machdep.h      Wed Feb 09 13:24:23 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 */
diff -r ca224cdd75ef -r aaa451e9905a sys/arch/x86/x86/genfb_machdep.c
--- a/sys/arch/x86/x86/genfb_machdep.c  Wed Feb 09 13:19:53 2011 +0000
+++ b/sys/arch/x86/x86/genfb_machdep.c  Wed Feb 09 13:24:23 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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
diff -r ca224cdd75ef -r aaa451e9905a sys/arch/x86/x86/x86_autoconf.c
--- a/sys/arch/x86/x86/x86_autoconf.c   Wed Feb 09 13:19:53 2011 +0000
+++ b/sys/arch/x86/x86/x86_autoconf.c   Wed Feb 09 13:24:23 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index