ide: DMA methods cleanups/sanitizations
cover ide: DMA methods cleanups/sanitizations
Sanitizations of DMA methods and related cleanups (~100 LOC gone)...
[ on top of pata-2.6 tree + http://lkml.org/lkml/2009/2/18/257 ]
diffstat:
drivers/ide/alim15x3.c | 10 ++-- drivers/ide/au1xxx-ide.c | 17 ------ drivers/ide/cmd64x.c | 6 -- drivers/ide/cs5536.c | 1 drivers/ide/hpt366.c | 10 ---- drivers/ide/icside.c | 8 --- drivers/ide/ide-atapi.c | 31 +++++------- drivers/ide/ide-cd.c | 4 + drivers/ide/ide-dma-sff.c | 10 ---- drivers/ide/ide-dma.c | 112 +++++++++++++++++++++++++-------------------- drivers/ide/ide-taskfile.c | 4 - drivers/ide/it821x.c | 3 - drivers/ide/ns87415.c | 28 ++++------- drivers/ide/pdc202xx_old.c | 10 ---- drivers/ide/pmac.c | 12 ---- drivers/ide/sc1200.c | 4 - drivers/ide/scc_pata.c | 10 ---- drivers/ide/sgiioc4.c | 19 ++----- drivers/ide/siimage.c | 1 drivers/ide/sl82c105.c | 7 +- drivers/ide/tc86c001.c | 1 drivers/ide/trm290.c | 41 +++++++--------- drivers/ide/tx4939ide.c | 15 ------ include/linux/ide.h | 15 +++--- 24 files changed, 144 insertions(+), 235 deletions(-)
PATCH 1/10 ide: add ->dma_clear method and remove ->dma_timeout one
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add ->dma_clear method and remove ->dma_timeout one
All custom ->dma_timeout implementations call the generic one thus it is possible to have only an optional method for resetting DMA engine instead:
* Add ->dma_clear method and convert hpt366, pdc202xx_old and sl82c105 host drivers to use it.
* Always use ide_dma_timeout() in ide_dma_timeout_retry() and remove ->dma_timeout method.
* Make ide_dma_timeout() static.
There should be no functional changes caused by this patch.
--- drivers/ide/alim15x3.c | 1 - drivers/ide/au1xxx-ide.c | 1 - drivers/ide/cmd64x.c | 3 --- drivers/ide/cs5536.c | 1 - drivers/ide/hpt366.c | 10 +--------- drivers/ide/icside.c | 1 - drivers/ide/ide-dma-sff.c | 3 +-- drivers/ide/ide-dma.c | 10 ++++++---- drivers/ide/it821x.c | 3 +-- drivers/ide/ns87415.c | 1 - drivers/ide/pdc202xx_old.c | 10 ++-------- drivers/ide/pmac.c | 1 - drivers/ide/sc1200.c | 1 - drivers/ide/scc_pata.c | 1 - drivers/ide/sgiioc4.c | 1 - drivers/ide/siimage.c | 1 - drivers/ide/sl82c105.c | 7 +++---- drivers/ide/tc86c001.c | 1 - drivers/ide/trm290.c | 1 - drivers/ide/tx4939ide.c | 1 - include/linux/ide.h | 4 ++-- 21 files changed, 16 insertions(+), 47 deletions(-)
drivers/ide/alim15x3.c +0 -1
@@ -509,7 +509,6 @@ static const struct ide_dma_ops ali_dma_ .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/au1xxx-ide.c +0 -1
@@ -353,7 +353,6 @@ static const struct ide_dma_ops au1xxx_d .dma_end = auide_dma_end, .dma_test_irq = auide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, - .dma_timeout = ide_dma_timeout, };static int auide_ddma_init (ide_hwif_t *hwif,const struct ide_port_info *d)
drivers/ide/cmd64x.c +0 -3
@@ -384,7 +384,6 @@ static const struct ide_dma_ops cmd64x_d .dma_test_irq = cmd64x_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
@@ -396,7 +395,6 @@ static const struct ide_dma_ops cmd646_r .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
@@ -408,7 +406,6 @@ static const struct ide_dma_ops cmd648_d .dma_test_irq = cmd648_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/cs5536.c +0 -1
@@ -236,7 +236,6 @@ static const struct ide_dma_ops cs5536_d .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, };static const struct ide_port_info cs5536_info = {
drivers/ide/hpt366.c +1 -9
@@ -835,12 +835,6 @@ static int hpt370_dma_end(ide_drive_t *dreturn ide_dma_end (drive); } -static void hpt370_dma_timeout (ide_drive_t *drive) -{ -hpt370_irq_timeout (drive); -ide_dma_timeout (drive); -} -/* returns 1 if DMA IRQ issued, 0 otherwise */ static int hpt374_dma_test_irq (ide_drive_t *drive) {
@@ -1423,7 +1417,6 @@ static const struct ide_dma_ops hpt37x_d .dma_test_irq = hpt374_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
@@ -1435,7 +1428,7 @@ static const struct ide_dma_ops hpt370_d .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = hpt370_dma_timeout, + .dma_clear = hpt370_irq_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
@@ -1447,7 +1440,6 @@ static const struct ide_dma_ops hpt36x_d .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = hpt366_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/icside.c +0 -1
@@ -377,7 +377,6 @@ static const struct ide_dma_ops icside_v .dma_start = icside_dma_start, .dma_end = icside_dma_end, .dma_test_irq = icside_dma_test_irq, - .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, };#else
drivers/ide/ide-dma-sff.c +1 -2
@@ -338,9 +338,8 @@ const struct ide_dma_ops sff_dma_ops = { .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = ide_dma_test_irq, - .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_sff_read_status = ide_dma_sff_read_status, };EXPORT_SYMBOL_GPL (sff_dma_ops);
drivers/ide/ide-dma.c +6 -4
@@ -456,7 +456,7 @@ void ide_dma_lost_irq(ide_drive_t *drive }EXPORT_SYMBOL_GPL (ide_dma_lost_irq); -void ide_dma_timeout (ide_drive_t *drive) +static void ide_dma_timeout (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif;
@@ -469,7 +469,6 @@ void ide_dma_timeout(ide_drive_t *drive) hwif->dma_ops->dma_end (drive); } -EXPORT_SYMBOL_GPL (ide_dma_timeout);/* * un-busy the port etc, and clear any pending DMA status. we want to
@@ -479,6 +478,7 @@ EXPORT_SYMBOL_GPL(ide_dma_timeout);ide_startstop_t ide_dma_timeout_retry (ide_drive_t *drive,int error) {ide_hwif_t *hwif = drive->hwif; +const struct ide_dma_ops *dma_ops = hwif->dma_ops;struct request *rq;ide_startstop_t ret = ide_stopped;
@@ -488,12 +488,14 @@ ide_startstop_t ide_dma_timeout_retry(idif (error <0 ) {printk (KERN_WARNING "%s: DMA timeout error\n" , drive->name); - (void )hwif->dma_ops->dma_end (drive); + (void )dma_ops->dma_end (drive); ret =ide_error (drive,"dma timeout error" , hwif->tp_ops->read_status (hwif)); }else {printk (KERN_WARNING "%s: DMA timeout retry\n" , drive->name); - hwif->dma_ops->dma_timeout (drive); +if (dma_ops->dma_clear) + dma_ops->dma_clear (drive); +ide_dma_timeout (drive); }/*
drivers/ide/it821x.c +1 -2
@@ -512,9 +512,8 @@ static struct ide_dma_ops it821x_pass_th .dma_start = it821x_dma_start, .dma_end = it821x_dma_end, .dma_test_irq = ide_dma_test_irq, - .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/ns87415.c +0 -1
@@ -306,7 +306,6 @@ static const struct ide_dma_ops ns87415_ .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = superio_dma_sff_read_status, };
drivers/ide/pdc202xx_old.c +2 -8
@@ -258,12 +258,6 @@ static void pdc202xx_dma_lost_irq(ide_dride_dma_lost_irq (drive); } -static void pdc202xx_dma_timeout (ide_drive_t *drive) -{ -pdc202xx_reset (drive); -ide_dma_timeout (drive); -} -static int init_chipset_pdc202xx (struct pci_dev *dev) {unsigned long dmabase =pci_resource_start (dev,4 );
@@ -336,7 +330,7 @@ static const struct ide_dma_ops pdc20246 .dma_test_irq = pdc202xx_dma_test_irq, .dma_lost_irq = pdc202xx_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = pdc202xx_dma_timeout, + .dma_clear = pdc202xx_reset, .dma_sff_read_status = ide_dma_sff_read_status, };
@@ -348,7 +342,7 @@ static const struct ide_dma_ops pdc2026x .dma_test_irq = pdc202xx_dma_test_irq, .dma_lost_irq = pdc202xx_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = pdc202xx_dma_timeout, + .dma_clear = pdc202xx_reset, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/pmac.c +0 -1
@@ -1650,7 +1650,6 @@ static const struct ide_dma_ops pmac_dma .dma_start = pmac_ide_dma_start, .dma_end = pmac_ide_dma_end, .dma_test_irq = pmac_ide_dma_test_irq, - .dma_timeout = ide_dma_timeout, .dma_lost_irq = pmac_ide_dma_lost_irq, };
drivers/ide/sc1200.c +0 -1
@@ -291,7 +291,6 @@ static const struct ide_dma_ops sc1200_d .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/scc_pata.c +0 -1
@@ -872,7 +872,6 @@ static const struct ide_dma_ops scc_dma_ .dma_end = scc_dma_end, .dma_test_irq = scc_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, - .dma_timeout = ide_dma_timeout, .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_sff_read_status = scc_dma_sff_read_status, };
drivers/ide/sgiioc4.c +0 -1
@@ -533,7 +533,6 @@ static const struct ide_dma_ops sgiioc4_ .dma_end = sgiioc4_dma_end, .dma_test_irq = sgiioc4_dma_test_irq, .dma_lost_irq = sgiioc4_dma_lost_irq, - .dma_timeout = ide_dma_timeout, };static const struct ide_port_info sgiioc4_port_info__devinitconst = {
drivers/ide/siimage.c +0 -1
@@ -715,7 +715,6 @@ static const struct ide_dma_ops sil_dma_ .dma_end = ide_dma_end, .dma_test_irq = siimage_dma_test_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/sl82c105.c +3 -4
@@ -189,14 +189,13 @@ static void sl82c105_dma_start(ide_driveide_dma_start (drive); } -static void sl82c105_dma_timeout (ide_drive_t *drive) +static void sl82c105_dma_clear (ide_drive_t *drive) {struct pci_dev *dev =to_pci_dev (drive->hwif->dev); -DBG (("sl82c105_dma_timeout(drive:%s)\n" , drive->name)); +DBG (("sl82c105_dma_clear(drive:%s)\n" , drive->name));sl82c105_reset_host (dev); -ide_dma_timeout (drive); }static int sl82c105_dma_end (ide_drive_t *drive)
@@ -298,7 +297,7 @@ static const struct ide_dma_ops sl82c105 .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = sl82c105_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = sl82c105_dma_timeout, + .dma_clear = sl82c105_dma_clear, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/tc86c001.c +0 -1
@@ -187,7 +187,6 @@ static const struct ide_dma_ops tc86c001 .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/trm290.c +0 -1
@@ -314,7 +314,6 @@ static struct ide_dma_ops trm290_dma_ops .dma_end = trm290_dma_end, .dma_test_irq = trm290_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, - .dma_timeout = ide_dma_timeout, };static const struct ide_port_info trm290_chipset__devinitdata = {
drivers/ide/tx4939ide.c +0 -1
@@ -632,7 +632,6 @@ static const struct ide_dma_ops tx4939id .dma_test_irq = tx4939ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_timeout = ide_dma_timeout, .dma_sff_read_status = tx4939ide_dma_sff_read_status, };
include/linux/ide.h +2 -2
@@ -715,8 +715,9 @@ struct ide_dma_ops {int (*dma_end)(struct ide_drive_s *);int (*dma_test_irq)(struct ide_drive_s *);void (*dma_lost_irq)(struct ide_drive_s *); +/* below ones are optional */ int (*dma_timer_expiry)(struct ide_drive_s *); -void (*dma_timeout)(struct ide_drive_s *); +void (*dma_clear)(struct ide_drive_s *);/* * The following method is optional and only required to be * implemented for the SFF-8038i compatible controllers.
@@ -1458,7 +1459,6 @@ static inline int config_drive_for_dma(i#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ void ide_dma_lost_irq (ide_drive_t *); -void ide_dma_timeout (ide_drive_t *);ide_startstop_t ide_dma_timeout_retry (ide_drive_t *,int );#else
PATCH 3/10 ide: destroy DMA mappings after ending DMA
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: destroy DMA mappings after ending DMA
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()
--- drivers/ide/au1xxx-ide.c | 2 -- drivers/ide/cmd64x.c | 2 -- drivers/ide/icside.c | 3 --- drivers/ide/ide-atapi.c | 7 +++++-- drivers/ide/ide-cd.c | 1 + drivers/ide/ide-dma-sff.c | 2 -- drivers/ide/ide-dma.c | 3 +++ drivers/ide/ns87415.c | 2 -- drivers/ide/pmac.c | 2 -- drivers/ide/sc1200.c | 1 - drivers/ide/scc_pata.c | 2 -- drivers/ide/sgiioc4.c | 2 +- drivers/ide/trm290.c | 3 +-- drivers/ide/tx4939ide.c | 4 +--- 14 files changed, 12 insertions(+), 24 deletions(-)
drivers/ide/au1xxx-ide.c +0 -2
@@ -280,8 +280,6 @@ static int auide_build_dmatable(ide_drivstatic int auide_dma_end (ide_drive_t *drive) { -ide_destroy_dmatable (drive); -return 0 ; }
drivers/ide/cmd64x.c +0 -2
@@ -327,8 +327,6 @@ static int cmd646_1_dma_end(ide_drive_toutb (dma_cmd & ~1 , hwif->dma_base +ATA_DMA_CMD );/* clear the INTR & ERROR bits */ outb (dma_stat |6 , hwif->dma_base +ATA_DMA_STATUS ); -/* and free any DMA resources */ -ide_destroy_dmatable (drive);/* verify good DMA status */ return (dma_stat &7 ) !=4 ; }
drivers/ide/icside.c +0 -3
@@ -291,9 +291,6 @@ static int icside_dma_end(ide_drive_t *ddisable_dma (ec->dma); -/* Teardown mappings after DMA has completed. */ -ide_destroy_dmatable (drive); -return get_dma_residue (ec->dma) !=0 ; }
drivers/ide/ide-atapi.c +5 -2
@@ -322,8 +322,11 @@ static ide_startstop_t ide_pc_intr(ide_d stat = tp_ops->read_status (hwif);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { -if (hwif->dma_ops->dma_end (drive) || - (drive->media == ide_tape && (stat &ATA_ERR ))) { +int rc = hwif->dma_ops->dma_end (drive); + +ide_destroy_dmatable (drive); + +if (rc || (drive->media == ide_tape && (stat &ATA_ERR ))) {if (drive->media == ide_floppy)printk (KERN_ERR "%s: DMA %s error\n" , drive->name, rq_data_dir(pc->rq)
drivers/ide/ide-cd.c +1 -0
@@ -639,6 +639,7 @@ static ide_startstop_t cdrom_newpc_intr(if (dma) { drive->dma =0 ; dma_error = hwif->dma_ops->dma_end (drive); +ide_destroy_dmatable (drive);if (dma_error) { printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name, write ? "write" : "read");
drivers/ide/ide-dma-sff.c +0 -2
@@ -310,8 +310,6 @@ int ide_dma_end(ide_drive_t *drive)/* clear INTR & ERROR bits */ ide_dma_sff_write_status (hwif, dma_stat |ATA_DMA_ERR |ATA_DMA_INTR ); -/* purge DMA mappings */ -ide_destroy_dmatable (drive);wmb ();/* verify good DMA status */
drivers/ide/ide-dma.c +3 -0
@@ -92,6 +92,7 @@ ide_startstop_t ide_dma_intr(ide_drive_tu8 stat =0 , dma_stat =0 ; dma_stat = hwif->dma_ops->dma_end (drive); +ide_destroy_dmatable (drive); stat = hwif->tp_ops->read_status (hwif);if (OK_STAT (stat,DRIVE_READY , drive->bad_wstat |ATA_DRQ )) {
@@ -475,6 +476,7 @@ ide_startstop_t ide_dma_timeout_retry(idif (error <0 ) {printk (KERN_WARNING "%s: DMA timeout error\n" , drive->name); (void )dma_ops->dma_end (drive); +ide_destroy_dmatable (drive); ret =ide_error (drive,"dma timeout error" , hwif->tp_ops->read_status (hwif)); }else {
@@ -486,6 +488,7 @@ ide_startstop_t ide_dma_timeout_retry(idide_dump_status (drive,"DMA timeout" , hwif->tp_ops->read_status (hwif)); (void )dma_ops->dma_end (drive); +ide_destroy_dmatable (drive); } }
drivers/ide/ns87415.c +0 -2
@@ -210,8 +210,6 @@ static int ns87415_dma_end(ide_drive_t */* from ERRATA: clear the INTR & ERROR bits */ dma_cmd =inb (hwif->dma_base +ATA_DMA_CMD );outb (dma_cmd |6 , hwif->dma_base +ATA_DMA_CMD ); -/* and free any DMA resources */ -ide_destroy_dmatable (drive);/* verify good DMA status */ return (dma_stat &7 ) !=4 ; }
drivers/ide/pmac.c +0 -2
@@ -1562,8 +1562,6 @@ pmac_ide_dma_end (ide_drive_t *drive) dstat =readl (&dma->status);writel (((RUN |WAKE |DEAD ) <<16 ), &dma->control); -ide_destroy_dmatable (drive); -/* verify good dma status. we don't check for ACTIVE beeing 0. We should... * in theory, but with ATAPI decices doing buffer underruns, that would * cause us to disable DMA, which isn't what we want
drivers/ide/sc1200.c +0 -1
@@ -184,7 +184,6 @@ static int sc1200_dma_end(ide_drive_t *doutb (inb (dma_base)&~1 , dma_base);/* !! DO THIS HERE !! stop DMA */ drive->waiting_for_dma =0 ; -ide_destroy_dmatable (drive);/* purge DMA mappings */ return (dma_stat &7 ) !=4 ;/* verify good DMA status */ }
drivers/ide/scc_pata.c +0 -2
@@ -365,8 +365,6 @@ static int __scc_dma_end(ide_drive_t *dr dma_stat =scc_dma_sff_read_status (hwif);/* clear the INTR & ERROR bits */ scc_ide_outb (dma_stat |6 , hwif->dma_base +4 ); -/* purge DMA mappings */ -ide_destroy_dmatable (drive);/* verify good DMA status */ wmb ();return (dma_stat &7 ) !=4 ? (0x10 | dma_stat) :0 ;
drivers/ide/sgiioc4.c +1 -1
@@ -259,7 +259,6 @@ static int sgiioc4_dma_end(ide_drive_t * } drive->waiting_for_dma =0 ; -ide_destroy_dmatable (drive);return dma_stat; }
@@ -284,6 +283,7 @@ static void sgiioc4_resetproc(ide_drive_t * drive) {sgiioc4_dma_end (drive); +ide_destroy_dmatable (drive);sgiioc4_clearirq (drive); }
drivers/ide/trm290.c +1 -2
@@ -216,8 +216,7 @@ static int trm290_dma_end(ide_drive_t *du16 status; drive->waiting_for_dma =0 ; -/* purge DMA mappings */ -ide_destroy_dmatable (drive); + status =inw (drive->hwif->dma_base +2 );return status !=0x00ff ;
drivers/ide/tx4939ide.c +1 -3
@@ -335,11 +335,9 @@ static int tx4939ide_dma_end(ide_drive_t/* read and clear the INTR & ERROR bits */ dma_stat =tx4939ide_clear_dma_status (base); -/* purge DMA mappings */ -ide_destroy_dmatable (drive); -/* verify good DMA status */ wmb (); +/* verify good DMA status */ if ((dma_stat & (ATA_DMA_INTR |ATA_DMA_ERR |ATA_DMA_ACTIVE )) ==0 && (ctl & (TX4939IDE_INT_XFEREND |TX4939IDE_INT_HOST )) == (TX4939IDE_INT_XFEREND |TX4939IDE_INT_HOST ))
PATCH 4/10 ide: add ide_dma_prepare() helper
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add ide_dma_prepare() helper
* Add ide_dma_prepare() helper.
* Convert ide_issue_pc() and do_rw_taskfile() to use it.
* Make ide_build_sglist() static.
There should be no functional changes caused by this patch.
--- drivers/ide/ide-atapi.c | 18 ++++-------------- drivers/ide/ide-dma.c | 11 ++++++++++- drivers/ide/ide-taskfile.c | 4 +--- include/linux/ide.h | 7 ++++--- 4 files changed, 19 insertions(+), 21 deletions(-)
drivers/ide/ide-atapi.c +4 -14
@@ -605,7 +605,6 @@ ide_startstop_t ide_issue_pc(ide_drive_t {struct ide_atapi_pc *pc;ide_hwif_t *hwif = drive->hwif; -const struct ide_dma_ops *dma_ops = hwif->dma_ops;ide_expiry_t *expiry =NULL ;struct request *rq = hwif->rq;unsigned int timeout;
@@ -619,12 +618,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t expiry = ide_cd_expiry; timeout =ATAPI_WAIT_PC ; -if (drive->dma) { -if (ide_build_sglist (drive, cmd)) - drive->dma = !dma_ops->dma_setup (drive, cmd); -else - drive->dma =0 ; - } +if (drive->dma) + drive->dma = !ide_dma_prepare (drive, cmd); }else { pc = drive->pc;
@@ -642,13 +637,8 @@ ide_startstop_t ide_issue_pc(ide_drive_tide_dma_off (drive); } -if ((pc->flags &PC_FLAG_DMA_OK ) && - (drive->dev_flags &IDE_DFLAG_USING_DMA )) { -if (ide_build_sglist (drive, cmd)) - drive->dma = !dma_ops->dma_setup (drive, cmd); -else - drive->dma =0 ; - } +if (pc->flags &PC_FLAG_DMA_OK ) + drive->dma = !ide_dma_prepare (drive, cmd);if (!drive->dma) pc->flags &= ~PC_FLAG_DMA_OK ;
drivers/ide/ide-dma.c +10 -1
@@ -128,7 +128,7 @@ int ide_dma_good_drive(ide_drive_t *driv* operate in a portable fashion. */ -int ide_build_sglist (ide_drive_t *drive,struct ide_cmd *cmd) +static int ide_build_sglist (ide_drive_t *drive,struct ide_cmd *cmd) {ide_hwif_t *hwif = drive->hwif;struct scatterlist *sg = hwif->sg_table;
@@ -559,3 +559,12 @@ int ide_allocate_dma_engine(ide_hwif_t *return 0 ; }EXPORT_SYMBOL_GPL (ide_allocate_dma_engine); + +int ide_dma_prepare (ide_drive_t *drive,struct ide_cmd *cmd) +{ +if ((drive->dev_flags &IDE_DFLAG_USING_DMA ) ==0 || +ide_build_sglist (drive, cmd) ==0 || + drive->hwif->dma_ops->dma_setup (drive, cmd)) +return 1 ; +return 0 ; +}
drivers/ide/ide-taskfile.c +1 -3
@@ -100,9 +100,7 @@ ide_startstop_t do_rw_taskfile(ide_driveide_execute_command (drive, cmd, handler,WAIT_WORSTCASE );return ide_started;case ATA_PROT_DMA : -if ((drive->dev_flags &IDE_DFLAG_USING_DMA ) ==0 || -ide_build_sglist (drive, cmd) ==0 || - dma_ops->dma_setup (drive, cmd)) +if (ide_dma_prepare (drive, cmd))return ide_stopped; hwif->expiry = dma_ops->dma_timer_expiry;ide_execute_command (drive, cmd, ide_dma_intr,2 *WAIT_CMD );
include/linux/ide.h +4 -3
@@ -1440,7 +1440,8 @@ ide_startstop_t ide_dma_intr(ide_drive_tint ide_allocate_dma_engine (ide_hwif_t *);void ide_release_dma_engine (ide_hwif_t *); -int ide_build_sglist (ide_drive_t *,struct ide_cmd *); +int ide_dma_prepare (ide_drive_t *,struct ide_cmd *); +void ide_destroy_dmatable (ide_drive_t *);#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
@@ -1474,8 +1475,8 @@ static inline void ide_check_dma_crc(idestatic inline ide_startstop_t ide_dma_intr (ide_drive_t *drive) {return ide_stopped; }static inline ide_startstop_t ide_dma_timeout_retry (ide_drive_t *drive,int error) {return ide_stopped; }static inline void ide_release_dma_engine (ide_hwif_t *hwif) { ; } -static inline int ide_build_sglist (ide_drive_t *drive, -struct ide_cmd *cmd) {return 0 ; } +static int ide_dma_prepare (ide_drive_t *drive, +struct ide_cmd *cmd) {return 1 ; }#endif /* CONFIG_BLK_DEV_IDEDMA */ #ifdef CONFIG_BLK_DEV_IDEACPI
PATCH 5/10 ns87415: use custom ->dma_{start,end} to handle ns87415_prepare_drive()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ns87415: use custom ->dma_{start,end} to handle ns87415_prepare_drive()
Use custom ->dma_{start,end} methods to handle ns87415_prepare_drive() there instead of in ->dma_setup method.
--- drivers/ide/ns87415.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/ide/ns87415.c +11 -13
@@ -196,6 +196,12 @@ static void ns87415_selectproc (ide_driv !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); } +static void ns87415_dma_start (ide_drive_t *drive) +{ +ns87415_prepare_drive (drive,1 ); +ide_dma_start (drive); +} +static int ns87415_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif;
@@ -210,19 +216,11 @@ static int ns87415_dma_end(ide_drive_t */* from ERRATA: clear the INTR & ERROR bits */ dma_cmd =inb (hwif->dma_base +ATA_DMA_CMD );outb (dma_cmd |6 , hwif->dma_base +ATA_DMA_CMD ); -/* verify good DMA status */ -return (dma_stat &7 ) !=4 ; -} -static int ns87415_dma_setup (ide_drive_t *drive,struct ide_cmd *cmd) -{ -/* select DMA xfer */ -ns87415_prepare_drive (drive,1 ); -if (ide_dma_setup (drive, cmd) ==0 ) -return 0 ; -/* DMA failed: select PIO xfer */ ns87415_prepare_drive (drive,0 ); -return 1 ; + +/* verify good DMA status */ +return (dma_stat &7 ) !=4 ; }static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
@@ -298,8 +296,8 @@ static const struct ide_port_ops ns87415static const struct ide_dma_ops ns87415_dma_ops = { .dma_host_set = ide_dma_host_set, - .dma_setup = ns87415_dma_setup, - .dma_start = ide_dma_start, + .dma_setup = ide_dma_setup, + .dma_start = ns87415_dma_start, .dma_end = ns87415_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq,
PATCH 6/10 trm290: use custom ->dma_{start,end} to handle trm290_prepare_drive()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] trm290: use custom ->dma_{start,end} to handle trm290_prepare_drive()
Use custom ->dma_{start,end} methods to handle trm290_prepare_drive() there instead of in ->dma_setup method.
There should be no functional changes caused by this patch (DMA support is disabled currently in trm290.c).
--- drivers/ide/trm290.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/ide/trm290.c +3 -4
@@ -184,7 +184,6 @@ static int trm290_dma_setup(ide_drive_tif (cmd->tf_flags &IDE_TFLAG_WRITE ) {#ifdef TRM290_NO_DMA_WRITES /* always use PIO for writes */ -trm290_prepare_drive (drive,0 );/* select PIO xfer */ return 1 ;#endif rw =1 ;
@@ -195,11 +194,8 @@ static int trm290_dma_setup(ide_drive_tif (count ==0 ) {ide_map_sg (drive, cmd);/* try PIO instead of DMA */ -trm290_prepare_drive (drive,0 );/* select PIO xfer */ return 1 ; } -/* select DMA xfer */ -trm290_prepare_drive (drive,1 );outl (hwif->dmatable_dma | rw, hwif->dma_base); drive->waiting_for_dma =1 ;/* start DMA */
@@ -209,6 +205,7 @@ static int trm290_dma_setup(ide_drive_tstatic void trm290_dma_start (ide_drive_t *drive) { +trm290_prepare_drive (drive,1 ); }static int trm290_dma_end (ide_drive_t *drive)
@@ -219,6 +216,8 @@ static int trm290_dma_end(ide_drive_t *d status =inw (drive->hwif->dma_base +2 ); +trm290_prepare_drive (drive,0 ); +return status !=0x00ff ; }
PATCH 7/10 ide: add ->dma_check method
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add ->dma_check method
* Add (an optional) ->dma_check method for checking if DMA can be used for a given command and fail DMA setup in ide_dma_prepare() if necessary.
* Convert alim15x3 and trm290 host drivers to use ->dma_check.
* Rename ali15x3_dma_setup() to ali_dma_setup() while at it.
There should be no functional changes caused by this patch.
--- drivers/ide/alim15x3.c | 9 +++++---- drivers/ide/ide-dma.c | 5 ++++- drivers/ide/trm290.c | 17 ++++++++++------- include/linux/ide.h | 1 + 4 files changed, 20 insertions(+), 12 deletions(-)
drivers/ide/alim15x3.c +5 -4
@@ -189,20 +189,20 @@ static void ali_set_dma_mode(ide_drive_t }/** -* ali15x3_dma_setup - begin a DMA phase +* ali_dma_check - DMA check * @drive: target device * @cmd: command * * Returns 1 if the DMA cannot be performed, zero on success. */ -static int ali15x3_dma_setup (ide_drive_t *drive,struct ide_cmd *cmd) +static int ali_dma_check (ide_drive_t *drive,struct ide_cmd *cmd) {if (m5229_revision <0xC2 && drive->media != ide_disk) {if (cmd->tf_flags &IDE_TFLAG_WRITE )return 1 ;/* try PIO instead of DMA */ } -return ide_dma_setup (drive, cmd); +return 0 ; }/**
@@ -503,11 +503,12 @@ static const struct ide_port_ops ali_porstatic const struct ide_dma_ops ali_dma_ops = { .dma_host_set = ide_dma_host_set, - .dma_setup = ali15x3_dma_setup, + .dma_setup = ide_dma_setup, .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_check = ali_dma_check, .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_sff_read_status = ide_dma_sff_read_status, };
drivers/ide/ide-dma.c +4 -1
@@ -562,9 +562,12 @@ EXPORT_SYMBOL_GPL(ide_allocate_dma_enginint ide_dma_prepare (ide_drive_t *drive,struct ide_cmd *cmd) { +const struct ide_dma_ops *dma_ops = drive->hwif->dma_ops; +if ((drive->dev_flags &IDE_DFLAG_USING_DMA ) ==0 || + (dma_ops->dma_check && dma_ops->dma_check (drive, cmd)) ||ide_build_sglist (drive, cmd) ==0 || - drive->hwif->dma_ops->dma_setup (drive, cmd)) + dma_ops->dma_setup (drive, cmd))return 1 ;return 0 ; }
drivers/ide/trm290.c +10 -7
@@ -176,19 +176,21 @@ static void trm290_selectproc (ide_drivetrm290_prepare_drive (drive, !!(drive->dev_flags &IDE_DFLAG_USING_DMA )); } -static int trm290_dma_setup (ide_drive_t *drive,struct ide_cmd *cmd) +static int trm290_dma_check (ide_drive_t *drive,struct ide_cmd *cmd) { -ide_hwif_t *hwif = drive->hwif; -unsigned int count, rw; -if (cmd->tf_flags &IDE_TFLAG_WRITE ) {#ifdef TRM290_NO_DMA_WRITES /* always use PIO for writes */ return 1 ;#endif - rw =1 ; - }else - rw =2 ; + } +return 0 ; +} + +static int trm290_dma_setup (ide_drive_t *drive,struct ide_cmd *cmd) +{ +ide_hwif_t *hwif = drive->hwif; +unsigned int count, rw = (cmd->tf_flags &IDE_TFLAG_WRITE ) ?1 :2 ; count =ide_build_dmatable (drive, cmd);if (count ==0 ) {
@@ -312,6 +314,7 @@ static struct ide_dma_ops trm290_dma_ops .dma_end = trm290_dma_end, .dma_test_irq = trm290_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_check = trm290_dma_check, };static const struct ide_port_info trm290_chipset__devinitdata = {
include/linux/ide.h +1 -0
@@ -716,6 +716,7 @@ struct ide_dma_ops {int (*dma_test_irq)(struct ide_drive_s *);void (*dma_lost_irq)(struct ide_drive_s *);/* below ones are optional */ +int (*dma_check)(struct ide_drive_s *,struct ide_cmd *);int (*dma_timer_expiry)(struct ide_drive_s *);void (*dma_clear)(struct ide_drive_s *);/*
PATCH 8/10 ide: move ide_map_sg() call out from ->dma_setup method
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: move ide_map_sg() call out from ->dma_setup method
Move ide_map_sg() call from ->dma_setup implementations and ide_destroy_dmatable() one from *_build_dmatable() to ide_dma_prepare().
There should be no functional changes caused by this patch.
--- drivers/ide/au1xxx-ide.c | 8 ++------ drivers/ide/ide-dma-sff.c | 2 -- drivers/ide/ide-dma.c | 8 ++++++-- drivers/ide/pmac.c | 6 +----- drivers/ide/scc_pata.c | 4 +--- drivers/ide/sgiioc4.c | 6 +----- drivers/ide/trm290.c | 5 ++--- drivers/ide/tx4939ide.c | 6 +----- 8 files changed, 14 insertions(+), 31 deletions(-)
drivers/ide/au1xxx-ide.c +2 -6
@@ -272,9 +272,7 @@ static int auide_build_dmatable(ide_drivif (count)return 1 ; - use_pio_instead: -ide_destroy_dmatable (drive); - +use_pio_instead:return 0 ;/* revert to PIO for this request */ }
@@ -290,10 +288,8 @@ static void auide_dma_start(ide_drive_tstatic int auide_dma_setup (ide_drive_t *drive,struct ide_cmd *cmd) { -if (auide_build_dmatable (drive, cmd) ==0 ) { -ide_map_sg (drive, cmd); +if (auide_build_dmatable (drive, cmd) ==0 )return 1 ; - } drive->waiting_for_dma =1 ;return 0 ;
drivers/ide/ide-dma-sff.c +0 -2
@@ -166,8 +166,6 @@ use_pio_instead:printk (KERN_ERR "%s: %s\n" , drive->name, count ?"DMA table too small" :"empty DMA table?" ); -ide_destroy_dmatable (drive); -return 0 ;/* revert to PIO for this request */ }EXPORT_SYMBOL_GPL (ide_build_dmatable);
drivers/ide/ide-dma.c +6 -2
@@ -566,8 +566,12 @@ int ide_dma_prepare(ide_drive_t *drive,if ((drive->dev_flags &IDE_DFLAG_USING_DMA ) ==0 || (dma_ops->dma_check && dma_ops->dma_check (drive, cmd)) || -ide_build_sglist (drive, cmd) ==0 || - dma_ops->dma_setup (drive, cmd)) +ide_build_sglist (drive, cmd) ==0 )return 1 ; +if (dma_ops->dma_setup (drive, cmd)) { +ide_destroy_dmatable (drive); +ide_map_sg (drive, cmd); +return 1 ; + }return 0 ; }
drivers/ide/pmac.c +1 -5
@@ -1493,8 +1493,6 @@ static int pmac_ide_build_dmatable(ide_dprintk (KERN_DEBUG "%s: empty DMA table?\n" , drive->name); use_pio_instead: -ide_destroy_dmatable (drive); -return 0 ;/* revert to PIO for this request */ }
@@ -1510,10 +1508,8 @@ static int pmac_ide_dma_setup(ide_drive_u8 unit = drive->dn &1 , ata4 = (pmif->kind == controller_kl_ata4);u8 write = !!(cmd->tf_flags &IDE_TFLAG_WRITE ); -if (pmac_ide_build_dmatable (drive, cmd) ==0 ) { -ide_map_sg (drive, cmd); +if (pmac_ide_build_dmatable (drive, cmd) ==0 )return 1 ; - }/* Apple adds 60ns to wrDataSetup on reads */ if (ata4 && (pmif->timings[unit] &TR_66_UDMA_EN )) {
drivers/ide/scc_pata.c +1 -3
@@ -321,10 +321,8 @@ static int scc_dma_setup(ide_drive_t *dru8 dma_stat;/* fall back to pio! */ -if (ide_build_dmatable (drive, cmd) ==0 ) { -ide_map_sg (drive, cmd); +if (ide_build_dmatable (drive, cmd) ==0 )return 1 ; - }/* PRD table */ out_be32 ((void __iomem *)(hwif->dma_base +8 ), hwif->dmatable_dma);
drivers/ide/sgiioc4.c +1 -5
@@ -478,8 +478,6 @@ static int sgiioc4_build_dmatable(ide_dr } use_pio_instead: -ide_destroy_dmatable (drive); -return 0 ;/* revert to PIO for this request */ }
@@ -488,11 +486,9 @@ static int sgiioc4_dma_setup(ide_drive_tint ddir;u8 write = !!(cmd->tf_flags &IDE_TFLAG_WRITE ); -if (sgiioc4_build_dmatable (drive, cmd) ==0 ) { +if (sgiioc4_build_dmatable (drive, cmd) ==0 )/* try PIO instead of DMA */ -ide_map_sg (drive, cmd);return 1 ; - }if (write)/* Writes TO the IOC4 FROM Main Memory */
drivers/ide/trm290.c +2 -3
@@ -193,11 +193,10 @@ static int trm290_dma_setup(ide_drive_tunsigned int count, rw = (cmd->tf_flags &IDE_TFLAG_WRITE ) ?1 :2 ; count =ide_build_dmatable (drive, cmd); -if (count ==0 ) { -ide_map_sg (drive, cmd); +if (count ==0 )/* try PIO instead of DMA */ return 1 ; - } +outl (hwif->dmatable_dma | rw, hwif->dma_base); drive->waiting_for_dma =1 ;/* start DMA */
drivers/ide/tx4939ide.c +1 -5
@@ -279,8 +279,6 @@ use_pio_instead:printk (KERN_ERR "%s: %s\n" , drive->name, count ?"DMA table too small" :"empty DMA table?" ); -ide_destroy_dmatable (drive); - return 0; /* revert to PIO for this request */ }#else
@@ -294,10 +292,8 @@ static int tx4939ide_dma_setup(ide_driveu8 rw = (cmd->tf_flags &IDE_TFLAG_WRITE ) ?0 :ATA_DMA_WR ;/* fall back to PIO! */ -if (tx4939ide_build_dmatable (drive, cmd) ==0 ) { -ide_map_sg (drive, cmd); +if (tx4939ide_build_dmatable (drive, cmd) ==0 )return 1 ; - }/* PRD table */ tx4939ide_writel (hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr);
PATCH 9/10 ide: set/clear drive->waiting_for_dma flag in the core code
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: set/clear drive->waiting_for_dma flag in the core code
Set/clear drive->waiting_for_dma flag in the core code instead of in ->dma_setup and ->dma_end methods.
There should be no functional changes caused by this patch.
--- drivers/ide/au1xxx-ide.c | 6 ------ drivers/ide/cmd64x.c | 1 - drivers/ide/icside.c | 4 ---- drivers/ide/ide-atapi.c | 4 +++- drivers/ide/ide-cd.c | 1 + drivers/ide/ide-dma-sff.c | 3 --- drivers/ide/ide-dma.c | 4 ++++ drivers/ide/ns87415.c | 1 - drivers/ide/pmac.c | 3 --- drivers/ide/sc1200.c | 2 -- drivers/ide/scc_pata.c | 3 +-- drivers/ide/sgiioc4.c | 3 --- drivers/ide/trm290.c | 8 ++------ drivers/ide/tx4939ide.c | 4 ---- 14 files changed, 11 insertions(+), 36 deletions(-)
drivers/ide/au1xxx-ide.c +0 -6
@@ -291,7 +291,6 @@ static int auide_dma_setup(ide_drive_t *if (auide_build_dmatable (drive, cmd) ==0 )return 1 ; - drive->waiting_for_dma =1 ;return 0 ; }
@@ -316,16 +315,11 @@ static void auide_dma_host_set(ide_drivestatic void auide_ddma_tx_callback (int irq,void *param) { -_auide_hwif *ahwif = (_auide_hwif *)param; - ahwif->drive->waiting_for_dma =0 ; }static void auide_ddma_rx_callback (int irq,void *param) { -_auide_hwif *ahwif = (_auide_hwif *)param; - ahwif->drive->waiting_for_dma =0 ; } -#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ static void auide_init_dbdma_dev (dbdev_tab_t *dev,u32 dev_id,u32 tsize,u32 devwidth,u32 flags)
drivers/ide/cmd64x.c +0 -1
@@ -318,7 +318,6 @@ static int cmd646_1_dma_end(ide_drive_tide_hwif_t *hwif = drive->hwif;u8 dma_stat =0 , dma_cmd =0 ; - drive->waiting_for_dma =0 ;/* get DMA status */ dma_stat =inb (hwif->dma_base +ATA_DMA_STATUS );/* read DMA command state */
drivers/ide/icside.c +0 -4
@@ -287,8 +287,6 @@ static int icside_dma_end(ide_drive_t *dide_hwif_t *hwif = drive->hwif;struct expansion_card *ec =ECARD_DEV (hwif->dev); - drive->waiting_for_dma =0 ; -disable_dma (ec->dma);return get_dma_residue (ec->dma) !=0 ;
@@ -343,8 +341,6 @@ static int icside_dma_setup(ide_drive_tset_dma_sg (ec->dma, hwif->sg_table, cmd->sg_nents);set_dma_mode (ec->dma, dma_mode); - drive->waiting_for_dma =1 ; -return 0 ; }
drivers/ide/ide-atapi.c +3 -1
@@ -322,8 +322,10 @@ static ide_startstop_t ide_pc_intr(ide_d stat = tp_ops->read_status (hwif);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { -int rc = hwif->dma_ops->dma_end (drive); +int rc; + drive->waiting_for_dma =0 ; + rc = hwif->dma_ops->dma_end (drive);ide_destroy_dmatable (drive);if (rc || (drive->media == ide_tape && (stat &ATA_ERR ))) {
drivers/ide/ide-cd.c +1 -0
@@ -638,6 +638,7 @@ static ide_startstop_t cdrom_newpc_intr( dma = drive->dma;if (dma) { drive->dma =0 ; + drive->waiting_for_dma =0 ; dma_error = hwif->dma_ops->dma_end (drive);ide_destroy_dmatable (drive);if (dma_error) {
drivers/ide/ide-dma-sff.c +0 -3
@@ -216,7 +216,6 @@ int ide_dma_setup(ide_drive_t *drive, st/* clear INTR & ERROR flags */ ide_dma_sff_write_status (hwif, dma_stat |ATA_DMA_ERR |ATA_DMA_INTR ); - drive->waiting_for_dma =1 ;return 0 ; }EXPORT_SYMBOL_GPL (ide_dma_setup);
@@ -290,8 +289,6 @@ int ide_dma_end(ide_drive_t *drive)ide_hwif_t *hwif = drive->hwif;u8 dma_stat =0 , dma_cmd =0 , mask; - drive->waiting_for_dma =0 ; -/* stop DMA */ if (hwif->host_flags &IDE_HFLAG_MMIO ) { dma_cmd =readb ((void __iomem *)(hwif->dma_base +ATA_DMA_CMD ));
drivers/ide/ide-dma.c +4 -0
@@ -91,6 +91,7 @@ ide_startstop_t ide_dma_intr(ide_drive_tide_hwif_t *hwif = drive->hwif;u8 stat =0 , dma_stat =0 ; + drive->waiting_for_dma =0 ; dma_stat = hwif->dma_ops->dma_end (drive);ide_destroy_dmatable (drive); stat = hwif->tp_ops->read_status (hwif);
@@ -475,6 +476,7 @@ ide_startstop_t ide_dma_timeout_retry(idif (error <0 ) {printk (KERN_WARNING "%s: DMA timeout error\n" , drive->name); + drive->waiting_for_dma =0 ; (void )dma_ops->dma_end (drive);ide_destroy_dmatable (drive); ret = ide_error(drive, "dma timeout error",
@@ -487,6 +489,7 @@ ide_startstop_t ide_dma_timeout_retry(idif (dma_ops->dma_test_irq (drive) ==0 ) {ide_dump_status (drive,"DMA timeout" , hwif->tp_ops->read_status (hwif)); + drive->waiting_for_dma =0 ; (void )dma_ops->dma_end (drive);ide_destroy_dmatable (drive); }
@@ -573,5 +576,6 @@ int ide_dma_prepare(ide_drive_t *drive,ide_map_sg (drive, cmd);return 1 ; } + drive->waiting_for_dma =1 ;return 0 ; }
drivers/ide/ns87415.c +0 -1
@@ -207,7 +207,6 @@ static int ns87415_dma_end(ide_drive_t *ide_hwif_t *hwif = drive->hwif;u8 dma_stat =0 , dma_cmd =0 ; - drive->waiting_for_dma =0 ; dma_stat = hwif->dma_ops->dma_sff_read_status (hwif);/* get DMA command mode */ dma_cmd =inb (hwif->dma_base +ATA_DMA_CMD );
drivers/ide/pmac.c +0 -3
@@ -1518,8 +1518,6 @@ static int pmac_ide_dma_setup(ide_drive_ (void )readl (PMAC_IDE_REG (IDE_TIMING_CONFIG )); } - drive->waiting_for_dma =1 ; -return 0 ; }
@@ -1554,7 +1552,6 @@ pmac_ide_dma_end (ide_drive_t *drive)volatile struct dbdma_regs __iomem *dma = pmif->dma_regs;u32 dstat; - drive->waiting_for_dma =0 ; dstat =readl (&dma->status);writel (((RUN |WAKE |DEAD ) <<16 ), &dma->control);
drivers/ide/sc1200.c +0 -2
@@ -183,8 +183,6 @@ static int sc1200_dma_end(ide_drive_t *doutb (dma_stat|0x1b , dma_base+2 );/* clear the INTR & ERROR bits */ outb (inb (dma_base)&~1 , dma_base);/* !! DO THIS HERE !! stop DMA */ - drive->waiting_for_dma =0 ; -return (dma_stat &7 ) !=4 ;/* verify good DMA status */ }
drivers/ide/scc_pata.c +1 -2
@@ -335,7 +335,7 @@ static int scc_dma_setup(ide_drive_t *dr/* clear INTR & ERROR flags */ out_be32 ((void __iomem *)(hwif->dma_base +4 ), dma_stat |6 ); - drive->waiting_for_dma =1 ; +return 0 ; }
@@ -354,7 +354,6 @@ static int __scc_dma_end(ide_drive_t *dride_hwif_t *hwif = drive->hwif;u8 dma_stat, dma_cmd; - drive->waiting_for_dma =0 ;/* get DMA command mode */ dma_cmd =scc_ide_inb (hwif->dma_base);/* stop DMA */
drivers/ide/sgiioc4.c +0 -3
@@ -258,8 +258,6 @@ static int sgiioc4_dma_end(ide_drive_t * } } - drive->waiting_for_dma =0 ; -return dma_stat; }
@@ -412,7 +410,6 @@ sgiioc4_configure_for_dma(int dma_directwritel (ending_dma_addr, (void __iomem *)(dma_base +IOC4_DMA_END_ADDR *4 ));writel (dma_direction, (void __iomem *)ioc4_dma_addr); - drive->waiting_for_dma =1 ; }/* IOC4 Scatter Gather list Format */
drivers/ide/trm290.c +2 -6
@@ -198,9 +198,9 @@ static int trm290_dma_setup(ide_drive_treturn 1 ;outl (hwif->dmatable_dma | rw, hwif->dma_base); - drive->waiting_for_dma =1 ;/* start DMA */ outw (count *2 -1 , hwif->dma_base +2 ); +return 0 ; }
@@ -211,11 +211,7 @@ static void trm290_dma_start(ide_drive_tstatic int trm290_dma_end (ide_drive_t *drive) { -u16 status; - - drive->waiting_for_dma =0 ; - - status =inw (drive->hwif->dma_base +2 ); +u16 status =inw (drive->hwif->dma_base +2 );trm290_prepare_drive (drive,0 );
drivers/ide/tx4939ide.c +0 -4
@@ -304,8 +304,6 @@ static int tx4939ide_dma_setup(ide_drive/* clear INTR & ERROR flags */ tx4939ide_clear_dma_status (base); - drive->waiting_for_dma =1 ; -tx4939ide_writew (SECTOR_SIZE /2 , base, drive->dn ? TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1);
@@ -321,8 +319,6 @@ static int tx4939ide_dma_end(ide_drive_tvoid __iomem *base =TX4939IDE_BASE (hwif);u16 ctl =tx4939ide_readw (base, TX4939IDE_Int_Ctl); - drive->waiting_for_dma =0 ; -/* get DMA command mode */ dma_cmd =tx4939ide_readb (base, TX4939IDE_DMA_Cmd);/* stop DMA */
PATCH 2/10 ide: inline ide_dma_timeout() into ide_dma_timeout_retry()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: inline ide_dma_timeout() into ide_dma_timeout_retry()
Since ide_dma_timeout() is only used by ide_dma_timeout_retry() inline it there.
There should be no functional changes caused by this patch.
--- drivers/ide/ide-dma.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/ide/ide-dma.c +6 -15
@@ -456,20 +456,6 @@ void ide_dma_lost_irq(ide_drive_t *drive }EXPORT_SYMBOL_GPL (ide_dma_lost_irq); -static void ide_dma_timeout (ide_drive_t *drive) -{ -ide_hwif_t *hwif = drive->hwif; - -printk (KERN_ERR "%s: timeout waiting for DMA\n" , drive->name); - -if (hwif->dma_ops->dma_test_irq (drive)) -return ; - -ide_dump_status (drive,"DMA timeout" , hwif->tp_ops->read_status (hwif)); - - hwif->dma_ops->dma_end (drive); -} -/* * un-busy the port etc, and clear any pending DMA status. we want to * retry the current request in pio mode instead of risking tossing it
@@ -495,7 +481,12 @@ ide_startstop_t ide_dma_timeout_retry(idprintk (KERN_WARNING "%s: DMA timeout retry\n" , drive->name);if (dma_ops->dma_clear) dma_ops->dma_clear (drive); -ide_dma_timeout (drive); +printk (KERN_ERR "%s: timeout waiting for DMA\n" , drive->name); +if (dma_ops->dma_test_irq (drive) ==0 ) { +ide_dump_status (drive,"DMA timeout" , + hwif->tp_ops->read_status (hwif)); + (void )dma_ops->dma_end (drive); + } }/*
PATCH 10/10 ide: sanitize ide_build_sglist() and ide_destroy_dmatable()
In reply to Bartlomiej ZolnierkiewiczFrom: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: sanitize ide_build_sglist() and ide_destroy_dmatable()
* Move ide_map_sg() calls out from ide_build_sglist() to ide_dma_prepare().
* Pass command to ide_destroy_dmatable().
* Rename ide_build_sglist() to ide_dma_map_sg() and ide_destroy_dmatable() to ide_dma_unmap_sg().
There should be no functional changes caused by this patch.
--- drivers/ide/ide-atapi.c | 2 - drivers/ide/ide-cd.c | 2 - drivers/ide/ide-dma.c | 50 ++++++++++++++++++++++++------------------------ drivers/ide/sgiioc4.c | 7 +++--- include/linux/ide.h | 3 -- 5 files changed, 32 insertions(+), 32 deletions(-)
drivers/ide/ide-atapi.c +1 -1
@@ -284,7 +284,7 @@ static ide_startstop_t ide_pc_intr(ide_d drive->waiting_for_dma =0 ; rc = hwif->dma_ops->dma_end (drive); -ide_destroy_dmatable (drive); +ide_dma_unmap_sg (drive, cmd);if (rc || (drive->media == ide_tape && (stat &ATA_ERR ))) {if (drive->media == ide_floppy)
drivers/ide/ide-cd.c +1 -1
@@ -640,7 +640,7 @@ static ide_startstop_t cdrom_newpc_intr( drive->dma =0 ; drive->waiting_for_dma =0 ; dma_error = hwif->dma_ops->dma_end (drive); -ide_destroy_dmatable (drive); +ide_dma_unmap_sg (drive, cmd);if (dma_error) { printk(KERN_ERR PFX "%s: DMA %s error\n", drive->name, write ? "write" : "read");
drivers/ide/ide-dma.c +25 -25
129 lines not on this page · raw message
drivers/ide/sgiioc4.c +4 -3
@@ -277,11 +277,12 @@ static void sgiioc4_dma_host_set(ide_drisgiioc4_clearirq (drive); } -static void -sgiioc4_resetproc (ide_drive_t * drive) +static void sgiioc4_resetproc (ide_drive_t *drive) { +struct ide_cmd *cmd = &drive->hwif->cmd; +sgiioc4_dma_end (drive); -ide_destroy_dmatable (drive); +ide_dma_unmap_sg (drive, cmd);sgiioc4_clearirq (drive); }
include/linux/ide.h +1 -2
@@ -1438,8 +1438,7 @@ int ide_allocate_dma_engine(ide_hwif_t *void ide_release_dma_engine (ide_hwif_t *);int ide_dma_prepare (ide_drive_t *,struct ide_cmd *); - -void ide_destroy_dmatable (ide_drive_t *); +void ide_dma_unmap_sg (ide_drive_t *,struct ide_cmd *);#ifdef CONFIG_BLK_DEV_IDEDMA_SFF int config_drive_for_dma (ide_drive_t *);
Re: [PATCH 01/10] ide: add ->dma_clear method and remove ->dma_timeout one
In reply to Bartlomiej ZolnierkiewiczQuoted 6 lines · Bartlomiej Zolnierkiewicz
All custom ->dma_timeout implementations call the generic one thus it is possible to have only an optional method for resetting DMA engine instead:
* Add ->dma_clear method and convert hpt366,
pdc202xx_oldand sl82c105 host drivers to use it.
Quoted 9 lines
* Always use
ide_dma_timeout()inide_dma_timeout_retry()and remove ->dma_timeout method.* Make
ide_dma_timeout()static.There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 5 lines
Index:
b/include/linux/ide.h
===================================================================
include/linux/ide.h struct ide_dma_ops { · line 723
Quoted 10 lines
include/linux/ide.h +2
-1@@ -715,8 +715,9 @@ struct ide_dma_ops {int (*dma_end)(struct ide_drive_s *);int (*dma_test_irq)(struct ide_drive_s *);void (*dma_lost_irq)(struct ide_drive_s *); +/* below ones are optional */ int (*dma_timer_expiry)(struct ide_drive_s *); -void (*dma_timeout)(struct ide_drive_s *); +void (*dma_clear)(struct ide_drive_s *);/* * The following method is optional and only required to be
Perhaps worth removing the words about method being optional now...
Quoted 2 lines
* implemented for the SFF-8038i compatible controllers.
MBR, Sergei
Re: [PATCH 02/10] ide: inline ide_dma_timeout() into ide_dma_timeout_retry()
In reply to Bartlomiej ZolnierkiewiczQuoted 6 lines · Bartlomiej Zolnierkiewicz
Since
ide_dma_timeout()is only used byide_dma_timeout_retry()inline it there.There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 05/10] ns87415: use custom ->dma_{start,end} to handle ns87415_prepare_drive()
In reply to Bartlomiej ZolnierkiewiczQuoted 4 lines · Bartlomiej Zolnierkiewicz
Use custom ->dma_{start,end} methods to handle
ns87415_prepare_drive()there instead of in ->dma_setup method.Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 06/10] trm290: use custom ->dma_{start,end} to handle trm290_prepare_drive()
In reply to Bartlomiej ZolnierkiewiczHello.
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Use custom ->dma_{start,end} methods to handle
trm290_prepare_drive()there instead of in ->dma_setup method.There should be no functional changes caused by this patch (DMA support is disabled currently in
trm290.c).Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 07/10] ide: add ->dma_check method
In reply to Bartlomiej ZolnierkiewiczQuoted 8 lines · Bartlomiej Zolnierkiewicz
* Add (an optional) ->dma_check method for checking if DMA can be used for a given command and fail DMA setup in
ide_dma_prepare()if necessary.* Convert alim15x3 and trm290 host drivers to use ->dma_check.
* Rename
ali15x3_dma_setup()toali_dma_setup()while at it.
ali_dma_check() you mean?
Quoted 4 lines
There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 03/10] ide: destroy DMA mappings after ending DMA
In reply to Bartlomiej ZolnierkiewiczHello.
Quoted 16 lines · Bartlomiej Zolnierkiewicz
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: destroy DMA mappings after ending DMAMove
ide_destroy_dmatable()call out from ->dma_end method to {ide_pc,cdrom_newpc,ide_dma}_intr(),ide_dma_timeout_retry()andsgiioc4_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()
Quoted 2 lines
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 13 lines
Index:
b/drivers/ide/sgiioc4.c
===================================================================drivers/ide/sgiioc4.c +0
-1@@ -259,7 +259,6 @@ static int sgiioc4_dma_end(ide_drive_t * } drive->waiting_for_dma =0 ; -ide_destroy_dmatable (drive);return dma_stat; }
drivers/ide/sgiioc4.c static void · line 288
Quoted 6 lines
drivers/ide/sgiioc4.c +1
-0@@ -284,6 +283,7 @@ static void sgiioc4_resetproc(ide_drive_t * drive) {sgiioc4_dma_end (drive); +ide_destroy_dmatable (drive);sgiioc4_clearirq (drive); }
I somewhat doubt that resetproc() can be called with DMA still active...
MBR, Sergei
Re: [PATCH 04/10] ide: add ide_dma_prepare() helper
In reply to Bartlomiej ZolnierkiewiczQuoted 9 lines · Bartlomiej Zolnierkiewicz
* Add
ide_dma_prepare()helper.* Convert
ide_issue_pc()anddo_rw_taskfile()to use it.* Make
ide_build_sglist()static.There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 08/10] ide: move ide_map_sg() call out from ->dma_setup method
In reply to Bartlomiej ZolnierkiewiczQuoted 8 lines · Bartlomiej Zolnierkiewicz
Move
ide_map_sg()call from ->dma_setup implementations andide_destroy_dmatable()one from*_build_dmatable()toide_dma_prepare().There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
[...]
drivers/ide/au1xxx-ide.c static int auide_build_dmatable(ide_driv · line 276
Quoted 13 lines
Index:
b/drivers/ide/au1xxx-ide.c
===================================================================drivers/ide/au1xxx-ide.c +1
-3@@ -272,9 +272,7 @@ static int auide_build_dmatable(ide_drivif (count)return 1 ; - use_pio_instead: -ide_destroy_dmatable (drive); - +use_pio_instead:
Could you please get rid of goto and label too, while at it?
drivers/ide/pmac.c static int pmac_ide_build_dmatable(ide_d · line 1496
Quoted 11 lines
Index:
b/drivers/ide/pmac.c
===================================================================drivers/ide/pmac.c +0
-2@@ -1493,8 +1493,6 @@ static int pmac_ide_build_dmatable(ide_dprintk (KERN_DEBUG "%s: empty DMA table?\n" , drive->name); use_pio_instead: -ide_destroy_dmatable (drive); -return 0 ;/* revert to PIO for this request */
Ditto...
drivers/ide/sgiioc4.c static int sgiioc4_build_dmatable(ide_dr · line 482
Quoted 12 lines
Index:
b/drivers/ide/sgiioc4.c
===================================================================drivers/ide/sgiioc4.c +0
-2@@ -478,8 +478,6 @@ static int sgiioc4_build_dmatable(ide_dr } use_pio_instead: -ide_destroy_dmatable (drive); -return 0 ;/* revert to PIO for this request */
Ditto...
MBR, Sergei
Re: [PATCH 09/10] ide: set/clear drive->waiting_for_dma flag in the core code
In reply to Bartlomiej ZolnierkiewiczHello.
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Set/clear
drive->waiting_for_dmaflag in the core code instead of in ->dma_setup and ->dma_end methods.There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 07/10] ide: add ->dma_check method
In reply to Sergei ShtylyovQuoted 6 lines · Sergei Shtylyov
Quoted 4 lines · Bartlomiej Zolnierkiewicz
* Add (an optional) ->dma_check method for checking if DMA can be used for a given command and fail DMA setup in
ide_dma_prepare()if necessary.
Quoted 6 lines
Quoted 4 lines
* Convert alim15x3 and trm290 host drivers to use ->dma_check.
* Rename
ali15x3_dma_setup()toali_dma_setup()while at it.
ali_dma_check()you mean?
Yep, thanks for noticing (it is fixed now).
Quoted 6 lines
Quoted 4 lines
There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>Acked-by Sergei Shtylyov <[email protected]>
Re: [PATCH 08/10] ide: move ide_map_sg() call out from ->dma_setup method
In reply to Sergei ShtylyovQuoted 19 lines · Sergei Shtylyov
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Move
ide_map_sg()call from ->dma_setup implementations andide_destroy_dmatable()one from*_build_dmatable()toide_dma_prepare().There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>[...]
Quoted 8 lines
Index:
b/drivers/ide/au1xxx-ide.c
===================================================================drivers/ide/au1xxx-ide.c +0
-0@@ -272,9 +272,7 @@ static int auide_build_dmatable(ide_drivif (count)return 1 ;
Quoted 7 lines
drivers/ide/au1xxx-ide.c static int auide_build_dmatable(ide_driv · line 278
Quoted 5 lines
drivers/ide/au1xxx-ide.c +1
-3- use_pio_instead: -ide_destroy_dmatable (drive); - +use_pio_instead:Could you please get rid of goto and label too, while at it?
Sorry but since this patch has been already merged it would be too much work/noise for too little gain IMO.
Re: [PATCH 08/10] ide: move ide_map_sg() call out from ->dma_setup method
Hello.
Quoted 18 lines · Bartlomiej Zolnierkiewicz
Quoted 18 lines
Quoted 7 lines
Move
ide_map_sg()call from ->dma_setup implementations andide_destroy_dmatable()one from*_build_dmatable()toide_dma_prepare().There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>[...]
Quoted 8 lines
Index:
b/drivers/ide/au1xxx-ide.c
===================================================================drivers/ide/au1xxx-ide.c +0
-0@@ -272,9 +272,7 @@ static int auide_build_dmatable(ide_drivif (count)return 1 ;
Quoted 8 lines
Quoted 6 lines
drivers/ide/au1xxx-ide.c static int auide_build_dmatable(ide_driv · line 275
Quoted 4 lines
drivers/ide/au1xxx-ide.c +1
-3- use_pio_instead: -ide_destroy_dmatable (drive); - +use_pio_instead:Could you please get rid of goto and label too, while at it?
Sorry but since this patch has been already merged
Merged where?!
Quoted 1 line
it would be too much work/noise for too little gain IMO.
Will you take a reworked patch from me?
MBR, Sergei
Re: [PATCH 08/10] ide: move ide_map_sg() call out from ->dma_setup method
Quoted 29 lines · Sergei Shtylyov
Hello.
Quoted 24 lines · Bartlomiej Zolnierkiewicz
Quoted 24 lines
Quoted 7 lines
Move
ide_map_sg()call from ->dma_setup implementations andide_destroy_dmatable()one from*_build_dmatable()toide_dma_prepare().There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>[...]
drivers/ide/au1xxx-ide.c static int auide_build_dmatable(ide_driv · line 275
Quoted 12 lines
Index:
b/drivers/ide/au1xxx-ide.c
===================================================================drivers/ide/au1xxx-ide.c +1
-3@@ -272,9 +272,7 @@ static int auide_build_dmatable(ide_drivif (count)return 1 ; - use_pio_instead: -ide_destroy_dmatable (drive); - +use_pio_instead:Could you please get rid of goto and label too, while at it?
Quoted 3 lines
Quoted 1 line
Sorry but since this patch has been already merged
Merged where?!
To pata tree, two weeks ago.
I try to limit touching merged stuff as much as possible so people working with pata tree don't get surprised too much (sometimes it is impossible but this doesn't discourage me from trying).
[ Some people may argue that existing stuff shouldn't change at all but
IMO it is all case specific and this trade-off is acceptable for fixing regressions / preserving bisectability... ]
Quoted 3 lines
Quoted 1 line
it would be too much work/noise for too little gain IMO.
Will you take a reworked patch from me?
Well, OK this time if it won't cause rejects in later patches... though stuff like that is really much more efficient done in incremental patches.
Thanks,
Bart
Re: [PATCH 03/10] ide: destroy DMA mappings after ending DMA
In reply to Bartlomiej ZolnierkiewiczQuoted 6 lines · Bartlomiej Zolnierkiewicz
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: destroy DMA mappings after ending DMAMove
ide_destroy_dmatable()call out from ->dma_end method to {ide_pc,cdrom_newpc,ide_dma}_intr(),ide_dma_timeout_retry()andsgiioc4_resetproc().
...
drivers/ide/ide-dma-sff.c int ide_dma_end(ide_drive_t *drive) · line 313
Quoted 9 lines
drivers/ide/ide-dma-sff.c +0
-2@@ -310,8 +310,6 @@ int ide_dma_end(ide_drive_t *drive) /* clear INTR & ERROR bits */ ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR); - /* purge DMA mappings */ - ide_destroy_dmatable(drive); wmb();
Bartlomiej,
I think the wmb() could removed as well. The outb/writeb functions are required to be strongly ordered and I don't see anything else touching DMA-able memory here.
BTW, care to remove "mask" usage from this function? It's really not needed (can be replaced with #define).
I can create separate patches for both. Which git tree should I base them against?
...
drivers/ide/scc_pata.c static int __scc_dma_end(ide_drive_t *dr · line 369
Quoted 10 lines
drivers/ide/scc_pata.c +0
-2@@ -365,8 +365,6 @@ static int __scc_dma_end(ide_drive_t *dr dma_stat = scc_dma_sff_read_status(hwif); /* clear the INTR & ERROR bits */ scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); - /* purge DMA mappings */ - ide_destroy_dmatable(drive); /* verify good DMA status */ wmb();
I think this wmb() can be removed too.
....
drivers/ide/tx4939ide.c static int tx4939ide_dma_end(ide_drive_t · line 338
Quoted 10 lines
drivers/ide/tx4939ide.c +0
-3@@ -335,11 +335,9 @@ static int tx4939ide_dma_end(ide_drive_t /* read and clear the INTR & ERROR bits */ dma_stat = tx4939ide_clear_dma_status(base); - /* purge DMA mappings */ - ide_destroy_dmatable(drive); - /* verify good DMA status */ wmb();
and this one as well.
hth,
grant
Re: [PATCH 03/10] ide: destroy DMA mappings after ending DMA
Hi,
Quoted 15 lines · Grant Grundler
Quoted 6 lines · Bartlomiej Zolnierkiewicz
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: destroy DMA mappings after ending DMAMove
ide_destroy_dmatable()call out from ->dma_end method to {ide_pc,cdrom_newpc,ide_dma}_intr(),ide_dma_timeout_retry()andsgiioc4_resetproc()....
Quoted 6 lines
drivers/ide/ide-dma-sff.c +0
-0@@ -310,8 +310,6 @@ int ide_dma_end(ide_drive_t *drive)/* clear INTR & ERROR bits */ ide_dma_sff_write_status (hwif, dma_stat |ATA_DMA_ERR |ATA_DMA_INTR );
Quoted 8 lines
drivers/ide/ide-dma-sff.c int ide_dma_end(ide_drive_t *drive) · line 313
Quoted 3 lines
drivers/ide/ide-dma-sff.c +0
-2-/* purge DMA mappings */ -ide_destroy_dmatable (drive);wmb ();Bartlomiej,
I think thewmb()could removed as well. The outb/writeb functions are required to be strongly ordered and I don't see anything else touching DMA-able memory here.
Indeed. IIRC this code precedes the requeirement for outb/writeb to be strongly ordered.
Seems like wmb() in ide_dma_start() is also superfluous nowadays...
Quoted 2 lines
BTW, care to remove "mask" usage from this function? It's really not needed (can be replaced with #define).
Feel free to remove it. :)
Quoted 2 lines
I can create separate patches for both. Which git tree should I base them against?
linux-next git tree
(or pata-2.6 quilt tree)
Quoted 21 lines
...
drivers/ide/scc_pata.c static int __scc_dma_end(ide_drive_t *dr · line 369
Quoted 10 lines
drivers/ide/scc_pata.c +0
-2@@ -365,8 +365,6 @@ static int __scc_dma_end(ide_drive_t *dr dma_stat =scc_dma_sff_read_status (hwif);/* clear the INTR & ERROR bits */ scc_ide_outb (dma_stat |6 , hwif->dma_base +4 ); -/* purge DMA mappings */ -ide_destroy_dmatable (drive);/* verify good DMA status */ wmb ();I think this
wmb()can be removed too.....
Quoted 6 lines
drivers/ide/tx4939ide.c +0
-0@@ -335,11 +335,9 @@ static int tx4939ide_dma_end(ide_drive_t/* read and clear the INTR & ERROR bits */ dma_stat =tx4939ide_clear_dma_status (base);
Quoted 6 lines
drivers/ide/tx4939ide.c static int tx4939ide_dma_end(ide_drive_t · line 338
Quoted 4 lines
drivers/ide/tx4939ide.c +0
-3-/* purge DMA mappings */ -ide_destroy_dmatable (drive); -/* verify good DMA status */ wmb ();and this one as well.
Seems so but please cc: scc_pata & tx4939 maintainers on your patch.
Thanks,
Bart
Re: [PATCH 03/10] ide: destroy DMA mappings after ending DMA
On Sat, Mar 14, 2009 at 8:51 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:
...
Quoted 5 lines
Quoted 2 lines
I can create separate patches for both. Which git tree should I base them against?
linux-next git tree
(or pata-2.6 quilt tree)
I've not used quilt yet and can only deal with git in a very crude way. Thanks for the references!
....
Quoted 1 line
Seems so but please cc:
scc_pata& tx4939 maintainers on your patch.
Yes, will do!
thanks,
grant
Re: [PATCH 03/10] ide: destroy DMA mappings after ending DMA
Quoted 11 lines · Grant Grundler
On Sat, Mar 14, 2009 at 8:51 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:
...Quoted 5 lines
Quoted 2 lines
I can create separate patches for both. Which git tree should I base them against?
linux-next git tree
(or pata-2.6 quilt tree)I've not used quilt yet and can only deal with git in a very crude way. Thanks for the references!
Have no fear ... you just rsync the quilt to a directory (~/pata_quilt or something) on any server (use rsync so you only pick up the diffs next time around) and then do
git quiltimport --patches ~/pata_quilt
and voila: a git tree ... of course it's a new one, and it's much harder to handle incremental quilts (quilts that just have an extra few patches added) since git rebuilds the entire tree with a different commitid for each patch every time.
James