diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:38 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:38 -0400 |
commit | b6308ee0c55acd2e943d849773c9f0a49c516317 (patch) | |
tree | e56f59a7935fccdf0145ffd4638a066bf4ba1e17 /drivers/ide/ide-taskfile.c | |
parent | adb1af9803d167091c2cb4de14014185054bfe2c (diff) |
ide: move command related fields from ide_hwif_t to struct ide_cmd
* Move command related fields from ide_hwif_t to struct ide_cmd.
* Make ide_init_sg_cmd() take command and sectors number as arguments.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r-- | drivers/ide/ide-taskfile.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index d3bd93afbf2b..249a707f88a4 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -209,7 +209,7 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, | |||
209 | { | 209 | { |
210 | ide_hwif_t *hwif = drive->hwif; | 210 | ide_hwif_t *hwif = drive->hwif; |
211 | struct scatterlist *sg = hwif->sg_table; | 211 | struct scatterlist *sg = hwif->sg_table; |
212 | struct scatterlist *cursg = hwif->cursg; | 212 | struct scatterlist *cursg = cmd->cursg; |
213 | struct page *page; | 213 | struct page *page; |
214 | #ifdef CONFIG_HIGHMEM | 214 | #ifdef CONFIG_HIGHMEM |
215 | unsigned long flags; | 215 | unsigned long flags; |
@@ -217,14 +217,14 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, | |||
217 | unsigned int offset; | 217 | unsigned int offset; |
218 | u8 *buf; | 218 | u8 *buf; |
219 | 219 | ||
220 | cursg = hwif->cursg; | 220 | cursg = cmd->cursg; |
221 | if (!cursg) { | 221 | if (!cursg) { |
222 | cursg = sg; | 222 | cursg = sg; |
223 | hwif->cursg = sg; | 223 | cmd->cursg = sg; |
224 | } | 224 | } |
225 | 225 | ||
226 | page = sg_page(cursg); | 226 | page = sg_page(cursg); |
227 | offset = cursg->offset + hwif->cursg_ofs * SECTOR_SIZE; | 227 | offset = cursg->offset + cmd->cursg_ofs * SECTOR_SIZE; |
228 | 228 | ||
229 | /* get the current page and offset */ | 229 | /* get the current page and offset */ |
230 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 230 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
@@ -235,12 +235,12 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, | |||
235 | #endif | 235 | #endif |
236 | buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; | 236 | buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; |
237 | 237 | ||
238 | hwif->nleft--; | 238 | cmd->nleft--; |
239 | hwif->cursg_ofs++; | 239 | cmd->cursg_ofs++; |
240 | 240 | ||
241 | if ((hwif->cursg_ofs * SECTOR_SIZE) == cursg->length) { | 241 | if ((cmd->cursg_ofs * SECTOR_SIZE) == cursg->length) { |
242 | hwif->cursg = sg_next(hwif->cursg); | 242 | cmd->cursg = sg_next(cmd->cursg); |
243 | hwif->cursg_ofs = 0; | 243 | cmd->cursg_ofs = 0; |
244 | } | 244 | } |
245 | 245 | ||
246 | /* do the actual data transfer */ | 246 | /* do the actual data transfer */ |
@@ -260,7 +260,7 @@ static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd, | |||
260 | { | 260 | { |
261 | unsigned int nsect; | 261 | unsigned int nsect; |
262 | 262 | ||
263 | nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); | 263 | nsect = min_t(unsigned int, cmd->nleft, drive->mult_count); |
264 | while (nsect--) | 264 | while (nsect--) |
265 | ide_pio_sector(drive, cmd, write); | 265 | ide_pio_sector(drive, cmd, write); |
266 | } | 266 | } |
@@ -295,19 +295,18 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, | |||
295 | const char *s, u8 stat) | 295 | const char *s, u8 stat) |
296 | { | 296 | { |
297 | if (cmd->tf_flags & IDE_TFLAG_FS) { | 297 | if (cmd->tf_flags & IDE_TFLAG_FS) { |
298 | ide_hwif_t *hwif = drive->hwif; | 298 | int sectors = cmd->nsect - cmd->nleft; |
299 | int sectors = hwif->nsect - hwif->nleft; | ||
300 | 299 | ||
301 | switch (cmd->data_phase) { | 300 | switch (cmd->data_phase) { |
302 | case TASKFILE_IN: | 301 | case TASKFILE_IN: |
303 | if (hwif->nleft) | 302 | if (cmd->nleft) |
304 | break; | 303 | break; |
305 | /* fall through */ | 304 | /* fall through */ |
306 | case TASKFILE_OUT: | 305 | case TASKFILE_OUT: |
307 | sectors--; | 306 | sectors--; |
308 | break; | 307 | break; |
309 | case TASKFILE_MULTI_IN: | 308 | case TASKFILE_MULTI_IN: |
310 | if (hwif->nleft) | 309 | if (cmd->nleft) |
311 | break; | 310 | break; |
312 | /* fall through */ | 311 | /* fall through */ |
313 | case TASKFILE_MULTI_OUT: | 312 | case TASKFILE_MULTI_OUT: |
@@ -375,7 +374,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) | |||
375 | ide_pio_datablock(drive, cmd, 0); | 374 | ide_pio_datablock(drive, cmd, 0); |
376 | 375 | ||
377 | /* Are we done? Check status and finish transfer. */ | 376 | /* Are we done? Check status and finish transfer. */ |
378 | if (!hwif->nleft) { | 377 | if (cmd->nleft == 0) { |
379 | stat = wait_drive_not_busy(drive); | 378 | stat = wait_drive_not_busy(drive); |
380 | if (!OK_STAT(stat, 0, BAD_STAT)) | 379 | if (!OK_STAT(stat, 0, BAD_STAT)) |
381 | return task_error(drive, cmd, __func__, stat); | 380 | return task_error(drive, cmd, __func__, stat); |
@@ -402,10 +401,10 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) | |||
402 | return task_error(drive, cmd, __func__, stat); | 401 | return task_error(drive, cmd, __func__, stat); |
403 | 402 | ||
404 | /* Deal with unexpected ATA data phase. */ | 403 | /* Deal with unexpected ATA data phase. */ |
405 | if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft) | 404 | if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) |
406 | return task_error(drive, cmd, __func__, stat); | 405 | return task_error(drive, cmd, __func__, stat); |
407 | 406 | ||
408 | if (!hwif->nleft) { | 407 | if (cmd->nleft == 0) { |
409 | ide_finish_cmd(drive, cmd, stat); | 408 | ide_finish_cmd(drive, cmd, stat); |
410 | return ide_stopped; | 409 | return ide_stopped; |
411 | } | 410 | } |