Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2007 15:41:51 +0200
From:      Christian Kandeler <christian.kandeler@hob.de>
To:        freebsd-hackers@freebsd.org
Subject:   Question about serial console code
Message-ID:  <200706151541.51913.christian.kandeler@hob.de>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706151541.51913.christian.kandeler>