From 14955691c1b9a258de8e286d6c97a2b337e87d7b Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Mon, 16 Sep 2002 07:14:02 +0000 Subject: Merged from sys/dev/sio/sio.c revision 1.378. --- sys/pc98/cbus/sio.c | 7 ++++++- sys/pc98/pc98/sio.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index e2f6916dd374..ce35e3f5a747 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -1948,6 +1948,7 @@ open_top: * XXX we should goto open_top if comparam() slept. */ if (com->hasfifo) { + int i; /* * (Re)enable and drain fifos. * @@ -1959,7 +1960,7 @@ open_top: * and to handle races between enabling and fresh * input. */ - while (TRUE) { + for (i = 0; i < 500; i++) { sio_setreg(com, com_fifo, FIFO_RCV_RST | FIFO_XMT_RST | com->fifo_image); @@ -1992,6 +1993,10 @@ open_top: DELAY(50); (void) inb(com->data_port); } + if (i == 500) { + error = EIO; + goto out; + } } mtx_lock_spin(&sio_lock); diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index e2f6916dd374..ce35e3f5a747 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -1948,6 +1948,7 @@ open_top: * XXX we should goto open_top if comparam() slept. */ if (com->hasfifo) { + int i; /* * (Re)enable and drain fifos. * @@ -1959,7 +1960,7 @@ open_top: * and to handle races between enabling and fresh * input. */ - while (TRUE) { + for (i = 0; i < 500; i++) { sio_setreg(com, com_fifo, FIFO_RCV_RST | FIFO_XMT_RST | com->fifo_image); @@ -1992,6 +1993,10 @@ open_top: DELAY(50); (void) inb(com->data_port); } + if (i == 500) { + error = EIO; + goto out; + } } mtx_lock_spin(&sio_lock); -- cgit v1.3