xyc->xyc_csr |= XYC_IPND;
xyc->xyc_csr = XYC_IPND;
xyc_remove_iorq(xycsc)	struct xyc_softc *xycsc;{	int     errno, rq, comm, errs;	struct xyc *xyc = xycsc->xyc;	u_long  addr;	struct xy_iopb *iopb;	struct xy_iorq *iorq;	struct buf *bp;	if (xyc->xyc_csr & XYC_DERR) {		/*		 * DOUBLE ERROR: should never happen under normal use. This		 * error is so bad, you can't even tell which IOPB is bad, so		 * we dump them all.		 */		errno = XY_ERR_DERR;		printf("%s: DOUBLE ERROR!\n", xycsc->sc_dev.dv_xname);		if (xyc_reset(xycsc, 0, XY_RSET_ALL, errno, 0) != XY_ERR_AOK) {			printf("%s: soft reset failed!\n",				xycsc->sc_dev.dv_xname);			panic("xyc_remove_iorq: controller DEAD");		}		return (XY_ERR_AOK);	}	/*	 * get iopb that is done, loop down the chain	 */	if (xyc->xyc_csr & XYC_ERR) {		xyc->xyc_csr |= XYC_ERR; /* clear error condition */	}	if (xyc->xyc_csr & XYC_IPND) {		xyc->xyc_csr |= XYC_IPND; /* clear interrupt */	}	for (rq = 0; rq < XYC_MAXIOPB; rq++) {		iorq = xycsc->xy_chain[rq];		if (iorq == NULL) break; /* done ! */		if (iorq->mode == 0 || XY_STATE(iorq->mode) == XY_SUB_DONE)			continue;	/* free, or done */		iopb = iorq->iopb;		if (iopb->done == 0)			continue;	/* not done yet */		comm = iopb->com;		errs = iopb->errs;		if (errs)			iorq->errno = iopb->errno;		else			iorq->errno = 0;		/* handle non-fatal errors */		if (errs &&		    xyc_error(xycsc, iorq, iopb, comm) == XY_ERR_AOK)			continue;	/* AOK: we resubmitted it */		/* this iorq is now done (hasn't been restarted or anything) */		if ((iorq->mode & XY_MODE_VERBO) && iorq->lasterror)			xyc_perror(iorq, iopb, 0);		/* now, if read/write check to make sure we got all the data		 * we needed. (this may not be the case if we got an error in		 * the middle of a multisector request).   */		if ((iorq->mode & XY_MODE_B144) != 0 && errs == 0 &&		    (comm == XYCMD_RD || comm == XYCMD_WR)) {			/* we just successfully processed a bad144 sector			 * note: if we are in bad 144 mode, the pointers have			 * been advanced already (see above) and are pointing			 * at the bad144 sector.   to exit bad144 mode, we			 * must advance the pointers 1 sector and issue a new			 * request if there are still sectors left to process			 * 			 */			XYC_ADVANCE(iorq, 1);	/* advance 1 sector */			/* exit b144 mode */			iorq->mode = iorq->mode & (~XY_MODE_B144);			if (iorq->sectcnt) {	/* more to go! */				iorq->lasterror = iorq->errno = iopb->errno = 0;				iopb->errs = iopb->done = 0;				iorq->tries = 0;				iopb->scnt = iorq->sectcnt;				iopb->cyl = iorq->blockno /						iorq->xy->sectpercyl;				iopb->head =					(iorq->blockno / iorq->xy->nhead) %						iorq->xy->nhead;				iopb->sect = iorq->blockno % XYFM_BPS;				addr = dvma_kvtopa((long) iorq->dbuf, BUS_VME16);				iopb->dataa = (addr & 0xffff);				iopb->datar = ((addr & 0xff0000) >> 16);				/* will resubit at end */				continue;			}		}		/* final cleanup, totally done with this request */		switch (XY_STATE(iorq->mode)) {		case XY_SUB_NORM:			bp = iorq->buf;			if (errs) {				bp->b_error = EIO;				bp->b_flags |= B_ERROR;				bp->b_resid = iorq->sectcnt * XYFM_BPS;			} else {				bp->b_resid = 0;	/* done */			}			/* Sun3: map/unmap regardless of B_PHYS */			dvma_mapout(iorq->dbufbase,					    iorq->buf->b_bcount);			iorq->xy->xyq.b_actf = bp->b_actf;			disk_unbusy(&iorq->xy->sc_dk,			    (bp->b_bcount - bp->b_resid));			biodone(bp);			iorq->mode = XY_SUB_FREE;			break;		case XY_SUB_WAIT:			iorq->mode = XY_NEWSTATE(iorq->mode, XY_SUB_DONE);			wakeup(iorq);			break;		case XY_SUB_POLL:			iorq->mode = XY_NEWSTATE(iorq->mode, XY_SUB_DONE);			break;		}	}	return (XY_ERR_AOK);}