1
From 433f879015ea04ca3053b15bf5b834b28badd977 Mon Sep 17 00:00:00 2001
2
From: Peter Maydell <peter.maydell@linaro.org>
3
Date: Mon, 18 Feb 2013 16:58:29 +0000
4
Subject: [PATCH 35/69] serial: reset lsr dr/thre upon fcr rfr/xfr
6
Content-Type: text/plain; charset=UTF-8
7
Content-Transfer-Encoding: 8bit
11
further fix serial.c fifo clear
13
when receive fifo is requested to be cleared and there is a received byte
14
pending to be read, accept the byte while discarding it so it will not stay
17
yet another serial tweak
21
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
23
hw/char/serial.c | 7 +++++++
24
1 file changed, 7 insertions(+)
26
diff --git a/hw/char/serial.c b/hw/char/serial.c
27
index 0383972..e5e511b 100644
28
--- a/hw/char/serial.c
29
+++ b/hw/char/serial.c
30
@@ -368,10 +368,17 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
31
qemu_del_timer(s->fifo_timeout_timer);
32
s->timeout_ipending=0;
33
fifo_clear(s,RECV_FIFO);
34
+ if ((s->lsr & UART_LSR_DR)) {
35
+ s->lsr &= ~(UART_LSR_DR | UART_LSR_BI | UART_LSR_OE);
36
+ if (!(s->mcr & UART_MCR_LOOP)) {
37
+ qemu_chr_accept_input(s->chr);
42
if (val & UART_FCR_XFR) {
43
fifo_clear(s,XMIT_FIFO);
44
+ s->lsr |= UART_LSR_THRE;
47
if (val & UART_FCR_FE) {