All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aristeu Rozanski <arozansk@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] 8250: fix break handling for Intel 82571
Date: Fri, 30 May 2008 12:25:05 -0400	[thread overview]
Message-ID: <20080530162505.GA2536@redhat.com> (raw)

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: Aristeu Rozanski <arozansk@redhat.com>

---
 drivers/serial/8250.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- linus-2.6.orig/drivers/serial/8250.c	2008-05-15 13:32:48.000000000 -0400
+++ linus-2.6/drivers/serial/8250.c	2008-05-15 13:48:59.000000000 -0400
@@ -1296,7 +1296,18 @@ receive_chars(struct uart_8250_port *up,
 	char flag;
 
 	do {
-		ch = serial_inp(up, UART_RX);
+		if (likely(lsr & UART_LSR_DR))
+			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;
 		up->port.icount.rx++;
 
@@ -1345,7 +1356,7 @@ receive_chars(struct uart_8250_port *up,
 
 ignore_char:
 		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);
 	tty_flip_buffer_push(tty);
 	spin_lock(&up->port.lock);
@@ -1428,7 +1439,7 @@ serial8250_handle_port(struct uart_8250_
 
 	DEBUG_INTR("status = %x...", status);
 
-	if (status & UART_LSR_DR)
+	if (status & (UART_LSR_DR | UART_LSR_BI))
 		receive_chars(up, &status);
 	check_modem_status(up);
 	if (status & UART_LSR_THRE)


             reply	other threads:[~2008-05-30 16:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 16:25 Aristeu Rozanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-05-19 14:21 [PATCH] 8250: fix break handling for Intel 82571 Aristeu Rozanski
2008-05-15 18:30 Aristeu Rozanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080530162505.GA2536@redhat.com \
    --to=arozansk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.