Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142973
b: refs/heads/master
c: 745483f
h: refs/heads/master
i:
  142971: fac0c50
v: v3
  • Loading branch information
Sergei Shtylyov authored and Bartlomiej Zolnierkiewicz committed Apr 8, 2009
1 parent 3117103 commit e665fd4
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 108 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 60f85019c6c8c1aebf3485a313e0da094bc95d07
refs/heads/master: 745483f10c6cefb303007c6873e2bfce54efa8ed
2 changes: 1 addition & 1 deletion trunk/drivers/ide/ide-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static int do_drive_set_taskfiles(ide_drive_t *drive,

/* convert GTF to taskfile */
memset(&cmd, 0, sizeof(cmd));
memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF);
memcpy(&cmd.tf.feature, gtf, REGS_PER_GTF);
cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;

Expand Down
30 changes: 15 additions & 15 deletions trunk/drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,19 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
pr_debug("%s: LBA=0x%012llx\n", drive->name,
(unsigned long long)block);

tf->hob_nsect = (nsectors >> 8) & 0xff;
tf->hob_lbal = (u8)(block >> 24);
if (sizeof(block) != 4) {
tf->hob_lbam = (u8)((u64)block >> 32);
tf->hob_lbah = (u8)((u64)block >> 40);
}

tf->nsect = nsectors & 0xff;
tf->lbal = (u8) block;
tf->lbam = (u8)(block >> 8);
tf->lbah = (u8)(block >> 16);
tf->device = ATA_LBA;

tf = &cmd.hob;
tf->nsect = (nsectors >> 8) & 0xff;
tf->lbal = (u8)(block >> 24);
if (sizeof(block) != 4) {
tf->lbam = (u8)((u64)block >> 32);
tf->lbah = (u8)((u64)block >> 40);
}

cmd.valid.out.hob = IDE_VALID_OUT_HOB;
cmd.valid.in.hob = IDE_VALID_IN_HOB;
Expand All @@ -125,10 +127,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
tf->lbal = block;
tf->lbam = block >>= 8;
tf->lbah = block >>= 8;
tf->device = (block >> 8) & 0xf;
tf->device = ((block >> 8) & 0xf) | ATA_LBA;
}

tf->device |= ATA_LBA;
} else {
unsigned int sect, head, cyl, track;

Expand Down Expand Up @@ -235,7 +235,7 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)

/* if OK, compute maximum address value */
if (!(tf->status & ATA_ERR))
addr = ide_get_lba_addr(tf, lba48) + 1;
addr = ide_get_lba_addr(&cmd, lba48) + 1;

return addr;
}
Expand All @@ -257,9 +257,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
tf->lbam = (addr_req >>= 8) & 0xff;
tf->lbah = (addr_req >>= 8) & 0xff;
if (lba48) {
tf->hob_lbal = (addr_req >>= 8) & 0xff;
tf->hob_lbam = (addr_req >>= 8) & 0xff;
tf->hob_lbah = (addr_req >>= 8) & 0xff;
cmd.hob.lbal = (addr_req >>= 8) & 0xff;
cmd.hob.lbam = (addr_req >>= 8) & 0xff;
cmd.hob.lbah = (addr_req >>= 8) & 0xff;
tf->command = ATA_CMD_SET_MAX_EXT;
} else {
tf->device = (addr_req >>= 8) & 0x0f;
Expand All @@ -279,7 +279,7 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)

/* if OK, compute maximum address value */
if (!(tf->status & ATA_ERR))
addr_set = ide_get_lba_addr(tf, lba48) + 1;
addr_set = ide_get_lba_addr(&cmd, lba48) + 1;

return addr_set;
}
Expand Down
24 changes: 13 additions & 11 deletions trunk/drivers/ide/ide-io-std.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
{
ide_hwif_t *hwif = drive->hwif;
struct ide_io_ports *io_ports = &hwif->io_ports;
struct ide_taskfile *tf = &cmd->tf;
struct ide_taskfile *tf = &cmd->hob;
void (*tf_outb)(u8 addr, unsigned long port);
u8 valid = cmd->valid.out.hob;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
Expand All @@ -104,16 +104,17 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
HIHI = 0xFF;

if (valid & IDE_VALID_FEATURE)
tf_outb(tf->hob_feature, io_ports->feature_addr);
tf_outb(tf->feature, io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
tf_outb(tf->hob_nsect, io_ports->nsect_addr);
tf_outb(tf->nsect, io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
tf_outb(tf->hob_lbal, io_ports->lbal_addr);
tf_outb(tf->lbal, io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
tf_outb(tf->hob_lbam, io_ports->lbam_addr);
tf_outb(tf->lbam, io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
tf_outb(tf->hob_lbah, io_ports->lbah_addr);
tf_outb(tf->lbah, io_ports->lbah_addr);

tf = &cmd->tf;
valid = cmd->valid.out.tf;

if (valid & IDE_VALID_FEATURE)
Expand Down Expand Up @@ -170,18 +171,19 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
if (cmd->tf_flags & IDE_TFLAG_LBA48) {
tf_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);

tf = &cmd->hob;
valid = cmd->valid.in.hob;

if (valid & IDE_VALID_ERROR)
tf->hob_error = tf_inb(io_ports->feature_addr);
tf->error = tf_inb(io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
tf->hob_nsect = tf_inb(io_ports->nsect_addr);
tf->nsect = tf_inb(io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
tf->hob_lbal = tf_inb(io_ports->lbal_addr);
tf->lbal = tf_inb(io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
tf->hob_lbam = tf_inb(io_ports->lbam_addr);
tf->lbam = tf_inb(io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
tf->hob_lbah = tf_inb(io_ports->lbah_addr);
tf->lbah = tf_inb(io_ports->lbah_addr);
}
}
EXPORT_SYMBOL_GPL(ide_tf_read);
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)

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

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

tp_ops->tf_read(drive, cmd);
Expand All @@ -97,7 +97,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
if (tf->lbal != 0xc4) {
printk(KERN_ERR "%s: head unload failed!\n",
drive->name);
ide_tf_dump(drive->name, tf);
ide_tf_dump(drive->name, cmd);
} else
drive->dev_flags |= IDE_DFLAG_PARKED;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/ide-ioctls.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg)
return -EFAULT;

memset(&cmd, 0, sizeof(cmd));
memcpy(&cmd.tf_array[7], &args[1], 6);
memcpy(&cmd.tf.feature, &args[1], 6);
cmd.tf.command = args[0];
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);

args[0] = cmd.tf.command;
memcpy(&args[1], &cmd.tf_array[7], 6);
memcpy(&args[1], &cmd.tf.feature, 6);

if (copy_to_user(p, args, 7))
err = -EFAULT;
Expand Down
15 changes: 8 additions & 7 deletions trunk/drivers/ide/ide-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ static void ide_dump_opcode(ide_drive_t *drive)
printk(KERN_CONT "0x%02x\n", cmd->tf.command);
}

u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
u64 ide_get_lba_addr(struct ide_cmd *cmd, int lba48)
{
struct ide_taskfile *tf = &cmd->tf;
u32 high, low;

if (lba48)
high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
tf->hob_lbal;
else
high = tf->device & 0xf;
low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
if (lba48) {
tf = &cmd->hob;
high = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
} else
high = tf->device & 0xf;

return ((u64)high << 24) | low;
}
Expand All @@ -82,7 +83,7 @@ static void ide_dump_sector(ide_drive_t *drive)

if (lba48 || (tf->device & ATA_LBA))
printk(KERN_CONT ", LBAsect=%llu",
(unsigned long long)ide_get_lba_addr(tf, lba48));
(unsigned long long)ide_get_lba_addr(&cmd, lba48));
else
printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam,
tf->device & 0xf, tf->lbal);
Expand Down
31 changes: 13 additions & 18 deletions trunk/drivers/ide/ide-taskfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@
#include <asm/uaccess.h>
#include <asm/io.h>

void ide_tf_dump(const char *s, struct ide_taskfile *tf)
void ide_tf_dump(const char *s, struct ide_cmd *cmd)
{
#ifdef DEBUG
printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x "
"lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n",
s, tf->feature, tf->nsect, tf->lbal,
tf->lbam, tf->lbah, tf->device, tf->command);
printk("%s: hob: nsect 0x%02x lbal 0x%02x "
"lbam 0x%02x lbah 0x%02x\n",
s, tf->hob_nsect, tf->hob_lbal,
tf->hob_lbam, tf->hob_lbah);
s, cmd->tf.feature, cmd->tf.nsect,
cmd->tf.lbal, cmd->tf.lbam, cmd->tf.lbah,
cmd->tf.device, cmd->tf.command);
printk("%s: hob: nsect 0x%02x lbal 0x%02x lbam 0x%02x lbah 0x%02x\n",
s, cmd->hob.nsect, cmd->hob.lbal, cmd->hob.lbam, cmd->hob.lbah);
#endif
}

Expand Down Expand Up @@ -80,12 +79,12 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
memcpy(cmd, orig_cmd, sizeof(*cmd));

if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
ide_tf_dump(drive->name, tf);
ide_tf_dump(drive->name, cmd);
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 };
u8 data[2] = { cmd->tf.data, cmd->hob.data };

tp_ops->output_data(drive, cmd, data, 2);
}
Expand Down Expand Up @@ -490,10 +489,8 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)

memset(&cmd, 0, sizeof(cmd));

memcpy(&cmd.tf_array[0], req_task->hob_ports,
HDIO_DRIVE_HOB_HDR_SIZE - 2);
memcpy(&cmd.tf_array[6], req_task->io_ports,
HDIO_DRIVE_TASK_HDR_SIZE);
memcpy(&cmd.hob, req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2);
memcpy(&cmd.tf, req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE);

cmd.valid.out.tf = IDE_VALID_DEVICE;
cmd.valid.in.tf = IDE_VALID_DEVICE | IDE_VALID_IN_TF;
Expand Down Expand Up @@ -598,7 +595,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA)
nsect = 0;
else if (!nsect) {
nsect = (cmd.tf.hob_nsect << 8) | cmd.tf.nsect;
nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect;

if (!nsect) {
printk(KERN_ERR "%s: in/out command without data\n",
Expand All @@ -610,10 +607,8 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)

err = ide_raw_taskfile(drive, &cmd, data_buf, nsect);

memcpy(req_task->hob_ports, &cmd.tf_array[0],
HDIO_DRIVE_HOB_HDR_SIZE - 2);
memcpy(req_task->io_ports, &cmd.tf_array[6],
HDIO_DRIVE_TASK_HDR_SIZE);
memcpy(req_task->hob_ports, &cmd.hob, HDIO_DRIVE_HOB_HDR_SIZE - 2);
memcpy(req_task->io_ports, &cmd.tf, HDIO_DRIVE_TASK_HDR_SIZE);

if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) &&
req_task->in_flags.all == 0) {
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/ide/ns87415.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,19 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
if (cmd->tf_flags & IDE_TFLAG_LBA48) {
outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);

tf = &cmd->hob;
valid = cmd->valid.in.hob;

if (valid & IDE_VALID_ERROR)
tf->hob_error = inb(io_ports->feature_addr);
tf->error = inb(io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
tf->hob_nsect = inb(io_ports->nsect_addr);
tf->nsect = inb(io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
tf->hob_lbal = inb(io_ports->lbal_addr);
tf->lbal = inb(io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
tf->hob_lbam = inb(io_ports->lbam_addr);
tf->lbam = inb(io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
tf->hob_lbah = inb(io_ports->lbah_addr);
tf->lbah = inb(io_ports->lbah_addr);
}
}

Expand Down
24 changes: 13 additions & 11 deletions trunk/drivers/ide/scc_pata.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,24 +648,25 @@ static int __devinit init_setup_scc(struct pci_dev *dev,
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_taskfile *tf = &cmd->tf;
struct ide_taskfile *tf = &cmd->hob;
u8 valid = cmd->valid.out.hob;
u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;

if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
HIHI = 0xFF;

if (valid & IDE_VALID_FEATURE)
scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
scc_ide_outb(tf->feature, io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
scc_ide_outb(tf->nsect, io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
scc_ide_outb(tf->lbal, io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
scc_ide_outb(tf->lbam, io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
scc_ide_outb(tf->lbah, io_ports->lbah_addr);

tf = &cmd->tf;
valid = cmd->valid.out.tf;

if (valid & IDE_VALID_FEATURE)
Expand Down Expand Up @@ -709,18 +710,19 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
if (cmd->tf_flags & IDE_TFLAG_LBA48) {
scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);

tf = &cmd->hob;
valid = cmd->valid.in.hob;

if (valid & IDE_VALID_ERROR)
tf->hob_error = scc_ide_inb(io_ports->feature_addr);
tf->error = scc_ide_inb(io_ports->feature_addr);
if (valid & IDE_VALID_NSECT)
tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
tf->nsect = scc_ide_inb(io_ports->nsect_addr);
if (valid & IDE_VALID_LBAL)
tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
tf->lbal = scc_ide_inb(io_ports->lbal_addr);
if (valid & IDE_VALID_LBAM)
tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
tf->lbam = scc_ide_inb(io_ports->lbam_addr);
if (valid & IDE_VALID_LBAH)
tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
tf->lbah = scc_ide_inb(io_ports->lbah_addr);
}
}

Expand Down
Loading

0 comments on commit e665fd4

Please sign in to comment.