xfer->drive, chp->ch_status);
xfer->drive, chp->ch_status, WDCS_BITS);
wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq){	struct ata_bio *ata_bio = xfer->cmd;	struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];	int drv_err;	WDCDEBUG_PRINT(("wdc_ata_bio_intr %s:%d:%d\n",	    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive),	    DEBUG_INTR | DEBUG_XFERS);	/* Is it not a transfer, but a control operation? */	if (drvp->state < READY) {		printf("%s:%d:%d: bad state %d in wdc_ata_bio_intr\n",		    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,		    drvp->state);		panic("wdc_ata_bio_intr: bad state");	}	/*	 * reset on timeout. This will cause extra resets in the case	 * of occasional lost interrupts	 */	if (xfer->c_flags & C_TIMEOU)		goto timeout;	/* Ack interrupt done by wait_for_unbusy */	if (wait_for_unbusy(chp,	    (irq == 0) ? ATA_DELAY : 0) < 0) {		if (irq)			return 0; /* IRQ was not for us */		printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip%d\n",		    chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,		    xfer->c_bcount, xfer->c_skip);		goto timeout;	}	if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)		chp->wdc->irqack(chp);	drv_err = wdc_ata_err(drvp, ata_bio);	if (xfer->c_flags & C_DMA) {		if (chp->wdc->dma_status != 0) {			if (drv_err != WDC_ATA_ERR) {				ata_bio->error = ERR_DMA;				drv_err = WDC_ATA_ERR;			}		}		if (chp->ch_status & WDCS_DRQ) {			if (drv_err != WDC_ATA_ERR) {				printf("%s:%d:%d: intr with DRQ (st=0x%x)\n",				    chp->wdc->sc_dev.dv_xname, chp->channel,				    xfer->drive, chp->ch_status);				ata_bio->error = TIMEOUT;				drv_err = WDC_ATA_ERR;			}		}		if (drv_err != WDC_ATA_ERR)			goto end;		ata_dmaerr(drvp);	}	/* if we had an error, end */	if (drv_err == WDC_ATA_ERR) {		wdc_ata_bio_done(chp, xfer);		return 1;	}	/* If this was a read and not using DMA, fetch the data. */	if ((ata_bio->flags & ATA_READ) != 0) {		if ((chp->ch_status & WDCS_DRQ) != WDCS_DRQ) {			printf("%s:%d:%d: read intr before drq\n",			    chp->wdc->sc_dev.dv_xname, chp->channel,			    xfer->drive);			ata_bio->error = TIMEOUT;			wdc_ata_bio_done(chp, xfer);			return 1;		}		wdc_input_bytes(drvp, (char *)xfer->databuf + xfer->c_skip,		    ata_bio->nbytes);	}end:	ata_bio->blkno += ata_bio->nblks;	ata_bio->blkdone += ata_bio->nblks;	xfer->c_skip += ata_bio->nbytes;	xfer->c_bcount -= ata_bio->nbytes;	/* See if this transfer is complete. */	if (xfer->c_bcount > 0) {		if ((ata_bio->flags & ATA_POLL) == 0) {			/* Start the next operation */			_wdc_ata_bio_start(chp, xfer);		} else {			/* Let _wdc_ata_bio_start do the loop */			return 1;		}	} else { /* Done with this transfer */		ata_bio->error = NOERROR;		wdc_ata_bio_done(chp, xfer);	}	return 1;timeout:	if (xfer->c_flags & C_DMA)		ata_dmaerr(drvp);	ata_bio->error = TIMEOUT;	wdc_ata_bio_done(chp, xfer);	return 1;}