Page MenuHomeFreeBSD

D36184.id109310.diff
No OneTemporary

D36184.id109310.diff

Index: sys/dev/uart/uart_dev_ns8250.c
===================================================================
--- sys/dev/uart/uart_dev_ns8250.c
+++ sys/dev/uart/uart_dev_ns8250.c
@@ -178,13 +178,21 @@
* limit high enough to handle large FIFOs and integrated
* UARTs. The HP rx2600 for example has 3 UARTs on the
* management board that tend to get a lot of data send
- * to it when the UART is first activated.
+ * to it when the UART is first activated. Assume that we
+ * have finished draining if !LSR_RXRDY is asserted both
+ * prior to and after a DELAY; but as long as LSR_RXRDY is
+ * not asserted, read (and discard) characters as quickly
+ * as possible.
*/
- limit=10*4096;
- while ((uart_getreg(bas, REG_LSR) & LSR_RXRDY) && --limit) {
+ for (limit = 10 * 4096; limit > 0; limit--) {
+ if ((uart_getreg(bas, REG_LSR) & LSR_RXRDY) == 0) {
+ DELAY(delay << 2);
+ uart_barrier(bas);
+ if ((uart_getreg(bas, REG_LSR) & LSR_RXRDY) == 0)
+ break;
+ }
(void)uart_getreg(bas, REG_DATA);
uart_barrier(bas);
- DELAY(delay << 2);
}
if (limit == 0) {
/* printf("ns8250: receiver appears broken... "); */

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 14, 6:14 AM (10 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28690471
Default Alt Text
D36184.id109310.diff (1 KB)

Event Timeline