From owner-svn-src-all@freebsd.org Tue Sep 8 16:06:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 367D6A00BB4; Tue, 8 Sep 2015 16:06:05 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.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 0D954198B; Tue, 8 Sep 2015 16:06:05 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t88G64gU067030; Tue, 8 Sep 2015 16:06:04 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t88G64l5067029; Tue, 8 Sep 2015 16:06:04 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509081606.t88G64l5067029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 8 Sep 2015 16:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287565 - head/sys/dev/uart X-SVN-Group: head 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.20 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, 08 Sep 2015 16:06:05 -0000 Author: andrew Date: Tue Sep 8 16:06:04 2015 New Revision: 287565 URL: https://svnweb.freebsd.org/changeset/base/287565 Log: Allow us to set the console device tree node. This is needed as not all vendor supplied device trees contain the needed properties for us to select the correct uart to use as the kernel console. An example of this would be to add the following to loader.conf. hw.fdt.console="/smb/uart@f7113000" The intention of this is slightly different than the existing hw.uart.console option. The new option will mean the boot serial configuration will be derived from the device node, while the existing option expects the user to configure all this themselves. Further work is planned to allow the uart configuration to be set based on the stdout-path property devicetree bindings. Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D3559 Modified: head/sys/dev/uart/uart_cpu_fdt.c Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Tue Sep 8 16:05:18 2015 (r287564) +++ head/sys/dev/uart/uart_cpu_fdt.c Tue Sep 8 16:06:04 2015 (r287565) @@ -134,6 +134,7 @@ uart_cpu_getdev(int devtype, struct uart phandle_t node, chosen; pcell_t shift, br, rclk; u_long start, size, pbase, psize; + char *cp; int err; uart_bus_space_mem = fdtbus_bs_tag; @@ -148,18 +149,25 @@ uart_cpu_getdev(int devtype, struct uart if (devtype != UART_DEV_CONSOLE) return (ENXIO); - /* - * Retrieve /chosen/std{in,out}. - */ - node = -1; - if ((chosen = OF_finddevice("/chosen")) != -1) { - for (name = propnames; *name != NULL; name++) { - if (phandle_chosen_propdev(chosen, *name, &node) == 0) - break; + /* Has the user forced a specific device node? */ + cp = kern_getenv("hw.fdt.console"); + if (cp == NULL) { + /* + * Retrieve /chosen/std{in,out}. + */ + node = -1; + if ((chosen = OF_finddevice("/chosen")) != -1) { + for (name = propnames; *name != NULL; name++) { + if (phandle_chosen_propdev(chosen, *name, + &node) == 0) + break; + } } + if (chosen == -1 || *name == NULL) + node = OF_finddevice("serial0"); /* Last ditch */ + } else { + node = OF_finddevice(cp); } - if (chosen == -1 || *name == NULL) - node = OF_finddevice("serial0"); /* Last ditch */ if (node == -1) /* Can't find anything */ return (ENXIO);