aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r--drivers/ide/ide-lib.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 217b7fdf2b17..56ff8c46c7d1 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -49,16 +49,17 @@ static void ide_dump_opcode(ide_drive_t *drive)
49 printk(KERN_CONT "0x%02x\n", cmd->tf.command); 49 printk(KERN_CONT "0x%02x\n", cmd->tf.command);
50} 50}
51 51
52u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) 52u64 ide_get_lba_addr(struct ide_cmd *cmd, int lba48)
53{ 53{
54 struct ide_taskfile *tf = &cmd->tf;
54 u32 high, low; 55 u32 high, low;
55 56
56 if (lba48)
57 high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
58 tf->hob_lbal;
59 else
60 high = tf->device & 0xf;
61 low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal; 57 low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
58 if (lba48) {
59 tf = &cmd->hob;
60 high = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
61 } else
62 high = tf->device & 0xf;
62 63
63 return ((u64)high << 24) | low; 64 return ((u64)high << 24) | low;
64} 65}
@@ -71,17 +72,18 @@ static void ide_dump_sector(ide_drive_t *drive)
71 u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); 72 u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48);
72 73
73 memset(&cmd, 0, sizeof(cmd)); 74 memset(&cmd, 0, sizeof(cmd));
74 if (lba48) 75 if (lba48) {
75 cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | 76 cmd.valid.in.tf = IDE_VALID_LBA;
76 IDE_TFLAG_LBA48; 77 cmd.valid.in.hob = IDE_VALID_LBA;
77 else 78 cmd.tf_flags = IDE_TFLAG_LBA48;
78 cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; 79 } else
80 cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE;
79 81
80 drive->hwif->tp_ops->tf_read(drive, &cmd); 82 ide_tf_readback(drive, &cmd);
81 83
82 if (lba48 || (tf->device & ATA_LBA)) 84 if (lba48 || (tf->device & ATA_LBA))
83 printk(KERN_CONT ", LBAsect=%llu", 85 printk(KERN_CONT ", LBAsect=%llu",
84 (unsigned long long)ide_get_lba_addr(tf, lba48)); 86 (unsigned long long)ide_get_lba_addr(&cmd, lba48));
85 else 87 else
86 printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam, 88 printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam,
87 tf->device & 0xf, tf->lbal); 89 tf->device & 0xf, tf->lbal);