aboutsummaryrefslogtreecommitdiff
path: root/hw/lpc-uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/lpc-uart.c')
-rw-r--r--hw/lpc-uart.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index c0f9c52..859d654 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -98,10 +98,16 @@ static inline void uart_write(unsigned int reg, uint8_t val)
static bool uart_check_tx_room(void)
{
+ uint8_t reg;
+
if (tx_room)
return true;
- if (uart_read(REG_LSR) & LSR_THRE) {
+ reg = uart_read(REG_LSR);
+ if (reg == 0xff)
+ return false;
+
+ if (reg & LSR_THRE) {
/* FIFO is 16 entries */
tx_room = 16;
tx_full = false;
@@ -337,7 +343,7 @@ static int64_t uart_opal_write_buffer_space(int64_t term_number,
lock(&uart_lock);
tx_buf_len = uart_tx_buf_space();
- if ((tx_buf_len < be64_to_cpu(*__length)) && uart_timed_out(1000))
+ if (uart_timed_out(1000))
ret = OPAL_TIMEOUT;
*__length = cpu_to_be64(tx_buf_len);