summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-08-15 21:04:33 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-08-15 21:04:33 +0000
commit9c9fd5ec680ac6056b8c58f95b618015eebc5a01 (patch)
tree0a15a92e1a3f293acbd9fb71d0b708d4efc36a08
parentd0481db6a55a0c22307f2bf12dcc23093933bf94 (diff)
Now that com(4) uses a different iot for the initial console and the
main attachment, the serial port is now longer recognized as console. To fix this, store the OFW node of the initial console and check it in the attachment driver. ok kettenis@
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.c9
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.h4
-rw-r--r--sys/arch/armv7/dev/com_fdt.c7
3 files changed, 16 insertions, 4 deletions
diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c
index 8c1bda586a2..aa7125907e8 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.c
+++ b/sys/arch/armv7/armv7/armv7_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.c,v 1.35 2016/08/08 19:27:12 kettenis Exp $ */
+/* $OpenBSD: armv7_machdep.c,v 1.36 2016/08/15 21:04:32 patrick Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -124,6 +124,7 @@
#include <dev/cons.h>
#include <dev/ofw/fdt.h>
+#include <dev/ofw/openfirm.h>
#include <net/if.h>
@@ -215,6 +216,8 @@ bs_protos(bs_notimpl);
int comcnspeed = CONSPEED;
int comcnmode = CONMODE;
+int stdout_node = 0;
+
/*
* void boot(int howto, char *bootstr)
*
@@ -902,8 +905,10 @@ fdt_find_cons(const char *name)
/* Lookup the physical address of the interface. */
if (stdout) {
node = fdt_find_node(stdout);
- if (node && fdt_is_compatible(node, name))
+ if (node && fdt_is_compatible(node, name)) {
+ stdout_node = OF_finddevice(stdout);
return (node);
+ }
}
return (NULL);
diff --git a/sys/arch/armv7/armv7/armv7_machdep.h b/sys/arch/armv7/armv7/armv7_machdep.h
index 7533582c6bf..616613e375d 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.h
+++ b/sys/arch/armv7/armv7/armv7_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.h,v 1.8 2016/06/08 15:27:05 jsg Exp $ */
+/* $OpenBSD: armv7_machdep.h,v 1.9 2016/08/15 21:04:32 patrick Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -18,6 +18,8 @@
#ifndef __PLATFORMVAR_H__
#define __PLATFORMVAR_H__
+extern int stdout_node;
+
void platform_init(void);
void platform_powerdown(void);
void platform_watchdog_reset(void);
diff --git a/sys/arch/armv7/dev/com_fdt.c b/sys/arch/armv7/dev/com_fdt.c
index e72da185bdf..5ca649b8cfd 100644
--- a/sys/arch/armv7/dev/com_fdt.c
+++ b/sys/arch/armv7/dev/com_fdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com_fdt.c,v 1.2 2016/08/15 14:17:34 patrick Exp $ */
+/* $OpenBSD: com_fdt.c,v 1.3 2016/08/15 21:04:32 patrick Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
* All rights reserved.
@@ -124,6 +124,11 @@ com_fdt_attach(struct device *parent, struct device *self, void *aux)
sc->sc.sc_frequency = 48000000;
sc->sc.sc_uarttype = COM_UART_TI16750;
+ if (stdout_node == faa->fa_node) {
+ SET(sc->sc.sc_hwflags, COM_HW_CONSOLE);
+ SET(sc->sc.sc_swflags, COM_SW_SOFTCAR);
+ }
+
if (bus_space_map(sc->sc.sc_iot, sc->sc.sc_iobase,
faa->fa_reg[0].size, 0, &sc->sc.sc_ioh)) {
printf("%s: bus_space_map failed\n", __func__);