- for (drive = 0; as && drive < 8; drive++)
- if (as & (1 << drive)) {
- as &= ~(1 << drive);
- /*
- * Consistency check the implied attention,
- * to make sure the drive should have interrupted.
- */
- mi = mhp->mh_mbip[drive];
- if (mi == NULL || mi->mi_tab.b_active == 0 &&
- (mi->mi_tab.b_flags&B_BUSY) == 0 ||
- (bp = mi->mi_tab.b_actf) == NULL)
- continue; /* unsolicited */
+ while (drive = ffs(as)) {
+ drive--; /* was 1 origin */
+ as &= ~(1 << drive);
+ mi = mhp->mh_mbip[drive];
+ if (mi == NULL)
+ continue;
+ /*
+ * If driver has a handler for non-data transfer
+ * 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)) {
+
+ 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);
+ /* fall into common code */
+ case MBN_RETRY: /* operation continues */
+ if (mi->mi_tab.b_actf)
+ mbustart(mi);
+ break;
+ case MBN_SKIP: /* ignore unsol. interrupt */
+ break;
+ default:
+ panic("mbintr");
+ }
+ } else