SCCS-vsn: sys/vax/uba/up.c 3.5
int asdel = 500;
int csdel3 = 100;
int asdel = 500;
int csdel3 = 100;
-int printsw;
-/* %H% 3.4 %G% */
/*
* Emulex UNIBUS disk driver with overlapped seeks and ECC recovery.
/*
* Emulex UNIBUS disk driver with overlapped seeks and ECC recovery.
dp = &uputab[unit];
(void) spl5();
disksort(dp, bp);
dp = &uputab[unit];
(void) spl5();
disksort(dp, bp);
+#ifdef UTRACE
+ ttime();
+ trace("upstrat bn %d unit %d\n", bp->b_blkno, unit);
+#endif
if (dp->b_active == 0) {
(void) upustart(unit);
if (uptab.b_actf && uptab.b_active == 0)
if (dp->b_active == 0) {
(void) upustart(unit);
if (uptab.b_actf && uptab.b_active == 0)
int sn, cn, csn;
int didie = 0;
int sn, cn, csn;
int didie = 0;
- if (printsw&1) printf("upustart\n");
if (unit >= NUP)
goto out;
if (unit >= NUP)
goto out;
+#ifdef UTRACE
+ ttime();
+ trace("upustart %d active %d", unit, uputab[unit].b_active);
+#endif
/*
* Whether or not it was before, this unit is no longer busy.
* Check to see if there is (still or now) a request in this
/*
* Whether or not it was before, this unit is no longer busy.
* Check to see if there is (still or now) a request in this
* the drive, preset it and put in 16bit/word mode.
*/
if ((upaddr->upds & VV) == 0) {
* the drive, preset it and put in 16bit/word mode.
*/
if ((upaddr->upds & VV) == 0) {
+#ifdef UTRACE
+ trace(" not VV");
+#endif
upaddr->upcs1 = IE|DCLR|GO;
DELAY(idelay);
upaddr->upcs1 = IE|PRESET|GO;
upaddr->upcs1 = IE|DCLR|GO;
DELAY(idelay);
upaddr->upcs1 = IE|PRESET|GO;
+#ifdef UTRACE
+ trace(" search %d@%d to %d@%d", upaddr->updc, (upaddr->upla>>6),
+ cn, sn);
+#endif
upaddr->updc = cn;
upaddr->upda = sn;
upaddr->upcs1 = IE|SEARCH|GO;
upaddr->updc = cn;
upaddr->upda = sn;
upaddr->upcs1 = IE|SEARCH|GO;
* we won't get called again (by upintr() because upas&(1<<unit))
* and link us onto the chain of ready disks.
*/
* we won't get called again (by upintr() because upas&(1<<unit))
* and link us onto the chain of ready disks.
*/
+#ifdef UTRACE
+ trace(" done");
+#endif
dp->b_active = 2;
dp->b_forw = NULL;
if (uptab.b_actf == NULL)
dp->b_active = 2;
dp->b_forw = NULL;
if (uptab.b_actf == NULL)
+#ifdef UTRACE
+ trace("\n");
+#endif
daddr_t bn;
int dn, sn, tn, cn, cmd;
daddr_t bn;
int dn, sn, tn, cn, cmd;
- if (printsw&2) printf("upstart\n");
+#ifdef UTRACE
+ ttime();
+ trace("upstart");
+#endif
/*
* Pick a drive off the queue of ready drives, and
* perform the first transfer on its queue.
/*
* Pick a drive off the queue of ready drives, and
* perform the first transfer on its queue.
* are not present and on-line, for which we completely clear the
* request queue.
*/
* are not present and on-line, for which we completely clear the
* request queue.
*/
- if ((dp = uptab.b_actf) == NULL)
+ if ((dp = uptab.b_actf) == NULL) {
+#ifdef UTRACE
+ trace("\n");
+#endif
if ((bp = dp->b_actf) == NULL) {
uptab.b_actf = dp->b_forw;
goto loop;
if ((bp = dp->b_actf) == NULL) {
uptab.b_actf = dp->b_forw;
goto loop;
tn = sn/NSECT;
sn %= NSECT;
upaddr = UPADDR;
tn = sn/NSECT;
sn %= NSECT;
upaddr = UPADDR;
+#ifdef UTRACE
+ trace(" unit %d", dn);
+#endif
if ((upaddr->upcs2 & 07) != dn) {
if ((upaddr->upcs2 & 07) != dn) {
+#ifdef UTRACE
+ trace(" select");
+#endif
upaddr->upcs2 = dn;
DELAY(sdelay);
nwaitcs2++;
upaddr->upcs2 = dn;
DELAY(sdelay);
nwaitcs2++;
* (Then on to any other ready drives.)
*/
if ((upaddr->upds & (DPR|MOL)) != (DPR|MOL)) {
* (Then on to any other ready drives.)
*/
if ((upaddr->upds & (DPR|MOL)) != (DPR|MOL)) {
+#ifdef UTRACE
+ trace(" !(DPR && MOL)");
+#endif
uptab.b_active = 0;
uptab.b_errcnt = 0;
dp->b_actf = bp->av_forw;
uptab.b_active = 0;
uptab.b_errcnt = 0;
dp->b_actf = bp->av_forw;
* begin to try offsetting the heads to recover the data.
*/
if (uptab.b_errcnt >= 16) {
* begin to try offsetting the heads to recover the data.
*/
if (uptab.b_errcnt >= 16) {
+#ifdef UTRACE
+ trace(" offset");
+#endif
upaddr->upof = up_offset[uptab.b_errcnt & 017] | FMT22;
upaddr->upcs1 = IE|OFFSET|GO;
DELAY(idelay);
upaddr->upof = up_offset[uptab.b_errcnt & 017] | FMT22;
upaddr->upcs1 = IE|OFFSET|GO;
DELAY(idelay);
* 2 bits of the UNIBUS address from the information
* returned by ubasetup() for the cs1 register bits 8 and 9.
*/
* 2 bits of the UNIBUS address from the information
* returned by ubasetup() for the cs1 register bits 8 and 9.
*/
+#ifdef UTRACE
+ trace(" %s %d.%d@%d cnt %d ba %x\n",
+ (bp->b_flags&B_READ) ? "read" : "write",
+ cn, tn, sn, bp->b_bcount, up_ubinfo & 0x3ffff);
+#endif
upaddr->updc = cn;
upaddr->upda = (tn << 8) + sn;
upaddr->upba = up_ubinfo;
upaddr->updc = cn;
upaddr->upda = (tn << 8) + sn;
upaddr->upba = up_ubinfo;
int as = upaddr->upas & 0377;
int needie = 1;
int as = upaddr->upas & 0377;
int needie = 1;
- if (printsw&4) printf("upintr as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active);
+#ifdef UTRACE
+ ttime();
+ trace("upintr as %d act %d %d %d;", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active);
+#endif
if (uptab.b_active) {
/*
* The drive is transferring, thus the hardware
if (uptab.b_active) {
/*
* The drive is transferring, thus the hardware
* completes; check for it anyways.
*/
if ((upaddr->upcs1 & RDY) == 0) {
* completes; check for it anyways.
*/
if ((upaddr->upcs1 & RDY) == 0) {
+#ifdef UTRACE
+ trace(" !RDY");
+#endif
printf("!RDY in upintr: cs1 %o\n", upaddr->upcs1);
printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active);
printf("!RDY in upintr: cs1 %o\n", upaddr->upcs1);
printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active);
/*
* Mark controller or drive not busy, and check for an
* error condition which may have resulted from the transfer.
/*
* Mark controller or drive not busy, and check for an
* error condition which may have resulted from the transfer.
else if (DK_N+unit <= DK_NMAX)
dk_busy &= ~(1<<(DK_N+unit));
if (upaddr->upcs1 & TRE) {
else if (DK_N+unit <= DK_NMAX)
dk_busy &= ~(1<<(DK_N+unit));
if (upaddr->upcs1 & TRE) {
+#ifdef UTRACE
+ trace(" TRE");
+#endif
/*
* 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
* on this drive with the upustart routine (if any).
*/
if (uptab.b_active) {
* on this drive with the upustart routine (if any).
*/
if (uptab.b_active) {
+#ifdef UTRACE
+ trace(" unit %d", unit);
+#endif
if ((upaddr->upcs2 & 07) != unit) {
if ((upaddr->upcs2 & 07) != unit) {
+#ifdef UTRACE
+ trace(" select");
+#endif
upaddr->upcs2 = unit;
DELAY(sdelay);
nwaitcs2++;
} else
neasycs2++;
if (uptab.b_errcnt >= 16) {
upaddr->upcs2 = unit;
DELAY(sdelay);
nwaitcs2++;
} else
neasycs2++;
if (uptab.b_errcnt >= 16) {
+#ifdef UTRACE
+ trace(" rtc");
+#endif
upaddr->upcs1 = RTC|GO|IE;
DELAY(idelay);
while (upaddr->upds & PIP)
upaddr->upcs1 = RTC|GO|IE;
DELAY(idelay);
while (upaddr->upds & PIP)
- if (printsw&64) printf("cs1 %o\n", upaddr->upcs1);
if (upaddr->upcs1 & TRE) {
if (upaddr->upcs1 & TRE) {
- printf("TRE in upintr: cs1 %o\n", upaddr->upcs1);
-printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active);
+#ifdef UTRACE
+ trace(" TRE");
+#endif
upaddr->upcs1 = TRE;
DELAY(idelay);
upaddr->upcs1 = TRE;
DELAY(idelay);
- if (printsw&64) printf("after TRE cs1 %o\n", upaddr->upcs1);
* Finally, if the controller is not transferring
* start it if any drives are now ready to transfer.
*/
* Finally, if the controller is not transferring
* start it if any drives are now ready to transfer.
*/
+#ifdef UTRACE
+ trace("\n");
+#endif
for (unit = 0; unit < NUP; unit++)
if (as & (1<<unit))
if (uputab[unit].b_active == 1) {
upaddr->upas = 1<<unit;
for (unit = 0; unit < NUP; unit++)
if (as & (1<<unit))
if (uputab[unit].b_active == 1) {
upaddr->upas = 1<<unit;
+#ifdef UTRACE
+ trace("as clear %d\n", unit);
+#endif
if (asdel) DELAY(asdel);
if (upustart(unit))
needie = 0;
} else {
if (asdel) DELAY(asdel);
if (upustart(unit))
needie = 0;
} else {
- printf("as in upintr: cs1 %o\n", upaddr->upcs1);
-printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active);
+#ifdef UTRACE
+ trace("spurious as clear %d\n", unit);
+#endif
DELAY(1000);
}
if (uptab.b_actf && uptab.b_active == 0)
if (upstart())
needie = 0;
out:
DELAY(1000);
}
if (uptab.b_actf && uptab.b_active == 0)
if (upstart())
needie = 0;
out:
+ if (needie) {
+#ifdef UTRACE
+ trace("upintr set IE\n");
+#endif
- if (printsw&128) printf("exit cs1 %o\n", upaddr->upcs1);
int reg, bit, byte, npf, mask, o, cmd, ubaddr;
int bn, cn, tn, sn;
int reg, bit, byte, npf, mask, o, cmd, ubaddr;
int bn, cn, tn, sn;
- if (printsw&8) printf("upecc\n");
/*
* Npf is the number of sectors transferred before the sector
* containing the ECC error, and reg is the UBA register
/*
* Npf is the number of sectors transferred before the sector
* containing the ECC error, and reg is the UBA register