Lines Matching refs:drive

57 int ide_end_rq(ide_drive_t *drive, struct request *rq, int error,  in ide_end_rq()  argument
64 if ((drive->dev_flags & IDE_DFLAG_DMA_PIO_RETRY) && in ide_end_rq()
65 drive->retry_pio <= 3) { in ide_end_rq()
66 drive->dev_flags &= ~IDE_DFLAG_DMA_PIO_RETRY; in ide_end_rq()
67 ide_dma_on(drive); in ide_end_rq()
74 void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) in ide_complete_cmd() argument
76 const struct ide_tp_ops *tp_ops = drive->hwif->tp_ops; in ide_complete_cmd()
87 tp_ops->input_data(drive, cmd, data, 2); in ide_complete_cmd()
93 ide_tf_readback(drive, cmd); in ide_complete_cmd()
99 drive->name); in ide_complete_cmd()
100 ide_tf_dump(drive->name, cmd); in ide_complete_cmd()
102 drive->dev_flags |= IDE_DFLAG_PARKED; in ide_complete_cmd()
115 int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) in ide_complete_rq() argument
117 ide_hwif_t *hwif = drive->hwif; in ide_complete_rq()
128 rc = ide_end_rq(drive, rq, error, nr_bytes); in ide_complete_rq()
136 void ide_kill_rq(ide_drive_t *drive, struct request *rq) in ide_kill_rq() argument
139 u8 media = drive->media; in ide_kill_rq()
141 drive->failed_pc = NULL; in ide_kill_rq()
152 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); in ide_kill_rq()
155 static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) in ide_tf_set_specify_cmd() argument
157 tf->nsect = drive->sect; in ide_tf_set_specify_cmd()
158 tf->lbal = drive->sect; in ide_tf_set_specify_cmd()
159 tf->lbam = drive->cyl; in ide_tf_set_specify_cmd()
160 tf->lbah = drive->cyl >> 8; in ide_tf_set_specify_cmd()
161 tf->device = (drive->head - 1) | drive->select; in ide_tf_set_specify_cmd()
165 static void ide_tf_set_restore_cmd(ide_drive_t *drive, struct ide_taskfile *tf) in ide_tf_set_restore_cmd() argument
167 tf->nsect = drive->sect; in ide_tf_set_restore_cmd()
171 static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf) in ide_tf_set_setmult_cmd() argument
173 tf->nsect = drive->mult_req; in ide_tf_set_setmult_cmd()
185 static ide_startstop_t do_special(ide_drive_t *drive) in do_special() argument
190 printk(KERN_DEBUG "%s: %s: 0x%02x\n", drive->name, __func__, in do_special()
191 drive->special_flags); in do_special()
193 if (drive->media != ide_disk) { in do_special()
194 drive->special_flags = 0; in do_special()
195 drive->mult_req = 0; in do_special()
202 if (drive->special_flags & IDE_SFLAG_SET_GEOMETRY) { in do_special()
203 drive->special_flags &= ~IDE_SFLAG_SET_GEOMETRY; in do_special()
204 ide_tf_set_specify_cmd(drive, &cmd.tf); in do_special()
205 } else if (drive->special_flags & IDE_SFLAG_RECALIBRATE) { in do_special()
206 drive->special_flags &= ~IDE_SFLAG_RECALIBRATE; in do_special()
207 ide_tf_set_restore_cmd(drive, &cmd.tf); in do_special()
208 } else if (drive->special_flags & IDE_SFLAG_SET_MULTMODE) { in do_special()
209 drive->special_flags &= ~IDE_SFLAG_SET_MULTMODE; in do_special()
210 ide_tf_set_setmult_cmd(drive, &cmd.tf); in do_special()
218 do_rw_taskfile(drive, &cmd); in do_special()
223 void ide_map_sg(ide_drive_t *drive, struct ide_cmd *cmd) in ide_map_sg() argument
225 ide_hwif_t *hwif = drive->hwif; in ide_map_sg()
229 cmd->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); in ide_map_sg()
253 static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, in execute_drive_cmd() argument
261 ide_map_sg(drive, cmd); in execute_drive_cmd()
264 return do_rw_taskfile(drive, cmd); in execute_drive_cmd()
272 printk("%s: DRIVE_CMD (null)\n", drive->name); in execute_drive_cmd()
275 ide_complete_rq(drive, 0, blk_rq_bytes(rq)); in execute_drive_cmd()
280 static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq) in ide_special_rq() argument
287 return ide_do_park_unpark(drive, rq); in ide_special_rq()
289 return ide_do_devset(drive, rq); in ide_special_rq()
291 return ide_do_reset(drive); in ide_special_rq()
306 static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) in start_request() argument
314 drive->hwif->name, (unsigned long) rq); in start_request()
318 if (drive->max_failures && (drive->failures > drive->max_failures)) { in start_request()
324 ide_check_pm_state(drive, rq); in start_request()
326 drive->hwif->tp_ops->dev_select(drive); in start_request()
327 if (ide_wait_stat(&startstop, drive, drive->ready_stat, in start_request()
329 printk(KERN_ERR "%s: drive not ready for command\n", drive->name); in start_request()
333 if (drive->special_flags == 0) { in start_request()
340 if (drive->current_speed == 0xff) in start_request()
341 ide_config_drive_speed(drive, drive->desired_speed); in start_request()
344 return execute_drive_cmd(drive, rq); in start_request()
349 drive->name, pm->pm_step); in start_request()
351 startstop = ide_start_power_step(drive, rq); in start_request()
354 ide_complete_pm_rq(drive, rq); in start_request()
365 return ide_special_rq(drive, rq); in start_request()
369 return drv->do_request(drive, rq, blk_rq_pos(rq)); in start_request()
371 return do_special(drive); in start_request()
373 ide_kill_rq(drive, rq); in start_request()
386 void ide_stall_queue (ide_drive_t *drive, unsigned long timeout) in ide_stall_queue() argument
390 drive->sleep = timeout + jiffies; in ide_stall_queue()
391 drive->dev_flags |= IDE_DFLAG_SLEEPING; in ide_stall_queue()
443 void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) in ide_requeue_and_plug() argument
445 struct request_queue *q = drive->queue; in ide_requeue_and_plug()
458 ide_drive_t *drive = q->queuedata; in do_ide_request() local
459 ide_hwif_t *hwif = drive->hwif; in do_ide_request()
481 if (drive->dev_flags & IDE_DFLAG_SLEEPING && in do_ide_request()
482 time_after(drive->sleep, jiffies)) { in do_ide_request()
483 unsigned long left = jiffies - drive->sleep; in do_ide_request()
507 hwif->cur_dev = drive; in do_ide_request()
508 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); in do_ide_request()
517 rq = blk_fetch_request(drive->queue); in do_ide_request()
540 if ((drive->dev_flags & IDE_DFLAG_BLOCKED) && in do_ide_request()
551 startstop = start_request(drive, rq); in do_ide_request()
576 static int drive_is_ready(ide_drive_t *drive) in drive_is_ready() argument
578 ide_hwif_t *hwif = drive->hwif; in drive_is_ready()
581 if (drive->waiting_for_dma) in drive_is_ready()
582 return hwif->dma_ops->dma_test_irq(drive); in drive_is_ready()
616 ide_drive_t *uninitialized_var(drive); in ide_timer_expiry()
638 drive = hwif->cur_dev; in ide_timer_expiry()
641 wait = expiry(drive); in ide_timer_expiry()
664 startstop = handler(drive); in ide_timer_expiry()
665 } else if (drive_is_ready(drive)) { in ide_timer_expiry()
666 if (drive->waiting_for_dma) in ide_timer_expiry()
667 hwif->dma_ops->dma_lost_irq(drive); in ide_timer_expiry()
669 hwif->port_ops->clear_irq(drive); in ide_timer_expiry()
672 drive->name); in ide_timer_expiry()
673 startstop = handler(drive); in ide_timer_expiry()
675 if (drive->waiting_for_dma) in ide_timer_expiry()
676 startstop = ide_dma_timeout_retry(drive, wait); in ide_timer_expiry()
678 startstop = ide_error(drive, "irq timeout", in ide_timer_expiry()
694 ide_requeue_and_plug(drive, rq_in_flight); in ide_timer_expiry()
774 ide_drive_t *uninitialized_var(drive); in ide_intr()
824 drive = hwif->cur_dev; in ide_intr()
826 if (!drive_is_ready(drive)) in ide_intr()
843 hwif->port_ops->clear_irq(drive); in ide_intr()
845 if (drive->dev_flags & IDE_DFLAG_UNMASK) in ide_intr()
849 startstop = handler(drive); in ide_intr()
872 ide_requeue_and_plug(drive, rq_in_flight); in ide_intr()
879 void ide_pad_transfer(ide_drive_t *drive, int write, int len) in ide_pad_transfer() argument
881 ide_hwif_t *hwif = drive->hwif; in ide_pad_transfer()
886 hwif->tp_ops->output_data(drive, NULL, buf, min(4, len)); in ide_pad_transfer()
888 hwif->tp_ops->input_data(drive, NULL, buf, min(4, len)); in ide_pad_transfer()