fix from tef to use UP_NOP so dont get spurious drives which arent there
[unix-history] / usr / src / sys / vax / uba / up.c
index 43e801f..e9b882f 100644 (file)
@@ -1,4 +1,4 @@
-/*     up.c    4.37    81/04/09        */
+/*     up.c    4.49    82/05/19        */
 
 #include "up.h"
 #if NSC > 0
 
 #include "up.h"
 #if NSC > 0
@@ -42,13 +42,22 @@ struct      size
        daddr_t nblocks;
        int     cyloff;
 } up_sizes[8] = {
        daddr_t nblocks;
        int     cyloff;
 } up_sizes[8] = {
+#ifdef ERNIE
+       49324,  0,              /* A=cyl 0 thru 26 */
+#else
        15884,  0,              /* A=cyl 0 thru 26 */
        15884,  0,              /* A=cyl 0 thru 26 */
+#endif
        33440,  27,             /* B=cyl 27 thru 81 */
        495520, 0,              /* C=cyl 0 thru 814 */
        15884,  562,            /* D=cyl 562 thru 588 */
        55936,  589,            /* E=cyl 589 thru 680 */
        33440,  27,             /* B=cyl 27 thru 81 */
        495520, 0,              /* C=cyl 0 thru 814 */
        15884,  562,            /* D=cyl 562 thru 588 */
        55936,  589,            /* E=cyl 589 thru 680 */
-       81472,  681,            /* F=cyl 681 thru 814 */
-       153824, 562,            /* G=cyl 562 thru 814 */
+#ifndef NOBADSECT
+       81376,  681,            /* F=cyl 681 thru 814 */
+       153728, 562,            /* G=cyl 562 thru 814 */
+#else
+       81472,  681,
+       153824, 562,
+#endif
        291346, 82,             /* H=cyl 82 thru 561 */
 }, fj_sizes[8] = {
        15884,  0,              /* A=cyl 0 thru 49 */
        291346, 82,             /* H=cyl 82 thru 561 */
 }, fj_sizes[8] = {
        15884,  0,              /* A=cyl 0 thru 49 */
@@ -58,11 +67,28 @@ struct      size
        0,      0,
        0,      0,
        0,      0,
        0,      0,
        0,      0,
        0,      0,
-       213760, 155,            /* H=cyl 155 thru 822 */
+#ifndef NOBADSECT
+       213664, 155,            /* H=cyl 155 thru 822 */
+#else
+       213760, 155,
+#endif
+}, am_sizes[8] = {
+       15884,  0,              /* A=cyl 0 thru 31 */
+       33440,  32,             /* B=cyl 32 thru 97 */
+       524288, 0,              /* C=cyl 0 thru 1023 */
+       27786,  668,
+       27786,  723,
+       125440, 778,
+       181760, 668,            /* G=cyl 668 thru 1022 */
+       291346, 98,             /* H=cyl 98 thru 667 */
 };
 /* END OF STUFF WHICH SHOULD BE READ IN PER DISK */
 
 };
 /* END OF STUFF WHICH SHOULD BE READ IN PER DISK */
 
-#define        _upSDIST        2               /* 1.0 msec */
+/*
+ * On a 780 upSDIST could be 2, but
+ * in the interest of 750's...
+ */
+#define        _upSDIST        3               /* 1.5 msec */
 #define        _upRDIST        4               /* 2.0 msec */
 
 int    upSDIST = _upSDIST;
 #define        _upRDIST        4               /* 2.0 msec */
 
 int    upSDIST = _upSDIST;
@@ -71,7 +97,8 @@ int   upRDIST = _upRDIST;
 int    upprobe(), upslave(), upattach(), updgo(), upintr();
 struct uba_ctlr *upminfo[NSC];
 struct uba_device *updinfo[NUP];
 int    upprobe(), upslave(), upattach(), updgo(), upintr();
 struct uba_ctlr *upminfo[NSC];
 struct uba_device *updinfo[NUP];
-struct uba_device *upip[NSC][4];
+#define        UPIPUNITS       8
+struct uba_device *upip[NSC][UPIPUNITS]; /* fuji w/fixed head gives n,n+4 */
 
 u_short        upstd[] = { 0776700, 0774400, 0776300, 0 };
 struct uba_driver scdriver =
 
 u_short        upstd[] = { 0776700, 0774400, 0776300, 0 };
 struct uba_driver scdriver =
@@ -88,6 +115,7 @@ struct       upst {
        32,     19,     32*19,  823,    up_sizes,       /* 9300/cdc */
 /* 9300 actually has 815 cylinders... */
        32,     10,     32*10,  823,    fj_sizes,       /* fujitsu 160m */
        32,     19,     32*19,  823,    up_sizes,       /* 9300/cdc */
 /* 9300 actually has 815 cylinders... */
        32,     10,     32*10,  823,    fj_sizes,       /* fujitsu 160m */
+       32,     16,     32*16,  1024,   am_sizes,       /* ampex capricorn */
 };
 
 u_char up_offset[16] = {
 };
 
 u_char up_offset[16] = {
@@ -132,6 +160,7 @@ upslave(ui, reg)
 
        upaddr->upcs1 = 0;              /* conservative */
        upaddr->upcs2 = ui->ui_slave;
 
        upaddr->upcs1 = 0;              /* conservative */
        upaddr->upcs2 = ui->ui_slave;
+       upaddr->upcs1 = UP_NOP|UP_GO;
        if (upaddr->upcs2&UPCS2_NED) {
                upaddr->upcs1 = UP_DCLR|UP_GO;
                return (0);
        if (upaddr->upcs2&UPCS2_NED) {
                upaddr->upcs1 = UP_DCLR|UP_GO;
                return (0);
@@ -156,8 +185,10 @@ upattach(ui)
        upaddr->upcs1 = 0;
        upaddr->upcs2 = ui->ui_slave;
        upaddr->uphr = UPHR_MAXTRAK;
        upaddr->upcs1 = 0;
        upaddr->upcs2 = ui->ui_slave;
        upaddr->uphr = UPHR_MAXTRAK;
-       if (upaddr->uphr == 10)
+       if (upaddr->uphr == 9)
                ui->ui_type = 1;                /* fujitsu hack */
                ui->ui_type = 1;                /* fujitsu hack */
+       else if (upaddr->uphr == 15)
+               ui->ui_type = 2;                /* ampex hack */
        upaddr->upcs2 = UPCS2_CLR;
 /*
        upaddr->uphr = UPHR_MAXCYL;
        upaddr->upcs2 = UPCS2_CLR;
 /*
        upaddr->uphr = UPHR_MAXCYL;
@@ -434,6 +465,7 @@ updgo(um)
 {
        register struct updevice *upaddr = (struct updevice *)um->um_addr;
 
 {
        register struct updevice *upaddr = (struct updevice *)um->um_addr;
 
+       um->um_tab.b_active++;  /* should now be 2 */
        upaddr->upba = um->um_ubinfo;
        upaddr->upcs1 = um->um_cmd|((um->um_ubinfo>>8)&0x300);
 }
        upaddr->upba = um->um_ubinfo;
        upaddr->upcs1 = um->um_cmd|((um->um_ubinfo>>8)&0x300);
 }
@@ -460,7 +492,7 @@ upintr(sc21)
         * interrupt for attention status on seeking drives.
         * Just service them.
         */
         * interrupt for attention status on seeking drives.
         * Just service them.
         */
-       if (um->um_tab.b_active == 0) {
+       if (um->um_tab.b_active != 2 && !sc->sc_recal) {
                if (upaddr->upcs1 & UP_TRE)
                        upaddr->upcs1 = UP_TRE;
                goto doattn;
                if (upaddr->upcs1 & UP_TRE)
                        upaddr->upcs1 = UP_TRE;
                goto doattn;
@@ -606,7 +638,7 @@ doattn:
                unit--;         /* was 1 origin */
                as &= ~(1<<unit);
                upaddr->upas = 1<<unit;
                unit--;         /* was 1 origin */
                as &= ~(1<<unit);
                upaddr->upas = 1<<unit;
-               if (upustart(upip[sc21][unit]))
+               if (unit < UPIPUNITS && upustart(upip[sc21][unit]))
                        needie = 0;
        }
        /*
                        needie = 0;
        }
        /*
@@ -711,7 +743,7 @@ upecc(ui)
                i++;
                bit -= 8;
        }
                i++;
                bit -= 8;
        }
-       um->um_tab.b_active++;  /* Either complete or continuing... */
+       um->um_tab.b_active = 2;        /* Either complete or continuing... */
        if (up->upwc == 0)
                return (0);
        /*
        if (up->upwc == 0)
                return (0);
        /*
@@ -764,6 +796,7 @@ upreset(uban)
                um->um_tab.b_active = 0;
                um->um_tab.b_actf = um->um_tab.b_actl = 0;
                up_softc[sc21].sc_recal = 0;
                um->um_tab.b_active = 0;
                um->um_tab.b_actf = um->um_tab.b_actl = 0;
                up_softc[sc21].sc_recal = 0;
+               up_softc[sc21].sc_wticks = 0;
                if (um->um_ubinfo) {
                        printf("<%d>", (um->um_ubinfo>>28)&0xf);
                        ubadone(um);
                if (um->um_ubinfo) {
                        printf("<%d>", (um->um_ubinfo>>28)&0xf);
                        ubadone(um);