- printf(" dh");
- dhisilo = 0;
- ubafree(dh_ubinfo);
- dh_ubinfo = uballoc((caddr_t)cfree, NCLIST*sizeof (struct cblock), 0);
- cbase = (short)dh_ubinfo;
- d = 0;
- do {
- addr = DHADDR + d;
- if (dhact & (1<<d))
- addr->un.dhcsr |= IENAB;
- d++;
- } while (d < (NDH11+15)/16);
- for (d = 0; d < NDH11; d++) {
- tp = &dh11[d];
- if (tp->t_state & (ISOPEN|WOPEN)) {
- dhparam(d);
- dmctl(d, TURNON, DMSET);
- tp->t_state &= ~BUSY;
- dhstart(tp);
+ }
+ addr = (struct dmdevice *)ui->ui_addr;
+ s = spl5();
+ 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);
+}
+
+/*
+ * Dump control bits into the DM registers.
+ */
+dmctl(dev, bits, how)
+ dev_t dev;
+ int bits, how;
+{
+ register struct uba_device *ui;
+ register struct dmdevice *addr;
+ register int unit, s;
+ int dm;
+
+ unit = minor(dev);
+ dm = unit >> 4;
+ if ((ui = dminfo[dm]) == 0 || ui->ui_alive == 0)
+ return;
+ addr = (struct dmdevice *)ui->ui_addr;
+ s = spl5();
+ addr->dmcsr &= ~DM_SE;
+ while (addr->dmcsr & DM_BUSY)
+ ;
+ addr->dmcsr = unit & 0xf;
+ switch(how) {
+ case DMSET:
+ addr->dmlstat = bits;
+ break;
+ case DMBIS:
+ addr->dmlstat |= bits;
+ break;
+ case DMBIC:
+ addr->dmlstat &= ~bits;
+ break;
+ }
+ addr->dmcsr = DM_IE|DM_SE;
+ splx(s);
+}
+
+/*
+ * DM11 interrupt; deal with carrier transitions.
+ */
+dmintr(dm)
+ register int dm;
+{
+ register struct uba_device *ui;
+ register struct tty *tp;
+ register struct dmdevice *addr;
+ int unit;
+
+ ui = dminfo[dm];
+ if (ui == 0)
+ return;
+ addr = (struct dmdevice *)ui->ui_addr;
+ if (addr->dmcsr&DM_DONE) {
+ if (addr->dmcsr&DM_CF) {
+ unit = addr->dmcsr & 0xf;
+ tp = &dh11[(dm << 4) + unit];
+ if (addr->dmlstat & DML_CAR)
+ (void)(*linesw[tp->t_line].l_modem)(tp, 1);
+ else if ((dhsoftCAR[dm] & (1<<unit)) == 0 &&
+ (*linesw[tp->t_line].l_modem)(tp, 0) == 0)
+ addr->dmlstat = 0;