aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index d00d807c0f53..dae9d988de10 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -28,7 +28,6 @@
28#include <linux/mutex.h> 28#include <linux/mutex.h>
29#include <linux/leds.h> 29#include <linux/leds.h>
30#include <linux/ide.h> 30#include <linux/ide.h>
31#include <linux/hdreg.h>
32 31
33#include <asm/byteorder.h> 32#include <asm/byteorder.h>
34#include <asm/irq.h> 33#include <asm/irq.h>
@@ -53,15 +52,6 @@ static const u8 ide_rw_cmds[] = {
53 ATA_CMD_WRITE_EXT, 52 ATA_CMD_WRITE_EXT,
54}; 53};
55 54
56static const u8 ide_data_phases[] = {
57 TASKFILE_MULTI_IN,
58 TASKFILE_MULTI_OUT,
59 TASKFILE_IN,
60 TASKFILE_OUT,
61 TASKFILE_IN_DMA,
62 TASKFILE_OUT_DMA,
63};
64
65static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) 55static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma)
66{ 56{
67 u8 index, lba48, write; 57 u8 index, lba48, write;
@@ -69,17 +59,19 @@ static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma)
69 lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; 59 lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0;
70 write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; 60 write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0;
71 61
72 if (dma) 62 if (dma) {
63 cmd->protocol = ATA_PROT_DMA;
73 index = 8; 64 index = 8;
74 else 65 } else {
75 index = drive->mult_count ? 0 : 4; 66 cmd->protocol = ATA_PROT_PIO;
67 if (drive->mult_count) {
68 cmd->tf_flags |= IDE_TFLAG_MULTI_PIO;
69 index = 0;
70 } else
71 index = 4;
72 }
76 73
77 cmd->tf.command = ide_rw_cmds[index + lba48 + write]; 74 cmd->tf.command = ide_rw_cmds[index + lba48 + write];
78
79 if (dma)
80 index = 8; /* fixup index */
81
82 cmd->data_phase = ide_data_phases[index / 2 + write];
83} 75}
84 76
85/* 77/*
@@ -401,9 +393,9 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
401 cmd->tf.command = ATA_CMD_FLUSH_EXT; 393 cmd->tf.command = ATA_CMD_FLUSH_EXT;
402 else 394 else
403 cmd->tf.command = ATA_CMD_FLUSH; 395 cmd->tf.command = ATA_CMD_FLUSH;
404 cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | 396 cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE |
405 IDE_TFLAG_DYN; 397 IDE_TFLAG_DYN;
406 cmd->data_phase = TASKFILE_NO_DATA; 398 cmd->protocol = ATA_PROT_NODATA;
407 399
408 rq->cmd_type = REQ_TYPE_ATA_TASKFILE; 400 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
409 rq->cmd_flags |= REQ_SOFTBARRIER; 401 rq->cmd_flags |= REQ_SOFTBARRIER;