--- Net2/arch/hp300/dev/dca.c 2018/04/24 18:04:00 1.1.1.1 +++ Net2/arch/hp300/dev/dca.c 2018/04/24 18:19:00 1.1.1.2 @@ -30,7 +30,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)dca.c 7.12 (Berkeley) 6/27/91 + * from: @(#)dca.c 7.12 (Berkeley) 6/27/91 + * dca.c,v 1.8 1993/07/12 11:38:03 mycroft Exp */ #include "dca.h" @@ -74,7 +75,7 @@ int dcaconsinit; int dcadefaultrate = TTYDEF_SPEED; int dcamajor; struct dcadevice *dca_addr[NDCA]; -struct tty dca_tty[NDCA]; +struct tty *dca_tty[NDCA]; struct isr dcaisr[NDCA]; struct speedtab dcaspeedtab[] = { @@ -195,7 +196,10 @@ dcaopen(dev, flag, mode, p) unit = UNIT(dev); if (unit >= NDCA || (dca_active & (1 << unit)) == 0) return (ENXIO); - tp = &dca_tty[unit]; + if(!dca_tty[unit]) + tp = dca_tty[unit] = ttymalloc(); + else + tp = dca_tty[unit]; tp->t_oproc = dcastart; tp->t_param = dcaparam; tp->t_dev = dev; @@ -242,7 +246,7 @@ dcaclose(dev, flag, mode, p) unit = UNIT(dev); dca = dca_addr[unit]; - tp = &dca_tty[unit]; + tp = dca_tty[unit]; (*linesw[tp->t_line].l_close)(tp, flag); dca->dca_cfcr &= ~CFCR_SBREAK; #ifdef KGDB @@ -254,6 +258,8 @@ dcaclose(dev, flag, mode, p) (tp->t_state&TS_ISOPEN) == 0) (void) dcamctl(dev, 0, DMSET); ttyclose(tp); + ttyfree(tp); + dca_tty[unit] = (struct tty *)NULL; return (0); } @@ -261,7 +267,7 @@ dcaread(dev, uio, flag) dev_t dev; 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)); } @@ -271,7 +277,7 @@ dcawrite(dev, uio, flag) struct uio *uio; { 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 @@ -305,7 +311,7 @@ dcaintr(unit) case IIR_RXTOUT: case IIR_RXRDY: /* do time-critical read in-line */ - tp = &dca_tty[unit]; + tp = dca_tty[unit]; /* * Process a received byte. Inline for speed... */ @@ -347,7 +353,7 @@ dcaintr(unit) } break; case IIR_TXRDY: - tp = &dca_tty[unit]; + tp = dca_tty[unit]; tp->t_state &=~ (TS_BUSY|TS_FLUSH); if (tp->t_line) (*linesw[tp->t_line].l_start)(tp); @@ -377,7 +383,7 @@ dcaeint(unit, stat, dca) register struct tty *tp; register int c; - tp = &dca_tty[unit]; + tp = dca_tty[unit]; c = dca->dca_data; if ((tp->t_state & TS_ISOPEN) == 0) { #ifdef KGDB @@ -404,7 +410,7 @@ dcamint(unit, dca) register struct tty *tp; register int stat; - tp = &dca_tty[unit]; + tp = dca_tty[unit]; stat = dca->dca_msr; #ifdef DEBUG dcamintcount[stat & 0xf]++; @@ -434,7 +440,7 @@ dcaioctl(dev, cmd, data, flag) register struct dcadevice *dca; register int error; - tp = &dca_tty[unit]; + tp = dca_tty[unit]; error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag); if (error >= 0) return (error); @@ -548,11 +554,7 @@ dcastart(tp) tp->t_state &= ~TS_ASLEEP; wakeup((caddr_t)&tp->t_outq); } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; - } + selwakeup(&tp->t_wsel); } if (tp->t_outq.c_cc == 0) goto out; @@ -652,7 +654,6 @@ dcacnprobe(cp) /* initialize required fields */ cp->cn_dev = makedev(dcamajor, unit); - cp->cn_tp = &dca_tty[unit]; switch (dca_addr[unit]->dca_irid) { case DCAID0: case DCAID1: