still get !RDY and as in upintr, but just added as = 1<<unit to fix
[unix-history] / usr / src / sys / vax / uba / dz.c
index 1c94895..c0ae610 100644 (file)
@@ -1,4 +1,4 @@
-/*     dz.c    3.4     %H%     */
+/*     dz.c    3.10    %G%     */
 
 /*
  *  DZ-11 Driver
 
 /*
  *  DZ-11 Driver
 #include "../h/conf.h"
 #include "../h/pdma.h"
 #include "../h/bk.h"
 #include "../h/conf.h"
 #include "../h/pdma.h"
 #include "../h/bk.h"
+
+/*
+ * When running dz's using only SAE (silo alarm) on input
+ * it is necessary to call dzrint() at clock interrupt time.
+ * This is unsafe unless spl5()s in tty code are changed to
+ * spl6()s to block clock interrupts.  Note that the dh driver
+ * currently in use works the same way as the dz, even though
+ * we could try to more intelligently manage its silo.
+ * Thus don't take this out if you have no dz's unless you
+ * change clock.c and dhtimer().
+ */
+#define        spl5    spl6
  
 #define DZADDR  (UBA0_DEV + 0160100)
 #ifdef ERNIE
  
 #define DZADDR  (UBA0_DEV + 0160100)
 #ifdef ERNIE
@@ -192,7 +204,11 @@ dzrint(dev)
                                if (tp->t_flags & RAW)
                                        c = 0;          /* null for getty */
                                else
                                if (tp->t_flags & RAW)
                                        c = 0;          /* null for getty */
                                else
-                                       c = 0177;       /* DEL = interrupt */
+#ifdef IIASA
+                                       continue;
+#else
+                                       c = tun.t_intrc;
+#endif
                        if (c&OVERRUN)
                                printf("o");
                        if (c&PERROR)   
                        if (c&OVERRUN)
                                printf("o");
                        if (c&PERROR)   
@@ -200,12 +216,10 @@ dzrint(dev)
                                if (((tp->t_flags & (EVENP|ODDP)) == EVENP)
                                  || ((tp->t_flags & (EVENP|ODDP)) == ODDP))
                                        continue;
                                if (((tp->t_flags & (EVENP|ODDP)) == EVENP)
                                  || ((tp->t_flags & (EVENP|ODDP)) == ODDP))
                                        continue;
-#ifdef BERKNET
                        if (tp->t_line == NETLDISC) {
                                c &= 0177;
                        if (tp->t_line == NETLDISC) {
                                c &= 0177;
-                               NETINPUT(c, tp);
+                               BKINPUT(c, tp);
                        } else
                        } else
-#endif
                                (*linesw[tp->t_line].l_rint)(c, tp);
                }
        }
                                (*linesw[tp->t_line].l_rint)(c, tp);
                }
        }
@@ -226,8 +240,22 @@ dev_t dev;
        if (ttioccomm(cmd, tp, addr, dev)) {
                if (cmd==TIOCSETP || cmd==TIOCSETN)
                        dzparam(minor(dev));
        if (ttioccomm(cmd, tp, addr, dev)) {
                if (cmd==TIOCSETP || cmd==TIOCSETN)
                        dzparam(minor(dev));
-       } else
+       } else switch(cmd) {
+       case TIOCSBRK:
+               ((struct device *)(tp->t_addr))->dzbrk |= 1 << (dev&07);
+               break;
+       case TIOCCBRK:
+               ((struct device *)(tp->t_addr))->dzbrk &= ~(1 << (dev&07));
+               break;
+       case TIOCSDTR:
+               dzmodem(minor(dev), ON);
+               break;
+       case TIOCCDTR:
+               dzmodem(minor(dev), OFF);
+               break;
+       default:
                u.u_error = ENOTTY;
                u.u_error = ENOTTY;
+       }
 }
  
 dzparam(dev)
 }
  
 dzparam(dev)
@@ -260,6 +288,8 @@ dzxint(tp)
 register struct tty *tp;
 {
        register struct pdma *dp;
 register struct tty *tp;
 {
        register struct pdma *dp;
+       register s;
+       s = spl6();     /* block the clock */
  
        dp = &dzpdma[tp-dz_tty];
        tp->t_state &= ~BUSY;
  
        dp = &dzpdma[tp-dz_tty];
        tp->t_state &= ~BUSY;
@@ -273,6 +303,7 @@ register struct tty *tp;
                dzstart(tp);
        if (tp->t_outq.c_cc == 0 || (tp->t_state&BUSY)==0)
                dp->p_addr->dztcr &= ~(1 << ((tp-dz_tty) % 8));
                dzstart(tp);
        if (tp->t_outq.c_cc == 0 || (tp->t_state&BUSY)==0)
                dp->p_addr->dztcr &= ~(1 << ((tp-dz_tty) % 8));
+       splx(s);
 }
 
 dzstart(tp)
 }
 
 dzstart(tp)
@@ -372,11 +403,15 @@ dzscan()
                } else {
                        if ((tp->t_state & CARR_ON)) {
                                /* carrier lost */
                } else {
                        if ((tp->t_state & CARR_ON)) {
                                /* carrier lost */
-                               signal(tp->t_pgrp, SIGHUP);
-                               dzaddr->dzdtr &= ~bit;
-                               flushtty(tp);
+                               if (tp->t_state&ISOPEN &&
+                                   (tp->t_local&LNOHANG) == 0) {
+                                       gsignal(tp->t_pgrp, SIGHUP);
+                                       gsignal(tp->t_pgrp, SIGCONT);
+                                       dzaddr->dzdtr &= ~bit;
+                                       flushtty(tp);
+                               }
+                               tp->t_state &= ~CARR_ON;
                        }
                        }
-                       tp->t_state &= ~CARR_ON;
                }
        }
        timeout(dzscan, (caddr_t)0, 2*HZ);
                }
        }
        timeout(dzscan, (caddr_t)0, 2*HZ);