Received: from eggs.gnu.org ([2001:4830:134:3::10]:58752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0Ygn-0007B0-ML for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:40:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0Ygh-0005eW-1p for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:40:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0Ygg-0005eN-RQ for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:58 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBFGdw2G001367 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 15 Dec 2014 11:39:58 -0500 Received: from playground.com (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBFGcXPR031674 for ; Mon, 15 Dec 2014 11:39:57 -0500 From: Paolo Bonzini Date: Mon, 15 Dec 2014 17:38:25 +0100 Message-Id: <1418661511-22348-42-git-send-email-pbonzini@redhat.com> In-Reply-To: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> References: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 41/47] serial: update LSR on enabling/disabling FIFOs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org When the transmit FIFO is emptied or enabled, the transmitter hold register is empty. When it is disabled, it is also emptied and in addition the previous contents of the transmitter hold register are discarded. In either case, the THRE bit in LSR must be set and THRI raised. When the receive FIFO is emptied or enabled, the data ready and break bits must be cleared in LSR. Likewise when the receive FIFO is disabled. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- hw/char/serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/char/serial.c b/hw/char/serial.c index 9adb126..76054a5 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -377,12 +377,15 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val, /* FIFO clear */ if (val & UART_FCR_RFR) { + s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); timer_del(s->fifo_timeout_timer); s->timeout_ipending = 0; fifo8_reset(&s->recv_fifo); } if (val & UART_FCR_XFR) { + s->lsr |= UART_LSR_THRE; + s->thr_ipending = 1; fifo8_reset(&s->xmit_fifo); } -- 1.8.3.1