Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp300/dev Fix a longstanding bug in hilkbd (and dnk...



details:   https://anonhg.NetBSD.org/src/rev/5004184dd105
branches:  trunk
changeset: 958128:5004184dd105
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Dec 26 00:16:16 2020 +0000

description:
Fix a longstanding bug in hilkbd (and dnkbd) console attachment.

cn_tab->cn_dev is initialized in wsdisplay_emul_attach()
(but not in wsdiaplay_cnattach()) so it cannot be used
when hil(4) is attached before wsdisplay(4) is attached.
Instead, use exported wsdisplay_cnputc() that is actually
set in early wsdisplay_cnattach().

Now we can use ddb and RB_ASKNAME via HIL keyboard console.
Should be pulleld up to netbsd-8 and netbsd-9.

diffstat:

 sys/arch/hp300/dev/dnkbd.c     |  15 ++++++++++++---
 sys/arch/hp300/dev/hil_intio.c |  13 +++++++++++--
 2 files changed, 23 insertions(+), 5 deletions(-)

diffs (93 lines):

diff -r 98259681ddc2 -r 5004184dd105 sys/arch/hp300/dev/dnkbd.c
--- a/sys/arch/hp300/dev/dnkbd.c        Fri Dec 25 21:12:15 2020 +0000
+++ b/sys/arch/hp300/dev/dnkbd.c        Sat Dec 26 00:16:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dnkbd.c,v 1.10 2017/04/08 17:04:56 tsutsui Exp $       */
+/*     $NetBSD: dnkbd.c,v 1.11 2020/12/26 00:16:16 tsutsui Exp $       */
 /*     $OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $     */
 
 /*
@@ -69,6 +69,9 @@
 
 #include "opt_wsdisplay_compat.h"
 
+#include "wsdisplay.h"
+#include "wsmouse.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -87,7 +90,9 @@
 #include <dev/wscons/wskbdvar.h>
 #include <dev/wscons/wsksymdef.h>
 #include <dev/wscons/wsksymvar.h>
-#include "wsmouse.h"
+#if NWSDISPLAY > 0
+#include <dev/wscons/wsdisplayvar.h>
+#endif
 #if NWSMOUSE > 0
 #include <dev/wscons/wsmousevar.h>
 #endif
@@ -354,7 +359,8 @@
         * plugged), unless the console keyboard has been claimed already
         * (i.e. late hotplug with hil keyboard plugged first).
         */
-       if (major(cn_tab->cn_dev) == devsw_name2chr("wsdisplay", NULL, 0)) {
+#if NWSDISPLAY > 0
+       if (cn_tab->cn_putc == wsdisplay_cnputc) {
 #if NHILKBD > 0
                if (hil_is_console == -1) {
                        ka.console = 1;
@@ -365,7 +371,10 @@
                ka.console = 1;
 #endif
        } else
+#endif
+       {
                ka.console = 0;
+       }
 
        ka.keymap = &dnkbd_keymapdata;
        ka.accessops = &dnkbd_accessops;
diff -r 98259681ddc2 -r 5004184dd105 sys/arch/hp300/dev/hil_intio.c
--- a/sys/arch/hp300/dev/hil_intio.c    Fri Dec 25 21:12:15 2020 +0000
+++ b/sys/arch/hp300/dev/hil_intio.c    Sat Dec 26 00:16:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hil_intio.c,v 1.3 2011/02/19 05:36:49 tsutsui Exp $    */
+/*     $NetBSD: hil_intio.c,v 1.4 2020/12/26 00:16:16 tsutsui Exp $    */
 /*     $OpenBSD: hil_intio.c,v 1.8 2007/01/06 20:10:57 miod Exp $      */
 
 /*
@@ -28,6 +28,8 @@
  *
  */
 
+#include "wsdisplay.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -38,6 +40,9 @@
 #include <machine/intr.h>
 
 #include <dev/cons.h>
+#if NWSDISPLAY > 0
+#include <dev/wscons/wsdisplayvar.h>
+#endif
 
 #include <hp300/dev/intiovar.h>
 
@@ -88,8 +93,12 @@
        /*
         * Check that the configured console device is a wsdisplay.
         */
-       if (major(cn_tab->cn_dev) != devsw_name2chr("wsdisplay", NULL, 0))
+#if NWSDISPLAY > 0
+       if (cn_tab->cn_putc != wsdisplay_cnputc)
+#endif
+       {
                hil_is_console = 0;
+       }
 
        hil_attach(sc, &hil_is_console);
        intr_establish(hil_intr, sc, ia->ia_ipl, IPL_TTY);



Home | Main Index | Thread Index | Old Index