Module Name:    src
Committed By:   rin
Date:           Tue Jul 23 17:39:36 UTC 2019

Modified Files:
        src/sys/dev/wscons: wsdisplay.c
        src/sys/sys: systm.h

Log Message:
Enable us to enter DDB from serial console when WSDISPLAY_MULTICONS
is enabled. This is necessary for machines on which framebuffer
console cannot be disabled at run time.

opt_wsdisplay_compat.h is generated for all ports including those
that do not support wscons.

OK Jared


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.285 -r1.286 src/sys/sys/systm.h

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/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.155 src/sys/dev/wscons/wsdisplay.c:1.156
--- src/sys/dev/wscons/wsdisplay.c:1.155	Tue Jul 23 15:55:49 2019
+++ src/sys/dev/wscons/wsdisplay.c	Tue Jul 23 17:39:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.155 2019/07/23 15:55:49 jmcneill Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.156 2019/07/23 17:39:36 rin Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.155 2019/07/23 15:55:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.156 2019/07/23 17:39:36 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -277,6 +277,19 @@ static int wsdisplay_dosync(struct wsdis
 int wsdisplay_clearonclose;
 
 #ifdef WSDISPLAY_MULTICONS
+/*
+ * Replace cn_isconsole() so that we can enter DDB from old console.
+ */
+bool
+wsdisplay_cn_isconsole(dev_t dev)
+{
+
+	return (cn_tab != NULL && cn_tab->cn_dev == dev) ||
+	    (cn_tab == &wsdisplay_cons && !wsdisplay_multicons_suspended &&
+	    wsdisplay_multicons_enable && wsdisplay_ocn != NULL &&
+	    wsdisplay_ocn->cn_dev == dev);
+}
+
 static void
 wsscreen_getc_poll(void *priv)
 {

Index: src/sys/sys/systm.h
diff -u src/sys/sys/systm.h:1.285 src/sys/sys/systm.h:1.286
--- src/sys/sys/systm.h:1.285	Mon May 20 20:35:45 2019
+++ src/sys/sys/systm.h	Tue Jul 23 17:39:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: systm.h,v 1.285 2019/05/20 20:35:45 christos Exp $	*/
+/*	$NetBSD: systm.h,v 1.286 2019/07/23 17:39:36 rin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -44,6 +44,7 @@
 #include "opt_multiprocessor.h"
 #include "opt_gprof.h"
 #include "opt_kleak.h"
+#include "opt_wsdisplay_compat.h"
 #endif
 #if !defined(_KERNEL) && !defined(_STANDALONE)
 #include <stdbool.h>
@@ -541,7 +542,12 @@ typedef struct cnm_state {
 #define cn_trap()	console_debugger()
 #endif
 #ifndef cn_isconsole
+#ifndef WSDISPLAY_MULTICONS
 #define cn_isconsole(d)	(cn_tab != NULL && (d) == cn_tab->cn_dev)
+#else
+bool wsdisplay_cn_isconsole(dev_t);
+#define cn_isconsole(d)	wsdisplay_cn_isconsole(d)
+#endif
 #endif
 
 void cn_init_magic(cnm_state_t *);

Reply via email to