summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2016-05-27 05:37:52 +0000
committerBob Beck <beck@cvs.openbsd.org>2016-05-27 05:37:52 +0000
commit40ea0e219a861d210221a15e26b5f013212ae734 (patch)
treedc10e33bd6987bb0f06c45b0073f363f9a5cf5bb /sys/arch/amd64/stand
parentbb2a70a5f5abb65cfad9b7a5f0ea4bf12a08709c (diff)
Modify com_init to match the com driver initializaiton, and add
a short delay so that baud rate changes on the console have a chance of working. Lots of help from theo on this one. Makes my serial console on my APU work for an unattended reboot instead of hanging when garbage is echoed to the tty. ok deraadt@
Diffstat (limited to 'sys/arch/amd64/stand')
-rw-r--r--sys/arch/amd64/stand/libsa/bioscons.c10
1 files changed, 9 insertions, 1 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)