summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-08-28 22:25:41 +0000
committerphk <phk@FreeBSD.org>2002-08-28 22:25:41 +0000
commit9226b11a98bcaadbaae51feb073683e127e79984 (patch)
tree458cf197fce2ce2d30c638a14f90011cdabb7f75
parent27ad5a20e288d728ed8df0e28ec9d31972402a9c (diff)
downloadFreeBSD-src-9226b11a98bcaadbaae51feb073683e127e79984.zip
FreeBSD-src-9226b11a98bcaadbaae51feb073683e127e79984.tar.gz
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.
-rw-r--r--sys/dev/sio/sio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index de38f2f..d98ef89 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -1233,6 +1233,7 @@ open_top:
* XXX we should goto open_top if comparam() slept.
*/
if (com->hasfifo) {
+ int i;
/*
* (Re)enable and drain fifos.
*
@@ -1244,7 +1245,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);
@@ -1266,6 +1267,10 @@ open_top:
DELAY(50);
(void) inb(com->data_port);
}
+ if (i == 500) {
+ error = EIO;
+ goto out;
+ }
}
mtx_lock_spin(&sio_lock);
OpenPOWER on IntegriCloud