Lines Matching refs:drive
29 void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd)
31 ide_hwif_t *hwif = drive->hwif;
37 tp_ops->tf_read(drive, &cmd->tf, cmd->valid.in.tf);
42 tp_ops->tf_read(drive, &cmd->hob, cmd->valid.in.hob);
59 int taskfile_lib_get_identify(ide_drive_t *drive, u8 *buf)
65 if (drive->media == ide_disk)
73 return ide_raw_taskfile(drive, &cmd, buf, 1);
80 ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
82 ide_hwif_t *hwif = drive->hwif;
91 drive->mult_count == 0) {
92 pr_err("%s: multimode not set!\n", drive->name);
102 ide_tf_dump(drive->name, cmd);
108 tp_ops->output_data(drive, cmd, data, 2);
117 cmd->tf.device |= drive->select;
120 tp_ops->tf_load(drive, &cmd->hob, cmd->valid.out.hob);
121 tp_ops->tf_load(drive, &cmd->tf, cmd->valid.out.tf);
129 return pre_task_out_intr(drive, cmd);
136 ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE);
139 if (ide_dma_prepare(drive, cmd))
142 ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD);
143 dma_ops->dma_start(drive);
151 static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
153 ide_hwif_t *hwif = drive->hwif;
171 drive->mult_req = drive->mult_count = 0;
172 drive->special_flags |= IDE_SFLAG_RECALIBRATE;
173 (void)ide_dump_status(drive, __func__, stat);
177 ide_set_handler(drive, &task_no_data_intr,
182 return ide_error(drive, "task_no_data_intr", stat);
186 drive->mult_count = drive->mult_req;
193 ide_complete_pm_rq(drive, rq);
195 ide_finish_cmd(drive, cmd, stat);
201 static u8 wait_drive_not_busy(ide_drive_t *drive)
203 ide_hwif_t *hwif = drive->hwif;
221 pr_err("%s: drive still BUSY!\n", drive->name);
226 void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
229 ide_hwif_t *hwif = drive->hwif;
263 hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes);
265 hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes);
274 static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
279 u8 saved_io_32bit = drive->io_32bit;
285 drive->io_32bit = 0;
290 nr_bytes = min_t(unsigned, cmd->nleft, drive->mult_count << 9);
294 ide_pio_bytes(drive, cmd, write, nr_bytes);
296 drive->io_32bit = saved_io_32bit;
299 static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
307 nr_bytes -= drive->mult_count << 9;
313 ide_complete_rq(drive, BLK_STS_OK, nr_bytes);
317 void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
319 struct request *rq = drive->hwif->rq;
320 u8 err = ide_read_error(drive), nsect = cmd->tf.nsect;
323 ide_complete_cmd(drive, cmd, stat, err);
327 ide_set_xfer_rate(drive, nsect);
328 ide_driveid_update(drive);
331 ide_complete_rq(drive, err ? BLK_STS_IOERR : BLK_STS_OK, blk_rq_bytes(rq));
337 static ide_startstop_t task_pio_intr(ide_drive_t *drive)
339 ide_hwif_t *hwif = drive->hwif;
340 struct ide_cmd *cmd = &drive->hwif->cmd;
359 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
371 ide_pio_datablock(drive, cmd, write);
375 stat = wait_drive_not_busy(drive);
383 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
387 ide_finish_cmd(drive, cmd, stat);
389 ide_complete_rq(drive, BLK_STS_OK, blk_rq_sectors(cmd->rq) << 9);
392 ide_error_cmd(drive, cmd);
393 return ide_error(drive, __func__, stat);
396 static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
401 if (ide_wait_stat(&startstop, drive, ATA_DRQ,
402 drive->bad_wstat, WAIT_DRQ)) {
403 pr_err("%s: no DRQ after issuing %sWRITE%s\n", drive->name,
405 (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : "");
409 if (!force_irqthreads && (drive->dev_flags & IDE_DFLAG_UNMASK) == 0)
412 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
414 ide_pio_datablock(drive, cmd, 1);
419 int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
425 rq = blk_get_request(drive->queue,
437 error = blk_rq_map_kern(drive->queue, rq, buf,
446 blk_execute_rq(drive->queue, NULL, rq, 0);
454 int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
458 return ide_raw_taskfile(drive, cmd, NULL, 0);
463 int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
524 if (drive->dev_flags & IDE_DFLAG_LBA48) {
574 if (!drive->mult_count) {
577 drive->name, __func__);
593 if (!drive->mult_count) {
596 drive->name, __func__);
625 drive->name);
631 err = ide_raw_taskfile(drive, &cmd, data_buf, nsect);
639 if (drive->dev_flags & IDE_DFLAG_LBA48)