Re: [Qemu-devel] [PATCH v3 2/4] serial: clean up THRE/TEMT handling

2014-12-15 Thread Dr. David Alan Gilbert
* Paolo Bonzini (pbonz...@redhat.com) wrote: > > > On 15/12/2014 12:40, Dr. David Alan Gilbert wrote: > >> > do { > >> > +assert(!(s->lsr & UART_LSR_TEMT)); > >> > +assert(!(s->lsr & UART_LSR_THRE)); > >> > + > >> > if (s->tsr_retry <= 0) { > >> > if (s-

Re: [Qemu-devel] [PATCH v3 2/4] serial: clean up THRE/TEMT handling

2014-12-15 Thread Dr. David Alan Gilbert
* Paolo Bonzini (pbonz...@redhat.com) wrote: > > > On 15/12/2014 16:21, Dr. David Alan Gilbert wrote: > >> > > >> > - serial_xmit is called from outside only after resetting TEMT and THRE > >> > and pushing a character on the FIFO > > Are you sure about TEMT? My reading of serial_ioport_write is

Re: [Qemu-devel] [PATCH v3 2/4] serial: clean up THRE/TEMT handling

2014-12-15 Thread Paolo Bonzini
On 15/12/2014 16:21, Dr. David Alan Gilbert wrote: >> > >> > - serial_xmit is called from outside only after resetting TEMT and THRE >> > and pushing a character on the FIFO > Are you sure about TEMT? My reading of serial_ioport_write is that if > !FCR_FE then TEMT isn't cleared. This patch cha

Re: [Qemu-devel] [PATCH v3 2/4] serial: clean up THRE/TEMT handling

2014-12-15 Thread Paolo Bonzini
On 15/12/2014 12:40, Dr. David Alan Gilbert wrote: >> > do { >> > +assert(!(s->lsr & UART_LSR_TEMT)); >> > +assert(!(s->lsr & UART_LSR_THRE)); >> > + >> > if (s->tsr_retry <= 0) { >> > if (s->fcr & UART_FCR_FE) { >> > -if (fifo8_is_empty(

Re: [Qemu-devel] [PATCH v3 2/4] serial: clean up THRE/TEMT handling

2014-12-15 Thread Dr. David Alan Gilbert
* Paolo Bonzini (pbonz...@redhat.com) wrote: > - assert THRE cleared and FIFO not empty (if enabled) before > sending a character. Also assert TEMT cleared, since it is > the combination of THRE && transmitter shift register empty. > > - raise THRI immediately after setting THRE > > - check THRE

[Qemu-devel] [PATCH v3 2/4] serial: clean up THRE/TEMT handling

2014-12-12 Thread Paolo Bonzini
- assert THRE cleared and FIFO not empty (if enabled) before sending a character. Also assert TEMT cleared, since it is the combination of THRE && transmitter shift register empty. - raise THRI immediately after setting THRE - check THRE to see if another character has to be sent, which makes th