new version which doesn't get hung up
[unix-history] / usr / src / sys / vax / uba / dh.c
index 4e3b400..a37208b 100644 (file)
@@ -1,11 +1,12 @@
-/*     dh.c    4.22    81/02/23        */
+/*     dh.c    4.26    81/02/27        */
 
 #include "dh.h"
 
 #include "dh.h"
-#if NDH11 > 0
+#if NDH > 0
 #define        DELAY(i)        { register int j = i; while (--j > 0); }
 /*
  * DH-11/DM-11 driver
  */
 #define        DELAY(i)        { register int j = i; while (--j > 0); }
 /*
  * DH-11/DM-11 driver
  */
+#include "bk.h"
 #include "../h/param.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
 #include "../h/param.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
  * There is one definition for the dh and one for the dm.
  */
 int    dhprobe(), dhattach(), dhrint(), dhxint();
  * There is one definition for the dh and one for the dm.
  */
 int    dhprobe(), dhattach(), dhrint(), dhxint();
-struct uba_dinfo *dhinfo[NDH11];
+struct uba_dinfo *dhinfo[NDH];
 u_short        dhstd[] = { 0 };
 struct uba_driver dhdriver =
        { dhprobe, 0, dhattach, 0, dhstd, "dh", dhinfo };
 
 int    dmprobe(), dmattach(), dmintr();
 u_short        dhstd[] = { 0 };
 struct uba_driver dhdriver =
        { dhprobe, 0, dhattach, 0, dhstd, "dh", dhinfo };
 
 int    dmprobe(), dmattach(), dmintr();
-struct uba_dinfo *dminfo[NDH11];
+struct uba_dinfo *dminfo[NDH];
 u_short        dmstd[] = { 0 };
 struct uba_driver dmdriver =
        { dmprobe, 0, dmattach, 0, dmstd, "dm", dminfo };
 u_short        dmstd[] = { 0 };
 struct uba_driver dmdriver =
        { dmprobe, 0, dmattach, 0, dmstd, "dm", dminfo };
@@ -118,11 +119,11 @@ struct dmdevice
 /*
  * Local variables for the driver
  */
 /*
  * Local variables for the driver
  */
-short  dhsar[NDH11];                   /* software copy of last bar */
-short  dhsoftCAR[NDH11];
+short  dhsar[NDH];                     /* software copy of last bar */
+short  dhsoftCAR[NDH];
 
 
-struct tty dh11[NDH11*16];
-int    ndh11   = NDH11*16;
+struct tty dh11[NDH*16];
+int    ndh11   = NDH*16;
 int    dhact;                          /* mask of active dh's */
 int    dhstart(), ttrstrt();
 
 int    dhact;                          /* mask of active dh's */
 int    dhstart(), ttrstrt();
 
@@ -149,7 +150,7 @@ dhprobe(reg)
 #ifdef lint
        br = 0; cvec = br; br = cvec;
 #endif
 #ifdef lint
        br = 0; cvec = br; br = cvec;
 #endif
-#ifdef notdef
+#ifndef notdef
        dhaddr->un.dhcsr = DH_RIE|DH_MM|DH_RI;
        DELAY(5);
        dhaddr->un.dhcsr = 0;
        dhaddr->un.dhcsr = DH_RIE|DH_MM|DH_RI;
        DELAY(5);
        dhaddr->un.dhcsr = 0;
@@ -221,7 +222,7 @@ dhopen(dev, flag)
 
        unit = minor(dev);
        dh = unit >> 4;
 
        unit = minor(dev);
        dh = unit >> 4;
-       if (unit >= NDH11*16 || (ui = dhinfo[dh])== 0 || ui->ui_alive == 0) {
+       if (unit >= NDH*16 || (ui = dhinfo[dh])== 0 || ui->ui_alive == 0) {
                u.u_error = ENXIO;
                return;
        }
                u.u_error = ENXIO;
                return;
        }
@@ -244,12 +245,11 @@ dhopen(dev, flag)
                /* 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+ 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);
+                       512+nclist*sizeof(struct cblock), 0);
                cbase[ui->ui_ubanum] = dh_ubinfo[ui->ui_ubanum]&0x3ffff;
        }
        if ((dhact&(1<<dh)) == 0) {
                addr->un.dhcsr |= DH_IE;
                cbase[ui->ui_ubanum] = dh_ubinfo[ui->ui_ubanum]&0x3ffff;
        }
        if ((dhact&(1<<dh)) == 0) {
                addr->un.dhcsr |= DH_IE;
-               DELAY(5);
                dhact |= (1<<dh);
                addr->dhsilo = 16;
        }
                dhact |= (1<<dh);
                addr->dhsilo = 16;
        }
@@ -354,10 +354,12 @@ dhrint(dh)
                                c = 0;
                        else
                                c = tun.t_intrc;
                                c = 0;
                        else
                                c = tun.t_intrc;
+#if NBK > 0
                if (tp->t_line == NETLDISC) {
                        c &= 0177;
                        BKINPUT(c, tp);
                } else
                if (tp->t_line == NETLDISC) {
                        c &= 0177;
                        BKINPUT(c, tp);
                } else
+#endif
                        (*linesw[tp->t_line].l_rint)(c, tp);
        }
 }
                        (*linesw[tp->t_line].l_rint)(c, tp);
        }
 }
@@ -455,7 +457,6 @@ dhxint(dh)
        ui = dhinfo[dh];
        addr = (struct dhdevice *)ui->ui_addr;
        if (addr->un.dhcsr & DH_NXM) {
        ui = dhinfo[dh];
        addr = (struct dhdevice *)ui->ui_addr;
        if (addr->un.dhcsr & DH_NXM) {
-               DELAY(5);
                addr->un.dhcsr |= DH_CNI;
                printf("dh%d NXM\n", dh);
        }
                addr->un.dhcsr |= DH_CNI;
                printf("dh%d NXM\n", dh);
        }
@@ -473,7 +474,6 @@ dhxint(dh)
                                tp->t_state &= ~FLUSH;
                        else {
                                addr->un.dhcsrl = (unit&017)|DH_IE;
                                tp->t_state &= ~FLUSH;
                        else {
                                addr->un.dhcsrl = (unit&017)|DH_IE;
-                               DELAY(5);
                                /*
                                 * Do arithmetic in a short to make up
                                 * for lost 16&17 bits.
                                /*
                                 * Do arithmetic in a short to make up
                                 * for lost 16&17 bits.
@@ -555,7 +555,6 @@ dhstart(tp)
                unit = 1 << unit;
                dhsar[dh] |= unit;
                addr->dhcar = car;
                unit = 1 << unit;
                dhsar[dh] |= unit;
                addr->dhcar = car;
-               DELAY(5);
                addr->dhbcr = -nch;
                addr->dhbar |= unit;
                tp->t_state |= BUSY;
                addr->dhbcr = -nch;
                addr->dhbar |= unit;
                tp->t_state |= BUSY;
@@ -588,7 +587,6 @@ dhstop(tp, flag)
                 */
                unit = minor(tp->t_dev);
                addr->un.dhcsrl = (unit&017) | DH_IE;
                 */
                unit = minor(tp->t_dev);
                addr->un.dhcsrl = (unit&017) | DH_IE;
-               DELAY(5);
                if ((tp->t_state&TTSTOP)==0)
                        tp->t_state |= FLUSH;
                addr->dhbcr = -1;
                if ((tp->t_state&TTSTOP)==0)
                        tp->t_state |= FLUSH;
                addr->dhbcr = -1;
@@ -614,15 +612,14 @@ dhreset(uban)
        printf(" dh");
        ubarelse(uban, &dh_ubinfo[uban]);
        dh_ubinfo[uban] = uballoc(uban, (caddr_t)cfree,
        printf(" dh");
        ubarelse(uban, &dh_ubinfo[uban]);
        dh_ubinfo[uban] = uballoc(uban, (caddr_t)cfree,
-           512+NCLIST*sizeof (struct cblock), 0);
+           512+nclist*sizeof (struct cblock), 0);
        cbase[uban] = dh_ubinfo[uban]&0x3ffff;
        dh = 0;
        cbase[uban] = dh_ubinfo[uban]&0x3ffff;
        dh = 0;
-       for (dh = 0; dh < NDH11; dh++) {
+       for (dh = 0; dh < NDH; dh++) {
                ui = dhinfo[dh];
                if (ui == 0 || ui->ui_alive == 0 || ui->ui_ubanum != uban)
                        continue;
                ((struct dhdevice *)ui->ui_addr)->un.dhcsr |= DH_IE;
                ui = dhinfo[dh];
                if (ui == 0 || ui->ui_alive == 0 || ui->ui_ubanum != uban)
                        continue;
                ((struct dhdevice *)ui->ui_addr)->un.dhcsr |= DH_IE;
-               DELAY(5);
                ((struct dhdevice *)ui->ui_addr)->dhsilo = 16;
                unit = dh * 16;
                for (i = 0; i < 16; i++) {
                ((struct dhdevice *)ui->ui_addr)->dhsilo = 16;
                unit = dh * 16;
                for (i = 0; i < 16; i++) {
@@ -647,7 +644,7 @@ dhtimer()
 {
        register int dh;
 
 {
        register int dh;
 
-       for (dh = 0; dh < NDH11; dh++)
+       for (dh = 0; dh < NDH; dh++)
                dhrint(dh);
 }
 
                dhrint(dh);
 }
 
@@ -667,7 +664,7 @@ dmopen(dev)
        dm = unit >> 4;
        tp = &dh11[unit];
        unit &= 0xf;
        dm = unit >> 4;
        tp = &dh11[unit];
        unit &= 0xf;
-       if (dm >= NDH11 || (ui = dminfo[dm]) == 0 || ui->ui_alive == 0 ||
+       if (dm >= NDH || (ui = dminfo[dm]) == 0 || ui->ui_alive == 0 ||
            (dhsoftCAR[dm]&(1<<unit))) {
                tp->t_state |= CARR_ON;
                return;
            (dhsoftCAR[dm]&(1<<unit))) {
                tp->t_state |= CARR_ON;
                return;