Lines Matching refs:drive
91 ide_startstop_t ide_dma_intr(ide_drive_t *drive) in ide_dma_intr() argument
93 ide_hwif_t *hwif = drive->hwif; in ide_dma_intr()
97 drive->waiting_for_dma = 0; in ide_dma_intr()
98 dma_stat = hwif->dma_ops->dma_end(drive); in ide_dma_intr()
99 ide_dma_unmap_sg(drive, cmd); in ide_dma_intr()
102 if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { in ide_dma_intr()
105 ide_finish_cmd(drive, cmd, stat); in ide_dma_intr()
107 ide_complete_rq(drive, 0, in ide_dma_intr()
112 drive->name, __func__, dma_stat); in ide_dma_intr()
114 return ide_error(drive, "dma_intr", stat); in ide_dma_intr()
117 int ide_dma_good_drive(ide_drive_t *drive) in ide_dma_good_drive() argument
119 return ide_in_drive_list(drive->id, drive_whitelist); in ide_dma_good_drive()
133 static int ide_dma_map_sg(ide_drive_t *drive, struct ide_cmd *cmd) in ide_dma_map_sg() argument
135 ide_hwif_t *hwif = drive->hwif; in ide_dma_map_sg()
164 void ide_dma_unmap_sg(ide_drive_t *drive, struct ide_cmd *cmd) in ide_dma_unmap_sg() argument
166 ide_hwif_t *hwif = drive->hwif; in ide_dma_unmap_sg()
180 void ide_dma_off_quietly(ide_drive_t *drive) in ide_dma_off_quietly() argument
182 drive->dev_flags &= ~IDE_DFLAG_USING_DMA; in ide_dma_off_quietly()
183 ide_toggle_bounce(drive, 0); in ide_dma_off_quietly()
185 drive->hwif->dma_ops->dma_host_set(drive, 0); in ide_dma_off_quietly()
197 void ide_dma_off(ide_drive_t *drive) in ide_dma_off() argument
199 printk(KERN_INFO "%s: DMA disabled\n", drive->name); in ide_dma_off()
200 ide_dma_off_quietly(drive); in ide_dma_off()
211 void ide_dma_on(ide_drive_t *drive) in ide_dma_on() argument
213 drive->dev_flags |= IDE_DFLAG_USING_DMA; in ide_dma_on()
214 ide_toggle_bounce(drive, 1); in ide_dma_on()
216 drive->hwif->dma_ops->dma_host_set(drive, 1); in ide_dma_on()
219 int __ide_dma_bad_drive(ide_drive_t *drive) in __ide_dma_bad_drive() argument
221 u16 *id = drive->id; in __ide_dma_bad_drive()
226 drive->name, (char *)&id[ATA_ID_PROD]); in __ide_dma_bad_drive()
239 static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) in ide_get_mode_mask() argument
241 u16 *id = drive->id; in ide_get_mode_mask()
242 ide_hwif_t *hwif = drive->hwif; in ide_get_mode_mask()
252 mask &= port_ops->udma_filter(drive); in ide_get_mode_mask()
260 if ((mask & 0x78) && (eighty_ninty_three(drive) == 0)) in ide_get_mode_mask()
275 mask &= port_ops->mdma_filter(drive); in ide_get_mode_mask()
313 u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode) in ide_find_dma_mode() argument
315 ide_hwif_t *hwif = drive->hwif; in ide_find_dma_mode()
320 if (drive->media != ide_disk) { in ide_find_dma_mode()
328 mask = ide_get_mode_mask(drive, xfer_mode_bases[i], req_mode); in ide_find_dma_mode()
340 if (ide_dma_good_drive(drive) && in ide_find_dma_mode()
341 drive->id[ATA_ID_EIDE_DMA_TIME] < 150) in ide_find_dma_mode()
347 printk(KERN_INFO "%s: %s mode selected\n", drive->name, in ide_find_dma_mode()
353 static int ide_tune_dma(ide_drive_t *drive) in ide_tune_dma() argument
355 ide_hwif_t *hwif = drive->hwif; in ide_tune_dma()
358 if (ata_id_has_dma(drive->id) == 0 || in ide_tune_dma()
359 (drive->dev_flags & IDE_DFLAG_NODMA)) in ide_tune_dma()
363 if (__ide_dma_bad_drive(drive)) in ide_tune_dma()
367 return config_drive_for_dma(drive); in ide_tune_dma()
369 speed = ide_max_dma_mode(drive); in ide_tune_dma()
374 if (ide_set_dma_mode(drive, speed)) in ide_tune_dma()
380 static int ide_dma_check(ide_drive_t *drive) in ide_dma_check() argument
382 ide_hwif_t *hwif = drive->hwif; in ide_dma_check()
384 if (ide_tune_dma(drive)) in ide_dma_check()
391 ide_set_max_pio(drive); in ide_dma_check()
396 int ide_set_dma(ide_drive_t *drive) in ide_set_dma() argument
406 ide_dma_off_quietly(drive); in ide_set_dma()
408 rc = ide_dma_check(drive); in ide_set_dma()
412 ide_dma_on(drive); in ide_set_dma()
417 void ide_check_dma_crc(ide_drive_t *drive) in ide_check_dma_crc() argument
421 ide_dma_off_quietly(drive); in ide_check_dma_crc()
422 drive->crc_count = 0; in ide_check_dma_crc()
423 mode = drive->current_speed; in ide_check_dma_crc()
432 ide_set_xfer_rate(drive, mode); in ide_check_dma_crc()
433 if (drive->current_speed >= XFER_SW_DMA_0) in ide_check_dma_crc()
434 ide_dma_on(drive); in ide_check_dma_crc()
437 void ide_dma_lost_irq(ide_drive_t *drive) in ide_dma_lost_irq() argument
439 printk(KERN_ERR "%s: DMA interrupt recovery\n", drive->name); in ide_dma_lost_irq()
448 ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) in ide_dma_timeout_retry() argument
450 ide_hwif_t *hwif = drive->hwif; in ide_dma_timeout_retry()
460 printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); in ide_dma_timeout_retry()
461 drive->waiting_for_dma = 0; in ide_dma_timeout_retry()
462 (void)dma_ops->dma_end(drive); in ide_dma_timeout_retry()
463 ide_dma_unmap_sg(drive, cmd); in ide_dma_timeout_retry()
464 ret = ide_error(drive, "dma timeout error", in ide_dma_timeout_retry()
467 printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); in ide_dma_timeout_retry()
469 dma_ops->dma_clear(drive); in ide_dma_timeout_retry()
470 printk(KERN_ERR "%s: timeout waiting for DMA\n", drive->name); in ide_dma_timeout_retry()
471 if (dma_ops->dma_test_irq(drive) == 0) { in ide_dma_timeout_retry()
472 ide_dump_status(drive, "DMA timeout", in ide_dma_timeout_retry()
474 drive->waiting_for_dma = 0; in ide_dma_timeout_retry()
475 (void)dma_ops->dma_end(drive); in ide_dma_timeout_retry()
476 ide_dma_unmap_sg(drive, cmd); in ide_dma_timeout_retry()
485 drive->dev_flags |= IDE_DFLAG_DMA_PIO_RETRY; in ide_dma_timeout_retry()
486 drive->retry_pio++; in ide_dma_timeout_retry()
487 ide_dma_off_quietly(drive); in ide_dma_timeout_retry()
533 int ide_dma_prepare(ide_drive_t *drive, struct ide_cmd *cmd) in ide_dma_prepare() argument
535 const struct ide_dma_ops *dma_ops = drive->hwif->dma_ops; in ide_dma_prepare()
537 if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || in ide_dma_prepare()
538 (dma_ops->dma_check && dma_ops->dma_check(drive, cmd))) in ide_dma_prepare()
540 ide_map_sg(drive, cmd); in ide_dma_prepare()
541 if (ide_dma_map_sg(drive, cmd) == 0) in ide_dma_prepare()
543 if (dma_ops->dma_setup(drive, cmd)) in ide_dma_prepare()
545 drive->waiting_for_dma = 1; in ide_dma_prepare()
548 ide_dma_unmap_sg(drive, cmd); in ide_dma_prepare()
550 ide_map_sg(drive, cmd); in ide_dma_prepare()