1. 16 12月, 2014 2 次提交
    • P
      serial: update LSR on enabling/disabling FIFOs · 023c3a97
      Paolo Bonzini 提交于
      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: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      023c3a97
    • P
      serial: clean up THRE/TEMT handling · 0d931d70
      Paolo Bonzini 提交于
      - assert TEMT is cleared before sending a character; we'll get one from
      TSR if tsr_retry > 0, from the FIFO or THR otherwise
      
      - assert THRE cleared and FIFO not empty (if enabled) before fetching a
      character to send.  This effectively reverts dffacd46, but the check
      makes no sense and commit f702e62a (serial: change retry logic to avoid
      concurrency, 2014-07-11) must have made it unnecessary.  The commit
      message for f702e62a talks about multiple calls to qemu_chr_fe_add_watch
      triggering s->tsr_retry >= MAX_XMIT_RETRY, but other failures were
      possible.  For example, if you have multiple calls, the subsequent ones
      will see s->tsr_retry == 0 and will find THRE and/or TEMT on entry.
      
      - for clarity, raise THRI immediately after the code sets THRE
      
      - check THRE to see if another character has to be sent.  This makes
      the assertions more obvious and also means TEMT has to be set as soon as
      the loop ends.  It makes the loop send both TSR and THR if flow-control
      happens in non-FIFO mode.  Previously, THR would be lost.
      
      - clear TEMT together with THRE even in the non-FIFO case
      
      The last two items are bugfixes, but they were just found by inspection
      and do not squash known bugs.
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d931d70
  2. 15 12月, 2014 38 次提交