SC11 > 0 rather than ifdef SC11
[unix-history] / usr / src / sys / vax / uba / up.c
index 0b0c822..a63873b 100644 (file)
@@ -1,6 +1,10 @@
-/*     up.c    3.29    %G%     */
+/*     up.c    4.6     %G%     */
 
 #include "../conf/up.h"
 
 #include "../conf/up.h"
+#if NUP > 0
+#if SC11 > 0
+#include "../dev/up.c.SC11"
+#else
 /*
  * UNIBUS disk driver with overlapped seeks and ECC recovery.
  */
 /*
  * UNIBUS disk driver with overlapped seeks and ECC recovery.
  */
@@ -171,6 +175,9 @@ struct      buf     rupbuf;                 /* Buffer for raw i/o */
 
 /* Bits of upcs2 */
 #define        CLR     040             /* Controller clear */
 
 /* Bits of upcs2 */
 #define        CLR     040             /* Controller clear */
+#define        MXF     01000
+#define        NEM     04000
+
 /* Bits of uper1 */
 #define        DCK     0100000         /* Ecc error occurred */
 #define        ECH     0100            /* Ecc error was unrecoverable */
 /* Bits of uper1 */
 #define        DCK     0100000         /* Ecc error occurred */
 #define        ECH     0100            /* Ecc error was unrecoverable */
@@ -207,7 +214,7 @@ register struct buf *bp;
        long sz, bn;
 
        if (upwstart == 0) {
        long sz, bn;
 
        if (upwstart == 0) {
-               timeout((caddr_t)upwatch, 0, HZ);
+               timeout(upwatch, (caddr_t)0, HZ);
                upwstart++;
        }
        xunit = minor(bp->b_dev) & 077;
                upwstart++;
        }
        xunit = minor(bp->b_dev) & 077;
@@ -507,6 +514,7 @@ upintr()
                if ((upaddr->upcs2 & 07) != unit)
                        upaddr->upcs2 = unit;
                if ((upaddr->upds&ERR) || (upaddr->upcs1&TRE)) {
                if ((upaddr->upcs2 & 07) != unit)
                        upaddr->upcs2 = unit;
                if ((upaddr->upds&ERR) || (upaddr->upcs1&TRE)) {
+                       int cs2;
                        /*
                         * An error occurred, indeed.  Select this unit
                         * to get at the drive status (a SEARCH may have
                        /*
                         * An error occurred, indeed.  Select this unit
                         * to get at the drive status (a SEARCH may have
@@ -528,7 +536,9 @@ upintr()
                        else
                                uptab.b_active = 0;     /* To force retry */
                        if (uptab.b_errcnt > 27)
                        else
                                uptab.b_active = 0;     /* To force retry */
                        if (uptab.b_errcnt > 27)
-                               deverror(bp, upaddr->upcs2, upaddr->uper1);
+                               cs2 = (int)upaddr->upcs2;
+                               deverror(bp, (int)upaddr->upcs2,
+                                   (int)upaddr->uper1);
                        /*
                         * If this was a correctible ECC error, let upecc
                         * do the dirty work to correct it.  If upecc
                        /*
                         * If this was a correctible ECC error, let upecc
                         * do the dirty work to correct it.  If upecc
@@ -550,6 +560,11 @@ upintr()
                                while(upaddr->upds & PIP)
                                        DELAY(25);
                        }
                                while(upaddr->upds & PIP)
                                        DELAY(25);
                        }
+                       if (uptab.b_errcnt == 28 && cs2&(NEM|MXF)) {
+                               printf("FLAKEY UP ");
+                               ubareset();
+                               return;
+                       }
                }
                /*
                 * If we are still noted as active, then no
                }
                /*
                 * If we are still noted as active, then no
@@ -610,7 +625,6 @@ upintr()
        if (uptab.b_actf && uptab.b_active == 0)
                if (upstart())
                        needie = 0;
        if (uptab.b_actf && uptab.b_active == 0)
                if (upstart())
                        needie = 0;
-out:
        if (needie)
                upaddr->upcs1 = IE;
 }
        if (needie)
                upaddr->upcs1 = IE;
 }
@@ -721,6 +735,7 @@ upreset()
        int unit;
 
        printf(" up");
        int unit;
 
        printf(" up");
+       DELAY(15000000);                /* give it time to self-test */
        uptab.b_active = 0;
        uptab.b_actf = uptab.b_actl = 0;
        if (up_ubinfo) {
        uptab.b_active = 0;
        uptab.b_actf = uptab.b_actl = 0;
        if (up_ubinfo) {
@@ -745,7 +760,7 @@ upwatch()
 {
        int i;
 
 {
        int i;
 
-       timeout((caddr_t)upwatch, 0, HZ);
+       timeout(upwatch, (caddr_t)0, HZ);
        if (uptab.b_active == 0) {
                for (i = 0; i < NUP; i++)
                        if (uputab[i].b_active)
        if (uptab.b_active == 0) {
                for (i = 0; i < NUP; i++)
                        if (uputab[i].b_active)
@@ -762,3 +777,5 @@ active:
                printf("\n");
        }
 }
                printf("\n");
        }
 }
+#endif
+#endif