jeremym@unx1.UUCP (Jeremy Maris) (11/01/86)
I'm posting this in response to recent articles in net.bugs.2bsd. There are indeed bugs in the original 2.9bsd distribution ts11 driver. I list below the ones we know about and the fixes we've applied to make it work. 1) Most serious. The buffer address was not loaded into the command packet. The driver would never have worked like this. Kevin Twiddle at Imperial College fixed this one. from tsstart() * If the data transfer command is in the correct place, * set up all registers and do the transfer. */ if ((blkno = sc->sc_blkno) == dbtofsb(bp->b_blkno)) { tc->c_size = bp->b_bcount; if ((bp->b_flags & B_READ) == 0) cmd = TS_WCOM; else cmd = TS_RCOM; if (tstab.b_errcnt) cmd |= TS_RETRY; tstab.b_active = SIO; | /* KPT start - Put buffer address in to command packet */ | tc->c_loba = bp->b_un.b_addr; | tc->c_hiba = bp->b_xmem; | | /* KPT end */ 2) The field sc_cmd must be aligned on a four byte bondary. The driver might work, depending upon where it gets loaded when you link the kernel. This code by Steve Isard at Sussex. in global declarations struct ts_softc { char sc_openf; char sc_lastiow; short sc_resid; daddr_t sc_blkno; daddr_t sc_nxrec; struct ts_cmd sc_cmd; struct ts_char sc_char; | int align; /* structure must be multiple of 4 bytes | * long to make sc_cmd come out on 4 byte | * boundary every time */ } *ts_softc; | /* We want space for an array of NTS ts_softc structures, where the sc_cmd | * field of each is long-aligned(i.e., core address is a multiple of 4 bytes). | * The compiler can only guarantee that the address will be even. Therefore we | * want to reserve an extra 2 bytes so that we can slide the array down by 2 | * if the compiler gets it wrong. ts_softc gets located within softspace in | * tsattach. | */ | char softspace[sizeof(struct ts_softc)*NTS+2]; replacement tsattach() tsattach(addr, unit) struct tsdevice *addr; { /* * This driver supports only one controller. */ if (unit == 0) { | /* Make ts_softc start on a 4 byte boundary */ | (u_short)ts_softc = (((u_short)softspace)&03 ? | ((u_short)softspace)+2 : (u_short)softspace); TSADDR = addr; return(1); } return(0); } 3) Space record and file commands don't work ( ie FSF FSR BSR and BSF). This bug led us to suppose that our tape drive or controller wouldn't support space record operations. After much hunting and running of diagnostics, and fixing the obvious bugs below, I resorted to doing a diff on the ts driver supplied with the Seismo distribution from Keith Bostic that eventually came our way. It turned out that a - got changed to a + and vice versa somewhere else. This bug manifests itself in that the tar r and tar u operations result in a tape IO error, and mt will not manipulate the tape correctly. Otherwise, all seems OK. in tsclose() if ((minor(dev) & T_NOREWIND) == 0 ) /* * 0 count means don't hang waiting for rewind complete. * Rather ctsbuf stays busy until the operation completes * preventing further opens from completing by * preventing a TS_SENSE from completing. */ | tscommand(dev, TS_REW, 0); /* KPT REV -> REW */ in tscommand() splx(s); bp->b_dev = dev; | bp->b_repcnt = count; /* AJM changed from -count */ bp->b_command = com; in tsseteof() else { /* spacing forward */ | sc->sc_blkno = dbtofsb(bp->b_blkno) | + sc->sc_sts.s_rbpcr; /* AJM changed from - to + */ /* OLD LINE static tsops[] = {TS_WEOF,TS_SFORW,TS_SREV,TS_SFORW,TS_SREV, TS_REW,TS_OFFL,TS_SENSE}; */ | static tsops[] = {TS_WEOF,TS_SFORWF,TS_SREVF,TS_SFORW,TS_SREV,TS_REW, | TS_OFFL,TS_SENSE}; As we run an 11/73, I can't vouch for its performance on a Unibus machine. We haven't tried the driver supplied with the Seismo distribution, but the code looks OK. However, sc_cmd needs to be aligned on a 4 byte boundary, so try the fix above. I'll mail this driver if anyone wants it. --------------------------------------------------------------------------- Jeremy Maris, Experimental Psychology, Sussex University, Falmer, Brighton E. Sussex BN1 9QY, England. uucp : ...mcvax!ukc!warwick!cvaxa!unx1!jeremym Janet : scfa5@uk.ac.sussex.vax2 Arpa : jeremym%unx1.uucp%cvaxa@uk.ac.ucl-cs ---------------------------------------------------------------------------