From owner-freebsd-current@FreeBSD.ORG Sat Oct 13 00:09:42 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1FBF35B8 for ; Sat, 13 Oct 2012 00:09:42 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id F005A8FC08 for ; Sat, 13 Oct 2012 00:09:41 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id B195F1BA89; Fri, 12 Oct 2012 17:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1350086981; bh=uJTcmq71Wvt9DnSvQbID6dNQ9tAjf/u3ZLE50nJI58A=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=eoUN3/nveXyBWKvxgpZEjmCoQXzDBN/Fp+XQJmETGxOkpvLqCVAyD6u5Wy940WR33 Xl/OA74d6cvPJrHKJvRZXFIECx6AavDt8IqOf+0f/T1/YKclWGPRYaF1qT51zZqgS+ ZtrlazvCafNJlQWikKzAY52LcOzySafovbQtLCEs= Message-ID: <5078B145.4090501@delphij.net> Date: Fri, 12 Oct 2012 17:09:41 -0700 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Garrett Cooper Subject: Re: boot2/loader: serial port handling References: <5078A803.7070705@delphij.net> In-Reply-To: X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, d@delphij.net X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 00:09:42 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/12/12 17:04, Garrett Cooper wrote: > On Fri, Oct 12, 2012 at 4:30 PM, Xin Li > wrote: >> Hi, >> >> We have some rather hacky quick hack at $WORK that addresses a >> problem we have found with boot2/loader and wants to share it and >> see if we can have more neat solution. >> >> Here is the problem: the current boot2 and loader have various >> places where it considers serial port to exist. When the port is >> not there, the code would hang because it tests whether the >> hardware's -READY bit, basically something like: >> >> do { } while (inpb(state register) & READY_BIT); >> >> This unfortunately would enter an infinite loop when the device >> is not present -- all in operations would get all bits set. >> >> To reproduce this, one can compile boot2/loader with non-existent >> port and the system will hang at very early stage of boot. >> >> --- >> >> Because boot2 is size constrained we can not use very >> sophisticated detection logic there, what I did is to use >> something like: >> >> outb(line control register, word) if (inb(line control register) >> != word) Disable the serial port read/write >> >> For loader I'm not sure if we should use better detection logic. >> By the way, it seems that the system may force using the default >> console in loader regardless if the detection logic said no, if >> it decides that's the only usable one. >> >> So what would be the right way to solve these issue? > > Have you tried out Andriy's commit yet to loader(8) (r241301)? Ah I wish I am not this far behind my email backlog. Yes I think these (241300 and 241301) will solve the problem. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQeLFFAAoJEG80Jeu8UPuzktAH/3nyrSCrvHWlOSp/eOWf1oMU KQwzyUXOVgKWCVTHUYHN6tCs0sN1Vguc1n+Q8tqSCuDOJ4/x0lyb6GcyxZv2tf6+ gGYE54yYjf9UDM0HQ3Zb3ZxmH8Z06eH3jK/SlUg8nMXnReLW2v1KkuQ+T3yTyhQH 7vCjOzQylF4CmzpS7l/skNL2lxkJsoD/XROFzRrDAUSK2rdnupjUIxuTXI2G+Bjf i51qFZk6JRHnecL2c4Zm6ynO65eXyD0Ux7l+FOa00ntOKD33/HJP/Qtpl2UrU+J5 YhMcPUU2uRM3LTSl2D3mtbasrgKQMTmH4syp4ucR7belFPloX7RYjHItQdO6x1M= =0R8e -----END PGP SIGNATURE-----