diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:20 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:20 -0400 |
commit | 4453011f959a5f5c6c7a33aea54fe17f5e43a867 (patch) | |
tree | 7ac781ab8d82b21cdf932b1736026ebe9fea757a /drivers/ide | |
parent | 1cee52de28aa687760ad262ad0834d1bf6c6d2ac (diff) |
ide: destroy DMA mappings after ending DMA (v2)
Move ide_destroy_dmatable() call out from ->dma_end method to
{ide_pc,cdrom_newpc,ide_dma}_intr(), ide_dma_timeout_retry()
and sgiioc4_resetproc().
This causes minor/safe behavior changes w.r.t.:
* cmd64x.c::cmd64{8,x}_dma_end()
* cs5536.c::cs5536_dma_end()
* icside.c::icside_dma_end()
* it821x.c::it821x_dma_end()
* scc_pata.c::__scc_dma_end()
* sl82c105.c::sl82c105_dma_end()
* tx4939ide.c::tx4939ide_dma_end()
v2:
* Fix build for CONFIG_BLK_DEV_IDEDMA=n (reported by Randy Dunlap).
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/au1xxx-ide.c | 2 | ||||
-rw-r--r-- | drivers/ide/cmd64x.c | 2 | ||||
-rw-r--r-- | drivers/ide/icside.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-atapi.c | 7 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-dma-sff.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 3 | ||||
-rw-r--r-- | drivers/ide/ns87415.c | 2 | ||||
-rw-r--r-- | drivers/ide/pmac.c | 2 | ||||
-rw-r--r-- | drivers/ide/sc1200.c | 1 | ||||
-rw-r--r-- | drivers/ide/scc_pata.c | 2 | ||||
-rw-r--r-- | drivers/ide/sgiioc4.c | 2 | ||||
-rw-r--r-- | drivers/ide/trm290.c | 3 | ||||
-rw-r--r-- | drivers/ide/tx4939ide.c | 4 |
14 files changed, 12 insertions, 24 deletions
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 0c08c5e01f2a..ba2a211758a9 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
@@ -280,8 +280,6 @@ static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) | |||
280 | 280 | ||
281 | static int auide_dma_end(ide_drive_t *drive) | 281 | static int auide_dma_end(ide_drive_t *drive) |
282 | { | 282 | { |
283 | ide_destroy_dmatable(drive); | ||
284 | |||
285 | return 0; | 283 | return 0; |
286 | } | 284 | } |
287 | 285 | ||
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index f0a49d2ff711..f2edf280ef8b 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c | |||
@@ -327,8 +327,6 @@ static int cmd646_1_dma_end(ide_drive_t *drive) | |||
327 | outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD); | 327 | outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD); |
328 | /* clear the INTR & ERROR bits */ | 328 | /* clear the INTR & ERROR bits */ |
329 | outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS); | 329 | outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS); |
330 | /* and free any DMA resources */ | ||
331 | ide_destroy_dmatable(drive); | ||
332 | /* verify good DMA status */ | 330 | /* verify good DMA status */ |
333 | return (dma_stat & 7) != 4; | 331 | return (dma_stat & 7) != 4; |
334 | } | 332 | } |
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index f069f122ee6e..9bf57d7c8e57 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c | |||
@@ -291,9 +291,6 @@ static int icside_dma_end(ide_drive_t *drive) | |||
291 | 291 | ||
292 | disable_dma(ec->dma); | 292 | disable_dma(ec->dma); |
293 | 293 | ||
294 | /* Teardown mappings after DMA has completed. */ | ||
295 | ide_destroy_dmatable(drive); | ||
296 | |||
297 | return get_dma_residue(ec->dma) != 0; | 294 | return get_dma_residue(ec->dma) != 0; |
298 | } | 295 | } |
299 | 296 | ||
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f591166d2c93..1481f71f8173 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -342,8 +342,11 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
342 | stat = tp_ops->read_status(hwif); | 342 | stat = tp_ops->read_status(hwif); |
343 | 343 | ||
344 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { | 344 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
345 | if (hwif->dma_ops->dma_end(drive) || | 345 | int rc = hwif->dma_ops->dma_end(drive); |
346 | (drive->media == ide_tape && (stat & ATA_ERR))) { | 346 | |
347 | ide_destroy_dmatable(drive); | ||
348 | |||
349 | if (rc || (drive->media == ide_tape && (stat & ATA_ERR))) { | ||
347 | if (drive->media == ide_floppy) | 350 | if (drive->media == ide_floppy) |
348 | printk(KERN_ERR "%s: DMA %s error\n", | 351 | printk(KERN_ERR "%s: DMA %s error\n", |
349 | drive->name, rq_data_dir(pc->rq) | 352 | drive->name, rq_data_dir(pc->rq) |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 5319e7a73708..4a0d66ee9547 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -639,6 +639,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
639 | if (dma) { | 639 | if (dma) { |
640 | drive->dma = 0; | 640 | drive->dma = 0; |
641 | dma_error = hwif->dma_ops->dma_end(drive); | 641 | dma_error = hwif->dma_ops->dma_end(drive); |
642 | ide_destroy_dmatable(drive); | ||
642 | if (dma_error) { | 643 | if (dma_error) { |
643 | printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name, | 644 | printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name, |
644 | write ? "write" : "read"); | 645 | write ? "write" : "read"); |
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 7836d7e03fff..f8adbb5eb339 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c | |||
@@ -310,8 +310,6 @@ int ide_dma_end(ide_drive_t *drive) | |||
310 | /* clear INTR & ERROR bits */ | 310 | /* clear INTR & ERROR bits */ |
311 | ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR); | 311 | ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR); |
312 | 312 | ||
313 | /* purge DMA mappings */ | ||
314 | ide_destroy_dmatable(drive); | ||
315 | wmb(); | 313 | wmb(); |
316 | 314 | ||
317 | /* verify good DMA status */ | 315 | /* verify good DMA status */ |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 4e2005071113..b430898bbcd6 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -92,6 +92,7 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) | |||
92 | u8 stat = 0, dma_stat = 0; | 92 | u8 stat = 0, dma_stat = 0; |
93 | 93 | ||
94 | dma_stat = hwif->dma_ops->dma_end(drive); | 94 | dma_stat = hwif->dma_ops->dma_end(drive); |
95 | ide_destroy_dmatable(drive); | ||
95 | stat = hwif->tp_ops->read_status(hwif); | 96 | stat = hwif->tp_ops->read_status(hwif); |
96 | 97 | ||
97 | if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { | 98 | if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { |
@@ -479,6 +480,7 @@ ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) | |||
479 | if (error < 0) { | 480 | if (error < 0) { |
480 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); | 481 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); |
481 | (void)dma_ops->dma_end(drive); | 482 | (void)dma_ops->dma_end(drive); |
483 | ide_destroy_dmatable(drive); | ||
482 | ret = ide_error(drive, "dma timeout error", | 484 | ret = ide_error(drive, "dma timeout error", |
483 | hwif->tp_ops->read_status(hwif)); | 485 | hwif->tp_ops->read_status(hwif)); |
484 | } else { | 486 | } else { |
@@ -490,6 +492,7 @@ ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) | |||
490 | ide_dump_status(drive, "DMA timeout", | 492 | ide_dump_status(drive, "DMA timeout", |
491 | hwif->tp_ops->read_status(hwif)); | 493 | hwif->tp_ops->read_status(hwif)); |
492 | (void)dma_ops->dma_end(drive); | 494 | (void)dma_ops->dma_end(drive); |
495 | ide_destroy_dmatable(drive); | ||
493 | } | 496 | } |
494 | } | 497 | } |
495 | 498 | ||
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index 9039a373020f..9ad71a74f93f 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c | |||
@@ -210,8 +210,6 @@ static int ns87415_dma_end(ide_drive_t *drive) | |||
210 | /* from ERRATA: clear the INTR & ERROR bits */ | 210 | /* from ERRATA: clear the INTR & ERROR bits */ |
211 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); | 211 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); |
212 | outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD); | 212 | outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD); |
213 | /* and free any DMA resources */ | ||
214 | ide_destroy_dmatable(drive); | ||
215 | /* verify good DMA status */ | 213 | /* verify good DMA status */ |
216 | return (dma_stat & 7) != 4; | 214 | return (dma_stat & 7) != 4; |
217 | } | 215 | } |
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index d15cc46a66e3..5643a8b957bf 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c | |||
@@ -1562,8 +1562,6 @@ pmac_ide_dma_end (ide_drive_t *drive) | |||
1562 | dstat = readl(&dma->status); | 1562 | dstat = readl(&dma->status); |
1563 | writel(((RUN|WAKE|DEAD) << 16), &dma->control); | 1563 | writel(((RUN|WAKE|DEAD) << 16), &dma->control); |
1564 | 1564 | ||
1565 | ide_destroy_dmatable(drive); | ||
1566 | |||
1567 | /* verify good dma status. we don't check for ACTIVE beeing 0. We should... | 1565 | /* verify good dma status. we don't check for ACTIVE beeing 0. We should... |
1568 | * in theory, but with ATAPI decices doing buffer underruns, that would | 1566 | * in theory, but with ATAPI decices doing buffer underruns, that would |
1569 | * cause us to disable DMA, which isn't what we want | 1567 | * cause us to disable DMA, which isn't what we want |
diff --git a/drivers/ide/sc1200.c b/drivers/ide/sc1200.c index 371549d18a01..d9c47034bedd 100644 --- a/drivers/ide/sc1200.c +++ b/drivers/ide/sc1200.c | |||
@@ -184,7 +184,6 @@ static int sc1200_dma_end(ide_drive_t *drive) | |||
184 | outb(inb(dma_base)&~1, dma_base); /* !! DO THIS HERE !! stop DMA */ | 184 | outb(inb(dma_base)&~1, dma_base); /* !! DO THIS HERE !! stop DMA */ |
185 | 185 | ||
186 | drive->waiting_for_dma = 0; | 186 | drive->waiting_for_dma = 0; |
187 | ide_destroy_dmatable(drive); /* purge DMA mappings */ | ||
188 | 187 | ||
189 | return (dma_stat & 7) != 4; /* verify good DMA status */ | 188 | return (dma_stat & 7) != 4; /* verify good DMA status */ |
190 | } | 189 | } |
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 64534d150b0c..693536ebe331 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c | |||
@@ -365,8 +365,6 @@ static int __scc_dma_end(ide_drive_t *drive) | |||
365 | dma_stat = scc_dma_sff_read_status(hwif); | 365 | dma_stat = scc_dma_sff_read_status(hwif); |
366 | /* clear the INTR & ERROR bits */ | 366 | /* clear the INTR & ERROR bits */ |
367 | scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); | 367 | scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); |
368 | /* purge DMA mappings */ | ||
369 | ide_destroy_dmatable(drive); | ||
370 | /* verify good DMA status */ | 368 | /* verify good DMA status */ |
371 | wmb(); | 369 | wmb(); |
372 | return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; | 370 | return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; |
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index 44df0c750bab..457a762a1f29 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c | |||
@@ -259,7 +259,6 @@ static int sgiioc4_dma_end(ide_drive_t *drive) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | drive->waiting_for_dma = 0; | 261 | drive->waiting_for_dma = 0; |
262 | ide_destroy_dmatable(drive); | ||
263 | 262 | ||
264 | return dma_stat; | 263 | return dma_stat; |
265 | } | 264 | } |
@@ -284,6 +283,7 @@ static void | |||
284 | sgiioc4_resetproc(ide_drive_t * drive) | 283 | sgiioc4_resetproc(ide_drive_t * drive) |
285 | { | 284 | { |
286 | sgiioc4_dma_end(drive); | 285 | sgiioc4_dma_end(drive); |
286 | ide_destroy_dmatable(drive); | ||
287 | sgiioc4_clearirq(drive); | 287 | sgiioc4_clearirq(drive); |
288 | } | 288 | } |
289 | 289 | ||
diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c index d6a950828e9f..8dd3d8226870 100644 --- a/drivers/ide/trm290.c +++ b/drivers/ide/trm290.c | |||
@@ -216,8 +216,7 @@ static int trm290_dma_end(ide_drive_t *drive) | |||
216 | u16 status; | 216 | u16 status; |
217 | 217 | ||
218 | drive->waiting_for_dma = 0; | 218 | drive->waiting_for_dma = 0; |
219 | /* purge DMA mappings */ | 219 | |
220 | ide_destroy_dmatable(drive); | ||
221 | status = inw(drive->hwif->dma_base + 2); | 220 | status = inw(drive->hwif->dma_base + 2); |
222 | 221 | ||
223 | return status != 0x00ff; | 222 | return status != 0x00ff; |
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 53f99853b065..f62ced855cf3 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -335,11 +335,9 @@ static int tx4939ide_dma_end(ide_drive_t *drive) | |||
335 | /* read and clear the INTR & ERROR bits */ | 335 | /* read and clear the INTR & ERROR bits */ |
336 | dma_stat = tx4939ide_clear_dma_status(base); | 336 | dma_stat = tx4939ide_clear_dma_status(base); |
337 | 337 | ||
338 | /* purge DMA mappings */ | ||
339 | ide_destroy_dmatable(drive); | ||
340 | /* verify good DMA status */ | ||
341 | wmb(); | 338 | wmb(); |
342 | 339 | ||
340 | /* verify good DMA status */ | ||
343 | if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && | 341 | if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && |
344 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == | 342 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == |
345 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) | 343 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) |