Synchronize with sys/i386/isa/sio.c revision 1.163.

This commit is contained in:
KATO Takenori 1997-04-19 14:54:32 +00:00
parent 25070303ca
commit 3238d14c9e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25026
2 changed files with 22 additions and 10 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.20 1997/03/24 12:29:41 bde Exp $ * $Id: sio.c,v 1.21 1997/04/05 15:04:32 kato Exp $
*/ */
#include "opt_comconsole.h" #include "opt_comconsole.h"
@ -228,6 +228,7 @@
#define CS_DTR_OFF 0x10 /* DTR held off */ #define CS_DTR_OFF 0x10 /* DTR held off */
#define CS_ODONE 4 /* output completed */ #define CS_ODONE 4 /* output completed */
#define CS_RTS_IFLOW 8 /* use RTS input flow control */ #define CS_RTS_IFLOW 8 /* use RTS input flow control */
#define CSE_BUSYCHECK 1 /* siobusycheck() scheduled */
static char const * const error_desc[] = { static char const * const error_desc[] = {
#define CE_OVERRUN 0 #define CE_OVERRUN 0
@ -261,6 +262,7 @@ struct com_s {
#ifdef COM_ESP #ifdef COM_ESP
bool_t esp; /* is this unit a hayes esp board? */ bool_t esp; /* is this unit a hayes esp board? */
#endif #endif
u_char extra_state; /* more flag bits, separate for order trick */
u_char fifo_image; /* copy of value written to FIFO */ u_char fifo_image; /* copy of value written to FIFO */
bool_t hasfifo; /* nonzero for 16550 UARTs */ bool_t hasfifo; /* nonzero for 16550 UARTs */
bool_t loses_outints; /* nonzero if device loses output interrupts */ bool_t loses_outints; /* nonzero if device loses output interrupts */
@ -1644,7 +1646,7 @@ comhardclose(com)
else else
#endif #endif
(void)commctl(com, TIOCM_DTR, DMBIC); (void)commctl(com, TIOCM_DTR, DMBIC);
if (com->dtr_wait != 0) { if (com->dtr_wait != 0 && !(com->state & CS_DTR_OFF)) {
timeout(siodtrwakeup, com, com->dtr_wait); timeout(siodtrwakeup, com, com->dtr_wait);
com->state |= CS_DTR_OFF; com->state |= CS_DTR_OFF;
} }
@ -1731,14 +1733,14 @@ siobusycheck(chan)
/* /*
* Clear TS_BUSY if low-level output is complete. * Clear TS_BUSY if low-level output is complete.
* spl locking is sufficient because siointr1() does not set CS_BUSY. * spl locking is sufficient because siointr1() does not set CS_BUSY.
* If siointr() clears CS_BUSY after we look at it, then we'll get * If siointr1() clears CS_BUSY after we look at it, then we'll get
* called again. Reading the line status port outside of siointr1() * called again. Reading the line status port outside of siointr1()
* is safe because CS_BUSY is clear so there are no output interrupts * is safe because CS_BUSY is clear so there are no output interrupts
* to lose. * to lose.
*/ */
s = spltty(); s = spltty();
if (com->state & CS_BUSY) if (com->state & CS_BUSY)
; /* False alarm. */ com->extra_state &= ~CSE_BUSYCHECK; /* False alarm. */
#ifdef PC98 #ifdef PC98
else if (IS_8251(com->pc98_if_type) && else if (IS_8251(com->pc98_if_type) &&
(inb(com->sts_port) & (STS8251_TxRDY | STS8251_TxEMP)) (inb(com->sts_port) & (STS8251_TxRDY | STS8251_TxEMP))
@ -1751,6 +1753,7 @@ siobusycheck(chan)
#endif #endif
com->tp->t_state &= ~TS_BUSY; com->tp->t_state &= ~TS_BUSY;
ttwwakeup(com->tp); ttwwakeup(com->tp);
com->extra_state &= ~CSE_BUSYCHECK;
} else } else
timeout(siobusycheck, com, hz / 100); timeout(siobusycheck, com, hz / 100);
splx(s); splx(s);
@ -2396,8 +2399,11 @@ repeat:
com_events -= LOTS_OF_EVENTS; com_events -= LOTS_OF_EVENTS;
com->state &= ~CS_ODONE; com->state &= ~CS_ODONE;
enable_intr(); enable_intr();
if (!(com->state & CS_BUSY)) if (!(com->state & CS_BUSY)
&& !(com->extra_state & CSE_BUSYCHECK)) {
timeout(siobusycheck, com, hz / 100); timeout(siobusycheck, com, hz / 100);
com->extra_state |= CSE_BUSYCHECK;
}
(*linesw[tp->t_line].l_start)(tp); (*linesw[tp->t_line].l_start)(tp);
} }
if (incc <= 0 || !(tp->t_state & TS_ISOPEN) || if (incc <= 0 || !(tp->t_state & TS_ISOPEN) ||

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.20 1997/03/24 12:29:41 bde Exp $ * $Id: sio.c,v 1.21 1997/04/05 15:04:32 kato Exp $
*/ */
#include "opt_comconsole.h" #include "opt_comconsole.h"
@ -228,6 +228,7 @@
#define CS_DTR_OFF 0x10 /* DTR held off */ #define CS_DTR_OFF 0x10 /* DTR held off */
#define CS_ODONE 4 /* output completed */ #define CS_ODONE 4 /* output completed */
#define CS_RTS_IFLOW 8 /* use RTS input flow control */ #define CS_RTS_IFLOW 8 /* use RTS input flow control */
#define CSE_BUSYCHECK 1 /* siobusycheck() scheduled */
static char const * const error_desc[] = { static char const * const error_desc[] = {
#define CE_OVERRUN 0 #define CE_OVERRUN 0
@ -261,6 +262,7 @@ struct com_s {
#ifdef COM_ESP #ifdef COM_ESP
bool_t esp; /* is this unit a hayes esp board? */ bool_t esp; /* is this unit a hayes esp board? */
#endif #endif
u_char extra_state; /* more flag bits, separate for order trick */
u_char fifo_image; /* copy of value written to FIFO */ u_char fifo_image; /* copy of value written to FIFO */
bool_t hasfifo; /* nonzero for 16550 UARTs */ bool_t hasfifo; /* nonzero for 16550 UARTs */
bool_t loses_outints; /* nonzero if device loses output interrupts */ bool_t loses_outints; /* nonzero if device loses output interrupts */
@ -1644,7 +1646,7 @@ comhardclose(com)
else else
#endif #endif
(void)commctl(com, TIOCM_DTR, DMBIC); (void)commctl(com, TIOCM_DTR, DMBIC);
if (com->dtr_wait != 0) { if (com->dtr_wait != 0 && !(com->state & CS_DTR_OFF)) {
timeout(siodtrwakeup, com, com->dtr_wait); timeout(siodtrwakeup, com, com->dtr_wait);
com->state |= CS_DTR_OFF; com->state |= CS_DTR_OFF;
} }
@ -1731,14 +1733,14 @@ siobusycheck(chan)
/* /*
* Clear TS_BUSY if low-level output is complete. * Clear TS_BUSY if low-level output is complete.
* spl locking is sufficient because siointr1() does not set CS_BUSY. * spl locking is sufficient because siointr1() does not set CS_BUSY.
* If siointr() clears CS_BUSY after we look at it, then we'll get * If siointr1() clears CS_BUSY after we look at it, then we'll get
* called again. Reading the line status port outside of siointr1() * called again. Reading the line status port outside of siointr1()
* is safe because CS_BUSY is clear so there are no output interrupts * is safe because CS_BUSY is clear so there are no output interrupts
* to lose. * to lose.
*/ */
s = spltty(); s = spltty();
if (com->state & CS_BUSY) if (com->state & CS_BUSY)
; /* False alarm. */ com->extra_state &= ~CSE_BUSYCHECK; /* False alarm. */
#ifdef PC98 #ifdef PC98
else if (IS_8251(com->pc98_if_type) && else if (IS_8251(com->pc98_if_type) &&
(inb(com->sts_port) & (STS8251_TxRDY | STS8251_TxEMP)) (inb(com->sts_port) & (STS8251_TxRDY | STS8251_TxEMP))
@ -1751,6 +1753,7 @@ siobusycheck(chan)
#endif #endif
com->tp->t_state &= ~TS_BUSY; com->tp->t_state &= ~TS_BUSY;
ttwwakeup(com->tp); ttwwakeup(com->tp);
com->extra_state &= ~CSE_BUSYCHECK;
} else } else
timeout(siobusycheck, com, hz / 100); timeout(siobusycheck, com, hz / 100);
splx(s); splx(s);
@ -2396,8 +2399,11 @@ repeat:
com_events -= LOTS_OF_EVENTS; com_events -= LOTS_OF_EVENTS;
com->state &= ~CS_ODONE; com->state &= ~CS_ODONE;
enable_intr(); enable_intr();
if (!(com->state & CS_BUSY)) if (!(com->state & CS_BUSY)
&& !(com->extra_state & CSE_BUSYCHECK)) {
timeout(siobusycheck, com, hz / 100); timeout(siobusycheck, com, hz / 100);
com->extra_state |= CSE_BUSYCHECK;
}
(*linesw[tp->t_line].l_start)(tp); (*linesw[tp->t_line].l_start)(tp);
} }
if (incc <= 0 || !(tp->t_state & TS_ISOPEN) || if (incc <= 0 || !(tp->t_state & TS_ISOPEN) ||