Commit 7500b1f6 authored by Aristeu Rozanski's avatar Aristeu Rozanski Committed by Linus Torvalds

8250: fix break handling for Intel 82571

Intel 82571 has a "Serial Over LAN" feature that doesn't properly
implements the receiving of break characters.  When a break is received,
it doesn't set UART_LSR_DR and unless another character is received, the
break won't be received by the application.
Signed-off-by: default avatarAristeu Rozanski <arozansk@redhat.com>
Acked-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 920519c1
...@@ -1293,7 +1293,18 @@ receive_chars(struct uart_8250_port *up, unsigned int *status) ...@@ -1293,7 +1293,18 @@ receive_chars(struct uart_8250_port *up, unsigned int *status)
char flag; char flag;
do { do {
if (likely(lsr & UART_LSR_DR))
ch = serial_inp(up, UART_RX); ch = serial_inp(up, UART_RX);
else
/*
* Intel 82571 has a Serial Over Lan device that will
* set UART_LSR_BI without setting UART_LSR_DR when
* it receives a break. To avoid reading from the
* receive buffer without UART_LSR_DR bit set, we
* just force the read character to be 0
*/
ch = 0;
flag = TTY_NORMAL; flag = TTY_NORMAL;
up->port.icount.rx++; up->port.icount.rx++;
...@@ -1342,7 +1353,7 @@ receive_chars(struct uart_8250_port *up, unsigned int *status) ...@@ -1342,7 +1353,7 @@ receive_chars(struct uart_8250_port *up, unsigned int *status)
ignore_char: ignore_char:
lsr = serial_inp(up, UART_LSR); lsr = serial_inp(up, UART_LSR);
} while ((lsr & UART_LSR_DR) && (max_count-- > 0)); } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0));
spin_unlock(&up->port.lock); spin_unlock(&up->port.lock);
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
spin_lock(&up->port.lock); spin_lock(&up->port.lock);
...@@ -1425,7 +1436,7 @@ serial8250_handle_port(struct uart_8250_port *up) ...@@ -1425,7 +1436,7 @@ serial8250_handle_port(struct uart_8250_port *up)
DEBUG_INTR("status = %x...", status); DEBUG_INTR("status = %x...", status);
if (status & UART_LSR_DR) if (status & (UART_LSR_DR | UART_LSR_BI))
receive_chars(up, &status); receive_chars(up, &status);
check_modem_status(up); check_modem_status(up);
if (status & UART_LSR_THRE) if (status & UART_LSR_THRE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment