From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 15 14:01:06 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 CAEFD16A46E for ; Fri, 15 Jun 2007 14:01:06 +0000 (UTC) (envelope-from christian.kandeler@hob.de) Received: from mailgate.hob.de (mailgate.hob.de [212.185.199.3]) by mx1.freebsd.org (Postfix) with ESMTP id 3376913C46E for ; Fri, 15 Jun 2007 14:01:06 +0000 (UTC) (envelope-from christian.kandeler@hob.de) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate.hob.de (Postfix) with ESMTP id 6F7E428059 for ; Fri, 15 Jun 2007 15:41:56 +0200 (CEST) Received: from mailgate.hob.de ([127.0.0.1]) by localhost (mailgate.hob.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31035-07 for ; Fri, 15 Jun 2007 15:41:56 +0200 (CEST) Received: from imap.hob.de (mail2.hob.de [172.25.1.102]) by mailgate.hob.de (Postfix) with ESMTP id 4004928054 for ; Fri, 15 Jun 2007 15:41:56 +0200 (CEST) Received: from [172.22.0.190] (linux03.hob.de [172.22.0.190]) by imap.hob.de (Postfix on SuSE eMail Server 2.0) with ESMTP id CB206C493C for ; Fri, 15 Jun 2007 15:41:55 +0200 (CEST) From: Christian Kandeler Organization: HOB To: freebsd-hackers@freebsd.org Date: Fri, 15 Jun 2007 15:41:51 +0200 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200706151541.51913.christian.kandeler@hob.de> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at hob.de Subject: 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 14:01:06 -0000 Hi, I've spent some time figuring out the code path for user space output to a serial console, and there is one thing I don't understand. The code flow goes via write() and tty_write() to uart_tty_oproc(), which contains the following line: 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. 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? 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? Regards, Christian Kandeler