u_long  dp;
xdc_cmd(xdcsc, cmd, subfn, unit, block, scnt, dptr, fullmode)	struct xdc_softc *xdcsc;	int     cmd, subfn, unit, block, scnt;	char   *dptr;	int     fullmode;{	int     rqno, submode = XD_STATE(fullmode), retry;	u_long  dp;	struct xd_iorq *iorq;	struct xd_iopb *iopb;	/* get iorq/iopb */	switch (submode) {	case XD_SUB_POLL:		while (xdcsc->nfree == 0) {			if (xdc_piodriver(xdcsc, 0, 1) != XD_ERR_AOK)				return (XD_ERR_FAIL);		}		break;	case XD_SUB_WAIT:		retry = 1;		while (retry) {			while (xdcsc->nfree == 0) {			    if (tsleep(&xdcsc->nfree, PRIBIO, "xdnfree", 0))				return (XD_ERR_FAIL);			}			while (xdcsc->ndone > XDC_SUBWAITLIM) {			    if (tsleep(&xdcsc->ndone, PRIBIO, "xdsubwait", 0))				return (XD_ERR_FAIL);			}			if (xdcsc->nfree)				retry = 0;	/* got it */		}		break;	default:		return (XD_ERR_FAIL);	/* illegal */	}	if (xdcsc->nfree == 0)		panic("xdcmd nfree");	rqno = XDC_RQALLOC(xdcsc);	iorq = &xdcsc->reqs[rqno];	iopb = iorq->iopb;	/* init iorq/iopb */	xdc_rqinit(iorq, xdcsc,	    (unit == XDC_NOUNIT) ? NULL : xdcsc->sc_drives[unit],	    fullmode, block, scnt, dptr, NULL);	/* load IOPB from iorq */	xdc_rqtopb(iorq, iopb, cmd, subfn);	/* submit it for processing */	xdc_submit_iorq(xdcsc, rqno, fullmode);	/* error code will be in iorq */	return (rqno);}