Having recently written a driver for the Goldfish TTY for NetBSD, I found it a 
bit odd (and a little annoying) that the device has a PUT_CHAR register but not 
a GET_CHAR register, something particularly useful for early-console or 
in-kernel debugger use.  As it stands, to get a single character from the 
device, you have to first poke a DMA address into 1 (or 2) registers and then 
poke the command register.  Depending on the operating system environment, this 
might involve a lot of kernel machinery.  My current driver works around this, 
but makes an explicit assumption that a physical address is a valid DMA 
address, which is the true for the m68k virt platform, but is the sort of 
assumption one shouldn’t be making these days.

Would there be an objection to adding a single-register-read get-char operation 
to the Goldfish TTY?  The change I have in mind is to bump the version to 2 (so 
that driver software can identity the capability) and then allow reads of the 
PUT_CHAR register to return the first pending byte or -1 if the FIFO is empty.  
Happy to create an additional register for the purpose if that’s preferred, but 
it seemed better to keep the footprint of the device the same.

If the consensus is that this is a worthwhile enhancement, I’ll post a patch.

Cheers.

-- thorpej


Reply via email to