From: Bill Joy Date: Thu, 19 Jun 1980 22:35:10 +0000 (-0800) Subject: with tracing, it works!?! X-Git-Tag: BSD-4^3~1099 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/6e17970346af5634aad0815f8d8df258b65158cf with tracing, it works!?! SCCS-vsn: sys/vax/uba/up.c 3.5 --- diff --git a/usr/src/sys/vax/uba/up.c b/usr/src/sys/vax/uba/up.c index a8ff02b3b3..eb2204040c 100644 --- a/usr/src/sys/vax/uba/up.c +++ b/usr/src/sys/vax/uba/up.c @@ -1,7 +1,7 @@ +#define UTRACE int asdel = 500; int csdel3 = 100; -int printsw; -/* %H% 3.4 %G% */ +/* %H% 3.5 %G% */ /* * Emulex UNIBUS disk driver with overlapped seeks and ECC recovery. @@ -254,6 +254,10 @@ register struct buf *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) @@ -276,9 +280,12 @@ register unit; int sn, cn, csn; int didie = 0; - if (printsw&1) printf("upustart\n"); 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 @@ -301,6 +308,9 @@ register unit; * 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; @@ -360,6 +370,10 @@ register unit; goto done; search: +#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; @@ -380,6 +394,9 @@ done: * we won't get called again (by upintr() because upas&(1<b_active = 2; dp->b_forw = NULL; if (uptab.b_actf == NULL) @@ -389,6 +406,9 @@ done: uptab.b_actl = dp; out: +#ifdef UTRACE + trace("\n"); +#endif return (didie); } @@ -403,8 +423,11 @@ upstart() daddr_t bn; int dn, sn, tn, cn, cmd; - if (printsw&2) printf("upstart\n"); loop: +#ifdef UTRACE + ttime(); + trace("upstart"); +#endif /* * Pick a drive off the queue of ready drives, and * perform the first transfer on its queue. @@ -413,8 +436,12 @@ loop: * 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 return (0); + } if ((bp = dp->b_actf) == NULL) { uptab.b_actf = dp->b_forw; goto loop; @@ -433,7 +460,13 @@ loop: tn = sn/NSECT; sn %= NSECT; upaddr = UPADDR; +#ifdef UTRACE + trace(" unit %d", dn); +#endif if ((upaddr->upcs2 & 07) != dn) { +#ifdef UTRACE + trace(" select"); +#endif upaddr->upcs2 = dn; DELAY(sdelay); nwaitcs2++; @@ -447,6 +480,9 @@ loop: * (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; @@ -461,6 +497,9 @@ loop: * 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); @@ -472,6 +511,11 @@ loop: * 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; @@ -520,7 +564,10 @@ upintr() 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 @@ -528,9 +575,12 @@ upintr() * 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); -} + } /* * Mark controller or drive not busy, and check for an * error condition which may have resulted from the transfer. @@ -543,6 +593,9 @@ printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1] 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 @@ -607,13 +660,22 @@ printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1] * 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) { +#ifdef UTRACE + trace(" select"); +#endif 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) @@ -637,13 +699,12 @@ printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1] } #ifndef notdef else { - if (printsw&64) printf("cs1 %o\n", upaddr->upcs1); 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); - if (printsw&64) printf("after TRE cs1 %o\n", upaddr->upcs1); } } #endif @@ -654,26 +715,36 @@ printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1] * 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<upas = 1<upcs1); -printf("as=%d act %d %d %d\n", as, uptab.b_active, uputab[0].b_active, uputab[1].b_active); upaddr->upas = 1<upcs1 = IE; - if (printsw&128) printf("exit cs1 %o\n", upaddr->upcs1); + } } upread(dev) @@ -704,7 +775,6 @@ register struct buf *bp; 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