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
remove HPER1_UNS from hard errors until figure out why it happens
[unix-history]
/
usr
/
src
/
sys
/
vax
/
mba
/
mba.c
diff --git
a/usr/src/sys/vax/mba/mba.c
b/usr/src/sys/vax/mba/mba.c
index
a43e033
..
f908daa
100644
(file)
--- a/
usr/src/sys/vax/mba/mba.c
+++ b/
usr/src/sys/vax/mba/mba.c
@@
-1,10
+1,9
@@
-/* mba.c 4.
16 81/03/07
*/
+/* mba.c 4.
20 81/05/09
*/
#include "mba.h"
#if NMBA > 0
/*
#include "mba.h"
#if NMBA > 0
/*
- * Massbus driver; arbitrates massbus using device
- * driver routines. This module provides common functions.
+ * Massbus driver, arbitrates a massbus among attached devices.
*/
#include "../h/param.h"
#include "../h/systm.h"
*/
#include "../h/param.h"
#include "../h/systm.h"
@@
-21,7
+20,7
@@
#include "../h/mtpr.h"
#include "../h/vm.h"
#include "../h/mtpr.h"
#include "../h/vm.h"
-char mb
asr_bits[] = MBA
SR_BITS;
+char mb
sr_bits[] = MB
SR_BITS;
/*
* Start activity on a massbus device.
* We are given the device's mba_device structure and activate
/*
* Start activity on a massbus device.
* We are given the device's mba_device structure and activate
@@
-86,8
+85,10
@@
loop:
* Mark device busy during non-data transfer
* and count this as a ``seek'' on the device.
*/
* Mark device busy during non-data transfer
* and count this as a ``seek'' on the device.
*/
- if (mi->mi_dk >= 0)
+ if (mi->mi_dk >= 0)
{
dk_seek[mi->mi_dk]++;
dk_seek[mi->mi_dk]++;
+ dk_busy |= (1 << mi->mi_dk);
+ }
mi->mi_tab.b_active = 1;
return;
mi->mi_tab.b_active = 1;
return;
@@
-117,6
+118,7
@@
mbstart(mhp)
register struct mba_device *mi;
struct buf *bp;
register struct mba_regs *mbp;
register struct mba_device *mi;
struct buf *bp;
register struct mba_regs *mbp;
+ register int com;
loop:
/*
loop:
/*
@@
-133,7
+135,7
@@
loop:
* If this device isn't present and on-line, then
* we screwed up, and can't really do the operation.
*/
* If this device isn't present and on-line, then
* we screwed up, and can't really do the operation.
*/
- if ((mi->mi_drv->mbd_ds &
(MBD_DPR|MBD_MOL)) != (MBD_DPR|MBD_MOL)
) {
+ if ((mi->mi_drv->mbd_ds &
MBDS_DREADY) != MBDS_DREADY
) {
printf("%s%d: not ready\n", mi->mi_driver->md_dname,
dkunit(bp));
mi->mi_tab.b_actf = bp->av_forw;
printf("%s%d: not ready\n", mi->mi_driver->md_dname,
dkunit(bp));
mi->mi_tab.b_actf = bp->av_forw;
@@
-150,8
+152,12
@@
loop:
* on disks).
*/
mhp->mh_active = 1;
* on disks).
*/
mhp->mh_active = 1;
- if (mi->mi_driver->md_start)
- (*mi->mi_driver->md_start)(mi);
+ if (mi->mi_driver->md_start) {
+ if ((com = (*mi->mi_driver->md_start)(mi)) == 0)
+ com = (bp->b_flags & B_READ) ?
+ MB_RCOM|MB_GO : MB_WCOM|MB_GO;
+ } else
+ com = (bp->b_flags & B_READ) ? MB_RCOM|MB_GO : MB_WCOM|MB_GO;
/*
* Setup the massbus control and map registers and start
/*
* Setup the massbus control and map registers and start
@@
-161,8
+167,7
@@
loop:
mbp->mba_sr = -1; /* conservative */
mbp->mba_var = mbasetup(mi);
mbp->mba_bcr = -bp->b_bcount;
mbp->mba_sr = -1; /* conservative */
mbp->mba_var = mbasetup(mi);
mbp->mba_bcr = -bp->b_bcount;
- mi->mi_drv->mbd_cs1 =
- (bp->b_flags & B_READ) ? MBD_RCOM|MBD_GO : MBD_WCOM|MBD_GO;
+ mi->mi_drv->mbd_cs1 = com;
if (mi->mi_dk >= 0) {
dk_busy |= 1 << mi->mi_dk;
dk_xfer[mi->mi_dk]++;
if (mi->mi_dk >= 0) {
dk_busy |= 1 << mi->mi_dk;
dk_xfer[mi->mi_dk]++;
@@
-192,7
+197,7
@@
mbintr(mbanum)
mbasr = mbp->mba_sr;
mbp->mba_sr = mbasr;
#if VAX750
mbasr = mbp->mba_sr;
mbp->mba_sr = mbasr;
#if VAX750
- if (mbasr&MBS_CBHUNG) {
+ if (mbasr&MBS
R
_CBHUNG) {
printf("mba%d: control bus hung\n", mbanum);
panic("cbhung");
}
printf("mba%d: control bus hung\n", mbanum);
panic("cbhung");
}
@@
-201,13
+206,6
@@
mbintr(mbanum)
as = mbp->mba_drv[0].mbd_as & 0xff;
mbp->mba_drv[0].mbd_as = as;
as = mbp->mba_drv[0].mbd_as & 0xff;
mbp->mba_drv[0].mbd_as = as;
- /*
- * Disable interrupts from the massbus adapter
- * for the duration of the operation of the massbus
- * driver, so that spurious interrupts won't be generated.
- */
- mbp->mba_cr &= ~MBAIE;
-
/*
* If the mba was active, process the data transfer
* complete interrupt; otherwise just process units which
/*
* If the mba was active, process the data transfer
* complete interrupt; otherwise just process units which
@@
-216,14
+214,15
@@
mbintr(mbanum)
if (mhp->mh_active) {
/*
* Clear attention status for drive whose data
if (mhp->mh_active) {
/*
* Clear attention status for drive whose data
- * transfer completed, and give the dtint driver
+ * transfer related operation completed,
+ * and give the dtint driver
* routine a chance to say what is next.
*/
mi = mhp->mh_actf;
as &= ~(1 << mi->mi_drive);
dk_busy &= ~(1 << mi->mi_dk);
bp = mi->mi_tab.b_actf;
* routine a chance to say what is next.
*/
mi = mhp->mh_actf;
as &= ~(1 << mi->mi_drive);
dk_busy &= ~(1 << mi->mi_dk);
bp = mi->mi_tab.b_actf;
- switch((*mi->mi_driver->md_dtint)(mi, mbasr)) {
+ switch
((*mi->mi_driver->md_dtint)(mi, mbasr)) {
case MBD_DONE: /* all done, for better or worse */
/*
case MBD_DONE: /* all done, for better or worse */
/*
@@
-269,47
+268,33
@@
mbintr(mbanum)
continue;
/*
* If driver has a handler for non-data transfer
continue;
/*
* If driver has a handler for non-data transfer
- * interrupts, give it a chance to tell us that
- * the operation needs to be redone
+ * interrupts, give it a chance to tell us what to do.
*/
if (mi->mi_driver->md_ndint) {
mi->mi_tab.b_active = 0;
switch ((*mi->mi_driver->md_ndint)(mi)) {
*/
if (mi->mi_driver->md_ndint) {
mi->mi_tab.b_active = 0;
switch ((*mi->mi_driver->md_ndint)(mi)) {
- case MBN_DONE:
- /*
- * Non-data transfer interrupt
- * completed i/o request's processing.
- */
+ case MBN_DONE: /* operation completed */
mi->mi_tab.b_errcnt = 0;
bp = mi->mi_tab.b_actf;
mi->mi_tab.b_actf = bp->av_forw;
iodone(bp);
mi->mi_tab.b_errcnt = 0;
bp = mi->mi_tab.b_actf;
mi->mi_tab.b_actf = bp->av_forw;
iodone(bp);
- /* fall into
...
*/
- case MBN_RETRY:
+ /* fall into
common code
*/
+ case MBN_RETRY:
/* operation continues */
if (mi->mi_tab.b_actf)
mbustart(mi);
break;
if (mi->mi_tab.b_actf)
mbustart(mi);
break;
-
- case MBN_SKIP:
- /*
- * Ignore (unsolicited interrupt, e.g.)
- */
- break;
-
- case MBN_CONT:
- /*
- * Continue with unit active, e.g.
- * between first and second rewind
- * interrupts.
- */
- mi->mi_tab.b_active = 1;
+ case MBN_SKIP: /* ignore unsol. interrupt */
break;
break;
-
default:
panic("mbintr");
}
} else
default:
panic("mbintr");
}
} else
+ /*
+ * If there is no non-data transfer interrupt
+ * routine, then we should just
+ * restart the unit, leading to a mbstart() soon.
+ */
mbustart(mi);
}
/*
mbustart(mi);
}
/*
@@
-318,7
+303,7
@@
mbintr(mbanum)
*/
if (mhp->mh_actf && !mhp->mh_active)
mbstart(mhp);
*/
if (mhp->mh_actf && !mhp->mh_active)
mbstart(mhp);
- mbp->mba_cr |= MBAIE;
+ /* THHHHATS all folks... */
}
/*
}
/*
@@
-368,11
+353,14
@@
mbasetup(mi)
return (vaddr);
}
return (vaddr);
}
+/*
+ * Init and interrupt enable a massbus adapter.
+ */
mbainit(mp)
struct mba_regs *mp;
{
mbainit(mp)
struct mba_regs *mp;
{
- mp->mba_cr = MB
A
INIT;
- mp->mba_cr = MB
A
IE;
+ mp->mba_cr = MB
CR_
INIT;
+ mp->mba_cr = MB
CR_
IE;
}
#endif
}
#endif