diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2009-04-08 08:13:02 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-04-08 08:13:02 -0400 |
commit | 745483f10c6cefb303007c6873e2bfce54efa8ed (patch) | |
tree | 9dc9dca95f017edf279bf3e2d5ec3d07481e75da /drivers/ide/ide-disk.c | |
parent | 60f85019c6c8c1aebf3485a313e0da094bc95d07 (diff) |
ide: simplify 'struct ide_taskfile'
Make 'struct ide_taskfile' cover only 8 register values and thus put two such
fields ('tf' and 'hob') into 'struct ide_cmd', dropping unnecessary 'tf_array'
field from it.
This required changing the prototype of ide_get_lba_addr() and ide_tf_dump().
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
[bart: fix setting of ATA_LBA bit for LBA48 commands in __ide_do_rw_disk()]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 235263e51dd9..a9fbe2c31210 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -105,17 +105,19 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
105 | pr_debug("%s: LBA=0x%012llx\n", drive->name, | 105 | pr_debug("%s: LBA=0x%012llx\n", drive->name, |
106 | (unsigned long long)block); | 106 | (unsigned long long)block); |
107 | 107 | ||
108 | tf->hob_nsect = (nsectors >> 8) & 0xff; | ||
109 | tf->hob_lbal = (u8)(block >> 24); | ||
110 | if (sizeof(block) != 4) { | ||
111 | tf->hob_lbam = (u8)((u64)block >> 32); | ||
112 | tf->hob_lbah = (u8)((u64)block >> 40); | ||
113 | } | ||
114 | |||
115 | tf->nsect = nsectors & 0xff; | 108 | tf->nsect = nsectors & 0xff; |
116 | tf->lbal = (u8) block; | 109 | tf->lbal = (u8) block; |
117 | tf->lbam = (u8)(block >> 8); | 110 | tf->lbam = (u8)(block >> 8); |
118 | tf->lbah = (u8)(block >> 16); | 111 | tf->lbah = (u8)(block >> 16); |
112 | tf->device = ATA_LBA; | ||
113 | |||
114 | tf = &cmd.hob; | ||
115 | tf->nsect = (nsectors >> 8) & 0xff; | ||
116 | tf->lbal = (u8)(block >> 24); | ||
117 | if (sizeof(block) != 4) { | ||
118 | tf->lbam = (u8)((u64)block >> 32); | ||
119 | tf->lbah = (u8)((u64)block >> 40); | ||
120 | } | ||
119 | 121 | ||
120 | cmd.valid.out.hob = IDE_VALID_OUT_HOB; | 122 | cmd.valid.out.hob = IDE_VALID_OUT_HOB; |
121 | cmd.valid.in.hob = IDE_VALID_IN_HOB; | 123 | cmd.valid.in.hob = IDE_VALID_IN_HOB; |
@@ -125,10 +127,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
125 | tf->lbal = block; | 127 | tf->lbal = block; |
126 | tf->lbam = block >>= 8; | 128 | tf->lbam = block >>= 8; |
127 | tf->lbah = block >>= 8; | 129 | tf->lbah = block >>= 8; |
128 | tf->device = (block >> 8) & 0xf; | 130 | tf->device = ((block >> 8) & 0xf) | ATA_LBA; |
129 | } | 131 | } |
130 | |||
131 | tf->device |= ATA_LBA; | ||
132 | } else { | 132 | } else { |
133 | unsigned int sect, head, cyl, track; | 133 | unsigned int sect, head, cyl, track; |
134 | 134 | ||
@@ -235,7 +235,7 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) | |||
235 | 235 | ||
236 | /* if OK, compute maximum address value */ | 236 | /* if OK, compute maximum address value */ |
237 | if (!(tf->status & ATA_ERR)) | 237 | if (!(tf->status & ATA_ERR)) |
238 | addr = ide_get_lba_addr(tf, lba48) + 1; | 238 | addr = ide_get_lba_addr(&cmd, lba48) + 1; |
239 | 239 | ||
240 | return addr; | 240 | return addr; |
241 | } | 241 | } |
@@ -257,9 +257,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
257 | tf->lbam = (addr_req >>= 8) & 0xff; | 257 | tf->lbam = (addr_req >>= 8) & 0xff; |
258 | tf->lbah = (addr_req >>= 8) & 0xff; | 258 | tf->lbah = (addr_req >>= 8) & 0xff; |
259 | if (lba48) { | 259 | if (lba48) { |
260 | tf->hob_lbal = (addr_req >>= 8) & 0xff; | 260 | cmd.hob.lbal = (addr_req >>= 8) & 0xff; |
261 | tf->hob_lbam = (addr_req >>= 8) & 0xff; | 261 | cmd.hob.lbam = (addr_req >>= 8) & 0xff; |
262 | tf->hob_lbah = (addr_req >>= 8) & 0xff; | 262 | cmd.hob.lbah = (addr_req >>= 8) & 0xff; |
263 | tf->command = ATA_CMD_SET_MAX_EXT; | 263 | tf->command = ATA_CMD_SET_MAX_EXT; |
264 | } else { | 264 | } else { |
265 | tf->device = (addr_req >>= 8) & 0x0f; | 265 | tf->device = (addr_req >>= 8) & 0x0f; |
@@ -279,7 +279,7 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
279 | 279 | ||
280 | /* if OK, compute maximum address value */ | 280 | /* if OK, compute maximum address value */ |
281 | if (!(tf->status & ATA_ERR)) | 281 | if (!(tf->status & ATA_ERR)) |
282 | addr_set = ide_get_lba_addr(tf, lba48) + 1; | 282 | addr_set = ide_get_lba_addr(&cmd, lba48) + 1; |
283 | 283 | ||
284 | return addr_set; | 284 | return addr_set; |
285 | } | 285 | } |