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.
This commit is contained in:
Poul-Henning Kamp 2002-08-28 22:25:41 +00:00
parent e353d3a1e0
commit de7ac779e9

View File

@ -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);