aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index ffff96e6ab3e..747dc6023346 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -137,14 +137,12 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
137{ 137{
138 ide_hwif_t *hwif = HWIF(drive); 138 ide_hwif_t *hwif = HWIF(drive);
139 unsigned int dma = drive->using_dma; 139 unsigned int dma = drive->using_dma;
140 u16 nsectors = (u16)rq->nr_sectors;
140 u8 lba48 = (drive->addressing == 1) ? 1 : 0; 141 u8 lba48 = (drive->addressing == 1) ? 1 : 0;
141 u8 command = WIN_NOP; 142 u8 command = WIN_NOP;
142 ata_nsector_t nsectors;
143 ide_task_t task; 143 ide_task_t task;
144 struct ide_taskfile *tf = &task.tf; 144 struct ide_taskfile *tf = &task.tf;
145 145
146 nsectors.all = (u16) rq->nr_sectors;
147
148 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { 146 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
149 if (block + rq->nr_sectors > 1ULL << 28) 147 if (block + rq->nr_sectors > 1ULL << 28)
150 dma = 0; 148 dma = 0;
@@ -166,14 +164,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
166 pr_debug("%s: LBA=0x%012llx\n", drive->name, 164 pr_debug("%s: LBA=0x%012llx\n", drive->name,
167 (unsigned long long)block); 165 (unsigned long long)block);
168 166
169 tf->hob_nsect = nsectors.b.high; 167 tf->hob_nsect = (nsectors >> 8) & 0xff;
170 tf->hob_lbal = (u8)(block >> 24); 168 tf->hob_lbal = (u8)(block >> 24);
171 if (sizeof(block) != 4) { 169 if (sizeof(block) != 4) {
172 tf->hob_lbam = (u8)((u64)block >> 32); 170 tf->hob_lbam = (u8)((u64)block >> 32);
173 tf->hob_lbah = (u8)((u64)block >> 40); 171 tf->hob_lbah = (u8)((u64)block >> 40);
174 } 172 }
175 173
176 tf->nsect = nsectors.b.low; 174 tf->nsect = nsectors & 0xff;
177 tf->lbal = (u8) block; 175 tf->lbal = (u8) block;
178 tf->lbam = (u8)(block >> 8); 176 tf->lbam = (u8)(block >> 8);
179 tf->lbah = (u8)(block >> 16); 177 tf->lbah = (u8)(block >> 16);
@@ -185,7 +183,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
185#endif 183#endif
186 task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); 184 task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
187 } else { 185 } else {
188 tf->nsect = nsectors.b.low; 186 tf->nsect = nsectors & 0xff;
189 tf->lbal = block; 187 tf->lbal = block;
190 tf->lbam = block >>= 8; 188 tf->lbam = block >>= 8;
191 tf->lbah = block >>= 8; 189 tf->lbah = block >>= 8;
@@ -200,7 +198,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
200 198
201 pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); 199 pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect);
202 200
203 tf->nsect = nsectors.b.low; 201 tf->nsect = nsectors & 0xff;
204 tf->lbal = sect; 202 tf->lbal = sect;
205 tf->lbam = cyl; 203 tf->lbam = cyl;
206 tf->lbah = cyl >> 8; 204 tf->lbah = cyl >> 8;