Changes to hp300 code to support two things:

1. dynamic tty allocation
2. use ring buffers instead of clists
Of course, I can't test it :-)
This commit is contained in:
deraadt 1993-05-27 09:35:10 +00:00
parent b671aede02
commit 2032b7529e
3 changed files with 81 additions and 54 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)dca.c 7.12 (Berkeley) 6/27/91 * from: @(#)dca.c 7.12 (Berkeley) 6/27/91
* $Id: dca.c,v 1.3 1993/05/22 11:40:42 cgd Exp $ * $Id: dca.c,v 1.4 1993/05/27 09:35:10 deraadt Exp $
*/ */
#include "dca.h" #include "dca.h"
@ -43,11 +43,11 @@
#include "sys/param.h" #include "sys/param.h"
#include "sys/systm.h" #include "sys/systm.h"
#include "sys/ioctl.h" #include "sys/ioctl.h"
#include "sys/select.h"
#include "sys/tty.h" #include "sys/tty.h"
#include "sys/proc.h" #include "sys/proc.h"
#include "sys/conf.h" #include "sys/conf.h"
#include "sys/file.h" #include "sys/file.h"
#include "sys/malloc.h"
#include "sys/uio.h" #include "sys/uio.h"
#include "sys/kernel.h" #include "sys/kernel.h"
#include "sys/syslog.h" #include "sys/syslog.h"
@ -76,7 +76,7 @@ int dcaconsinit;
int dcadefaultrate = TTYDEF_SPEED; int dcadefaultrate = TTYDEF_SPEED;
int dcamajor; int dcamajor;
struct dcadevice *dca_addr[NDCA]; struct dcadevice *dca_addr[NDCA];
struct tty dca_tty[NDCA]; struct tty *dca_tty[NDCA];
struct isr dcaisr[NDCA]; struct isr dcaisr[NDCA];
struct speedtab dcaspeedtab[] = { struct speedtab dcaspeedtab[] = {
@ -197,7 +197,12 @@ dcaopen(dev, flag, mode, p)
unit = UNIT(dev); unit = UNIT(dev);
if (unit >= NDCA || (dca_active & (1 << unit)) == 0) if (unit >= NDCA || (dca_active & (1 << unit)) == 0)
return (ENXIO); return (ENXIO);
tp = &dca_tty[unit]; if(!dca_tty[unit]) {
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
bzero(tp, sizeof(struct tty));
dca_tty[unit] = tp;
} else
tp = dca_tty[unit];
tp->t_oproc = dcastart; tp->t_oproc = dcastart;
tp->t_param = dcaparam; tp->t_param = dcaparam;
tp->t_dev = dev; tp->t_dev = dev;
@ -244,7 +249,7 @@ dcaclose(dev, flag, mode, p)
unit = UNIT(dev); unit = UNIT(dev);
dca = dca_addr[unit]; dca = dca_addr[unit];
tp = &dca_tty[unit]; tp = dca_tty[unit];
(*linesw[tp->t_line].l_close)(tp, flag); (*linesw[tp->t_line].l_close)(tp, flag);
dca->dca_cfcr &= ~CFCR_SBREAK; dca->dca_cfcr &= ~CFCR_SBREAK;
#ifdef KGDB #ifdef KGDB
@ -256,6 +261,8 @@ dcaclose(dev, flag, mode, p)
(tp->t_state&TS_ISOPEN) == 0) (tp->t_state&TS_ISOPEN) == 0)
(void) dcamctl(dev, 0, DMSET); (void) dcamctl(dev, 0, DMSET);
ttyclose(tp); ttyclose(tp);
FREE(tp, M_TTYS);
dca_tty[unit] = (struct tty *)NULL;
return (0); return (0);
} }
@ -263,7 +270,7 @@ dcaread(dev, uio, flag)
dev_t dev; dev_t dev;
struct uio *uio; struct uio *uio;
{ {
register struct tty *tp = &dca_tty[UNIT(dev)]; register struct tty *tp = dca_tty[UNIT(dev)];
return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
} }
@ -273,7 +280,7 @@ dcawrite(dev, uio, flag)
struct uio *uio; struct uio *uio;
{ {
int unit = UNIT(dev); int unit = UNIT(dev);
register struct tty *tp = &dca_tty[unit]; register struct tty *tp = dca_tty[unit];
/* /*
* (XXX) We disallow virtual consoles if the physical console is * (XXX) We disallow virtual consoles if the physical console is
@ -307,7 +314,7 @@ dcaintr(unit)
case IIR_RXTOUT: case IIR_RXTOUT:
case IIR_RXRDY: case IIR_RXRDY:
/* do time-critical read in-line */ /* do time-critical read in-line */
tp = &dca_tty[unit]; tp = dca_tty[unit];
/* /*
* Process a received byte. Inline for speed... * Process a received byte. Inline for speed...
*/ */
@ -349,7 +356,7 @@ dcaintr(unit)
} }
break; break;
case IIR_TXRDY: case IIR_TXRDY:
tp = &dca_tty[unit]; tp = dca_tty[unit];
tp->t_state &=~ (TS_BUSY|TS_FLUSH); tp->t_state &=~ (TS_BUSY|TS_FLUSH);
if (tp->t_line) if (tp->t_line)
(*linesw[tp->t_line].l_start)(tp); (*linesw[tp->t_line].l_start)(tp);
@ -379,7 +386,7 @@ dcaeint(unit, stat, dca)
register struct tty *tp; register struct tty *tp;
register int c; register int c;
tp = &dca_tty[unit]; tp = dca_tty[unit];
c = dca->dca_data; c = dca->dca_data;
if ((tp->t_state & TS_ISOPEN) == 0) { if ((tp->t_state & TS_ISOPEN) == 0) {
#ifdef KGDB #ifdef KGDB
@ -406,7 +413,7 @@ dcamint(unit, dca)
register struct tty *tp; register struct tty *tp;
register int stat; register int stat;
tp = &dca_tty[unit]; tp = dca_tty[unit];
stat = dca->dca_msr; stat = dca->dca_msr;
#ifdef DEBUG #ifdef DEBUG
dcamintcount[stat & 0xf]++; dcamintcount[stat & 0xf]++;
@ -436,7 +443,7 @@ dcaioctl(dev, cmd, data, flag)
register struct dcadevice *dca; register struct dcadevice *dca;
register int error; register int error;
tp = &dca_tty[unit]; tp = dca_tty[unit];
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag); error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag);
if (error >= 0) if (error >= 0)
return (error); return (error);
@ -545,22 +552,22 @@ dcastart(tp)
s = spltty(); s = spltty();
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP)) if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
goto out; goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) { if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
if (tp->t_state&TS_ASLEEP) { if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP; tp->t_state &= ~TS_ASLEEP;
wakeup((caddr_t)&tp->t_outq); wakeup((caddr_t)&tp->t_out);
} }
selwakeup(&tp->t_wsel); selwakeup(&tp->t_wsel);
} }
if (tp->t_outq.c_cc == 0) if (RB_LEN(&tp->t_out) == 0)
goto out; goto out;
if (dca->dca_lsr & LSR_TXRDY) { if (dca->dca_lsr & LSR_TXRDY) {
c = getc(&tp->t_outq); c = getc(&tp->t_out);
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
dca->dca_data = c; dca->dca_data = c;
if (dca_hasfifo & (1 << unit)) { if (dca_hasfifo & (1 << unit)) {
for (c = 1; c < 16 && tp->t_outq.c_cc; ++c) for (c = 1; c < 16 && RB_LEN(&tp->t_out); ++c)
dca->dca_data = getc(&tp->t_outq); dca->dca_data = getc(&tp->t_out);
#ifdef DEBUG #ifdef DEBUG
if (c > 16) if (c > 16)
fifoout[0]++; fifoout[0]++;
@ -650,7 +657,7 @@ dcacnprobe(cp)
/* initialize required fields */ /* initialize required fields */
cp->cn_dev = makedev(dcamajor, unit); cp->cn_dev = makedev(dcamajor, unit);
cp->cn_tp = &dca_tty[unit]; cp->cn_tp = dca_tty[unit];
switch (dca_addr[unit]->dca_irid) { switch (dca_addr[unit]->dca_irid) {
case DCAID0: case DCAID0:
case DCAID1: case DCAID1:

View File

@ -38,7 +38,7 @@
* from: $Hdr: dcm.c 1.26 91/01/21$ * from: $Hdr: dcm.c 1.26 91/01/21$
* *
* from: @(#)dcm.c 7.14 (Berkeley) 6/27/91 * from: @(#)dcm.c 7.14 (Berkeley) 6/27/91
* $Id: dcm.c,v 1.3 1993/05/22 11:40:46 cgd Exp $ * $Id: dcm.c,v 1.4 1993/05/27 09:35:15 deraadt Exp $
*/ */
/* /*
@ -55,12 +55,12 @@
#include "sys/param.h" #include "sys/param.h"
#include "sys/systm.h" #include "sys/systm.h"
#include "sys/ioctl.h" #include "sys/ioctl.h"
#include "sys/select.h"
#include "sys/tty.h" #include "sys/tty.h"
#include "sys/proc.h" #include "sys/proc.h"
#include "sys/conf.h" #include "sys/conf.h"
#include "sys/file.h" #include "sys/file.h"
#include "sys/uio.h" #include "sys/uio.h"
#include "sys/malloc.h"
#include "sys/kernel.h" #include "sys/kernel.h"
#include "sys/syslog.h" #include "sys/syslog.h"
#include "sys/time.h" #include "sys/time.h"
@ -83,7 +83,7 @@ struct driver dcmdriver = {
#define NDCMLINE (NDCM*4) #define NDCMLINE (NDCM*4)
struct tty dcm_tty[NDCMLINE]; struct tty *dcm_tty[NDCMLINE];
struct modemreg *dcm_modem[NDCMLINE]; struct modemreg *dcm_modem[NDCMLINE];
char mcndlast[NDCMLINE]; /* XXX last modem status for line */ char mcndlast[NDCMLINE]; /* XXX last modem status for line */
int ndcm = NDCMLINE; int ndcm = NDCMLINE;
@ -353,7 +353,12 @@ dcmopen(dev, flag, mode, p)
brd = BOARD(unit); brd = BOARD(unit);
if (unit >= NDCMLINE || (dcm_active & (1 << brd)) == 0) if (unit >= NDCMLINE || (dcm_active & (1 << brd)) == 0)
return (ENXIO); return (ENXIO);
tp = &dcm_tty[unit]; if(!dcm_tty[unit]) {
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
bzero(tp, sizeof(struct tty));
dcm_tty[unit] = tp;
} else
tp = dcm_tty[unit];
tp->t_oproc = dcmstart; tp->t_oproc = dcmstart;
tp->t_param = dcmparam; tp->t_param = dcmparam;
tp->t_dev = dev; tp->t_dev = dev;
@ -413,7 +418,7 @@ dcmclose(dev, flag, mode, p)
int unit; int unit;
unit = UNIT(dev); unit = UNIT(dev);
tp = &dcm_tty[unit]; tp = dcm_tty[unit];
(*linesw[tp->t_line].l_close)(tp, flag); (*linesw[tp->t_line].l_close)(tp, flag);
if (tp->t_cflag&HUPCL || tp->t_state&TS_WOPEN || if (tp->t_cflag&HUPCL || tp->t_state&TS_WOPEN ||
(tp->t_state&TS_ISOPEN) == 0) (tp->t_state&TS_ISOPEN) == 0)
@ -424,6 +429,8 @@ dcmclose(dev, flag, mode, p)
unit, tp->t_state, tp->t_flags); unit, tp->t_state, tp->t_flags);
#endif #endif
ttyclose(tp); ttyclose(tp);
FREE(tp, M_TTYS);
dcm_tty[unit] = (struct tty *)NULL;
return (0); return (0);
} }
@ -433,7 +440,7 @@ dcmread(dev, uio, flag)
{ {
register struct tty *tp; register struct tty *tp;
tp = &dcm_tty[UNIT(dev)]; tp = dcm_tty[UNIT(dev)];
return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
} }
@ -444,7 +451,7 @@ dcmwrite(dev, uio, flag)
int unit = UNIT(dev); int unit = UNIT(dev);
register struct tty *tp; register struct tty *tp;
tp = &dcm_tty[unit]; tp = dcm_tty[unit];
/* /*
* XXX we disallow virtual consoles if the physical console is * XXX we disallow virtual consoles if the physical console is
* a serial port. This is in case there is a display attached that * a serial port. This is in case there is a display attached that
@ -567,7 +574,7 @@ dcmpint(unit, code, dcm)
int unit, code; int unit, code;
struct dcmdevice *dcm; struct dcmdevice *dcm;
{ {
struct tty *tp = &dcm_tty[unit]; struct tty *tp = dcm_tty[unit];
if (code & IT_SPEC) if (code & IT_SPEC)
dcmreadbuf(unit, dcm, tp); dcmreadbuf(unit, dcm, tp);
@ -583,7 +590,7 @@ dcmrint(brd, dcm)
register struct tty *tp; register struct tty *tp;
unit = MKUNIT(brd, 0); unit = MKUNIT(brd, 0);
tp = &dcm_tty[unit]; tp = dcm_tty[unit];
for (i = 0; i < 4; i++, tp++, unit++) for (i = 0; i < 4; i++, tp++, unit++)
dcmreadbuf(unit, dcm, tp); dcmreadbuf(unit, dcm, tp);
} }
@ -697,7 +704,7 @@ dcmmint(unit, mcnd, dcm)
printf("dcmmint: port %d mcnd %x mcndlast %x\n", printf("dcmmint: port %d mcnd %x mcndlast %x\n",
unit, mcnd, mcndlast[unit]); unit, mcnd, mcndlast[unit]);
#endif #endif
tp = &dcm_tty[unit]; tp = dcm_tty[unit];
delta = mcnd ^ mcndlast[unit]; delta = mcnd ^ mcndlast[unit];
mcndlast[unit] = mcnd; mcndlast[unit] = mcnd;
if ((delta & MI_CTS) && (tp->t_state & TS_ISOPEN) && if ((delta & MI_CTS) && (tp->t_state & TS_ISOPEN) &&
@ -738,7 +745,7 @@ dcmioctl(dev, cmd, data, flag)
printf("dcmioctl: unit %d cmd %x data %x flag %x\n", printf("dcmioctl: unit %d cmd %x data %x flag %x\n",
unit, cmd, *data, flag); unit, cmd, *data, flag);
#endif #endif
tp = &dcm_tty[unit]; tp = dcm_tty[unit];
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag); error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag);
if (error >= 0) if (error >= 0)
return (error); return (error);
@ -897,18 +904,18 @@ dcmstart(tp)
if (dcmdebug & DDB_OUTPUT) if (dcmdebug & DDB_OUTPUT)
printf("dcmstart(%d): state %x flags %x outcc %d\n", printf("dcmstart(%d): state %x flags %x outcc %d\n",
UNIT(tp->t_dev), tp->t_state, tp->t_flags, UNIT(tp->t_dev), tp->t_state, tp->t_flags,
tp->t_outq.c_cc); RB_LEN(&tp->t_out));
#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 (RB_LEN(&tp->t_out) <= tp->t_lowat) {
if (tp->t_state&TS_ASLEEP) { if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP; tp->t_state &= ~TS_ASLEEP;
wakeup((caddr_t)&tp->t_outq); wakeup((caddr_t)&tp->t_out);
} }
selwakeup(&tp->t_wsel); selwakeup(&tp->t_wsel);
} }
if (tp->t_outq.c_cc == 0) { if (RB_LEN(&tp->t_out) == 0) {
#ifdef IOSTATS #ifdef IOSTATS
dsp->xempty++; dsp->xempty++;
#endif #endif
@ -925,7 +932,12 @@ dcmstart(tp)
goto out; goto out;
fifo = &dcm->dcm_tfifos[3-port][tail]; fifo = &dcm->dcm_tfifos[3-port][tail];
again: again:
#if 0
nch = q_to_b(&tp->t_outq, buf, (head - next) & TX_MASK); nch = q_to_b(&tp->t_outq, buf, (head - next) & TX_MASK);
#else
nch = rbunpack(&tp->t_out, buf, nch);
#endif
#ifdef IOSTATS #ifdef IOSTATS
tch += nch; tch += nch;
#endif #endif
@ -958,7 +970,7 @@ again:
* Head changed while we were loading the buffer, * Head changed while we were loading the buffer,
* go back and load some more if we can. * go back and load some more if we can.
*/ */
if (tp->t_outq.c_cc && head != (pp->t_head & TX_MASK)) { if (RB_LEN(&tp->t_out) && head != (pp->t_head & TX_MASK)) {
#ifdef IOSTATS #ifdef IOSTATS
dsp->xrestarts++; dsp->xrestarts++;
#endif #endif
@ -979,8 +991,8 @@ again:
} }
#ifdef DEBUG #ifdef DEBUG
if (dcmdebug & DDB_INTR) if (dcmdebug & DDB_INTR)
printf("dcmstart(%d): head %x tail %x outqcc %d\n", printf("dcmstart(%d): head %x tail %x outlen %d\n",
UNIT(tp->t_dev), head, tail, tp->t_outq.c_cc); UNIT(tp->t_dev), head, tail, RB_LEN(&tp->t_out));
#endif #endif
out: out:
#ifdef IOSTATS #ifdef IOSTATS
@ -1101,7 +1113,7 @@ dcmsetischeme(brd, flags)
* chars for any port on the board. * chars for any port on the board.
*/ */
if (!perchar) { if (!perchar) {
register struct tty *tp = &dcm_tty[MKUNIT(brd, 0)]; register struct tty *tp = dcm_tty[MKUNIT(brd, 0)];
int c; int c;
for (i = 0; i < 4; i++, tp++) { for (i = 0; i < 4; i++, tp++) {
@ -1161,7 +1173,7 @@ dcmcnprobe(cp)
/* initialize required fields */ /* initialize required fields */
cp->cn_dev = makedev(dcmmajor, unit); cp->cn_dev = makedev(dcmmajor, unit);
cp->cn_tp = &dcm_tty[unit]; cp->cn_tp = dcm_tty[unit];
switch (dcm_addr[BOARD(unit)]->dcm_rsid) { switch (dcm_addr[BOARD(unit)]->dcm_rsid) {
case DCMID: case DCMID:
cp->cn_pri = CN_NORMAL; cp->cn_pri = CN_NORMAL;

View File

@ -38,7 +38,7 @@
* from: Utah $Hdr: ite.c 1.1 90/07/09$ * from: Utah $Hdr: ite.c 1.1 90/07/09$
* *
* from: @(#)ite.c 7.6 (Berkeley) 5/16/91 * from: @(#)ite.c 7.6 (Berkeley) 5/16/91
* $Id: ite.c,v 1.3 1993/05/22 11:40:52 cgd Exp $ * $Id: ite.c,v 1.4 1993/05/27 09:35:18 deraadt Exp $
*/ */
/* /*
@ -58,7 +58,6 @@
#include "conf.h" #include "conf.h"
#include "proc.h" #include "proc.h"
#include "ioctl.h" #include "ioctl.h"
#include "select.h"
#include "tty.h" #include "tty.h"
#include "systm.h" #include "systm.h"
#include "malloc.h" #include "malloc.h"
@ -108,7 +107,7 @@ int iteburst = 64;
int nite = NITE; int nite = NITE;
struct tty *kbd_tty = NULL; struct tty *kbd_tty = NULL;
struct tty ite_tty[NITE]; struct tty *ite_tty[NITE];
struct ite_softc ite_softc[NITE]; struct ite_softc ite_softc[NITE];
int itestart(); int itestart();
@ -129,7 +128,7 @@ iteon(dev, flag)
dev_t dev; dev_t dev;
{ {
int unit = UNIT(dev); int unit = UNIT(dev);
struct tty *tp = &ite_tty[unit]; struct tty *tp = ite_tty[unit];
struct ite_softc *ip = &ite_softc[unit]; struct ite_softc *ip = &ite_softc[unit];
if (unit < 0 || unit >= NITE || (ip->flags&ITE_ALIVE) == 0) if (unit < 0 || unit >= NITE || (ip->flags&ITE_ALIVE) == 0)
@ -216,11 +215,18 @@ iteopen(dev, mode, devtype, p)
#endif #endif
{ {
int unit = UNIT(dev); int unit = UNIT(dev);
register struct tty *tp = &ite_tty[unit]; register struct tty *tp;
register struct ite_softc *ip = &ite_softc[unit]; register struct ite_softc *ip = &ite_softc[unit];
register int error; register int error;
int first = 0; int first = 0;
if(!ite_tty[unit]) {
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
bzero(tp, sizeof(struct tty));
ite_tty[unit] = tp;
} else
tp = ite_tty[unit];
if ((tp->t_state&(TS_ISOPEN|TS_XCLUDE)) == (TS_ISOPEN|TS_XCLUDE) if ((tp->t_state&(TS_ISOPEN|TS_XCLUDE)) == (TS_ISOPEN|TS_XCLUDE)
&& p->p_ucred->cr_uid != 0) && p->p_ucred->cr_uid != 0)
return (EBUSY); return (EBUSY);
@ -258,11 +264,13 @@ iteclose(dev, flag, mode, p)
int flag, mode; int flag, mode;
struct proc *p; struct proc *p;
{ {
register struct tty *tp = &ite_tty[UNIT(dev)]; register struct tty *tp = ite_tty[UNIT(dev)];
(*linesw[tp->t_line].l_close)(tp, flag); (*linesw[tp->t_line].l_close)(tp, flag);
ttyclose(tp); ttyclose(tp);
iteoff(dev, 0); iteoff(dev, 0);
FREE(dev, M_TTYS);
ite_tty[UNIT(dev)] = (struct tty *)NULL;
return(0); return(0);
} }
@ -270,7 +278,7 @@ iteread(dev, uio, flag)
dev_t dev; dev_t dev;
struct uio *uio; struct uio *uio;
{ {
register struct tty *tp = &ite_tty[UNIT(dev)]; register struct tty *tp = ite_tty[UNIT(dev)];
return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
} }
@ -280,7 +288,7 @@ itewrite(dev, uio, flag)
struct uio *uio; struct uio *uio;
{ {
int unit = UNIT(dev); int unit = UNIT(dev);
register struct tty *tp = &ite_tty[unit]; register struct tty *tp = ite_tty[unit];
if ((ite_softc[unit].flags & ITE_ISCONS) && constty && if ((ite_softc[unit].flags & ITE_ISCONS) && constty &&
(constty->t_state&(TS_CARR_ON|TS_ISOPEN))==(TS_CARR_ON|TS_ISOPEN)) (constty->t_state&(TS_CARR_ON|TS_ISOPEN))==(TS_CARR_ON|TS_ISOPEN))
@ -292,7 +300,7 @@ iteioctl(dev, cmd, addr, flag)
dev_t dev; dev_t dev;
caddr_t addr; caddr_t addr;
{ {
register struct tty *tp = &ite_tty[UNIT(dev)]; register struct tty *tp = ite_tty[UNIT(dev)];
int error; int error;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr, flag); error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr, flag);
@ -316,11 +324,11 @@ itestart(tp)
return; return;
} }
tp->t_state |= TS_BUSY; tp->t_state |= TS_BUSY;
cc = tp->t_outq.c_cc; cc = RB_LEN(&tp->t_out);
if (cc <= tp->t_lowat) { if (cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) { if (tp->t_state & TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP; tp->t_state &= ~TS_ASLEEP;
wakeup(&tp->t_outq); wakeup(&tp->t_out);
} }
selwakeup(&tp->t_wsel); selwakeup(&tp->t_wsel);
} }
@ -335,7 +343,7 @@ itestart(tp)
while (--cc >= 0) { while (--cc >= 0) {
register int c; register int c;
c = getc(&tp->t_outq); c = getc(&tp->t_out);
/* /*
* iteputchar() may take a long time and we don't want to * iteputchar() may take a long time and we don't want to
* block all interrupts for long periods of time. Since * block all interrupts for long periods of time. Since
@ -661,7 +669,7 @@ ignore:
break; break;
case CTRL('G'): case CTRL('G'):
if (&ite_tty[unit] == kbd_tty) if (ite_tty[unit] == kbd_tty)
kbdbell(); kbdbell();
break; break;
@ -841,7 +849,7 @@ itecnprobe(cp)
/* initialize required fields */ /* initialize required fields */
cp->cn_dev = makedev(maj, unit); cp->cn_dev = makedev(maj, unit);
cp->cn_tp = &ite_tty[unit]; cp->cn_tp = ite_tty[unit];
cp->cn_pri = pri; cp->cn_pri = pri;
} }
@ -854,7 +862,7 @@ itecninit(cp)
ip->attrbuf = console_attributes; ip->attrbuf = console_attributes;
iteinit(cp->cn_dev); iteinit(cp->cn_dev);
ip->flags |= (ITE_ACTIVE|ITE_ISCONS); ip->flags |= (ITE_ACTIVE|ITE_ISCONS);
kbd_tty = &ite_tty[unit]; kbd_tty = ite_tty[unit];
} }
/*ARGSUSED*/ /*ARGSUSED*/