Commit 60f85019 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Bartlomiej Zolnierkiewicz

ide: replace IDE_TFLAG_* flags by IDE_VALID_*

Replace IDE_TFLAG_{IN|OUT}_* flags meaning to the taskfile register validity on
input/output by the IDE_VALID_* flags and introduce 4 symmetric 8-bit register
validity indicator subfields, 'valid.{input/output}.{tf|hob}', into the 'struct
ide_cmd' instead of using the 'tf_flags' field for that purpose (this field can
then be turned from 32-bit into 8-bit one).
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 674f0ea1
...@@ -319,7 +319,8 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, ...@@ -319,7 +319,8 @@ static int do_drive_set_taskfiles(ide_drive_t *drive,
/* convert GTF to taskfile */ /* convert GTF to taskfile */
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF); memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF);
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
err = ide_no_data_taskfile(drive, &cmd); err = ide_no_data_taskfile(drive, &cmd);
if (err) { if (err) {
......
...@@ -257,8 +257,7 @@ void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) ...@@ -257,8 +257,7 @@ void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason)
struct ide_cmd cmd; struct ide_cmd cmd;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | cmd.valid.in.tf = IDE_VALID_LBAH | IDE_VALID_LBAM | IDE_VALID_NSECT;
IDE_TFLAG_IN_NSECT;
drive->hwif->tp_ops->tf_read(drive, &cmd); drive->hwif->tp_ops->tf_read(drive, &cmd);
...@@ -439,12 +438,12 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) ...@@ -439,12 +438,12 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
return ide_started; return ide_started;
} }
static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, static void ide_init_packet_cmd(struct ide_cmd *cmd, u8 valid_tf,
u16 bcount, u8 dma) u16 bcount, u8 dma)
{ {
cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO;
cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | cmd->valid.out.tf = IDE_VALID_LBAH | IDE_VALID_LBAM |
IDE_TFLAG_OUT_FEATURE | tf_flags; IDE_VALID_FEATURE | valid_tf;
cmd->tf.command = ATA_CMD_PACKET; cmd->tf.command = ATA_CMD_PACKET;
cmd->tf.feature = dma; /* Use PIO/DMA */ cmd->tf.feature = dma; /* Use PIO/DMA */
cmd->tf.lbam = bcount & 0xff; cmd->tf.lbam = bcount & 0xff;
...@@ -456,7 +455,7 @@ static u8 ide_read_ireason(ide_drive_t *drive) ...@@ -456,7 +455,7 @@ static u8 ide_read_ireason(ide_drive_t *drive)
struct ide_cmd cmd; struct ide_cmd cmd;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf_flags = IDE_TFLAG_IN_NSECT; cmd.valid.in.tf = IDE_VALID_NSECT;
drive->hwif->tp_ops->tf_read(drive, &cmd); drive->hwif->tp_ops->tf_read(drive, &cmd);
...@@ -588,12 +587,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -588,12 +587,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
ide_expiry_t *expiry = NULL; ide_expiry_t *expiry = NULL;
struct request *rq = hwif->rq; struct request *rq = hwif->rq;
unsigned int timeout; unsigned int timeout;
u32 tf_flags;
u16 bcount; u16 bcount;
u8 valid_tf;
u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT);
if (dev_is_idecd(drive)) { if (dev_is_idecd(drive)) {
tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; valid_tf = IDE_VALID_NSECT | IDE_VALID_LBAL;
bcount = ide_cd_get_xferlen(rq); bcount = ide_cd_get_xferlen(rq);
expiry = ide_cd_expiry; expiry = ide_cd_expiry;
timeout = ATAPI_WAIT_PC; timeout = ATAPI_WAIT_PC;
...@@ -607,7 +606,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -607,7 +606,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
pc->xferred = 0; pc->xferred = 0;
pc->cur_pos = pc->buf; pc->cur_pos = pc->buf;
tf_flags = IDE_TFLAG_OUT_DEVICE; valid_tf = IDE_VALID_DEVICE;
bcount = ((drive->media == ide_tape) ? bcount = ((drive->media == ide_tape) ?
pc->req_xfer : pc->req_xfer :
min(pc->req_xfer, 63 * 1024)); min(pc->req_xfer, 63 * 1024));
...@@ -627,7 +626,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -627,7 +626,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
: WAIT_TAPE_CMD; : WAIT_TAPE_CMD;
} }
ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma); ide_init_packet_cmd(cmd, valid_tf, bcount, drive->dma);
(void)do_rw_taskfile(drive, cmd); (void)do_rw_taskfile(drive, cmd);
......
...@@ -97,7 +97,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -97,7 +97,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
} }
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
if (drive->dev_flags & IDE_DFLAG_LBA) { if (drive->dev_flags & IDE_DFLAG_LBA) {
if (lba48) { if (lba48) {
...@@ -116,7 +117,9 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -116,7 +117,9 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
tf->lbam = (u8)(block >> 8); tf->lbam = (u8)(block >> 8);
tf->lbah = (u8)(block >> 16); tf->lbah = (u8)(block >> 16);
cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); cmd.valid.out.hob = IDE_VALID_OUT_HOB;
cmd.valid.in.hob = IDE_VALID_IN_HOB;
cmd.tf_flags |= IDE_TFLAG_LBA48;
} else { } else {
tf->nsect = nsectors & 0xff; tf->nsect = nsectors & 0xff;
tf->lbal = block; tf->lbal = block;
...@@ -220,9 +223,13 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) ...@@ -220,9 +223,13 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
tf->command = ATA_CMD_READ_NATIVE_MAX; tf->command = ATA_CMD_READ_NATIVE_MAX;
tf->device = ATA_LBA; tf->device = ATA_LBA;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
if (lba48) cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); if (lba48) {
cmd.valid.out.hob = IDE_VALID_OUT_HOB;
cmd.valid.in.hob = IDE_VALID_IN_HOB;
cmd.tf_flags = IDE_TFLAG_LBA48;
}
ide_no_data_taskfile(drive, &cmd); ide_no_data_taskfile(drive, &cmd);
...@@ -260,9 +267,13 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) ...@@ -260,9 +267,13 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
} }
tf->device |= ATA_LBA; tf->device |= ATA_LBA;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
if (lba48) cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); if (lba48) {
cmd.valid.out.hob = IDE_VALID_OUT_HOB;
cmd.valid.in.hob = IDE_VALID_IN_HOB;
cmd.tf_flags = IDE_TFLAG_LBA48;
}
ide_no_data_taskfile(drive, &cmd); ide_no_data_taskfile(drive, &cmd);
...@@ -395,8 +406,8 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) ...@@ -395,8 +406,8 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
cmd->tf.command = ATA_CMD_FLUSH_EXT; cmd->tf.command = ATA_CMD_FLUSH_EXT;
else else
cmd->tf.command = ATA_CMD_FLUSH; cmd->tf.command = ATA_CMD_FLUSH;
cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
IDE_TFLAG_DYN; cmd->tf_flags = IDE_TFLAG_DYN;
cmd->protocol = ATA_PROT_NODATA; cmd->protocol = ATA_PROT_NODATA;
rq->cmd_type = REQ_TYPE_ATA_TASKFILE; rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
...@@ -457,7 +468,8 @@ static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) ...@@ -457,7 +468,8 @@ static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect)
cmd.tf.feature = feature; cmd.tf.feature = feature;
cmd.tf.nsect = nsect; cmd.tf.nsect = nsect;
cmd.tf.command = ATA_CMD_SET_FEATURES; cmd.tf.command = ATA_CMD_SET_FEATURES;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
return ide_no_data_taskfile(drive, &cmd); return ide_no_data_taskfile(drive, &cmd);
} }
...@@ -533,7 +545,8 @@ static int do_idedisk_flushcache(ide_drive_t *drive) ...@@ -533,7 +545,8 @@ static int do_idedisk_flushcache(ide_drive_t *drive)
cmd.tf.command = ATA_CMD_FLUSH_EXT; cmd.tf.command = ATA_CMD_FLUSH_EXT;
else else
cmd.tf.command = ATA_CMD_FLUSH; cmd.tf.command = ATA_CMD_FLUSH;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
return ide_no_data_taskfile(drive, &cmd); return ide_no_data_taskfile(drive, &cmd);
} }
...@@ -715,7 +728,8 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, ...@@ -715,7 +728,8 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk,
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
ret = ide_no_data_taskfile(drive, &cmd); ret = ide_no_data_taskfile(drive, &cmd);
......
...@@ -13,7 +13,8 @@ static int smart_enable(ide_drive_t *drive) ...@@ -13,7 +13,8 @@ static int smart_enable(ide_drive_t *drive)
tf->lbam = ATA_SMART_LBAM_PASS; tf->lbam = ATA_SMART_LBAM_PASS;
tf->lbah = ATA_SMART_LBAH_PASS; tf->lbah = ATA_SMART_LBAH_PASS;
tf->command = ATA_CMD_SMART; tf->command = ATA_CMD_SMART;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
return ide_no_data_taskfile(drive, &cmd); return ide_no_data_taskfile(drive, &cmd);
} }
...@@ -29,7 +30,8 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) ...@@ -29,7 +30,8 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
tf->lbam = ATA_SMART_LBAM_PASS; tf->lbam = ATA_SMART_LBAM_PASS;
tf->lbah = ATA_SMART_LBAH_PASS; tf->lbah = ATA_SMART_LBAH_PASS;
tf->command = ATA_CMD_SMART; tf->command = ATA_CMD_SMART;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
cmd.protocol = ATA_PROT_PIO; cmd.protocol = ATA_PROT_PIO;
return ide_raw_taskfile(drive, &cmd, buf, 1); return ide_raw_taskfile(drive, &cmd, buf, 1);
......
...@@ -91,6 +91,7 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -91,6 +91,7 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_io_ports *io_ports = &hwif->io_ports; struct ide_io_ports *io_ports = &hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf; struct ide_taskfile *tf = &cmd->tf;
void (*tf_outb)(u8 addr, unsigned long port); void (*tf_outb)(u8 addr, unsigned long port);
u8 valid = cmd->valid.out.hob;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
...@@ -102,29 +103,31 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -102,29 +103,31 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
HIHI = 0xFF; HIHI = 0xFF;
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) if (valid & IDE_VALID_FEATURE)
tf_outb(tf->hob_feature, io_ports->feature_addr); tf_outb(tf->hob_feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) if (valid & IDE_VALID_NSECT)
tf_outb(tf->hob_nsect, io_ports->nsect_addr); tf_outb(tf->hob_nsect, io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) if (valid & IDE_VALID_LBAL)
tf_outb(tf->hob_lbal, io_ports->lbal_addr); tf_outb(tf->hob_lbal, io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) if (valid & IDE_VALID_LBAM)
tf_outb(tf->hob_lbam, io_ports->lbam_addr); tf_outb(tf->hob_lbam, io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) if (valid & IDE_VALID_LBAH)
tf_outb(tf->hob_lbah, io_ports->lbah_addr); tf_outb(tf->hob_lbah, io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) valid = cmd->valid.out.tf;
if (valid & IDE_VALID_FEATURE)
tf_outb(tf->feature, io_ports->feature_addr); tf_outb(tf->feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) if (valid & IDE_VALID_NSECT)
tf_outb(tf->nsect, io_ports->nsect_addr); tf_outb(tf->nsect, io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) if (valid & IDE_VALID_LBAL)
tf_outb(tf->lbal, io_ports->lbal_addr); tf_outb(tf->lbal, io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) if (valid & IDE_VALID_LBAM)
tf_outb(tf->lbam, io_ports->lbam_addr); tf_outb(tf->lbam, io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) if (valid & IDE_VALID_LBAH)
tf_outb(tf->lbah, io_ports->lbah_addr); tf_outb(tf->lbah, io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) if (valid & IDE_VALID_DEVICE)
tf_outb((tf->device & HIHI) | drive->select, tf_outb((tf->device & HIHI) | drive->select,
io_ports->device_addr); io_ports->device_addr);
} }
...@@ -137,6 +140,7 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -137,6 +140,7 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
struct ide_taskfile *tf = &cmd->tf; struct ide_taskfile *tf = &cmd->tf;
void (*tf_outb)(u8 addr, unsigned long port); void (*tf_outb)(u8 addr, unsigned long port);
u8 (*tf_inb)(unsigned long port); u8 (*tf_inb)(unsigned long port);
u8 valid = cmd->valid.in.tf;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
if (mmio) { if (mmio) {
...@@ -150,31 +154,33 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -150,31 +154,33 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
/* be sure we're looking at the low order bits */ /* be sure we're looking at the low order bits */
tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) if (valid & IDE_VALID_ERROR)
tf->error = tf_inb(io_ports->feature_addr); tf->error = tf_inb(io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) if (valid & IDE_VALID_NSECT)
tf->nsect = tf_inb(io_ports->nsect_addr); tf->nsect = tf_inb(io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) if (valid & IDE_VALID_LBAL)
tf->lbal = tf_inb(io_ports->lbal_addr); tf->lbal = tf_inb(io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) if (valid & IDE_VALID_LBAM)
tf->lbam = tf_inb(io_ports->lbam_addr); tf->lbam = tf_inb(io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) if (valid & IDE_VALID_LBAH)
tf->lbah = tf_inb(io_ports->lbah_addr); tf->lbah = tf_inb(io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) if (valid & IDE_VALID_DEVICE)
tf->device = tf_inb(io_ports->device_addr); tf->device = tf_inb(io_ports->device_addr);
if (cmd->tf_flags & IDE_TFLAG_LBA48) { if (cmd->tf_flags & IDE_TFLAG_LBA48) {
tf_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); tf_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) valid = cmd->valid.in.hob;
if (valid & IDE_VALID_ERROR)
tf->hob_error = tf_inb(io_ports->feature_addr); tf->hob_error = tf_inb(io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) if (valid & IDE_VALID_NSECT)
tf->hob_nsect = tf_inb(io_ports->nsect_addr); tf->hob_nsect = tf_inb(io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) if (valid & IDE_VALID_LBAL)
tf->hob_lbal = tf_inb(io_ports->lbal_addr); tf->hob_lbal = tf_inb(io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) if (valid & IDE_VALID_LBAM)
tf->hob_lbam = tf_inb(io_ports->lbam_addr); tf->hob_lbam = tf_inb(io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) if (valid & IDE_VALID_LBAH)
tf->hob_lbah = tf_inb(io_ports->lbah_addr); tf->hob_lbah = tf_inb(io_ports->lbah_addr);
} }
} }
......
...@@ -205,8 +205,9 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) ...@@ -205,8 +205,9 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
return ide_stopped; return ide_stopped;
} }
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
IDE_TFLAG_CUSTOM_HANDLER; cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
cmd.tf_flags = IDE_TFLAG_CUSTOM_HANDLER;
do_rw_taskfile(drive, &cmd); do_rw_taskfile(drive, &cmd);
......
...@@ -141,11 +141,12 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -141,11 +141,12 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
tf->lbal = args[1]; tf->lbal = args[1];
tf->lbam = 0x4f; tf->lbam = 0x4f;
tf->lbah = 0xc2; tf->lbah = 0xc2;
cmd.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; cmd.valid.out.tf = IDE_VALID_OUT_TF;
cmd.valid.in.tf = IDE_VALID_NSECT;
} else { } else {
tf->nsect = args[1]; tf->nsect = args[1];
cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
IDE_TFLAG_IN_NSECT; cmd.valid.in.tf = IDE_VALID_NSECT;
} }
tf->command = args[0]; tf->command = args[0];
cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA;
...@@ -207,7 +208,8 @@ static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -207,7 +208,8 @@ static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
memcpy(&cmd.tf_array[7], &args[1], 6); memcpy(&cmd.tf_array[7], &args[1], 6);
cmd.tf.command = args[0]; cmd.tf.command = args[0];
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
err = ide_no_data_taskfile(drive, &cmd); err = ide_no_data_taskfile(drive, &cmd);
......
...@@ -40,7 +40,7 @@ u8 ide_read_error(ide_drive_t *drive) ...@@ -40,7 +40,7 @@ u8 ide_read_error(ide_drive_t *drive)
struct ide_cmd cmd; struct ide_cmd cmd;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf_flags = IDE_TFLAG_IN_ERROR; cmd.valid.in.tf = IDE_VALID_ERROR;
drive->hwif->tp_ops->tf_read(drive, &cmd); drive->hwif->tp_ops->tf_read(drive, &cmd);
...@@ -348,7 +348,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) ...@@ -348,7 +348,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS); tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
cmd.tf.feature = SETFEATURES_XFER; cmd.tf.feature = SETFEATURES_XFER;
cmd.tf.nsect = speed; cmd.tf.nsect = speed;
......
...@@ -71,11 +71,12 @@ static void ide_dump_sector(ide_drive_t *drive) ...@@ -71,11 +71,12 @@ static void ide_dump_sector(ide_drive_t *drive)
u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48);
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
if (lba48) if (lba48) {
cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | cmd.valid.in.tf = IDE_VALID_LBA;
IDE_TFLAG_LBA48; cmd.valid.in.hob = IDE_VALID_LBA;
else cmd.tf_flags = IDE_TFLAG_LBA48;
cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; } else
cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE;
drive->hwif->tp_ops->tf_read(drive, &cmd); drive->hwif->tp_ops->tf_read(drive, &cmd);
......
...@@ -74,7 +74,8 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) ...@@ -74,7 +74,8 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq)
tf->lbal = 0x4c; tf->lbal = 0x4c;
tf->lbam = 0x4e; tf->lbam = 0x4e;
tf->lbah = 0x55; tf->lbah = 0x55;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
} else /* cmd == REQ_UNPARK_HEADS */ } else /* cmd == REQ_UNPARK_HEADS */
tf->command = ATA_CMD_CHK_POWER; tf->command = ATA_CMD_CHK_POWER;
......
...@@ -163,7 +163,8 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) ...@@ -163,7 +163,8 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
return ide_stopped; return ide_stopped;
out_do_tf: out_do_tf:
cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd->valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
cmd->protocol = ATA_PROT_NODATA; cmd->protocol = ATA_PROT_NODATA;
return do_rw_taskfile(drive, cmd); return do_rw_taskfile(drive, cmd);
......
...@@ -287,7 +287,7 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id) ...@@ -287,7 +287,7 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
/* disable DMA & overlap */ /* disable DMA & overlap */
cmd.tf_flags = IDE_TFLAG_OUT_FEATURE; cmd.valid.out.tf = IDE_VALID_FEATURE;
tp_ops->tf_load(drive, &cmd); tp_ops->tf_load(drive, &cmd);
} }
...@@ -340,7 +340,7 @@ static u8 ide_read_device(ide_drive_t *drive) ...@@ -340,7 +340,7 @@ static u8 ide_read_device(ide_drive_t *drive)
struct ide_cmd cmd; struct ide_cmd cmd;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.tf_flags = IDE_TFLAG_IN_DEVICE; cmd.valid.in.tf = IDE_VALID_DEVICE;
drive->hwif->tp_ops->tf_read(drive, &cmd); drive->hwif->tp_ops->tf_read(drive, &cmd);
......
...@@ -204,8 +204,8 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) ...@@ -204,8 +204,8 @@ static int set_xfer_rate (ide_drive_t *drive, int arg)
cmd.tf.command = ATA_CMD_SET_FEATURES; cmd.tf.command = ATA_CMD_SET_FEATURES;
cmd.tf.feature = SETFEATURES_XFER; cmd.tf.feature = SETFEATURES_XFER;
cmd.tf.nsect = (u8)arg; cmd.tf.nsect = (u8)arg;
cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
IDE_TFLAG_IN_NSECT; cmd.valid.in.tf = IDE_VALID_NSECT;
err = ide_no_data_taskfile(drive, &cmd); err = ide_no_data_taskfile(drive, &cmd);
......
...@@ -47,7 +47,8 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) ...@@ -47,7 +47,8 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
cmd.tf.command = ATA_CMD_ID_ATA; cmd.tf.command = ATA_CMD_ID_ATA;
else else
cmd.tf.command = ATA_CMD_ID_ATAPI; cmd.tf.command = ATA_CMD_ID_ATAPI;
cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
cmd.protocol = ATA_PROT_PIO; cmd.protocol = ATA_PROT_PIO;
return ide_raw_taskfile(drive, &cmd, buf, 1); return ide_raw_taskfile(drive, &cmd, buf, 1);
...@@ -494,11 +495,14 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -494,11 +495,14 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
memcpy(&cmd.tf_array[6], req_task->io_ports, memcpy(&cmd.tf_array[6], req_task->io_ports,
HDIO_DRIVE_TASK_HDR_SIZE); HDIO_DRIVE_TASK_HDR_SIZE);
cmd.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | cmd.valid.out.tf = IDE_VALID_DEVICE;
IDE_TFLAG_IN_TF; cmd.valid.in.tf = IDE_VALID_DEVICE | IDE_VALID_IN_TF;
cmd.tf_flags = IDE_TFLAG_IO_16BIT;
if (drive->dev_flags & IDE_DFLAG_LBA48) if (drive->dev_flags & IDE_DFLAG_LBA48) {
cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); cmd.tf_flags |= IDE_TFLAG_LBA48;
cmd.valid.in.hob = IDE_VALID_IN_HOB;
}
if (req_task->out_flags.all) { if (req_task->out_flags.all) {
cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; cmd.ftf_flags |= IDE_FTFLAG_FLAGGED;
...@@ -507,28 +511,28 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -507,28 +511,28 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA;
if (req_task->out_flags.b.nsector_hob) if (req_task->out_flags.b.nsector_hob)
cmd.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; cmd.valid.out.hob |= IDE_VALID_NSECT;
if (req_task->out_flags.b.sector_hob) if (req_task->out_flags.b.sector_hob)
cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; cmd.valid.out.hob |= IDE_VALID_LBAL;
if (req_task->out_flags.b.lcyl_hob) if (req_task->out_flags.b.lcyl_hob)
cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; cmd.valid.out.hob |= IDE_VALID_LBAM;
if (req_task->out_flags.b.hcyl_hob) if (req_task->out_flags.b.hcyl_hob)
cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; cmd.valid.out.hob |= IDE_VALID_LBAH;
if (req_task->out_flags.b.error_feature) if (req_task->out_flags.b.error_feature)
cmd.tf_flags |= IDE_TFLAG_OUT_FEATURE; cmd.valid.out.tf |= IDE_VALID_FEATURE;
if (req_task->out_flags.b.nsector) if (req_task->out_flags.b.nsector)
cmd.tf_flags |= IDE_TFLAG_OUT_NSECT; cmd.valid.out.tf |= IDE_VALID_NSECT;
if (req_task->out_flags.b.sector) if (req_task->out_flags.b.sector)
cmd.tf_flags |= IDE_TFLAG_OUT_LBAL; cmd.valid.out.tf |= IDE_VALID_LBAL;
if (req_task->out_flags.b.lcyl) if (req_task->out_flags.b.lcyl)
cmd.tf_flags |= IDE_TFLAG_OUT_LBAM; cmd.valid.out.tf |= IDE_VALID_LBAM;
if (req_task->out_flags.b.hcyl) if (req_task->out_flags.b.hcyl)
cmd.tf_flags |= IDE_TFLAG_OUT_LBAH; cmd.valid.out.tf |= IDE_VALID_LBAH;
} else { } else {
cmd.tf_flags |= IDE_TFLAG_OUT_TF; cmd.valid.out.tf |= IDE_VALID_OUT_TF;
if (cmd.tf_flags & IDE_TFLAG_LBA48) if (cmd.tf_flags & IDE_TFLAG_LBA48)
cmd.tf_flags |= IDE_TFLAG_OUT_HOB; cmd.valid.out.hob |= IDE_VALID_OUT_HOB;
} }
if (req_task->in_flags.b.data) if (req_task->in_flags.b.data)
......
...@@ -65,35 +65,38 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -65,35 +65,38 @@ 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_io_ports *io_ports = &drive->hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf; struct ide_taskfile *tf = &cmd->tf;
u8 valid = cmd->valid.in.tf;
/* be sure we're looking at the low order bits */ /* be sure we're looking at the low order bits */
outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) if (valid & IDE_VALID_ERROR)
tf->error = inb(io_ports->feature_addr); tf->error = inb(io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) if (valid & IDE_VALID_NSECT)
tf->nsect = inb(io_ports->nsect_addr); tf->nsect = inb(io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) if (valid & IDE_VALID_LBAL)
tf->lbal = inb(io_ports->lbal_addr); tf->lbal = inb(io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) if (valid & IDE_VALID_LBAM)
tf->lbam = inb(io_ports->lbam_addr); tf->lbam = inb(io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) if (valid & IDE_VALID_LBAH)
tf->lbah = inb(io_ports->lbah_addr); tf->lbah = inb(io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) if (valid & IDE_VALID_DEVICE)
tf->device = superio_ide_inb(io_ports->device_addr); tf->device = superio_ide_inb(io_ports->device_addr);
if (cmd->tf_flags & IDE_TFLAG_LBA48) { if (cmd->tf_flags & IDE_TFLAG_LBA48) {
outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) valid = cmd->valid.in.hob;
if (valid & IDE_VALID_ERROR)
tf->hob_error = inb(io_ports->feature_addr); tf->hob_error = inb(io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) if (valid & IDE_VALID_NSECT)
tf->hob_nsect = inb(io_ports->nsect_addr); tf->hob_nsect = inb(io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) if (valid & IDE_VALID_LBAL)
tf->hob_lbal = inb(io_ports->lbal_addr); tf->hob_lbal = inb(io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) if (valid & IDE_VALID_LBAM)
tf->hob_lbam = inb(io_ports->lbam_addr); tf->hob_lbam = inb(io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) if (valid & IDE_VALID_LBAH)
tf->hob_lbah = inb(io_ports->lbah_addr); tf->hob_lbah = inb(io_ports->lbah_addr);
} }
} }
......
...@@ -649,34 +649,37 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -649,34 +649,37 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
{ {
struct ide_io_ports *io_ports = &drive->hwif->io_ports; struct ide_io_ports *io_ports = &drive->hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf; struct ide_taskfile *tf = &cmd->tf;
u8 valid = cmd->valid.out.hob;
u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
HIHI = 0xFF; HIHI = 0xFF;
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) if (valid & IDE_VALID_FEATURE)
scc_ide_outb(tf->hob_feature, io_ports->feature_addr); scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) if (valid & IDE_VALID_NSECT)
scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) if (valid & IDE_VALID_LBAL)
scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) if (valid & IDE_VALID_LBAM)
scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) if (valid & IDE_VALID_LBAH)
scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) valid = cmd->valid.out.tf;
if (valid & IDE_VALID_FEATURE)
scc_ide_outb(tf->feature, io_ports->feature_addr); scc_ide_outb(tf->feature, io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) if (valid & IDE_VALID_NSECT)
scc_ide_outb(tf->nsect, io_ports->nsect_addr); scc_ide_outb(tf->nsect, io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) if (valid & IDE_VALID_LBAL)
scc_ide_outb(tf->lbal, io_ports->lbal_addr); scc_ide_outb(tf->lbal, io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) if (valid & IDE_VALID_LBAM)
scc_ide_outb(tf->lbam, io_ports->lbam_addr); scc_ide_outb(tf->lbam, io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) if (valid & IDE_VALID_LBAH)
scc_ide_outb(tf->lbah, io_ports->lbah_addr); scc_ide_outb(tf->lbah, io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) if (valid & IDE_VALID_DEVICE)
scc_ide_outb((tf->device & HIHI) | drive->select, scc_ide_outb((tf->device & HIHI) | drive->select,
io_ports->device_addr); io_ports->device_addr);
} }
...@@ -685,35 +688,38 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -685,35 +688,38 @@ 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_io_ports *io_ports = &drive->hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf; struct ide_taskfile *tf = &cmd->tf;
u8 valid = cmd->valid.in.tf;
/* be sure we're looking at the low order bits */ /* be sure we're looking at the low order bits */
scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) if (valid & IDE_VALID_ERROR)
tf->error = scc_ide_inb(io_ports->feature_addr); tf->error = scc_ide_inb(io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) if (valid & IDE_VALID_NSECT)
tf->nsect = scc_ide_inb(io_ports->nsect_addr); tf->nsect = scc_ide_inb(io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) if (valid & IDE_VALID_LBAL)
tf->lbal = scc_ide_inb(io_ports->lbal_addr); tf->lbal = scc_ide_inb(io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) if (valid & IDE_VALID_LBAM)
tf->lbam = scc_ide_inb(io_ports->lbam_addr); tf->lbam = scc_ide_inb(io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) if (valid & IDE_VALID_LBAH)
tf->lbah = scc_ide_inb(io_ports->lbah_addr); tf->lbah = scc_ide_inb(io_ports->lbah_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) if (valid & IDE_VALID_DEVICE)
tf->device = scc_ide_inb(io_ports->device_addr); tf->device = scc_ide_inb(io_ports->device_addr);
if (cmd->tf_flags & IDE_TFLAG_LBA48) { if (cmd->tf_flags & IDE_TFLAG_LBA48) {
scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) valid = cmd->valid.in.hob;
if (valid & IDE_VALID_ERROR)
tf->hob_error = scc_ide_inb(io_ports->feature_addr); tf->hob_error = scc_ide_inb(io_ports->feature_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) if (valid & IDE_VALID_NSECT)
tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) if (valid & IDE_VALID_LBAL)
tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) if (valid & IDE_VALID_LBAM)
tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) if (valid & IDE_VALID_LBAH)
tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
} }
} }
......
...@@ -438,7 +438,7 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -438,7 +438,7 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
{ {
ide_tf_load(drive, cmd); ide_tf_load(drive, cmd);
if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) if (cmd->valid.out.tf & IDE_VALID_DEVICE)
tx4939ide_tf_load_fixup(drive); tx4939ide_tf_load_fixup(drive);
} }
......
...@@ -239,66 +239,39 @@ typedef enum { ...@@ -239,66 +239,39 @@ typedef enum {
ide_started, /* a drive operation was started, handler was set */ ide_started, /* a drive operation was started, handler was set */
} ide_startstop_t; } ide_startstop_t;
enum {
IDE_VALID_ERROR = (1 << 1),
IDE_VALID_FEATURE = IDE_VALID_ERROR,
IDE_VALID_NSECT = (1 << 2),
IDE_VALID_LBAL = (1 << 3),
IDE_VALID_LBAM = (1 << 4),
IDE_VALID_LBAH = (1 << 5),
IDE_VALID_DEVICE = (1 << 6),
IDE_VALID_LBA = IDE_VALID_LBAL |
IDE_VALID_LBAM |
IDE_VALID_LBAH,
IDE_VALID_OUT_TF = IDE_VALID_FEATURE |
IDE_VALID_NSECT |
IDE_VALID_LBA,
IDE_VALID_IN_TF = IDE_VALID_NSECT |
IDE_VALID_LBA,
IDE_VALID_OUT_HOB = IDE_VALID_OUT_TF,
IDE_VALID_IN_HOB = IDE_VALID_ERROR |
IDE_VALID_NSECT |
IDE_VALID_LBA,
};
enum { enum {
IDE_TFLAG_LBA48 = (1 << 0), IDE_TFLAG_LBA48 = (1 << 0),
IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1), IDE_TFLAG_WRITE = (1 << 1),
IDE_TFLAG_OUT_HOB_NSECT = (1 << 2), IDE_TFLAG_CUSTOM_HANDLER = (1 << 2),
IDE_TFLAG_OUT_HOB_LBAL = (1 << 3), IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3),
IDE_TFLAG_OUT_HOB_LBAM = (1 << 4),
IDE_TFLAG_OUT_HOB_LBAH = (1 << 5),
IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
IDE_TFLAG_OUT_HOB_NSECT |
IDE_TFLAG_OUT_HOB_LBAL |
IDE_TFLAG_OUT_HOB_LBAM |
IDE_TFLAG_OUT_HOB_LBAH,
IDE_TFLAG_OUT_FEATURE = (1 << 6),
IDE_TFLAG_OUT_NSECT = (1 << 7),
IDE_TFLAG_OUT_LBAL = (1 << 8),
IDE_TFLAG_OUT_LBAM = (1 << 9),
IDE_TFLAG_OUT_LBAH = (1 << 10),
IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
IDE_TFLAG_OUT_NSECT |
IDE_TFLAG_OUT_LBAL |
IDE_TFLAG_OUT_LBAM |
IDE_TFLAG_OUT_LBAH,
IDE_TFLAG_OUT_DEVICE = (1 << 11),
IDE_TFLAG_WRITE = (1 << 12),
IDE_TFLAG_CUSTOM_HANDLER = (1 << 13),
IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14),
IDE_TFLAG_IN_HOB_ERROR = (1 << 15),
IDE_TFLAG_IN_HOB_NSECT = (1 << 16),
IDE_TFLAG_IN_HOB_LBAL = (1 << 17),
IDE_TFLAG_IN_HOB_LBAM = (1 << 18),
IDE_TFLAG_IN_HOB_LBAH = (1 << 19),
IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
IDE_TFLAG_IN_HOB_LBAM |
IDE_TFLAG_IN_HOB_LBAH,
IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_ERROR |
IDE_TFLAG_IN_HOB_NSECT |
IDE_TFLAG_IN_HOB_LBA,
IDE_TFLAG_IN_ERROR = (1 << 20),
IDE_TFLAG_IN_NSECT = (1 << 21),
IDE_TFLAG_IN_LBAL = (1 << 22),
IDE_TFLAG_IN_LBAM = (1 << 23),
IDE_TFLAG_IN_LBAH = (1 << 24),
IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
IDE_TFLAG_IN_LBAM |
IDE_TFLAG_IN_LBAH,
IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
IDE_TFLAG_IN_LBA,
IDE_TFLAG_IN_DEVICE = (1 << 25),
IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
IDE_TFLAG_IN_HOB,
IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
IDE_TFLAG_IN_TF,
IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
IDE_TFLAG_IN_DEVICE,
/* force 16-bit I/O operations */ /* force 16-bit I/O operations */
IDE_TFLAG_IO_16BIT = (1 << 26), IDE_TFLAG_IO_16BIT = (1 << 4),
/* struct ide_cmd was allocated using kmalloc() */ /* struct ide_cmd was allocated using kmalloc() */
IDE_TFLAG_DYN = (1 << 27), IDE_TFLAG_DYN = (1 << 5),
IDE_TFLAG_FS = (1 << 28), IDE_TFLAG_FS = (1 << 6),
IDE_TFLAG_MULTI_PIO = (1 << 29), IDE_TFLAG_MULTI_PIO = (1 << 7),
}; };
enum { enum {
...@@ -346,8 +319,16 @@ struct ide_cmd { ...@@ -346,8 +319,16 @@ struct ide_cmd {
struct ide_taskfile tf; struct ide_taskfile tf;
u8 tf_array[14]; u8 tf_array[14];
}; };
struct {
struct {
u8 tf;
u8 hob;
} out, in;
} valid;
u8 tf_flags;
u8 ftf_flags; /* for TASKFILE ioctl */ u8 ftf_flags; /* for TASKFILE ioctl */
u32 tf_flags;
int protocol; int protocol;
int sg_nents; /* number of sg entries */ int sg_nents; /* number of sg entries */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment