projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new version which doesn't get hung up
[unix-history]
/
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
8724781
..
89a1773
100644
(file)
--- a/
usr/src/sys/vax/uba/tm.c
+++ b/
usr/src/sys/vax/uba/tm.c
@@
-1,9
+1,10
@@
-/* tm.c 4.
14
%G% */
+/* tm.c 4.
21
%G% */
-#include "tm.h"
-#if NTM03 > 0
+#include "te.h"
+#if NTM > 0
+int tmgapsdcnt; /* DEBUG */
/*
/*
- * TM tape driver
+ * TM
11/TE10
tape driver
*
* THIS DRIVER HAS NOT BEEN TESTED WITH MORE THAN ONE TRANSPORT.
*/
*
* THIS DRIVER HAS NOT BEEN TESTED WITH MORE THAN ONE TRANSPORT.
*/
@@
-25,19
+26,19
@@
#include "../h/tmreg.h"
#include "../h/tmreg.h"
-struct buf ctmbuf[NT
M11
];
-struct buf rtmbuf[NT
M11
];
+struct buf ctmbuf[NT
E
];
+struct buf rtmbuf[NT
E
];
int tmprobe(), tmslave(), tmattach(), tmdgo(), tmintr();
int tmprobe(), tmslave(), tmattach(), tmdgo(), tmintr();
-struct uba_minfo *tmminfo[NTM
03
];
-struct uba_dinfo *tmdinfo[NT
M11
];
-struct buf tmutab[NT
M11
];
+struct uba_minfo *tmminfo[NTM];
+struct uba_dinfo *tmdinfo[NT
E
];
+struct buf tmutab[NT
E
];
#ifdef notyet
#ifdef notyet
-struct uba_dinfo *tmip[NTM
03
][4];
+struct uba_dinfo *tmip[NTM][4];
#endif
u_short tmstd[] = { 0772520, 0 };
struct uba_driver tmdriver =
#endif
u_short tmstd[] = { 0772520, 0 };
struct uba_driver tmdriver =
-
{ tmprobe, tmslave, tmattach, tmdgo, tmstd, "mtm", tmdinfo, "tm", tmminfo
};
+
{ tmprobe, tmslave, tmattach, tmdgo, tmstd, "te", tmdinfo, "tm", tmminfo, 0
};
/* bits in minor device */
#define TMUNIT(dev) (minor(dev)&03)
/* bits in minor device */
#define TMUNIT(dev) (minor(dev)&03)
@@
-57,7
+58,8
@@
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 */
u_short sc_erreg; /* copy of last erreg */
u_short sc_dsreg; /* copy of last dsreg */
short sc_resid; /* copy of last bc */
-} tm_softc[NTM03];
+ short sc_lastcmd; /* last command to handle direction changes */
+} tm_softc[NTM];
/*
* States for um->um_tab.b_active, the
/*
* States for um->um_tab.b_active, the
@@
-87,7
+89,7
@@
tmprobe(reg)
#endif
((struct device *)reg)->tmcs = TM_IE;
/*
#endif
((struct device *)reg)->tmcs = TM_IE;
/*
- * If this is a tm
03
, it ought to have interrupted
+ * If this is a tm
11
, it ought to have interrupted
* by now, if it isn't (ie: it is a ts04) then we just
* hope that it didn't interrupt, so autoconf will ignore it.
* Just in case, we will reference one
* by now, if it isn't (ie: it is a ts04) then we just
* hope that it didn't interrupt, so autoconf will ignore it.
* Just in case, we will reference one
@@
-146,7
+148,7
@@
tmopen(dev, flag)
register struct tm_softc *sc;
unit = TMUNIT(dev);
register struct tm_softc *sc;
unit = TMUNIT(dev);
- if (unit>=NT
M11
|| (sc = &tm_softc[unit])->sc_openf ||
+ if (unit>=NT
E
|| (sc = &tm_softc[unit])->sc_openf ||
(ui = tmdinfo[unit]) == 0 || ui->ui_alive == 0) {
u.u_error = ENXIO;
return;
(ui = tmdinfo[unit]) == 0 || ui->ui_alive == 0) {
u.u_error = ENXIO;
return;
@@
-345,13
+347,11
@@
loop:
if (bp == &ctmbuf[unit]) {
if (bp->b_command == TM_SENSE)
goto next;
if (bp == &ctmbuf[unit]) {
if (bp->b_command == TM_SENSE)
goto next;
- cmd |= bp->b_command;
um->um_tab.b_active =
bp->b_command == TM_REW ? SREW : SCOM;
if (bp->b_command == TM_SFORW || bp->b_command == TM_SREV)
addr->tmbc = bp->b_repcnt;
um->um_tab.b_active =
bp->b_command == TM_REW ? SREW : SCOM;
if (bp->b_command == TM_SFORW || bp->b_command == TM_SREV)
addr->tmbc = bp->b_repcnt;
- addr->tmcs = cmd;
- return;
+ goto dobpcmd;
}
/*
* If the data transfer command is in the correct place,
}
/*
* If the data transfer command is in the correct place,
@@
-370,6
+370,12
@@
loop:
cmd |= TM_RCOM;
um->um_tab.b_active = SIO;
um->um_cmd = cmd;
cmd |= TM_RCOM;
um->um_tab.b_active = SIO;
um->um_cmd = cmd;
+/*
+ if (tmreverseop(sc->sc_lastcmd))
+ while (addr->tmer & TM_SDWN)
+ tmgapsdcnt++;
+*/
+ sc->sc_lastcmd = TM_RCOM; /* will serve */
ubago(ui);
return;
}
ubago(ui);
return;
}
@@
-379,13
+385,20
@@
loop:
*/
um->um_tab.b_active = SSEEK;
if (blkno < dbtofsb(bp->b_blkno)) {
*/
um->um_tab.b_active = SSEEK;
if (blkno < dbtofsb(bp->b_blkno)) {
-
cmd |
= TM_SFORW;
+
bp->b_command
= TM_SFORW;
addr->tmbc = blkno - dbtofsb(bp->b_blkno);
} else {
addr->tmbc = blkno - dbtofsb(bp->b_blkno);
} else {
-
cmd |
= TM_SREV;
+
bp->b_command
= TM_SREV;
addr->tmbc = dbtofsb(bp->b_blkno) - blkno;
}
addr->tmbc = dbtofsb(bp->b_blkno) - blkno;
}
- addr->tmcs = cmd;
+dobpcmd:
+/*
+ if (tmreverseop(sc->sc_lastcmd) != tmreverseop(bp->b_command))
+ while (addr->tmer & TM_SDWN)
+ tmgapsdcnt++;
+*/
+ sc->sc_lastcmd = bp->b_command;
+ addr->tmcs = (cmd | bp->b_command);
return;
next:
return;
next:
@@
-396,7
+409,7
@@
next:
* the transfer and continue processing this slave.
*/
if (um->um_ubinfo)
* the transfer and continue processing this slave.
*/
if (um->um_ubinfo)
- uba
relse(um->um_ubanum, &um->um_ubinfo
);
+ uba
done(um
);
um->um_tab.b_errcnt = 0;
dp->b_actf = bp->av_forw;
iodone(bp);
um->um_tab.b_errcnt = 0;
dp->b_actf = bp->av_forw;
iodone(bp);
@@
-420,13
+433,13
@@
tmdgo(um)
* Tm interrupt routine.
*/
/*ARGSUSED*/
* Tm interrupt routine.
*/
/*ARGSUSED*/
-tmintr(tm
03
)
- int tm
03
;
+tmintr(tm
11
)
+ int tm
11
;
{
struct buf *dp;
register struct buf *bp;
{
struct buf *dp;
register struct buf *bp;
- register struct uba_minfo *um = tmminfo[tm
03
];
- register struct device *addr = (struct device *)tmdinfo[tm
03
]->ui_addr;
+ register struct uba_minfo *um = tmminfo[tm
11
];
+ register struct device *addr = (struct device *)tmdinfo[tm
11
]->ui_addr;
register struct tm_softc *sc;
int unit;
register state;
register struct tm_softc *sc;
int unit;
register state;
@@
-492,7
+505,7
@@
tmintr(tm03)
if((addr->tmer&TM_SOFT) == TM_NXM)
printf("TM UBA late error\n");
sc->sc_blkno++;
if((addr->tmer&TM_SOFT) == TM_NXM)
printf("TM UBA late error\n");
sc->sc_blkno++;
- uba
relse(um->um_ubanum, &um->um_ubinfo
);
+ uba
done(um
);
goto opcont;
}
} else
goto opcont;
}
} else
@@
-505,7
+518,9
@@
tmintr(tm03)
/*
* Couldn't recover error
*/
/*
* Couldn't recover error
*/
- deverror(bp, sc->sc_erreg, sc->sc_dsreg);
+ harderr(bp);
+ printf("tm%d er=%b\n", dkunit(bp),
+ sc->sc_erreg, TMEREG_BITS);
bp->b_flags |= B_ERROR;
goto opdone;
}
bp->b_flags |= B_ERROR;
goto opdone;
}
@@
-565,7
+580,7
@@
opdone:
um->um_tab.b_errcnt = 0;
dp->b_actf = bp->av_forw;
bp->b_resid = -addr->tmbc;
um->um_tab.b_errcnt = 0;
dp->b_actf = bp->av_forw;
bp->b_resid = -addr->tmbc;
- uba
relse(um->um_ubanum, &um->um_ubinfo
);
+ uba
done(um
);
iodone(bp);
/*
* Circulate slave to end of controller
iodone(bp);
/*
* Circulate slave to end of controller
@@
-642,12
+657,12
@@
tmreset(uban)
{
int printed = 0;
register struct uba_minfo *um;
{
int printed = 0;
register struct uba_minfo *um;
- register tm
03
, unit;
+ register tm
11
, unit;
register struct uba_dinfo *ui;
register struct buf *dp;
register struct uba_dinfo *ui;
register struct buf *dp;
- for (tm
03 = 0; tm03 < NTM03; tm03
++) {
- if ((um = tmminfo[tm
03
]) == 0 || um->um_alive == 0 ||
+ for (tm
11 = 0; tm11 < NTM; tm11
++) {
+ if ((um = tmminfo[tm
11
]) == 0 || um->um_alive == 0 ||
um->um_ubanum != uban)
continue;
if (printed == 0) {
um->um_ubanum != uban)
continue;
if (printed == 0) {
@@
-659,10
+674,10
@@
tmreset(uban)
um->um_tab.b_actf = um->um_tab.b_actl = 0;
if (um->um_ubinfo) {
printf("<%d>", (um->um_ubinfo>>28)&0xf);
um->um_tab.b_actf = um->um_tab.b_actl = 0;
if (um->um_ubinfo) {
printf("<%d>", (um->um_ubinfo>>28)&0xf);
- uba
relse(um->um_ubanum, &um->um_ubinfo
);
+ uba
done(um
);
}
((struct device *)(um->um_addr))->tmcs = TM_DCLR;
}
((struct device *)(um->um_addr))->tmcs = TM_DCLR;
- for (unit = 0; unit < NT
M11
; unit++) {
+ for (unit = 0; unit < NT
E
; unit++) {
if ((ui = tmdinfo[unit]) == 0)
continue;
if (ui->ui_alive == 0)
if ((ui = tmdinfo[unit]) == 0)
continue;
if (ui->ui_alive == 0)
@@
-765,10
+780,8
@@
tmdump()
start = 0;
num = maxfree;
#define phys(a,b) ((b)((int)(a)&0x7fffffff))
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
ui = phys(tmdinfo[0], struct uba_dinfo *);
up = phys(ui->ui_hd, struct uba_hd *)->uh_physuba;
#if VAX780
@@
-788,6
+801,8
@@
tmdump()
tmeof(addr);
tmeof(addr);
tmwait(addr);
tmeof(addr);
tmeof(addr);
tmwait(addr);
+ if (addr->tmcs&TM_ERR)
+ return (EIO);
addr->tmcs = TM_REW | TM_GO;
tmwait(addr);
return (0);
addr->tmcs = TM_REW | TM_GO;
tmwait(addr);
return (0);