libata: separate out SFF and BMDMA, take#2
Subsystems (6)
PATCH 1/1 libata: separate out SFF and BMDMA, take#2
Hello, Jeff, Sergei.
This is the second take of separate-out-SFF-and-BMDMA patchset. The initial take[L] was posted back in 2008. It got mostly acked but somehow forgotten in the middle of patch logistics by Jeff and me both. Thankfully, Sergei somehow digged this up. :-)
Other than refreshing on top of the current #upstream including reflecting the changes in core code and addition of new drivers, the bulk of patchset is about the same.
The patchset separates out SFF and BMDMA code and categorizes low level drivers as such. This has marginal benefit of having the ability not to include unneded core code but the main point is clearing the muddy line between SFF and BMDMA so that drivers don't end up needing dummy functions or explicit boilerplate overrides not knowing what's gonna be called. It also makes verifying which driver depends on which core functions much easier during both code review (simply searching for sff in bmdma driver and dma in !bmdma driver gives pretty good picture) and compile.
Please read patchset description of the initial take for more details.
Build tested on x86. Tested on ahci and ata_piix. Couldn't test more as I'm away from my test equipments. :-( I think breakages from this patchset wouldn't be too hard to catch but it definitely needs some testing time in linux-next or whereever before hitting mainline.
This patchset is on top of the current #upstream (3d02d7242c513f945009f74e8d59d45d861195e4) and contains the following 23 patches.
0001-pata_sch-use-ata_pci_sff_init_one.patch 0002-sata_inic162x-inic162x-is-not-dependent-on-CONFIG_AT.patch 0003-sata_mv-remove-unnecessary-initialization.patch 0004-libata-sff-update-bmdma-host-bus-error-handling.patch 0005-libata-sff-kill-unused-prototype-and-make-ata_dev_se.patch 0006-libata-kill-ATA_FLAG_DISABLED.patch 0007-sata_inic162x-kill-PORT_PRD_ADDR-initialization.patch 0008-libata-sff-reorder-SFF-BMDMA-functions.patch 0009-libata-sff-clean-up-inheritance-in-several-drivers.patch 0010-libata-sff-clean-up-BMDMA-initialization.patch 0011-libata-sff-introduce-ata_sff_init-exit-and-ata_sff_p.patch 0012-libata-sff-rename-ap-ops-drain_fifo-to-sff_drain_fif.patch 0013-libata-sff-ap-last_-ctl-are-SFF-specific.patch 0014-libata-sff-port_task-is-SFF-specific.patch 0015-libata-sff-separate-out-BMDMA-EH.patch 0016-libata-sff-ata_sff_-dumb_-qc_prep-are-BMDMA-specific.patch 0017-libata-sff-prd-is-BMDMA-specific.patch 0018-libata-sff-separate-out-BMDMA-qc_issue.patch 0019-libata-sff-ata_sff_irq_clear-is-BMDMA-specific.patch 0020-libata-sff-separate-out-BMDMA-irq-handler.patch 0021-libata-sff-separate-out-BMDMA-init.patch 0022-libata-sff-kill-dummy-BMDMA-ops-from-sata_qstor-and-.patch 0023-libata-sff-make-BMDMA-optional.patch
It's also available in the following git branch.
git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata-dev.git modularize-SFF
and contains the following changes.
drivers/ata/Kconfig | 521 +++++------ drivers/ata/Makefile | 83 + drivers/ata/ata_generic.c | 2 drivers/ata/ata_piix.c | 4 drivers/ata/libata-core.c | 179 --- drivers/ata/libata-eh.c | 6 drivers/ata/libata-scsi.c | 3 drivers/ata/libata-sff.c | 1640 +++++++++++++++++++++--------------- drivers/ata/libata.h | 29 drivers/ata/pata_acpi.c | 10 drivers/ata/pata_ali.c | 7 drivers/ata/pata_amd.c | 2 drivers/ata/pata_artop.c | 2 drivers/ata/pata_at91.c | 1 drivers/ata/pata_atiixp.c | 6 drivers/ata/pata_atp867x.c | 2 drivers/ata/pata_bf54x.c | 20 drivers/ata/pata_cmd640.c | 10 drivers/ata/pata_cmd64x.c | 2 drivers/ata/pata_cs5520.c | 4 drivers/ata/pata_cs5530.c | 6 drivers/ata/pata_cs5535.c | 2 drivers/ata/pata_cs5536.c | 2 drivers/ata/pata_cypress.c | 2 drivers/ata/pata_efar.c | 4 drivers/ata/pata_hpt366.c | 4 drivers/ata/pata_hpt37x.c | 6 drivers/ata/pata_hpt3x2n.c | 4 drivers/ata/pata_hpt3x3.c | 2 drivers/ata/pata_icside.c | 7 drivers/ata/pata_it8213.c | 2 drivers/ata/pata_it821x.c | 8 drivers/ata/pata_jmicron.c | 2 drivers/ata/pata_macio.c | 7 drivers/ata/pata_marvell.c | 2 drivers/ata/pata_mpc52xx.c | 2 drivers/ata/pata_netcell.c | 2 drivers/ata/pata_ninja32.c | 2 drivers/ata/pata_ns87415.c | 4 drivers/ata/pata_octeon_cf.c | 27 drivers/ata/pata_oldpiix.c | 4 drivers/ata/pata_optidma.c | 2 drivers/ata/pata_pcmcia.c | 2 drivers/ata/pata_pdc2027x.c | 6 drivers/ata/pata_pdc202xx_old.c | 4 drivers/ata/pata_piccolo.c | 2 drivers/ata/pata_platform.c | 1 drivers/ata/pata_radisys.c | 4 drivers/ata/pata_rdc.c | 4 drivers/ata/pata_sc1200.c | 6 drivers/ata/pata_scc.c | 15 drivers/ata/pata_sch.c | 12 drivers/ata/pata_serverworks.c | 8 drivers/ata/pata_sil680.c | 4 drivers/ata/pata_sis.c | 2 drivers/ata/pata_sl82c105.c | 2 drivers/ata/pata_triflex.c | 2 drivers/ata/pata_via.c | 6 drivers/ata/pdc_adma.c | 74 - drivers/ata/sata_inic162x.c | 25 drivers/ata/sata_mv.c | 51 - drivers/ata/sata_nv.c | 266 ++--- drivers/ata/sata_promise.c | 32 drivers/ata/sata_qstor.c | 104 -- drivers/ata/sata_sil.c | 13 drivers/ata/sata_sil24.c | 9 drivers/ata/sata_sis.c | 4 drivers/ata/sata_svw.c | 4 drivers/ata/sata_sx4.c | 10 drivers/ata/sata_uli.c | 6 drivers/ata/sata_via.c | 8 drivers/ata/sata_vsc.c | 12 drivers/scsi/ipr.c | 6 drivers/scsi/libsas/sas_scsi_host.c | 2 include/linux/ata.h | 2 include/linux/libata.h | 99 +- 76 files changed, 1743 insertions(+), 1700 deletions(-)
Thanks.
--
tejun
PATCH 1/23 pata_sch: use ata_pci_sff_init_one()
pata_sch is standard SFF. No reason to open code init. Use ata_pci_sff_init_one() instead.
--- drivers/ata/pata_sch.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-)
drivers/ata/pata_sch.c +1 -11
@@ -174,22 +174,12 @@ static int __devinit sch_init_one(struct pci_dev *pdev, {static int printed_version;const struct ata_port_info *ppi[] = { &sch_port_info,NULL }; -struct ata_host *host; -int rc;if (!printed_version++)dev_printk (KERN_DEBUG , &pdev->dev,"version " DRV_VERSION "\n" ); -/* enable device and prepare host */ - rc =pcim_enable_device (pdev); -if (rc) -return rc; - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); -if (rc) -return rc; -pci_set_master (pdev); -return ata_pci_sff_activate_host (host, ata_sff_interrupt, &sch_sht); +return ata_pci_sff_init_one (pdev, ppi, &sch_sht,NULL ,0 ); }static int __init sch_init (void )
Signature · 1 line
1.6.4.2
Re: [PATCH 01/23] pata_sch: use ata_pci_sff_init_one()
Quoted 7 lines · Tejun Heo
pata_schis standard SFF. No reason to open code init. Useata_pci_sff_init_one()instead.Signed-off-by Tejun Heo<[email protected]>--- drivers/ata/pata_sch.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-)
applied 1-5
PATCH 2/23 sata_inic162x: inic162x is not dependent on CONFIG_ATA_SFF
In reply to Tejun Heosata_inic162x no longer uses SFF interface. Move it out of CONFIG_ATA_SFF.
--- drivers/ata/Kconfig | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/ata/Kconfig +6 -6
@@ -81,6 +81,12 @@ config SATA_SIL24 If unsure, say N. +config SATA_INIC162X + tristate "Initio 162x SATA support" + depends on PCI + help + This option enables support for Initio 162x Serial ATA. + config SATA_FSL tristate "Freescale 3.0Gbps SATA support" depends on FSL_SOC
@@ -221,12 +227,6 @@ config SATA_VITESSE If unsure, say N. -config SATA_INIC162X - tristate "Initio 162x SATA support" - depends on PCI - help - This option enables support for Initio 162x Serial ATA. - config PATA_ACPI tristate "ACPI firmware driver for PATA" depends on ATA_ACPI
Signature · 1 line
1.6.4.2
PATCH 3/23 sata_mv: remove unnecessary initialization
In reply to Tejun Heosata_mv initializes unused ioports fields including bmdma_addr to NULL. As later changes will conditionalize BMDMA, this makes sata_mv unnecessarily dependent on BMDMA. Remove the unnecessary initialization.
--- drivers/ata/sata_mv.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/ata/sata_mv.c +0 -3
@@ -3656,9 +3656,6 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio)/* special case: control/altstatus doesn't have ATA_REG_ address */ port->altstatus_addr = port->ctl_addr = shd_base +SHD_CTL_AST ; -/* unused: */ - port->cmd_addr = port->bmdma_addr = port->scr_addr =NULL ; -/* Clear any currently outstanding port interrupt conditions */ serr = port_mmio +mv_scr_offset (SCR_ERROR );writelfl (readl (serr), serr);
Signature · 1 line
1.6.4.2
PATCH 4/23 libata-sff: update bmdma host bus error handling
In reply to Tejun Heo* Clearing IRQ from ata_sff_error_handler() is necessary only when the port is gonna be thawed before performing EH actions and some controllers don't like being accessed after certain failure modes until they're reset. Clear IRQ iff the port is being thawed.
* When the controller succesfully indicated bus error, the point of thawing doesn't matter. Move thawing inside bmdma part of EH. This is a bit ugly but will ease code reorganization later.
* Remove the unneeded ata_sff_sync().
--- drivers/ata/libata-sff.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
drivers/ata/libata-sff.c +12 -8
@@ -2359,7 +2359,7 @@ void ata_sff_error_handler(struct ata_port *ap)ata_reset_fn_t hardreset = ap->ops->hardreset;struct ata_queued_cmd *qc;unsigned long flags; -int thaw =0 ; +bool thaw = false; qc =__ata_qc_from_tag (ap, ap->link.active_tag);if (qc && !(qc->flags &ATA_QCFLAG_FAILED ))
@@ -2385,15 +2385,22 @@ void ata_sff_error_handler(struct ata_port *ap)if (qc->err_mask ==AC_ERR_TIMEOUT && (host_stat &ATA_DMA_ERR )) { qc->err_mask =AC_ERR_HOST_BUS ; - thaw =1 ; + thaw = true; } ap->ops->bmdma_stop (qc); + +/* if we're gonna thaw, make sure IRQ is clear */ +if (thaw) { + ap->ops->sff_check_status (ap); + ap->ops->sff_irq_clear (ap); + +spin_unlock_irqrestore (ap->lock, flags); +ata_eh_thaw_port (ap); +spin_lock_irqsave (ap->lock, flags); + } } -ata_sff_sync (ap);/* FIXME: We don't need this */ - ap->ops->sff_check_status (ap); - ap->ops->sff_irq_clear (ap);/* We *MUST* do FIFO draining before we issue a reset as several * devices helpfully clear their internal state and will lock solid * if we touch the data port post reset. Pass qc in case anyone wants
@@ -2404,9 +2411,6 @@ void ata_sff_error_handler(struct ata_port *ap)spin_unlock_irqrestore (ap->lock, flags); -if (thaw) -ata_eh_thaw_port (ap); -/* PIO and DMA engines have been stopped, perform recovery */ /* Ignore ata_sff_softreset if ctl isn't accessible and
Signature · 1 line
1.6.4.2
PATCH 5/23 libata-sff: kill unused prototype and make ata_dev_select() static
In reply to Tejun Heoata_irq_on() was renamed to ata_sff_irq_on() and exported a while ago but prototype for the original function lingered in drivers/ata/libata.h. Kill it. Also, ata_dev_select() is only used inside drivers/ata/libata-sff.c. Make it static.
--- drivers/ata/libata-sff.c | 2 +- drivers/ata/libata.h | 3 --- 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/ata/libata-sff.c +1 -1
@@ -491,7 +491,7 @@ EXPORT_SYMBOL_GPL(ata_sff_dev_select);* LOCKING: * caller. */ -void ata_dev_select (struct ata_port *ap,unsigned int device, +static void ata_dev_select (struct ata_port *ap,unsigned int device,unsigned int wait,unsigned int can_sleep) {if (ata_msg_probe (ap))
drivers/ata/libata.h +0 -3
@@ -202,9 +202,6 @@ static inline int sata_pmp_attach(struct ata_device *dev)/* libata-sff.c */ #ifdef CONFIG_ATA_SFF -extern void ata_dev_select (struct ata_port *ap,unsigned int device, -unsigned int wait,unsigned int can_sleep); -extern u8 ata_irq_on (struct ata_port *ap);extern void ata_pio_task (struct work_struct *work);#endif /* CONFIG_ATA_SFF */
Signature · 1 line
1.6.4.2
PATCH 6/23 libata: kill ATA_FLAG_DISABLED
In reply to Tejun HeoATA_FLAG_DISABLED is only used by drivers which don't use ->error_handler framework and is largely broken. Its only meaningful function is to make irq handlers skip processing if the flag is set, which is largely useless and even harmful as it makes those ports more likely to cause IRQ storms.
Kill ATA_FLAG_DISABLED and makes the callers disable attached devices instead. ata_port_probe() and ata_port_disable() which manipulate the flag are also killed.
This simplifies condition check in IRQ handlers. While updating IRQ handlers, remove ap NULL check as libata guarantees consecutive port allocation (unoccupied ports are initialized with dummies) and long-obsolete ATA_QCFLAG_ACTIVE check (checked by ata_qc_from_tag()).
--- drivers/ata/libata-core.c | 66 +---------- drivers/ata/libata-scsi.c | 3 - drivers/ata/libata-sff.c | 10 +-- drivers/ata/pata_bf54x.c | 16 +-- drivers/ata/pata_octeon_cf.c | 9 +- drivers/ata/pdc_adma.c | 66 +++++------ drivers/ata/sata_inic162x.c | 17 +-- drivers/ata/sata_mv.c | 18 +-- drivers/ata/sata_nv.c | 238 +++++++++++++++++------------------ drivers/ata/sata_promise.c | 6 +- drivers/ata/sata_qstor.c | 79 ++++++------ drivers/ata/sata_sil.c | 3 - drivers/ata/sata_sil24.c | 9 +- drivers/ata/sata_sx4.c | 3 +- drivers/ata/sata_vsc.c | 10 +-- drivers/scsi/ipr.c | 6 +- drivers/scsi/libsas/sas_scsi_host.c | 2 +- include/linux/libata.h | 8 -- 18 files changed, 210 insertions(+), 359 deletions(-)
drivers/ata/libata-core.c +1 -65
@@ -1907,22 +1907,6 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, ap->qc_active = preempted_qc_active; ap->nr_active_links = preempted_nr_active_links; -/* XXX - Some LLDDs (sata_mv) disable port on command failure. -* Until those drivers are fixed, we detect the condition -* here, fail the command with AC_ERR_SYSTEM and reenable the -* port. -* -* Note that this doesn't change any behavior as internal -* command failure results in disabling the device in the -* higher layer for LLDDs without new reset/EH callbacks. -* -* Kill the following code as soon as those drivers are fixed. -*/ -if (ap->flags &ATA_FLAG_DISABLED ) { - err_mask |=AC_ERR_SYSTEM ; -ata_port_probe (ap); - } -spin_unlock_irqrestore (ap->lock, flags);if ((err_mask &AC_ERR_TIMEOUT ) && auto_timeout)
@@ -2768,8 +2752,6 @@ int ata_bus_probe(struct ata_port *ap)int rc;struct ata_device *dev; -ata_port_probe (ap); -ata_for_each_dev (dev, &ap->link,ALL ) tries[dev->devno] =ATA_PROBE_MAX_TRIES ;
@@ -2797,8 +2779,7 @@ int ata_bus_probe(struct ata_port *ap) ap->ops->phy_reset (ap);ata_for_each_dev (dev, &ap->link,ALL ) { -if (!(ap->flags &ATA_FLAG_DISABLED ) && - dev->class !=ATA_DEV_UNKNOWN ) +if (dev->class !=ATA_DEV_UNKNOWN ) classes[dev->devno] = dev->class;else classes[dev->devno] =ATA_DEV_NONE ;
@@ -2806,8 +2787,6 @@ int ata_bus_probe(struct ata_port *ap) dev->class =ATA_DEV_UNKNOWN ; } -ata_port_probe (ap); -/* read IDENTIFY page and configure devices. We have to do the identify specific sequence bass-ackwards so that PDIAG- is released by the slave device */
@@ -2857,8 +2836,6 @@ int ata_bus_probe(struct ata_port *ap)ata_for_each_dev (dev, &ap->link,ENABLED )return 0 ; -/* no device present, disable port */ -ata_port_disable (ap);return -ENODEV ; fail:
@@ -2890,22 +2867,6 @@ int ata_bus_probe(struct ata_port *ap) }/** -* ata_port_probe - Mark port as enabled -* @ap: Port for which we indicate enablement -* -* Modify @ap data structure such that the system -* thinks that the entire port is enabled. -* -* LOCKING: host lock, or some other form of -* serialization. -*/ - -void ata_port_probe (struct ata_port *ap) -{ - ap->flags &= ~ATA_FLAG_DISABLED ; -} - -/** * sata_print_link_status - Print SATA link status * @link: SATA link to printk link status about *
@@ -2952,26 +2913,6 @@ struct ata_device *ata_dev_pair(struct ata_device *adev) }/** -* ata_port_disable - Disable port. -* @ap: Port to be disabled. -* -* Modify @ap data structure such that the system -* thinks that the entire port is disabled, and should -* never attempt to probe or communicate with devices -* on this port. -* -* LOCKING: host lock, or some other form of -* serialization. -*/ - -void ata_port_disable (struct ata_port *ap) -{ - ap->link.device[0 ].class =ATA_DEV_NONE ; - ap->link.device[1 ].class =ATA_DEV_NONE ; - ap->flags |=ATA_FLAG_DISABLED ; -} - -/** * sata_down_spd_limit - adjust SATA spd limit downward * @link: Link to adjust SATA spd limit for * @spd_limit: Additional limit
@@ -5716,7 +5657,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->pflags |=ATA_PFLAG_INITIALIZING ; ap->lock = &host->lock; - ap->flags =ATA_FLAG_DISABLED ; ap->print_id =-1 ; ap->ctl =ATA_DEVCTL_OBS ; ap->host = host;
@@ -6145,8 +6085,6 @@ static void async_port_probe(void *data, async_cookie_t cookie)struct ata_eh_info *ehi = &ap->link.eh_info;unsigned long flags; -ata_port_probe (ap); -/* kick EH for boot probing */ spin_lock_irqsave (ap->lock, flags);
@@ -6823,7 +6761,6 @@ EXPORT_SYMBOL_GPL(ata_port_start);EXPORT_SYMBOL_GPL (ata_do_set_mode);EXPORT_SYMBOL_GPL (ata_std_qc_defer);EXPORT_SYMBOL_GPL (ata_noop_qc_prep); -EXPORT_SYMBOL_GPL (ata_port_probe);EXPORT_SYMBOL_GPL (ata_dev_disable);EXPORT_SYMBOL_GPL (sata_set_spd);EXPORT_SYMBOL_GPL (ata_wait_after_reset);
@@ -6835,7 +6772,6 @@ EXPORT_SYMBOL_GPL(sata_std_hardreset);EXPORT_SYMBOL_GPL (ata_std_postreset);EXPORT_SYMBOL_GPL (ata_dev_classify);EXPORT_SYMBOL_GPL (ata_dev_pair); -EXPORT_SYMBOL_GPL (ata_port_disable);EXPORT_SYMBOL_GPL (ata_ratelimit);EXPORT_SYMBOL_GPL (ata_wait_register);EXPORT_SYMBOL_GPL (ata_scsi_queuecmd);
drivers/ata/libata-scsi.c +0 -3
@@ -3345,9 +3345,6 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)struct ata_link *link;struct ata_device *dev; -if (ap->flags &ATA_FLAG_DISABLED ) -return ; - repeat:ata_for_each_link (link, ap,EDGE ) {ata_for_each_dev (dev, link,ENABLED ) {
drivers/ata/libata-sff.c +2 -8
@@ -1785,9 +1785,6 @@ retry:struct ata_port *ap = host->ports[i];struct ata_queued_cmd *qc; -if (unlikely (ap->flags &ATA_FLAG_DISABLED )) -continue ; - qc =ata_qc_from_tag (ap, ap->link.active_tag);if (qc) {if (!(qc->tf.flags &ATA_TFLAG_POLLING ))
@@ -1862,11 +1859,8 @@ void ata_sff_lost_interrupt(struct ata_port *ap)/* Only one outstanding command per SFF channel */ qc =ata_qc_from_tag (ap, ap->link.active_tag); -/* Check we have a live one.. */ -if (qc ==NULL || !(qc->flags &ATA_QCFLAG_ACTIVE )) -return ; -/* We cannot lose an interrupt on a polled command */ -if (qc->tf.flags &ATA_TFLAG_POLLING ) +/* We cannot lose an interrupt on a non-existent or polled command */ +if (!qc || qc->tf.flags &ATA_TFLAG_POLLING )return ;/* See if the controller thinks it is still busy - if so the command isn't a lost IRQ but is still in progress */
drivers/ata/pata_bf54x.c +5 -11
@@ -1438,18 +1438,12 @@ static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance)spin_lock_irqsave (&host->lock, flags);for (i =0 ; i < host->n_ports; i++) { -struct ata_port *ap; +struct ata_port *ap = host->ports[i]; +struct ata_queued_cmd *qc; - ap = host->ports[i]; -if (ap && - !(ap->flags &ATA_FLAG_DISABLED )) { -struct ata_queued_cmd *qc; - - qc =ata_qc_from_tag (ap, ap->link.active_tag); -if (qc && (!(qc->tf.flags &ATA_TFLAG_POLLING )) && - (qc->flags &ATA_QCFLAG_ACTIVE )) - handled |=bfin_ata_host_intr (ap, qc); - } + qc =ata_qc_from_tag (ap, ap->link.active_tag); +if (qc && (!(qc->tf.flags &ATA_TFLAG_POLLING ))) + handled |=bfin_ata_host_intr (ap, qc); }spin_unlock_irqrestore (&host->lock, flags);
drivers/ata/pata_octeon_cf.c +2 -7
@@ -655,9 +655,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance) ap = host->ports[i]; ocd = ap->dev->platform_data; -if (ap->flags &ATA_FLAG_DISABLED ) -continue ; - ocd = ap->dev->platform_data; cf_port = ap->private_data; dma_int.u64 =
@@ -667,8 +664,7 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance) qc =ata_qc_from_tag (ap, ap->link.active_tag); -if (qc && (!(qc->tf.flags &ATA_TFLAG_POLLING )) && - (qc->flags &ATA_QCFLAG_ACTIVE )) { +if (qc && !(qc->tf.flags &ATA_TFLAG_POLLING )) {if (dma_int.s.done && !dma_cfg.s.en) {if (!sg_is_last (qc->cursg)) { qc->cursg =sg_next (qc->cursg);
@@ -738,8 +734,7 @@ static void octeon_cf_delayed_finish(struct work_struct *work) goto out; } qc =ata_qc_from_tag (ap, ap->link.active_tag); -if (qc && (!(qc->tf.flags &ATA_TFLAG_POLLING )) && - (qc->flags &ATA_QCFLAG_ACTIVE )) +if (qc && !(qc->tf.flags &ATA_TFLAG_POLLING ))octeon_cf_dma_finished (ap, qc); out:spin_unlock_irqrestore (&host->lock, flags);
drivers/ata/pdc_adma.c +30 -36
80 lines not on this page · raw message
drivers/ata/sata_inic162x.c +3 -14
@@ -415,22 +415,11 @@ static irqreturn_t inic_interrupt(int irq, void *dev_instance)spin_lock (&host->lock); -for (i =0 ; i <NR_PORTS ; i++) { -struct ata_port *ap = host->ports[i]; - -if (!(host_irq_stat & (HIRQ_PORT0 << i))) -continue ; - -if (likely (ap && !(ap->flags &ATA_FLAG_DISABLED ))) { -inic_host_intr (ap); +for (i =0 ; i <NR_PORTS ; i++) +if (host_irq_stat & (HIRQ_PORT0 << i)) { +inic_host_intr (host->ports[i]); handled++; - }else { -if (ata_ratelimit ()) -dev_printk (KERN_ERR , host->dev,"interrupt " -"from disabled port %d (0x%x)\n" , - i, host_irq_stat); } - }spin_unlock (&host->lock);
drivers/ata/sata_mv.c +4 -14
@@ -2355,13 +2355,9 @@ static struct ata_queued_cmd *mv_get_active_qc(struct ata_port *ap)if (pp->pp_flags &MV_PP_FLAG_NCQ_EN )return NULL ; qc =ata_qc_from_tag (ap, ap->link.active_tag); -if (qc) { -if (qc->tf.flags &ATA_TFLAG_POLLING ) - qc =NULL ; -else if (!(qc->flags &ATA_QCFLAG_ACTIVE )) - qc =NULL ; - } -return qc; +if (qc && !(qc->tf.flags &ATA_TFLAG_POLLING )) +return qc; +return NULL ; }static void mv_pmp_error_handler (struct ata_port *ap)
@@ -2546,9 +2542,7 @@ static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled)char *when ="idle" ;ata_ehi_clear_desc (ehi); -if (ap->flags &ATA_FLAG_DISABLED ) { - when ="disabled" ; - }else if (edma_was_enabled) { +if (edma_was_enabled) { when ="EDMA enabled" ; }else {struct ata_queued_cmd *qc =ata_qc_from_tag (ap, ap->link.active_tag);
@@ -2782,10 +2776,6 @@ static void mv_port_intr(struct ata_port *ap, u32 port_cause)struct mv_port_priv *pp;int edma_was_enabled; -if (ap->flags &ATA_FLAG_DISABLED ) { -mv_unexpected_intr (ap,0 ); -return ; - }/* * Grab a snapshot of the EDMA_EN flag setting, * so that we have a consistent view for this port,
drivers/ata/sata_nv.c +114 -122
270 lines not on this page · raw message
drivers/ata/sata_promise.c +2 -4
@@ -984,8 +984,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)/* check for a plug or unplug event */ ata_no =pdc_port_no_to_ata_no (i, is_sataii_tx4); tmp = hotplug_status & (0x11 << ata_no); -if (tmp && ap && - !(ap->flags &ATA_FLAG_DISABLED )) { +if (tmp) {struct ata_eh_info *ehi = &ap->link.eh_info;ata_ehi_clear_desc (ehi);ata_ehi_hotplugged (ehi);
@@ -997,8 +996,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)/* check for a packet interrupt */ tmp = mask & (1 << (i +1 )); -if (tmp && ap && - !(ap->flags &ATA_FLAG_DISABLED )) { +if (tmp) {struct ata_queued_cmd *qc; qc =ata_qc_from_tag (ap, ap->link.active_tag);
drivers/ata/sata_qstor.c +37 -42
96 lines not on this page · raw message
drivers/ata/sata_sil.c +0 -3
@@ -532,9 +532,6 @@ static irqreturn_t sil_interrupt(int irq, void *dev_instance)struct ata_port *ap = host->ports[i];u32 bmdma2 =readl (mmio_base + sil_port[ap->port_no].bmdma2); -if (unlikely (ap->flags &ATA_FLAG_DISABLED )) -continue ; -/* turn off SATA_IRQ if not supported */ if (ap->flags &SIL_FLAG_NO_SATA_IRQ ) bmdma2 &= ~SIL_DMA_SATA_IRQ ;
drivers/ata/sata_sil24.c +2 -7
@@ -1160,13 +1160,8 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance)for (i =0 ; i < host->n_ports; i++)if (status & (1 << i)) { -struct ata_port *ap = host->ports[i]; -if (ap && !(ap->flags &ATA_FLAG_DISABLED )) { -sil24_host_intr (ap); - handled++; - }else - printk(KERN_ERR DRV_NAME -": interrupt from disabled port %d\n" , i); +sil24_host_intr (host->ports[i]); + handled++; }spin_unlock (&host->lock);
drivers/ata/sata_sx4.c +1 -2
@@ -840,8 +840,7 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance) ap = host->ports[port_no]; tmp = mask & (1 << i);VPRINTK ("seq %u, port_no %u, ap %p, tmp %x\n" , i, port_no, ap, tmp); -if (tmp && ap && - !(ap->flags &ATA_FLAG_DISABLED )) { +if (tmp && ap) {struct ata_queued_cmd *qc; qc =ata_qc_from_tag (ap, ap->link.active_tag);
drivers/ata/sata_vsc.c +2 -8
@@ -284,14 +284,8 @@ static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance)for (i =0 ; i < host->n_ports; i++) {u8 port_status = (status >> (8 * i)) &0xff ;if (port_status) { -struct ata_port *ap = host->ports[i]; - -if (ap && !(ap->flags &ATA_FLAG_DISABLED )) { -vsc_port_intr (port_status, ap); - handled++; - }else -dev_printk (KERN_ERR , host->dev, -"interrupt from disabled port %d\n" , i); +vsc_port_intr (port_status, host->ports[i]); + handled++; } }
drivers/scsi/ipr.c +3 -3
@@ -4295,7 +4295,7 @@ static void ipr_slave_destroy(struct scsi_device *sdev) res = (struct ipr_resource_entry *) sdev->hostdata;if (res) {if (res->sata_port) -ata_port_disable (res->sata_port->ap); + res->sata_port->ap->link.device[0 ].class =ATA_DEV_NONE ; sdev->hostdata =NULL ; res->sdev =NULL ; res->sata_port =NULL ;
@@ -5751,13 +5751,13 @@ static void ipr_ata_phy_reset(struct ata_port *ap) rc =ipr_device_reset (ioa_cfg, res);if (rc) { -ata_port_disable (ap); + ap->link.device[0 ].class =ATA_DEV_NONE ; goto out_unlock; } ap->link.device[0 ].class = res->ata_class;if (ap->link.device[0 ].class ==ATA_DEV_UNKNOWN ) -ata_port_disable (ap); + ap->link.device[0 ].class =ATA_DEV_NONE ; out_unlock:spin_unlock_irqrestore (ioa_cfg->host->host_lock, flags);
drivers/scsi/libsas/sas_scsi_host.c +1 -1
@@ -818,7 +818,7 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)struct domain_device *dev =sdev_to_domain_dev (scsi_dev);if (dev_is_sata (dev)) -ata_port_disable (dev->sata_dev.ap); + dev->sata_dev.ap->link.device[0 ].class =ATA_DEV_NONE ; } int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
include/linux/libata.h +0 -8
@@ -202,12 +202,6 @@ enum { ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity* led */ -/* The following flag belongs to ap->pflags but is kept in -* ap->flags because it's referenced in many LLDs and will be -* removed in not-too-distant future. -*/ - ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */ -/* bits 24:31 of ap->flags are reserved for LLD specific flags */
@@ -936,7 +930,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)return ap->ops == &ata_dummy_port_ops; } -extern void ata_port_probe (struct ata_port *);extern int sata_set_spd (struct ata_link *link);extern int ata_std_prereset (struct ata_link *link,unsigned long deadline); extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
@@ -951,7 +944,6 @@ extern int sata_link_hardreset(struct ata_link *link,extern int sata_std_hardreset (struct ata_link *link,unsigned int *class,unsigned long deadline);extern void ata_std_postreset (struct ata_link *link,unsigned int *classes); -extern void ata_port_disable (struct ata_port *);extern struct ata_host *ata_host_alloc (struct device *dev,int max_ports); extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
Signature · 1 line
1.6.4.2
Re: [PATCH 06/23] libata: kill ATA_FLAG_DISABLED
Quoted 28 lines · Tejun Heo
ATA_FLAG_DISABLEDis only used by drivers which don't use ->error_handler framework and is largely broken. Its only meaningful function is to make irq handlers skip processing if the flag is set, which is largely useless and even harmful as it makes those ports more likely to cause IRQ storms.Kill
ATA_FLAG_DISABLEDand makes the callers disable attached devices instead.ata_port_probe()andata_port_disable()which manipulate the flag are also killed.This simplifies condition check in IRQ handlers. While updating IRQ handlers, remove ap NULL check as libata guarantees consecutive port allocation (unoccupied ports are initialized with dummies) and long-obsolete
ATA_QCFLAG_ACTIVEcheck (checked byata_qc_from_tag()).Signed-off-by Tejun Heo<[email protected]>--- drivers/ata/libata-core.c | 66 +---------- drivers/ata/libata-scsi.c | 3 - drivers/ata/libata-sff.c | 10 +-- drivers/ata/pata_bf54x.c | 16 +-- drivers/ata/pata_octeon_cf.c | 9 +- drivers/ata/pdc_adma.c | 66 +++++------ drivers/ata/sata_inic162x.c | 17 +-- drivers/ata/sata_mv.c | 18 +-- drivers/ata/sata_nv.c | 238 +++++++++++++++++------------------ drivers/ata/sata_promise.c | 6 +- drivers/ata/sata_qstor.c | 79 ++++++------
Quoted 8 lines
drivers/ata/sata_sil.c | 3 - drivers/ata/sata_sil24.c | 9 +- drivers/ata/sata_sx4.c | 3 +- drivers/ata/sata_vsc.c | 10 +-- drivers/scsi/ipr.c | 6 +- drivers/scsi/libsas/sas_scsi_host.c | 2 +- include/linux/libata.h | 8 -- 18 files changed, 210 insertions(+), 359 deletions(-)
applied 6-8
PATCH 7/23 sata_inic162x: kill PORT_PRD_ADDR initialization
In reply to Tejun Heosata_inic162x doesn't use PRD anymore. No need to initialize it.
--- drivers/ata/sata_inic162x.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/ata/sata_inic162x.c +1 -2
@@ -668,8 +668,7 @@ static void init_port(struct ata_port *ap)memset (pp->pkt,0 ,sizeof (struct inic_pkt ));memset (pp->cpb_tbl,0 ,IDMA_CPB_TBL_SIZE ); -/* setup PRD and CPB lookup table addresses */ -writel (ap->prd_dma, port_base +PORT_PRD_ADDR ); +/* setup CPB lookup table addresses */ writel (pp->cpb_tbl_dma, port_base +PORT_CPB_CPBLAR ); }
Signature · 1 line
1.6.4.2
PATCH 8/23 libata-sff: reorder SFF/BMDMA functions
In reply to Tejun HeoReorder functions such that SFF and BMDMA functions are grouped. While at it, s/BMDMA/SFF in a few comments where it actually meant SFF.
--- drivers/ata/libata-sff.c | 448 +++++++++++++++++++++++----------------------- include/linux/libata.h | 21 ++- 2 files changed, 238 insertions(+), 231 deletions(-)
drivers/ata/libata-sff.c +226 -222
@@ -72,26 +72,6 @@ const struct ata_port_operations ata_sff_port_ops = { };EXPORT_SYMBOL_GPL (ata_sff_port_ops); -const struct ata_port_operations ata_bmdma_port_ops = { - .inherits = &ata_sff_port_ops, - - .mode_filter = ata_bmdma_mode_filter, - - .bmdma_setup = ata_bmdma_setup, - .bmdma_start = ata_bmdma_start, - .bmdma_stop = ata_bmdma_stop, - .bmdma_status = ata_bmdma_status, -}; -EXPORT_SYMBOL_GPL (ata_bmdma_port_ops); - -const struct ata_port_operations ata_bmdma32_port_ops = { - .inherits = &ata_bmdma_port_ops, - - .sff_data_xfer = ata_sff_data_xfer32, - .port_start = ata_sff_port_start32, -}; -EXPORT_SYMBOL_GPL (ata_bmdma32_port_ops); -/** * ata_fill_sg - Fill PCI IDE PRD table * @qc: Metadata associated with taskfile to be transferred
@@ -1728,7 +1708,7 @@ unsigned int ata_sff_host_intr(struct ata_port *ap, goto idle_irq; } -/* ack bmdma irq events */ +/* clear irq events */ ap->ops->sff_irq_clear (ap);ata_sff_hsm_move (ap, qc, status,0 );
@@ -1882,7 +1862,7 @@ EXPORT_SYMBOL_GPL(ata_sff_lost_interrupt);* ata_sff_freeze - Freeze SFF controller port * @ap: port to freeze * -* Freeze BMDMA controller port. +* Freeze SFF controller port. * * LOCKING: * Inherited from caller.
@@ -2513,208 +2493,8 @@ void ata_sff_std_ports(struct ata_ioports *ioaddr) }EXPORT_SYMBOL_GPL (ata_sff_std_ports); -unsigned long ata_bmdma_mode_filter (struct ata_device *adev, -unsigned long xfer_mask) -{ -/* Filter out DMA modes if the device has been configured by -the BIOS as PIO only */ - -if (adev->link->ap->ioaddr.bmdma_addr ==NULL ) - xfer_mask &= ~(ATA_MASK_MWDMA |ATA_MASK_UDMA ); -return xfer_mask; -} -EXPORT_SYMBOL_GPL (ata_bmdma_mode_filter); - -/** -* ata_bmdma_setup - Set up PCI IDE BMDMA transaction -* @qc: Info associated with this ATA transaction. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_bmdma_setup (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -unsigned int rw = (qc->tf.flags &ATA_TFLAG_WRITE ); -u8 dmactl; - -/* load PRD table addr. */ -mb ();/* make sure PRD table writes are visible to controller */ -iowrite32 (ap->prd_dma, ap->ioaddr.bmdma_addr +ATA_DMA_TABLE_OFS ); - -/* specify data direction, triple-check start bit is clear */ - dmactl =ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); - dmactl &= ~(ATA_DMA_WR |ATA_DMA_START ); -if (!rw) - dmactl |=ATA_DMA_WR ; -iowrite8 (dmactl, ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); - -/* issue r/w command */ - ap->ops->sff_exec_command (ap, &qc->tf); -} -EXPORT_SYMBOL_GPL (ata_bmdma_setup); - -/** -* ata_bmdma_start - Start a PCI IDE BMDMA transaction -* @qc: Info associated with this ATA transaction. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_bmdma_start (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -u8 dmactl; - -/* start host DMA transaction */ - dmactl =ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); -iowrite8 (dmactl |ATA_DMA_START , ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); - -/* Strictly, one may wish to issue an ioread8() here, to -* flush the mmio write. However, control also passes -* to the hardware at this point, and it will interrupt -* us when we are to resume control. So, in effect, -* we don't care when the mmio write flushes. -* Further, a read of the DMA status register _immediately_ -* following the write may not be what certain flaky hardware -* is expected, so I think it is best to not add a readb() -* without first all the MMIO ATA cards/mobos. -* Or maybe I'm just being paranoid. -* -* FIXME: The posting of this write means I/O starts are -* unneccessarily delayed for MMIO -*/ -} -EXPORT_SYMBOL_GPL (ata_bmdma_start); - -/** -* ata_bmdma_stop - Stop PCI IDE BMDMA transfer -* @qc: Command we are ending DMA for -* -* Clears the ATA_DMA_START flag in the dma control register -* -* May be used as the bmdma_stop() entry in ata_port_operations. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_bmdma_stop (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -void __iomem *mmio = ap->ioaddr.bmdma_addr; - -/* clear start/stop bit */ -iowrite8 (ioread8 (mmio +ATA_DMA_CMD ) & ~ATA_DMA_START , - mmio +ATA_DMA_CMD ); - -/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ -ata_sff_dma_pause (ap); -} -EXPORT_SYMBOL_GPL (ata_bmdma_stop); - -/** -* ata_bmdma_status - Read PCI IDE BMDMA status -* @ap: Port associated with this ATA transaction. -* -* Read and return BMDMA status register. -* -* May be used as the bmdma_status() entry in ata_port_operations. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -u8 ata_bmdma_status (struct ata_port *ap) -{ -return ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_STATUS ); -} -EXPORT_SYMBOL_GPL (ata_bmdma_status); -#ifdef CONFIG_PCI -/** -* ata_pci_bmdma_clear_simplex - attempt to kick device out of simplex -* @pdev: PCI device -* -* Some PCI ATA devices report simplex mode but in fact can be told to -* enter non simplex mode. This implements the necessary logic to -* perform the task on such devices. Calling it on other devices will -* have -undefined- behaviour. -*/ -int ata_pci_bmdma_clear_simplex (struct pci_dev *pdev) -{ -unsigned long bmdma =pci_resource_start (pdev,4 ); -u8 simplex; - -if (bmdma ==0 ) -return -ENOENT ; - - simplex =inb (bmdma +0x02 ); -outb (simplex &0x60 , bmdma +0x02 ); - simplex =inb (bmdma +0x02 ); -if (simplex &0x80 ) -return -EOPNOTSUPP ; -return 0 ; -} -EXPORT_SYMBOL_GPL (ata_pci_bmdma_clear_simplex); - -/** -* ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host -* @host: target ATA host -* -* Acquire PCI BMDMA resources and initialize @host accordingly. -* -* LOCKING: -* Inherited from calling layer (may sleep). -* -* RETURNS: -* 0 on success, -errno otherwise. -*/ -int ata_pci_bmdma_init (struct ata_host *host) -{ -struct device *gdev = host->dev; -struct pci_dev *pdev =to_pci_dev (gdev); -int i, rc; - -/* No BAR4 allocation: No DMA */ -if (pci_resource_start (pdev,4 ) ==0 ) -return 0 ; - -/* TODO: If we get no DMA mask we should fall back to PIO */ - rc =pci_set_dma_mask (pdev,ATA_DMA_MASK ); -if (rc) -return rc; - rc =pci_set_consistent_dma_mask (pdev,ATA_DMA_MASK ); -if (rc) -return rc; - -/* request and iomap DMA region */ - rc =pcim_iomap_regions (pdev,1 <<4 ,dev_driver_string (gdev)); -if (rc) { -dev_printk (KERN_ERR , gdev,"failed to request/iomap BAR4\n" ); -return -ENOMEM ; - } - host->iomap =pcim_iomap_table (pdev); - -for (i =0 ; i <2 ; i++) { -struct ata_port *ap = host->ports[i]; -void __iomem *bmdma = host->iomap[4 ] +8 * i; - -if (ata_port_is_dummy (ap)) -continue ; - - ap->ioaddr.bmdma_addr = bmdma; -if ((!(ap->flags &ATA_FLAG_IGN_SIMPLEX )) && - (ioread8 (bmdma +2 ) &0x80 )) - host->flags |=ATA_HOST_SIMPLEX ; - -ata_port_desc (ap,"bmdma 0x%llx" , - (unsigned long long )pci_resource_start (pdev,4 ) +8 * i); - } - -return 0 ; -} -EXPORT_SYMBOL_GPL (ata_pci_bmdma_init); -static int ata_resources_present (struct pci_dev *pdev,int port) {int i;
@@ -3039,3 +2819,227 @@ out:EXPORT_SYMBOL_GPL (ata_pci_sff_init_one);#endif /* CONFIG_PCI */ + +const struct ata_port_operations ata_bmdma_port_ops = { + .inherits = &ata_sff_port_ops, + + .mode_filter = ata_bmdma_mode_filter, + + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, + .bmdma_stop = ata_bmdma_stop, + .bmdma_status = ata_bmdma_status, +}; +EXPORT_SYMBOL_GPL (ata_bmdma_port_ops); + +const struct ata_port_operations ata_bmdma32_port_ops = { + .inherits = &ata_bmdma_port_ops, + + .sff_data_xfer = ata_sff_data_xfer32, + .port_start = ata_sff_port_start32, +}; +EXPORT_SYMBOL_GPL (ata_bmdma32_port_ops); + +unsigned long ata_bmdma_mode_filter (struct ata_device *adev, +unsigned long xfer_mask) +{ +/* Filter out DMA modes if the device has been configured by +the BIOS as PIO only */ + +if (adev->link->ap->ioaddr.bmdma_addr ==NULL ) + xfer_mask &= ~(ATA_MASK_MWDMA |ATA_MASK_UDMA ); +return xfer_mask; +} +EXPORT_SYMBOL_GPL (ata_bmdma_mode_filter); + +/** +* ata_bmdma_setup - Set up PCI IDE BMDMA transaction +* @qc: Info associated with this ATA transaction. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +void ata_bmdma_setup (struct ata_queued_cmd *qc) +{ +struct ata_port *ap = qc->ap; +unsigned int rw = (qc->tf.flags &ATA_TFLAG_WRITE ); +u8 dmactl; + +/* load PRD table addr. */ +mb ();/* make sure PRD table writes are visible to controller */ +iowrite32 (ap->prd_dma, ap->ioaddr.bmdma_addr +ATA_DMA_TABLE_OFS ); + +/* specify data direction, triple-check start bit is clear */ + dmactl =ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); + dmactl &= ~(ATA_DMA_WR |ATA_DMA_START ); +if (!rw) + dmactl |=ATA_DMA_WR ; +iowrite8 (dmactl, ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); + +/* issue r/w command */ + ap->ops->sff_exec_command (ap, &qc->tf); +} +EXPORT_SYMBOL_GPL (ata_bmdma_setup); + +/** +* ata_bmdma_start - Start a PCI IDE BMDMA transaction +* @qc: Info associated with this ATA transaction. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +void ata_bmdma_start (struct ata_queued_cmd *qc) +{ +struct ata_port *ap = qc->ap; +u8 dmactl; + +/* start host DMA transaction */ + dmactl =ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); +iowrite8 (dmactl |ATA_DMA_START , ap->ioaddr.bmdma_addr +ATA_DMA_CMD ); + +/* Strictly, one may wish to issue an ioread8() here, to +* flush the mmio write. However, control also passes +* to the hardware at this point, and it will interrupt +* us when we are to resume control. So, in effect, +* we don't care when the mmio write flushes. +* Further, a read of the DMA status register _immediately_ +* following the write may not be what certain flaky hardware +* is expected, so I think it is best to not add a readb() +* without first all the MMIO ATA cards/mobos. +* Or maybe I'm just being paranoid. +* +* FIXME: The posting of this write means I/O starts are +* unneccessarily delayed for MMIO +*/ +} +EXPORT_SYMBOL_GPL (ata_bmdma_start); + +/** +* ata_bmdma_stop - Stop PCI IDE BMDMA transfer +* @qc: Command we are ending DMA for +* +* Clears the ATA_DMA_START flag in the dma control register +* +* May be used as the bmdma_stop() entry in ata_port_operations. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +void ata_bmdma_stop (struct ata_queued_cmd *qc) +{ +struct ata_port *ap = qc->ap; +void __iomem *mmio = ap->ioaddr.bmdma_addr; + +/* clear start/stop bit */ +iowrite8 (ioread8 (mmio +ATA_DMA_CMD ) & ~ATA_DMA_START , + mmio +ATA_DMA_CMD ); + +/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ +ata_sff_dma_pause (ap); +} +EXPORT_SYMBOL_GPL (ata_bmdma_stop); + +/** +* ata_bmdma_status - Read PCI IDE BMDMA status +* @ap: Port associated with this ATA transaction. +* +* Read and return BMDMA status register. +* +* May be used as the bmdma_status() entry in ata_port_operations. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +u8 ata_bmdma_status (struct ata_port *ap) +{ +return ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_STATUS ); +} +EXPORT_SYMBOL_GPL (ata_bmdma_status); + +#ifdef CONFIG_PCI + +/** +* ata_pci_bmdma_clear_simplex - attempt to kick device out of simplex +* @pdev: PCI device +* +* Some PCI ATA devices report simplex mode but in fact can be told to +* enter non simplex mode. This implements the necessary logic to +* perform the task on such devices. Calling it on other devices will +* have -undefined- behaviour. +*/ +int ata_pci_bmdma_clear_simplex (struct pci_dev *pdev) +{ +unsigned long bmdma =pci_resource_start (pdev,4 ); +u8 simplex; + +if (bmdma ==0 ) +return -ENOENT ; + + simplex =inb (bmdma +0x02 ); +outb (simplex &0x60 , bmdma +0x02 ); + simplex =inb (bmdma +0x02 ); +if (simplex &0x80 ) +return -EOPNOTSUPP ; +return 0 ; +} +EXPORT_SYMBOL_GPL (ata_pci_bmdma_clear_simplex); + +/** +* ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host +* @host: target ATA host +* +* Acquire PCI BMDMA resources and initialize @host accordingly. +* +* LOCKING: +* Inherited from calling layer (may sleep). +* +* RETURNS: +* 0 on success, -errno otherwise. +*/ +int ata_pci_bmdma_init (struct ata_host *host) +{ +struct device *gdev = host->dev; +struct pci_dev *pdev =to_pci_dev (gdev); +int i, rc; + +/* No BAR4 allocation: No DMA */ +if (pci_resource_start (pdev,4 ) ==0 ) +return 0 ; + +/* TODO: If we get no DMA mask we should fall back to PIO */ + rc =pci_set_dma_mask (pdev,ATA_DMA_MASK ); +if (rc) +return rc; + rc =pci_set_consistent_dma_mask (pdev,ATA_DMA_MASK ); +if (rc) +return rc; + +/* request and iomap DMA region */ + rc =pcim_iomap_regions (pdev,1 <<4 ,dev_driver_string (gdev)); +if (rc) { +dev_printk (KERN_ERR , gdev,"failed to request/iomap BAR4\n" ); +return -ENOMEM ; + } + host->iomap =pcim_iomap_table (pdev); + +for (i =0 ; i <2 ; i++) { +struct ata_port *ap = host->ports[i]; +void __iomem *bmdma = host->iomap[4 ] +8 * i; + +if (ata_port_is_dummy (ap)) +continue ; + + ap->ioaddr.bmdma_addr = bmdma; +if ((!(ap->flags &ATA_FLAG_IGN_SIMPLEX )) && + (ioread8 (bmdma +2 ) &0x80 )) + host->flags |=ATA_HOST_SIMPLEX ; + +ata_port_desc (ap,"bmdma 0x%llx" , + (unsigned long long )pci_resource_start (pdev,4 ) +8 * i); + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (ata_pci_bmdma_init); + +#endif /* CONFIG_PCI */
include/linux/libata.h +12 -9
@@ -1618,16 +1618,7 @@ extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);extern int ata_sff_port_start (struct ata_port *ap);extern int ata_sff_port_start32 (struct ata_port *ap);extern void ata_sff_std_ports (struct ata_ioports *ioaddr); -extern unsigned long ata_bmdma_mode_filter (struct ata_device *dev, -unsigned long xfer_mask); -extern void ata_bmdma_setup (struct ata_queued_cmd *qc); -extern void ata_bmdma_start (struct ata_queued_cmd *qc); -extern void ata_bmdma_stop (struct ata_queued_cmd *qc); -extern u8 ata_bmdma_status (struct ata_port *ap); -#ifdef CONFIG_PCI -extern int ata_pci_bmdma_clear_simplex (struct pci_dev *pdev); -extern int ata_pci_bmdma_init (struct ata_host *host);extern int ata_pci_sff_init_host (struct ata_host *host); extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, const struct ata_port_info * const * ppi,
@@ -1640,6 +1631,18 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, struct scsi_host_template *sht, void *host_priv, int hflags);#endif /* CONFIG_PCI */ +extern unsigned long ata_bmdma_mode_filter (struct ata_device *dev, +unsigned long xfer_mask); +extern void ata_bmdma_setup (struct ata_queued_cmd *qc); +extern void ata_bmdma_start (struct ata_queued_cmd *qc); +extern void ata_bmdma_stop (struct ata_queued_cmd *qc); +extern u8 ata_bmdma_status (struct ata_port *ap); + +#ifdef CONFIG_PCI +extern int ata_pci_bmdma_clear_simplex (struct pci_dev *pdev); +extern int ata_pci_bmdma_init (struct ata_host *host); +#endif /* CONFIG_PCI */ +/** * ata_sff_busy_wait - Wait for a port status register * @ap: Port to wait for.
Signature · 1 line
1.6.4.2
PATCH 9/23 libata-sff: clean up inheritance in several drivers
In reply to Tejun Heo1. pata_cmd640 is PIO only. Inherit from sff.
2. pata_macio is BMDMA. Inherit from bmdma and drop explicit bmdma_mode_filter() setting.
3. In pata_marvell, unlike mv5, mv6 is BMDMA. Inherit from bmdma and don't clear ->post_internal_cmd().
4. bf54x and icside are quasi-BMDMA controllers which don't use the standard BMDMA registers so they don't initialize bmdma_addr and inherit from sff to avoid the default mode_filter which disables DMA modes if bmdma_addr is not initialized.
For 2 and 3, this patch makes the drivers explicitly specify ->mode_filter to ATA_OP_NULL while inheriting from ata_bmdma_port_ops. These will be removed by the next patch.
This patch makes all and only BMDMA drivers inherit from ata_bmdma_port_ops to ease further SFF/BMDMA separation.
--- drivers/ata/pata_bf54x.c | 4 +++- drivers/ata/pata_cmd640.c | 4 ++-- drivers/ata/pata_icside.c | 4 +++- drivers/ata/pata_macio.c | 3 +-- drivers/ata/sata_mv.c | 24 ++++++++++++++++++++---- 5 files changed, 29 insertions(+), 10 deletions(-)
drivers/ata/pata_bf54x.c +3 -1
@@ -1459,7 +1459,7 @@ static struct scsi_host_template bfin_sht = { };static struct ata_port_operations bfin_pata_ops = { - .inherits = &ata_sff_port_ops, + .inherits = &ata_bmdma_port_ops, .set_piomode = bfin_set_piomode, .set_dmamode = bfin_set_dmamode,
@@ -1489,6 +1489,8 @@ static struct ata_port_operations bfin_pata_ops = { .port_start = bfin_port_start, .port_stop = bfin_port_stop, + + .mode_filter = ATA_OP_NULL, /* will be removed soon */ };static struct ata_port_info bfin_port_info[] = {
drivers/ata/pata_cmd640.c +2 -2
@@ -166,11 +166,11 @@ static int cmd640_port_start(struct ata_port *ap) }static struct scsi_host_template cmd640_sht = { -ATA_BMDMA_SHT (DRV_NAME ), +ATA_PIO_SHT (DRV_NAME ), };static struct ata_port_operations cmd640_port_ops = { - .inherits = &ata_bmdma_port_ops, + .inherits = &ata_sff_port_ops,/* In theory xfer_noirq is not needed once we kill the prefetcher */ .sff_data_xfer = ata_sff_data_xfer_noirq, .qc_issue = cmd640_qc_issue,
drivers/ata/pata_icside.c +3 -1
@@ -321,7 +321,7 @@ static void pata_icside_postreset(struct ata_link *link, unsigned int *classes) }static struct ata_port_operations pata_icside_port_ops = { - .inherits = &ata_sff_port_ops, + .inherits = &ata_bmdma_port_ops,/* no need to build any PRD tables for DMA */ .qc_prep = ata_noop_qc_prep, .sff_data_xfer = ata_sff_data_xfer_noirq,
@@ -334,6 +334,8 @@ static struct ata_port_operations pata_icside_port_ops = { .set_dmamode = pata_icside_set_dmamode, .postreset = pata_icside_postreset, .post_internal_cmd = pata_icside_bmdma_stop, + + .mode_filter = ATA_OP_NULL, /* will be removed soon */ }; static void __devinit
drivers/ata/pata_macio.c +1 -2
@@ -917,7 +917,7 @@ static struct scsi_host_template pata_macio_sht = { };static struct ata_port_operations pata_macio_ops = { - .inherits = &ata_sff_port_ops, + .inherits = &ata_bmdma_port_ops, .freeze = pata_macio_freeze, .set_piomode = pata_macio_set_timings,
@@ -925,7 +925,6 @@ static struct ata_port_operations pata_macio_ops = { .cable_detect = pata_macio_cable_detect, .sff_dev_select = pata_macio_dev_select, .qc_prep = pata_macio_qc_prep, - .mode_filter = ata_bmdma_mode_filter, .bmdma_setup = pata_macio_bmdma_setup, .bmdma_start = pata_macio_bmdma_start, .bmdma_stop = pata_macio_bmdma_stop,
drivers/ata/sata_mv.c +20 -4
@@ -686,16 +686,27 @@ static struct ata_port_operations mv5_ops = { };static struct ata_port_operations mv6_ops = { - .inherits = &mv5_ops, + .inherits = &ata_bmdma_port_ops, + + .lost_interrupt =ATA_OP_NULL , + + .qc_defer = mv_qc_defer, + .qc_prep = mv_qc_prep, + .qc_issue = mv_qc_issue, + .dev_config = mv6_dev_config, - .scr_read = mv_scr_read, - .scr_write = mv_scr_write, + .freeze = mv_eh_freeze, + .thaw = mv_eh_thaw, + .hardreset = mv_hardreset, + .softreset = mv_softreset, .pmp_hardreset = mv_pmp_hardreset, .pmp_softreset = mv_softreset, - .softreset = mv_softreset, .error_handler = mv_pmp_error_handler, + .scr_read = mv_scr_read, + .scr_write = mv_scr_write, + .sff_check_status = mv_sff_check_status, .sff_irq_clear = mv_sff_irq_clear, .check_atapi_dma = mv_check_atapi_dma,
@@ -703,6 +714,11 @@ static struct ata_port_operations mv6_ops = { .bmdma_start = mv_bmdma_start, .bmdma_stop = mv_bmdma_stop, .bmdma_status = mv_bmdma_status, + + .port_start = mv_port_start, + .port_stop = mv_port_stop, + + .mode_filter = ATA_OP_NULL, /* will be removed soon */ };static struct ata_port_operations mv_iie_ops = {
Signature · 1 line
1.6.4.2
Jeff Garzik
AppliedRe: [PATCH 09/23] libata-sff: clean up inheritance in several drivers
Quoted 10 lines · Tejun Heo
1.
pata_cmd640is PIO only. Inherit from sff.2.
pata_maciois BMDMA. Inherit from bmdma and drop explicitbmdma_mode_filter()setting.3. bf54x and icside are quasi-BMDMA controllers which don't use the standard BMDMA registers so they don't initialize
bmdma_addrand inherit from sff to avoid the defaultmode_filterwhich disables DMA modes ifbmdma_addris not initialized.
Quoted 8 lines
For 2 and 3, this patch makes the drivers explicitly specify ->mode_filter to
ATA_OP_NULLwhile inheriting fromata_bmdma_port_ops. These will be removed by the next patch.This patch makes all and only BMDMA drivers inherit from
ata_bmdma_port_opsto ease further SFF/BMDMA separation.Signed-off-by Tejun Heo<[email protected]>
applied, sans the sata_mv (mistakenly labelled as pata_marvell) patch
sata_mv is not standard BMDMA, unless I am confused about something?
Re: [PATCH 09/23] libata-sff: clean up inheritance in several drivers
Quoted 1 line · Jeff Garzik
applied, sans the
sata_mv(mistakenly labelled aspata_marvell) patch
Oops.
Quoted 1 line
sata_mvis not standard BMDMA, unless I am confused about something?
mv6 uses BMDMA for ATAPI DMA commands, so it's partially bmdma and it's clearer to make anything which uses BMDMA inherit from BMDMA, so...
Thanks.
Signature · 1 line
tejun
Re: [PATCH 09/23] libata-sff: clean up inheritance in several drivers
Quoted 10 lines · Tejun Heo
Quoted 1 line · Jeff Garzik
applied, sans the
sata_mv(mistakenly labelled aspata_marvell) patchOops.
Quoted 1 line
sata_mvis not standard BMDMA, unless I am confused about something?mv6 uses BMDMA for ATAPI DMA commands, so it's partially bmdma and it's clearer to make anything which uses BMDMA inherit from BMDMA, so...
I had forgotten about that, my apologies. Can you resend patch #9 and #10?
Jeff
PATCH 10/23 libata-sff: clean up BMDMA initialization
In reply to Tejun HeoWhen BMDMA initialization failed or BMDMA was not available for whatever reason, bmdma_addr was left at zero and used as an indication that BMDMA shouldn't be used. This leads to the following problems.
p1. For BMDMA drivers which don't use traditional BMDMA register,
ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those drivers either have to inherit from ata_sff_port_ops or clear ->mode_filter explicitly.
p2. non-BMDMA drivers call into BMDMA PRD table allocation. It
doesn't actually allocate PRD table if bmdma_addr is not initialized but is still confusing.
p3. For BMDMA drivers which don't use traditional BMDMA register, some
methods might not be invoked as expected (e.g. bmdma_stop from ata_sff_post_internal_cmd()).
p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
worrying libata core might call into one of them.
These problems are caused by the muddy line between SFF and BMDMA and the assumption that all BMDMA controllers initialize bmdma_addr.
This patch fixes p1 and p2 by removing the bmdma_addr assumption and moving prd allocation to BMDMA port start. Later patches will fix the remaining issues.
This patch improves BMDMA initialization such that
* When BMDMA register initialization fails, falls back to PIO instead of failing. ata_pci_bmdma_init() never fails now.
* When ata_pci_bmdma_init() falls back to PIO, it clears ap->mwdma_mask and udma_mask instead of depending on ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter() unnecessary thus resolving p1.
* ata_port_start() which actually is BMDMA specific is moved to ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start() are killed.
* ata_sff_port_start32() is moved and renamed to
ata_bmdma_port_start32().
Drivers which no longer call into PRD table allocation are...
pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all drivers which inherit from ata_sff_port_ops.
pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD but is a BMDMA controller and doesn't have custom port_start like other such controllers.
Note that with the previous patch which makes all and only BMDMA drivers inherit from ata_bmdma_port_ops, this change doesn't break drivers which need PRD table.
--- drivers/ata/libata-core.c | 25 ------ drivers/ata/libata-sff.c | 170 +++++++++++++++++++-------------------- drivers/ata/pata_acpi.c | 4 +- drivers/ata/pata_ali.c | 2 +- drivers/ata/pata_at91.c | 1 - drivers/ata/pata_bf54x.c | 2 - drivers/ata/pata_cmd640.c | 6 +- drivers/ata/pata_hpt366.c | 2 +- drivers/ata/pata_hpt37x.c | 4 +- drivers/ata/pata_icside.c | 2 +- drivers/ata/pata_it821x.c | 2 +- drivers/ata/pata_macio.c | 2 + drivers/ata/pata_pdc2027x.c | 4 +- drivers/ata/pata_pdc202xx_old.c | 2 +- drivers/ata/pata_platform.c | 1 - drivers/ata/pata_scc.c | 6 +- drivers/ata/pata_serverworks.c | 6 +- drivers/ata/pata_via.c | 4 +- drivers/ata/pdc_adma.c | 4 - drivers/ata/sata_inic162x.c | 5 - drivers/ata/sata_mv.c | 2 - drivers/ata/sata_nv.c | 6 +- drivers/ata/sata_promise.c | 3 +- drivers/ata/sata_qstor.c | 4 - drivers/ata/sata_sx4.c | 5 - drivers/ata/sata_uli.c | 4 +- include/linux/libata.h | 9 +-- 27 files changed, 116 insertions(+), 171 deletions(-)
drivers/ata/libata-core.c +0 -25
@@ -5506,30 +5506,6 @@ void ata_host_resume(struct ata_host *host)#endif /** -* ata_port_start - Set port up for dma. -* @ap: Port to initialize -* -* Called just after data structures for each port are -* initialized. Allocates space for PRD table. -* -* May be used as the port_start() entry in ata_port_operations. -* -* LOCKING: -* Inherited from caller. -*/ -int ata_port_start (struct ata_port *ap) -{ -struct device *dev = ap->dev; - - ap->prd =dmam_alloc_coherent (dev,ATA_PRD_TBL_SZ , &ap->prd_dma, -GFP_KERNEL ); -if (!ap->prd) -return -ENOMEM ; - -return 0 ; -} - -/** * ata_dev_init - Initialize an ata_device structure * @dev: Device structure to initialize *
@@ -6757,7 +6733,6 @@ EXPORT_SYMBOL_GPL(ata_xfer_mode2mask);EXPORT_SYMBOL_GPL (ata_xfer_mode2shift);EXPORT_SYMBOL_GPL (ata_mode_string);EXPORT_SYMBOL_GPL (ata_id_xfermask); -EXPORT_SYMBOL_GPL (ata_port_start);EXPORT_SYMBOL_GPL (ata_do_set_mode);EXPORT_SYMBOL_GPL (ata_std_qc_defer);EXPORT_SYMBOL_GPL (ata_noop_qc_prep);
drivers/ata/libata-sff.c +84 -86
250 lines not on this page · raw message
drivers/ata/pata_acpi.c +2 -2
@@ -101,7 +101,7 @@ static unsigned long pacpi_discover_modes(struct ata_port *ap, struct ata_devicestatic unsigned long pacpi_mode_filter (struct ata_device *adev,unsigned long mask) {struct pata_acpi *acpi = adev->link->ap->private_data; -return ata_bmdma_mode_filter (adev, mask & acpi->mask[adev->devno]); +return mask & acpi->mask[adev->devno]; }/**
@@ -205,7 +205,7 @@ static int pacpi_port_start(struct ata_port *ap)return -ENOMEM ; acpi->mask[0 ] =pacpi_discover_modes (ap, &ap->link.device[0 ]); acpi->mask[1 ] =pacpi_discover_modes (ap, &ap->link.device[1 ]); - ret =ata_sff_port_start (ap); + ret =ata_bmdma_port_start (ap);if (ret <0 )return ret;
drivers/ata/pata_ali.c +1 -1
@@ -124,7 +124,7 @@ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask)ata_id_c_string (adev->id, model_num,ATA_ID_PROD ,sizeof (model_num));if (strstr (model_num,"WDC" ))return mask &= ~ATA_MASK_UDMA ; -return ata_bmdma_mode_filter (adev, mask); +return mask; }/**
drivers/ata/pata_at91.c +0 -1
@@ -202,7 +202,6 @@ static struct ata_port_operations pata_at91_port_ops = { .sff_data_xfer = pata_at91_data_xfer_noirq, .set_piomode = pata_at91_set_piomode, .cable_detect = ata_cable_40wire, - .port_start = ATA_OP_NULL, };static int __devinit pata_at91_probe (struct platform_device *pdev)
drivers/ata/pata_bf54x.c +0 -2
@@ -1489,8 +1489,6 @@ static struct ata_port_operations bfin_pata_ops = { .port_start = bfin_port_start, .port_stop = bfin_port_stop, - - .mode_filter = ATA_OP_NULL, /* will be removed soon */ };static struct ata_port_info bfin_port_info[] = {
drivers/ata/pata_cmd640.c +1 -5
@@ -153,16 +153,12 @@ static int cmd640_port_start(struct ata_port *ap)struct pci_dev *pdev =to_pci_dev (ap->host->dev);struct cmd640_reg *timing; -int ret =ata_sff_port_start (ap); -if (ret <0 ) -return ret; - timing =devm_kzalloc (&pdev->dev,sizeof (struct cmd640_reg ),GFP_KERNEL );if (timing ==NULL )return -ENOMEM ; timing->last =-1 ;/* Force a load */ ap->private_data = timing; -return ret; +return 0 ; }static struct scsi_host_template cmd640_sht = {
drivers/ata/pata_hpt366.c +1 -1
@@ -182,7 +182,7 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask) }else if (adev->class ==ATA_DEV_ATAPI ) mask &= ~(ATA_MASK_MWDMA |ATA_MASK_UDMA ); -return ata_bmdma_mode_filter (adev, mask); +return mask; }static int hpt36x_cable_detect (struct ata_port *ap)
drivers/ata/pata_hpt37x.c +2 -2
@@ -282,7 +282,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask)if (hpt_dma_blacklisted (adev,"UDMA100" , bad_ata100_5)) mask &= ~(0xE0 <<ATA_SHIFT_UDMA ); } -return ata_bmdma_mode_filter (adev, mask); +return mask; }/**
@@ -298,7 +298,7 @@ static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask)if (hpt_dma_blacklisted (adev,"UDMA100" , bad_ata100_5)) mask &= ~(0xE0 <<ATA_SHIFT_UDMA ); } -return ata_bmdma_mode_filter (adev, mask); +return mask; }/**
drivers/ata/pata_icside.c +1 -1
@@ -335,7 +335,7 @@ static struct ata_port_operations pata_icside_port_ops = { .postreset = pata_icside_postreset, .post_internal_cmd = pata_icside_bmdma_stop, - .mode_filter = ATA_OP_NULL, /* will be removed soon */ + .port_start = ATA_OP_NULL, /* don't need PRD table */ }; static void __devinit
drivers/ata/pata_it821x.c +1 -1
@@ -739,7 +739,7 @@ static int it821x_port_start(struct ata_port *ap)struct it821x_dev *itdev;u8 conf; -int ret =ata_sff_port_start (ap); +int ret =ata_bmdma_port_start (ap);if (ret <0 )return ret;
drivers/ata/pata_macio.c +2 -0
@@ -720,6 +720,8 @@ static int pata_macio_port_start(struct ata_port *ap)if (priv->dma_table_cpu ==NULL ) {dev_err (priv->dev,"Unable to allocate DMA command list\n" ); ap->ioaddr.bmdma_addr =NULL ; + ap->mwdma_mask =0 ; + ap->udma_mask =0 ; }return 0 ; }
drivers/ata/pata_pdc2027x.c +2 -2
@@ -265,7 +265,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned longstruct ata_device *pair =ata_dev_pair (adev);if (adev->class !=ATA_DEV_ATA || adev->devno ==0 || pair ==NULL ) -return ata_bmdma_mode_filter (adev, mask); +return mask;/* Check for slave of a Maxtor at UDMA6 */ ata_id_c_string(pair->id, model_num, ATA_ID_PROD,
@@ -274,7 +274,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned longif (strstr (model_num,"Maxtor" ) ==NULL && pair->dma_mode ==XFER_UDMA_6 ) mask &= ~ (1 << (6 +ATA_SHIFT_UDMA )); -return ata_bmdma_mode_filter (adev, mask); +return mask; }/**
drivers/ata/pata_pdc202xx_old.c +1 -1
@@ -249,7 +249,7 @@ static int pdc2026x_port_start(struct ata_port *ap)u8 burst =ioread8 (bmdma +0x1f );iowrite8 (burst |0x01 , bmdma +0x1f ); } -return ata_sff_port_start (ap); +return ata_bmdma_port_start (ap); }/**
drivers/ata/pata_platform.c +0 -1
@@ -53,7 +53,6 @@ static struct ata_port_operations pata_platform_port_ops = { .sff_data_xfer = ata_sff_data_xfer_noirq, .cable_detect = ata_cable_unknown, .set_mode = pata_platform_set_mode, - .port_start = ATA_OP_NULL, }; static void pata_platform_setup_port(struct ata_ioports *ioaddr,
drivers/ata/pata_scc.c +3 -3
@@ -265,7 +265,7 @@ unsigned long scc_mode_filter(struct ata_device *adev, unsigned long mask)printk (KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n" ,DRV_NAME ); mask &= ~(0xE0 <<ATA_SHIFT_UDMA ); } -return ata_bmdma_mode_filter (adev, mask); +return mask; }/**
@@ -930,7 +930,7 @@ static void scc_irq_clear (struct ata_port *ap)* scc_port_start - Set port up for dma. * @ap: Port to initialize * -* Allocate space for PRD table using ata_port_start(). +* Allocate space for PRD table using ata_bmdma_port_start(). * Set PRD table address for PTERADD. (PRD Transfer End Read) */
@@ -939,7 +939,7 @@ static int scc_port_start (struct ata_port *ap)void __iomem *mmio = ap->ioaddr.bmdma_addr;int rc; - rc =ata_port_start (ap); + rc =ata_bmdma_port_start (ap);if (rc)return rc;
drivers/ata/pata_serverworks.c +3 -3
@@ -198,7 +198,7 @@ static unsigned long serverworks_osb4_filter(struct ata_device *adev, unsigned l {if (adev->class ==ATA_DEV_ATA ) mask &= ~ATA_MASK_UDMA ; -return ata_bmdma_mode_filter (adev, mask); +return mask; }
@@ -218,7 +218,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo/* Disk, UDMA */ if (adev->class !=ATA_DEV_ATA ) -return ata_bmdma_mode_filter (adev, mask); +return mask;/* Actually do need to check */ ata_id_c_string (adev->id, model_num,ATA_ID_PROD ,sizeof (model_num));
@@ -227,7 +227,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned loif (!strcmp (p, model_num)) mask &= ~(0xE0 <<ATA_SHIFT_UDMA ); } -return ata_bmdma_mode_filter (adev, mask); +return mask; }/**
drivers/ata/pata_via.c +2 -2
@@ -355,7 +355,7 @@ static unsigned long via_mode_filter(struct ata_device *dev, unsigned long mask) mask &= ~ATA_MASK_UDMA ; } } -return ata_bmdma_mode_filter (dev, mask); +return mask; }/**
@@ -426,7 +426,7 @@ static int via_port_start(struct ata_port *ap)struct via_port *vp;struct pci_dev *pdev =to_pci_dev (ap->host->dev); -int ret =ata_sff_port_start (ap); +int ret =ata_bmdma_port_start (ap);if (ret <0 )return ret;
drivers/ata/pdc_adma.c +0 -4
@@ -556,11 +556,7 @@ static int adma_port_start(struct ata_port *ap) {struct device *dev = ap->host->dev;struct adma_port_priv *pp; -int rc; - rc =ata_port_start (ap); -if (rc) -return rc;adma_enter_reg_mode (ap); pp =devm_kzalloc (dev,sizeof (*pp),GFP_KERNEL );if (!pp)
drivers/ata/sata_inic162x.c +0 -5
@@ -682,7 +682,6 @@ static int inic_port_start(struct ata_port *ap) {struct device *dev = ap->host->dev;struct inic_port_priv *pp; -int rc;/* alloc and initialize private data */ pp =devm_kzalloc (dev,sizeof (*pp),GFP_KERNEL );
@@ -691,10 +690,6 @@ static int inic_port_start(struct ata_port *ap) ap->private_data = pp;/* Alloc resources */ - rc =ata_port_start (ap); -if (rc) -return rc; - pp->pkt =dmam_alloc_coherent (dev,sizeof (struct inic_pkt ), &pp->pkt_dma,GFP_KERNEL );if (!pp->pkt)
drivers/ata/sata_mv.c +0 -2
@@ -717,8 +717,6 @@ static struct ata_port_operations mv6_ops = { .port_start = mv_port_start, .port_stop = mv_port_stop, - - .mode_filter = ATA_OP_NULL, /* will be removed soon */ };static struct ata_port_operations mv_iie_ops = {
drivers/ata/sata_nv.c +4 -2
@@ -1156,7 +1156,8 @@ static int nv_adma_port_start(struct ata_port *ap)if (rc)return rc; - rc =ata_port_start (ap); +/* we might fallback to bmdma, allocate bmdma resources */ + rc =ata_bmdma_port_start (ap);if (rc)return rc;
@@ -1985,7 +1986,8 @@ static int nv_swncq_port_start(struct ata_port *ap)struct nv_swncq_port_priv *pp;int rc; - rc =ata_port_start (ap); +/* we might fallback to bmdma, allocate bmdma resources */ + rc =ata_bmdma_port_start (ap);if (rc)return rc;
drivers/ata/sata_promise.c +2 -1
@@ -333,7 +333,8 @@ static int pdc_common_port_start(struct ata_port *ap)struct pdc_port_priv *pp;int rc; - rc =ata_port_start (ap); +/* we use the same prd table as bmdma, allocate it */ + rc =ata_bmdma_port_start (ap);if (rc)return rc;
drivers/ata/sata_qstor.c +0 -4
@@ -504,11 +504,7 @@ static int qs_port_start(struct ata_port *ap)void __iomem *mmio_base =qs_mmio_base (ap->host);void __iomem *chan = mmio_base + (ap->port_no *0x4000 );u64 addr; -int rc; - rc =ata_port_start (ap); -if (rc) -return rc; pp =devm_kzalloc (dev,sizeof (*pp),GFP_KERNEL );if (!pp)return -ENOMEM ;
drivers/ata/sata_sx4.c +0 -5
@@ -302,11 +302,6 @@ static int pdc_port_start(struct ata_port *ap) {struct device *dev = ap->host->dev;struct pdc_port_priv *pp; -int rc; - - rc =ata_port_start (ap); -if (rc) -return rc; pp =devm_kzalloc (dev,sizeof (*pp),GFP_KERNEL );if (!pp)
drivers/ata/sata_uli.c +1 -3
@@ -181,9 +181,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)if (rc)return rc; - rc =ata_pci_bmdma_init (host); -if (rc) -return rc; +ata_pci_bmdma_init (host); iomap = host->iomap;
include/linux/libata.h +3 -6
@@ -999,7 +999,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);extern int ata_xfer_mode2shift (unsigned long xfer_mode);extern const char *ata_mode_string (unsigned long xfer_mask);extern unsigned long ata_id_xfermask (const u16 *id); -extern int ata_port_start (struct ata_port *ap);extern int ata_std_qc_defer (struct ata_queued_cmd *qc);extern void ata_noop_qc_prep (struct ata_queued_cmd *qc); extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -1615,8 +1614,6 @@ extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);extern void ata_sff_drain_fifo (struct ata_queued_cmd *qc);extern void ata_sff_error_handler (struct ata_port *ap);extern void ata_sff_post_internal_cmd (struct ata_queued_cmd *qc); -extern int ata_sff_port_start (struct ata_port *ap); -extern int ata_sff_port_start32 (struct ata_port *ap);extern void ata_sff_std_ports (struct ata_ioports *ioaddr);#ifdef CONFIG_PCI extern int ata_pci_sff_init_host (struct ata_host *host);
@@ -1631,16 +1628,16 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, struct scsi_host_template *sht, void *host_priv, int hflags);#endif /* CONFIG_PCI */ -extern unsigned long ata_bmdma_mode_filter (struct ata_device *dev, -unsigned long xfer_mask);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);extern void ata_bmdma_start (struct ata_queued_cmd *qc);extern void ata_bmdma_stop (struct ata_queued_cmd *qc);extern u8 ata_bmdma_status (struct ata_port *ap); +extern int ata_bmdma_port_start (struct ata_port *ap); +extern int ata_bmdma_port_start32 (struct ata_port *ap);#ifdef CONFIG_PCI extern int ata_pci_bmdma_clear_simplex (struct pci_dev *pdev); -extern int ata_pci_bmdma_init (struct ata_host *host); +extern void ata_pci_bmdma_init (struct ata_host *host);#endif /* CONFIG_PCI */ /**
Signature · 1 line
1.6.4.2
Jeff Garzik
AppliedRe: [PATCH 10/23] libata-sff: clean up BMDMA initialization
Quoted 53 lines · Tejun Heo
When BMDMA initialization failed or BMDMA was not available for whatever reason,
bmdma_addrwas left at zero and used as an indication that BMDMA shouldn't be used. This leads to the following problems.p1. For BMDMA drivers which don't use traditional BMDMA register,
ata_bmdma_mode_filter()incorrectly inhibits DMA modes. Those drivers either have to inherit fromata_sff_port_opsor clear ->mode_filter explicitly.p2. non-BMDMA drivers call into BMDMA PRD table allocation. It
doesn't actually allocate PRD table ifbmdma_addris not initialized but is still confusing.p3. For BMDMA drivers which don't use traditional BMDMA register, some
methods might not be invoked as expected (e.g.bmdma_stopfromata_sff_post_internal_cmd()).p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
worrying libata core might call into one of them.These problems are caused by the muddy line between SFF and BMDMA and the assumption that all BMDMA controllers initialize
bmdma_addr.This patch fixes p1 and p2 by removing the
bmdma_addrassumption and moving prd allocation to BMDMA port start. Later patches will fix the remaining issues.This patch improves BMDMA initialization such that
* When BMDMA register initialization fails, falls back to PIO instead of failing.
ata_pci_bmdma_init()never fails now.* When
ata_pci_bmdma_init()falls back to PIO, it clearsap->mwdma_maskandudma_maskinstead of depending onata_bmdma_mode_filter(). This makesata_bmdma_mode_filter()unnecessary thus resolving p1.*
ata_port_start()which actually is BMDMA specific is moved toata_bmdma_port_start().ata_port_start()andata_sff_port_start()are killed.*
ata_sff_port_start32()is moved and renamed to
ata_bmdma_port_start32().Drivers which no longer call into PRD table allocation are...
pdc_adma,sata_inic162x,sata_qstor,sata_sx4,pata_cmd640and all drivers which inherit fromata_sff_port_ops.
pata_icsidesets ->port_start toATA_OP_NULLas it doesn't need PRD but is a BMDMA controller and doesn't have customport_startlike other such controllers.
Quoted 5 lines
Note that with the previous patch which makes all and only BMDMA drivers inherit from
ata_bmdma_port_ops, this change doesn't break drivers which need PRD table.Signed-off-by Tejun Heo<[email protected]>
applied, with sata_mv portion removed (fallout from patch #9 edit)
PATCH 11/23 libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init()
In reply to Tejun HeoIn preparation of proper SFF/BMDMA separation, introduce ata_sff_init/exit() and ata_sff_port_init(). These functions currently don't do anything.
--- drivers/ata/libata-core.c | 23 +++++++++++++++++------ drivers/ata/libata-sff.c | 23 +++++++++++++++++++++++ drivers/ata/libata.h | 10 ++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-)
drivers/ata/libata-core.c +17 -6
@@ -5670,6 +5670,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->stats.unhandled_irq =1 ; ap->stats.idle_irq =1 ;#endif +ata_sff_port_init (ap); +return ap; }
@@ -6584,6 +6586,8 @@ static void __init ata_parse_force_param(void)static int __init ata_init (void ) { +int rc = -ENOMEM ; +ata_parse_force_param ();/*
@@ -6595,24 +6599,31 @@ static int __init ata_init(void)*/ ata_wq =create_workqueue ("ata" );if (!ata_wq) - goto free_force_tbl; + goto fail; ata_aux_wq =create_singlethread_workqueue ("ata_aux" );if (!ata_aux_wq) - goto free_wq; + goto fail; + + rc =ata_sff_init (); +if (rc) + goto fail;printk (KERN_DEBUG "libata version " DRV_VERSION " loaded.\n" );return 0 ; -free_wq: -destroy_workqueue (ata_wq); -free_force_tbl: +fail:kfree (ata_force_tbl); -return -ENOMEM ; +if (ata_wq) +destroy_workqueue (ata_wq); +if (ata_aux_wq) +destroy_workqueue (ata_aux_wq); +return rc; } static void __exit ata_exit(void) { +ata_sff_exit ();kfree (ata_force_tbl);destroy_workqueue (ata_wq);destroy_workqueue (ata_aux_wq);
drivers/ata/libata-sff.c +23 -0
@@ -3041,3 +3041,26 @@ void ata_pci_bmdma_init(struct ata_host *host)EXPORT_SYMBOL_GPL (ata_pci_bmdma_init);#endif /* CONFIG_PCI */ + +/** +* ata_sff_port_init - Initialize SFF/BMDMA ATA port +* @ap: Port to initialize +* +* Called on port allocation to initialize SFF/BMDMA specific +* fields. +* +* LOCKING: +* None. +*/ +void ata_sff_port_init (struct ata_port *ap) +{ +} + +int __init ata_sff_init (void ) +{ +return 0 ; +} + +void __exit ata_sff_exit(void) +{ +}
drivers/ata/libata.h +10 -0
@@ -203,6 +203,16 @@ static inline int sata_pmp_attach(struct ata_device *dev)/* libata-sff.c */ #ifdef CONFIG_ATA_SFF extern void ata_pio_task (struct work_struct *work); +extern void ata_sff_port_init (struct ata_port *ap); +extern int ata_sff_init (void ); +extern void ata_sff_exit (void ); +#else /* CONFIG_ATA_SFF */ +static inline void ata_sff_port_init (struct ata_port *ap) +{ } +static inline int ata_sff_init (void ) +{return 0 ; } +static inline void ata_sff_exit (void ) +{ }#endif /* CONFIG_ATA_SFF */ #endif /* __LIBATA_H__ */
Signature · 1 line
1.6.4.2
Jeff Garzik
AppliedRe: [PATCH 11/23] libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init()
Quoted 10 lines · Tejun Heo
In preparation of proper SFF/BMDMA separation, introduce ata_sff_init/exit() and
ata_sff_port_init(). These functions currently don't do anything.Signed-off-by Tejun Heo<[email protected]>--- drivers/ata/libata-core.c | 23 +++++++++++++++++------ drivers/ata/libata-sff.c | 23 +++++++++++++++++++++++ drivers/ata/libata.h | 10 ++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-)
applied
Re: [PATCH 11/23] libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init()
In reply to Tejun HeoQuoted 10 lines · Tejun Heo
In preparation of proper SFF/BMDMA separation, introduce ata_sff_init/exit() and
ata_sff_port_init(). These functions currently don't do anything.Signed-off-by Tejun Heo<[email protected]>--- drivers/ata/libata-core.c | 23 +++++++++++++++++------ drivers/ata/libata-sff.c | 23 +++++++++++++++++++++++ drivers/ata/libata.h | 10 ++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-)
applied 9-16
PATCH 12/23 libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo()
In reply to Tejun Heo->drain_fifo() is SFF specific. Rename and relocate it.
--- drivers/ata/libata-sff.c | 6 +++--- drivers/ata/pata_pcmcia.c | 2 +- include/linux/libata.h | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/ata/libata-sff.c +3 -3
@@ -53,7 +53,6 @@ const struct ata_port_operations ata_sff_port_ops = { .softreset = ata_sff_softreset, .hardreset = sata_sff_hardreset, .postreset = ata_sff_postreset, - .drain_fifo = ata_sff_drain_fifo, .error_handler = ata_sff_error_handler, .post_internal_cmd = ata_sff_post_internal_cmd,
@@ -65,6 +64,7 @@ const struct ata_port_operations ata_sff_port_ops = { .sff_data_xfer = ata_sff_data_xfer, .sff_irq_on = ata_sff_irq_on, .sff_irq_clear = ata_sff_irq_clear, + .sff_drain_fifo = ata_sff_drain_fifo, .lost_interrupt = ata_sff_lost_interrupt, };
@@ -2378,8 +2378,8 @@ void ata_sff_error_handler(struct ata_port *ap)* if we touch the data port post reset. Pass qc in case anyone wants * to do different PIO/DMA recovery or has per command fixups */ -if (ap->ops->drain_fifo) - ap->ops->drain_fifo (qc); +if (ap->ops->sff_drain_fifo) + ap->ops->sff_drain_fifo (qc);spin_unlock_irqrestore (ap->lock, flags);
drivers/ata/pata_pcmcia.c +1 -1
@@ -175,7 +175,7 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { .sff_data_xfer = ata_data_xfer_8bit, .cable_detect = ata_cable_40wire, .set_mode = pcmcia_set_mode_8bit, - .drain_fifo = pcmcia_8bit_drain_fifo, + .sff_drain_fifo = pcmcia_8bit_drain_fifo, };
include/linux/libata.h +1 -2
@@ -855,13 +855,12 @@ struct ata_port_operations {u8 (*sff_irq_on)(struct ata_port *);bool (*sff_irq_check)(struct ata_port *);void (*sff_irq_clear)(struct ata_port *); +void (*sff_drain_fifo)(struct ata_queued_cmd *qc);void (*bmdma_setup)(struct ata_queued_cmd *qc);void (*bmdma_start)(struct ata_queued_cmd *qc);void (*bmdma_stop)(struct ata_queued_cmd *qc);u8 (*bmdma_status)(struct ata_port *ap); - -void (*drain_fifo)(struct ata_queued_cmd *qc);#endif /* CONFIG_ATA_SFF */ ssize_t (*em_show)(struct ata_port *ap,char *buf);
Signature · 1 line
1.6.4.2
Re: [PATCH 12/23] libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo()
Quoted 8 lines · Tejun Heo
->drain_fifo() is SFF specific. Rename and relocate it.
Signed-off-by Tejun Heo<[email protected]>--- drivers/ata/libata-sff.c | 6 +++--- drivers/ata/pata_pcmcia.c | 2 +- include/linux/libata.h | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-)
This patch failed to apply,
Quoted 6 lines
Applying: libata-sff: rename
ap->ops->drain_fifo()tosff_drain_fifo()
error: patch failed:drivers/ata/libata-sff.c:65
error:drivers/ata/libata-sff.c: patch does not apply
error: patch failed:include/linux/libata.h:855
error:include/linux/libata.h: patch does not apply
Patch failed at 0002 libata-sff: renameap->ops->drain_fifo()tosff_drain_fifo()
At this point, I am going to drop the rest of the patchset, and await a resend. This is largely due to my wish to avoid a large deviation on sata_mv, which continues to be patched in further patches.
After we figure out the best patch for sata_mv, I request a rediff+resend of the sata_mv bits and patches 12-23.
Thanks,
Jeff
Re: [PATCH 12/23] libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo()
Hello, Jeff.
Quoted 3 lines · Jeff Garzik
At this point, I am going to drop the rest of the patchset, and await a resend. This is largely due to my wish to avoid a large deviation on
sata_mv, which continues to be patched in further patches.
Hmm... the sata_mv one was a legit change. mv6 is partially BMDMA and thus inherits from BMDMA although it ends up overriding most ops anyway but that way it's clear that mv6 uses BMDMA facility and when later further facilities are added to BMDMA, it gets automatically inherited (which cuts both ways but at least it's easier to locate exceptions when everything which uses bmdma inherits from it).
Thanks.
Signature · 1 line
tejun
PATCH 13/23 libata-sff: ap->[last_]ctl are SFF specific
In reply to Tejun Heoap->[last_]ctl are specific to SFF controllers. Put them inside CONFIG_ATA_SFF and move initialization into ata_sff_port_init().
--- drivers/ata/libata-core.c | 2 -- drivers/ata/libata-sff.c | 2 ++ include/linux/libata.h | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/ata/libata-core.c +0 -2
@@ -5634,10 +5634,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->pflags |=ATA_PFLAG_INITIALIZING ; ap->lock = &host->lock; ap->print_id =-1 ; - ap->ctl =ATA_DEVCTL_OBS ; ap->host = host; ap->dev = host->dev; - ap->last_ctl =0xFF ;#if defined(ATA_VERBOSE_DEBUG )/* turn on all debugging levels */
drivers/ata/libata-sff.c +2 -0
@@ -3054,6 +3054,8 @@ EXPORT_SYMBOL_GPL(ata_pci_bmdma_init);*/ void ata_sff_port_init (struct ata_port *ap) { + ap->ctl =ATA_DEVCTL_OBS ; + ap->last_ctl =0xFF ; }int __init ata_sff_init (void )
include/linux/libata.h +6 -2
@@ -721,10 +721,10 @@ struct ata_port {#ifdef CONFIG_ATA_SFF struct ata_ioports ioaddr;/* ATA cmd/ctl/dma register blocks */ -#endif /* CONFIG_ATA_SFF */ -u8 ctl;/* cache of ATA control register */ u8 last_ctl;/* Cache last written value */ +#endif /* CONFIG_ATA_SFF */ +unsigned int pio_mask;unsigned int mwdma_mask;unsigned int udma_mask;
@@ -1434,7 +1434,11 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf) {memset (tf,0 ,sizeof (*tf)); +#ifdef CONFIG_ATA_SFF tf->ctl = dev->link->ap->ctl; +#else + tf->ctl =ATA_DEVCTL_OBS ; +#endif if (dev->devno ==0 ) tf->device =ATA_DEVICE_OBS ;else
Signature · 1 line
1.6.4.2
PATCH 14/23 libata-sff: port_task is SFF specific
In reply to Tejun Heoport_task is tightly bound to the standard SFF PIO HSM implementation. Using it for any other purpose would be error-prone and there's no such user and if some drivers need such feature, it would be much better off using its own. Move it inside CONFIG_ATA_SFF and rename it to sff_pio_task.
The only function which is exposed to the core layer is ata_sff_flush_pio_task() which is renamed from ata_port_flush_task() and now also takes care of resetting hsm_task_state to HSM_ST_IDLE, which is possible as it's now specific to PIO HSM.
--- drivers/ata/libata-core.c | 69 +------------------------------------------ drivers/ata/libata-eh.c | 4 +- drivers/ata/libata-sff.c | 72 +++++++++++++++++++++++++++++++++----------- drivers/ata/libata.h | 5 ++- drivers/ata/sata_mv.c | 2 +- include/linux/libata.h | 7 +--- 6 files changed, 63 insertions(+), 96 deletions(-)
drivers/ata/libata-core.c +1 -68
@@ -97,7 +97,6 @@ static void ata_dev_xfermask(struct ata_device *dev);static unsigned long ata_dev_blacklisted (const struct ata_device *dev);unsigned int ata_print_id =1 ; -static struct workqueue_struct *ata_wq;struct workqueue_struct *ata_aux_wq;
@@ -1686,52 +1685,6 @@ unsigned long ata_id_xfermask(const u16 *id)return ata_pack_xfermask (pio_mask, mwdma_mask, udma_mask); } -/** -* ata_pio_queue_task - Queue port_task -* @ap: The ata_port to queue port_task for -* @data: data for @fn to use -* @delay: delay time in msecs for workqueue function -* -* Schedule @fn(@data) for execution after @delay jiffies using -* port_task. There is one port_task per port and it's the -* user(low level driver)'s responsibility to make sure that only -* one task is active at any given time. -* -* libata core layer takes care of synchronization between -* port_task and EH. ata_pio_queue_task() may be ignored for EH -* synchronization. -* -* LOCKING: -* Inherited from caller. -*/ -void ata_pio_queue_task (struct ata_port *ap,void *data,unsigned long delay) -{ - ap->port_task_data = data; - -/* may fail if ata_port_flush_task() in progress */ -queue_delayed_work (ata_wq, &ap->port_task,msecs_to_jiffies (delay)); -} - -/** -* ata_port_flush_task - Flush port_task -* @ap: The ata_port to flush port_task for -* -* After this function completes, port_task is guranteed not to -* be running or scheduled. -* -* LOCKING: -* Kernel thread context (may sleep) -*/ -void ata_port_flush_task (struct ata_port *ap) -{ -DPRINTK ("ENTER\n" ); - -cancel_rearming_delayed_work (&ap->port_task); - -if (ata_msg_ctl (ap)) -ata_port_printk (ap,KERN_DEBUG ,"%s: EXIT\n" , __func__); -} -static void ata_qc_complete_internal (struct ata_queued_cmd *qc) {struct completion *waiting = qc->private_data;
@@ -1853,7 +1806,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, rc =wait_for_completion_timeout (&wait,msecs_to_jiffies (timeout)); -ata_port_flush_task (ap); +ata_sff_flush_pio_task (ap);if (!rc) {spin_lock_irqsave (ap->lock, flags);
@@ -5646,11 +5599,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->msg_enable =ATA_MSG_DRV |ATA_MSG_ERR |ATA_MSG_WARN ;#endif -#ifdef CONFIG_ATA_SFF -INIT_DELAYED_WORK (&ap->port_task, ata_pio_task); -#else -INIT_DELAYED_WORK (&ap->port_task,NULL ); -#endif INIT_DELAYED_WORK (&ap->hotplug_task, ata_scsi_hotplug);INIT_WORK (&ap->scsi_rescan_task, ata_scsi_dev_rescan);INIT_LIST_HEAD (&ap->eh_done_q);
@@ -6588,17 +6536,6 @@ static int __init ata_init(void)ata_parse_force_param (); -/* -* FIXME: In UP case, there is only one workqueue thread and if you -* have more than one PIO device, latency is bloody awful, with -* occasional multi-second "hiccups" as one PIO device waits for -* another. It's an ugly wart that users DO occasionally complain -* about; luckily most users have at most one PIO polled device. -*/ - ata_wq =create_workqueue ("ata" ); -if (!ata_wq) - goto fail; - ata_aux_wq =create_singlethread_workqueue ("ata_aux" );if (!ata_aux_wq) goto fail;
@@ -6612,8 +6549,6 @@ static int __init ata_init(void) fail:kfree (ata_force_tbl); -if (ata_wq) -destroy_workqueue (ata_wq);if (ata_aux_wq)destroy_workqueue (ata_aux_wq);return rc;
@@ -6623,7 +6558,6 @@ static void __exit ata_exit(void) {ata_sff_exit ();kfree (ata_force_tbl); -destroy_workqueue (ata_wq);destroy_workqueue (ata_aux_wq); }
@@ -6777,7 +6711,6 @@ EXPORT_SYMBOL_GPL(ata_id_c_string);EXPORT_SYMBOL_GPL (ata_do_dev_read_id);EXPORT_SYMBOL_GPL (ata_scsi_simulate); -EXPORT_SYMBOL_GPL (ata_pio_queue_task);EXPORT_SYMBOL_GPL (ata_pio_need_iordy);EXPORT_SYMBOL_GPL (ata_timing_find_mode);EXPORT_SYMBOL_GPL (ata_timing_compute);
drivers/ata/libata-eh.c +2 -2
@@ -550,8 +550,8 @@ void ata_scsi_error(struct Scsi_Host *host)DPRINTK ("ENTER\n" ); -/* synchronize with port task */ -ata_port_flush_task (ap); +/* make sure sff pio task is not running */ +ata_sff_flush_pio_task (ap);/* synchronize with host lock and sort out timeouts */
drivers/ata/libata-sff.c +54 -18
160 lines not on this page · raw message
drivers/ata/libata.h +3 -2
@@ -79,7 +79,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags, unsigned int tag);extern u64 ata_tf_read_block (struct ata_taskfile *tf,struct ata_device *dev); -extern void ata_port_flush_task (struct ata_port *ap); extern unsigned ata_exec_internal(struct ata_device *dev, struct ata_taskfile *tf, const u8 *cdb, int dma_dir, void *buf, unsigned int buflen,
@@ -202,11 +201,13 @@ static inline int sata_pmp_attach(struct ata_device *dev)/* libata-sff.c */ #ifdef CONFIG_ATA_SFF -extern void ata_pio_task (struct work_struct *work); +extern void ata_sff_flush_pio_task (struct ata_port *ap);extern void ata_sff_port_init (struct ata_port *ap);extern int ata_sff_init (void );extern void ata_sff_exit (void );#else /* CONFIG_ATA_SFF */ +static inline void ata_sff_flush_pio_task (struct ata_port *ap) +{ }static inline void ata_sff_port_init (struct ata_port *ap) { }static inline int ata_sff_init (void )
drivers/ata/sata_mv.c +1 -1
@@ -2262,7 +2262,7 @@ static unsigned int mv_qc_issue_fis(struct ata_queued_cmd *qc) }if (qc->tf.flags &ATA_TFLAG_POLLING ) -ata_pio_queue_task (ap, qc,0 ); +ata_sff_queue_pio_task (ap,0 );return 0 ; }
include/linux/libata.h +2 -5
@@ -723,6 +723,7 @@ struct ata_port {struct ata_ioports ioaddr;/* ATA cmd/ctl/dma register blocks */ u8 ctl;/* cache of ATA control register */ u8 last_ctl;/* Cache last written value */ +struct delayed_work sff_pio_task;#endif /* CONFIG_ATA_SFF */ unsigned int pio_mask;
@@ -746,8 +747,6 @@ struct ata_port {struct ata_host *host;struct device *dev; -void *port_task_data; -struct delayed_work port_task;struct delayed_work hotplug_task;struct work_struct scsi_rescan_task;
@@ -1030,9 +1029,6 @@ extern int ata_cable_sata(struct ata_port *ap);extern int ata_cable_ignore (struct ata_port *ap);extern int ata_cable_unknown (struct ata_port *ap); -extern void ata_pio_queue_task (struct ata_port *ap,void *data, -unsigned long delay); -/* Timing helpers */ extern unsigned int ata_pio_need_iordy (const struct ata_device *);extern const struct ata_timing *ata_timing_find_mode (u8 xfer_mode);
@@ -1596,6 +1592,7 @@ extern u8 ata_sff_irq_on(struct ata_port *ap);extern void ata_sff_irq_clear (struct ata_port *ap);extern int ata_sff_hsm_move (struct ata_port *ap,struct ata_queued_cmd *qc,u8 status,int in_wq); +extern void ata_sff_queue_pio_task (struct ata_port *ap,unsigned long delay);extern unsigned int ata_sff_qc_issue (struct ata_queued_cmd *qc);extern bool ata_sff_qc_fill_rtf (struct ata_queued_cmd *qc); extern unsigned int ata_sff_host_intr(struct ata_port *ap,
Signature · 1 line
1.6.4.2
PATCH 15/23 libata-sff: separate out BMDMA EH
In reply to Tejun HeoSome of error handling logic in ata_sff_error_handler() and all of ata_sff_post_internal_cmd() are for BMDMA. Create ata_bmdma_error_handler() and ata_bmdma_post_internal_cmd() and move BMDMA part into those.
While at it, change DMA protocol check to ata_is_dma(), fix post_internal_cmd to call ap->ops->bmdma_stop instead of directly calling ata_bmdma_stop() and open code hardreset selection so that ata_std_error_handler() doesn't have to know about sff hardreset.
As these two functions are BMDMA specific, there's no reason to check for bmdma_addr before calling bmdma methods if the protocol of the failed command is DMA. sata_mv and pata_mpc52xx now don't need to set .post_internal_cmd to ATA_OP_NULL and pata_icside and sata_qstor don't need to set it to their bmdma_stop routines.
ata_sff_post_internal_cmd() becomes noop and is removed.
This fixes p3 described in clean-up-BMDMA-initialization patch.
--- drivers/ata/libata-eh.c | 2 +- drivers/ata/libata-sff.c | 159 ++++++++++++++++++++++++++------------------ drivers/ata/libata.h | 11 --- drivers/ata/pata_icside.c | 1 - drivers/ata/pata_scc.c | 1 - drivers/ata/sata_mv.c | 2 - drivers/ata/sata_nv.c | 6 +- drivers/ata/sata_promise.c | 2 +- drivers/ata/sata_qstor.c | 3 +- drivers/ata/sata_sx4.c | 2 +- include/linux/libata.h | 3 +- 11 files changed, 102 insertions(+), 90 deletions(-)
drivers/ata/libata-eh.c +1 -1
@@ -3684,7 +3684,7 @@ void ata_std_error_handler(struct ata_port *ap)ata_reset_fn_t hardreset = ops->hardreset;/* ignore built-in hardreset if SCR access is not available */ -if (ata_is_builtin_hardreset (hardreset) && !sata_scr_valid (&ap->link)) +if (hardreset == sata_std_hardreset && !sata_scr_valid (&ap->link)) hardreset =NULL ;ata_do_eh (ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
drivers/ata/libata-sff.c +93 -66
210 lines not on this page · raw message
drivers/ata/libata.h +0 -11
@@ -38,17 +38,6 @@ struct ata_scsi_args {void (*done)(struct scsi_cmnd *); }; -static inline int ata_is_builtin_hardreset (ata_reset_fn_t reset) -{ -if (reset == sata_std_hardreset) -return 1 ; -#ifdef CONFIG_ATA_SFF -if (reset == sata_sff_hardreset) -return 1 ; -#endif -return 0 ; -} -/* libata-core.c */ enum {/* flags for ata_dev_read_id() */
drivers/ata/pata_icside.c +0 -1
@@ -333,7 +333,6 @@ static struct ata_port_operations pata_icside_port_ops = { .cable_detect = ata_cable_40wire, .set_dmamode = pata_icside_set_dmamode, .postreset = pata_icside_postreset, - .post_internal_cmd = pata_icside_bmdma_stop, .port_start = ATA_OP_NULL, /* don't need PRD table */ };
drivers/ata/pata_scc.c +0 -1
@@ -989,7 +989,6 @@ static struct ata_port_operations scc_pata_ops = { .prereset = scc_pata_prereset, .softreset = scc_softreset, .postreset = scc_postreset, - .post_internal_cmd = scc_bmdma_stop, .sff_irq_clear = scc_irq_clear, .sff_irq_on = scc_irq_on,
drivers/ata/sata_mv.c +0 -2
@@ -675,8 +675,6 @@ static struct ata_port_operations mv5_ops = { .freeze = mv_eh_freeze, .thaw = mv_eh_thaw, .hardreset = mv_hardreset, - .error_handler = ata_std_error_handler, /* avoid SFF EH */ - .post_internal_cmd = ATA_OP_NULL, .scr_read = mv5_scr_read, .scr_write = mv5_scr_write,
drivers/ata/sata_nv.c +3 -3
@@ -1131,7 +1131,7 @@ static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc)struct nv_adma_port_priv *pp = qc->ap->private_data;if (pp->flags &NV_ADMA_PORT_REGISTER_MODE ) -ata_sff_post_internal_cmd (qc); +ata_bmdma_post_internal_cmd (qc); }static int nv_adma_port_start (struct ata_port *ap)
@@ -1739,7 +1739,7 @@ static void nv_adma_error_handler(struct ata_port *ap)readw (mmio +NV_ADMA_CTL );/* flush posted write */ } -ata_sff_error_handler (ap); +ata_bmdma_error_handler (ap); }static void nv_swncq_qc_to_dq (struct ata_port *ap,struct ata_queued_cmd *qc)
@@ -1865,7 +1865,7 @@ static void nv_swncq_error_handler(struct ata_port *ap) ehc->i.action |=ATA_EH_RESET ; } -ata_sff_error_handler (ap); +ata_bmdma_error_handler (ap); }#ifdef CONFIG_PM
drivers/ata/sata_promise.c +1 -1
@@ -839,7 +839,7 @@ static void pdc_error_handler(struct ata_port *ap)if (!(ap->pflags &ATA_PFLAG_FROZEN ))pdc_reset_port (ap); -ata_std_error_handler (ap); +ata_sff_error_handler (ap); }static void pdc_post_internal_cmd (struct ata_queued_cmd *qc)
drivers/ata/sata_qstor.c +1 -2
@@ -147,7 +147,6 @@ static struct ata_port_operations qs_ata_ops = { .prereset = qs_prereset, .softreset = ATA_OP_NULL, .error_handler = qs_error_handler, - .post_internal_cmd = ATA_OP_NULL, .lost_interrupt = ATA_OP_NULL, .scr_read = qs_scr_read,
@@ -255,7 +254,7 @@ static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)static void qs_error_handler (struct ata_port *ap) {qs_enter_reg_mode (ap); -ata_std_error_handler (ap); +ata_sff_error_handler (ap); }static int qs_scr_write (struct ata_link *link,unsigned int sc_reg,u32 val)
drivers/ata/sata_sx4.c +1 -1
@@ -921,7 +921,7 @@ static void pdc_error_handler(struct ata_port *ap)if (!(ap->pflags &ATA_PFLAG_FROZEN ))pdc_reset_port (ap); -ata_std_error_handler (ap); +ata_sff_error_handler (ap); }static void pdc_post_internal_cmd (struct ata_queued_cmd *qc)
include/linux/libata.h +2 -1
@@ -1613,7 +1613,6 @@ extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,extern void ata_sff_postreset (struct ata_link *link,unsigned int *classes);extern void ata_sff_drain_fifo (struct ata_queued_cmd *qc);extern void ata_sff_error_handler (struct ata_port *ap); -extern void ata_sff_post_internal_cmd (struct ata_queued_cmd *qc);extern void ata_sff_std_ports (struct ata_ioports *ioaddr);#ifdef CONFIG_PCI extern int ata_pci_sff_init_host (struct ata_host *host);
@@ -1628,6 +1627,8 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, struct scsi_host_template *sht, void *host_priv, int hflags);#endif /* CONFIG_PCI */ +extern void ata_bmdma_error_handler (struct ata_port *ap); +extern void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);extern void ata_bmdma_start (struct ata_queued_cmd *qc);extern void ata_bmdma_stop (struct ata_queued_cmd *qc);
Signature · 1 line
1.6.4.2
PATCH 16/23 libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific
In reply to Tejun HeoBoth qc_prep functions deal only with BMDMA PRD setup and PIO only SFF drivers don't need them. Rename to ata_bmdma_[dumb_]qc_prep() and relocate.
All usages are renamed except for pdc_adma and sata_qstor. Those two drivers are not BMDMA drivers and don't need to call BMDMA qc_prep functions. Calls to ata_sff_qc_prep() in the two drivers are removed.
--- drivers/ata/libata-sff.c | 290 +++++++++++++++++++++++---------------------- drivers/ata/pata_atiixp.c | 2 +- drivers/ata/pata_cs5520.c | 2 +- drivers/ata/pata_cs5530.c | 2 +- drivers/ata/pata_sc1200.c | 2 +- drivers/ata/pdc_adma.c | 4 +- drivers/ata/sata_nv.c | 4 +- drivers/ata/sata_qstor.c | 4 +- include/linux/libata.h | 4 +- 9 files changed, 156 insertions(+), 158 deletions(-)
drivers/ata/libata-sff.c +146 -144
@@ -45,7 +45,7 @@ static struct workqueue_struct *ata_sff_wq;const struct ata_port_operations ata_sff_port_ops = { .inherits = &ata_base_port_ops, - .qc_prep = ata_sff_qc_prep, + .qc_prep = ata_noop_qc_prep, .qc_issue = ata_sff_qc_issue, .qc_fill_rtf = ata_sff_qc_fill_rtf,
@@ -72,149 +72,6 @@ const struct ata_port_operations ata_sff_port_ops = {EXPORT_SYMBOL_GPL (ata_sff_port_ops);/** -* ata_fill_sg - Fill PCI IDE PRD table -* @qc: Metadata associated with taskfile to be transferred -* -* Fill PCI IDE PRD (scatter-gather) table with segments -* associated with the current disk command. -* -* LOCKING: -* spin_lock_irqsave(host lock) -* -*/ -static void ata_fill_sg (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -struct scatterlist *sg; -unsigned int si, pi; - - pi =0 ; -for_each_sg (qc->sg, sg, qc->n_elem, si) { -u32 addr, offset; -u32 sg_len, len; - -/* determine if physical DMA addr spans 64K boundary. -* Note h/w doesn't support 64-bit, so we unconditionally -* truncate dma_addr_t to u32. -*/ - addr = (u32 )sg_dma_address (sg); - sg_len =sg_dma_len (sg); - -while (sg_len) { - offset = addr &0xffff ; - len = sg_len; -if ((offset + sg_len) >0x10000 ) - len =0x10000 - offset; - - ap->prd[pi].addr =cpu_to_le32 (addr); - ap->prd[pi].flags_len =cpu_to_le32 (len &0xffff ); -VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , pi, addr, len); - - pi++; - sg_len -= len; - addr += len; - } - } - - ap->prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); -} - -/** -* ata_fill_sg_dumb - Fill PCI IDE PRD table -* @qc: Metadata associated with taskfile to be transferred -* -* Fill PCI IDE PRD (scatter-gather) table with segments -* associated with the current disk command. Perform the fill -* so that we avoid writing any length 64K records for -* controllers that don't follow the spec. -* -* LOCKING: -* spin_lock_irqsave(host lock) -* -*/ -static void ata_fill_sg_dumb (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -struct scatterlist *sg; -unsigned int si, pi; - - pi =0 ; -for_each_sg (qc->sg, sg, qc->n_elem, si) { -u32 addr, offset; -u32 sg_len, len, blen; - -/* determine if physical DMA addr spans 64K boundary. -* Note h/w doesn't support 64-bit, so we unconditionally -* truncate dma_addr_t to u32. -*/ - addr = (u32 )sg_dma_address (sg); - sg_len =sg_dma_len (sg); - -while (sg_len) { - offset = addr &0xffff ; - len = sg_len; -if ((offset + sg_len) >0x10000 ) - len =0x10000 - offset; - - blen = len &0xffff ; - ap->prd[pi].addr =cpu_to_le32 (addr); -if (blen ==0 ) { -/* Some PATA chipsets like the CS5530 can't -cope with 0x0000 meaning 64K as the spec -says */ - ap->prd[pi].flags_len =cpu_to_le32 (0x8000 ); - blen =0x8000 ; - ap->prd[++pi].addr =cpu_to_le32 (addr +0x8000 ); - } - ap->prd[pi].flags_len =cpu_to_le32 (blen); -VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , pi, addr, len); - - pi++; - sg_len -= len; - addr += len; - } - } - - ap->prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); -} - -/** -* ata_sff_qc_prep - Prepare taskfile for submission -* @qc: Metadata associated with taskfile to be prepared -* -* Prepare ATA taskfile for submission. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_sff_qc_prep (struct ata_queued_cmd *qc) -{ -if (!(qc->flags &ATA_QCFLAG_DMAMAP )) -return ; - -ata_fill_sg (qc); -} -EXPORT_SYMBOL_GPL (ata_sff_qc_prep); - -/** -* ata_sff_dumb_qc_prep - Prepare taskfile for submission -* @qc: Metadata associated with taskfile to be prepared -* -* Prepare ATA taskfile for submission. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_sff_dumb_qc_prep (struct ata_queued_cmd *qc) -{ -if (!(qc->flags &ATA_QCFLAG_DMAMAP )) -return ; - -ata_fill_sg_dumb (qc); -} -EXPORT_SYMBOL_GPL (ata_sff_dumb_qc_prep); - -/** * ata_sff_check_status - Read device status reg & clear interrupt * @ap: port where the device is *
@@ -2740,6 +2597,8 @@ const struct ata_port_operations ata_bmdma_port_ops = { .error_handler = ata_bmdma_error_handler, .post_internal_cmd = ata_bmdma_post_internal_cmd, + .qc_prep = ata_bmdma_qc_prep, + .bmdma_setup = ata_bmdma_setup, .bmdma_start = ata_bmdma_start, .bmdma_stop = ata_bmdma_stop,
@@ -2758,6 +2617,149 @@ const struct ata_port_operations ata_bmdma32_port_ops = {EXPORT_SYMBOL_GPL (ata_bmdma32_port_ops);/** +* ata_bmdma_fill_sg - Fill PCI IDE PRD table +* @qc: Metadata associated with taskfile to be transferred +* +* Fill PCI IDE PRD (scatter-gather) table with segments +* associated with the current disk command. +* +* LOCKING: +* spin_lock_irqsave(host lock) +* +*/ +static void ata_bmdma_fill_sg (struct ata_queued_cmd *qc) +{ +struct ata_port *ap = qc->ap; +struct scatterlist *sg; +unsigned int si, pi; + + pi =0 ; +for_each_sg (qc->sg, sg, qc->n_elem, si) { +u32 addr, offset; +u32 sg_len, len; + +/* determine if physical DMA addr spans 64K boundary. +* Note h/w doesn't support 64-bit, so we unconditionally +* truncate dma_addr_t to u32. +*/ + addr = (u32 )sg_dma_address (sg); + sg_len =sg_dma_len (sg); + +while (sg_len) { + offset = addr &0xffff ; + len = sg_len; +if ((offset + sg_len) >0x10000 ) + len =0x10000 - offset; + + ap->prd[pi].addr =cpu_to_le32 (addr); + ap->prd[pi].flags_len =cpu_to_le32 (len &0xffff ); +VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , pi, addr, len); + + pi++; + sg_len -= len; + addr += len; + } + } + + ap->prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); +} + +/** +* ata_bmdma_fill_sg_dumb - Fill PCI IDE PRD table +* @qc: Metadata associated with taskfile to be transferred +* +* Fill PCI IDE PRD (scatter-gather) table with segments +* associated with the current disk command. Perform the fill +* so that we avoid writing any length 64K records for +* controllers that don't follow the spec. +* +* LOCKING: +* spin_lock_irqsave(host lock) +* +*/ +static void ata_bmdma_fill_sg_dumb (struct ata_queued_cmd *qc) +{ +struct ata_port *ap = qc->ap; +struct scatterlist *sg; +unsigned int si, pi; + + pi =0 ; +for_each_sg (qc->sg, sg, qc->n_elem, si) { +u32 addr, offset; +u32 sg_len, len, blen; + +/* determine if physical DMA addr spans 64K boundary. +* Note h/w doesn't support 64-bit, so we unconditionally +* truncate dma_addr_t to u32. +*/ + addr = (u32 )sg_dma_address (sg); + sg_len =sg_dma_len (sg); + +while (sg_len) { + offset = addr &0xffff ; + len = sg_len; +if ((offset + sg_len) >0x10000 ) + len =0x10000 - offset; + + blen = len &0xffff ; + ap->prd[pi].addr =cpu_to_le32 (addr); +if (blen ==0 ) { +/* Some PATA chipsets like the CS5530 can't +cope with 0x0000 meaning 64K as the spec +says */ + ap->prd[pi].flags_len =cpu_to_le32 (0x8000 ); + blen =0x8000 ; + ap->prd[++pi].addr =cpu_to_le32 (addr +0x8000 ); + } + ap->prd[pi].flags_len =cpu_to_le32 (blen); +VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , pi, addr, len); + + pi++; + sg_len -= len; + addr += len; + } + } + + ap->prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); +} + +/** +* ata_bmdma_qc_prep - Prepare taskfile for submission +* @qc: Metadata associated with taskfile to be prepared +* +* Prepare ATA taskfile for submission. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +void ata_bmdma_qc_prep (struct ata_queued_cmd *qc) +{ +if (!(qc->flags &ATA_QCFLAG_DMAMAP )) +return ; + +ata_bmdma_fill_sg (qc); +} +EXPORT_SYMBOL_GPL (ata_bmdma_qc_prep); + +/** +* ata_bmdma_dumb_qc_prep - Prepare taskfile for submission +* @qc: Metadata associated with taskfile to be prepared +* +* Prepare ATA taskfile for submission. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +void ata_bmdma_dumb_qc_prep (struct ata_queued_cmd *qc) +{ +if (!(qc->flags &ATA_QCFLAG_DMAMAP )) +return ; + +ata_bmdma_fill_sg_dumb (qc); +} +EXPORT_SYMBOL_GPL (ata_bmdma_dumb_qc_prep); + +/** * ata_bmdma_error_handler - Stock error handler for BMDMA controller * @ap: port to handle error for *
drivers/ata/pata_atiixp.c +1 -1
@@ -217,7 +217,7 @@ static struct scsi_host_template atiixp_sht = {static struct ata_port_operations atiixp_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_sff_dumb_qc_prep, + .qc_prep = ata_bmdma_dumb_qc_prep, .bmdma_start = atiixp_bmdma_start, .bmdma_stop = atiixp_bmdma_stop,
drivers/ata/pata_cs5520.c +1 -1
@@ -110,7 +110,7 @@ static struct scsi_host_template cs5520_sht = {static struct ata_port_operations cs5520_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_sff_dumb_qc_prep, + .qc_prep = ata_bmdma_dumb_qc_prep, .cable_detect = ata_cable_40wire, .set_piomode = cs5520_set_piomode, };
drivers/ata/pata_cs5530.c +1 -1
@@ -167,7 +167,7 @@ static struct scsi_host_template cs5530_sht = {static struct ata_port_operations cs5530_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_sff_dumb_qc_prep, + .qc_prep = ata_bmdma_dumb_qc_prep, .qc_issue = cs5530_qc_issue, .cable_detect = ata_cable_40wire,
drivers/ata/pata_sc1200.c +1 -1
@@ -209,7 +209,7 @@ static struct scsi_host_template sc1200_sht = {static struct ata_port_operations sc1200_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_sff_dumb_qc_prep, + .qc_prep = ata_bmdma_dumb_qc_prep, .qc_issue = sc1200_qc_issue, .qc_defer = sc1200_qc_defer, .cable_detect = ata_cable_40wire,
drivers/ata/pdc_adma.c +1 -3
@@ -324,10 +324,8 @@ static void adma_qc_prep(struct ata_queued_cmd *qc)VPRINTK ("ENTER\n" );adma_enter_reg_mode (qc->ap); -if (qc->tf.protocol !=ATA_PROT_DMA ) { -ata_sff_qc_prep (qc); +if (qc->tf.protocol !=ATA_PROT_DMA )return ; - } buf[i++] =0 ;/* Response flags */ buf[i++] =0 ;/* reserved */
drivers/ata/sata_nv.c +2 -2
@@ -1409,7 +1409,7 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)BUG_ON (!(pp->flags &NV_ADMA_ATAPI_SETUP_COMPLETE ) && (qc->flags &ATA_QCFLAG_DMAMAP ));nv_adma_register_mode (qc->ap); -ata_sff_qc_prep (qc); +ata_bmdma_qc_prep (qc);return ; }
@@ -2012,7 +2012,7 @@ static int nv_swncq_port_start(struct ata_port *ap)static void nv_swncq_qc_prep (struct ata_queued_cmd *qc) {if (qc->tf.protocol !=ATA_PROT_NCQ ) { -ata_sff_qc_prep (qc); +ata_bmdma_qc_prep (qc);return ; }
drivers/ata/sata_qstor.c +1 -3
@@ -303,10 +303,8 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)VPRINTK ("ENTER\n" );qs_enter_reg_mode (qc->ap); -if (qc->tf.protocol !=ATA_PROT_DMA ) { -ata_sff_qc_prep (qc); +if (qc->tf.protocol !=ATA_PROT_DMA )return ; - } nelem =qs_fill_sg (qc);
include/linux/libata.h +2 -2
@@ -1569,8 +1569,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops; .sg_tablesize = LIBATA_MAX_PRD, \ .dma_boundary = ATA_DMA_BOUNDARY -extern void ata_sff_qc_prep(struct ata_queued_cmd *qc); -extern void ata_sff_dumb_qc_prep (struct ata_queued_cmd *qc); extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);extern u8 ata_sff_check_status (struct ata_port *ap);extern void ata_sff_pause (struct ata_port *ap);
@@ -1627,6 +1625,8 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, struct scsi_host_template *sht, void *host_priv, int hflags);#endif /* CONFIG_PCI */ +extern void ata_bmdma_qc_prep (struct ata_queued_cmd *qc); +extern void ata_bmdma_dumb_qc_prep (struct ata_queued_cmd *qc);extern void ata_bmdma_error_handler (struct ata_port *ap);extern void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
Signature · 1 line
1.6.4.2
Re: [PATCH 16/23] libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific
Quoted 9 lines · Tejun Heo
Both
qc_prepfunctions deal only with BMDMA PRD setup and PIO only SFF drivers don't need them. Rename to ata_bmdma_[dumb_]qc_prep() and relocate.All usages are renamed except for
pdc_admaandsata_qstor. Those two drivers are not BMDMA drivers and don't need to call BMDMAqc_prepfunctions. Calls toata_sff_qc_prep()in the two drivers are removed.Signed-off-by Tejun Heo<[email protected]>
Quoted 11 lines
--- drivers/ata/libata-sff.c | 290 +++++++++++++++++++++++---------------------- drivers/ata/pata_atiixp.c | 2 +- drivers/ata/pata_cs5520.c | 2 +- drivers/ata/pata_cs5530.c | 2 +- drivers/ata/pata_sc1200.c | 2 +- drivers/ata/pdc_adma.c | 4 +- drivers/ata/sata_nv.c | 4 +- drivers/ata/sata_qstor.c | 4 +- include/linux/libata.h | 4 +- 9 files changed, 156 insertions(+), 158 deletions(-)
ack
PATCH 17/23 libata-sff: prd is BMDMA specific
In reply to Tejun Heostruct ata_prd and ap->prd are BMDMA specific. Add bmdma_ prefix to them and move them inside CONFIG_ATA_SFF.
--- drivers/ata/libata-sff.c | 27 +++++++++++++++------------ drivers/ata/pata_ns87415.c | 2 +- drivers/ata/pata_scc.c | 4 ++-- drivers/ata/sata_nv.c | 4 ++-- drivers/ata/sata_promise.c | 21 +++++++++++---------- drivers/ata/sata_sil.c | 6 +++--- drivers/ata/sata_svw.c | 2 +- include/linux/ata.h | 2 +- include/linux/libata.h | 5 ++--- 9 files changed, 38 insertions(+), 35 deletions(-)
drivers/ata/libata-sff.c +15 -12
@@ -2630,6 +2630,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma32_port_ops);static void ata_bmdma_fill_sg (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap; +struct ata_bmdma_prd *prd = ap->bmdma_prd;struct scatterlist *sg;unsigned int si, pi;
@@ -2651,8 +2652,8 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)if ((offset + sg_len) >0x10000 ) len =0x10000 - offset; - ap->prd[pi].addr =cpu_to_le32 (addr); - ap->prd[pi].flags_len =cpu_to_le32 (len &0xffff ); + prd[pi].addr =cpu_to_le32 (addr); + prd[pi].flags_len =cpu_to_le32 (len &0xffff );VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , pi, addr, len); pi++;
@@ -2661,7 +2662,7 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc) } } - ap->prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); + prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); }/**
@@ -2680,6 +2681,7 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)static void ata_bmdma_fill_sg_dumb (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap; +struct ata_bmdma_prd *prd = ap->bmdma_prd;struct scatterlist *sg;unsigned int si, pi;
@@ -2702,16 +2704,16 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc) len =0x10000 - offset; blen = len &0xffff ; - ap->prd[pi].addr =cpu_to_le32 (addr); + prd[pi].addr =cpu_to_le32 (addr);if (blen ==0 ) {/* Some PATA chipsets like the CS5530 can't cope with 0x0000 meaning 64K as the spec says */ - ap->prd[pi].flags_len =cpu_to_le32 (0x8000 ); + prd[pi].flags_len =cpu_to_le32 (0x8000 ); blen =0x8000 ; - ap->prd[++pi].addr =cpu_to_le32 (addr +0x8000 ); + prd[++pi].addr =cpu_to_le32 (addr +0x8000 ); } - ap->prd[pi].flags_len =cpu_to_le32 (blen); + prd[pi].flags_len =cpu_to_le32 (blen);VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , pi, addr, len); pi++;
@@ -2720,7 +2722,7 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc) } } - ap->prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); + prd[pi -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); }/**
@@ -2852,7 +2854,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)/* load PRD table addr. */ mb ();/* make sure PRD table writes are visible to controller */ -iowrite32 (ap->prd_dma, ap->ioaddr.bmdma_addr +ATA_DMA_TABLE_OFS ); +iowrite32 (ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr +ATA_DMA_TABLE_OFS );/* specify data direction, triple-check start bit is clear */ dmactl =ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_CMD );
@@ -2957,9 +2959,10 @@ EXPORT_SYMBOL_GPL(ata_bmdma_status);int ata_bmdma_port_start (struct ata_port *ap) {if (ap->mwdma_mask || ap->udma_mask) { - ap->prd =dmam_alloc_coherent (ap->host->dev,ATA_PRD_TBL_SZ , - &ap->prd_dma,GFP_KERNEL ); -if (!ap->prd) + ap->bmdma_prd = +dmam_alloc_coherent (ap->host->dev,ATA_PRD_TBL_SZ , + &ap->bmdma_prd_dma,GFP_KERNEL ); +if (!ap->bmdma_prd)return -ENOMEM ; }
drivers/ata/pata_ns87415.c +1 -1
@@ -126,7 +126,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc)/* load PRD table addr. */ mb ();/* make sure PRD table writes are visible to controller */ -iowrite32 (ap->prd_dma, ap->ioaddr.bmdma_addr +ATA_DMA_TABLE_OFS ); +iowrite32 (ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr +ATA_DMA_TABLE_OFS );/* specify data direction, triple-check start bit is clear */ dmactl =ioread8 (ap->ioaddr.bmdma_addr +ATA_DMA_CMD );
drivers/ata/pata_scc.c +2 -2
@@ -430,7 +430,7 @@ static void scc_bmdma_setup (struct ata_queued_cmd *qc)void __iomem *mmio = ap->ioaddr.bmdma_addr;/* load PRD table addr */ -out_be32 (mmio +SCC_DMA_TABLE_OFS , ap->prd_dma); +out_be32 (mmio +SCC_DMA_TABLE_OFS , ap->bmdma_prd_dma);/* specify data direction, triple-check start bit is clear */ dmactl =in_be32 (mmio +SCC_DMA_CMD );
@@ -943,7 +943,7 @@ static int scc_port_start (struct ata_port *ap)if (rc)return rc; -out_be32 (mmio +SCC_DMA_PTERADD , ap->prd_dma); +out_be32 (mmio +SCC_DMA_PTERADD , ap->bmdma_prd_dma);return 0 ; }
drivers/ata/sata_nv.c +2 -2
@@ -272,7 +272,7 @@ enum ncq_saw_flag_list { };struct nv_swncq_port_priv { -struct ata_prd *prd;/* our SG list */ +struct ata_bmdma_prd *prd;/* our SG list */ dma_addr_t prd_dma;/* and its DMA mapping */ void __iomem *sactive_block;void __iomem *irq_block;
@@ -2027,7 +2027,7 @@ static void nv_swncq_fill_sg(struct ata_queued_cmd *qc)struct ata_port *ap = qc->ap;struct scatterlist *sg;struct nv_swncq_port_priv *pp = ap->private_data; -struct ata_prd *prd; +struct ata_bmdma_prd *prd;unsigned int si, idx; prd = pp->prd +ATA_MAX_PRD * qc->tag;
drivers/ata/sata_promise.c +11 -10
@@ -500,7 +500,7 @@ static int pdc_sata_scr_write(struct ata_link *link,static void pdc_atapi_pkt (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap; -dma_addr_t sg_table = ap->prd_dma; +dma_addr_t sg_table = ap->bmdma_prd_dma;unsigned int cdb_len = qc->dev->cdb_len;u8 *cdb = qc->cdb;struct pdc_port_priv *pp = ap->private_data;
@@ -588,6 +588,7 @@ static void pdc_atapi_pkt(struct ata_queued_cmd *qc)static void pdc_fill_sg (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap; +struct ata_bmdma_prd *prd = ap->bmdma_prd;struct scatterlist *sg;const u32 SG_COUNT_ASIC_BUG =41 *4 ;unsigned int si, idx;
@@ -614,8 +615,8 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)if ((offset + sg_len) >0x10000 ) len =0x10000 - offset; - ap->prd[idx].addr =cpu_to_le32 (addr); - ap->prd[idx].flags_len =cpu_to_le32 (len &0xffff ); + prd[idx].addr =cpu_to_le32 (addr); + prd[idx].flags_len =cpu_to_le32 (len &0xffff );VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , idx, addr, len); idx++;
@@ -624,27 +625,27 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc) } } - len =le32_to_cpu (ap->prd[idx -1 ].flags_len); + len =le32_to_cpu (prd[idx -1 ].flags_len);if (len >SG_COUNT_ASIC_BUG ) {u32 addr;VPRINTK ("Splitting last PRD.\n" ); - addr =le32_to_cpu (ap->prd[idx -1 ].addr); - ap->prd[idx -1 ].flags_len =cpu_to_le32 (len -SG_COUNT_ASIC_BUG ); + addr =le32_to_cpu (prd[idx -1 ].addr); + prd[idx -1 ].flags_len =cpu_to_le32 (len -SG_COUNT_ASIC_BUG );VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , idx -1 , addr,SG_COUNT_ASIC_BUG ); addr = addr + len -SG_COUNT_ASIC_BUG ; len =SG_COUNT_ASIC_BUG ; - ap->prd[idx].addr =cpu_to_le32 (addr); - ap->prd[idx].flags_len =cpu_to_le32 (len); + prd[idx].addr =cpu_to_le32 (addr); + prd[idx].flags_len =cpu_to_le32 (len);VPRINTK ("PRD[%u] = (0x%X, 0x%X)\n" , idx, addr, len); idx++; } - ap->prd[idx -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); + prd[idx -1 ].flags_len |=cpu_to_le32 (ATA_PRD_EOT ); }static void pdc_qc_prep (struct ata_queued_cmd *qc)
@@ -659,7 +660,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)pdc_fill_sg (qc);/*FALLTHROUGH*/ case ATA_PROT_NODATA : - i =pdc_pkt_header (&qc->tf, qc->ap->prd_dma, + i =pdc_pkt_header (&qc->tf, qc->ap->bmdma_prd_dma, qc->dev->devno, pp->pkt);if (qc->tf.flags &ATA_TFLAG_LBA48 ) i =pdc_prep_lba48 (&qc->tf, pp->pkt, i);
drivers/ata/sata_sil.c +3 -3
@@ -284,7 +284,7 @@ static void sil_bmdma_setup(struct ata_queued_cmd *qc)void __iomem *bmdma = ap->ioaddr.bmdma_addr;/* load PRD table addr. */ -iowrite32 (ap->prd_dma, bmdma +ATA_DMA_TABLE_OFS ); +iowrite32 (ap->bmdma_prd_dma, bmdma +ATA_DMA_TABLE_OFS );/* issue r/w command */ ap->ops->sff_exec_command (ap, &qc->tf);
@@ -311,10 +311,10 @@ static void sil_fill_sg(struct ata_queued_cmd *qc) {struct scatterlist *sg;struct ata_port *ap = qc->ap; -struct ata_prd *prd, *last_prd =NULL ; +struct ata_bmdma_prd *prd, *last_prd =NULL ;unsigned int si; - prd = &ap->prd[0 ]; + prd = &ap->bmdma_prd[0 ];for_each_sg (qc->sg, sg, qc->n_elem, si) {/* Note h/w doesn't support 64-bit, so we unconditionally * truncate dma_addr_t to u32.
drivers/ata/sata_svw.c +1 -1
@@ -224,7 +224,7 @@ static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc)/* load PRD table addr. */ mb ();/* make sure PRD table writes are visible to controller */ -writel (ap->prd_dma, mmio +ATA_DMA_TABLE_OFS ); +writel (ap->bmdma_prd_dma, mmio +ATA_DMA_TABLE_OFS );/* specify data direction, triple-check start bit is clear */ dmactl =readb (mmio +ATA_DMA_CMD );
include/linux/ata.h +1 -1
@@ -467,7 +467,7 @@ enum ata_ioctls {/* core structures */ -struct ata_prd { +struct ata_bmdma_prd {__le32 addr;__le32 flags_len; };
include/linux/libata.h +2 -3
@@ -716,14 +716,13 @@ struct ata_port {unsigned int print_id;/* user visible unique port ID */ unsigned int port_no;/* 0 based port no. inside the host */ -struct ata_prd *prd;/* our SG list */ -dma_addr_t prd_dma;/* and its DMA mapping */ -#ifdef CONFIG_ATA_SFF struct ata_ioports ioaddr;/* ATA cmd/ctl/dma register blocks */ u8 ctl;/* cache of ATA control register */ u8 last_ctl;/* Cache last written value */ struct delayed_work sff_pio_task; +struct ata_bmdma_prd *bmdma_prd;/* BMDMA SG list */ +dma_addr_t bmdma_prd_dma;/* and its DMA mapping */ #endif /* CONFIG_ATA_SFF */ unsigned int pio_mask;
Signature · 1 line
1.6.4.2
Re: [PATCH 17/23] libata-sff: prd is BMDMA specific
Quoted 11 lines · Tejun Heo
include/linux/libata.h +0
-3@@ -716,14 +716,13 @@ struct ata_port {unsigned int print_id;/* user visible unique port ID */ unsigned int port_no;/* 0 based port no. inside the host */ -struct ata_prd *prd;/* our SG list */ -dma_addr_t prd_dma;/* and its DMA mapping */ -
include/linux/libata.h struct ata_port { · line 728
Quoted 10 lines
include/linux/libata.h +2
-0#ifdef CONFIG_ATA_SFF struct ata_ioports ioaddr;/* ATA cmd/ctl/dma register blocks */ u8 ctl;/* cache of ATA control register */ u8 last_ctl;/* Cache last written value */ struct delayed_work sff_pio_task; +struct ata_bmdma_prd *bmdma_prd;/* BMDMA SG list */ +dma_addr_t bmdma_prd_dma;/* and its DMA mapping */ #endif /* CONFIG_ATA_SFF */ unsigned int pio_mask;
"bmdma_prd_dma" is a bit too redundant for my tastes.
I would prefer "bmdma_prd_addr" or similar.
ack, with that change
Re: [PATCH 17/23] libata-sff: prd is BMDMA specific
Quoted 3 lines · Jeff Garzik
"
bmdma_prd_dma" is a bit too redundant for my tastes.I would prefer "
bmdma_prd_addr" or similar.
That will be a tad bit confusing w/ the kernel address. That is specifically the DMA address of BMDMA PRD table instead of the kernel visible address. Given the weird nature of that address, I vote for weird redundant name.
Thanks.
Signature · 1 line
tejun
Re: [PATCH 17/23] libata-sff: prd is BMDMA specific
In reply to Tejun HeoQuoted 4 lines · Tejun Heo
struct
ata_prdandap->prdare BMDMA specific. Addbmdma_prefix to them and move them insideCONFIG_ATA_SFF.Signed-off-by Tejun Heo<[email protected]>
Quoted 11 lines
--- drivers/ata/libata-sff.c | 27 +++++++++++++++------------ drivers/ata/pata_ns87415.c | 2 +- drivers/ata/pata_scc.c | 4 ++-- drivers/ata/sata_nv.c | 4 ++-- drivers/ata/sata_promise.c | 21 +++++++++++---------- drivers/ata/sata_sil.c | 6 +++--- drivers/ata/sata_svw.c | 2 +- include/linux/ata.h | 2 +- include/linux/libata.h | 5 ++--- 9 files changed, 38 insertions(+), 35 deletions(-)
applied 17-18
PATCH 18/23 libata-sff: separate out BMDMA qc_issue
In reply to Tejun HeoSeparate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and uses ata_sff_qc_issue() for non-DMA commands. All the users are updated accordingly.
--- drivers/ata/libata-sff.c | 112 ++++++++++++++++++++++++++------------------ drivers/ata/pata_acpi.c | 4 +- drivers/ata/pata_cs5530.c | 2 +- drivers/ata/pata_hpt3x2n.c | 2 +- drivers/ata/pata_it821x.c | 4 +- drivers/ata/pata_oldpiix.c | 2 +- drivers/ata/pata_radisys.c | 2 +- drivers/ata/pata_sc1200.c | 2 +- drivers/ata/sata_mv.c | 2 +- drivers/ata/sata_nv.c | 4 +- include/linux/libata.h | 1 + 11 files changed, 80 insertions(+), 57 deletions(-)
drivers/ata/libata-sff.c +67 -45
@@ -1357,15 +1357,11 @@ fsm_start: }/** -* ata_sff_qc_issue - issue taskfile to device in proto-dependent manner +* ata_sff_qc_issue - issue taskfile to a SFF controller * @qc: command to issue to device * -* Using various libata functions and hooks, this function -* starts an ATA command. ATA commands are grouped into -* classes called "protocols", and issuing each type of protocol -* is slightly different. -* -* May be used as the qc_issue() entry in ata_port_operations. +* This function issues a PIO or NODATA command to a SFF +* controller. * * LOCKING: * spin_lock_irqsave(host lock)
@@ -1380,23 +1376,8 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)/* Use polling pio if the LLD doesn't handle * interrupt driven pio and atapi CDB interrupt. */ -if (ap->flags &ATA_FLAG_PIO_POLLING ) { -switch (qc->tf.protocol) { -case ATA_PROT_PIO : -case ATA_PROT_NODATA : -case ATAPI_PROT_PIO : -case ATAPI_PROT_NODATA : - qc->tf.flags |=ATA_TFLAG_POLLING ; -break ; -case ATAPI_PROT_DMA : -if (qc->dev->flags &ATA_DFLAG_CDB_INTR ) -/* see ata_dma_blacklisted() */ -BUG (); -break ; -default : -break ; - } - } +if (ap->flags &ATA_FLAG_PIO_POLLING ) + qc->tf.flags |=ATA_TFLAG_POLLING ;/* select the device */ ata_dev_select (ap, qc->dev->devno,1 ,0 );
@@ -1415,15 +1396,6 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)break ; -case ATA_PROT_DMA : -WARN_ON_ONCE (qc->tf.flags &ATA_TFLAG_POLLING ); - - ap->ops->sff_tf_load (ap, &qc->tf);/* load tf registers */ - ap->ops->bmdma_setup (qc);/* set up bmdma */ - ap->ops->bmdma_start (qc);/* initiate bmdma */ - ap->hsm_task_state =HSM_ST_LAST ; -break ; -case ATA_PROT_PIO :if (qc->tf.flags &ATA_TFLAG_POLLING )ata_qc_set_polling (qc);
@@ -1468,18 +1440,6 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)ata_sff_queue_pio_task (ap,0 );break ; -case ATAPI_PROT_DMA : -WARN_ON_ONCE (qc->tf.flags &ATA_TFLAG_POLLING ); - - ap->ops->sff_tf_load (ap, &qc->tf);/* load tf registers */ - ap->ops->bmdma_setup (qc);/* set up bmdma */ - ap->hsm_task_state =HSM_ST_FIRST ; - -/* send cdb by polling if no cdb interrupt */ -if (!(qc->dev->flags &ATA_DFLAG_CDB_INTR )) -ata_sff_queue_pio_task (ap,0 ); -break ; -default :WARN_ON_ONCE (1 );return AC_ERR_SYSTEM ;
@@ -2598,6 +2558,7 @@ const struct ata_port_operations ata_bmdma_port_ops = { .post_internal_cmd = ata_bmdma_post_internal_cmd, .qc_prep = ata_bmdma_qc_prep, + .qc_issue = ata_bmdma_qc_issue, .bmdma_setup = ata_bmdma_setup, .bmdma_start = ata_bmdma_start,
@@ -2762,6 +2723,67 @@ void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc)EXPORT_SYMBOL_GPL (ata_bmdma_dumb_qc_prep);/** +* ata_bmdma_qc_issue - issue taskfile to a BMDMA controller +* @qc: command to issue to device +* +* This function issues a PIO, NODATA or DMA command to a +* SFF/BMDMA controller. PIO and NODATA are handled by +* ata_sff_qc_issue(). +* +* LOCKING: +* spin_lock_irqsave(host lock) +* +* RETURNS: +* Zero on success, AC_ERR_* mask on failure +*/ +unsigned int ata_bmdma_qc_issue (struct ata_queued_cmd *qc) +{ +struct ata_port *ap = qc->ap; + +/* see ata_dma_blacklisted() */ +BUG_ON ((ap->flags &ATA_FLAG_PIO_POLLING ) && + qc->tf.protocol ==ATAPI_PROT_DMA ); + +/* defer PIO handling to sff_qc_issue */ +if (!ata_is_dma (qc->tf.protocol)) +return ata_sff_qc_issue (qc); + +/* select the device */ +ata_dev_select (ap, qc->dev->devno,1 ,0 ); + +/* start the command */ +switch (qc->tf.protocol) { +case ATA_PROT_DMA : +WARN_ON_ONCE (qc->tf.flags &ATA_TFLAG_POLLING ); + + ap->ops->sff_tf_load (ap, &qc->tf);/* load tf registers */ + ap->ops->bmdma_setup (qc);/* set up bmdma */ + ap->ops->bmdma_start (qc);/* initiate bmdma */ + ap->hsm_task_state =HSM_ST_LAST ; +break ; + +case ATAPI_PROT_DMA : +WARN_ON_ONCE (qc->tf.flags &ATA_TFLAG_POLLING ); + + ap->ops->sff_tf_load (ap, &qc->tf);/* load tf registers */ + ap->ops->bmdma_setup (qc);/* set up bmdma */ + ap->hsm_task_state =HSM_ST_FIRST ; + +/* send cdb by polling if no cdb interrupt */ +if (!(qc->dev->flags &ATA_DFLAG_CDB_INTR )) +ata_sff_queue_pio_task (ap,0 ); +break ; + +default : +WARN_ON (1 ); +return AC_ERR_SYSTEM ; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (ata_bmdma_qc_issue); + +/** * ata_bmdma_error_handler - Stock error handler for BMDMA controller * @ap: port to handle error for *
drivers/ata/pata_acpi.c +2 -2
@@ -172,7 +172,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc)struct pata_acpi *acpi = ap->private_data;if (acpi->gtm.flags &0x10 ) -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc);if (adev != acpi->last) {pacpi_set_piomode (ap, adev);
@@ -180,7 +180,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc)pacpi_set_dmamode (ap, adev); acpi->last = adev; } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }/**
drivers/ata/pata_cs5530.c +1 -1
@@ -156,7 +156,7 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc)cs5530_set_dmamode (ap, adev); } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }static struct scsi_host_template cs5530_sht = {
drivers/ata/pata_hpt3x2n.c +1 -1
@@ -320,7 +320,7 @@ static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc)hpt3x2n_set_clock (ap, dpll ?0x21 :0x23 ); } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }static struct scsi_host_template hpt3x2n_sht = {
drivers/ata/pata_it821x.c +2 -2
@@ -430,7 +430,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)case 0xFC :/* Internal 'report rebuild state' */ /* Arguably should just no-op this one */ case ATA_CMD_SET_FEATURES : -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }printk (KERN_DEBUG "it821x: can't process command 0x%02X\n" , qc->tf.command);return AC_ERR_DEV ;
@@ -448,7 +448,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)static unsigned int it821x_passthru_qc_issue (struct ata_queued_cmd *qc) {it821x_passthru_dev_select (qc->ap, qc->dev->devno); -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }/**
drivers/ata/pata_oldpiix.c +1 -1
@@ -200,7 +200,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc)if (ata_dma_enabled (adev))oldpiix_set_dmamode (ap, adev); } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }
drivers/ata/pata_radisys.c +1 -1
@@ -179,7 +179,7 @@ static unsigned int radisys_qc_issue(struct ata_queued_cmd *qc)radisys_set_piomode (ap, adev); } } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }
drivers/ata/pata_sc1200.c +1 -1
@@ -174,7 +174,7 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc)sc1200_set_dmamode (ap, adev); } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }/**
drivers/ata/sata_mv.c +1 -1
@@ -2356,7 +2356,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)if (IS_GEN_II (hpriv))return mv_qc_issue_fis (qc); } -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }static struct ata_queued_cmd *mv_get_active_qc (struct ata_port *ap)
drivers/ata/sata_nv.c +2 -2
@@ -1468,7 +1468,7 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)BUG_ON (!(pp->flags &NV_ADMA_ATAPI_SETUP_COMPLETE ) && (qc->flags &ATA_QCFLAG_DMAMAP ));nv_adma_register_mode (qc->ap); -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc); }else nv_adma_mode (qc->ap);
@@ -2088,7 +2088,7 @@ static unsigned int nv_swncq_qc_issue(struct ata_queued_cmd *qc)struct nv_swncq_port_priv *pp = ap->private_data;if (qc->tf.protocol !=ATA_PROT_NCQ ) -return ata_sff_qc_issue (qc); +return ata_bmdma_qc_issue (qc);DPRINTK ("Enter\n" );
include/linux/libata.h +1 -0
@@ -1625,6 +1625,7 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,#endif /* CONFIG_PCI */ extern void ata_bmdma_qc_prep (struct ata_queued_cmd *qc); +extern unsigned int ata_bmdma_qc_issue (struct ata_queued_cmd *qc);extern void ata_bmdma_dumb_qc_prep (struct ata_queued_cmd *qc);extern void ata_bmdma_error_handler (struct ata_port *ap);extern void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc);
Signature · 1 line
1.6.4.2
PATCH 19/23 libata-sff: ata_sff_irq_clear() is BMDMA specific
In reply to Tejun Heoata_sff_irq_clear() is BMDMA specific. Rename it to ata_bmdma_irq_clear(), move it to ata_bmdma_port_ops and make ->sff_irq_clear() optional.
Note: ata_bmdma_irq_clear() is actually only needed by ata_piix and
possibly by sata_sil. This should be moved to respective low level drivers later.
--- drivers/ata/libata-sff.c | 64 +++++++++++++++++++++++++--------------------- drivers/ata/pata_bf54x.c | 2 +- drivers/ata/pata_scc.c | 2 +- drivers/ata/sata_nv.c | 2 +- drivers/ata/sata_sil.c | 4 +- drivers/ata/sata_via.c | 2 +- include/linux/libata.h | 2 +- 7 files changed, 42 insertions(+), 36 deletions(-)
drivers/ata/libata-sff.c +35 -29
@@ -64,7 +64,6 @@ const struct ata_port_operations ata_sff_port_ops = { .sff_exec_command = ata_sff_exec_command, .sff_data_xfer = ata_sff_data_xfer, .sff_irq_on = ata_sff_irq_on, - .sff_irq_clear = ata_sff_irq_clear, .sff_drain_fifo = ata_sff_drain_fifo, .lost_interrupt = ata_sff_lost_interrupt,
@@ -368,35 +367,14 @@ u8 ata_sff_irq_on(struct ata_port *ap)iowrite8 (ap->ctl, ioaddr->ctl_addr); tmp =ata_wait_idle (ap); - ap->ops->sff_irq_clear (ap); +if (ap->ops->sff_irq_clear) + ap->ops->sff_irq_clear (ap);return tmp; }EXPORT_SYMBOL_GPL (ata_sff_irq_on);/** -* ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt. -* @ap: Port associated with this ATA transaction. -* -* Clear interrupt and error flags in DMA status register. -* -* May be used as the irq_clear() entry in ata_port_operations. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_sff_irq_clear (struct ata_port *ap) -{ -void __iomem *mmio = ap->ioaddr.bmdma_addr; - -if (!mmio) -return ; - -iowrite8 (ioread8 (mmio +ATA_DMA_STATUS ), mmio +ATA_DMA_STATUS ); -} -EXPORT_SYMBOL_GPL (ata_sff_irq_clear); - -/** * ata_sff_tf_load - send taskfile registers to host controller * @ap: Port to which output is sent * @tf: ATA taskfile register set
@@ -1550,7 +1528,8 @@ unsigned int ata_sff_host_intr(struct ata_port *ap, }/* clear irq events */ - ap->ops->sff_irq_clear (ap); +if (ap->ops->sff_irq_clear) + ap->ops->sff_irq_clear (ap);ata_sff_hsm_move (ap, qc, status,0 );
@@ -1566,7 +1545,8 @@ idle_irq:#ifdef ATA_IRQ_TRAP if ((ap->stats.idle_irq %1000 ) ==0 ) { ap->ops->sff_check_status (ap); - ap->ops->sff_irq_clear (ap); +if (ap->ops->sff_irq_clear) + ap->ops->sff_irq_clear (ap);ata_port_printk (ap,KERN_WARNING ,"irq trap\n" );return 1 ; }
@@ -1724,7 +1704,8 @@ void ata_sff_freeze(struct ata_port *ap)*/ ap->ops->sff_check_status (ap); - ap->ops->sff_irq_clear (ap); +if (ap->ops->sff_irq_clear) + ap->ops->sff_irq_clear (ap); }EXPORT_SYMBOL_GPL (ata_sff_freeze);
@@ -1741,7 +1722,8 @@ void ata_sff_thaw(struct ata_port *ap) {/* clear & re-enable interrupts */ ap->ops->sff_check_status (ap); - ap->ops->sff_irq_clear (ap); +if (ap->ops->sff_irq_clear) + ap->ops->sff_irq_clear (ap); ap->ops->sff_irq_on (ap); }EXPORT_SYMBOL_GPL (ata_sff_thaw);
@@ -2560,6 +2542,7 @@ const struct ata_port_operations ata_bmdma_port_ops = { .qc_prep = ata_bmdma_qc_prep, .qc_issue = ata_bmdma_qc_issue, + .sff_irq_clear = ata_bmdma_irq_clear, .bmdma_setup = ata_bmdma_setup, .bmdma_start = ata_bmdma_start, .bmdma_stop = ata_bmdma_stop,
@@ -2828,7 +2811,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)/* if we're gonna thaw, make sure IRQ is clear */ if (thaw) { ap->ops->sff_check_status (ap); - ap->ops->sff_irq_clear (ap); +if (ap->ops->sff_irq_clear) + ap->ops->sff_irq_clear (ap); } }
@@ -2862,6 +2846,28 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)EXPORT_SYMBOL_GPL (ata_bmdma_post_internal_cmd);/** +* ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. +* @ap: Port associated with this ATA transaction. +* +* Clear interrupt and error flags in DMA status register. +* +* May be used as the irq_clear() entry in ata_port_operations. +* +* LOCKING: +* spin_lock_irqsave(host lock) +*/ +void ata_bmdma_irq_clear (struct ata_port *ap) +{ +void __iomem *mmio = ap->ioaddr.bmdma_addr; + +if (!mmio) +return ; + +iowrite8 (ioread8 (mmio +ATA_DMA_STATUS ), mmio +ATA_DMA_STATUS ); +} +EXPORT_SYMBOL_GPL (ata_bmdma_irq_clear); + +/** * ata_bmdma_setup - Set up PCI IDE BMDMA transaction * @qc: Info associated with this ATA transaction. *
drivers/ata/pata_bf54x.c +1 -1
@@ -1202,7 +1202,7 @@ static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf,* bfin_irq_clear - Clear ATAPI interrupt. * @ap: Port associated with this ATA transaction. * -* Note: Original code is ata_sff_irq_clear(). +* Note: Original code is ata_bmdma_irq_clear(). */ static void bfin_irq_clear (struct ata_port *ap)
drivers/ata/pata_scc.c +1 -1
@@ -913,7 +913,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes)* scc_irq_clear - Clear PCI IDE BMDMA interrupt. * @ap: Port associated with this ATA transaction. * -* Note: Original code is ata_sff_irq_clear(). +* Note: Original code is ata_bmdma_irq_clear(). */ static void scc_irq_clear (struct ata_port *ap)
drivers/ata/sata_nv.c +1 -1
@@ -1100,7 +1100,7 @@ static void nv_adma_irq_clear(struct ata_port *ap)u32 notifier_clears[2 ];if (pp->flags &NV_ADMA_ATAPI_SETUP_COMPLETE ) { -ata_sff_irq_clear (ap); +ata_bmdma_irq_clear (ap);return ; }
drivers/ata/sata_sil.c +2 -2
@@ -503,7 +503,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) goto err_hsm;/* ack bmdma irq events */ -ata_sff_irq_clear (ap); +ata_bmdma_irq_clear (ap);/* kick HSM in the ass */ ata_sff_hsm_move (ap, qc, status,0 );
@@ -584,7 +584,7 @@ static void sil_thaw(struct ata_port *ap)/* clear IRQ */ ap->ops->sff_check_status (ap); -ata_sff_irq_clear (ap); +ata_bmdma_irq_clear (ap);/* turn on SATA IRQ if supported */ if (!(ap->flags &SIL_FLAG_NO_SATA_IRQ ))
drivers/ata/sata_via.c +1 -1
@@ -308,7 +308,7 @@ static void svia_noop_freeze(struct ata_port *ap)* certain way. Leave it alone and just clear pending IRQ. */ ap->ops->sff_check_status (ap); -ata_sff_irq_clear (ap); +ata_bmdma_irq_clear (ap); }/**
include/linux/libata.h +1 -1
@@ -1586,7 +1586,6 @@ extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,extern unsigned int ata_sff_data_xfer_noirq (struct ata_device *dev,unsigned char *buf,unsigned int buflen,int rw);extern u8 ata_sff_irq_on (struct ata_port *ap); -extern void ata_sff_irq_clear (struct ata_port *ap);extern int ata_sff_hsm_move (struct ata_port *ap,struct ata_queued_cmd *qc,u8 status,int in_wq);extern void ata_sff_queue_pio_task (struct ata_port *ap,unsigned long delay);
@@ -1629,6 +1628,7 @@ extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc);extern void ata_bmdma_dumb_qc_prep (struct ata_queued_cmd *qc);extern void ata_bmdma_error_handler (struct ata_port *ap);extern void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc); +extern void ata_bmdma_irq_clear (struct ata_port *ap);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);extern void ata_bmdma_start (struct ata_queued_cmd *qc);extern void ata_bmdma_stop (struct ata_queued_cmd *qc);
Signature · 1 line
1.6.4.2
Re: [PATCH 19/23] libata-sff: ata_sff_irq_clear() is BMDMA specific
Quoted 9 lines · Tejun Heo
ata_sff_irq_clear()is BMDMA specific. Rename it toata_bmdma_irq_clear(), move it toata_bmdma_port_opsand make ->sff_irq_clear() optional.Note:
ata_bmdma_irq_clear()is actually only needed byata_piixand
possibly bysata_sil. This should be moved to respective low level drivers later.Signed-off-by Tejun Heo<[email protected]>
Quoted 9 lines
--- drivers/ata/libata-sff.c | 64 +++++++++++++++++++++++++--------------------- drivers/ata/pata_bf54x.c | 2 +- drivers/ata/pata_scc.c | 2 +- drivers/ata/sata_nv.c | 2 +- drivers/ata/sata_sil.c | 4 +- drivers/ata/sata_via.c | 2 +- include/linux/libata.h | 2 +- 7 files changed, 42 insertions(+), 36 deletions(-)
This failed to apply, stopping here:
Applying: libata-sff: ata_sff_irq_clear() is BMDMA specific
error: patch failed: drivers/ata/libata-sff.c:64
error: drivers/ata/libata-sff.c: patch does not apply
error: patch failed: include/linux/libata.h:1586
error: include/linux/libata.h: patch does not apply
Patch failed at 0003 libata-sff: ata_sff_irq_clear() is BMDMA specific When you have resolved this problem run "git am -i --resolved". If you would prefer to skip this patch, instead run "git am -i --skip". To restore the original branch and stop patching run "git am -i --abort". [jgarzik@bd libata-dev]$ patch -sp1 < .git/rebase-apply/patch
3 out of 9 hunks FAILED -- saving rejects to file drivers/ata/libata-sff.c.rej 1 out of 2 hunks FAILED -- saving rejects to file include/linux/libata.h.rej
PATCH 20/23 libata-sff: separate out BMDMA irq handler
In reply to Tejun HeoSeparate out BMDMA irq handler from SFF irq handler. The misnamed host_intr() functions are renamed to ata_sff_port_intr() and ata_bmdma_port_intr(). Common parts are factored into __ata_sff_port_intr() and __ata_sff_interrupt() and used by sff and bmdma interrupt routines.
All BMDMA drivers now use ata_bmdma_interrupt() or ata_bmdma_port_intr() while all non-BMDMA SFF ones use ata_sff_interrupt() or ata_sff_port_intr().
For now, ata_pci_sff_init_one() uses ata_bmdma_interrupt() as it's used by both SFF and BMDMA drivers.
--- drivers/ata/ata_piix.c | 2 +- drivers/ata/libata-sff.c | 208 +++++++++++++++++++++++++++---------------- drivers/ata/pata_atp867x.c | 2 +- drivers/ata/pata_cs5520.c | 2 +- drivers/ata/pata_hpt3x3.c | 2 +- drivers/ata/pata_icside.c | 2 +- drivers/ata/pata_macio.c | 2 +- drivers/ata/pata_mpc52xx.c | 2 +- drivers/ata/pata_ninja32.c | 2 +- drivers/ata/pata_pdc2027x.c | 2 +- drivers/ata/pata_rdc.c | 2 +- drivers/ata/pata_scc.c | 2 +- drivers/ata/pata_sil680.c | 2 +- drivers/ata/sata_mv.c | 2 +- drivers/ata/sata_nv.c | 4 +- drivers/ata/sata_qstor.c | 2 +- drivers/ata/sata_sis.c | 2 +- drivers/ata/sata_svw.c | 2 +- drivers/ata/sata_uli.c | 2 +- drivers/ata/sata_via.c | 2 +- drivers/ata/sata_vsc.c | 2 +- include/linux/libata.h | 5 +- 22 files changed, 155 insertions(+), 100 deletions(-)
drivers/ata/ata_piix.c +1 -1
@@ -1626,7 +1626,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, host->flags |=ATA_HOST_PARALLEL_SCAN ;pci_set_master (pdev); -return ata_pci_sff_activate_host (host, ata_sff_interrupt, &piix_sht); +return ata_pci_sff_activate_host (host, ata_bmdma_interrupt, &piix_sht); }static void piix_remove_one (struct pci_dev *pdev)
drivers/ata/libata-sff.c +130 -78
280 lines not on this page · raw message
drivers/ata/pata_atp867x.c +1 -1
@@ -525,7 +525,7 @@ static int atp867x_init_one(struct pci_dev *pdev,pci_set_master (pdev); - rc =ata_host_activate (host, pdev->irq, ata_sff_interrupt, + rc =ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &atp867x_sht);if (rc)dev_printk (KERN_ERR , &pdev->dev,"failed to activate host\n" );
drivers/ata/pata_cs5520.c +1 -1
@@ -221,7 +221,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devicontinue ; rc =devm_request_irq (&pdev->dev, irq[ap->port_no], - ata_sff_interrupt,0 ,DRV_NAME , host); + ata_bmdma_interrupt,0 ,DRV_NAME , host);if (rc)return rc;
drivers/ata/pata_hpt3x3.c +1 -1
@@ -248,7 +248,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)ata_port_pbar_desc (ap,4 , offset_cmd[i],"cmd" ); }pci_set_master (pdev); -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &hpt3x3_sht); }
drivers/ata/pata_icside.c +1 -1
@@ -470,7 +470,7 @@ static int __devinit pata_icside_add_ports(struct pata_icside_info *info)pata_icside_setup_ioaddr (ap, info->base, info, info->port[i]); } -return ata_host_activate (host, ec->irq, ata_sff_interrupt,0 , +return ata_host_activate (host, ec->irq, ata_bmdma_interrupt,0 , &pata_icside_sht); }
drivers/ata/pata_macio.c +1 -1
@@ -1110,7 +1110,7 @@ static int __devinit pata_macio_common_init(struct pata_macio_priv *priv,/* Start it up */ priv->irq = irq; -return ata_host_activate (priv->host, irq, ata_sff_interrupt,0 , +return ata_host_activate (priv->host, irq, ata_bmdma_interrupt,0 , &pata_macio_sht); }
drivers/ata/pata_mpc52xx.c +1 -1
@@ -659,7 +659,7 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv,ata_port_desc (ap,"ata_regs 0x%lx" , raw_ata_regs);/* activate host */ -return ata_host_activate (host, priv->ata_irq, ata_sff_interrupt,0 , +return ata_host_activate (host, priv->ata_irq, ata_bmdma_interrupt,0 , &mpc52xx_ata_sht); }
drivers/ata/pata_ninja32.c +1 -1
@@ -149,7 +149,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)ninja32_program (base);/* FIXME: Should we disable them at remove ? */ -return ata_host_activate (host, dev->irq, ata_sff_interrupt, +return ata_host_activate (host, dev->irq, ata_bmdma_interrupt,IRQF_SHARED , &ninja32_sht); }
drivers/ata/pata_pdc2027x.c +1 -1
@@ -754,7 +754,7 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_dereturn -EIO ;pci_set_master (pdev); -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &pdc2027x_sht); }
drivers/ata/pata_rdc.c +1 -1
@@ -354,7 +354,7 @@ static int __devinit rdc_init_one(struct pci_dev *pdev, host->flags |=ATA_HOST_PARALLEL_SCAN ;pci_set_master (pdev); -return ata_pci_sff_activate_host (host, ata_sff_interrupt, &rdc_sht); +return ata_pci_sff_activate_host (host, ata_bmdma_interrupt, &rdc_sht); }static void rdc_remove_one (struct pci_dev *pdev)
drivers/ata/pata_scc.c +1 -1
@@ -1144,7 +1144,7 @@ static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)if (rc)return rc; -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &scc_sht); }
drivers/ata/pata_sil680.c +1 -1
@@ -352,7 +352,7 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,ata_sff_std_ports (&host->ports[1 ]->ioaddr);/* Register & activate */ -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &sil680_sht); use_ioports:
drivers/ata/sata_mv.c +1 -1
@@ -2811,7 +2811,7 @@ static void mv_port_intr(struct ata_port *ap, u32 port_cause) }else if (!edma_was_enabled) {struct ata_queued_cmd *qc =mv_get_active_qc (ap);if (qc) -ata_sff_host_intr (ap, qc); +ata_bmdma_port_intr (ap, qc);else mv_unexpected_intr (ap, edma_was_enabled); }
drivers/ata/sata_nv.c +2 -2
@@ -920,7 +920,7 @@ static int nv_host_intr(struct ata_port *ap, u8 irq_stat) }/* handle interrupt */ -return ata_sff_host_intr (ap, qc); +return ata_bmdma_port_intr (ap, qc); }static irqreturn_t nv_adma_interrupt (int irq,void *dev_instance)
@@ -1505,7 +1505,7 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance) qc =ata_qc_from_tag (ap, ap->link.active_tag);if (qc && (!(qc->tf.flags &ATA_TFLAG_POLLING ))) { - handled +=ata_sff_host_intr (ap, qc); + handled +=ata_bmdma_port_intr (ap, qc); }else {/* * No request pending? Clear interrupt status
drivers/ata/sata_qstor.c +1 -1
@@ -454,7 +454,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host *host)if (!pp || pp->state != qs_state_mmio)continue ;if (!(qc->tf.flags &ATA_TFLAG_POLLING )) - handled |=ata_sff_host_intr (ap, qc); + handled |=ata_sff_port_intr (ap, qc); }return handled; }
drivers/ata/sata_sis.c +1 -1
@@ -308,7 +308,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_master (pdev);pci_intx (pdev,1 ); -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &sis_sht); }
drivers/ata/sata_svw.c +1 -1
@@ -502,7 +502,7 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *enwritel (0x0 , mmio_base +K2_SATA_SIM_OFFSET );pci_set_master (pdev); -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &k2_sata_sht); }
drivers/ata/sata_uli.c +1 -1
@@ -242,7 +242,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_master (pdev);pci_intx (pdev,1 ); -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &uli_sht); }
drivers/ata/sata_via.c +1 -1
@@ -628,7 +628,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)svia_configure (pdev);pci_set_master (pdev); -return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +return ata_host_activate (host, pdev->irq, ata_bmdma_interrupt,IRQF_SHARED , &svia_sht); }
drivers/ata/sata_vsc.c +1 -1
@@ -245,7 +245,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap) qc =ata_qc_from_tag (ap, ap->link.active_tag);if (qc &&likely (!(qc->tf.flags &ATA_TFLAG_POLLING ))) - handled =ata_sff_host_intr (ap, qc); + handled =ata_bmdma_port_intr (ap, qc);/* We received an interrupt during a polled command, * or some other spurious condition. Interrupt reporting
include/linux/libata.h +4 -1
@@ -1591,7 +1591,7 @@ extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,extern void ata_sff_queue_pio_task (struct ata_port *ap,unsigned long delay);extern unsigned int ata_sff_qc_issue (struct ata_queued_cmd *qc);extern bool ata_sff_qc_fill_rtf (struct ata_queued_cmd *qc); -extern unsigned int ata_sff_host_intr (struct ata_port *ap, +extern unsigned int ata_sff_port_intr (struct ata_port *ap,struct ata_queued_cmd *qc);extern irqreturn_t ata_sff_interrupt (int irq,void *dev_instance);extern void ata_sff_lost_interrupt (struct ata_port *ap);
@@ -1626,6 +1626,9 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,extern void ata_bmdma_qc_prep (struct ata_queued_cmd *qc);extern unsigned int ata_bmdma_qc_issue (struct ata_queued_cmd *qc);extern void ata_bmdma_dumb_qc_prep (struct ata_queued_cmd *qc); +extern unsigned int ata_bmdma_port_intr (struct ata_port *ap, +struct ata_queued_cmd *qc); +extern irqreturn_t ata_bmdma_interrupt (int irq,void *dev_instance);extern void ata_bmdma_error_handler (struct ata_port *ap);extern void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc);extern void ata_bmdma_irq_clear (struct ata_port *ap);
Signature · 1 line
1.6.4.2
PATCH 21/23 libata-sff: separate out BMDMA init
In reply to Tejun HeoSeparate out ata_pci_bmdma_prepare_host() and ata_pci_bmdma_init_one() from their SFF counterparts. SFF ones no longer try to initialize BMDMA or set PCI master.
--- drivers/ata/ata_generic.c | 2 +- drivers/ata/ata_piix.c | 2 +- drivers/ata/libata-sff.c | 138 ++++++++++++++++++++++++++++++++------- drivers/ata/pata_acpi.c | 2 +- drivers/ata/pata_ali.c | 5 +- drivers/ata/pata_amd.c | 2 +- drivers/ata/pata_artop.c | 2 +- drivers/ata/pata_atiixp.c | 4 +- drivers/ata/pata_cmd64x.c | 2 +- drivers/ata/pata_cs5530.c | 2 +- drivers/ata/pata_cs5535.c | 2 +- drivers/ata/pata_cs5536.c | 2 +- drivers/ata/pata_cypress.c | 2 +- drivers/ata/pata_efar.c | 4 +- drivers/ata/pata_hpt366.c | 2 +- drivers/ata/pata_hpt37x.c | 2 +- drivers/ata/pata_hpt3x2n.c | 2 +- drivers/ata/pata_it8213.c | 2 +- drivers/ata/pata_it821x.c | 2 +- drivers/ata/pata_jmicron.c | 2 +- drivers/ata/pata_marvell.c | 2 +- drivers/ata/pata_netcell.c | 2 +- drivers/ata/pata_ns87415.c | 2 +- drivers/ata/pata_oldpiix.c | 2 +- drivers/ata/pata_optidma.c | 2 +- drivers/ata/pata_pdc202xx_old.c | 2 +- drivers/ata/pata_piccolo.c | 2 +- drivers/ata/pata_radisys.c | 2 +- drivers/ata/pata_rdc.c | 2 +- drivers/ata/pata_sc1200.c | 2 +- drivers/ata/pata_sch.c | 2 +- drivers/ata/pata_serverworks.c | 2 +- drivers/ata/pata_sil680.c | 2 +- drivers/ata/pata_sis.c | 2 +- drivers/ata/pata_sl82c105.c | 2 +- drivers/ata/pata_triflex.c | 2 +- drivers/ata/pata_via.c | 2 +- drivers/ata/sata_nv.c | 2 +- drivers/ata/sata_sis.c | 2 +- drivers/ata/sata_via.c | 4 +- include/linux/libata.h | 7 ++ 41 files changed, 166 insertions(+), 66 deletions(-)
drivers/ata/ata_generic.c +1 -1
@@ -155,7 +155,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_idreturn rc;pcim_pin_device (dev); } -return ata_pci_sff_init_one (dev, ppi, &generic_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &generic_sht,NULL ,0 ); }static struct pci_device_id ata_generic[] = {
drivers/ata/ata_piix.c +1 -1
@@ -1589,7 +1589,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, hpriv->map =piix_init_sata_map (pdev, port_info, piix_map_db_table[ent->driver_data]); - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); + rc =ata_pci_bmdma_prepare_host (pdev, ppi, &host);if (rc)return rc; host->private_data = hpriv;
drivers/ata/libata-sff.c +114 -24
189 lines not on this page · raw message
drivers/ata/pata_acpi.c +1 -1
@@ -260,7 +260,7 @@ static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id)return rc;pcim_pin_device (pdev); } -return ata_pci_sff_init_one (pdev, ppi, &pacpi_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &pacpi_sht,NULL ,0 ); }static const struct pci_device_id pacpi_pci_tbl[] = {
drivers/ata/pata_ali.c +4 -1
@@ -583,7 +583,10 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ppi[0 ] = &info_20_udma; } -return ata_pci_sff_init_one (pdev, ppi, &ali_sht,NULL ,0 ); +if (!ppi[0 ]->mwdma_mask && !ppi[0 ]->udma_mask) +return ata_pci_sff_init_one (pdev, ppi, &ali_sht,NULL ,0 ); +else +return ata_pci_bmdma_init_one (pdev, ppi, &ali_sht,NULL ,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_amd.c +1 -1
@@ -574,7 +574,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) }/* And fire it up */ -return ata_pci_sff_init_one (pdev, ppi, &amd_sht, hpriv,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &amd_sht, hpriv,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_artop.c +1 -1
@@ -421,7 +421,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)BUG_ON (ppi[0 ] ==NULL ); -return ata_pci_sff_init_one (pdev, ppi, &artop_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &artop_sht,NULL ,0 ); }static const struct pci_device_id artop_pci_tbl[] = {
drivers/ata/pata_atiixp.c +2 -2
@@ -246,8 +246,8 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)if (!pci_test_config_bits (pdev, &atiixp_enable_bits[i])) ppi[i] = &ata_dummy_port_info; -return ata_pci_sff_init_one (pdev, ppi, &atiixp_sht,NULL , -ATA_HOST_PARALLEL_SCAN ); +return ata_pci_bmdma_init_one (pdev, ppi, &atiixp_sht,NULL , +ATA_HOST_PARALLEL_SCAN ); }static const struct pci_device_id atiixp[] = {
drivers/ata/pata_cmd64x.c +1 -1
@@ -367,7 +367,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)pci_write_config_byte (pdev,UDIDETCR0 ,0xF0 );#endif -return ata_pci_sff_init_one (pdev, ppi, &cmd64x_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &cmd64x_sht,NULL ,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_cs5530.c +1 -1
@@ -324,7 +324,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ppi[1 ] = &info_palmax_secondary;/* Now kick off ATA set up */ -return ata_pci_sff_init_one (pdev, ppi, &cs5530_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &cs5530_sht,NULL ,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_cs5535.c +1 -1
@@ -198,7 +198,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id)rdmsr (ATAC_CH0D1_PIO , timings, dummy);if (CS5535_BAD_PIO (timings))wrmsr (ATAC_CH0D1_PIO ,0xF7F4F7F4UL ,0 ); -return ata_pci_sff_init_one (dev, ppi, &cs5535_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &cs5535_sht,NULL ,0 ); }static const struct pci_device_id cs5535[] = {
drivers/ata/pata_cs5536.c +1 -1
@@ -260,7 +260,7 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id)return -ENODEV ; } -return ata_pci_sff_init_one (dev, ppi, &cs5536_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &cs5536_sht,NULL ,0 ); }static const struct pci_device_id cs5536[] = {
drivers/ata/pata_cypress.c +1 -1
@@ -138,7 +138,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *iif (PCI_FUNC (pdev->devfn) !=1 )return -ENODEV ; -return ata_pci_sff_init_one (pdev, ppi, &cy82c693_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &cy82c693_sht,NULL ,0 ); }static const struct pci_device_id cy82c693[] = {
drivers/ata/pata_efar.c +2 -2
@@ -277,8 +277,8 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)dev_printk (KERN_DEBUG , &pdev->dev,"version " DRV_VERSION "\n" ); -return ata_pci_sff_init_one (pdev, ppi, &efar_sht,NULL , -ATA_HOST_PARALLEL_SCAN ); +return ata_pci_bmdma_init_one (pdev, ppi, &efar_sht,NULL , +ATA_HOST_PARALLEL_SCAN ); }static const struct pci_device_id efar_pci_tbl[] = {
drivers/ata/pata_hpt366.c +1 -1
@@ -361,7 +361,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)break ; }/* Now kick off ATA set up */ -return ata_pci_sff_init_one (dev, ppi, &hpt36x_sht, hpriv,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &hpt36x_sht, hpriv,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_hpt37x.c +1 -1
@@ -987,7 +987,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) }/* Now kick off ATA set up */ -return ata_pci_sff_init_one (dev, ppi, &hpt37x_sht, private_data,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &hpt37x_sht, private_data,0 ); }static const struct pci_device_id hpt37x[] = {
drivers/ata/pata_hpt3x2n.c +1 -1
@@ -548,7 +548,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)outb (inb (iobase +0x9c ) |0x04 , iobase +0x9c );/* Now kick off ATA set up */ -return ata_pci_sff_init_one (dev, ppi, &hpt3x2n_sht, hpriv,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &hpt3x2n_sht, hpriv,0 ); }static const struct pci_device_id hpt3x2n[] = {
drivers/ata/pata_it8213.c +1 -1
@@ -273,7 +273,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *endev_printk (KERN_DEBUG , &pdev->dev,"version " DRV_VERSION "\n" ); -return ata_pci_sff_init_one (pdev, ppi, &it8213_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &it8213_sht,NULL ,0 ); }static const struct pci_device_id it8213_pci_tbl[] = {
drivers/ata/pata_it821x.c +1 -1
@@ -933,7 +933,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)else ppi[0 ] = &info_smart; } -return ata_pci_sff_init_one (pdev, ppi, &it821x_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &it821x_sht,NULL ,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_jmicron.c +1 -1
@@ -144,7 +144,7 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i };const struct ata_port_info *ppi[] = { &info,NULL }; -return ata_pci_sff_init_one (pdev, ppi, &jmicron_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &jmicron_sht,NULL ,0 ); }static const struct pci_device_id jmicron_pci_tbl[] = {
drivers/ata/pata_marvell.c +1 -1
@@ -153,7 +153,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *ireturn -ENODEV ; }#endif -return ata_pci_sff_init_one (pdev, ppi, &marvell_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &marvell_sht,NULL ,0 ); } static const struct pci_device_id marvell_pci_tbl[] = {
drivers/ata/pata_netcell.c +1 -1
@@ -82,7 +82,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *eata_pci_bmdma_clear_simplex (pdev);/* And let the library code do the work */ -return ata_pci_sff_init_one (pdev, port_info, &netcell_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, port_info, &netcell_sht,NULL ,0 ); }static const struct pci_device_id netcell_pci_tbl[] = {
drivers/ata/pata_ns87415.c +1 -1
@@ -380,7 +380,7 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *ens87415_fixup (pdev); -return ata_pci_sff_init_one (pdev, ppi, &ns87415_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &ns87415_sht,NULL ,0 ); }static const struct pci_device_id ns87415_pci_tbl[] = {
drivers/ata/pata_oldpiix.c +1 -1
@@ -248,7 +248,7 @@ static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *edev_printk (KERN_DEBUG , &pdev->dev,"version " DRV_VERSION "\n" ); -return ata_pci_sff_init_one (pdev, ppi, &oldpiix_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &oldpiix_sht,NULL ,0 ); }static const struct pci_device_id oldpiix_pci_tbl[] = {
drivers/ata/pata_optidma.c +1 -1
@@ -429,7 +429,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)if (optiplus_with_udma (dev)) ppi[0 ] = &info_82c700_udma; -return ata_pci_sff_init_one (dev, ppi, &optidma_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &optidma_sht,NULL ,0 ); }static const struct pci_device_id optidma[] = {
drivers/ata/pata_pdc202xx_old.c +1 -1
@@ -337,7 +337,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *idreturn -ENODEV ; } } -return ata_pci_sff_init_one (dev, ppi, &pdc202xx_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &pdc202xx_sht,NULL ,0 ); }static const struct pci_device_id pdc202xx[] = {
drivers/ata/pata_piccolo.c +1 -1
@@ -95,7 +95,7 @@ static int ata_tosh_init_one(struct pci_dev *dev, const struct pci_device_id *id };const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };/* Just one port for the moment */ -return ata_pci_sff_init_one (dev, ppi, &tosh_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &tosh_sht,NULL ,0 ); }static struct pci_device_id ata_tosh[] = {
drivers/ata/pata_radisys.c +1 -1
@@ -227,7 +227,7 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *edev_printk (KERN_DEBUG , &pdev->dev,"version " DRV_VERSION "\n" ); -return ata_pci_sff_init_one (pdev, ppi, &radisys_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &radisys_sht,NULL ,0 ); }static const struct pci_device_id radisys_pci_tbl[] = {
drivers/ata/pata_rdc.c +1 -1
@@ -344,7 +344,7 @@ static int __devinit rdc_init_one(struct pci_dev *pdev,*/ pci_read_config_dword (pdev,0x54 , &hpriv->saved_iocfg); - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); + rc =ata_pci_bmdma_prepare_host (pdev, ppi, &host);if (rc)return rc; host->private_data = hpriv;
drivers/ata/pata_sc1200.c +1 -1
@@ -237,7 +237,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) };const struct ata_port_info *ppi[] = { &info,NULL }; -return ata_pci_sff_init_one (dev, ppi, &sc1200_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &sc1200_sht,NULL ,0 ); }static const struct pci_device_id sc1200[] = {
drivers/ata/pata_sch.c +1 -1
@@ -179,7 +179,7 @@ static int __devinit sch_init_one(struct pci_dev *pdev,dev_printk (KERN_DEBUG , &pdev->dev,"version " DRV_VERSION "\n" ); -return ata_pci_sff_init_one (pdev, ppi, &sch_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &sch_sht,NULL ,0 ); }static int __init sch_init (void )
drivers/ata/pata_serverworks.c +1 -1
@@ -460,7 +460,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_idif (pdev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB5IDE )ata_pci_bmdma_clear_simplex (pdev); -return ata_pci_sff_init_one (pdev, ppi, &serverworks_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &serverworks_sht,NULL ,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_sil680.c +1 -1
@@ -356,7 +356,7 @@ static int __devinit sil680_init_one(struct pci_dev *pdev, IRQF_SHARED, &sil680_sht); use_ioports: -return ata_pci_sff_init_one (pdev, ppi, &sil680_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &sil680_sht,NULL ,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_sis.c +1 -1
@@ -826,7 +826,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)sis_fixup (pdev, chipset); -return ata_pci_sff_init_one (pdev, ppi, &sis_sht, chipset,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &sis_sht, chipset,0 ); }#ifdef CONFIG_PM
drivers/ata/pata_sl82c105.c +1 -1
@@ -316,7 +316,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id val |=CTRL_P0EN |CTRL_P0F16 |CTRL_P1F16 ;pci_write_config_dword (dev,0x40 , val); -return ata_pci_sff_init_one (dev, ppi, &sl82c105_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &sl82c105_sht,NULL ,0 ); }static const struct pci_device_id sl82c105[] = {
drivers/ata/pata_triflex.c +1 -1
@@ -201,7 +201,7 @@ static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id)if (!printed_version++)dev_printk (KERN_DEBUG , &dev->dev,"version " DRV_VERSION "\n" ); -return ata_pci_sff_init_one (dev, ppi, &triflex_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &triflex_sht,NULL ,0 ); }static const struct pci_device_id triflex[] = {
drivers/ata/pata_via.c +1 -1
@@ -629,7 +629,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) }/* We have established the device type, now fire it up */ -return ata_pci_sff_init_one (pdev, ppi, &via_sht, (void *)config,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, &via_sht, (void *)config,0 ); }#ifdef CONFIG_PM
drivers/ata/sata_nv.c +1 -1
@@ -2430,7 +2430,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ppi[0 ] = &nv_port_info[type]; ipriv = ppi[0 ]->private_data; - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); + rc =ata_pci_bmdma_prepare_host (pdev, ppi, &host);if (rc)return rc;
drivers/ata/sata_sis.c +1 -1
@@ -279,7 +279,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)break ; } - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); + rc =ata_pci_bmdma_prepare_host (pdev, ppi, &host);if (rc)return rc;
drivers/ata/sata_via.c +2 -2
@@ -463,7 +463,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)struct ata_host *host;int rc; - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); + rc =ata_pci_bmdma_prepare_host (pdev, ppi, &host);if (rc)return rc; *r_host = host;
@@ -520,7 +520,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)struct ata_host *host;int i, rc; - rc =ata_pci_sff_prepare_host (pdev, ppi, &host); + rc =ata_pci_bmdma_prepare_host (pdev, ppi, &host);if (rc)return rc; *r_host = host;
include/linux/libata.h +7 -0
@@ -1642,6 +1642,13 @@ extern int ata_bmdma_port_start32(struct ata_port *ap);#ifdef CONFIG_PCI extern int ata_pci_bmdma_clear_simplex (struct pci_dev *pdev);extern void ata_pci_bmdma_init (struct ata_host *host); +extern int ata_pci_bmdma_prepare_host (struct pci_dev *pdev, +const struct ata_port_info *const * ppi, +struct ata_host **r_host); +extern int ata_pci_bmdma_init_one (struct pci_dev *pdev, +const struct ata_port_info *const * ppi, +struct scsi_host_template *sht, +void *host_priv,int hflags);#endif /* CONFIG_PCI */ /**
Signature · 1 line
1.6.4.2
PATCH 22/23 libata-sff: kill dummy BMDMA ops from sata_qstor and pata_octeon_cf
In reply to Tejun HeoNow that SFF and BMDMA are completely separate, sata_qstor and pata_octeon_cf which inherit from ata_sff_port_ops don't need to worry about BMDMA ops being called. Kill the dummy BMDMA ops.
--- drivers/ata/pata_octeon_cf.c | 18 ------------------ drivers/ata/sata_qstor.c | 14 -------------- 2 files changed, 0 insertions(+), 32 deletions(-)
drivers/ata/pata_octeon_cf.c +0 -18
@@ -751,20 +751,6 @@ static void octeon_cf_dev_config(struct ata_device *dev) }/* -* Trap if driver tries to do standard bmdma commands. They are not -* supported. -*/ -static void unreachable_qc (struct ata_queued_cmd *qc) -{ -BUG (); -} - -static u8 unreachable_port (struct ata_port *ap) -{ -BUG (); -} - -/* * We don't do ATAPI DMA so return 0. */ static int octeon_cf_check_atapi_dma (struct ata_queued_cmd *qc)
@@ -805,10 +791,6 @@ static struct ata_port_operations octeon_cf_ops = { .sff_dev_select = octeon_cf_dev_select, .sff_irq_on = octeon_cf_irq_on, .sff_irq_clear = octeon_cf_irq_clear, - .bmdma_setup = unreachable_qc, - .bmdma_start = unreachable_qc, - .bmdma_stop = unreachable_qc, - .bmdma_status = unreachable_port, .cable_detect = ata_cable_40wire, .set_piomode = octeon_cf_set_piomode, .set_dmamode = octeon_cf_set_dmamode,
drivers/ata/sata_qstor.c +0 -14
@@ -120,8 +120,6 @@ static void qs_host_stop(struct ata_host *host);static void qs_qc_prep (struct ata_queued_cmd *qc);static unsigned int qs_qc_issue (struct ata_queued_cmd *qc);static int qs_check_atapi_dma (struct ata_queued_cmd *qc); -static void qs_bmdma_stop (struct ata_queued_cmd *qc); -static u8 qs_bmdma_status (struct ata_port *ap);static void qs_freeze (struct ata_port *ap);static void qs_thaw (struct ata_port *ap);static int qs_prereset (struct ata_link *link,unsigned long deadline);
@@ -137,8 +135,6 @@ static struct ata_port_operations qs_ata_ops = { .inherits = &ata_sff_port_ops, .check_atapi_dma = qs_check_atapi_dma, - .bmdma_stop = qs_bmdma_stop, - .bmdma_status = qs_bmdma_status, .qc_prep = qs_qc_prep, .qc_issue = qs_qc_issue,
@@ -190,16 +186,6 @@ static int qs_check_atapi_dma(struct ata_queued_cmd *qc)return 1 ;/* ATAPI DMA not supported */ } -static void qs_bmdma_stop (struct ata_queued_cmd *qc) -{ -/* nothing */ -} - -static u8 qs_bmdma_status (struct ata_port *ap) -{ -return 0 ; -} -static inline void qs_enter_reg_mode (struct ata_port *ap) {u8 __iomem *chan =qs_mmio_base (ap->host) + (ap->port_no *0x4000 );
Signature · 1 line
1.6.4.2
PATCH 23/23 libata-sff: make BMDMA optional
In reply to Tejun HeoMake BMDMA optional depending on new config variable CONFIG_ATA_BMDMA. In Kconfig, drivers are grouped into five groups - non-SFF native, SFF w/ custom DMA interface, SFF w/ BMDMA, PIO-only SFF, and generic fallback / legacy ones. Kconfig and Makefile are reorganized according to the groups and ordered alphabetically inside each group.
ata_ioports.bmdma_addr and ata_port.bmdma_prd[_dma] are put into CONFIG_ATA_BMDMA, as are all bmdma related ops, variables and functions.
This increase the binary size slightly when BMDMA is enabled but on both native-only and PIO-only configurations the size is slightly reduced. Either way, the size difference is insignificant. This change is more meaningful to signify the separation between SFF and BMDMA and as a tool to verify the separation.
--- drivers/ata/Kconfig | 511 ++++++++++++++++++++++++---------------------- drivers/ata/Makefile | 83 ++++---- drivers/ata/libata-sff.c | 11 + include/linux/libata.h | 22 ++- 4 files changed, 341 insertions(+), 286 deletions(-)
drivers/ata/Kconfig +268 -243
@@ -57,6 +57,8 @@ config SATA_PMP This option adds support for SATA Port Multipliers (the SATA version of an ethernet hub, or SAS expander). +comment "Controllers with non-SFF native interface" + config SATA_AHCI tristate "AHCI SATA support" depends on PCI
@@ -73,11 +75,12 @@ config SATA_AHCI_PLATFORM If unsure, say N. -config SATA_SIL24 - tristate "Silicon Image 3124/3132 SATA support" - depends on PCI +config SATA_FSL + tristate "Freescale 3.0Gbps SATA support" + depends on FSL_SOC help - This option enables support for Silicon Image 3124/3132 Serial ATA. + This option enables support for Freescale 3.0Gbps SATA controller. + It can be found on MPC837x and MPC8315. If unsure, say N.
@@ -87,12 +90,11 @@ config SATA_INIC162X help This option enables support for Initio 162x Serial ATA. -config SATA_FSL - tristate "Freescale 3.0Gbps SATA support" - depends on FSL_SOC +config SATA_SIL24 + tristate "Silicon Image 3124/3132 SATA support" + depends on PCI help - This option enables support for Freescale 3.0Gbps SATA controller. - It can be found on MPC837x and MPC8315. + This option enables support for Silicon Image 3124/3132 Serial ATA. If unsure, say N.
@@ -116,15 +118,65 @@ config ATA_SFF if ATA_SFF -config SATA_SVW - tristate "ServerWorks Frodo / Apple K2 SATA support" +comment "SFF controllers with custom DMA interface" + +config PDC_ADMA + tristate "Pacific Digital ADMA support" depends on PCI help - This option enables support for Broadcom/Serverworks/Apple K2 - SATA support. + This option enables support for Pacific Digital ADMA controllers + + If unsure, say N. + +config PATA_MPC52xx + tristate "Freescale MPC52xx SoC internal IDE" + depends on PPC_MPC52xx && PPC_BESTCOMM + select PPC_BESTCOMM_ATA + help + This option enables support for integrated IDE controller + of the Freescale MPC52xx SoC. + + If unsure, say N. + +config PATA_OCTEON_CF + tristate "OCTEON Boot Bus Compact Flash support" + depends on CPU_CAVIUM_OCTEON + help + This option enables a polled compact flash driver for use with + compact flash cards attached to the OCTEON boot bus. + + If unsure, say N. + +config SATA_QSTOR + tristate "Pacific Digital SATA QStor support" + depends on PCI + help + This option enables support for Pacific Digital Serial ATA QStor. + + If unsure, say N. + +config SATA_SX4 + tristate "Promise SATA SX4 support (Experimental)" + depends on PCI && EXPERIMENTAL + help + This option enables support for Promise Serial ATA SX4. If unsure, say N. +config ATA_BMDMA + bool "ATA BMDMA support" + default y + help + This option adds support for SFF ATA controllers with BMDMA + capability. BMDMA stands for bus-master DMA and the + de-facto DMA interface for SFF controllers. + + If unuser, say Y. + +if ATA_BMDMA + +comment "SATA SFF controllers with BMDMA" + config ATA_PIIX tristate "Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support" depends on PCI
@@ -152,22 +204,6 @@ config SATA_NV If unsure, say N. -config PDC_ADMA - tristate "Pacific Digital ADMA support" - depends on PCI - help - This option enables support for Pacific Digital ADMA controllers - - If unsure, say N. - -config SATA_QSTOR - tristate "Pacific Digital SATA QStor support" - depends on PCI - help - This option enables support for Pacific Digital Serial ATA QStor. - - If unsure, say N. - config SATA_PROMISE tristate "Promise SATA TX2/TX4 support" depends on PCI
@@ -176,14 +212,6 @@ config SATA_PROMISE If unsure, say N. -config SATA_SX4 - tristate "Promise SATA SX4 support (Experimental)" - depends on PCI && EXPERIMENTAL - help - This option enables support for Promise Serial ATA SX4. - - If unsure, say N. - config SATA_SIL tristate "Silicon Image SATA support" depends on PCI
@@ -203,6 +231,15 @@ config SATA_SIS enable the PATA_SIS driver in the config. If unsure, say N. +config SATA_SVW + tristate "ServerWorks Frodo / Apple K2 SATA support" + depends on PCI + help + This option enables support for Broadcom/Serverworks/Apple K2 + SATA support. + + If unsure, say N. + config SATA_ULI tristate "ULi Electronics SATA support" depends on PCI
@@ -227,14 +264,7 @@ config SATA_VITESSE If unsure, say N. -config PATA_ACPI - tristate "ACPI firmware driver for PATA" - depends on ATA_ACPI - help - This option enables an ACPI method driver which drives - motherboard PATA controller interfaces through the ACPI - firmware in the BIOS. This driver can sometimes handle - otherwise unsupported hardware. +comment "PATA SFF controllers with BMDMA" config PATA_ALI tristate "ALi PATA support"
@@ -262,40 +292,30 @@ config PATA_ARTOP If unsure, say N. -config PATA_ATP867X - tristate "ARTOP/Acard ATP867X PATA support" +config PATA_ATIIXP + tristate "ATI PATA support" depends on PCI help - This option enables support for ARTOP/Acard ATP867X PATA - controllers. - - If unsure, say N. - -config PATA_AT32 - tristate "Atmel AVR32 PATA support (Experimental)" - depends on AVR32 && PLATFORM_AT32AP && EXPERIMENTAL - help - This option enables support for the IDE devices on the - Atmel AT32AP platform. + This option enables support for the ATI ATA interfaces + found on the many ATI chipsets. If unsure, say N. -config PATA_ATIIXP - tristate "ATI PATA support" +config PATA_ATP867X + tristate "ARTOP/Acard ATP867X PATA support" depends on PCI help - This option enables support for the ATI ATA interfaces - found on the many ATI chipsets. + This option enables support for ARTOP/Acard ATP867X PATA + controllers. If unsure, say N. -config PATA_CMD640_PCI - tristate "CMD640 PCI PATA support (Experimental)" - depends on PCI && EXPERIMENTAL +config PATA_BF54X + tristate "Blackfin 54x ATAPI support" + depends on BF542 || BF548 || BF549 help - This option enables support for the CMD640 PCI IDE - interface chip. Only the primary channel is currently - supported. + This option enables support for the built-in ATAPI controller on + Blackfin 54x family chips. If unsure, say N.
@@ -362,15 +382,6 @@ config PATA_EFAR If unsure, say N. -config ATA_GENERIC - tristate "Generic ATA support" - depends on PCI - help - This option enables support for generic BIOS configured - ATA controllers via the new ATA layer - - If unsure, say N. - config PATA_HPT366 tristate "HPT 366/368 PATA support" depends on PCI
@@ -415,12 +426,20 @@ config PATA_HPT3X3_DMA controllers. Enable with care as there are still some problems with DMA on this chipset. -config PATA_ISAPNP - tristate "ISA Plug and Play PATA support" - depends on ISAPNP +config PATA_ICSIDE + tristate "Acorn ICS PATA support" + depends on ARM && ARCH_ACORN help - This option enables support for ISA plug & play ATA - controllers such as those found on old soundcards. + On Acorn systems, say Y here if you wish to use the ICS PATA + interface card. This is not required for ICS partition support. + If you are unsure, say N to this. + +config PATA_IT8213 + tristate "IT8213 PATA support (Experimental)" + depends on PCI && EXPERIMENTAL + help + This option enables support for the ITE 821 PATA + controllers via the new ATA layer. If unsure, say N.
@@ -434,15 +453,6 @@ config PATA_IT821X If unsure, say N. -config PATA_IT8213 - tristate "IT8213 PATA support (Experimental)" - depends on PCI && EXPERIMENTAL - help - This option enables support for the ITE 821 PATA - controllers via the new ATA layer. - - If unsure, say N. - config PATA_JMICRON tristate "JMicron PATA support" depends on PCI
@@ -452,23 +462,14 @@ config PATA_JMICRON If unsure, say N. -config PATA_LEGACY - tristate "Legacy ISA PATA support (Experimental)" - depends on (ISA || PCI) && EXPERIMENTAL - help - This option enables support for ISA/VLB/PCI bus legacy PATA - ports and allows them to be accessed via the new ATA layer. - - If unsure, say N. - -config PATA_TRIFLEX - tristate "Compaq Triflex PATA support" - depends on PCI +config PATA_MACIO + tristate "Apple PowerMac/PowerBook internal 'MacIO' IDE" + depends on PPC_PMAC help - Enable support for the Compaq 'Triflex' IDE controller as found - on many Compaq Pentium-Pro systems, via the new ATA layer. - - If unsure, say N. + Most IDE capable PowerMacs have IDE busses driven by a variant + of this controller which is part of the Apple chipset used on + most PowerMac models. Some models have multiple busses using + different chipsets, though generally, MacIO is one of them. config PATA_MARVELL tristate "Marvell PATA support via legacy mode"
@@ -481,32 +482,6 @@ config PATA_MARVELL If unsure, say N. -config PATA_MPC52xx - tristate "Freescale MPC52xx SoC internal IDE" - depends on PPC_MPC52xx && PPC_BESTCOMM - select PPC_BESTCOMM_ATA - help - This option enables support for integrated IDE controller - of the Freescale MPC52xx SoC. - - If unsure, say N. - -config PATA_MPIIX - tristate "Intel PATA MPIIX support" - depends on PCI - help - This option enables support for MPIIX PATA support. - - If unsure, say N. - -config PATA_OLDPIIX - tristate "Intel PATA old PIIX support" - depends on PCI - help - This option enables support for early PIIX PATA support. - - If unsure, say N. - config PATA_NETCELL tristate "NETCELL Revolution RAID support" depends on PCI
@@ -525,15 +500,6 @@ config PATA_NINJA32 If unsure, say N. -config PATA_NS87410 - tristate "Nat Semi NS87410 PATA support" - depends on PCI - help - This option enables support for the National Semiconductor - NS87410 PCI-IDE controller. - - If unsure, say N. - config PATA_NS87415 tristate "Nat Semi NS87415 PATA support" depends on PCI
@@ -543,12 +509,11 @@ config PATA_NS87415 If unsure, say N. -config PATA_OPTI - tristate "OPTI621/6215 PATA support (Very Experimental)" - depends on PCI && EXPERIMENTAL +config PATA_OLDPIIX + tristate "Intel PATA old PIIX support" + depends on PCI help - This option enables full PIO support for the early Opti ATA - controllers found on some old motherboards. + This option enables support for early PIIX PATA support. If unsure, say N.
@@ -562,24 +527,6 @@ config PATA_OPTIDMA If unsure, say N. -config PATA_PALMLD - tristate "Palm LifeDrive PATA support" - depends on MACH_PALMLD - help - This option enables support for Palm LifeDrive's internal ATA - port via the new ATA layer. - - If unsure, say N. - -config PATA_PCMCIA - tristate "PCMCIA PATA support" - depends on PCMCIA - help - This option enables support for PCMCIA ATA interfaces, including - compact flash card adapters via the new ATA layer. - - If unsure, say N. - config PATA_PDC2027X tristate "Promise PATA 2027x support" depends on PCI
@@ -597,12 +544,6 @@ config PATA_PDC_OLD If unsure, say N. -config PATA_QDI - tristate "QDI VLB PATA support" - depends on ISA - help - Support for QDI 6500 and 6580 PATA controllers on VESA local bus. - config PATA_RADISYS tristate "RADISYS 82600 PATA support (Experimental)" depends on PCI && EXPERIMENTAL
@@ -612,15 +553,6 @@ config PATA_RADISYS If unsure, say N. -config PATA_RB532 - tristate "RouterBoard 532 PATA CompactFlash support" - depends on MIKROTIK_RB532 - help - This option enables support for the RouterBoard 532 - PATA CompactFlash controller. - - If unsure, say N. - config PATA_RDC tristate "RDC PATA support" depends on PCI
@@ -631,21 +563,30 @@ config PATA_RDC If unsure, say N. -config PATA_RZ1000 - tristate "PC Tech RZ1000 PATA support" +config PATA_SC1200 + tristate "SC1200 PATA support" depends on PCI help - This option enables basic support for the PC Tech RZ1000/1 - PATA controllers via the new ATA layer + This option enables support for the NatSemi/AMD SC1200 SoC + companion chip used with the Geode processor family. If unsure, say N. -config PATA_SC1200 - tristate "SC1200 PATA support" +config PATA_SCC + tristate "Toshiba's Cell Reference Set IDE support" + depends on PCI && PPC_CELLEB + help + This option enables support for the built-in IDE controller on + Toshiba Cell Reference Board. + + If unsure, say N. + +config PATA_SCH + tristate "Intel SCH PATA support" depends on PCI help - This option enables support for the NatSemi/AMD SC1200 SoC - companion chip used with the Geode processor family. + This option enables support for Intel SCH PATA on the Intel + SCH (US15W, US15L, UL11L) series host controllers. If unsure, say N.
@@ -683,6 +624,15 @@ config PATA_TOSHIBA If unsure, say N. +config PATA_TRIFLEX + tristate "Compaq Triflex PATA support" + depends on PCI + help + Enable support for the Compaq 'Triflex' IDE controller as found + on many Compaq Pentium-Pro systems, via the new ATA layer. + + If unsure, say N. + config PATA_VIA tristate "VIA PATA support" depends on PCI
@@ -701,12 +651,99 @@ config PATA_WINBOND If unsure, say N. -config PATA_WINBOND_VLB - tristate "Winbond W83759A VLB PATA support (Experimental)" - depends on ISA && EXPERIMENTAL +endif # ATA_BMDMA + +comment "PIO-only SFF controllers" + +config PATA_AT32 + tristate "Atmel AVR32 PATA support (Experimental)" + depends on AVR32 && PLATFORM_AT32AP && EXPERIMENTAL help - Support for the Winbond W83759A controller on Vesa Local Bus - systems. + This option enables support for the IDE devices on the + Atmel AT32AP platform. + + If unsure, say N. + +config PATA_AT91 + tristate "PATA support for AT91SAM9260" + depends on ARM && ARCH_AT91 + help + This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. + + If unsure, say N. + +config PATA_CMD640_PCI + tristate "CMD640 PCI PATA support (Experimental)" + depends on PCI && EXPERIMENTAL + help + This option enables support for the CMD640 PCI IDE + interface chip. Only the primary channel is currently + supported. + + If unsure, say N. + +config PATA_ISAPNP + tristate "ISA Plug and Play PATA support" + depends on ISAPNP + help + This option enables support for ISA plug & play ATA + controllers such as those found on old soundcards. + + If unsure, say N. + +config PATA_IXP4XX_CF + tristate "IXP4XX Compact Flash support" + depends on ARCH_IXP4XX + help + This option enables support for a Compact Flash connected on + the ixp4xx expansion bus. This driver had been written for + Loft/Avila boards in mind but can work with others. + + If unsure, say N. + +config PATA_MPIIX + tristate "Intel PATA MPIIX support" + depends on PCI + help + This option enables support for MPIIX PATA support. + + If unsure, say N. + +config PATA_NS87410 + tristate "Nat Semi NS87410 PATA support" + depends on PCI + help + This option enables support for the National Semiconductor + NS87410 PCI-IDE controller. + + If unsure, say N. + +config PATA_OPTI + tristate "OPTI621/6215 PATA support (Very Experimental)" + depends on PCI && EXPERIMENTAL + help + This option enables full PIO support for the early Opti ATA + controllers found on some old motherboards. + + If unsure, say N. + +config PATA_PALMLD + tristate "Palm LifeDrive PATA support" + depends on MACH_PALMLD + help + This option enables support for Palm LifeDrive's internal ATA + port via the new ATA layer. + + If unsure, say N. + +config PATA_PCMCIA + tristate "PCMCIA PATA support" + depends on PCMCIA + help + This option enables support for PCMCIA ATA interfaces, including + compact flash card adapters via the new ATA layer. + + If unsure, say N. config HAVE_PATA_PLATFORM bool
@@ -725,14 +762,6 @@ config PATA_PLATFORM If unsure, say N. -config PATA_AT91 - tristate "PATA support for AT91SAM9260" - depends on ARM && ARCH_AT91 - help - This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. - - If unsure, say N. - config PATA_OF_PLATFORM tristate "OpenFirmware platform device PATA support" depends on PATA_PLATFORM && PPC_OF
@@ -743,69 +772,65 @@ config PATA_OF_PLATFORM If unsure, say N. -config PATA_ICSIDE - tristate "Acorn ICS PATA support" - depends on ARM && ARCH_ACORN +config PATA_QDI + tristate "QDI VLB PATA support" + depends on ISA help - On Acorn systems, say Y here if you wish to use the ICS PATA - interface card. This is not required for ICS partition support. - If you are unsure, say N to this. + Support for QDI 6500 and 6580 PATA controllers on VESA local bus. -config PATA_IXP4XX_CF - tristate "IXP4XX Compact Flash support" - depends on ARCH_IXP4XX +config PATA_RB532 + tristate "RouterBoard 532 PATA CompactFlash support" + depends on MIKROTIK_RB532 help - This option enables support for a Compact Flash connected on - the ixp4xx expansion bus. This driver had been written for - Loft/Avila boards in mind but can work with others. + This option enables support for the RouterBoard 532 + PATA CompactFlash controller. If unsure, say N. -config PATA_OCTEON_CF - tristate "OCTEON Boot Bus Compact Flash support" - depends on CPU_CAVIUM_OCTEON +config PATA_RZ1000 + tristate "PC Tech RZ1000 PATA support" + depends on PCI help - This option enables a polled compact flash driver for use with - compact flash cards attached to the OCTEON boot bus. + This option enables basic support for the PC Tech RZ1000/1 + PATA controllers via the new ATA layer If unsure, say N. -config PATA_SCC - tristate "Toshiba's Cell Reference Set IDE support" - depends on PCI && PPC_CELLEB +config PATA_WINBOND_VLB + tristate "Winbond W83759A VLB PATA support (Experimental)" + depends on ISA && EXPERIMENTAL help - This option enables support for the built-in IDE controller on - Toshiba Cell Reference Board. + Support for the Winbond W83759A controller on Vesa Local Bus + systems. - If unsure, say N. +comment "Generic fallback / legacy drivers" -config PATA_SCH - tristate "Intel SCH PATA support" - depends on PCI +config PATA_ACPI + tristate "ACPI firmware driver for PATA" + depends on ATA_ACPI && ATA_BMDMA help - This option enables support for Intel SCH PATA on the Intel - SCH (US15W, US15L, UL11L) series host controllers. - - If unsure, say N. + This option enables an ACPI method driver which drives + motherboard PATA controller interfaces through the ACPI + firmware in the BIOS. This driver can sometimes handle + otherwise unsupported hardware. -config PATA_BF54X - tristate "Blackfin 54x ATAPI support" - depends on BF542 || BF548 || BF549 +config ATA_GENERIC + tristate "Generic ATA support" + depends on PCI && ATA_BMDMA help - This option enables support for the built-in ATAPI controller on - Blackfin 54x family chips. + This option enables support for generic BIOS configured + ATA controllers via the new ATA layer If unsure, say N. -config PATA_MACIO - tristate "Apple PowerMac/PowerBook internal 'MacIO' IDE" - depends on PPC_PMAC +config PATA_LEGACY + tristate "Legacy ISA PATA support (Experimental)" + depends on (ISA || PCI) && EXPERIMENTAL help - Most IDE capable PowerMacs have IDE busses driven by a variant - of this controller which is part of the Apple chipset used on - most PowerMac models. Some models have multiple busses using - different chipsets, though generally, MacIO is one of them. + This option enables support for ISA/VLB/PCI bus legacy PATA + ports and allows them to be accessed via the new ATA layer. + If unsure, say N. endif # ATA_SFF endif # ATA
drivers/ata/Makefile +46 -37
126 lines not on this page · raw message
drivers/ata/libata-sff.c +11 -0
@@ -776,11 +776,15 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)case ATAPI_PROT_NODATA : ap->hsm_task_state =HSM_ST_LAST ;break ; +#ifdef CONFIG_ATA_BMDMA case ATAPI_PROT_DMA : ap->hsm_task_state =HSM_ST_LAST ;/* initiate bmdma */ ap->ops->bmdma_start (qc);break ; +#endif /* CONFIG_ATA_BMDMA */ +default : +BUG (); } }
@@ -2514,6 +2518,12 @@ EXPORT_SYMBOL_GPL(ata_pci_sff_init_one);#endif /* CONFIG_PCI */ +/* +* BMDMA support +*/ + +#ifdef CONFIG_ATA_BMDMA +const struct ata_port_operations ata_bmdma_port_ops = { .inherits = &ata_sff_port_ops,
@@ -3266,6 +3276,7 @@ int ata_pci_bmdma_init_one(struct pci_dev *pdev,EXPORT_SYMBOL_GPL (ata_pci_bmdma_init_one);#endif /* CONFIG_PCI */ +#endif /* CONFIG_ATA_BMDMA */ /** * ata_sff_port_init - Initialize SFF/BMDMA ATA port
include/linux/libata.h +16 -6
@@ -513,7 +513,9 @@ struct ata_ioports {void __iomem *command_addr;void __iomem *altstatus_addr;void __iomem *ctl_addr; +#ifdef CONFIG_ATA_BMDMA void __iomem *bmdma_addr; +#endif /* CONFIG_ATA_BMDMA */ void __iomem *scr_addr; };#endif /* CONFIG_ATA_SFF */
@@ -721,8 +723,10 @@ struct ata_port {u8 ctl;/* cache of ATA control register */ u8 last_ctl;/* Cache last written value */ struct delayed_work sff_pio_task; +#ifdef CONFIG_ATA_BMDMA struct ata_bmdma_prd *bmdma_prd;/* BMDMA SG list */ dma_addr_t bmdma_prd_dma;/* and its DMA mapping */ +#endif /* CONFIG_ATA_BMDMA */ #endif /* CONFIG_ATA_SFF */ unsigned int pio_mask;
@@ -855,10 +859,12 @@ struct ata_port_operations {void (*sff_irq_clear)(struct ata_port *);void (*sff_drain_fifo)(struct ata_queued_cmd *qc); +#ifdef CONFIG_ATA_BMDMA void (*bmdma_setup)(struct ata_queued_cmd *qc);void (*bmdma_start)(struct ata_queued_cmd *qc);void (*bmdma_stop)(struct ata_queued_cmd *qc);u8 (*bmdma_status)(struct ata_port *ap); +#endif /* CONFIG_ATA_BMDMA */ #endif /* CONFIG_ATA_SFF */ ssize_t (*em_show)(struct ata_port *ap,char *buf);
@@ -1554,7 +1560,6 @@ extern void sata_pmp_error_handler(struct ata_port *ap);#ifdef CONFIG_ATA_SFF extern const struct ata_port_operations ata_sff_port_ops; -extern const struct ata_port_operations ata_bmdma_port_ops;extern const struct ata_port_operations ata_bmdma32_port_ops;/* PIO only, sg_tablesize and dma_boundary limits can be removed */
@@ -1563,11 +1568,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops; .sg_tablesize = LIBATA_MAX_PRD, \ .dma_boundary = ATA_DMA_BOUNDARY -#define ATA_BMDMA_SHT (drv_name) \ - ATA_BASE_SHT(drv_name), \ - .sg_tablesize = LIBATA_MAX_PRD, \ - .dma_boundary = ATA_DMA_BOUNDARY - extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);extern u8 ata_sff_check_status (struct ata_port *ap);extern void ata_sff_pause (struct ata_port *ap);
@@ -1623,6 +1623,15 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, struct scsi_host_template *sht, void *host_priv, int hflags);#endif /* CONFIG_PCI */ +#ifdef CONFIG_ATA_BMDMA + +extern const struct ata_port_operations ata_bmdma_port_ops; + +#define ATA_BMDMA_SHT (drv_name) \ + ATA_BASE_SHT(drv_name), \ + .sg_tablesize = LIBATA_MAX_PRD, \ + .dma_boundary = ATA_DMA_BOUNDARY +extern void ata_bmdma_qc_prep (struct ata_queued_cmd *qc);extern unsigned int ata_bmdma_qc_issue (struct ata_queued_cmd *qc);extern void ata_bmdma_dumb_qc_prep (struct ata_queued_cmd *qc);
@@ -1650,6 +1659,7 @@ extern int ata_pci_bmdma_init_one(struct pci_dev *pdev,struct scsi_host_template *sht, void *host_priv, int hflags);#endif /* CONFIG_PCI */ +#endif /* CONFIG_ATA_BMDMA */ /** * ata_sff_busy_wait - Wait for a port status register
Signature · 1 line
1.6.4.2
Re: [PATCH 23/23] libata-sff: make BMDMA optional
Quoted 16 lines · Tejun Heo
Make BMDMA optional depending on new config variable
CONFIG_ATA_BMDMA. InKconfig, drivers are grouped into five groups - non-SFF native, SFF w/ custom DMA interface, SFF w/ BMDMA, PIO-only SFF, and generic fallback / legacy ones.KconfigandMakefileare reorganized according to the groups and ordered alphabetically inside each group.ata_ioports.bmdma_addr and ata_port.bmdma_prd[_dma] are put into
CONFIG_ATA_BMDMA, as are all bmdma related ops, variables and functions.This increase the binary size slightly when BMDMA is enabled but on both native-only and PIO-only configurations the size is slightly reduced. Either way, the size difference is insignificant. This change is more meaningful to signify the separation between SFF and BMDMA and as a tool to verify the separation.
Quoted 7 lines
Signed-off-by Tejun Heo<[email protected]>--- drivers/ata/Kconfig | 511 ++++++++++++++++++++++++---------------------- drivers/ata/Makefile | 83 ++++---- drivers/ata/libata-sff.c | 11 + include/linux/libata.h | 22 ++- 4 files changed, 341 insertions(+), 286 deletions(-)
ack remaining patches
I seem to be missing the following patches: 18, 20, 21, 23.
Checked multiple 'spam' folders to make sure they weren't accidentally considered spam. http://marc.info/?l=linux-ide shows those patches, so perhaps I could request a private re-send of those patches?
Thanks,
Jeff
Quoted 6 lines · Jeff Garzik
I seem to be missing the following patches: 18, 20, 21, 23.
Checked multiple 'spam' folders to make sure they weren't accidentally considered spam. http://marc.info/?l=linux-ide shows those patches, so perhaps I could request a private re-send of those patches?
OK, the missing patches just appeared.
Jeff