|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v8 12/26] emul/ns16x50: implement FCR register (write-only)
On 11/11/26 8:47 PM, dmukhin@xxxxxxxx wrote:
Bits 4 and 5 are indeed reserved on the TL16C550C ("reserved for future
use"), so warning is fine; with a local mask (02/26) the two checks
collapse into one. Nit: %#x, as in the MCR warnings.
One of the places that keeps LSR.DR in sync by hand, see 10/26.
The TX "FIFO" here is the line buffer of 11/26: everything in it has
already been reported to the guest as transmitted (THRE and TEMT are
set again right after each THR write), it just hasn't been printed yet
because no newline arrived. Resetting it discards output the guest
considers sent, e.g. a prompt without a trailing newline, whenever the
guest clears the TX FIFO. Linux does that in serial8250_do_startup()
and serial8250_do_shutdown(), via serial8250_clear_fifos(). Since TEMT
says the transmitter is empty, there is nothing left to clear from the
guest's point of view; I'd flush the buffer here instead of dropping
it (or leave it alone).
+ + regs[UART_LSR] |= UART_LSR_THRE | UART_LSR_TEMT; + vdev->thr_pending = true; + } + + if ( val & UART_FCR_ENABLE ) + val &= UART_FCR_ENABLE | UART_FCR_DMA | + UART_FCR_RTB0 | UART_FCR_RTB1; + else + val = 0;
The datasheet (SLLS177I, 7.7.2) also says for bit 0: "Changing this bit
clears the FIFOs", which isn't emulated: toggling FCR.ENABLE without
CLRX/CLTX leaves stale RX data in place. QEMU handles it by forcing
both clear bits when the enable bit changes:
if ((val ^ s->fcr) & UART_FCR_FE) {
val |= UART_FCR_XFR | UART_FCR_RFR;
}
(and with the above, the TX part would then be a flush rather than a
drop.)
As for the mask, UART_FCR_RTB0 | UART_FCR_RTB1 is UART_FCR_TRG14, see
my reply to 02/26.
~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |