From de7ac779e942cdcb4f0540a6fd024bcdf44a3bc7 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 28 Aug 2002 22:25:41 +0000 Subject: [PATCH] Only try to flush the FIFO of 500 characters, return EIO if that fails. This at least prevents the total hang of the machine when I open a PCCARD sio device on -current, but it does not solve the problem. --- sys/dev/sio/sio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index de38f2fdfbca..d98ef8965a8d 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1233,6 +1233,7 @@ sioopen(dev, flag, mode, td) * XXX we should goto open_top if comparam() slept. */ if (com->hasfifo) { + int i; /* * (Re)enable and drain fifos. * @@ -1244,7 +1245,7 @@ sioopen(dev, flag, mode, td) * 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); @@ -1266,6 +1267,10 @@ sioopen(dev, flag, mode, td) DELAY(50); (void) inb(com->data_port); } + if (i == 500) { + error = EIO; + goto out; + } } mtx_lock_spin(&sio_lock);