-/* tm.c 4.39 81/07/05 */
+/* tm.c 4.48 82/05/27 */
#include "te.h"
#include "ts.h"
-#if NTM > 0
+#if NTE > 0
/*
* TM11/TE10 tape driver
*
u_short sc_dens; /* prototype command with density info */
daddr_t sc_timo; /* time until timeout expires */
short sc_tact; /* timeout is active */
-} te_softc[NTM];
+} te_softc[NTE];
#ifdef unneeded
int tmgapsdcnt; /* DEBUG */
#endif
#define SCOM 3 /* sending control command */
#define SREW 4 /* sending a drive rewind */
-#if NTS > 0
-/*
- * Kludge to get around fact that we don't really
- * check if a ts is there... if there are both tm's and ts's
- * declared in the system, then this driver sets havetm to 1
- * if it finds a tm, and ts just pretends there isn't a ts.
- */
-int havetm = 0;
-#endif
/*
* Determine if there is a controller for
* a tm at address reg. Our goal is to make the
#ifdef lint
br = 0; cvec = br; br = cvec;
+ tmintr(0);
#endif
- ((struct device *)reg)->tmcs = TM_IE;
+ ((struct tmdevice *)reg)->tmcs = TM_IE;
/*
* If this is a tm11, it ought to have interrupted
* by now, if it isn't (ie: it is a ts04) then we just
* a uba error for a ts; but our caller will notice that
* so we won't check for it.
*/
- if (badaddr((caddr_t)&((struct device *)reg)->tmrd, 2))
+ if (badaddr((caddr_t)&((struct tmdevice *)reg)->tmrd, 2))
return (0);
return (1);
}
tmattach(ui)
struct uba_device *ui;
{
-
-#if NTS > 0
- havetm = 1;
-#endif
/*
* Tetotm is used in TMUNIT to index the ctmbuf and rtmbuf
* arrays given a te unit number.
register struct uba_device *ui;
register struct te_softc *sc;
int olddens, dens;
+ int s;
teunit = TEUNIT(dev);
if (teunit>=NTE || (sc = &te_softc[teunit])->sc_openf ||
sc->sc_nxrec = INF;
sc->sc_lastiow = 0;
sc->sc_dens = dens;
- (void) spl6();
+ s = spl6();
if (sc->sc_tact == 0) {
sc->sc_timo = INF;
sc->sc_tact = 1;
timeout(tmtimer, (caddr_t)dev, 5*hz);
}
- (void) spl0();
+ splx(s);
}
/*
int com, count;
{
register struct buf *bp;
+ register int s;
bp = &ctmbuf[TMUNIT(dev)];
- (void) spl5();
+ s = spl5();
while (bp->b_flags&B_BUSY) {
/*
* This special check is because B_BUSY never
sleep((caddr_t)bp, PRIBIO);
}
bp->b_flags = B_BUSY|B_READ;
- (void) spl0();
+ splx(s);
bp->b_dev = dev;
bp->b_repcnt = -count;
bp->b_command = com;
int teunit = TEUNIT(bp->b_dev);
register struct uba_ctlr *um;
register struct buf *dp;
+ int s;
/*
* Put transfer at end of unit queue
*/
dp = &teutab[teunit];
bp->av_forw = NULL;
- (void) spl5();
+ s = spl5();
um = tedinfo[teunit]->ui_mi;
if (dp->b_actf == NULL) {
dp->b_actf = bp;
*/
if (um->um_tab.b_active == 0)
tmstart(um);
- (void) spl0();
+ splx(s);
}
/*
register struct uba_ctlr *um;
{
register struct buf *bp, *dp;
- register struct device *addr = (struct device *)um->um_addr;
+ register struct tmdevice *addr = (struct tmdevice *)um->um_addr;
register struct te_softc *sc;
register struct uba_device *ui;
int teunit, cmd;
* Record pre-transfer status (e.g. for TM_SENSE)
*/
sc = &te_softc[teunit];
- addr = (struct device *)um->um_addr;
+ addr = (struct tmdevice *)um->um_addr;
addr->tmcs = (ui->ui_slave << 8);
sc->sc_dsreg = addr->tmcs;
sc->sc_erreg = addr->tmer;
sc->sc_timo = 5 * 60;
} else {
um->um_tab.b_active = SCOM;
- sc->sc_timo = imin(imax(10 * bp->b_repcnt, 60), 5*60);
+ sc->sc_timo =
+ imin(imax(10*(int)-bp->b_repcnt,60),5*60);
}
if (bp->b_command == TM_SFORW || bp->b_command == TM_SREV)
addr->tmbc = bp->b_repcnt;
tmdgo(um)
register struct uba_ctlr *um;
{
- register struct device *addr = (struct device *)um->um_addr;
+ register struct tmdevice *addr = (struct tmdevice *)um->um_addr;
addr->tmba = um->um_ubinfo;
addr->tmcs = um->um_cmd | ((um->um_ubinfo >> 12) & 0x30);
struct buf *dp;
register struct buf *bp;
register struct uba_ctlr *um = tmminfo[tm11];
- register struct device *addr;
+ register struct tmdevice *addr;
register struct te_softc *sc;
int teunit;
register state;
return;
bp = dp->b_actf;
teunit = TEUNIT(bp->b_dev);
- addr = (struct device *)tedinfo[teunit]->ui_addr;
+ addr = (struct tmdevice *)tedinfo[teunit]->ui_addr;
sc = &te_softc[teunit];
/*
* If last command was a rewind, and tape is still
int dev;
{
register struct te_softc *sc = &te_softc[TEUNIT(dev)];
+ register short x;
if (sc->sc_timo != INF && (sc->sc_timo -= 5) < 0) {
- printf("te%d: lost interrupt\n");
+ printf("te%d: lost interrupt\n", TEUNIT(dev));
sc->sc_timo = INF;
- (void) spl5();
+ x = spl5();
tmintr(TMUNIT(dev));
- (void) spl0();
+ (void) splx(x);
}
timeout(tmtimer, (caddr_t)dev, 5*hz);
}
register struct buf *bp;
{
register int teunit = TEUNIT(bp->b_dev);
- register struct device *addr =
- (struct device *)tedinfo[teunit]->ui_addr;
+ register struct tmdevice *addr =
+ (struct tmdevice *)tedinfo[teunit]->ui_addr;
register struct te_softc *sc = &te_softc[teunit];
if (bp == &ctmbuf[TMUNIT(bp->b_dev)]) {
printf("<%d>", (um->um_ubinfo>>28)&0xf);
ubadone(um);
}
- ((struct device *)(um->um_addr))->tmcs = TM_DCLR;
+ ((struct tmdevice *)(um->um_addr))->tmcs = TM_DCLR;
for (teunit = 0; teunit < NTE; teunit++) {
if ((ui = tedinfo[teunit]) == 0 || ui->ui_mi != um ||
ui->ui_alive == 0)
{
register struct uba_device *ui;
register struct uba_regs *up;
- register struct device *addr;
+ register struct tmdevice *addr;
int blk, num;
int start;
up = phys(ui->ui_hd, struct uba_hd *)->uh_physuba;
ubainit(up);
DELAY(1000000);
- addr = (struct device *)ui->ui_physaddr;
+ addr = (struct tmdevice *)ui->ui_physaddr;
tmwait(addr);
addr->tmcs = TM_DCLR | TM_GO;
while (num > 0) {
tmdwrite(dbuf, num, addr, up)
register dbuf, num;
- register struct device *addr;
+ register struct tmdevice *addr;
struct uba_regs *up;
{
register struct pte *io;
}
tmwait(addr)
- register struct device *addr;
+ register struct tmdevice *addr;
{
register s;
}
tmeof(addr)
- struct device *addr;
+ struct tmdevice *addr;
{
tmwait(addr);