Lines Matching defs:chp
148 struct ata_channel *chp = drvp->chnl_softc;
149 struct atac_softc *atac = chp->ch_atac;
172 ata_exec_xfer(chp, xfer);
176 wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer)
178 struct atac_softc *atac = chp->ch_atac;
179 struct wdc_softc *wdc = CHAN_TO_WDC(chp);
180 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel];
182 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
193 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive,
194 drvp->state, drvp->drive_flags, xfer->c_flags, chp->ch_flags),
197 ata_channel_lock_owned(chp);
207 if ((xfer->c_flags & C_POLL) == 0 && !ata_is_thread_run(chp))
218 wdc->select(chp, xfer->c_drive);
223 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags,
226 wdccommandshort(chp, xfer->c_drive, WDCC_RECAL);
230 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags,
241 wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0,
244 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags,
252 wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0,
257 wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0,
263 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags,
272 wdccommand(chp, xfer->c_drive, WDCC_IDP,
278 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags,
286 wdccommand(chp, xfer->c_drive, WDCC_SETMULTI, 0, 0, 0,
289 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags,
305 return _wdc_ata_bio_start(chp, xfer);
308 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive,
314 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive,
334 _wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer)
336 struct atac_softc *atac = chp->ch_atac;
337 struct wdc_softc *wdc = CHAN_TO_WDC(chp);
338 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel];
340 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
350 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive),
427 chp->ch_channel, xfer->c_drive,
447 wdc->select(chp, xfer->c_drive);
450 switch(wdc_wait_for_ready(chp, ATA_DELAY, wait_flags,
460 if ((chp->ch_flags & ATACH_DMA_BEFORE_CMD) != 0)
462 chp->ch_channel, xfer->c_drive);
470 wdccommandext(chp, xfer->c_drive, cmd,
473 wdccommand(chp, xfer->c_drive, cmd, cyl,
477 if ((chp->ch_flags & ATACH_DMA_BEFORE_CMD) == 0)
479 chp->ch_channel, xfer->c_drive);
480 chp->ch_flags |= ATACH_DMA_WAIT;
494 chp->ch_channel, xfer->c_drive,
528 wdc->select(chp, xfer->c_drive);
531 switch(wdc_wait_for_ready(chp, ATA_DELAY, wait_flags, &tfd)) {
540 wdccommandext(chp, xfer->c_drive, atacmd_to48(cmd),
543 wdccommand(chp, xfer->c_drive, cmd, cyl,
562 if (wdc_wait_for_drq(chp, ATA_DELAY, AT_POLL, &tfd) != 0) {
565 device_xname(atac->atac_dev), chp->ch_channel,
579 chp->ch_channel, xfer->c_drive,
581 chp->ch_flags |= ATACH_DMA_WAIT;
585 wdc->dataout_pio(chp, drvp->drive_flags,
595 callout_reset(&chp->c_timo_callout,
596 ATA_DELAY / 1000 * hz, wdctimeout, chp);
597 chp->ch_flags |= ATACH_IRQ_WAIT;
605 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive,
613 wdc_ata_bio_poll(struct ata_channel *chp, struct ata_xfer *xfer)
618 if (chp->ch_flags & ATACH_DMA_WAIT) {
619 wdc_dmawait(chp, xfer, ATA_DELAY);
620 chp->ch_flags &= ~ATACH_DMA_WAIT;
623 wdc_ata_bio_intr(chp, xfer, 0);
628 wdc_ata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq)
630 struct atac_softc *atac = chp->ch_atac;
631 struct wdc_softc *wdc = CHAN_TO_WDC(chp);
633 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
637 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive),
640 ata_channel_lock(chp);
645 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive,
661 if ((xfer->c_flags & C_PIOBM) && (chp->ch_flags & ATACH_PIOBM_WAIT)) {
662 chp->ch_flags &= ~ATACH_PIOBM_WAIT;
668 if (wdc_wait_for_unbusy(chp,
671 ata_channel_unlock(chp);
675 device_xname(atac->atac_dev), chp->ch_channel,
681 wdc->irqack(chp);
695 if (wdcwait(chp, WDCS_DRDY | WDCS_DRQ, WDCS_DRDY,
700 chp->ch_channel, xfer->c_drive,
716 chp->ch_channel,
740 device_xname(atac->atac_dev), chp->ch_channel,
749 chp->ch_channel, xfer->c_drive,
752 chp->ch_flags |= ATACH_DMA_WAIT | ATACH_PIOBM_WAIT;
753 ata_channel_unlock(chp);
757 wdc->datain_pio(chp, drvp->drive_flags,
773 KASSERT((chp->ch_flags & ATACH_IRQ_WAIT) == 0);
774 callout_stop(&chp->c_timo_callout);
782 ata_channel_unlock(chp);
788 err: ata_channel_unlock(chp);
789 wdc_ata_bio_done(chp, xfer);
794 wdc_ata_bio_kill_xfer(struct ata_channel *chp, struct ata_xfer *xfer,
820 ata_deactivate_xfer(chp, xfer);
823 (*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer);
827 wdc_ata_bio_done(struct ata_channel *chp, struct ata_xfer *xfer)
833 device_xname(chp->ch_atac->atac_dev), chp->ch_channel,
837 if (ata_waitdrain_xfer_check(chp, xfer))
844 ata_deactivate_xfer(chp, xfer);
848 (*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer);
850 chp->ch_flags), DEBUG_XFERS);
851 atastart(chp);
885 struct ata_channel *chp = drvp->chnl_softc;
887 return (ata_addref(chp));
893 struct ata_channel *chp = drvp->chnl_softc;
895 ata_delref(chp);