Lines Matching refs:chp

446 	struct ata_channel *chp = &mvport->port_ata_channel;  in mvsata_nondma_handle()  local
455 xfer = ata_queue_get_active_xfer(chp); in mvsata_nondma_handle()
460 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, in mvsata_nondma_handle()
465 ret = xfer->ops->c_intr(chp, xfer, 1); in mvsata_nondma_handle()
543 struct ata_channel *chp = &mvport->port_ata_channel; in mvsata_error() local
549 ata_channel_lock(chp); in mvsata_error()
550 ata_thread_run(chp, 0, ATACH_TH_RECOVERY, in mvsata_error()
552 ata_channel_unlock(chp); in mvsata_error()
560 mvsata_channel_recover(struct ata_channel *chp, int flags, uint32_t tfd) in mvsata_channel_recover() argument
562 struct mvsata_port * const mvport = (struct mvsata_port *)chp; in mvsata_channel_recover()
565 ata_channel_lock_owned(chp); in mvsata_channel_recover()
567 if (chp->ch_ndrives > PMP_PORT_CTL) { in mvsata_channel_recover()
582 ata_recovery_resume(chp, drive, tfd, AT_POLL); in mvsata_channel_recover()
594 mvsata_probe_drive(struct ata_channel *chp) in mvsata_probe_drive() argument
596 struct mvsata_port * const mvport = (struct mvsata_port *)chp; in mvsata_probe_drive()
599 ata_channel_lock(chp); in mvsata_probe_drive()
601 sstat = sata_reset_interface(chp, mvport->port_iot, in mvsata_probe_drive()
607 sata_interpret_sig(chp, 0, sig); in mvsata_probe_drive()
613 ata_channel_unlock(chp); in mvsata_probe_drive()
620 struct ata_channel *chp = drvp->chnl_softc; in mvsata_reset_drive() local
621 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_reset_drive()
625 ata_channel_lock_owned(chp); in mvsata_reset_drive()
631 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, drvp->drive, in mvsata_reset_drive()
651 mvsata_reset_channel(struct ata_channel *chp, int flags) in mvsata_reset_channel() argument
653 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_reset_channel()
658 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel)); in mvsata_reset_channel()
660 ata_channel_lock_owned(chp); in mvsata_reset_channel()
663 sstat = sata_reset_interface(chp, mvport->port_iot, in mvsata_reset_channel()
680 sata_reset_interface(chp, mvport->port_iot, in mvsata_reset_channel()
685 ata_kill_active(chp, KILL_RESET, flags); in mvsata_reset_channel()
717 struct ata_channel *chp = ata_sc->sc_chan; in mvsata_atapibus_attach() local
718 struct atac_softc *atac = chp->ch_atac; in mvsata_atapibus_attach()
720 struct scsipi_channel *chan = &chp->ch_atapi_channel; in mvsata_atapibus_attach()
737 chan->chan_channel = chp->ch_channel; in mvsata_atapibus_attach()
744 chp->atapibus = config_found(ata_sc->sc_dev, chan, atapiprint, in mvsata_atapibus_attach()
767 struct ata_channel *chp = atac->atac_channels[chan->chan_channel]; in mvsata_atapi_probe_device() local
768 struct ata_drive_datas *drvp = &chp->ch_drive[target]; in mvsata_atapi_probe_device()
781 device_xname(atac->atac_dev), chp->ch_channel, target)); in mvsata_atapi_probe_device()
850 device_xname(atac->atac_dev), chp->ch_channel, target)); in mvsata_atapi_probe_device()
867 struct ata_channel *chp = in mvsata_atapi_kill_pending() local
870 ata_kill_pending(&chp->ch_drive[periph->periph_target]); in mvsata_atapi_kill_pending()
882 mvsata_setup_channel(struct ata_channel *chp) in mvsata_setup_channel() argument
885 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_setup_channel()
895 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel)); in mvsata_setup_channel()
897 for (drive = 0; drive < chp->ch_ndrives; drive++) { in mvsata_setup_channel()
898 drvp = &chp->ch_drive[drive]; in mvsata_setup_channel()
958 "channel %d: can't use EDMA\n", chp->ch_channel); in mvsata_setup_channel()
960 for (drive = 0; drive < chp->ch_ndrives; drive++) { in mvsata_setup_channel()
961 drvp = &chp->ch_drive[drive]; in mvsata_setup_channel()
991 struct ata_channel *chp = drvp->chnl_softc; in mvsata_bio() local
992 struct atac_softc *atac = chp->ch_atac; in mvsata_bio()
997 ", bcount=%ld\n", device_xname(atac->atac_dev), chp->ch_channel, in mvsata_bio()
1011 ata_exec_xfer(chp, xfer); in mvsata_bio()
1015 mvsata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_bio_start() argument
1017 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_bio_start()
1019 struct atac_softc *atac = chp->ch_atac; in mvsata_bio_start()
1020 struct wdc_softc *wdc = CHAN_TO_WDC(chp); in mvsata_bio_start()
1022 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; in mvsata_bio_start()
1029 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive)); in mvsata_bio_start()
1031 ata_channel_lock_owned(chp); in mvsata_bio_start()
1099 chp->ch_channel); in mvsata_bio_start()
1110 chp->ch_flags |= ATACH_DMA_WAIT; in mvsata_bio_start()
1145 KASSERT((chp->ch_flags & ATACH_NCQ) == 0); in mvsata_bio_start()
1164 && !ata_is_thread_run(chp)) in mvsata_bio_start()
1175 switch(wdc_wait_for_ready(chp, ATA_DELAY, wait_flags, &tfd)) { in mvsata_bio_start()
1184 wdccommandext(chp, 0, atacmd_to48(cmd), in mvsata_bio_start()
1187 wdccommand(chp, 0, cmd, cyl, in mvsata_bio_start()
1205 if (wdc_wait_for_drq(chp, ATA_DELAY, AT_POLL, &tfd) != 0) { in mvsata_bio_start()
1209 chp->ch_channel, xfer->c_drive, ATACH_ST(tfd), in mvsata_bio_start()
1217 mvsata_bio_done(chp, xfer); in mvsata_bio_start()
1221 wdc->dataout_pio(chp, drvp->drive_flags, in mvsata_bio_start()
1234 callout_reset(&chp->c_timo_callout, in mvsata_bio_start()
1235 mstohz(ATA_DELAY), wdctimeout, chp); in mvsata_bio_start()
1243 chp->ch_channel, xfer->c_drive, ATACH_ST(tfd), ATACH_ERR(tfd)); in mvsata_bio_start()
1249 mvsata_bio_poll(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_bio_poll() argument
1251 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_bio_poll()
1256 if (chp->ch_flags & ATACH_DMA_WAIT) { in mvsata_bio_poll()
1259 chp->ch_flags &= ~ATACH_DMA_WAIT; in mvsata_bio_poll()
1262 mvsata_bio_intr(chp, xfer, 0); in mvsata_bio_poll()
1268 mvsata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int intr_arg) in mvsata_bio_intr() argument
1270 struct atac_softc *atac = chp->ch_atac; in mvsata_bio_intr()
1271 struct wdc_softc *wdc = CHAN_TO_WDC(chp); in mvsata_bio_intr()
1273 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; in mvsata_bio_intr()
1291 device_xname(atac->atac_dev), chp->ch_channel, __func__, in mvsata_bio_intr()
1297 mvsata_edma_rqq_remove((struct mvsata_port *)chp, xfer); in mvsata_bio_intr()
1300 ata_channel_lock(chp); in mvsata_bio_intr()
1302 chp->ch_flags &= ~(ATACH_DMA_WAIT); in mvsata_bio_intr()
1310 ata_channel_unlock(chp); in mvsata_bio_intr()
1311 mvsata_bio_done(chp, xfer); in mvsata_bio_intr()
1319 chp->ch_channel, xfer->c_drive, drvp->state, __func__); in mvsata_bio_intr()
1325 (wdc_wait_for_unbusy(chp, (irq == 0) ? ATA_DELAY : 0, AT_POLL, &tfd) in mvsata_bio_intr()
1328 ata_channel_unlock(chp); in mvsata_bio_intr()
1333 chp->ch_channel, xfer->c_drive, xfer->c_bcount, in mvsata_bio_intr()
1336 ata_channel_unlock(chp); in mvsata_bio_intr()
1337 mvsata_bio_done(chp, xfer); in mvsata_bio_intr()
1347 ata_channel_unlock(chp); in mvsata_bio_intr()
1354 ata_channel_unlock(chp); in mvsata_bio_intr()
1356 mvsata_bio_done(chp, xfer); in mvsata_bio_intr()
1365 chp->ch_channel, xfer->c_drive); in mvsata_bio_intr()
1367 ata_channel_unlock(chp); in mvsata_bio_intr()
1368 mvsata_bio_done(chp, xfer); in mvsata_bio_intr()
1371 wdc->datain_pio(chp, drvp->drive_flags, in mvsata_bio_intr()
1392 ata_channel_unlock(chp); in mvsata_bio_intr()
1395 ata_channel_unlock(chp); in mvsata_bio_intr()
1396 mvsata_bio_done(chp, xfer); in mvsata_bio_intr()
1402 mvsata_bio_kill_xfer(struct ata_channel *chp, struct ata_xfer *xfer, int reason) in mvsata_bio_kill_xfer() argument
1404 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_bio_kill_xfer()
1405 struct atac_softc *atac = chp->ch_atac; in mvsata_bio_kill_xfer()
1412 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive)); in mvsata_bio_kill_xfer()
1442 ata_deactivate_xfer(chp, xfer); in mvsata_bio_kill_xfer()
1444 (*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer); in mvsata_bio_kill_xfer()
1448 mvsata_bio_done(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_bio_done() argument
1450 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_bio_done()
1457 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, xfer->c_drive, in mvsata_bio_done()
1466 if (ata_waitdrain_xfer_check(chp, xfer)) in mvsata_bio_done()
1473 ata_deactivate_xfer(chp, xfer); in mvsata_bio_done()
1476 (*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer); in mvsata_bio_done()
1478 atastart(chp); in mvsata_bio_done()
1485 struct ata_channel *chp = &mvport->port_ata_channel; in mvsata_bio_ready() local
1486 struct atac_softc *atac = chp->ch_atac; in mvsata_bio_ready()
1487 struct ata_drive_datas *drvp = &chp->ch_drive[drive]; in mvsata_bio_ready()
1493 ata_channel_lock_owned(chp); in mvsata_bio_ready()
1503 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, flags, &tfd)) in mvsata_bio_ready()
1505 wdccommandshort(chp, 0, WDCC_RECAL); in mvsata_bio_ready()
1509 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, flags, &tfd)) in mvsata_bio_ready()
1519 wdccommand(chp, 0, SET_FEATURES, 0, 0, 0, in mvsata_bio_ready()
1522 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, flags, &tfd)) in mvsata_bio_ready()
1527 wdccommand(chp, 0, SET_FEATURES, 0, 0, 0, in mvsata_bio_ready()
1530 wdccommand(chp, 0, SET_FEATURES, 0, 0, 0, in mvsata_bio_ready()
1535 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, flags, &tfd)) in mvsata_bio_ready()
1542 wdccommand(chp, 0, WDCC_IDP, drvp->lp->d_ncylinders, in mvsata_bio_ready()
1547 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, flags, &tfd)) in mvsata_bio_ready()
1554 wdccommand(chp, 0, WDCC_SETMULTI, 0, 0, 0, drvp->multi, 0); in mvsata_bio_ready()
1556 if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, flags, &tfd)) in mvsata_bio_ready()
1571 chp->ch_channel, drive, errstring); in mvsata_bio_ready()
1576 chp->ch_channel, drive, errstring); in mvsata_bio_ready()
1602 struct ata_channel *chp = drvp->chnl_softc; in mvsata_exec_command() local
1609 device_xname(MVSATA_DEV2((struct mvsata_port *)chp)), in mvsata_exec_command()
1610 chp->ch_channel, in mvsata_exec_command()
1623 ata_exec_xfer(chp, xfer); in mvsata_exec_command()
1627 mvsata_wdc_cmd_start(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_wdc_cmd_start() argument
1629 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_wdc_cmd_start()
1637 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, drive)); in mvsata_wdc_cmd_start()
1639 ata_channel_lock_owned(chp); in mvsata_wdc_cmd_start()
1642 KASSERT((chp->ch_flags & ATACH_NCQ) == 0); in mvsata_wdc_cmd_start()
1649 switch(wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, in mvsata_wdc_cmd_start()
1663 wdccommandext(chp, 0, ata_c->r_command, in mvsata_wdc_cmd_start()
1667 wdccommand(chp, 0, ata_c->r_command, in mvsata_wdc_cmd_start()
1677 callout_reset(&chp->c_timo_callout, ata_c->timeout / 1000 * hz, in mvsata_wdc_cmd_start()
1678 wdctimeout, chp); in mvsata_wdc_cmd_start()
1686 mvsata_wdc_cmd_poll(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_wdc_cmd_poll() argument
1693 mvsata_wdc_cmd_intr(chp, xfer, 0); in mvsata_wdc_cmd_poll()
1698 mvsata_wdc_cmd_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) in mvsata_wdc_cmd_intr() argument
1700 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_wdc_cmd_intr()
1701 struct wdc_softc *wdc = CHAN_TO_WDC(chp); in mvsata_wdc_cmd_intr()
1709 ata_channel_lock(chp); in mvsata_wdc_cmd_intr()
1720 chp->ch_drive[xfer->c_drive].drive_flags; in mvsata_wdc_cmd_intr()
1726 drive_flags = chp->ch_drive[xfer->c_drive].drive_flags; in mvsata_wdc_cmd_intr()
1736 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, in mvsata_wdc_cmd_intr()
1753 if (wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, in mvsata_wdc_cmd_intr()
1757 ata_channel_unlock(chp); in mvsata_wdc_cmd_intr()
1764 if (wdcwait(chp, ata_c->r_st_pmask, ata_c->r_st_pmask, in mvsata_wdc_cmd_intr()
1767 ata_channel_unlock(chp); in mvsata_wdc_cmd_intr()
1779 wdc->datain_pio(chp, drive_flags, data, bcount); in mvsata_wdc_cmd_intr()
1791 wdc->dataout_pio(chp, drive_flags, data, bcount); in mvsata_wdc_cmd_intr()
1794 callout_reset(&chp->c_timo_callout, in mvsata_wdc_cmd_intr()
1795 mstohz(ata_c->timeout), wdctimeout, chp); in mvsata_wdc_cmd_intr()
1796 ata_channel_unlock(chp); in mvsata_wdc_cmd_intr()
1808 ata_channel_unlock(chp); in mvsata_wdc_cmd_intr()
1809 mvsata_wdc_cmd_done(chp, xfer); in mvsata_wdc_cmd_intr()
1812 atastart(chp); in mvsata_wdc_cmd_intr()
1818 mvsata_wdc_cmd_kill_xfer(struct ata_channel *chp, struct ata_xfer *xfer, in mvsata_wdc_cmd_kill_xfer() argument
1821 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_wdc_cmd_kill_xfer()
1827 device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, xfer->c_drive)); in mvsata_wdc_cmd_kill_xfer()
1848 mvsata_wdc_cmd_done_end(chp, xfer); in mvsata_wdc_cmd_kill_xfer()
1851 ata_deactivate_xfer(chp, xfer); in mvsata_wdc_cmd_kill_xfer()
1855 mvsata_wdc_cmd_done(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_wdc_cmd_done() argument
1857 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_wdc_cmd_done()
1858 struct atac_softc *atac = chp->ch_atac; in mvsata_wdc_cmd_done()
1863 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, in mvsata_wdc_cmd_done()
1866 if (ata_waitdrain_xfer_check(chp, xfer)) in mvsata_wdc_cmd_done()
1917 mvsata_wdc_cmd_done_end(chp, xfer); in mvsata_wdc_cmd_done()
1919 ata_deactivate_xfer(chp, xfer); in mvsata_wdc_cmd_done()
1923 mvsata_wdc_cmd_done_end(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_wdc_cmd_done_end() argument
1925 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_wdc_cmd_done_end()
1955 struct ata_channel *chp = atac->atac_channels[chan->chan_channel]; in mvsata_atapi_scsipi_request() local
1970 xfer = ata_get_xfer(chp, false); in mvsata_atapi_scsipi_request()
1987 ata_exec_xfer(chp, xfer); in mvsata_atapi_scsipi_request()
2004 mvsata_atapi_start(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_atapi_start() argument
2006 struct mvsata_softc *sc = (struct mvsata_softc *)chp->ch_atac; in mvsata_atapi_start()
2007 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_atapi_start()
2010 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; in mvsata_atapi_start()
2017 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in mvsata_atapi_start()
2020 ata_channel_lock_owned(chp); in mvsata_atapi_start()
2022 KASSERT((chp->ch_flags & ATACH_NCQ) == 0); in mvsata_atapi_start()
2035 && !ata_is_thread_run(chp)) in mvsata_atapi_start()
2052 if (wdc_wait_for_unbusy(chp, ATAPI_DELAY, wait_flags, &tfd)) in mvsata_atapi_start()
2054 wdccommand(chp, 0, SET_FEATURES, 0, 0, 0, in mvsata_atapi_start()
2057 if (wdc_wait_for_unbusy(chp, ATAPI_MODE_DELAY, wait_flags, in mvsata_atapi_start()
2070 chp->ch_channel, xfer->c_drive, in mvsata_atapi_start()
2078 wdccommand(chp, 0, SET_FEATURES, 0, 0, 0, in mvsata_atapi_start()
2082 wdccommand(chp, 0, SET_FEATURES, 0, 0, 0, in mvsata_atapi_start()
2087 if (wdc_wait_for_unbusy(chp, ATAPI_MODE_DELAY, wait_flags, in mvsata_atapi_start()
2103 chp->ch_channel, xfer->c_drive, in mvsata_atapi_start()
2117 if (wdc_wait_for_unbusy(chp, ATAPI_DELAY, wait_flags, &tfd) != 0) { in mvsata_atapi_start()
2126 callout_reset(&chp->c_timo_callout, mstohz(sc_xfer->timeout), in mvsata_atapi_start()
2127 wdctimeout, chp); in mvsata_atapi_start()
2138 wdccommand(chp, 0, ATAPI_PKT_CMD, in mvsata_atapi_start()
2154 chp->ch_channel, xfer->c_drive, errstring); in mvsata_atapi_start()
2163 chp->ch_channel, xfer->c_drive, errstring, ATACH_ERR(tfd)); in mvsata_atapi_start()
2172 mvsata_atapi_poll(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_atapi_poll() argument
2183 mvsata_atapi_intr(chp, xfer, 0); in mvsata_atapi_poll()
2188 if (chp->ch_flags & ATACH_DMA_WAIT) { in mvsata_atapi_poll()
2189 wdc_dmawait(chp, xfer, xfer->c_scsipi->timeout); in mvsata_atapi_poll()
2190 chp->ch_flags &= ~ATACH_DMA_WAIT; in mvsata_atapi_poll()
2196 mvsata_atapi_intr(chp, xfer, 0); in mvsata_atapi_poll()
2203 mvsata_atapi_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) in mvsata_atapi_intr() argument
2205 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_atapi_intr()
2206 struct atac_softc *atac = chp->ch_atac; in mvsata_atapi_intr()
2207 struct wdc_softc *wdc = CHAN_TO_WDC(chp); in mvsata_atapi_intr()
2209 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; in mvsata_atapi_intr()
2214 ata_channel_lock(chp); in mvsata_atapi_intr()
2218 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive)); in mvsata_atapi_intr()
2224 chp->ch_channel, xfer->c_drive, drvp->state); in mvsata_atapi_intr()
2232 ata_channel_unlock(chp); in mvsata_atapi_intr()
2234 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_intr()
2240 if (wdc_wait_for_unbusy(chp, in mvsata_atapi_intr()
2243 ata_channel_unlock(chp); in mvsata_atapi_intr()
2248 chp->ch_channel, xfer->c_bcount, xfer->c_skip); in mvsata_atapi_intr()
2253 ata_channel_unlock(chp); in mvsata_atapi_intr()
2254 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_intr()
2265 ata_channel_unlock(chp); in mvsata_atapi_intr()
2266 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_intr()
2307 wdc->dataout_pio(chp, drvp->drive_flags, cmd, sc_xfer->cmdlen); in mvsata_atapi_intr()
2312 chp->ch_flags |= ATACH_DMA_WAIT; in mvsata_atapi_intr()
2314 ata_channel_unlock(chp); in mvsata_atapi_intr()
2324 chp->ch_channel, xfer->c_drive); in mvsata_atapi_intr()
2329 ata_channel_unlock(chp); in mvsata_atapi_intr()
2330 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_intr()
2337 chp->ch_channel, xfer->c_drive, xfer->c_bcount, in mvsata_atapi_intr()
2342 wdc->dataout_pio(chp, drvp->drive_flags, in mvsata_atapi_intr()
2350 ata_channel_unlock(chp); in mvsata_atapi_intr()
2360 chp->ch_channel, xfer->c_drive); in mvsata_atapi_intr()
2364 ata_channel_unlock(chp); in mvsata_atapi_intr()
2366 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_intr()
2373 chp->ch_channel, xfer->c_drive, xfer->c_bcount, in mvsata_atapi_intr()
2378 wdc->datain_pio(chp, drvp->drive_flags, in mvsata_atapi_intr()
2382 wdcbit_bucket(chp, len - xfer->c_bcount); in mvsata_atapi_intr()
2386 ata_channel_unlock(chp); in mvsata_atapi_intr()
2410 chp->ch_channel, xfer->c_drive, phase); in mvsata_atapi_intr()
2419 ata_channel_unlock(chp); in mvsata_atapi_intr()
2420 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_intr()
2428 ata_channel_unlock(chp); in mvsata_atapi_intr()
2429 mvsata_atapi_done(chp, xfer); in mvsata_atapi_intr()
2434 mvsata_atapi_kill_xfer(struct ata_channel *chp, struct ata_xfer *xfer, in mvsata_atapi_kill_xfer() argument
2437 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_atapi_kill_xfer()
2462 ata_deactivate_xfer(chp, xfer); in mvsata_atapi_kill_xfer()
2464 ata_free_xfer(chp, xfer); in mvsata_atapi_kill_xfer()
2469 mvsata_atapi_reset(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_atapi_reset() argument
2471 struct mvsata_port *mvport = (struct mvsata_port *)chp; in mvsata_atapi_reset()
2472 struct atac_softc *atac = chp->ch_atac; in mvsata_atapi_reset()
2473 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; in mvsata_atapi_reset()
2477 ata_channel_lock(chp); in mvsata_atapi_reset()
2481 wdccommandshort(chp, 0, ATAPI_SOFT_RESET); in mvsata_atapi_reset()
2483 if (wdc_wait_for_unbusy(chp, WDC_RESET_WAIT, AT_POLL, &tfd) != 0) { in mvsata_atapi_reset()
2485 chp->ch_channel, xfer->c_drive); in mvsata_atapi_reset()
2489 ata_channel_unlock(chp); in mvsata_atapi_reset()
2491 mvsata_atapi_done(chp, xfer); in mvsata_atapi_reset()
2498 struct ata_channel *chp = xfer->c_chp; in mvsata_atapi_phase_complete() local
2499 struct atac_softc *atac = chp->ch_atac; in mvsata_atapi_phase_complete()
2500 struct wdc_softc *wdc = CHAN_TO_WDC(chp); in mvsata_atapi_phase_complete()
2502 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; in mvsata_atapi_phase_complete()
2504 ata_channel_lock_owned(chp); in mvsata_atapi_phase_complete()
2510 device_xname(atac->atac_dev), chp->ch_channel, in mvsata_atapi_phase_complete()
2515 if (wdcwait(chp, WDCS_DSC, WDCS_DSC, 10, AT_POLL, &tfd) == in mvsata_atapi_phase_complete()
2522 chp->ch_channel); in mvsata_atapi_phase_complete()
2523 ata_channel_unlock(chp); in mvsata_atapi_phase_complete()
2525 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_phase_complete()
2527 callout_reset(&chp->c_timo_callout, 1, in mvsata_atapi_phase_complete()
2528 mvsata_atapi_polldsc, chp); in mvsata_atapi_phase_complete()
2529 ata_channel_unlock(chp); in mvsata_atapi_phase_complete()
2556 ata_channel_unlock(chp); in mvsata_atapi_phase_complete()
2557 mvsata_atapi_reset(chp, xfer); in mvsata_atapi_phase_complete()
2564 device_xname(atac->atac_dev), chp->ch_channel, in mvsata_atapi_phase_complete()
2572 chp->ch_channel, xfer->c_drive, xfer->c_bcount); in mvsata_atapi_phase_complete()
2579 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, in mvsata_atapi_phase_complete()
2581 ata_channel_unlock(chp); in mvsata_atapi_phase_complete()
2582 mvsata_atapi_done(chp, xfer); in mvsata_atapi_phase_complete()
2586 mvsata_atapi_done(struct ata_channel *chp, struct ata_xfer *xfer) in mvsata_atapi_done() argument
2593 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in mvsata_atapi_done()
2596 if (ata_waitdrain_xfer_check(chp, xfer)) in mvsata_atapi_done()
2600 ata_deactivate_xfer(chp, xfer); in mvsata_atapi_done()
2602 ata_free_xfer(chp, xfer); in mvsata_atapi_done()
2606 device_xname(chp->ch_atac->atac_dev), chp->ch_channel)); in mvsata_atapi_done()
2610 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in mvsata_atapi_done()
2611 chp->ch_flags)); in mvsata_atapi_done()
2613 atastart(chp); in mvsata_atapi_done()
2619 struct ata_channel *chp = arg; in mvsata_atapi_polldsc() local
2620 struct ata_xfer *xfer = ata_queue_get_active_xfer(chp); in mvsata_atapi_polldsc()
2624 ata_channel_lock(chp); in mvsata_atapi_polldsc()
2718 struct ata_channel *chp = &mvport->port_ata_channel; in mvsata_edma_handle() local
2777 uint32_t aslots = ata_queue_active(chp); in mvsata_edma_handle()
2795 xfer = ata_queue_hwslot_to_xfer(chp, quetag); in mvsata_edma_handle()
2812 mvsata_bio_intr(chp, xfer, ATACH_ERR_ST(0, st)); in mvsata_edma_handle()
2862 struct ata_channel *chp = &mvport->port_ata_channel; in mvsata_edma_rqq_remove() local
2876 uint32_t aslots = ata_queue_active(chp); in mvsata_edma_rqq_remove()
2895 rqxfer = ata_queue_hwslot_to_xfer(chp, i); in mvsata_edma_rqq_remove()
2992 struct ata_channel *chp; in mvsata_port_init() local
3042 chp = &mvport->port_ata_channel; in mvsata_port_init()
3043 chp->ch_channel = channel; in mvsata_port_init()
3044 chp->ch_atac = &sc->sc_wdcdev.sc_atac; in mvsata_port_init()
3045 chp->ch_queue = ata_queue_alloc(MVSATA_EDMAQ_LEN); in mvsata_port_init()
3046 sc->sc_ata_channels[channel] = chp; in mvsata_port_init()
3350 struct ata_channel *chp = &mvport->port_ata_channel; in mvsata_softreset() local
3355 ata_channel_lock_owned(chp); in mvsata_softreset()
3374 ata_delay(chp, 10, "atarst", flags); in mvsata_softreset()
3413 struct ata_channel *chp = &mvport->port_ata_channel; in mvsata_edma_disable() local
3417 ata_channel_lock_owned(chp); in mvsata_edma_disable()
3430 ata_delay(chp, hztoms(1), "mvsata_edma2", wflags); in mvsata_edma_disable()