aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1995-06-28 17:58:14 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1995-06-28 17:58:14 +0000
commit5575abefeba383d796432fbac5c3faf1da9e67d8 (patch)
tree1cd6a1bdc49b82335efe2594208e450776deb1a8
parentb7ae4efa24908a47bfe59e2d10a751fb51cfd658 (diff)
downloadsrc-5575abefeba383d796432fbac5c3faf1da9e67d8.tar.gz
src-5575abefeba383d796432fbac5c3faf1da9e67d8.zip
Fight with hanging modems continued:
return EIO after t_timeout expired instead infinite looping in "siotx" in comparam, consuming CPU time.
Notes
Notes: svn path=/head/; revision=9366
-rw-r--r--sys/dev/sio/sio.c9
-rw-r--r--sys/i386/isa/sio.c9
-rw-r--r--sys/isa/sio.c9
3 files changed, 24 insertions, 3 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 50719aa8cc0b..558f1152f96d 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.99 1995/05/30 08:03:06 rgrimes Exp $
+ * $Id: sio.c,v 1.100 1995/06/25 04:51:01 bde Exp $
*/
#include "sio.h"
@@ -1651,6 +1651,7 @@ comparam(tp, t)
Port_t iobase;
int s;
int unit;
+ int txtimeout;
/* do historical conversions */
if (t->c_ispeed == 0)
@@ -1720,11 +1721,17 @@ comparam(tp, t)
disable_intr();
retry:
com->state &= ~CS_TTGO;
+ txtimeout = tp->t_timeout;
enable_intr();
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
!= (LSR_TSRE | LSR_TXRDY)) {
error = ttysleep(tp, TSA_OCOMPLETE(tp), TTIPRI | PCATCH,
"siotx", hz / 100);
+ if ( txtimeout != 0
+ && (!error || error == EAGAIN)
+ && (txtimeout -= hz / 100) <= 0
+ )
+ error = EIO;
if (error != 0 && error != EAGAIN) {
if (!(tp->t_state & TS_TTSTOP)) {
disable_intr();
diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c
index 50719aa8cc0b..558f1152f96d 100644
--- a/sys/i386/isa/sio.c
+++ b/sys/i386/isa/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.99 1995/05/30 08:03:06 rgrimes Exp $
+ * $Id: sio.c,v 1.100 1995/06/25 04:51:01 bde Exp $
*/
#include "sio.h"
@@ -1651,6 +1651,7 @@ comparam(tp, t)
Port_t iobase;
int s;
int unit;
+ int txtimeout;
/* do historical conversions */
if (t->c_ispeed == 0)
@@ -1720,11 +1721,17 @@ comparam(tp, t)
disable_intr();
retry:
com->state &= ~CS_TTGO;
+ txtimeout = tp->t_timeout;
enable_intr();
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
!= (LSR_TSRE | LSR_TXRDY)) {
error = ttysleep(tp, TSA_OCOMPLETE(tp), TTIPRI | PCATCH,
"siotx", hz / 100);
+ if ( txtimeout != 0
+ && (!error || error == EAGAIN)
+ && (txtimeout -= hz / 100) <= 0
+ )
+ error = EIO;
if (error != 0 && error != EAGAIN) {
if (!(tp->t_state & TS_TTSTOP)) {
disable_intr();
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index 50719aa8cc0b..558f1152f96d 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.99 1995/05/30 08:03:06 rgrimes Exp $
+ * $Id: sio.c,v 1.100 1995/06/25 04:51:01 bde Exp $
*/
#include "sio.h"
@@ -1651,6 +1651,7 @@ comparam(tp, t)
Port_t iobase;
int s;
int unit;
+ int txtimeout;
/* do historical conversions */
if (t->c_ispeed == 0)
@@ -1720,11 +1721,17 @@ comparam(tp, t)
disable_intr();
retry:
com->state &= ~CS_TTGO;
+ txtimeout = tp->t_timeout;
enable_intr();
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
!= (LSR_TSRE | LSR_TXRDY)) {
error = ttysleep(tp, TSA_OCOMPLETE(tp), TTIPRI | PCATCH,
"siotx", hz / 100);
+ if ( txtimeout != 0
+ && (!error || error == EAGAIN)
+ && (txtimeout -= hz / 100) <= 0
+ )
+ error = EIO;
if (error != 0 && error != EAGAIN) {
if (!(tp->t_state & TS_TTSTOP)) {
disable_intr();