From: patrick Date: Mon, 15 Aug 2016 21:04:32 +0000 (+0000) Subject: Now that com(4) uses a different iot for the initial console and the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4ad296a89635e5c99e55048c3c3def266da95154;p=openbsd 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@ --- 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 #include +#include #include @@ -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 * @@ -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__);