From owner-svn-src-all@freebsd.org Wed Jan 20 23:38:50 2016 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 45DA1A8BB96; Wed, 20 Jan 2016 23:38:50 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D228F1B25; Wed, 20 Jan 2016 23:38:49 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id u0KNcd1c058255 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 21 Jan 2016 00:38:39 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id u0KNcdcp058254; Thu, 21 Jan 2016 00:38:39 +0100 (CET) (envelope-from marius) Date: Thu, 21 Jan 2016 00:38:39 +0100 From: Marius Strobl To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r294362 - in head/sys: dev/uart kern sys Message-ID: <20160120233839.GN15359@alchemy.franken.de> References: <201601192334.u0JNYST5080954@repo.freebsd.org> <1453256671.46848.98.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453256671.46848.98.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (alchemy.franken.de [0.0.0.0]); Thu, 21 Jan 2016 00:38:39 +0100 (CET) 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: Wed, 20 Jan 2016 23:38:50 -0000 On Tue, Jan 19, 2016 at 07:24:31PM -0700, Ian Lepore wrote: > On Tue, 2016-01-19 at 23:34 +0000, Marius Strobl wrote: > > Author: marius > > Date: Tue Jan 19 23:34:27 2016 > > New Revision: 294362 > > URL: https://svnweb.freebsd.org/changeset/base/294362 > > > > Log: > > Fix tty_drain() and, thus, TIOCDRAIN of the current tty(4) incarnation > > to actually wait until the TX FIFOs of UARTs have be drained before > > returning. This is done by bringing the equivalent of the TS_BUSY flag > > found in the previous implementation back in an ABI-preserving way. > > Reported and tested by: Patrick Powell > > > > Most likely, drivers for USB-serial-adapters likewise incorporating > > TX FIFOs as well as other terminal devices that buffer output in some > > form should also provide implementations of tsw_busy. > > > > MFC after:> > 3 days > > > > Modified: > > head/sys/dev/uart/uart_tty.c > > head/sys/kern/tty.c > > head/sys/sys/ttydevsw.h > > This rocks. > > It would rock even more if uart's sc_txbusy actually meant what its > name implies, but for some hardware what it really indicates is "the > hardware can/cannot accept more data" which is not the same as "all > data has been transmitted." Even for hardware that doesn't signal > txidle until the fifo is completely empty (not just at a lowater mark), > there may still be a last byte on the way out from a tx holding > register. > Yes, I'm aware that at least for uart_dev_ns8250.c, sc_txbusy doesn't cover a character still being in the TX shift register so far. I've started working on that but it turned out to be non-trivial to get right. Marius