From owner-svn-src-all@FreeBSD.ORG Tue May 13 19:09:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC0D99B6; Tue, 13 May 2014 19:09:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD2DD2597; Tue, 13 May 2014 19:09:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4DJ90SN040530; Tue, 13 May 2014 19:09:00 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4DJ90Cc040529; Tue, 13 May 2014 19:09:00 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201405131909.s4DJ90Cc040529@svn.freebsd.org> From: Ian Lepore Date: Tue, 13 May 2014 19:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r265973 - stable/10/sys/dev/uart X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2014 19:09:01 -0000 Author: ian Date: Tue May 13 19:09:00 2014 New Revision: 265973 URL: http://svnweb.freebsd.org/changeset/base/265973 Log: MFC r257111, r257144, r257157, r257183 Test UARTs physical address instead of virtual. Be a bit more flexible in how we find the console from the properties on /chosen, following the list of allowed console properties in ePAPR. Also do not require that stdin be defined and equal to stdout: stdin is nonstandard (for ePAPR) and console in an unexpected place is after all better than no console. Modified: stable/10/sys/dev/uart/uart_cpu_fdt.c Modified: stable/10/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- stable/10/sys/dev/uart/uart_cpu_fdt.c Tue May 13 18:24:02 2014 (r265972) +++ stable/10/sys/dev/uart/uart_cpu_fdt.c Tue May 13 19:09:00 2014 (r265973) @@ -36,6 +36,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#include +#include #include #include @@ -88,13 +92,34 @@ int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { - return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); + if (b1->bst != b2->bst) + return (0); + if (pmap_kextract(b1->bsh) == 0) + return (0); + if (pmap_kextract(b2->bsh) == 0) + return (0); + return ((pmap_kextract(b1->bsh) == pmap_kextract(b2->bsh)) ? 1 : 0); +} + +static int +phandle_chosen_propdev(phandle_t chosen, const char *name, phandle_t *node) +{ + char buf[64]; + + if (OF_getprop(chosen, name, buf, sizeof(buf)) <= 0) + return (ENXIO); + if ((*node = OF_finddevice(buf)) == -1) + return (ENXIO); + + return (0); } int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { - char buf[64]; + const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", + "stdin-path", "stdin", NULL}; + const char **name; const struct ofw_compat_data *cd; struct uart_class *class; phandle_t node, chosen; @@ -105,7 +130,7 @@ uart_cpu_getdev(int devtype, struct uart uart_bus_space_mem = fdtbus_bs_tag; uart_bus_space_io = NULL; - /* Allow overriding the FDT uning the environment. */ + /* Allow overriding the FDT using the environment. */ class = &uart_ns8250_class; err = uart_getenv(devtype, di, class); if (!err) @@ -119,14 +144,11 @@ uart_cpu_getdev(int devtype, struct uart */ if ((chosen = OF_finddevice("/chosen")) == -1) return (ENXIO); - if (OF_getprop(chosen, "stdin", buf, sizeof(buf)) <= 0) - return (ENXIO); - if ((node = OF_finddevice(buf)) == -1) - return (ENXIO); - if (OF_getprop(chosen, "stdout", buf, sizeof(buf)) <= 0) - return (ENXIO); - if (OF_finddevice(buf) != node) - /* Only stdin == stdout is supported. */ + for (name = propnames; *name != NULL; name++) { + if (phandle_chosen_propdev(chosen, *name, &node) == 0) + break; + } + if (*name == NULL) return (ENXIO); /* * Retrieve serial attributes.