aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-disk.c4
-rw-r--r--drivers/ide/ide-floppy.c2
-rw-r--r--drivers/ide/ide-io.c6
-rw-r--r--drivers/ide/ide-taskfile.c32
4 files changed, 22 insertions, 22 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 4b32c4eb7b82..ca934c8a1289 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -152,7 +152,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
152 cmd.rq = rq; 152 cmd.rq = rq;
153 153
154 if (dma == 0) { 154 if (dma == 0) {
155 ide_init_sg_cmd(&cmd, nsectors); 155 ide_init_sg_cmd(&cmd, nsectors << 9);
156 ide_map_sg(drive, &cmd); 156 ide_map_sg(drive, &cmd);
157 } 157 }
158 158
@@ -162,7 +162,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
162 /* fallback to PIO */ 162 /* fallback to PIO */
163 cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; 163 cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
164 ide_tf_set_cmd(drive, &cmd, 0); 164 ide_tf_set_cmd(drive, &cmd, 0);
165 ide_init_sg_cmd(&cmd, nsectors); 165 ide_init_sg_cmd(&cmd, nsectors << 9);
166 rc = do_rw_taskfile(drive, &cmd); 166 rc = do_rw_taskfile(drive, &cmd);
167 } 167 }
168 168
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index f3ed5de3141b..7ae662334835 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -294,7 +294,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
294 cmd.rq = rq; 294 cmd.rq = rq;
295 295
296 if (blk_fs_request(rq) || pc->req_xfer) { 296 if (blk_fs_request(rq) || pc->req_xfer) {
297 ide_init_sg_cmd(&cmd, rq->nr_sectors); 297 ide_init_sg_cmd(&cmd, rq->nr_sectors << 9);
298 ide_map_sg(drive, &cmd); 298 ide_map_sg(drive, &cmd);
299 } 299 }
300 300
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index b4901b690c9a..1adc5e2e7fb3 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -245,9 +245,9 @@ void ide_map_sg(ide_drive_t *drive, struct ide_cmd *cmd)
245} 245}
246EXPORT_SYMBOL_GPL(ide_map_sg); 246EXPORT_SYMBOL_GPL(ide_map_sg);
247 247
248void ide_init_sg_cmd(struct ide_cmd *cmd, int nsect) 248void ide_init_sg_cmd(struct ide_cmd *cmd, unsigned int nr_bytes)
249{ 249{
250 cmd->nsect = cmd->nleft = nsect; 250 cmd->nbytes = cmd->nleft = nr_bytes;
251 cmd->cursg_ofs = 0; 251 cmd->cursg_ofs = 0;
252 cmd->cursg = NULL; 252 cmd->cursg = NULL;
253} 253}
@@ -272,7 +272,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
272 272
273 if (cmd) { 273 if (cmd) {
274 if (cmd->protocol == ATA_PROT_PIO) { 274 if (cmd->protocol == ATA_PROT_PIO) {
275 ide_init_sg_cmd(cmd, rq->nr_sectors); 275 ide_init_sg_cmd(cmd, rq->nr_sectors << 9);
276 ide_map_sg(drive, cmd); 276 ide_map_sg(drive, cmd);
277 } 277 }
278 278
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 329fd6f13f79..84532be97c00 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -188,8 +188,8 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
188 return stat; 188 return stat;
189} 189}
190 190
191static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, 191static void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
192 unsigned int write) 192 unsigned int write, unsigned int nr_bytes)
193{ 193{
194 ide_hwif_t *hwif = drive->hwif; 194 ide_hwif_t *hwif = drive->hwif;
195 struct scatterlist *sg = hwif->sg_table; 195 struct scatterlist *sg = hwif->sg_table;
@@ -208,7 +208,7 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd,
208 } 208 }
209 209
210 page = sg_page(cursg); 210 page = sg_page(cursg);
211 offset = cursg->offset + cmd->cursg_ofs * SECTOR_SIZE; 211 offset = cursg->offset + cmd->cursg_ofs;
212 212
213 /* get the current page and offset */ 213 /* get the current page and offset */
214 page = nth_page(page, (offset >> PAGE_SHIFT)); 214 page = nth_page(page, (offset >> PAGE_SHIFT));
@@ -219,19 +219,19 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd,
219#endif 219#endif
220 buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; 220 buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
221 221
222 cmd->nleft--; 222 cmd->nleft -= nr_bytes;
223 cmd->cursg_ofs++; 223 cmd->cursg_ofs += nr_bytes;
224 224
225 if ((cmd->cursg_ofs * SECTOR_SIZE) == cursg->length) { 225 if (cmd->cursg_ofs == cursg->length) {
226 cmd->cursg = sg_next(cmd->cursg); 226 cmd->cursg = sg_next(cmd->cursg);
227 cmd->cursg_ofs = 0; 227 cmd->cursg_ofs = 0;
228 } 228 }
229 229
230 /* do the actual data transfer */ 230 /* do the actual data transfer */
231 if (write) 231 if (write)
232 hwif->tp_ops->output_data(drive, cmd, buf, SECTOR_SIZE); 232 hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes);
233 else 233 else
234 hwif->tp_ops->input_data(drive, cmd, buf, SECTOR_SIZE); 234 hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes);
235 235
236 kunmap_atomic(buf, KM_BIO_SRC_IRQ); 236 kunmap_atomic(buf, KM_BIO_SRC_IRQ);
237#ifdef CONFIG_HIGHMEM 237#ifdef CONFIG_HIGHMEM
@@ -244,9 +244,9 @@ static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd,
244{ 244{
245 unsigned int nsect; 245 unsigned int nsect;
246 246
247 nsect = min_t(unsigned int, cmd->nleft, drive->mult_count); 247 nsect = min_t(unsigned int, cmd->nleft >> 9, drive->mult_count);
248 while (nsect--) 248 while (nsect--)
249 ide_pio_sector(drive, cmd, write); 249 ide_pio_bytes(drive, cmd, write, SECTOR_SIZE);
250} 250}
251 251
252static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, 252static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
@@ -265,7 +265,7 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
265 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) 265 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO)
266 ide_pio_multi(drive, cmd, write); 266 ide_pio_multi(drive, cmd, write);
267 else 267 else
268 ide_pio_sector(drive, cmd, write); 268 ide_pio_bytes(drive, cmd, write, SECTOR_SIZE);
269 269
270 drive->io_32bit = saved_io_32bit; 270 drive->io_32bit = saved_io_32bit;
271} 271}
@@ -273,18 +273,18 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
273static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) 273static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
274{ 274{
275 if (cmd->tf_flags & IDE_TFLAG_FS) { 275 if (cmd->tf_flags & IDE_TFLAG_FS) {
276 int sectors = cmd->nsect - cmd->nleft; 276 int nr_bytes = cmd->nbytes - cmd->nleft;
277 277
278 if (cmd->protocol == ATA_PROT_PIO && 278 if (cmd->protocol == ATA_PROT_PIO &&
279 ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) { 279 ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) {
280 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) 280 if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO)
281 sectors -= drive->mult_count; 281 nr_bytes -= drive->mult_count << 9;
282 else 282 else
283 sectors--; 283 nr_bytes -= SECTOR_SIZE;
284 } 284 }
285 285
286 if (sectors > 0) 286 if (nr_bytes > 0)
287 ide_complete_rq(drive, 0, sectors << 9); 287 ide_complete_rq(drive, 0, nr_bytes);
288 } 288 }
289} 289}
290 290