Skip to content

Commit

Permalink
ide: call {in|out}put_data() methods from tf_{read|load}() methods (t…
Browse files Browse the repository at this point in the history
…ake 2)

Handle IDE_FTFLAG_{IN|OUT}_DATA flags in tf_{read|load}() methods by calling
{in|out}put_data() methods to transfer 2 bytes -- this will allow us to move
that handling out of those methods altogether...

Signed-off-by: Sergei Shtylyov <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
  • Loading branch information
Sergei Shtylyov authored and bzolnier committed Mar 31, 2009
1 parent deae17f commit bac08ce
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 48 deletions.
13 changes: 7 additions & 6 deletions drivers/ide/at91_ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
HIHI = 0xFF;

if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
u16 data = (tf->hob_data << 8) | tf->data;
u8 data[2] = { tf->data, tf->hob_data };

at91_ide_output_data(drive, NULL, &data, 2);
at91_ide_output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
Expand Down Expand Up @@ -234,11 +234,12 @@ static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf;

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data;
u8 data[2];

at91_ide_input_data(drive, NULL, &data, 2);
tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
at91_ide_input_data(drive, cmd, data, 2);

tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down
15 changes: 10 additions & 5 deletions drivers/ide/ide-h8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
HIHI = 0xFF;

if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA)
mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr);
if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
u8 data[2] = { tf->data, tf->hob_data };

h8300_output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
outb(tf->hob_feature, io_ports->feature_addr);
Expand Down Expand Up @@ -91,10 +94,12 @@ static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf;

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data = mm_inw(io_ports->data_addr);
u8 data[2];

h8300_input_data(drive, cmd, data, 2);

tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down
18 changes: 6 additions & 12 deletions drivers/ide/ide-io-std.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,9 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
HIHI = 0xFF;

if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
u16 data = (tf->hob_data << 8) | tf->data;
u8 data[2] = { tf->data, tf->hob_data };

if (mmio)
writew(data, (void __iomem *)io_ports->data_addr);
else
outw(data, io_ports->data_addr);
ide_output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
Expand Down Expand Up @@ -145,15 +142,12 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
}

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data;
u8 data[2];

if (mmio)
data = readw((void __iomem *)io_ports->data_addr);
else
data = inw(io_ports->data_addr);
ide_input_data(drive, cmd, data, 2);

tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down
8 changes: 5 additions & 3 deletions drivers/ide/ns87415.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf;

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data = inw(io_ports->data_addr);
u8 data[2];

tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
ide_input_data(drive, cmd, data, 2);

tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down
16 changes: 10 additions & 6 deletions drivers/ide/scc_pata.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,11 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
HIHI = 0xFF;

if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA)
out_be32((void *)io_ports->data_addr,
(tf->hob_data << 8) | tf->data);
if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
u8 data[2] = { tf->data, tf->hob_data };

scc_output_data(drive, NULL, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
Expand Down Expand Up @@ -693,10 +695,12 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf;

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data = (u16)in_be32((void *)io_ports->data_addr);
u8 data[2];

scc_input_data(drive, cmd, data, 2);

tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down
15 changes: 7 additions & 8 deletions drivers/ide/tx4938ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
HIHI = 0xFF;

if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
u16 data = (tf->hob_data << 8) | tf->data;
u8 data[2] = { tf->data, tf->hob_data };

/* no endian swap */
__raw_writew(data, (void __iomem *)io_ports->data_addr);
hwif->tp_ops->output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
Expand Down Expand Up @@ -133,12 +132,12 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf;

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data;
u8 data[2];

/* no endian swap */
data = __raw_readw((void __iomem *)io_ports->data_addr);
tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
hwif->tp_ops->input_data(drive, cmd, data, 2);

tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down
15 changes: 7 additions & 8 deletions drivers/ide/tx4939ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,9 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
HIHI = 0xFF;

if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
u16 data = (tf->hob_data << 8) | tf->data;
u8 data[2] = { tf->data, tf->hob_data };

/* no endian swap */
__raw_writew(data, (void __iomem *)io_ports->data_addr);
hwif->tp_ops->output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
Expand Down Expand Up @@ -500,12 +499,12 @@ static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf;

if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u16 data;
u8 data[2];

/* no endian swap */
data = __raw_readw((void __iomem *)io_ports->data_addr);
tf->data = data & 0xff;
tf->hob_data = (data >> 8) & 0xff;
hwif->tp_ops->input_data(drive, cmd, data, 2);

tf->data = data[0];
tf->hob_data = data[1];
}

/* be sure we're looking at the low order bits */
Expand Down

0 comments on commit bac08ce

Please sign in to comment.