Skip to content

Commit

Permalink
ide: move data register access out of tf_{read|load}() methods (take 2)
Browse files Browse the repository at this point in the history
Move IDE_FTFLAG_{IN|OUT}_DATA flag handling out of tf_{read|load}() methods
into the only two functions where these flags actually need to be handled:
do_rw_taskfile() and ide_complete_cmd()...

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 bac08ce commit 35218d1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 100 deletions.
15 changes: 0 additions & 15 deletions drivers/ide/at91_ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,6 @@ static void at91_ide_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) {
u8 data[2] = { tf->data, tf->hob_data };

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

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
ide_mm_outb(tf->hob_feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
Expand Down Expand Up @@ -233,15 +227,6 @@ static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;

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

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 */
ide_mm_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down
15 changes: 0 additions & 15 deletions drivers/ide/ide-h8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ 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) {
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);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
Expand Down Expand Up @@ -93,15 +87,6 @@ static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;

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

h8300_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 */
outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down
15 changes: 0 additions & 15 deletions drivers/ide/ide-io-std.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ void ide_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) {
u8 data[2] = { tf->data, tf->hob_data };

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

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
tf_outb(tf->hob_feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
Expand Down Expand Up @@ -141,15 +135,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
tf_inb = ide_inb;
}

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

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 */
tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down
12 changes: 11 additions & 1 deletion drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,24 @@ EXPORT_SYMBOL_GPL(ide_end_rq);

void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
{
const struct ide_tp_ops *tp_ops = drive->hwif->tp_ops;
struct ide_taskfile *tf = &cmd->tf;
struct request *rq = cmd->rq;
u8 tf_cmd = tf->command;

tf->error = err;
tf->status = stat;

drive->hwif->tp_ops->tf_read(drive, cmd);
if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
u8 data[2];

tp_ops->input_data(drive, cmd, data, 2);

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

tp_ops->tf_read(drive, cmd);

if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) &&
tf_cmd == ATA_CMD_IDLEIMMEDIATE) {
Expand Down
6 changes: 6 additions & 0 deletions drivers/ide/ide-taskfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
ide_tf_dump(drive->name, tf);
tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
SELECT_MASK(drive, 0);

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

tp_ops->output_data(drive, cmd, data, 2);
}
tp_ops->tf_load(drive, cmd);
}

Expand Down
9 changes: 0 additions & 9 deletions drivers/ide/ns87415.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &drive->hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;

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

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 */
outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down
15 changes: 0 additions & 15 deletions drivers/ide/scc_pata.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,6 @@ 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) {
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);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
Expand Down Expand Up @@ -694,15 +688,6 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &drive->hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;

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

scc_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 */
scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down
15 changes: 0 additions & 15 deletions drivers/ide/tx4938ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ static void tx4938ide_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) {
u8 data[2] = { tf->data, tf->hob_data };

hwif->tp_ops->output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
tx4938ide_outb(tf->hob_feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
Expand Down Expand Up @@ -131,15 +125,6 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;

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

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 */
tx4938ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down
15 changes: 0 additions & 15 deletions drivers/ide/tx4939ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,6 @@ static void tx4939ide_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) {
u8 data[2] = { tf->data, tf->hob_data };

hwif->tp_ops->output_data(drive, cmd, data, 2);
}

if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
tx4939ide_outb(tf->hob_feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
Expand Down Expand Up @@ -498,15 +492,6 @@ static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;

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

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 */
tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);

Expand Down

0 comments on commit 35218d1

Please sign in to comment.