Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Add support for a "force_console" property, where...



details:   https://anonhg.NetBSD.org/src/rev/85371fbc60a4
branches:  trunk
changeset: 994941:85371fbc60a4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Nov 28 22:28:46 2018 +0000

description:
Add support for a "force_console" property, where when set, reuses the console dev configuration

diffstat:

 sys/dev/ic/com.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 7717031d7877 -r 85371fbc60a4 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Wed Nov 28 21:31:32 2018 +0000
+++ b/sys/dev/ic/com.c  Wed Nov 28 22:28:46 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.348 2018/05/27 17:05:06 jmcneill Exp $ */
+/* $NetBSD: com.c,v 1.349 2018/11/28 22:28:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.348 2018/05/27 17:05:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.349 2018/11/28 22:28:46 jmcneill Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -388,11 +388,13 @@
        const char *fifo_msg = NULL;
        prop_dictionary_t       dict;
        bool is_console = true;
+       bool force_console = false;
 
        aprint_naive("\n");
 
        dict = device_properties(sc->sc_dev);
        prop_dictionary_get_bool(dict, "is_console", &is_console);
+       prop_dictionary_get_bool(dict, "force_console", &force_console);
        callout_init(&sc->sc_diag_callout, 0);
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
 
@@ -414,10 +416,13 @@
 
        CSR_WRITE_1(regsp, COM_REG_IER, sc->sc_ier);
 
-       if (bus_space_is_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
-           regsp->cr_iobase == comcons_info.regs.cr_iobase) {
+       if ((bus_space_is_equal(regsp->cr_iot, comcons_info.regs.cr_iot) &&
+           regsp->cr_iobase == comcons_info.regs.cr_iobase) || force_console) {
                comconsattached = 1;
 
+               if (force_console)
+                       memcpy(regsp, &comcons_info.regs, sizeof(*regsp));
+
                if (cn_tab == NULL && comcnreattach() != 0) {
                        printf("can't re-init serial console @%lx\n",
                            (u_long)comcons_info.regs.cr_iobase);



Home | Main Index | Thread Index | Old Index