X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/d13306469087fadeefddbf85d793a73fe4afc2c2..809050756a30fe4d50aa9388e51f189e1cdafee0:/usr/src/sys/vax/uba/tm.c diff --git a/usr/src/sys/vax/uba/tm.c b/usr/src/sys/vax/uba/tm.c index 9311997831..cd5e51af43 100644 --- a/usr/src/sys/vax/uba/tm.c +++ b/usr/src/sys/vax/uba/tm.c @@ -1,12 +1,15 @@ -/* tm.c 4.17 %G% */ +/* tm.c 4.22 %G% */ -#include "tm.h" +#include "te.h" #if NTM > 0 int tmgapsdcnt; /* DEBUG */ /* * TM11/TE10 tape driver * - * THIS DRIVER HAS NOT BEEN TESTED WITH MORE THAN ONE TRANSPORT. + * Todo: + * Test driver with more than one slave + * Test reset code + * Do rewinds without hanging in driver */ #define DELAY(N) { register int d = N; while (--d > 0); } #include "../h/param.h" @@ -58,7 +61,9 @@ struct tm_softc { u_short sc_erreg; /* copy of last erreg */ u_short sc_dsreg; /* copy of last dsreg */ short sc_resid; /* copy of last bc */ +#ifdef notdef short sc_lastcmd; /* last command to handle direction changes */ +#endif } tm_softc[NTM]; /* @@ -154,13 +159,8 @@ tmopen(dev, flag) return; } tmcommand(dev, TM_SENSE, 1); - if ((sc->sc_erreg&(TM_SELR|TM_TUR)) != (TM_SELR|TM_TUR)) { - uprintf("tape not online\n"); - u.u_error = EIO; - return; - } - if ((flag&(FREAD|FWRITE)) == FWRITE && sc->sc_erreg&TM_WRL) { - uprintf("tape write protected\n"); + if ((sc->sc_erreg&(TM_SELR|TM_TUR)) != (TM_SELR|TM_TUR) || + (flag&(FREAD|FWRITE)) == FWRITE && sc->sc_erreg&TM_WRL) { u.u_error = EIO; return; } @@ -168,8 +168,6 @@ tmopen(dev, flag) sc->sc_blkno = (daddr_t)0; sc->sc_nxrec = INF; sc->sc_lastiow = 0; - sc->sc_openf = 1; - return; } /* @@ -370,12 +368,12 @@ loop: cmd |= TM_RCOM; um->um_tab.b_active = SIO; um->um_cmd = cmd; -/* +#ifdef notdef if (tmreverseop(sc->sc_lastcmd)) while (addr->tmer & TM_SDWN) tmgapsdcnt++; -*/ sc->sc_lastcmd = TM_RCOM; /* will serve */ +#endif ubago(ui); return; } @@ -392,12 +390,12 @@ loop: addr->tmbc = dbtofsb(bp->b_blkno) - blkno; } dobpcmd: -/* +#ifdef notdef if (tmreverseop(sc->sc_lastcmd) != tmreverseop(bp->b_command)) while (addr->tmer & TM_SDWN) tmgapsdcnt++; -*/ sc->sc_lastcmd = bp->b_command; +#endif addr->tmcs = (cmd | bp->b_command); return; @@ -500,10 +498,6 @@ tmintr(tm11) */ if ((addr->tmer&TM_HARD)==0 && state==SIO) { if (++um->um_tab.b_errcnt < 7) { -/* SHOULD CHECK THAT RECOVERY WORKS IN THIS CASE */ -/* AND THEN ONLY PRINT IF errcnt==7 */ - if((addr->tmer&TM_SOFT) == TM_NXM) - printf("TM UBA late error\n"); sc->sc_blkno++; ubadone(um); goto opcont; @@ -518,7 +512,8 @@ tmintr(tm11) /* * Couldn't recover error */ - deverror(bp, sc->sc_erreg, sc->sc_dsreg); + printf("te%d: hard error bn%d er=%b\n", minor(bp->b_dev)&03, + bp->b_blkno, sc->sc_erreg, TMEREG_BITS); bp->b_flags |= B_ERROR; goto opdone; } @@ -653,7 +648,6 @@ tmphys(dev) tmreset(uban) int uban; { - int printed = 0; register struct uba_minfo *um; register tm11, unit; register struct uba_dinfo *ui; @@ -663,11 +657,7 @@ tmreset(uban) if ((um = tmminfo[tm11]) == 0 || um->um_alive == 0 || um->um_ubanum != uban) continue; - if (printed == 0) { - printf(" tm"); - DELAY(2000000); /* time to self test */ - printed = 1; - } + printf(" tm%d", tm11); um->um_tab.b_active = 0; um->um_tab.b_actf = um->um_tab.b_actl = 0; if (um->um_ubinfo) { @@ -778,10 +768,8 @@ tmdump() start = 0; num = maxfree; #define phys(a,b) ((b)((int)(a)&0x7fffffff)) - if (tmdinfo[0] == 0) { - printf("dna\n"); - return (-1); - } + if (tmdinfo[0] == 0) + return (ENXIO); ui = phys(tmdinfo[0], struct uba_dinfo *); up = phys(ui->ui_hd, struct uba_hd *)->uh_physuba; #if VAX780 @@ -801,6 +789,8 @@ tmdump() tmeof(addr); tmeof(addr); tmwait(addr); + if (addr->tmcs&TM_ERR) + return (EIO); addr->tmcs = TM_REW | TM_GO; tmwait(addr); return (0);