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