diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/stand/libsa/bioscons.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/bioscons.c | 9 |
2 files changed, 17 insertions, 2 deletions
diff --git a/sys/arch/amd64/stand/libsa/bioscons.c b/sys/arch/amd64/stand/libsa/bioscons.c index bdff9a4b67e..9e8ec24ac42 100644 --- a/sys/arch/amd64/stand/libsa/bioscons.c +++ b/sys/arch/amd64/stand/libsa/bioscons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioscons.c,v 1.10 2014/03/29 18:09:28 guenther Exp $ */ +/* $OpenBSD: bioscons.c,v 1.11 2016/05/27 05:37:51 beck Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -141,13 +141,21 @@ void com_init(struct consdev *cn) { int port = (com_addr == -1) ? comports[minor(cn->cn_dev)] : com_addr; + time_t tt = getsecs() + 1; + u_long i = 1; outb(port + com_ier, 0); if (com_speed == -1) comspeed(cn->cn_dev, 9600); /* default speed is 9600 baud */ outb(port + com_mcr, MCR_DTR | MCR_RTS); + outb(port + com_ier, 0); outb(port + com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1); + (void) inb(port + com_iir); + + /* A few ms delay for the chip, using the getsecs() API */ + while (!(i++ % 1000) && getsecs() < tt) + ; /* drain the input buffer */ while (inb(port + com_lsr) & LSR_RXRDY) diff --git a/sys/arch/i386/stand/libsa/bioscons.c b/sys/arch/i386/stand/libsa/bioscons.c index 028bef396d2..2f0f1bd08ce 100644 --- a/sys/arch/i386/stand/libsa/bioscons.c +++ b/sys/arch/i386/stand/libsa/bioscons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioscons.c,v 1.35 2014/03/29 18:09:29 guenther Exp $ */ +/* $OpenBSD: bioscons.c,v 1.36 2016/05/27 05:37:51 beck Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -139,6 +139,8 @@ void com_init(struct consdev *cn) { int port = (com_addr == -1) ? comports[minor(cn->cn_dev)] : com_addr; + time_t tt = getsecs() + 1; + u_long i = 1; outb(port + com_ier, 0); if (com_speed == -1) @@ -146,6 +148,11 @@ com_init(struct consdev *cn) outb(port + com_mcr, MCR_DTR | MCR_RTS); outb(port + com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1); + (void) inb(port + com_iir); + + /* A few ms delay for the chip, using the getsecs() API */ + while (!(i++ % 1000) && getsecs() < tt) + ; /* drain the input buffer */ while (inb(port + com_lsr) & LSR_RXRDY) |