X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/74bfa0d5d127756fbc09e5d71f088e0715ad4233..6ddc83ab3f80fa56ed0240be0bf2372d18d1cbda:/usr/src/sys/vax/uba/dh.c diff --git a/usr/src/sys/vax/uba/dh.c b/usr/src/sys/vax/uba/dh.c index 0bf4c02d74..05c190080b 100644 --- a/usr/src/sys/vax/uba/dh.c +++ b/usr/src/sys/vax/uba/dh.c @@ -1,9 +1,9 @@ /* - * Copyright (c) 1982 Regents of the University of California. + * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)dh.c 6.12 (Berkeley) %G% + * @(#)dh.c 7.5 (Berkeley) %G% */ #include "dh.h" @@ -82,12 +82,14 @@ static short timerstarted; int dhstart(), ttrstrt(); /* - * The clist space is mapped by the driver onto each UNIBUS. + * The clist space is mapped by one terminal driver onto each UNIBUS. + * The identity of the board which allocated resources is recorded, + * so the process may be repeated after UNIBUS resets. * The UBACVT macro converts a clist space address for unibus uban * into an i/o space address for the DMA routine. */ -int dh_ubinfo[NUBA]; /* info about allocated unibus map */ -int cbase[NUBA]; /* base address in unibus map */ +int dh_uballoc[NUBA]; /* which dh (if any) allocated unibus map */ +int cbase[NUBA]; /* base address of clists in unibus map */ #define UBACVT(x, uban) (cbase[uban] + ((x)-(char *)cfree)) /* @@ -134,6 +136,8 @@ dhattach(ui) { dhsoftCAR[ui->ui_unit] = ui->ui_flags; + cbase[ui->ui_ubanum] = -1; + dh_uballoc[ui->ui_unit] = -1; } /* @@ -194,12 +198,10 @@ dhopen(dev, flag) * block uba resets which can clear the state. */ s = spl5(); - if (dh_ubinfo[ui->ui_ubanum] == 0) { - /* 512+ is a kludge to try to get around a hardware problem */ - dh_ubinfo[ui->ui_ubanum] = - uballoc(ui->ui_ubanum, (caddr_t)cfree, - 512+nclist*sizeof(struct cblock), 0); - cbase[ui->ui_ubanum] = dh_ubinfo[ui->ui_ubanum]&0x3ffff; + if (cbase[ui->ui_ubanum] == -1) { + dh_uballoc[ui->ui_ubanum] = dh; + cbase[ui->ui_ubanum] = UBAI_ADDR(uballoc(ui->ui_ubanum, + (caddr_t)cfree, nclist*sizeof(struct cblock), 0)); } if (timerstarted == 0) { timerstarted++; @@ -212,13 +214,21 @@ dhopen(dev, flag) } splx(s); /* - * If this is first open, initialze tty state to default. + * If this is first open, initialize tty state to default. */ if ((tp->t_state&TS_ISOPEN) == 0) { ttychars(tp); - tp->t_ispeed = ISPEED; - tp->t_ospeed = ISPEED; - tp->t_flags = IFLAGS; +#ifndef PORTSELECTOR + if (tp->t_ispeed == 0) { +#else + tp->t_state |= TS_HUPCLS; +#endif PORTSELECTOR + tp->t_ispeed = ISPEED; + tp->t_ospeed = ISPEED; + tp->t_flags = IFLAGS; +#ifndef PORTSELECTOR + } +#endif PORTSELECTOR dhparam(unit); } /* @@ -395,6 +405,7 @@ dhparam(unit) if ((tp->t_ispeed)==0) { tp->t_state |= TS_HUPCLS; dmctl(unit, DML_OFF, DMSET); + splx(s); return; } lpar = ((tp->t_ospeed)<<10) | ((tp->t_ispeed)<<6); @@ -590,17 +601,24 @@ dhreset(uban) register struct uba_device *ui; int i; - if (dh_ubinfo[uban] == 0) - return; - dh_ubinfo[uban] = uballoc(uban, (caddr_t)cfree, - 512+nclist*sizeof (struct cblock), 0); - cbase[uban] = dh_ubinfo[uban]&0x3ffff; dh = 0; for (dh = 0; dh < NDH; dh++) { ui = dhinfo[dh]; if (ui == 0 || ui->ui_alive == 0 || ui->ui_ubanum != uban) continue; printf(" dh%d", dh); + if (dh_uballoc[uban] == dh) { + int info; + + info = uballoc(uban, (caddr_t)cfree, + nclist * sizeof(struct cblock), UBA_CANTWAIT); + if (info) + cbase[uban] = UBAI_ADDR(info); + else { + printf(" [can't get uba map]"); + cbase[uban] = -1; + } + } ((struct dhdevice *)ui->ui_addr)->un.dhcsr |= DH_IE; ((struct dhdevice *)ui->ui_addr)->dhsilo = 0; unit = dh * 16; @@ -683,16 +701,19 @@ dmopen(dev) } addr = (struct dmdevice *)ui->ui_addr; s = spl5(); - addr->dmcsr &= ~DM_SE; - while (addr->dmcsr & DM_BUSY) - ; - addr->dmcsr = unit; - addr->dmlstat = DML_ON; - if ((addr->dmlstat&DML_CAR) || (dhsoftCAR[dm]&(1<t_state |= TS_CARR_ON; - addr->dmcsr = DM_IE|DM_SE; - while ((tp->t_state&TS_CARR_ON)==0) + for (;;) { + addr->dmcsr &= ~DM_SE; + while (addr->dmcsr & DM_BUSY) + ; + addr->dmcsr = unit; + addr->dmlstat = DML_ON; + if ((addr->dmlstat & DML_CAR) || (dhsoftCAR[dm] & (1 << unit))) + tp->t_state |= TS_CARR_ON; + addr->dmcsr = DM_IE|DM_SE; + if (tp->t_state & TS_CARR_ON) + break; sleep((caddr_t)&tp->t_rawq, TTIPRI); + } splx(s); }