- Factor out too many copies of the same bit of tty code.

- Fix another tty signalling/wakeup problem.
This commit is contained in:
ad 2007-11-19 18:51:36 +00:00
parent 417cd168ee
commit dc26833bb6
65 changed files with 266 additions and 707 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: a12dc.c,v 1.18 2007/03/04 05:59:08 christos Exp $ */ /* $NetBSD: a12dc.c,v 1.19 2007/11/19 18:51:36 ad Exp $ */
/* [Notice revision 2.2] /* [Notice revision 2.2]
* Copyright (c) 1997, 1998 Avalon Computer Systems, Inc. * Copyright (c) 1997, 1998 Avalon Computer Systems, Inc.
@ -64,7 +64,7 @@
#ifndef BSIDE #ifndef BSIDE
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.18 2007/03/04 05:59:08 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.19 2007/11/19 18:51:36 ad Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -164,7 +164,7 @@ a12dcattach(parent, self, aux)
/* note that we've attached the chipset; can't have 2 A12Cs. */ /* note that we've attached the chipset; can't have 2 A12Cs. */
a12dcfound = 1; a12dcfound = 1;
printf(": driver %s\n", "$Revision: 1.18 $"); printf(": driver %s\n", "$Revision: 1.19 $");
tp = a12dc_tty[0] = ttymalloc(); tp = a12dc_tty[0] = ttymalloc();
tp->t_oproc = a12dcstart; tp->t_oproc = a12dcstart;
@ -394,13 +394,7 @@ a12dcstart(tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_TTSTOP | TS_BUSY)) if (tp->t_state & (TS_TTSTOP | TS_BUSY))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) while (tp->t_outq.c_cc != 0)
a12dccnputc(tp->t_dev, getc(&tp->t_outq)); a12dccnputc(tp->t_dev, getc(&tp->t_outq));

View File

@ -1,4 +1,4 @@
/* $NetBSD: promcons.c,v 1.33 2007/10/17 19:52:56 garbled Exp $ */ /* $NetBSD: promcons.c,v 1.34 2007/11/19 18:51:36 ad Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.33 2007/10/17 19:52:56 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.34 2007/11/19 18:51:36 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -202,13 +202,7 @@ promstart(struct tty *tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_TTSTOP | TS_BUSY)) if (tp->t_state & (TS_TTSTOP | TS_BUSY))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) while (tp->t_outq.c_cc != 0)
promcnputc(tp->t_dev, getc(&tp->t_outq)); promcnputc(tp->t_dev, getc(&tp->t_outq));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.80 2007/10/18 18:54:56 joerg Exp $ */ /* $NetBSD: ite.c,v 1.81 2007/11/19 18:51:37 ad Exp $ */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -83,7 +83,7 @@
#include "opt_ddb.h" #include "opt_ddb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.80 2007/10/18 18:54:56 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.81 2007/11/19 18:51:37 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -660,18 +660,10 @@ itestart(struct tty *tp)
s = spltty(); { s = spltty(); {
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
/* we have characters remaining. */ /* we have characters remaining. */
if (rbp->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
/* wakeup we are below */
if (rbp->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *) rbp);
}
selwakeup(&tp->t_wsel);
}
} }
out: out:
splx(s); splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfc.c,v 1.47 2007/11/07 15:56:11 ad Exp $ */ /* $NetBSD: mfc.c,v 1.48 2007/11/19 18:51:37 ad Exp $ */
/* /*
* Copyright (c) 1982, 1990 The Regents of the University of California. * Copyright (c) 1982, 1990 The Regents of the University of California.
@ -55,7 +55,7 @@
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfc.c,v 1.47 2007/11/07 15:56:11 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: mfc.c,v 1.48 2007/11/19 18:51:37 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -820,14 +820,7 @@ mfcsstart(struct tty *tp)
goto out; goto out;
cc = tp->t_outq.c_cc; cc = tp->t_outq.c_cc;
if (cc <= tp->t_lowat) { if (!ttypull(tp) || (tp->t_state & TS_BUSY))
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *) & tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (cc == 0 || (tp->t_state & TS_BUSY))
goto out; goto out;
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: msc.c,v 1.39 2007/11/07 15:56:11 ad Exp $ */ /* $NetBSD: msc.c,v 1.40 2007/11/19 18:51:37 ad Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California. * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -93,7 +93,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msc.c,v 1.39 2007/11/07 15:56:11 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: msc.c,v 1.40 2007/11/19 18:51:37 ad Exp $");
#include "msc.h" #include "msc.h"
@ -1001,17 +1001,7 @@ mscstart(register struct tty *tp)
/* wake up if below low water */ /* wake up if below low water */
cc = tp->t_outq.c_cc; cc = tp->t_outq.c_cc;
if (!ttypull(tp) || (tp->t_state & TS_BUSY))
if (cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
/* don't bother if no characters or busy */
if (cc == 0 || (tp->t_state & TS_BUSY))
goto out; goto out;
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ser.c,v 1.76 2007/03/04 05:59:27 christos Exp $ */ /* $NetBSD: ser.c,v 1.77 2007/11/19 18:51:37 ad Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California. * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -40,7 +40,7 @@
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.76 2007/03/04 05:59:27 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.77 2007/11/19 18:51:37 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -923,14 +923,7 @@ serstart(struct tty *tp)
goto out; goto out;
cc = tp->t_outq.c_cc; cc = tp->t_outq.c_cc;
if (cc <= tp->t_lowat) { if (!ttypull(tp) || (tp->t_state & TS_BUSY))
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *) & tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (cc == 0 || (tp->t_state & TS_BUSY))
goto out; goto out;
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.52 2007/10/18 18:54:57 joerg Exp $ */ /* $NetBSD: pccons.c,v 1.53 2007/11/19 18:51:37 ad Exp $ */
/* $OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $ */ /* $OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $ */
/* NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp */ /* NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp */
@ -80,7 +80,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.52 2007/10/18 18:54:57 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.53 2007/11/19 18:51:37 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -795,7 +795,6 @@ pcioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
void void
pcstart(struct tty *tp) pcstart(struct tty *tp)
{ {
struct clist *cl;
int s, len; int s, len;
u_char buf[PCBURST]; u_char buf[PCBURST];
@ -808,22 +807,14 @@ pcstart(struct tty *tp)
* We need to do this outside spl since it could be fairly * We need to do this outside spl since it could be fairly
* expensive and we don't want our serial ports to overflow. * expensive and we don't want our serial ports to overflow.
*/ */
cl = &tp->t_outq;
len = q_to_b(cl, buf, PCBURST); len = q_to_b(cl, buf, PCBURST);
sput(buf, len); sput(buf, len);
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: epcom.c,v 1.14 2007/03/04 05:59:37 christos Exp $ */ /* $NetBSD: epcom.c,v 1.15 2007/11/19 18:51:38 ad Exp $ */
/* /*
* Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -80,7 +80,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.14 2007/03/04 05:59:37 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.15 2007/11/19 18:51:38 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -367,16 +367,8 @@ epcomstart(struct tty *tp)
goto out; goto out;
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: footbridge_com.c,v 1.26 2007/10/18 18:54:57 joerg Exp $ */ /* $NetBSD: footbridge_com.c,v 1.27 2007/11/19 18:51:38 ad Exp $ */
/*- /*-
* Copyright (c) 1997 Mark Brinicombe * Copyright (c) 1997 Mark Brinicombe
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: footbridge_com.c,v 1.26 2007/10/18 18:54:57 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: footbridge_com.c,v 1.27 2007/11/19 18:51:38 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_ddbparam.h" #include "opt_ddbparam.h"
@ -438,17 +438,10 @@ fcomstart(tp)
} }
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
(void)splx(s); (void)splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ixp12x0_com.c,v 1.30 2007/03/04 05:59:38 christos Exp $ */ /* $NetBSD: ixp12x0_com.c,v 1.31 2007/11/19 18:51:38 ad Exp $ */
/* /*
* Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -73,7 +73,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.30 2007/03/04 05:59:38 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.31 2007/11/19 18:51:38 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -390,15 +390,8 @@ ixpcomstart(tp)
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sscom.c,v 1.25 2007/10/17 19:53:42 garbled Exp $ */ /* $NetBSD: sscom.c,v 1.26 2007/11/19 18:51:38 ad Exp $ */
/* /*
* Copyright (c) 2002, 2003 Fujitsu Component Limited * Copyright (c) 2002, 2003 Fujitsu Component Limited
@ -105,7 +105,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.25 2007/10/17 19:53:42 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.26 2007/11/19 18:51:38 ad Exp $");
#include "opt_sscom.h" #include "opt_sscom.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -1290,16 +1290,8 @@ sscomstart(struct tty *tp)
goto out; goto out;
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sa11x0_com.c,v 1.40 2007/10/17 19:53:42 garbled Exp $ */ /* $NetBSD: sa11x0_com.c,v 1.41 2007/11/19 18:51:38 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.40 2007/10/17 19:53:42 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.41 2007/11/19 18:51:38 ad Exp $");
#include "opt_com.h" #include "opt_com.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -1064,16 +1064,8 @@ sacomstart(struct tty *tp)
s = spltty(); s = spltty();
if (ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP)) if (ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP))
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.57 2007/10/18 18:54:57 joerg Exp $ */ /* $NetBSD: ite.c,v 1.58 2007/11/19 18:51:39 ad Exp $ */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -81,7 +81,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.57 2007/10/18 18:54:57 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.58 2007/11/19 18:51:39 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -677,18 +677,10 @@ itestart(tp)
s = spltty(); { s = spltty(); {
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
/* we have characters remaining. */ /* we have characters remaining. */
if (rbp->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
/* wakeup we are below */
if (rbp->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *) rbp);
}
selwakeup(&tp->t_wsel);
}
out: ; out: ;
} splx(s); } splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ser.c,v 1.35 2007/10/17 19:53:48 garbled Exp $ */ /* $NetBSD: ser.c,v 1.36 2007/11/19 18:51:39 ad Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -100,7 +100,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.35 2007/10/17 19:53:48 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.36 2007/11/19 18:51:39 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_mbtype.h" #include "opt_mbtype.h"
@ -968,16 +968,8 @@ serstart(tp)
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto stopped; goto stopped;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto stopped;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto stopped;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: zs.c,v 1.53 2007/03/06 14:13:02 tsutsui Exp $ */ /* $NetBSD: zs.c,v 1.54 2007/11/19 18:51:39 ad Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -82,7 +82,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.53 2007/03/06 14:13:02 tsutsui Exp $"); __KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.54 2007/11/19 18:51:39 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1001,13 +1001,7 @@ register struct tty *tp;
* If there are sleepers, and output has drained below low * If there are sleepers, and output has drained below low
* water mark, awaken. * water mark, awaken.
*/ */
if(tp->t_outq.c_cc <= tp->t_lowat) { ttypull(tp);
if(tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
nch = ndqb(&tp->t_outq, 0); /* XXX */ nch = ndqb(&tp->t_outq, 0); /* XXX */
if(nch) { if(nch) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: plcom.c,v 1.23 2007/10/17 19:54:11 garbled Exp $ */ /* $NetBSD: plcom.c,v 1.24 2007/11/19 18:51:39 ad Exp $ */
/*- /*-
* Copyright (c) 2001 ARM Ltd * Copyright (c) 2001 ARM Ltd
@ -101,7 +101,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.23 2007/10/17 19:54:11 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.24 2007/11/19 18:51:39 ad Exp $");
#include "opt_plcom.h" #include "opt_plcom.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -1425,15 +1425,8 @@ plcomstart(struct tty *tp)
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: xlcom.c,v 1.3 2007/10/17 19:54:20 garbled Exp $ */ /* $NetBSD: xlcom.c,v 1.4 2007/11/19 18:51:39 ad Exp $ */
/* /*
* Copyright (c) 2006 Jachym Holecek * Copyright (c) 2006 Jachym Holecek
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xlcom.c,v 1.3 2007/10/17 19:54:20 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: xlcom.c,v 1.4 2007/11/19 18:51:39 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -605,17 +605,9 @@ xlcom_start(struct tty *tp)
return ; return ;
} }
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp)) {
if (tp->t_state & TS_ASLEEP) { splx(s1);
tp->t_state &= ~TS_ASLEEP; return;
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0) {
splx(s1);
return ;
}
} }
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dcm.c,v 1.77 2007/03/04 05:59:47 christos Exp $ */ /* $NetBSD: dcm.c,v 1.78 2007/11/19 18:51:39 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -123,7 +123,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.77 2007/03/04 05:59:47 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.78 2007/11/19 18:51:39 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -1221,14 +1221,7 @@ dcmstart(struct tty *tp)
#endif #endif
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp)) {
if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (tp->t_outq.c_cc == 0) {
#ifdef DCMSTATS #ifdef DCMSTATS
dsp->xempty++; dsp->xempty++;
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.78 2007/10/18 18:54:57 joerg Exp $ */ /* $NetBSD: ite.c,v 1.79 2007/11/19 18:51:40 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -119,7 +119,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.78 2007/10/18 18:54:57 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.79 2007/11/19 18:51:40 ad Exp $");
#include "hil.h" #include "hil.h"
@ -516,13 +516,7 @@ itestart(struct tty *tp)
} }
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
cc = tp->t_outq.c_cc; cc = tp->t_outq.c_cc;
if (cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
/* /*
* Handle common (?) case * Handle common (?) case
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdc.c,v 1.22 2007/10/17 19:54:25 garbled Exp $ */ /* $NetBSD: pdc.c,v 1.23 2007/11/19 18:51:40 ad Exp $ */
/* $OpenBSD: pdc.c,v 1.14 2001/04/29 21:05:43 mickey Exp $ */ /* $OpenBSD: pdc.c,v 1.14 2001/04/29 21:05:43 mickey Exp $ */
@ -33,7 +33,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pdc.c,v 1.22 2007/10/17 19:54:25 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: pdc.c,v 1.23 2007/11/19 18:51:40 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -321,13 +321,7 @@ pdcstart(struct tty *tp)
splx(s); splx(s);
return; return;
} }
if (tp->t_outq.c_cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) while (tp->t_outq.c_cc != 0)
pdccnputc(tp->t_dev, getc(&tp->t_outq)); pdccnputc(tp->t_dev, getc(&tp->t_outq));

View File

@ -1,4 +1,4 @@
/* $NetBSD: txcom.c,v 1.37 2007/03/04 05:59:54 christos Exp $ */ /* $NetBSD: txcom.c,v 1.38 2007/11/19 18:51:40 ad Exp $ */
/*- /*-
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.37 2007/03/04 05:59:54 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.38 2007/11/19 18:51:40 ad Exp $");
#include "opt_tx39uart_debug.h" #include "opt_tx39uart_debug.h"
@ -1033,15 +1033,8 @@ txcomstart(struct tty *tp)
ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP)) ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
sc->sc_tba = tp->t_outq.c_cf; sc->sc_tba = tp->t_outq.c_cf;
sc->sc_tbc = ndqb(&tp->t_outq, 0); sc->sc_tbc = ndqb(&tp->t_outq, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: siotty.c,v 1.20 2007/03/04 06:00:03 christos Exp $ */ /* $NetBSD: siotty.c,v 1.21 2007/11/19 18:51:40 ad Exp $ */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.20 2007/03/04 06:00:03 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.21 2007/11/19 18:51:40 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -217,16 +217,8 @@ siostart(tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_BUSY|TS_TIMEOUT|TS_TTSTOP)) if (tp->t_state & (TS_BUSY|TS_TIMEOUT|TS_TTSTOP))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (tp->t_outq.c_cc == 0)
goto out; goto out;
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
while (getsiocsr(sc->sc_ctl) & RR_TXRDY) { while (getsiocsr(sc->sc_ctl) & RR_TXRDY) {
if ((c = getc(&tp->t_outq)) == -1) if ((c = getc(&tp->t_outq)) == -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofcons.c,v 1.21 2007/10/18 18:54:58 joerg Exp $ */ /* $NetBSD: ofcons.c,v 1.22 2007/11/19 18:51:41 ad Exp $ */
/* /*
* Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1.21 2007/10/18 18:54:58 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1.22 2007/11/19 18:51:41 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/conf.h> #include <sys/conf.h>
@ -230,17 +230,10 @@ ofcstart(struct tty *tp)
OF_write(stdout, buf, len); OF_write(stdout, buf, len);
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: uart.c,v 1.2 2007/03/23 20:05:47 dogcow Exp $ */ /* $NetBSD: uart.c,v 1.3 2007/11/19 18:51:41 ad Exp $ */
/*- /*-
* Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uart.c,v 1.2 2007/03/23 20:05:47 dogcow Exp $"); __KERNEL_RCSID(0, "$NetBSD: uart.c,v 1.3 2007/11/19 18:51:41 ad Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -304,13 +304,7 @@ uart_start(struct tty *tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_TTSTOP | TS_BUSY)) if (tp->t_state & (TS_TTSTOP | TS_BUSY))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((char *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) { while (tp->t_outq.c_cc != 0) {
cnt = ndqb(&tp->t_outq, 0); cnt = ndqb(&tp->t_outq, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbjcn.c,v 1.18 2007/10/17 19:55:39 garbled Exp $ */ /* $NetBSD: sbjcn.c,v 1.19 2007/11/19 18:51:41 ad Exp $ */
/* /*
* Copyright 2000, 2001 * Copyright 2000, 2001
@ -110,7 +110,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.18 2007/10/17 19:55:39 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.19 2007/11/19 18:51:41 ad Exp $");
#define SBJCN_DEBUG #define SBJCN_DEBUG
@ -1126,16 +1126,8 @@ sbjcn_start(struct tty *tp)
goto out; goto out;
if (ch->ch_tx_stopped) if (ch->ch_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbscn.c,v 1.23 2007/10/17 19:55:40 garbled Exp $ */ /* $NetBSD: sbscn.c,v 1.24 2007/11/19 18:51:41 ad Exp $ */
/* /*
* Copyright 2000, 2001 * Copyright 2000, 2001
@ -116,7 +116,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.23 2007/10/17 19:55:40 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.24 2007/11/19 18:51:41 ad Exp $");
#define SBSCN_DEBUG #define SBSCN_DEBUG
@ -1235,16 +1235,8 @@ sbscn_start(struct tty *tp)
goto out; goto out;
if (ch->ch_tx_stopped) if (ch->ch_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sci.c,v 1.48 2007/10/17 19:57:06 garbled Exp $ */ /* $NetBSD: sci.c,v 1.49 2007/11/19 18:51:42 ad Exp $ */
/*- /*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -100,7 +100,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.48 2007/10/17 19:57:06 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.49 2007/11/19 18:51:42 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "opt_sci.h" #include "opt_sci.h"
@ -116,6 +116,7 @@ __KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.48 2007/10/17 19:57:06 garbled Exp $");
#include <sys/device.h> #include <sys/device.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/kauth.h> #include <sys/kauth.h>
#include <sys/intr.h>
#include <dev/cons.h> #include <dev/cons.h>
@ -124,7 +125,6 @@ __KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.48 2007/10/17 19:57:06 garbled Exp $");
#include <sh3/pfcreg.h> #include <sh3/pfcreg.h>
#include <sh3/tmureg.h> #include <sh3/tmureg.h>
#include <sh3/exception.h> #include <sh3/exception.h>
#include <machine/intr.h>
static void scistart(struct tty *); static void scistart(struct tty *);
static int sciparam(struct tty *, struct termios *); static int sciparam(struct tty *, struct termios *);
@ -406,7 +406,7 @@ sci_attach(struct device *parent, struct device *self, void *aux)
intc_intr_establish(SH_INTEVT_SCI_TEI, IST_LEVEL, IPL_SERIAL, sciintr, intc_intr_establish(SH_INTEVT_SCI_TEI, IST_LEVEL, IPL_SERIAL, sciintr,
sc); sc);
sc->sc_si = softintr_establish(IPL_SOFTSERIAL, scisoft, sc); sc->sc_si = softint_establish(SOFTINT_SERIAL, scisoft, sc);
SET(sc->sc_hwflags, SCI_HW_DEV_OK); SET(sc->sc_hwflags, SCI_HW_DEV_OK);
tp = ttymalloc(); tp = ttymalloc();
@ -440,16 +440,8 @@ scistart(struct tty *tp)
goto out; goto out;
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {
@ -849,7 +841,7 @@ sci_schedrx(struct sci_softc *sc)
sc->sc_rx_ready = 1; sc->sc_rx_ready = 1;
/* Wake up the poller. */ /* Wake up the poller. */
softintr_schedule(sc->sc_si); softint_schedule(sc->sc_si);
} }
void void
@ -1281,7 +1273,7 @@ sciintr(void *arg)
} }
/* Wake up the poller. */ /* Wake up the poller. */
softintr_schedule(sc->sc_si); softint_schedule(sc->sc_si);
#if NRND > 0 && defined(RND_SCI) #if NRND > 0 && defined(RND_SCI)
rnd_add_uint32(&sc->rnd_source, iir | lsr); rnd_add_uint32(&sc->rnd_source, iir | lsr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scif.c,v 1.53 2007/11/06 05:01:26 uwe Exp $ */ /* $NetBSD: scif.c,v 1.54 2007/11/19 18:51:42 ad Exp $ */
/*- /*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -100,7 +100,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.53 2007/11/06 05:01:26 uwe Exp $"); __KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.54 2007/11/19 18:51:42 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "opt_scif.h" #include "opt_scif.h"
@ -514,16 +514,8 @@ scifstart(struct tty *tp)
goto out; goto out;
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.46 2007/10/18 18:54:58 joerg Exp $ */ /* $NetBSD: kd.c,v 1.47 2007/11/19 18:51:42 ad Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.46 2007/10/18 18:54:58 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.47 2007/11/19 18:51:42 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "fb.h" #include "fb.h"
@ -351,7 +351,7 @@ kdstart(struct tty *tp)
goto out; goto out;
cl = &tp->t_outq; cl = &tp->t_outq;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
if ((s1 & PSR_PIL) == 0) { if ((s1 & PSR_PIL) == 0) {
/* called at level zero - update screen now. */ /* called at level zero - update screen now. */
@ -364,13 +364,6 @@ kdstart(struct tty *tp)
callout_schedule(&tp->t_rstrt_ch, 0); callout_schedule(&tp->t_rstrt_ch, 0);
} }
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)cl);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s2); splx(s2);
splx(s1); splx(s1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.46 2007/10/19 08:50:07 dogcow Exp $ */ /* $NetBSD: kd.c,v 1.47 2007/11/19 18:51:43 ad Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.46 2007/10/19 08:50:07 dogcow Exp $"); __KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.47 2007/11/19 18:51:43 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
@ -345,13 +345,7 @@ kdstart(struct tty *tp)
ndflush(cl, cl->c_cc); ndflush(cl, cl->c_cc);
} }
} }
if (cl->c_cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)cl);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s2); splx(s2);
splx(s1); splx(s1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcons.c,v 1.27 2007/10/18 18:54:58 joerg Exp $ */ /* $NetBSD: pcons.c,v 1.28 2007/11/19 18:51:43 ad Exp $ */
/*- /*-
* Copyright (c) 2000 Eduardo E. Horvath * Copyright (c) 2000 Eduardo E. Horvath
@ -34,7 +34,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.27 2007/10/18 18:54:58 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.28 2007/11/19 18:51:43 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -239,17 +239,10 @@ pconsstart(struct tty *tp)
prom_write(prom_stdout(), buf, len); prom_write(prom_stdout(), buf, len);
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: sab.c,v 1.38 2007/11/07 15:56:13 ad Exp $ */ /* $NetBSD: sab.c,v 1.39 2007/11/19 18:51:43 ad Exp $ */
/* $OpenBSD: sab.c,v 1.7 2002/04/08 17:49:42 jason Exp $ */ /* $OpenBSD: sab.c,v 1.7 2002/04/08 17:49:42 jason Exp $ */
/* /*
@ -42,7 +42,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sab.c,v 1.38 2007/11/07 15:56:13 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: sab.c,v 1.39 2007/11/19 18:51:43 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include <sys/types.h> #include <sys/types.h>
@ -1075,14 +1075,7 @@ sabtty_start(struct tty *tp)
s = spltty(); s = spltty();
if ((tp->t_state & (TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) == 0) { if ((tp->t_state & (TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) == 0) {
if (tp->t_outq.c_cc <= tp->t_lowat) { if (ttypull(tp)) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (tp->t_outq.c_cc) {
sc->sc_txc = ndqb(&tp->t_outq, 0); sc->sc_txc = ndqb(&tp->t_outq, 0);
sc->sc_txp = tp->t_outq.c_cf; sc->sc_txp = tp->t_outq.c_cf;
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.18 2007/10/21 16:18:33 he Exp $ */ /* $NetBSD: kd.c,v 1.19 2007/11/19 18:51:43 ad Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.18 2007/10/21 16:18:33 he Exp $"); __KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.19 2007/11/19 18:51:43 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
@ -368,7 +368,7 @@ kdstart(struct tty *tp)
goto out; goto out;
cl = &tp->t_outq; cl = &tp->t_outq;
if (cl->c_cc) { if (ttypull(tp)) {
if (kd_is_console) { if (kd_is_console) {
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
if (is_spl0(s1)) { if (is_spl0(s1)) {
@ -391,13 +391,6 @@ kdstart(struct tty *tp)
ndflush(cl, cl->c_cc); ndflush(cl, cl->c_cc);
} }
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)cl);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s2); splx(s2);
splx(s1); splx(s1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcons.c,v 1.16 2007/10/18 18:54:59 joerg Exp $ */ /* $NetBSD: pcons.c,v 1.17 2007/11/19 18:51:43 ad Exp $ */
/*- /*-
* Copyright (c) 2000 Eduardo E. Horvath * Copyright (c) 2000 Eduardo E. Horvath
@ -34,7 +34,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.16 2007/10/18 18:54:59 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.17 2007/11/19 18:51:43 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -237,17 +237,10 @@ pconsstart(struct tty *tp)
prom_putstr(buf, len); prom_putstr(buf, len);
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.52 2007/10/28 13:29:21 rjs Exp $ */ /* $NetBSD: kd.c,v 1.53 2007/11/19 18:51:44 ad Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.52 2007/10/28 13:29:21 rjs Exp $"); __KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.53 2007/11/19 18:51:44 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
@ -296,7 +296,7 @@ kdstart(struct tty *tp)
goto out; goto out;
cl = &tp->t_outq; cl = &tp->t_outq;
if (cl->c_cc) { if (ttypull(tp)) {
if (kd_is_console) { if (kd_is_console) {
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
if ((s1 & PSL_IPL) == 0) { if ((s1 & PSL_IPL) == 0) {
@ -319,13 +319,6 @@ kdstart(struct tty *tp)
ndflush(cl, cl->c_cc); ndflush(cl, cl->c_cc);
} }
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)cl);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s2); splx(s2);
splx(s1); splx(s1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: qv.c,v 1.17 2007/03/04 06:00:57 christos Exp $ */ /* $NetBSD: qv.c,v 1.18 2007/11/19 18:51:44 ad Exp $ */
/*- /*-
* Copyright (c) 1988 * Copyright (c) 1988
@ -123,7 +123,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.17 2007/03/04 06:00:57 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.18 2007/11/19 18:51:44 ad Exp $");
#include "qv.h" #include "qv.h"
#if NQV > 0 #if NQV > 0
@ -981,12 +981,7 @@ qvstart(tp)
* If there are sleepers, and output has drained below low * If there are sleepers, and output has drained below low
* water mark, wake up the sleepers. * water mark, wake up the sleepers.
*/ */
if ( tp->t_outq.c_cc<= tp->t_lowat ) { ttypull(tp);
if (tp->t_state&TS_ASLEEP){
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
}
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
out: out:
splx(s); splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: gencons.c,v 1.47 2007/03/04 06:00:58 christos Exp $ */ /* $NetBSD: gencons.c,v 1.48 2007/11/19 18:51:44 ad Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -36,7 +36,7 @@
/* All bugs are subject to removal without further notice */ /* All bugs are subject to removal without further notice */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gencons.c,v 1.47 2007/03/04 06:00:58 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: gencons.c,v 1.48 2007/11/19 18:51:44 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_cputype.h" #include "opt_cputype.h"
@ -201,19 +201,13 @@ gencnstart(struct tty *tp)
goto out; goto out;
cl = &tp->t_outq; cl = &tp->t_outq;
if(cl->c_cc){ if (ttypull(tp)) {
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
ch = getc(cl); ch = getc(cl);
mtpr(ch, pr_txdb[minor(tp->t_dev)]); mtpr(ch, pr_txdb[minor(tp->t_dev)]);
} else {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)cl);
}
selwakeup(&tp->t_wsel);
} }
out:
out: splx(s); splx(s);
} }
static void static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.49 2007/10/17 19:58:01 garbled Exp $ */ /* $NetBSD: com.c,v 1.50 2007/11/19 18:51:44 ad Exp $ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -73,7 +73,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.49 2007/10/17 19:58:01 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.50 2007/11/19 18:51:44 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -838,15 +838,8 @@ comstart(struct tty *tp)
goto stopped; goto stopped;
if (ISSET(tp->t_cflag, CRTSCTS) && !ISSET(sc->sc_msr, MSR_CTS)) if (ISSET(tp->t_cflag, CRTSCTS) && !ISSET(sc->sc_msr, MSR_CTS))
goto stopped; goto stopped;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto stopped;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
if (tp->t_outq.c_cc == 0)
goto stopped;
selwakeup(&tp->t_wsel);
}
SET(tp->t_state, TS_BUSY); SET(tp->t_state, TS_BUSY);
if (!ISSET(sc->sc_ier, IER_ETXRDY)) { if (!ISSET(sc->sc_ier, IER_ETXRDY)) {
@ -1080,7 +1073,7 @@ comintr(void *arg)
if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) { if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) {
CLR(tp->t_state, TS_BUSY | TS_FLUSH); CLR(tp->t_state, TS_BUSY | TS_FLUSH);
if (sc->sc_halt > 0) if (sc->sc_halt > 0)
wakeup(&tp->t_outq); clwakeup(&tp->t_outq);
(*tp->t_linesw->l_start)(tp); (*tp->t_linesw->l_start)(tp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.52 2007/10/18 18:54:59 joerg Exp $ */ /* $NetBSD: ite.c,v 1.53 2007/11/19 18:51:45 ad Exp $ */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -83,7 +83,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.52 2007/10/18 18:54:59 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.53 2007/11/19 18:51:45 ad Exp $");
#include "ite.h" #include "ite.h"
#if NITE > 0 #if NITE > 0
@ -557,18 +557,10 @@ itestart(struct tty *tp)
/*s = spltty();*/ /*s = spltty();*/
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
/* we have characters remaining. */ /* we have characters remaining. */
if (rbp->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
/* wakeup we are below */
if (rbp->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)rbp);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: xencons.c,v 1.23 2007/10/18 18:54:59 joerg Exp $ */ /* $NetBSD: xencons.c,v 1.24 2007/11/19 18:51:45 ad Exp $ */
/* /*
* Copyright (c) 2006 Manuel Bouyer. * Copyright (c) 2006 Manuel Bouyer.
@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.23 2007/10/18 18:54:59 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.24 2007/11/19 18:51:45 ad Exp $");
#include "opt_xen.h" #include "opt_xen.h"
@ -425,17 +425,10 @@ xencons_start(struct tty *tp)
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
out: out:
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: arcbios_tty.c,v 1.18 2007/07/11 21:19:08 ad Exp $ */ /* $NetBSD: arcbios_tty.c,v 1.19 2007/11/19 18:51:45 ad Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: arcbios_tty.c,v 1.18 2007/07/11 21:19:08 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: arcbios_tty.c,v 1.19 2007/11/19 18:51:45 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/user.h> #include <sys/user.h>
@ -189,13 +189,7 @@ arcbios_tty_start(struct tty *tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_TTSTOP | TS_BUSY)) if (tp->t_state & (TS_TTSTOP | TS_BUSY))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { ttypull(tp);
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
while (tp->t_outq.c_cc != 0) { while (tp->t_outq.c_cc != 0) {
(*ARCBIOS->Write)(ARCBIOS_STDOUT, tp->t_outq.c_cf, (*ARCBIOS->Write)(ARCBIOS_STDOUT, tp->t_outq.c_cf,

View File

@ -1,4 +1,4 @@
/* $NetBSD: dz.c,v 1.31 2007/11/07 15:56:14 ad Exp $ */ /* $NetBSD: dz.c,v 1.32 2007/11/19 18:51:46 ad Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -67,7 +67,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dz.c,v 1.31 2007/11/07 15:56:14 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: dz.c,v 1.32 2007/11/19 18:51:46 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -271,7 +271,7 @@ dzrint(void *arg)
cn_check_magic(tp->t_dev, mcc, dz_cnm_state); cn_check_magic(tp->t_dev, mcc, dz_cnm_state);
if (!(tp->t_state & TS_ISOPEN)) { if (!(tp->t_state & TS_ISOPEN)) {
wakeup((void *)&tp->t_rawq); clwakeup(&tp->t_rawq);
continue; continue;
} }
@ -584,21 +584,9 @@ dzstart(struct tty *tp)
splx(s); splx(s);
return; return;
} }
cl = &tp->t_outq; if (!ttypull(tp))
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)cl);
}
selwakeup(&tp->t_wsel);
}
if (cl->c_cc == 0) {
splx(s);
return; return;
}
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
state = dz_read2(sc, sc->sc_dr.dr_tcrw) & 255; state = dz_read2(sc, sc->sc_dr.dr_tcrw) & 255;
if ((state & (1 << line)) == 0) if ((state & (1 << line)) == 0)
dz_write1(sc, sc->sc_dr.dr_tcr, state | (1 << line)); dz_write1(sc, sc->sc_dr.dr_tcr, state | (1 << line));

View File

@ -1,4 +1,4 @@
/* $NetBSD: biconsdev.c,v 1.19 2007/10/18 18:55:00 joerg Exp $ */ /* $NetBSD: biconsdev.c,v 1.20 2007/11/19 18:51:46 ad Exp $ */
/*- /*-
* Copyright (c) 1999-2001 * Copyright (c) 1999-2001
@ -67,7 +67,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: biconsdev.c,v 1.19 2007/10/18 18:55:00 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: biconsdev.c,v 1.20 2007/11/19 18:51:46 ad Exp $");
#include "biconsdev.h" #include "biconsdev.h"
#include <sys/param.h> #include <sys/param.h>
@ -149,17 +149,10 @@ biconsdev_output(struct tty *tp)
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
/* Come back if there's more to do */ /* Come back if there's more to do */
if (tp->t_outq.c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (tp->t_outq.c_cc <= tp->t_lowat) {
if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd18xx.c,v 1.21 2007/10/19 11:59:49 ad Exp $ */ /* $NetBSD: cd18xx.c,v 1.22 2007/11/19 18:51:46 ad Exp $ */
/* XXXad does this even compile? */ /* XXXad does this even compile? */
@ -103,7 +103,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd18xx.c,v 1.21 2007/10/19 11:59:49 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: cd18xx.c,v 1.22 2007/11/19 18:51:46 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/conf.h> #include <sys/conf.h>
@ -689,15 +689,8 @@ cdttystart(tp)
if (p->p_tx_stopped) if (p->p_tx_stopped)
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: clmpcc.c,v 1.35 2007/10/19 11:59:49 ad Exp $ */ /* $NetBSD: clmpcc.c,v 1.36 2007/11/19 18:51:47 ad Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.35 2007/10/19 11:59:49 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.36 2007/11/19 18:51:47 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -1050,14 +1050,7 @@ clmpcc_start(tp)
s = spltty(); s = spltty();
if ( ISCLR(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY) ) { if ( ISCLR(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY) ) {
if ( tp->t_outq.c_cc <= tp->t_lowat ) { ttypull(tp);
if ( ISSET(tp->t_state, TS_ASLEEP) ) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if ( ISSET(ch->ch_flags, CLMPCC_FLG_START_BREAK | if ( ISSET(ch->ch_flags, CLMPCC_FLG_START_BREAK |
CLMPCC_FLG_END_BREAK) || CLMPCC_FLG_END_BREAK) ||
tp->t_outq.c_cc > 0 ) { tp->t_outq.c_cc > 0 ) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.265 2007/10/19 11:59:49 ad Exp $ */ /* $NetBSD: com.c,v 1.266 2007/11/19 18:51:47 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@ -73,7 +73,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.265 2007/10/19 11:59:49 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.266 2007/11/19 18:51:47 ad Exp $");
#include "opt_com.h" #include "opt_com.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -1660,16 +1660,8 @@ comstart(struct tty *tp)
goto out; goto out;
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: cy.c,v 1.53 2007/11/07 15:56:14 ad Exp $ */ /* $NetBSD: cy.c,v 1.54 2007/11/19 18:51:47 ad Exp $ */
/* /*
* cy.c * cy.c
@ -16,7 +16,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.53 2007/11/07 15:56:14 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.54 2007/11/19 18:51:47 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -593,16 +593,8 @@ cystart(struct tty *tp)
#endif #endif
if (!ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) { if (!ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) {
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
SET(tp->t_state, TS_BUSY); SET(tp->t_state, TS_BUSY);
cy_enable_transmitter(sc, cy); cy_enable_transmitter(sc, cy);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.116 2007/11/10 18:07:53 ad Exp $ */ /* $NetBSD: z8530tty.c,v 1.117 2007/11/19 18:51:48 ad Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@ -137,7 +137,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.116 2007/11/10 18:07:53 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.117 2007/11/19 18:51:48 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "opt_ntp.h" #include "opt_ntp.h"
@ -1052,16 +1052,8 @@ zsstart(tp)
return; return;
if (zst->zst_tx_stopped) if (zst->zst_tx_stopped)
return; return;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { return;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
cv_broadcast(&tp->t_outq.c_cv);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
return;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
tba = tp->t_outq.c_cf; tba = tp->t_outq.c_cf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: irframe_tty.c,v 1.46 2007/11/10 18:29:37 ad Exp $ */ /* $NetBSD: irframe_tty.c,v 1.47 2007/11/19 18:51:48 ad Exp $ */
/* /*
* TODO * TODO
@ -48,7 +48,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.46 2007/11/10 18:29:37 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.47 2007/11/19 18:51:48 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
@ -650,7 +650,6 @@ irt_putc(struct tty *tp, int c)
mutex_spin_exit(&tty_lock); mutex_spin_exit(&tty_lock);
goto go; goto go;
} }
SET(tp->t_state, TS_ASLEEP);
error = ttysleep(tp, &tp->t_outq.c_cv, true, 0); error = ttysleep(tp, &tp->t_outq.c_cv, true, 0);
mutex_spin_exit(&tty_lock); mutex_spin_exit(&tty_lock);
if (error) if (error)

View File

@ -1,4 +1,4 @@
/* $NetBSD: gtmpsc.c,v 1.26 2007/10/19 12:00:33 ad Exp $ */ /* $NetBSD: gtmpsc.c,v 1.27 2007/11/19 18:51:48 ad Exp $ */
/* /*
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@ -45,7 +45,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.26 2007/10/19 12:00:33 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.27 2007/11/19 18:51:48 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -768,15 +768,8 @@ gtmpscstart(struct tty *tp)
goto out; goto out;
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if ((tp->t_state & TS_ASLEEP) != 0) { goto out;
tp->t_state &= ~TS_ASLEEP;
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
tba = tp->t_outq.c_cf; tba = tp->t_outq.c_cf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofcons.c,v 1.32 2007/10/18 18:55:00 joerg Exp $ */ /* $NetBSD: ofcons.c,v 1.33 2007/11/19 18:51:48 ad Exp $ */
/* /*
* Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1.32 2007/10/18 18:55:00 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1.33 2007/11/19 18:51:48 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/conf.h> #include <sys/conf.h>
@ -240,7 +240,6 @@ static void
ofcons_start(tp) ofcons_start(tp)
struct tty *tp; struct tty *tp;
{ {
struct clist *cl;
int s, len; int s, len;
u_char buf[OFBURSTLEN]; u_char buf[OFBURSTLEN];
@ -251,22 +250,14 @@ ofcons_start(tp)
} }
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
splx(s); splx(s);
cl = &tp->t_outq;
len = q_to_b(cl, buf, OFBURSTLEN); len = q_to_b(cl, buf, OFBURSTLEN);
OF_write(stdout, buf, len); OF_write(stdout, buf, len);
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
if (cl->c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(cl);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: cz.c,v 1.46 2007/11/12 14:20:41 ad Exp $ */ /* $NetBSD: cz.c,v 1.47 2007/11/19 18:51:49 ad Exp $ */
/*- /*-
* Copyright (c) 2000 Zembu Labs, Inc. * Copyright (c) 2000 Zembu Labs, Inc.
@ -73,7 +73,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.46 2007/11/12 14:20:41 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.47 2007/11/19 18:51:49 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1481,17 +1481,8 @@ czttystart(struct tty *tp)
s = spltty(); s = spltty();
if (ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP)) if (ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP))
goto out; goto out;
if (!ttypull(tp))
if (tp->t_outq.c_cc <= tp->t_lowat) { goto out;
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
cztty_transmit(sc, tp); cztty_transmit(sc, tp);
out: out:
splx(s); splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dhu.c,v 1.49 2007/11/07 15:56:21 ad Exp $ */ /* $NetBSD: dhu.c,v 1.50 2007/11/19 18:51:49 ad Exp $ */
/* /*
* Copyright (c) 2003, Hugh Graham. * Copyright (c) 2003, Hugh Graham.
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -68,7 +68,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dhu.c,v 1.49 2007/11/07 15:56:21 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: dhu.c,v 1.50 2007/11/19 18:51:49 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -358,7 +358,7 @@ dhurint(arg)
} }
if (!(tp->t_state & TS_ISOPEN)) { if (!(tp->t_state & TS_ISOPEN)) {
wakeup((void *)&tp->t_rawq); clwakeup(&tp->t_rawq);
continue; continue;
} }
@ -685,14 +685,7 @@ dhustart(tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (tp->t_outq.c_cc == 0)
goto out; goto out;
cc = ndqb(&tp->t_outq, 0); cc = ndqb(&tp->t_outq, 0);
if (cc == 0) if (cc == 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: dl.c,v 1.38 2007/10/19 12:01:08 ad Exp $ */ /* $NetBSD: dl.c,v 1.39 2007/11/19 18:51:49 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -111,7 +111,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.38 2007/10/19 12:01:08 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.39 2007/11/19 18:51:49 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -283,7 +283,7 @@ dlrint(void *arg)
cc = c & 0xFF; cc = c & 0xFF;
if (!(tp->t_state & TS_ISOPEN)) { if (!(tp->t_state & TS_ISOPEN)) {
wakeup((void *)&tp->t_rawq); clwakeup(&tp->t_rawq);
return; return;
} }
@ -468,17 +468,8 @@ dlstart(struct tty *tp)
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (tp->t_outq.c_cc == 0)
goto out; goto out;
if (DL_READ_WORD(DL_UBA_XCSR) & DL_XCSR_TX_READY) { if (DL_READ_WORD(DL_UBA_XCSR) & DL_XCSR_TX_READY) {
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
DL_WRITE_BYTE(DL_UBA_XBUFL, getc(&tp->t_outq)); DL_WRITE_BYTE(DL_UBA_XBUFL, getc(&tp->t_outq));

View File

@ -1,4 +1,4 @@
/* $NetBSD: qd.c,v 1.39 2007/10/19 12:01:09 ad Exp $ */ /* $NetBSD: qd.c,v 1.40 2007/11/19 18:51:49 ad Exp $ */
/*- /*-
* Copyright (c) 1988 Regents of the University of California. * Copyright (c) 1988 Regents of the University of California.
@ -58,7 +58,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: qd.c,v 1.39 2007/10/19 12:01:09 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: qd.c,v 1.40 2007/11/19 18:51:49 ad Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -1808,17 +1808,7 @@ void qdstart(tp)
if (unit == 0) if (unit == 0)
blitc(which_unit, (u_char)c); blitc(which_unit, (u_char)c);
} }
/* ttypull(tp);
* If there are sleepers, and output has drained below low
* water mark, wake up the sleepers.
*/
if (tp->t_outq.c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP){
tp->t_state &= ~TS_ASLEEP;
wakeup((void *) &tp->t_outq);
}
}
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
out: out:

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcons_kern.c,v 1.20 2007/10/18 18:55:00 joerg Exp $ */ /* $NetBSD: rcons_kern.c,v 1.21 2007/11/19 18:51:50 ad Exp $ */
/* /*
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rcons_kern.c,v 1.20 2007/10/18 18:55:00 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: rcons_kern.c,v 1.21 2007/11/19 18:51:50 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/device.h> #include <sys/device.h>
@ -101,17 +101,10 @@ rcons_output(tp)
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
/* Come back if there's more to do */ /* Come back if there's more to do */
if (tp->t_outq.c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, 1); callout_schedule(&tp->t_rstrt_ch, 1);
} }
if (tp->t_outq.c_cc <= tp->t_lowat) {
if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((void *)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: magma.c,v 1.44 2007/10/19 12:01:12 ad Exp $ */ /* $NetBSD: magma.c,v 1.45 2007/11/19 18:51:50 ad Exp $ */
/* /*
* magma.c * magma.c
* *
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.44 2007/10/19 12:01:12 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.45 2007/11/19 18:51:50 ad Exp $");
#if 0 #if 0
#define MAGMA_DEBUG #define MAGMA_DEBUG
@ -1224,22 +1224,7 @@ mtty_start(tp)
* or delaying or stopped * or delaying or stopped
*/ */
if( !ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY) ) { if( !ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY) ) {
if (ttypull(tp)) {
/* if we are sleeping and output has drained below
* low water mark, awaken
*/
if( tp->t_outq.c_cc <= tp->t_lowat ) {
if( ISSET(tp->t_state, TS_ASLEEP) ) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
/* if something to send, start transmitting
*/
if( tp->t_outq.c_cc ) {
mp->mp_txc = ndqb(&tp->t_outq, 0); mp->mp_txc = ndqb(&tp->t_outq, 0);
mp->mp_txp = tp->t_outq.c_cf; mp->mp_txp = tp->t_outq.c_cf;
SET(tp->t_state, TS_BUSY); SET(tp->t_state, TS_BUSY);

View File

@ -1,4 +1,4 @@
/* $NetBSD: spif.c,v 1.13 2007/11/07 15:56:21 ad Exp $ */ /* $NetBSD: spif.c,v 1.14 2007/11/19 18:51:50 ad Exp $ */
/* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */ /* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */
/* /*
@ -41,7 +41,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.13 2007/11/07 15:56:21 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.14 2007/11/19 18:51:50 ad Exp $");
#include "spif.h" #include "spif.h"
#if NSPIF > 0 #if NSPIF > 0
@ -739,14 +739,7 @@ stty_start(tp)
s = spltty(); s = spltty();
if (!ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) { if (!ISSET(tp->t_state, TS_TTSTOP | TS_TIMEOUT | TS_BUSY)) {
if (tp->t_outq.c_cc <= tp->t_lowat) { if (ttypull(tp)) {
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (tp->t_outq.c_cc) {
sp->sp_txc = ndqb(&tp->t_outq, 0); sp->sp_txc = ndqb(&tp->t_outq, 0);
sp->sp_txp = tp->t_outq.c_cf; sp->sp_txp = tp->t_outq.c_cf;
SET(tp->t_state, TS_BUSY); SET(tp->t_state, TS_BUSY);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ucom.c,v 1.72 2007/11/12 14:20:41 ad Exp $ */ /* $NetBSD: ucom.c,v 1.73 2007/11/19 18:51:50 ad Exp $ */
/* /*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.72 2007/11/12 14:20:41 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.73 2007/11/19 18:51:50 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -913,15 +913,8 @@ ucomstart(struct tty *tp)
if (sc->sc_tx_stopped) if (sc->sc_tx_stopped)
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (!ttypull(tp))
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
data = tp->t_outq.c_cf; data = tp->t_outq.c_cf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ucycom.c,v 1.18 2007/11/10 18:29:37 ad Exp $ */ /* $NetBSD: ucycom.c,v 1.19 2007/11/19 18:51:51 ad Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation, Inc. * Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: ucycom.c,v 1.18 2007/11/10 18:29:37 ad Exp $"); __RCSID("$NetBSD: ucycom.c,v 1.19 2007/11/19 18:51:51 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -472,15 +472,8 @@ ucycomstart(struct tty *tp)
goto out; goto out;
#endif #endif
if (tp->t_outq.c_cc <= tp->t_lowat) { if (ttypull(tp) == 0)
if (ISSET(tp->t_state, TS_ASLEEP)) { goto out;
CLR(tp->t_state, TS_ASLEEP);
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
if (tp->t_outq.c_cc == 0)
goto out;
}
/* Grab the first contiguous region of buffer space. */ /* Grab the first contiguous region of buffer space. */
data = tp->t_outq.c_cf; data = tp->t_outq.c_cf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.111 2007/10/18 21:08:18 joerg Exp $ */ /* $NetBSD: wsdisplay.c,v 1.112 2007/11/19 18:51:51 ad Exp $ */
/* /*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.111 2007/10/18 21:08:18 joerg Exp $"); __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.112 2007/11/19 18:51:51 ad Exp $");
#include "opt_wsdisplay_compat.h" #include "opt_wsdisplay_compat.h"
#include "opt_wsmsgattrs.h" #include "opt_wsmsgattrs.h"
@ -1471,17 +1471,10 @@ wsdisplaystart(struct tty *tp)
s = spltty(); s = spltty();
tp->t_state &= ~TS_BUSY; tp->t_state &= ~TS_BUSY;
/* Come back if there's more to do */ /* Come back if there's more to do */
if (tp->t_outq.c_cc) { if (ttypull(tp)) {
tp->t_state |= TS_TIMEOUT; tp->t_state |= TS_TIMEOUT;
callout_schedule(&tp->t_rstrt_ch, (hz > 128) ? (hz / 128) : 1); callout_schedule(&tp->t_rstrt_ch, (hz > 128) ? (hz / 128) : 1);
} }
if (tp->t_outq.c_cc <= tp->t_lowat) {
if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup(&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.202 2007/11/14 01:15:31 ad Exp $ */ /* $NetBSD: tty.c,v 1.203 2007/11/19 18:51:51 ad Exp $ */
/*- /*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993 * Copyright (c) 1982, 1986, 1990, 1991, 1993
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.202 2007/11/14 01:15:31 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.203 2007/11/19 18:51:51 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1359,7 +1359,6 @@ ttywait(struct tty *tp)
while ((tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY)) && while ((tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY)) &&
CONNECTED(tp) && tp->t_oproc) { CONNECTED(tp) && tp->t_oproc) {
(*tp->t_oproc)(tp); (*tp->t_oproc)(tp);
SET(tp->t_state, TS_ASLEEP);
error = ttysleep(tp, &tp->t_outq.c_cv, true, 0); error = ttysleep(tp, &tp->t_outq.c_cv, true, 0);
if (error) if (error)
break; break;
@ -1407,7 +1406,7 @@ ttyflush(struct tty *tp, int rw)
CLR(tp->t_state, TS_TTSTOP); CLR(tp->t_state, TS_TTSTOP);
cdev_stop(tp, rw); cdev_stop(tp, rw);
FLUSHQ(&tp->t_outq); FLUSHQ(&tp->t_outq);
cv_broadcast(&tp->t_outq.c_cv); clwakeup(&tp->t_outq);
selnotify(&tp->t_wsel, NOTE_SUBMIT); selnotify(&tp->t_wsel, NOTE_SUBMIT);
} }
} }
@ -1424,7 +1423,7 @@ ttychars(struct tty *tp)
/* /*
* Send stop character on input overflow. * Send stop character on input overflow.
* Call withthe tty lock held. * Call with the tty lock held.
*/ */
static void static void
ttyblock(struct tty *tp) ttyblock(struct tty *tp)
@ -1828,7 +1827,6 @@ ttycheckoutq_wlock(struct tty *tp, int wait)
ttstart(tp); ttstart(tp);
if (wait == 0) if (wait == 0)
return (0); return (0);
SET(tp->t_state, TS_ASLEEP);
error = ttysleep(tp, &tp->t_outq.c_cv, true, hz); error = ttysleep(tp, &tp->t_outq.c_cv, true, hz);
if (error == EINTR) if (error == EINTR)
wait = 0; wait = 0;
@ -2029,7 +2027,6 @@ ttwrite(struct tty *tp, struct uio *uio, int flag)
error = EWOULDBLOCK; error = EWOULDBLOCK;
goto out; goto out;
} }
SET(tp->t_state, TS_ASLEEP);
error = ttysleep(tp, &tp->t_outq.c_cv, true, 0); error = ttysleep(tp, &tp->t_outq.c_cv, true, 0);
mutex_spin_exit(&tty_lock); mutex_spin_exit(&tty_lock);
if (error) if (error)
@ -2037,6 +2034,23 @@ ttwrite(struct tty *tp, struct uio *uio, int flag)
goto loop; goto loop;
} }
/*
* Try to pull more output from the producer. Return non-zero if
* there is output ready to be sent.
*/
bool
ttypull(struct tty *tp)
{
/* XXXSMP not yet KASSERT(mutex_owned(&tty_lock)); */
if (tp->t_outq.c_cc <= tp->t_lowat) {
clwakeup(&tp->t_outq);
selnotify(&tp->t_wsel, NOTE_SUBMIT);
}
return tp->t_outq.c_cc != 0;
}
/* /*
* Rubout one character from the rawq of tp * Rubout one character from the rawq of tp
* as cleanly as possible. * as cleanly as possible.
@ -2206,7 +2220,7 @@ ttwakeup(struct tty *tp)
selnotify(&tp->t_rsel, NOTE_SUBMIT); selnotify(&tp->t_rsel, NOTE_SUBMIT);
if (ISSET(tp->t_state, TS_ASYNC)) if (ISSET(tp->t_state, TS_ASYNC))
ttysig(tp, TTYSIG_PG2, SIGIO); ttysig(tp, TTYSIG_PG2, SIGIO);
cv_broadcast(&tp->t_rawq.c_cv); clwakeup(&tp->t_rawq);
} }
/* /*
@ -2657,8 +2671,8 @@ ttysigintr(void *cookie)
pgsignal(pgrp, sig, 1); pgsignal(pgrp, sig, 1);
break; break;
case TTYSIG_PG2: case TTYSIG_PG2:
if (pgrp != NULL && sess != NULL) if (pgrp != NULL)
pgsignal(pgrp, sig, 0); pgsignal(pgrp, sig, sess != NULL);
break; break;
case TTYSIG_LEADER: case TTYSIG_LEADER:
if (sess != NULL && sess->s_leader != NULL) if (sess != NULL && sess->s_leader != NULL)
@ -2670,5 +2684,7 @@ ttysigintr(void *cookie)
} }
mutex_exit(&proclist_mutex); mutex_exit(&proclist_mutex);
} }
/* XXXSMP notyet mutex_exit(&proclist_lock); */ /* XXXSMP notyet mutex_exit(&proclist_lock); */
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty_pty.c,v 1.102 2007/11/07 15:56:22 ad Exp $ */ /* $NetBSD: tty_pty.c,v 1.103 2007/11/19 18:51:52 ad Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1993 * Copyright (c) 1982, 1986, 1989, 1993
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.102 2007/11/07 15:56:22 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.103 2007/11/19 18:51:52 ad Exp $");
#include "opt_compat_sunos.h" #include "opt_compat_sunos.h"
#include "opt_ptm.h" #include "opt_ptm.h"
@ -480,7 +480,7 @@ ptsstart(tp)
} }
selnotify(&pti->pt_selr, NOTE_SUBMIT); selnotify(&pti->pt_selr, NOTE_SUBMIT);
cv_broadcast(&tp->t_outq.c_cvf); clwakeup(&tp->t_outq);
} }
/* /*
@ -505,11 +505,11 @@ ptsstop(tp, flush)
/* change of perspective */ /* change of perspective */
if (flush & FREAD) { if (flush & FREAD) {
selnotify(&pti->pt_selw, NOTE_SUBMIT); selnotify(&pti->pt_selw, NOTE_SUBMIT);
cv_broadcast(&tp->t_rawq.c_cvf); clwakeup(&tp->t_rawq);
} }
if (flush & FWRITE) { if (flush & FWRITE) {
selnotify(&pti->pt_selr, NOTE_SUBMIT); selnotify(&pti->pt_selr, NOTE_SUBMIT);
cv_broadcast(&tp->t_outq.c_cvf); clwakeup(&tp->t_outq);
} }
} }
@ -523,11 +523,11 @@ ptcwakeup(tp, flag)
mutex_spin_enter(&tty_lock); mutex_spin_enter(&tty_lock);
if (flag & FREAD) { if (flag & FREAD) {
selnotify(&pti->pt_selr, NOTE_SUBMIT); selnotify(&pti->pt_selr, NOTE_SUBMIT);
cv_broadcast(&tp->t_outq.c_cvf); clwakeup(&tp->t_outq);
} }
if (flag & FWRITE) { if (flag & FWRITE) {
selnotify(&pti->pt_selw, NOTE_SUBMIT); selnotify(&pti->pt_selw, NOTE_SUBMIT);
cv_broadcast(&tp->t_rawq.c_cvf); clwakeup(&tp->t_rawq);
} }
mutex_spin_exit(&tty_lock); mutex_spin_exit(&tty_lock);
} }
@ -636,7 +636,7 @@ ptcread(dev, uio, flag)
error = EWOULDBLOCK; error = EWOULDBLOCK;
goto out; goto out;
} }
error = cv_wait_sig(&tp->t_outq.c_cvf, &tty_lock); error = cv_wait_sig(&tp->t_outq.c_cv, &tty_lock);
if (error) if (error)
goto out; goto out;
} }
@ -658,14 +658,7 @@ ptcread(dev, uio, flag)
if (error == 0 && !ISSET(tp->t_state, TS_ISOPEN)) if (error == 0 && !ISSET(tp->t_state, TS_ISOPEN))
error = EIO; error = EIO;
} }
ttypull(tp);
if (tp->t_outq.c_cc <= tp->t_lowat) {
if (ISSET(tp->t_state, TS_ASLEEP)) {
CLR(tp->t_state, TS_ASLEEP);
cv_broadcast(&tp->t_outq.c_cv);
}
selnotify(&tp->t_wsel, NOTE_SUBMIT);
}
out: out:
mutex_spin_exit(&tty_lock); mutex_spin_exit(&tty_lock);
return (error); return (error);
@ -720,7 +713,7 @@ again:
} }
(void) putc(0, &tp->t_canq); (void) putc(0, &tp->t_canq);
ttwakeup(tp); ttwakeup(tp);
cv_broadcast(&tp->t_canq.c_cv); clwakeup(&tp->t_canq);
error = 0; error = 0;
goto out; goto out;
} }
@ -744,7 +737,7 @@ again:
while (cc > 0) { while (cc > 0) {
if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 && if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 &&
(tp->t_canq.c_cc > 0 || !ISSET(tp->t_lflag, ICANON))) { (tp->t_canq.c_cc > 0 || !ISSET(tp->t_lflag, ICANON))) {
cv_broadcast(&tp->t_rawq.c_cv); clwakeup(&tp->t_rawq);
goto block; goto block;
} }
/* XXX - should change l_rint to be called with lock /* XXX - should change l_rint to be called with lock

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty_subr.c,v 1.30 2007/11/07 15:56:22 ad Exp $ */ /* $NetBSD: tty_subr.c,v 1.31 2007/11/19 18:51:52 ad Exp $ */
/* /*
* Copyright (c) 1993, 1994 Theo de Raadt * Copyright (c) 1993, 1994 Theo de Raadt
@ -29,7 +29,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tty_subr.c,v 1.30 2007/11/07 15:56:22 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: tty_subr.c,v 1.31 2007/11/19 18:51:52 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -94,7 +94,6 @@ clalloc(struct clist *clp, int size, int quot)
clp->c_cc = 0; clp->c_cc = 0;
cv_init(&clp->c_cv, "tty"); cv_init(&clp->c_cv, "tty");
cv_init(&clp->c_cvf, "tty");
return (0); return (0);
} }
@ -107,9 +106,14 @@ clfree(struct clist *clp)
free(clp->c_cq, M_TTYS); free(clp->c_cq, M_TTYS);
clp->c_cs = clp->c_cq = (u_char *)0; clp->c_cs = clp->c_cq = (u_char *)0;
cv_destroy(&clp->c_cv); cv_destroy(&clp->c_cv);
cv_destroy(&clp->c_cvf);
} }
void
clwakeup(struct clist *clp)
{
cv_broadcast(&clp->c_cv);
}
/* /*
* Get a character from a clist. * Get a character from a clist.

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.h,v 1.75 2007/11/14 01:15:30 ad Exp $ */ /* $NetBSD: tty.h,v 1.76 2007/11/19 18:51:52 ad Exp $ */
/*- /*-
* Copyright (c) 1982, 1986, 1993 * Copyright (c) 1982, 1986, 1993
@ -56,15 +56,14 @@
* *DON'T* play with c_cs, c_ce, c_cq, or c_cl outside tty_subr.c!!! * *DON'T* play with c_cs, c_ce, c_cq, or c_cl outside tty_subr.c!!!
*/ */
struct clist { struct clist {
kcondvar_t c_cv; /* notifier 1, locked by tty lock */
kcondvar_t c_cvf; /* notifier 2, locked by tty lock */
int c_cc; /* count of characters in queue */
int c_cn; /* total ring buffer length */
u_char *c_cf; /* points to first character */ u_char *c_cf; /* points to first character */
u_char *c_cl; /* points to next open character */ u_char *c_cl; /* points to next open character */
u_char *c_cs; /* start of ring buffer */ u_char *c_cs; /* start of ring buffer */
u_char *c_ce; /* c_ce + c_len */ u_char *c_ce; /* c_ce + c_len */
u_char *c_cq; /* N bits/bytes long, see tty_subr.c */ u_char *c_cq; /* N bits/bytes long, see tty_subr.c */
kcondvar_t c_cv; /* notifier, locked by tty lock */
int c_cc; /* count of characters in queue */
int c_cn; /* total ring buffer length */
}; };
/* tty signal types */ /* tty signal types */
@ -75,7 +74,6 @@ enum ttysigtype {
TTYSIG_COUNT TTYSIG_COUNT
}; };
/* /*
* Per-tty structure. * Per-tty structure.
* *
@ -143,7 +141,6 @@ struct tty {
#endif /* _KERNEL */ #endif /* _KERNEL */
/* These flags are kept in t_state. */ /* These flags are kept in t_state. */
#define TS_ASLEEP 0x00001 /* Process waiting for tty. */
#define TS_ASYNC 0x00002 /* Tty in async I/O mode. */ #define TS_ASYNC 0x00002 /* Tty in async I/O mode. */
#define TS_BUSY 0x00004 /* Draining output. */ #define TS_BUSY 0x00004 /* Draining output. */
#define TS_CARR_ON 0x00008 /* Carrier is present. */ #define TS_CARR_ON 0x00008 /* Carrier is present. */
@ -264,9 +261,11 @@ struct tty
*ttymalloc(void); *ttymalloc(void);
void ttyfree(struct tty *); void ttyfree(struct tty *);
u_char *firstc(struct clist *, int *); u_char *firstc(struct clist *, int *);
bool ttypull(struct tty *);
int clalloc(struct clist *, int, int); int clalloc(struct clist *, int, int);
void clfree(struct clist *); void clfree(struct clist *);
void clwakeup(struct clist *);
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_compat_freebsd.h" #include "opt_compat_freebsd.h"