aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index e9d042dba0e0..6adc5b4a4406 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -149,7 +149,10 @@ static void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk,
149 memcpy(rq->cmd, pc->c, 12); 149 memcpy(rq->cmd, pc->c, 12);
150 if (drive->media == ide_tape) 150 if (drive->media == ide_tape)
151 rq->cmd[13] = REQ_IDETAPE_PC1; 151 rq->cmd[13] = REQ_IDETAPE_PC1;
152 ide_do_drive_cmd(drive, rq); 152
153 drive->hwif->rq = NULL;
154
155 elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
153} 156}
154 157
155/* 158/*
@@ -297,6 +300,21 @@ int ide_cd_get_xferlen(struct request *rq)
297} 300}
298EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); 301EXPORT_SYMBOL_GPL(ide_cd_get_xferlen);
299 302
303void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason)
304{
305 ide_task_t task;
306
307 memset(&task, 0, sizeof(task));
308 task.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM |
309 IDE_TFLAG_IN_NSECT;
310
311 drive->hwif->tp_ops->tf_read(drive, &task);
312
313 *bcount = (task.tf.lbah << 8) | task.tf.lbam;
314 *ireason = task.tf.nsect & 3;
315}
316EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason);
317
300/* 318/*
301 * This is the usual interrupt handler which will be called during a packet 319 * This is the usual interrupt handler which will be called during a packet
302 * command. We will transfer some of the data (as requested by the drive) 320 * command. We will transfer some of the data (as requested by the drive)
@@ -456,6 +474,25 @@ next_irq:
456 return ide_started; 474 return ide_started;
457} 475}
458 476
477static void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount)
478{
479 ide_hwif_t *hwif = drive->hwif;
480 ide_task_t task;
481 u8 dma = drive->dma;
482
483 memset(&task, 0, sizeof(task));
484 task.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM |
485 IDE_TFLAG_OUT_FEATURE | tf_flags;
486 task.tf.feature = dma; /* Use PIO/DMA */
487 task.tf.lbam = bcount & 0xff;
488 task.tf.lbah = (bcount >> 8) & 0xff;
489
490 ide_tf_dump(drive->name, &task.tf);
491 hwif->tp_ops->set_irq(hwif, 1);
492 SELECT_MASK(drive, 0);
493 hwif->tp_ops->tf_load(drive, &task);
494}
495
459static u8 ide_read_ireason(ide_drive_t *drive) 496static u8 ide_read_ireason(ide_drive_t *drive)
460{ 497{
461 ide_task_t task; 498 ide_task_t task;
@@ -629,7 +666,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
629 : WAIT_TAPE_CMD; 666 : WAIT_TAPE_CMD;
630 } 667 }
631 668
632 ide_pktcmd_tf_load(drive, tf_flags, bcount, drive->dma); 669 ide_pktcmd_tf_load(drive, tf_flags, bcount);
633 670
634 /* Issue the packet command */ 671 /* Issue the packet command */
635 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { 672 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {