From b94c4607e07d485813ef2693cd1dd707f7bbd900 Mon Sep 17 00:00:00 2001 From: jasper Date: Sat, 12 Jul 2014 14:15:06 +0000 Subject: [PATCH] fix annoying bug where the first character would be eaten, cnischar() was wreaking havoc. from miod@ --- sys/arch/octeon/stand/boot/uart.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/arch/octeon/stand/boot/uart.c b/sys/arch/octeon/stand/boot/uart.c index 43ee35478db..02cee69cfdb 100644 --- a/sys/arch/octeon/stand/boot/uart.c +++ b/sys/arch/octeon/stand/boot/uart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uart.c,v 1.7 2014/07/12 14:12:53 jasper Exp $ */ +/* $OpenBSD: uart.c,v 1.8 2014/07/12 14:15:06 jasper Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -123,8 +123,15 @@ cn30xxuartcngetc (dev_t dev) /* 1/10th the time to transmit 1 character (estimate). */ d = cn30xxuart_delay(); + if (dev & 0x80) + return octeon_xkphys_read_8(OCTEON_MIO_UART0_LSR) & LSR_RXRDY; + while ((octeon_xkphys_read_8(OCTEON_MIO_UART0_LSR) & LSR_RXRDY) == 0) delay(d); + c = octeon_xkphys_read_8(OCTEON_MIO_UART0_RBR); + if (c == '\r') + c = '\n'; + return (c); } -- 2.20.1