From owner-svn-src-head@freebsd.org Tue Sep 8 17:10:12 2015 Return-Path: Delivered-To: svn-src-head@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 EF9759CC10F; Tue, 8 Sep 2015 17:10:11 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1F461EEB; Tue, 8 Sep 2015 17:10:11 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from zeppelin.tachypleus.net (75-101-50-44.static.sonic.net [75.101.50.44]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id t88HA3QZ029782 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 8 Sep 2015 10:10:03 -0700 Subject: Re: svn commit: r287565 - head/sys/dev/uart To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201509081606.t88G64l5067029@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <55EF166A.40703@freebsd.org> Date: Tue, 8 Sep 2015 10:10:02 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <201509081606.t88G64l5067029@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVYnUe0ilJobPxodrPZF6LneWdVKb3HwsGqzW1fmAFgm6nbR69sfXnq2pI0s0iVnoizsb5zfL/31MrSy9IG6dkrCq1hqj4xboXU= X-Sonic-ID: C;ZJ67cUxW5RGbm70U9jFv0A== M;XrMLckxW5RGbm70U9jFv0A== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 17:10:12 -0000 Nice work! You might want to look at uart_cpu_powerpc.c, which already supports stdout-path and various related things. -Nathan On 09/08/15 09:06, Andrew Turner wrote: > 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); >