Lines Matching +full:no +full:- +full:bf
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 /*-
46 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
183 wdr->cmd_iohs[wd_status] = wdr->cmd_iohs[wd_command]; in wdc_init_shadow_regs()
184 wdr->cmd_iohs[wd_features] = wdr->cmd_iohs[wd_error]; in wdc_init_shadow_regs()
194 wdc->regs = malloc(wdc->sc_atac.atac_nchannels * in wdc_allocate_regs()
212 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL); in wdc_sataprobe()
219 switch (sata_reset_interface(chp, wdr->sata_iot, wdr->sata_control, in wdc_sataprobe()
220 wdr->sata_status, AT_WAIT)) { in wdc_sataprobe()
224 bus_space_write_1(wdr->cmd_iot, in wdc_sataprobe()
225 wdr->cmd_iohs[wd_sdh], 0, WDSD_IBM); in wdc_sataprobe()
227 st = bus_space_read_1(wdr->cmd_iot, in wdc_sataprobe()
228 wdr->cmd_iohs[wd_status], 0); in wdc_sataprobe()
234 aprint_error_dev(chp->ch_atac->atac_dev, in wdc_sataprobe()
236 sc = bus_space_read_1(wdr->cmd_iot, in wdc_sataprobe()
237 wdr->cmd_iohs[wd_seccnt], 0); in wdc_sataprobe()
238 sn = bus_space_read_1(wdr->cmd_iot, in wdc_sataprobe()
239 wdr->cmd_iohs[wd_sector], 0); in wdc_sataprobe()
240 cl = bus_space_read_1(wdr->cmd_iot, in wdc_sataprobe()
241 wdr->cmd_iohs[wd_cyl_lo], 0); in wdc_sataprobe()
242 ch = bus_space_read_1(wdr->cmd_iot, in wdc_sataprobe()
243 wdr->cmd_iohs[wd_cyl_hi], 0); in wdc_sataprobe()
246 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in wdc_sataprobe()
248 if (atabus_alloc_drives(chp, wdc->wdc_maxdrives) != 0) { in wdc_sataprobe()
257 chp->ch_drive[0].drive_type = ATA_DRIVET_ATAPI; in wdc_sataprobe()
259 chp->ch_drive[0].drive_type = ATA_DRIVET_ATA; in wdc_sataprobe()
266 chp->ch_drive[0].drive_type = ATA_DRIVET_NONE; in wdc_sataprobe()
282 * - If a status register is at 0xff, assume there is no drive here
283 * (ISA has pull-up resistors). Similarly if the status register has
285 * If no drive at all -> return.
286 * - reset the controller, wait for it to complete (may take up to 31s !).
287 * If timeout -> return.
288 * - test ATA/ATAPI signatures. If at last one drive found -> return.
289 * - try an ATA command on the master.
296 struct atac_softc *atac = chp->ch_atac; in wdc_drvprobe()
298 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdc_drvprobe()
303 if (atabus_alloc_drives(chp, wdc->wdc_maxdrives) != 0) { in wdc_drvprobe()
308 /* No drives, abort the attach here. */ in wdc_drvprobe()
320 if (chp->ch_ndrives > 1 && in wdc_drvprobe()
321 chp->ch_drive[1].drive_type == ATA_DRIVET_ATA) { in wdc_drvprobe()
322 if (wdc->select) in wdc_drvprobe()
323 wdc->select(chp,1); in wdc_drvprobe()
324 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdc_drvprobe()
327 st1 = bus_space_read_1(wdr->cmd_iot, in wdc_drvprobe()
328 wdr->cmd_iohs[wd_status], 0); in wdc_drvprobe()
330 if (chp->ch_drive[0].drive_type == ATA_DRIVET_ATA) { in wdc_drvprobe()
331 if (wdc->select) in wdc_drvprobe()
332 wdc->select(chp,0); in wdc_drvprobe()
333 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdc_drvprobe()
336 st0 = bus_space_read_1(wdr->cmd_iot, in wdc_drvprobe()
337 wdr->cmd_iohs[wd_status], 0); in wdc_drvprobe()
341 if ((chp->ch_drive[0].drive_type != ATA_DRIVET_ATA || in wdc_drvprobe()
343 (chp->ch_ndrives < 2 || in wdc_drvprobe()
344 chp->ch_drive[1].drive_type != ATA_DRIVET_ATA || in wdc_drvprobe()
357 chp->ch_drive[0].drive_type != ATA_DRIVET_ATAPI) in wdc_drvprobe()
358 chp->ch_drive[0].drive_type = ATA_DRIVET_NONE; in wdc_drvprobe()
359 if (chp->ch_ndrives > 1 && (st1 & WDCS_DRDY) == 0 && in wdc_drvprobe()
360 chp->ch_drive[1].drive_type != ATA_DRIVET_ATAPI) in wdc_drvprobe()
361 chp->ch_drive[1].drive_type = ATA_DRIVET_NONE; in wdc_drvprobe()
365 device_xname(atac->atac_dev), in wdc_drvprobe()
366 chp->ch_channel, st0, st1), DEBUG_PROBE); in wdc_drvprobe()
371 for (i = 0; i < chp->ch_ndrives; i++) { in wdc_drvprobe()
377 chp->ch_drive[i].n_dmaerrs = NERRS_MAX - 1; in wdc_drvprobe()
381 if ((atac->atac_cap & in wdc_drvprobe()
384 chp->ch_drive[i].drive_flags |= ATA_DRIVE_CAP32; in wdc_drvprobe()
387 if (chp->ch_drive[i].drive_type == ATA_DRIVET_NONE) in wdc_drvprobe()
391 if (chp->ch_flags & ATACH_SHUTDOWN) in wdc_drvprobe()
397 * is no devices, we will get a command aborted without in wdc_drvprobe()
400 error = ata_get_params(&chp->ch_drive[i], in wdc_drvprobe()
408 if (chp->ch_flags & ATACH_SHUTDOWN) in wdc_drvprobe()
411 error = ata_get_params(&chp->ch_drive[i], in wdc_drvprobe()
416 device_xname(atac->atac_dev), in wdc_drvprobe()
417 chp->ch_channel, i, error), DEBUG_PROBE); in wdc_drvprobe()
419 if (chp->ch_drive[i].drive_type != ATA_DRIVET_ATA || in wdc_drvprobe()
420 (wdc->cap & WDC_CAPABILITY_PREATA) == 0) { in wdc_drvprobe()
421 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE; in wdc_drvprobe()
426 * Pre-ATA drive ? in wdc_drvprobe()
430 if (wdc->select) in wdc_drvprobe()
431 wdc->select(chp,i); in wdc_drvprobe()
432 bus_space_write_1(wdr->cmd_iot, in wdc_drvprobe()
433 wdr->cmd_iohs[wd_sdh], 0, WDSD_IBM | (i << 4)); in wdc_drvprobe()
435 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], in wdc_drvprobe()
437 bus_space_write_1(wdr->cmd_iot, in wdc_drvprobe()
438 wdr->cmd_iohs[wd_cyl_lo], 0, 0xa5); in wdc_drvprobe()
439 if (bus_space_read_1(wdr->cmd_iot, in wdc_drvprobe()
440 wdr->cmd_iohs[wd_error], 0) == 0x58 || in wdc_drvprobe()
441 bus_space_read_1(wdr->cmd_iot, in wdc_drvprobe()
442 wdr->cmd_iohs[wd_cyl_lo], 0) != 0xa5) { in wdc_drvprobe()
445 device_xname(atac->atac_dev), in wdc_drvprobe()
446 chp->ch_channel, i), DEBUG_PROBE); in wdc_drvprobe()
447 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE; in wdc_drvprobe()
454 device_xname(atac->atac_dev), in wdc_drvprobe()
455 chp->ch_channel, i), DEBUG_PROBE); in wdc_drvprobe()
456 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE; in wdc_drvprobe()
460 bus_space_write_1(wdr->cmd_iot, in wdc_drvprobe()
461 wdr->cmd_iohs[wd_command], 0, WDCC_RECAL); in wdc_drvprobe()
466 device_xname(atac->atac_dev), in wdc_drvprobe()
467 chp->ch_channel, i), DEBUG_PROBE); in wdc_drvprobe()
468 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE; in wdc_drvprobe()
471 for (j = 0; j < chp->ch_ndrives; j++) { in wdc_drvprobe()
472 if (chp->ch_drive[i].drive_type != in wdc_drvprobe()
474 chp->ch_drive[j].drive_type = in wdc_drvprobe()
503 ch->ch_atac = &wdc->sc_atac; in wdcprobe_with_reset()
504 wdc->regs = wdr; in wdcprobe_with_reset()
507 wdc->reset = (do_reset != NULL) ? do_reset : wdc_do_reset; in wdcprobe_with_reset()
525 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdcprobe1()
538 if ((wdc->cap & WDC_CAPABILITY_NO_EXTRA_RESETS) == 0) { in wdcprobe1()
539 while (wdc_probe_count-- > 0) { in wdcprobe1()
540 if (wdc->select) in wdcprobe1()
541 wdc->select(chp,0); in wdcprobe1()
543 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdcprobe1()
546 st0 = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
547 wdr->cmd_iohs[wd_status], 0); in wdcprobe1()
549 if (wdc->select) in wdcprobe1()
550 wdc->select(chp,1); in wdcprobe1()
552 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdcprobe1()
555 st1 = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
556 wdr->cmd_iohs[wd_status], 0); in wdcprobe1()
562 __func__, chp->ch_channel, st0, st1), DEBUG_PROBE); in wdcprobe1()
570 if (wdc->select) in wdcprobe1()
571 wdc->select(chp,0); in wdcprobe1()
572 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdcprobe1()
574 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
575 wdr->cmd_iohs[wd_cyl_lo], 0, 0x02); in wdcprobe1()
576 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
577 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
581 __func__, chp->ch_channel, cl), in wdcprobe1()
585 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
586 wdr->cmd_iohs[wd_cyl_lo], 0, 0x01); in wdcprobe1()
587 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
588 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
592 __func__, chp->ch_channel, cl), in wdcprobe1()
596 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
597 wdr->cmd_iohs[wd_sector], 0, 0x01); in wdcprobe1()
598 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
599 wdr->cmd_iohs[wd_sector], 0); in wdcprobe1()
603 __func__, chp->ch_channel, cl), in wdcprobe1()
607 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
608 wdr->cmd_iohs[wd_sector], 0, 0x02); in wdcprobe1()
609 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
610 wdr->cmd_iohs[wd_sector], 0); in wdcprobe1()
614 __func__, chp->ch_channel, cl), in wdcprobe1()
618 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
619 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
623 __func__, chp->ch_channel, cl), in wdcprobe1()
630 if (wdc->select) in wdcprobe1()
631 wdc->select(chp,1); in wdcprobe1()
632 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdcprobe1()
634 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
635 wdr->cmd_iohs[wd_cyl_lo], 0, 0x02); in wdcprobe1()
636 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
637 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
641 __func__, chp->ch_channel, cl), in wdcprobe1()
645 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
646 wdr->cmd_iohs[wd_cyl_lo], 0, 0x01); in wdcprobe1()
647 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
648 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
652 __func__, chp->ch_channel, cl), in wdcprobe1()
656 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
657 wdr->cmd_iohs[wd_sector], 0, 0x01); in wdcprobe1()
658 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
659 wdr->cmd_iohs[wd_sector], 0); in wdcprobe1()
663 __func__, chp->ch_channel, cl), in wdcprobe1()
667 bus_space_write_1(wdr->cmd_iot, in wdcprobe1()
668 wdr->cmd_iohs[wd_sector], 0, 0x02); in wdcprobe1()
669 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
670 wdr->cmd_iohs[wd_sector], 0); in wdcprobe1()
674 __func__, chp->ch_channel, cl), in wdcprobe1()
678 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
679 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
683 __func__, chp->ch_channel, cl), in wdcprobe1()
700 if (wdc->select) in wdcprobe1()
701 wdc->select(chp,0); in wdcprobe1()
702 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdcprobe1()
704 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0, in wdcprobe1()
708 if (wdc->select) in wdcprobe1()
709 wdc->select(chp,0); in wdcprobe1()
710 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in wdcprobe1()
712 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0, in wdcprobe1()
719 wdc->reset(chp, RESET_POLL); in wdcprobe1()
721 (void) bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], 0); in wdcprobe1()
723 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) in wdcprobe1()
724 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, in wdcprobe1()
733 __func__, chp->ch_channel, ret_value), DEBUG_PROBE); in wdcprobe1()
746 for (drive = 0; drive < wdc->wdc_maxdrives; drive++) { in wdcprobe1()
749 if (wdc->select) in wdcprobe1()
750 wdc->select(chp,drive); in wdcprobe1()
751 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in wdcprobe1()
755 sc = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
756 wdr->cmd_iohs[wd_seccnt], 0); in wdcprobe1()
757 sn = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
758 wdr->cmd_iohs[wd_sector], 0); in wdcprobe1()
759 cl = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
760 wdr->cmd_iohs[wd_cyl_lo], 0); in wdcprobe1()
761 ch = bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
762 wdr->cmd_iohs[wd_cyl_hi], 0); in wdcprobe1()
765 "cl=0x%x ch=0x%x\n", __func__, chp->ch_channel, drive, sc, in wdcprobe1()
771 if (chp->ch_drive != NULL) { in wdcprobe1()
773 chp->ch_drive[drive].drive_type = ATA_DRIVET_ATAPI; in wdcprobe1()
775 chp->ch_drive[drive].drive_type = ATA_DRIVET_ATA; in wdcprobe1()
784 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in wdcprobe1()
786 (void)bus_space_read_1(wdr->cmd_iot, in wdcprobe1()
787 wdr->cmd_iohs[wd_status], 0); in wdcprobe1()
795 struct atac_softc *atac = chp->ch_atac; in wdcattach()
798 KASSERT(wdc->wdc_maxdrives > 0 && wdc->wdc_maxdrives <= WDC_MAXDRIVES); in wdcattach()
801 if (wdc->datain_pio == NULL) in wdcattach()
802 wdc->datain_pio = wdc_datain_pio; in wdcattach()
803 if (wdc->dataout_pio == NULL) in wdcattach()
804 wdc->dataout_pio = wdc_dataout_pio; in wdcattach()
806 if (wdc->reset == NULL) in wdcattach()
807 wdc->reset = wdc_do_reset; in wdcattach()
810 if (atac->atac_bustype_ata == NULL) in wdcattach()
811 atac->atac_bustype_ata = &wdc_ata_bustype; in wdcattach()
812 if (atac->atac_probe == NULL) in wdcattach()
813 atac->atac_probe = wdc_drvprobe; in wdcattach()
815 if (atac->atac_atapibus_attach == NULL) in wdcattach()
816 atac->atac_atapibus_attach = wdc_atapibus_attach; in wdcattach()
829 for (i = 0; i < atac->atac_nchannels; i++) { in wdc_childdetached()
830 chp = atac->atac_channels[i]; in wdc_childdetached()
831 if (child == chp->atabus) { in wdc_childdetached()
832 chp->atabus = NULL; in wdc_childdetached()
843 struct scsipi_adapter *adapt = &atac->atac_atapi_adapter._generic; in wdcdetach()
846 for (i = 0; i < atac->atac_nchannels; i++) { in wdcdetach()
847 chp = atac->atac_channels[i]; in wdcdetach()
848 if (chp->atabus == NULL) in wdcdetach()
851 device_xname(atac->atac_dev), device_xname(chp->atabus)), in wdcdetach()
853 if ((error = config_detach(chp->atabus, flags)) != 0) in wdcdetach()
857 if (adapt->adapt_refcnt != 0) in wdcdetach()
885 struct atac_softc *atac = chp->ch_atac; in wdcintr()
887 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdcintr()
891 if (!device_is_active(atac->atac_dev)) { in wdcintr()
897 if ((chp->ch_flags & ATACH_IRQ_WAIT) == 0) in wdcintr()
905 (void)bus_space_read_1(wdr->cmd_iot, in wdcintr()
906 wdr->cmd_iohs[wd_status], 0); in wdcintr()
911 * On some controllers (e.g. some PCI-IDE) setting the WDCTL_IDS bit in wdcintr()
912 * actually has no effect, and interrupt is triggered regardless. in wdcintr()
915 if (ISSET(xfer->c_flags, C_POLL)) { in wdcintr()
925 if (chp->ch_flags & ATACH_DMA_WAIT) { in wdcintr()
926 wdc->dma_status = in wdcintr()
927 (*wdc->dma_finish)(wdc->dma_arg, chp->ch_channel, in wdcintr()
928 xfer->c_drive, WDC_DMAEND_END); in wdcintr()
929 if (wdc->dma_status & WDC_DMAST_NOIRQ) { in wdcintr()
933 chp->ch_flags &= ~ATACH_DMA_WAIT; in wdcintr()
936 chp->ch_flags &= ~ATACH_IRQ_WAIT; in wdcintr()
937 KASSERT(xfer->ops != NULL && xfer->ops->c_intr != NULL); in wdcintr()
938 ret = xfer->ops->c_intr(chp, xfer, 1); in wdcintr()
940 chp->ch_flags |= ATACH_IRQ_WAIT; in wdcintr()
948 struct ata_channel *chp = drvp->chnl_softc; in wdc_reset_drive()
955 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in wdc_reset_drive()
956 drvp->drive), DEBUG_FUNCS); in wdc_reset_drive()
972 chp->ch_flags &= ~ATACH_IRQ_WAIT; in wdc_reset_channel()
980 if (xfer && xfer->c_chp == chp && (xfer->c_flags & C_ATAPI)) { in wdc_reset_channel()
981 wdccommandshort(chp, xfer->c_drive, ATAPI_SOFT_RESET); in wdc_reset_channel()
1004 if (xfer->c_chp != chp) { in wdc_reset_channel()
1005 ata_thread_run(xfer->c_chp, flags, ATACH_TH_RESET, in wdc_reset_channel()
1013 if (chp->ch_flags & ATACH_DMA_WAIT) { in wdc_reset_channel()
1014 (*wdc->dma_finish)(wdc->dma_arg, in wdc_reset_channel()
1015 chp->ch_channel, xfer->c_drive, in wdc_reset_channel()
1017 chp->ch_flags &= ~ATACH_DMA_WAIT; in wdc_reset_channel()
1029 struct atac_softc *atac = chp->ch_atac; in wdcreset()
1031 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdcreset()
1039 wdc->reset(chp, poll); in wdcreset()
1041 drv_mask1 = (chp->ch_drive[0].drive_type != ATA_DRIVET_NONE) in wdcreset()
1043 if (chp->ch_ndrives > 1) in wdcreset()
1044 drv_mask1 |= (chp->ch_drive[1].drive_type != ATA_DRIVET_NONE) in wdcreset()
1050 device_xname(atac->atac_dev), chp->ch_channel); in wdcreset()
1057 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) in wdcreset()
1058 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, in wdcreset()
1068 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdc_do_reset()
1073 if (wdc->select) in wdc_do_reset()
1074 wdc->select(chp,0); in wdc_do_reset()
1076 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, WDSD_IBM); in wdc_do_reset()
1079 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) { in wdc_do_reset()
1080 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, in wdc_do_reset()
1084 (void) bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_error], 0); in wdc_do_reset()
1085 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) in wdc_do_reset()
1086 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, in wdc_do_reset()
1091 if (wdc->irqack) in wdc_do_reset()
1092 wdc->irqack(chp); in wdc_do_reset()
1101 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in __wdcwait_reset()
1116 if (wdc->select) in __wdcwait_reset()
1117 wdc->select(chp,0); in __wdcwait_reset()
1118 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in __wdcwait_reset()
1121 st0 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1122 wdr->cmd_iohs[wd_status], 0); in __wdcwait_reset()
1124 sc0 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1125 wdr->cmd_iohs[wd_seccnt], 0); in __wdcwait_reset()
1126 sn0 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1127 wdr->cmd_iohs[wd_sector], 0); in __wdcwait_reset()
1128 cl0 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1129 wdr->cmd_iohs[wd_cyl_lo], 0); in __wdcwait_reset()
1130 ch0 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1131 wdr->cmd_iohs[wd_cyl_hi], 0); in __wdcwait_reset()
1135 if (wdc->select) in __wdcwait_reset()
1136 wdc->select(chp,1); in __wdcwait_reset()
1137 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], in __wdcwait_reset()
1140 st1 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1141 wdr->cmd_iohs[wd_status], 0); in __wdcwait_reset()
1143 sc1 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1144 wdr->cmd_iohs[wd_seccnt], 0); in __wdcwait_reset()
1145 sn1 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1146 wdr->cmd_iohs[wd_sector], 0); in __wdcwait_reset()
1147 cl1 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1148 wdr->cmd_iohs[wd_cyl_lo], 0); in __wdcwait_reset()
1149 ch1 = bus_space_read_1(wdr->cmd_iot, in __wdcwait_reset()
1150 wdr->cmd_iohs[wd_cyl_hi], 0); in __wdcwait_reset()
1155 /* no master */ in __wdcwait_reset()
1157 /* No master, slave is ready, it's done */ in __wdcwait_reset()
1161 /* No master, no slave: it's done */ in __wdcwait_reset()
1165 /* no slave */ in __wdcwait_reset()
1167 /* No slave, master is ready, it's done */ in __wdcwait_reset()
1186 device_xname(chp->ch_atac->atac_dev), in __wdcwait_reset()
1187 chp->ch_channel, sc0, sn0, cl0, ch0), DEBUG_PROBE); in __wdcwait_reset()
1190 device_xname(chp->ch_atac->atac_dev), in __wdcwait_reset()
1191 chp->ch_channel, sc1, sn1, cl1, ch1), DEBUG_PROBE); in __wdcwait_reset()
1194 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in __wdcwait_reset()
1202 * return -1 for a timeout after "timeout" ms.
1208 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in __wdcwait()
1214 device_xname(chp->ch_atac->atac_dev), in __wdcwait()
1215 chp->ch_channel), DEBUG_STATUS); in __wdcwait()
1222 bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_status], 0); in __wdcwait()
1229 bus_space_read_1(wdr->cmd_iot, in __wdcwait()
1230 wdr->cmd_iohs[wd_error], 0), mask, bits), in __wdcwait()
1239 printf("__wdcwait: did busy-wait, time=%d\n", xtime); in __wdcwait()
1242 error = bus_space_read_1(wdr->cmd_iot, in __wdcwait()
1243 wdr->cmd_iohs[wd_error], 0); in __wdcwait()
1245 /* After autoconfig, there should be no long delays. */ in __wdcwait()
1251 printf("%s channel %d: warning: busy-wait took %dus\n", in __wdcwait()
1252 device_xname(chp->ch_atac->atac_dev), in __wdcwait()
1253 chp->ch_channel, WDCDELAY * xtime); in __wdcwait()
1255 printf("%s:%d:%d: warning: busy-wait took %dus\n", in __wdcwait()
1256 device_xname(chp->ch_atac->atac_dev), in __wdcwait()
1257 chp->ch_channel, xfer->c_drive, in __wdcwait()
1298 &chp->ch_lock); in wdcwait()
1315 * Busy-wait for DMA to complete
1324 wdc->dma_status = in wdc_dmawait()
1325 (*wdc->dma_finish)(wdc->dma_arg, in wdc_dmawait()
1326 chp->ch_channel, xfer->c_drive, WDC_DMAEND_END); in wdc_dmawait()
1327 if ((wdc->dma_status & WDC_DMAST_NOIRQ) == 0) in wdc_dmawait()
1332 wdc->dma_status = (*wdc->dma_finish)(wdc->dma_arg, in wdc_dmawait()
1333 chp->ch_channel, xfer->c_drive, WDC_DMAEND_ABRT); in wdc_dmawait()
1352 callout_ack(&chp->c_timo_callout); in wdctimeout()
1354 if ((chp->ch_flags & ATACH_IRQ_WAIT) == 0) { in wdctimeout()
1369 (xfer->c_flags & C_ATAPI) ? "atapi" : "ata", in wdctimeout()
1370 xfer->c_bcount, xfer->c_skip); in wdctimeout()
1372 if (chp->ch_flags & ATACH_DMA_WAIT) { in wdctimeout()
1373 wdc->dma_status = in wdctimeout()
1374 (*wdc->dma_finish)(wdc->dma_arg, chp->ch_channel, in wdctimeout()
1375 xfer->c_drive, WDC_DMAEND_ABRT); in wdctimeout()
1376 chp->ch_flags &= ~ATACH_DMA_WAIT; in wdctimeout()
1384 xfer->c_flags |= C_TIMEOU; in wdctimeout()
1385 chp->ch_flags &= ~ATACH_IRQ_WAIT; in wdctimeout()
1386 KASSERT(xfer->ops != NULL && xfer->ops->c_intr != NULL); in wdctimeout()
1387 xfer->ops->c_intr(chp, xfer, 1); in wdctimeout()
1404 struct ata_channel *chp = drvp->chnl_softc; in wdc_exec_command()
1405 struct ata_command *ata_c = &xfer->c_ata_c; in wdc_exec_command()
1408 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in wdc_exec_command()
1409 drvp->drive), DEBUG_FUNCS); in wdc_exec_command()
1412 if (chp->ch_atac->atac_cap & ATAC_CAP_NOIRQ) in wdc_exec_command()
1413 ata_c->flags |= AT_POLL; in wdc_exec_command()
1414 if (ata_c->flags & AT_POLL) in wdc_exec_command()
1415 xfer->c_flags |= C_POLL; in wdc_exec_command()
1416 if (ata_c->flags & AT_WAIT) in wdc_exec_command()
1417 xfer->c_flags |= C_WAIT; in wdc_exec_command()
1418 xfer->c_drive = drvp->drive; in wdc_exec_command()
1419 xfer->c_databuf = ata_c->data; in wdc_exec_command()
1420 xfer->c_bcount = ata_c->bcount; in wdc_exec_command()
1421 xfer->ops = &wdc_cmd_xfer_ops; in wdc_exec_command()
1430 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in __wdccommand_start()
1431 int drive = xfer->c_drive; in __wdccommand_start()
1432 int wait_flags = (xfer->c_flags & C_POLL) ? AT_POLL : 0; in __wdccommand_start()
1433 struct ata_command *ata_c = &xfer->c_ata_c; in __wdccommand_start()
1437 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in __wdccommand_start()
1438 xfer->c_drive), DEBUG_FUNCS); in __wdccommand_start()
1440 if (wdc->select) in __wdccommand_start()
1441 wdc->select(chp,drive); in __wdccommand_start()
1442 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in __wdccommand_start()
1444 switch(wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, in __wdccommand_start()
1445 ata_c->r_st_bmask, ata_c->timeout, wait_flags, &tfd)) { in __wdccommand_start()
1449 ata_c->flags |= AT_TIMEOU; in __wdccommand_start()
1454 if (ata_c->flags & AT_POLL) { in __wdccommand_start()
1456 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) in __wdccommand_start()
1457 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, in __wdccommand_start()
1460 if ((ata_c->flags & AT_LBA48) != 0) { in __wdccommand_start()
1461 wdccommandext(chp, drive, ata_c->r_command, in __wdccommand_start()
1462 ata_c->r_lba, ata_c->r_count, ata_c->r_features, in __wdccommand_start()
1463 ata_c->r_device & ~0x10); in __wdccommand_start()
1465 wdccommand(chp, drive, ata_c->r_command, in __wdccommand_start()
1466 (ata_c->r_lba >> 8) & 0xffff, in __wdccommand_start()
1468 (((ata_c->flags & AT_LBA) != 0) ? WDSD_LBA : 0) | in __wdccommand_start()
1469 ((ata_c->r_lba >> 24) & 0x0f), in __wdccommand_start()
1470 ata_c->r_lba & 0xff, in __wdccommand_start()
1471 ata_c->r_count & 0xff, in __wdccommand_start()
1472 ata_c->r_features & 0xff); in __wdccommand_start()
1475 if ((ata_c->flags & AT_POLL) == 0) { in __wdccommand_start()
1476 chp->ch_flags |= ATACH_IRQ_WAIT; /* wait for interrupt */ in __wdccommand_start()
1477 callout_reset(&chp->c_timo_callout, ata_c->timeout / 1000 * hz, in __wdccommand_start()
1501 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in __wdccommand_intr()
1502 struct ata_command *ata_c = &xfer->c_ata_c; in __wdccommand_intr()
1503 int bcount = ata_c->bcount; in __wdccommand_intr()
1504 char *data = ata_c->data; in __wdccommand_intr()
1508 if (ata_c->r_command == WDCC_IDENTIFY || in __wdccommand_intr()
1509 ata_c->r_command == ATAPI_IDENTIFY_DEVICE) { in __wdccommand_intr()
1517 chp->ch_drive[xfer->c_drive].drive_flags; in __wdccommand_intr()
1523 drive_flags = chp->ch_drive[xfer->c_drive].drive_flags; in __wdccommand_intr()
1529 if ((ata_c->flags & (AT_WAIT | AT_POLL)) == (AT_WAIT | AT_POLL)) { in __wdccommand_intr()
1541 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, in __wdccommand_intr()
1542 xfer->c_drive), DEBUG_INTR); in __wdccommand_intr()
1549 if ((xfer->c_flags & C_ATAPI) != 0) { in __wdccommand_intr()
1550 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in __wdccommand_intr()
1551 WDSD_IBM | (xfer->c_drive << 4)); in __wdccommand_intr()
1553 if ((ata_c->flags & AT_XFDONE) != 0) { in __wdccommand_intr()
1558 if (wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, in __wdccommand_intr()
1559 ata_c->r_st_bmask, (irq == 0) ? ata_c->timeout : 0, in __wdccommand_intr()
1561 if (irq && (xfer->c_flags & C_TIMEOU) == 0) { in __wdccommand_intr()
1565 ata_c->flags |= AT_TIMEOU; in __wdccommand_intr()
1569 if (wdcwait(chp, ata_c->r_st_pmask, ata_c->r_st_pmask, in __wdccommand_intr()
1570 (irq == 0) ? ata_c->timeout : 0, wflags, &tfd) == WDCWAIT_TOUT) { in __wdccommand_intr()
1571 if (irq && (xfer->c_flags & C_TIMEOU) == 0) { in __wdccommand_intr()
1575 ata_c->flags |= AT_TIMEOU; in __wdccommand_intr()
1578 if (wdc->irqack) in __wdccommand_intr()
1579 wdc->irqack(chp); in __wdccommand_intr()
1580 if (ata_c->flags & AT_READ) { in __wdccommand_intr()
1582 ata_c->flags |= AT_TIMEOU; in __wdccommand_intr()
1585 wdc->datain_pio(chp, drive_flags, data, bcount); in __wdccommand_intr()
1587 ata_c->flags |= AT_XFDONE; in __wdccommand_intr()
1592 } else if (ata_c->flags & AT_WRITE) { in __wdccommand_intr()
1594 ata_c->flags |= AT_TIMEOU; in __wdccommand_intr()
1597 wdc->dataout_pio(chp, drive_flags, data, bcount); in __wdccommand_intr()
1598 ata_c->flags |= AT_XFDONE; in __wdccommand_intr()
1599 if ((ata_c->flags & AT_POLL) == 0) { in __wdccommand_intr()
1600 chp->ch_flags |= ATACH_IRQ_WAIT; /* wait for interrupt */ in __wdccommand_intr()
1601 callout_reset(&chp->c_timo_callout, in __wdccommand_intr()
1602 mstohz(ata_c->timeout), wdctimeout, chp); in __wdccommand_intr()
1611 ata_c->flags |= AT_DF; in __wdccommand_intr()
1613 ata_c->flags |= AT_ERROR; in __wdccommand_intr()
1614 ata_c->r_error = ATACH_ST(tfd); in __wdccommand_intr()
1626 struct atac_softc *atac = chp->ch_atac; in __wdccommand_done()
1628 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in __wdccommand_done()
1629 struct ata_command *ata_c = &xfer->c_ata_c; in __wdccommand_done()
1633 device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, in __wdccommand_done()
1634 ata_c->flags), DEBUG_FUNCS); in __wdccommand_done()
1641 if ((ata_c->flags & AT_READREG) != 0 && in __wdccommand_done()
1642 device_is_active(atac->atac_dev) && in __wdccommand_done()
1643 (ata_c->flags & (AT_ERROR | AT_DF)) == 0) { in __wdccommand_done()
1644 ata_c->r_status = bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1645 wdr->cmd_iohs[wd_status], 0); in __wdccommand_done()
1646 ata_c->r_error = bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1647 wdr->cmd_iohs[wd_error], 0); in __wdccommand_done()
1648 ata_c->r_count = bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1649 wdr->cmd_iohs[wd_seccnt], 0); in __wdccommand_done()
1650 ata_c->r_lba = (uint64_t)bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1651 wdr->cmd_iohs[wd_sector], 0) << 0; in __wdccommand_done()
1652 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1653 wdr->cmd_iohs[wd_cyl_lo], 0) << 8; in __wdccommand_done()
1654 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1655 wdr->cmd_iohs[wd_cyl_hi], 0) << 16; in __wdccommand_done()
1656 ata_c->r_device = bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1657 wdr->cmd_iohs[wd_sdh], 0); in __wdccommand_done()
1659 if ((ata_c->flags & AT_LBA48) != 0) { in __wdccommand_done()
1660 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) { in __wdccommand_done()
1661 if ((ata_c->flags & AT_POLL) != 0) in __wdccommand_done()
1662 bus_space_write_1(wdr->ctl_iot, in __wdccommand_done()
1663 wdr->ctl_ioh, wd_aux_ctlr, in __wdccommand_done()
1666 bus_space_write_1(wdr->ctl_iot, in __wdccommand_done()
1667 wdr->ctl_ioh, wd_aux_ctlr, in __wdccommand_done()
1670 ata_c->r_count |= bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1671 wdr->cmd_iohs[wd_seccnt], 0) << 8; in __wdccommand_done()
1672 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1673 wdr->cmd_iohs[wd_sector], 0) << 24; in __wdccommand_done()
1674 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1675 wdr->cmd_iohs[wd_cyl_lo], 0) << 32; in __wdccommand_done()
1676 ata_c->r_lba |= (uint64_t)bus_space_read_1(wdr->cmd_iot, in __wdccommand_done()
1677 wdr->cmd_iohs[wd_cyl_hi], 0) << 40; in __wdccommand_done()
1678 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) { in __wdccommand_done()
1679 if ((ata_c->flags & AT_POLL) != 0) in __wdccommand_done()
1680 bus_space_write_1(wdr->ctl_iot, in __wdccommand_done()
1681 wdr->ctl_ioh, wd_aux_ctlr, in __wdccommand_done()
1684 bus_space_write_1(wdr->ctl_iot, in __wdccommand_done()
1685 wdr->ctl_ioh, wd_aux_ctlr, in __wdccommand_done()
1689 ata_c->r_lba |= in __wdccommand_done()
1690 (uint64_t)(ata_c->r_device & 0x0f) << 24; in __wdccommand_done()
1692 ata_c->r_device &= 0xf0; in __wdccommand_done()
1700 if (ata_c->flags & AT_POLL) { in __wdccommand_done()
1702 if (! (wdc->cap & WDC_CAPABILITY_NO_AUXCTL)) in __wdccommand_done()
1703 bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, in __wdccommand_done()
1715 struct ata_command *ata_c = &xfer->c_ata_c; in __wdccommand_done_end()
1717 ata_c->flags |= AT_DONE; in __wdccommand_done_end()
1724 struct ata_command *ata_c = &xfer->c_ata_c; in __wdccommand_kill_xfer()
1732 ata_c->flags |= AT_GONE; in __wdccommand_kill_xfer()
1735 ata_c->flags |= AT_RESET; in __wdccommand_kill_xfer()
1759 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdccommand()
1763 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, drive, in wdccommand()
1766 if (wdc->select) in wdccommand()
1767 wdc->select(chp,drive); in wdccommand()
1770 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in wdccommand()
1773 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_features], 0, in wdccommand()
1775 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_seccnt], 0, count); in wdccommand()
1776 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sector], 0, sector); in wdccommand()
1777 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_cyl_lo], 0, cylin); in wdccommand()
1778 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_cyl_hi], in wdccommand()
1782 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0, command); in wdccommand()
1787 * Send a 48-bit addressing command. The drive should be ready.
1795 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdccommandext()
1799 "device=0x%02x\n", device_xname(chp->ch_atac->atac_dev), in wdccommandext()
1800 chp->ch_channel, drive, command, blkno, count, features, device), in wdccommandext()
1803 KASSERT(drive < wdc->wdc_maxdrives); in wdccommandext()
1805 if (wdc->select) in wdccommandext()
1806 wdc->select(chp,drive); in wdccommandext()
1809 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in wdccommandext()
1812 if (wdc->cap & WDC_CAPABILITY_WIDEREGS) { in wdccommandext()
1813 bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_features], in wdccommandext()
1815 bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_seccnt], in wdccommandext()
1817 bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_lo], in wdccommandext()
1819 bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_mi], in wdccommandext()
1821 bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_hi], in wdccommandext()
1825 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_features], in wdccommandext()
1827 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_seccnt], in wdccommandext()
1829 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_lo], in wdccommandext()
1831 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_mi], in wdccommandext()
1833 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_hi], in wdccommandext()
1837 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_features], in wdccommandext()
1839 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_seccnt], in wdccommandext()
1841 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_lo], in wdccommandext()
1843 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_mi], in wdccommandext()
1845 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_lba_hi], in wdccommandext()
1850 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0, command); in wdccommandext()
1862 struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; in wdccommandshort()
1865 device_xname(chp->ch_atac->atac_dev), chp->ch_channel, drive, in wdccommandshort()
1868 if (wdc->select) in wdccommandshort()
1869 wdc->select(chp,drive); in wdccommandshort()
1872 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, in wdccommandshort()
1875 bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_command], 0, command); in wdccommandshort()
1881 struct atac_softc *atac = chp->ch_atac; in __wdcerror()
1885 aprint_error("%s:%d: %s\n", device_xname(atac->atac_dev), in __wdcerror()
1886 chp->ch_channel, msg); in __wdcerror()
1888 aprint_error("%s:%d:%d: %s\n", device_xname(atac->atac_dev), in __wdcerror()
1889 chp->ch_channel, xfer->c_drive, msg); in __wdcerror()
1900 for (; size >= 2; size -= 2) in wdcbit_bucket()
1901 (void)bus_space_read_2(wdr->cmd_iot, wdr->cmd_iohs[wd_data], 0); in wdcbit_bucket()
1903 (void)bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_data], 0); in wdcbit_bucket()
1907 wdc_datain_pio(struct ata_channel *chp, int flags, void *bf, size_t len) in wdc_datain_pio() argument
1912 if ((uintptr_t)bf & 1) in wdc_datain_pio()
1914 if ((flags & ATA_DRIVE_CAP32) && ((uintptr_t)bf & 3)) in wdc_datain_pio()
1920 bus_space_read_multi_4(wdr->data32iot, in wdc_datain_pio()
1921 wdr->data32ioh, 0, bf, len >> 2); in wdc_datain_pio()
1922 bf = (char *)bf + (len & ~3); in wdc_datain_pio()
1926 bus_space_read_multi_2(wdr->cmd_iot, in wdc_datain_pio()
1927 wdr->cmd_iohs[wd_data], 0, bf, len >> 1); in wdc_datain_pio()
1928 bf = (char *)bf + (len & ~1); in wdc_datain_pio()
1933 bus_space_read_multi_stream_4(wdr->data32iot, in wdc_datain_pio()
1934 wdr->data32ioh, 0, bf, len >> 2); in wdc_datain_pio()
1935 bf = (char *)bf + (len & ~3); in wdc_datain_pio()
1939 bus_space_read_multi_stream_2(wdr->cmd_iot, in wdc_datain_pio()
1940 wdr->cmd_iohs[wd_data], 0, bf, len >> 1); in wdc_datain_pio()
1941 bf = (char *)bf + (len & ~1); in wdc_datain_pio()
1946 *((uint8_t *)bf) = bus_space_read_1(wdr->cmd_iot, in wdc_datain_pio()
1947 wdr->cmd_iohs[wd_data], 0); in wdc_datain_pio()
1957 val = bus_space_read_4(wdr->data32iot, in wdc_datain_pio()
1958 wdr->data32ioh, 0); in wdc_datain_pio()
1959 memcpy(bf, &val, 4); in wdc_datain_pio()
1960 bf = (char *)bf + 4; in wdc_datain_pio()
1961 len -= 4; in wdc_datain_pio()
1967 val = bus_space_read_2(wdr->cmd_iot, in wdc_datain_pio()
1968 wdr->cmd_iohs[wd_data], 0); in wdc_datain_pio()
1969 memcpy(bf, &val, 2); in wdc_datain_pio()
1970 bf = (char *)bf + 2; in wdc_datain_pio()
1971 len -= 2; in wdc_datain_pio()
1978 val = bus_space_read_stream_4(wdr->data32iot, in wdc_datain_pio()
1979 wdr->data32ioh, 0); in wdc_datain_pio()
1980 memcpy(bf, &val, 4); in wdc_datain_pio()
1981 bf = (char *)bf + 4; in wdc_datain_pio()
1982 len -= 4; in wdc_datain_pio()
1988 val = bus_space_read_stream_2(wdr->cmd_iot, in wdc_datain_pio()
1989 wdr->cmd_iohs[wd_data], 0); in wdc_datain_pio()
1990 memcpy(bf, &val, 2); in wdc_datain_pio()
1991 bf = (char *)bf + 2; in wdc_datain_pio()
1992 len -= 2; in wdc_datain_pio()
1999 wdc_dataout_pio(struct ata_channel *chp, int flags, void *bf, size_t len) in wdc_dataout_pio() argument
2004 if ((uintptr_t)bf & 1) in wdc_dataout_pio()
2006 if ((flags & ATA_DRIVE_CAP32) && ((uintptr_t)bf & 3)) in wdc_dataout_pio()
2012 bus_space_write_multi_4(wdr->data32iot, in wdc_dataout_pio()
2013 wdr->data32ioh, 0, bf, len >> 2); in wdc_dataout_pio()
2014 bf = (char *)bf + (len & ~3); in wdc_dataout_pio()
2018 bus_space_write_multi_2(wdr->cmd_iot, in wdc_dataout_pio()
2019 wdr->cmd_iohs[wd_data], 0, bf, len >> 1); in wdc_dataout_pio()
2023 bus_space_write_multi_stream_4(wdr->data32iot, in wdc_dataout_pio()
2024 wdr->data32ioh, 0, bf, len >> 2); in wdc_dataout_pio()
2025 bf = (char *)bf + (len & ~3); in wdc_dataout_pio()
2029 bus_space_write_multi_stream_2(wdr->cmd_iot, in wdc_dataout_pio()
2030 wdr->cmd_iohs[wd_data], 0, bf, len >> 1); in wdc_dataout_pio()
2042 memcpy(&val, bf, 4); in wdc_dataout_pio()
2043 bus_space_write_4(wdr->data32iot, in wdc_dataout_pio()
2044 wdr->data32ioh, 0, val); in wdc_dataout_pio()
2045 bf = (char *)bf + 4; in wdc_dataout_pio()
2046 len -= 4; in wdc_dataout_pio()
2052 memcpy(&val, bf, 2); in wdc_dataout_pio()
2053 bus_space_write_2(wdr->cmd_iot, in wdc_dataout_pio()
2054 wdr->cmd_iohs[wd_data], 0, val); in wdc_dataout_pio()
2055 bf = (char *)bf + 2; in wdc_dataout_pio()
2056 len -= 2; in wdc_dataout_pio()
2063 memcpy(&val, bf, 4); in wdc_dataout_pio()
2064 bus_space_write_stream_4(wdr->data32iot, in wdc_dataout_pio()
2065 wdr->data32ioh, 0, val); in wdc_dataout_pio()
2066 bf = (char *)bf + 4; in wdc_dataout_pio()
2067 len -= 4; in wdc_dataout_pio()
2073 memcpy(&val, bf, 2); in wdc_dataout_pio()
2074 bus_space_write_stream_2(wdr->cmd_iot, in wdc_dataout_pio()
2075 wdr->cmd_iohs[wd_data], 0, val); in wdc_dataout_pio()
2076 bf = (char *)bf + 2; in wdc_dataout_pio()
2077 len -= 2; in wdc_dataout_pio()