From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 15 16:05:00 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B8EA16A496 for ; Fri, 15 Jun 2007 16:05:00 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.186]) by mx1.freebsd.org (Postfix) with ESMTP id 7600313C44B for ; Fri, 15 Jun 2007 16:05:00 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from mac.com (smtpin02-en2 [10.13.10.147]) by smtpout.mac.com (Xserve/smtpout16/MantshX 4.0) with ESMTP id l5FG4xZU025630; Fri, 15 Jun 2007 09:04:59 -0700 (PDT) Received: from [172.16.1.3] (209-128-86-226.bayarea.net [209.128.86.226]) (authenticated bits=0) by mac.com (Xserve/smtpin02/MantshX 4.0) with ESMTP id l5FG46f4026538 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 15 Jun 2007 09:04:25 -0700 (PDT) In-Reply-To: <200706151541.51913.christian.kandeler@hob.de> References: <200706151541.51913.christian.kandeler@hob.de> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8D1F83C2-C7A6-4C86-88BE-17DD516DA4D9@mac.com> Content-Transfer-Encoding: 7bit From: Marcel Moolenaar Date: Fri, 15 Jun 2007 09:03:50 -0700 To: Christian Kandeler X-Mailer: Apple Mail (2.752.3) Cc: freebsd-hackers@freebsd.org Subject: Re: Question about serial console code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2007 16:05:00 -0000 On Jun 15, 2007, at 6:41 AM, Christian Kandeler wrote: > sc->sc_txdatasz = q_to_b(&tp->t_outq, sc->sc_txbuf, sc->sc_txfifosz); > This copies at most sc->sc_txfifosz (the size of the UART's FIFO) > bytes from > tp->outq to sc->sc_txbuf. After that, UART_TRANSMIT is called and > outputs the > characters just copied to the serial device. Yes. > Now obviously, the number of > characters in tp->t_outq can be greater than the UART's FIFO size, > but I > can't for the life of me find a loop anywhere in the call tree. So > what > happens to the rest of the outq buffer? The loop is formed by the transmit interrupt of the UART. When UART_TRANSMIT() is called, the FIFO of the UART is written and transmission starts. Eventually the UART will raise a "transmission done" interrupt, which will trigger the next iteration. > And what if the UART has no FIFO at > all (e.g. 8250)? sc->sc_txfifosz is zero in that case, so how does > anything > ever get printed then? If the UART has no FIFO (in the 16550-sense), then sc_txfifosz is still 1. There's obviously always at least 1 8-bit register in the UART to which data can to be written or read. The use of FIFO in the uart(4) is not limited to its definition in PC hardware. FYI, -- Marcel Moolenaar xcllnt@mac.com