libata: modularize SFF support, take #1
Subsystems (5)
PATCH 1/1 libata: modularize SFF support, take #1
Hello, all.
This humongous patchset modularizes SFF support and cleans up whole lot of other stuff in the course. At the end, core layer is leaner and simpler, SFF support is well modularized and made optional and LLDs don't have to worry about how it's gonna meet the pseudo SFFism libata used to require.
This patchset is comprised of the following 27 patches.
0001-libata-drop-ata_dev_select-from-ata_dev_read_id.patch 0002-libata-reorder-functions-in-libata-sff.c.patch 0003-libata-reorganize-SFF-related-stuff.patch 0004-libata-move-ata_pci_default_filter-out-of-CONFIG_.patch 0005-libata-kill-ata_chk_status-call-from-ata_dev_conf.patch 0006-libata-kill-ata_chk_status.patch
0007-libata-rename-SFF-functions.patch
0008-libata-rename-SFF-port-ops.patch
0009-libata-clean-up-port_ops-sff_irq_clear.patch 0010-libata-separate-out-ata_std_prereset-from-ata_sff.patch 0011-libata-separate-out-ata_std_postreset-from-ata_sf.patch
0012-libata-restructure-SFF-post-reset-readiness-waits.patch 0013-libata-separate-out-ata_wait_ready-and-implement.patch 0014-ahci-use-ata_wait_after_reset-instead-of-ata_sff_.patch 0015-libata-move-generic-hardreset-code-from-sata_sff_ha.patch 0016-libata-implement-and-use-sata_std_hardreset.patch 0017-libata-clear-SError-after-link-resume.patch 0018-libata-move-PMP-SCR-access-failure-during-reset-to.patch 0019-libata-unify-mechanism-to-request-follow-up-SRST.patch
0020-libata-add-qc_fill_rtf-port-operation.patch 0021-libata-drop-finish_qc-from-ata_qc_complete_multipl.patch 0022-libata-replace-tf_read-with-qc_fill_rtf-for-non-SFF.patch 0023-libata-remove-check_status-from-non-SFF-drivers.patch
0024-libata-kill-ata_noop_dev_select.patch 0025-libata-clean-up-dummy-port_ops.patch 0026-libata-don-t-use-ap-ioaddr-in-non-SFF-drivers.patch
0027-libata-make-SFF-support-optional.patch
0001-0006 prepare for the soon-to-follow changes by dropping unncessary stuff and reorganizing code.
0007-0008 mass renames SFF related stuff. Over the time, the naming has become quite chaotic. Core and SFF stuff are mixed and various prefixes are in use pseudo-randomly. These two patches make the names consistent. By doing so make it clear which belongs where - ie. it sets the requirements for the soon-to-follow modularization. Stuff named with SFF and BMDMA prefixes should only live in libata-sff.c and can't be directly referenced from core layer.
0009-0011 separate out SFF specific parts regarding ->sff_irq_clear, prereset and postreset.
0012-0019 refactor post-reset wait code, separate out SFF specific parts regarding resets and clean up resulting code.
0020-0023 separate out TF access code out of core layer.
0024-0026 separate out what's left of SFF from core layer.
0027 makes SFF support optional.
The patchset has been tested on the following LLDs.
ahci, ata_piix, sata_sil, sata_sil24, pdc_adma, pata_hpt366, sata_promise, pata_jmicron
sata_fsl, ipr and libsas received good amount of modification but I couldn't test them. Especially, I couldn't even compile test sata_fsl. If you have access to the above drivers, please verify they are okay.
On x86_64 w/o any debugging turned on, on-disk size of libata.ko is reduced from 226k to 193k if SFF is turned off. The loaded size is changed from 157k to 133k.
This patchset is on top of
upstream-fixes (4cde32fc4b32e96a99063af3183acdfd54c563f0)
+ prefer-hardreset (990d6db0af21830681157317ab58c10f80277cb8)
+ cleanup-sht-ops (ed75ba53c883bc7a63fa1b60c63f33fcf395e751)
+ [1] cleanup-pdc_adma
This patchset is available as git tree.
http://git.kernel.org/?p=linux/kernel/git/tj/libata-dev.git;a=shortlog;h=modularize-SFF
git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata-dev.git modularize-SFF
Thanks.
--
tejun
PATCH 4/27 libata: move ata_pci_default_filter() out of CONFIG_PCI
ata_pci_default_filter() doesn't really have anything to do with PCI. It's generally applicable to BMDMA controllers. Move it out of CONFIG_PCI.
--- drivers/ata/libata-sff.c | 22 +++++++++++----------- include/linux/libata.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/ata/libata-sff.c +11 -11
@@ -2118,6 +2118,16 @@ void ata_std_ports(struct ata_ioports *ioaddr) ioaddr->command_addr = ioaddr->cmd_addr +ATA_REG_CMD ; } +unsigned long ata_pci_default_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; +} +/** * ata_bmdma_setup - Set up PCI IDE BMDMA transaction * @qc: Info associated with this ATA transaction.
@@ -2336,16 +2346,6 @@ int ata_pci_clear_simplex(struct pci_dev *pdev)return 0 ; } -unsigned long ata_pci_default_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; -} -/** * ata_pci_init_bmdma - acquire PCI BMDMA resources and init ATA host * @host: target ATA host
@@ -2726,6 +2726,7 @@ EXPORT_SYMBOL_GPL(ata_sff_port_ops);EXPORT_SYMBOL_GPL (ata_bmdma_port_ops);EXPORT_SYMBOL_GPL (ata_qc_prep);EXPORT_SYMBOL_GPL (ata_dumb_qc_prep); +EXPORT_SYMBOL_GPL (ata_pci_default_filter);EXPORT_SYMBOL_GPL (ata_std_dev_select);EXPORT_SYMBOL_GPL (ata_check_status);EXPORT_SYMBOL_GPL (ata_altstatus);
@@ -2761,7 +2762,6 @@ EXPORT_SYMBOL_GPL(ata_bmdma_status);EXPORT_SYMBOL_GPL (ata_bus_reset);#ifdef CONFIG_PCI EXPORT_SYMBOL_GPL (ata_pci_clear_simplex); -EXPORT_SYMBOL_GPL (ata_pci_default_filter);EXPORT_SYMBOL_GPL (ata_pci_init_bmdma);EXPORT_SYMBOL_GPL (ata_pci_init_sff_host);EXPORT_SYMBOL_GPL (ata_pci_prepare_sff_host);
include/linux/libata.h +2 -2
@@ -1397,6 +1397,8 @@ extern void ata_bmdma_error_handler(struct ata_port *ap);extern void ata_bmdma_post_internal_cmd (struct ata_queued_cmd *qc);extern int ata_sff_port_start (struct ata_port *ap);extern void ata_std_ports (struct ata_ioports *ioaddr); +extern unsigned long ata_pci_default_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);
@@ -1405,8 +1407,6 @@ extern void ata_bus_reset(struct ata_port *ap);#ifdef CONFIG_PCI extern int ata_pci_clear_simplex (struct pci_dev *pdev); -extern unsigned long ata_pci_default_filter (struct ata_device *dev, -unsigned long xfer_mask);extern int ata_pci_init_bmdma (struct ata_host *host);extern int ata_pci_init_sff_host (struct ata_host *host); extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
Signature · 1 line
1.5.2.4
PATCH 1/27 libata: drop ata_dev_select() from ata_dev_read_id
In reply to Tejun HeoThere is no reason to issue device select in read_id, it will be done by ops->qc_issue() when IDENTIFY[_PACKET] is issued via ata_exec_internal().
--- drivers/ata/libata-core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/ata/libata-core.c +0 -1
@@ -2118,7 +2118,6 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,if (ata_msg_ctl (ap))ata_dev_printk (dev,KERN_DEBUG ,"%s: ENTER\n" , __func__); -ata_dev_select (ap, dev->devno,1 ,1 );/* select device 0/1 */ retry:ata_tf_init (dev, &tf);
Signature · 1 line
1.5.2.4
PATCH 2/27 libata: reorder functions in libata-sff.c
In reply to Tejun HeoReorder functions in drivers/ata/libata-sff.c such that functions generally follow ops table order and init functions come last. This is in preparation of SFF cleanup.
This patch strictly moves stuff around and as such doesn't cause any functional difference.
--- drivers/ata/libata-sff.c | 443 +++++++++++++++++++++++----------------------- 1 files changed, 220 insertions(+), 223 deletions(-)
drivers/ata/libata-sff.c +220 -223
@@ -39,6 +39,43 @@#include "libata.h" /** +* ata_check_status - Read device status reg & clear interrupt +* @ap: port where the device is +* +* Reads ATA taskfile status register for currently-selected device +* and return its value. This also clears pending interrupts +* from this device +* +* LOCKING: +* Inherited from caller. +*/ +u8 ata_check_status (struct ata_port *ap) +{ +return ioread8 (ap->ioaddr.status_addr); +} + +/** +* ata_altstatus - Read device alternate status reg +* @ap: port where the device is +* +* Reads ATA taskfile alternate status register for +* currently-selected device and return its value. +* +* Note: may NOT be used as the check_altstatus() entry in +* ata_port_operations. +* +* LOCKING: +* Inherited from caller. +*/ +u8 ata_altstatus (struct ata_port *ap) +{ +if (ap->ops->check_altstatus) +return ap->ops->check_altstatus (ap); + +return ioread8 (ap->ioaddr.altstatus_addr); +} + +/** * ata_irq_on - Enable interrupts on a port. * @ap: Port on which interrupts are enabled. *
@@ -66,6 +103,27 @@ u8 ata_irq_on(struct ata_port *ap) }/** +* 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 ); +} + +/** * ata_tf_load - send taskfile registers to host controller * @ap: Port to which output is sent * @tf: ATA taskfile register set
@@ -75,7 +133,6 @@ u8 ata_irq_on(struct ata_port *ap)* LOCKING: * Inherited from caller. */ -void ata_tf_load (struct ata_port *ap,const struct ata_taskfile *tf) {struct ata_ioports *ioaddr = &ap->ioaddr;
@@ -126,25 +183,6 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) }/** -* ata_exec_command - issue ATA command to host controller -* @ap: port to which command is being issued -* @tf: ATA taskfile register set -* -* Issues ATA command, with proper synchronization with interrupt -* handler / other threads. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ -void ata_exec_command (struct ata_port *ap,const struct ata_taskfile *tf) -{ -DPRINTK ("ata%u: cmd 0x%X\n" , ap->print_id, tf->command); - -iowrite8 (tf->command, ap->ioaddr.command_addr); -ata_pause (ap); -} - -/** * ata_tf_read - input device's ATA taskfile shadow registers * @ap: Port from which input is read * @tf: ATA taskfile register set for storing input
@@ -185,169 +223,22 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) }/** -* ata_check_status - Read device status reg & clear interrupt -* @ap: port where the device is -* -* Reads ATA taskfile status register for currently-selected device -* and return its value. This also clears pending interrupts -* from this device -* -* LOCKING: -* Inherited from caller. -*/ -u8 ata_check_status (struct ata_port *ap) -{ -return ioread8 (ap->ioaddr.status_addr); -} - -/** -* ata_altstatus - Read device alternate status reg -* @ap: port where the device is -* -* Reads ATA taskfile alternate status register for -* currently-selected device and return its value. -* -* Note: may NOT be used as the check_altstatus() entry in -* ata_port_operations. -* -* LOCKING: -* Inherited from caller. -*/ -u8 ata_altstatus (struct ata_port *ap) -{ -if (ap->ops->check_altstatus) -return ap->ops->check_altstatus (ap); - -return ioread8 (ap->ioaddr.altstatus_addr); -} - -/** -* 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->exec_command (ap, &qc->tf); -} - -/** -* 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 -*/ -} - -/** -* 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 ); -} - -/** -* ata_noop_irq_clear - Noop placeholder for irq_clear -* @ap: Port associated with this ATA transaction. -*/ -void ata_noop_irq_clear (struct ata_port *ap) -{ -} - -/** -* 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 ); -} - -/** -* 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 +* ata_exec_command - issue ATA command to host controller +* @ap: port to which command is being issued +* @tf: ATA taskfile register set * -* May be used as the bmdma_stop() entry in ata_port_operations. +* Issues ATA command, with proper synchronization with interrupt +* handler / other threads. * * LOCKING: * spin_lock_irqsave(host lock) */ -void ata_bmdma_stop (struct ata_queued_cmd *qc) +void ata_exec_command (struct ata_port *ap,const struct ata_taskfile *tf) { -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 ); +DPRINTK ("ata%u: cmd 0x%X\n" , ap->print_id, tf->command); -/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ -ata_altstatus (ap);/* dummy read */ +iowrite8 (tf->command, ap->ioaddr.command_addr); +ata_pause (ap); }/**
@@ -496,7 +387,6 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)* LOCKING: * Inherited from caller. */ -int ata_sff_port_start (struct ata_port *ap) {if (ap->ioaddr.bmdma_addr)
@@ -504,20 +394,149 @@ int ata_sff_port_start(struct ata_port *ap)return 0 ; } +/** +* 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->exec_command (ap, &qc->tf); +} + +/** +* 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 +*/ +} + +/** +* 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_altstatus (ap);/* dummy read */ +} + +/** +* 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 ); +} + +/** +* ata_noop_irq_clear - Noop placeholder for irq_clear +* @ap: Port associated with this ATA transaction. +*/ +void ata_noop_irq_clear (struct ata_port *ap) +{ +} +#ifdef CONFIG_PCI -static int ata_resources_present (struct pci_dev *pdev,int port) +/** +* ata_pci_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_clear_simplex (struct pci_dev *pdev) { -int i; +unsigned long bmdma =pci_resource_start (pdev,4 ); +u8 simplex; -/* Check the PCI resources for this channel are enabled */ - port = port *2 ; -for (i =0 ; i <2 ; i ++) { -if (pci_resource_start (pdev, port + i) ==0 || -pci_resource_len (pdev, port + i) ==0 ) -return 0 ; - } -return 1 ; +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 ; +} + +unsigned long ata_pci_default_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; }/**
@@ -577,6 +596,20 @@ int ata_pci_init_bmdma(struct ata_host *host)return 0 ; } +static int ata_resources_present (struct pci_dev *pdev,int port) +{ +int i; + +/* Check the PCI resources for this channel are enabled */ + port = port *2 ; +for (i =0 ; i <2 ; i ++) { +if (pci_resource_start (pdev, port + i) ==0 || +pci_resource_len (pdev, port + i) ==0 ) +return 0 ; + } +return 1 ; +} +/** * ata_pci_init_sff_host - acquire native PCI ATA resources and init host * @host: target ATA host
@@ -880,41 +913,5 @@ int ata_pci_init_one(struct pci_dev *pdev, return rc; } -/** -* ata_pci_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_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 ; -} - -unsigned long ata_pci_default_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; -} -#endif /* CONFIG_PCI */
Signature · 1 line
1.5.2.4
PATCH 7/27 libata: rename SFF functions
In reply to Tejun HeoSFF functions have confusing names. Some have sff prefix, some have bmdma, some std, some pci and some none. Unify the naming by...
* SFF functions which are common to both BMDMA and non-BMDMA are prefixed with ata_sff_.
* SFF functions which are specific to BMDMA are prefixed with ata_bmdma_.
* SFF functions which are specific to PCI but apply to both BMDMA and non-BMDMA are prefixed with ata_pci_sff_.
* SFF functions which are specific to PCI and BMDMA are prefixed with ata_pci_bmdma_.
* Drop generic prefixes from LLD specific routines. For example, bfin_std_dev_select -> bfin_dev_select.
The following renames are noteworthy.
ata_qc_issue_prot() -> ata_sff_qc_issue() ata_pci_default_filter() -> ata_bmdma_mode_filter() ata_dev_try_classify() -> ata_sff_dev_classify()
This rename is in preparation of separating SFF support out of libata core layer. This patch strictly renames functions and doesn't introduce any behavior difference.
--- drivers/ata/ahci.c | 10 +- drivers/ata/ata_generic.c | 4 +- drivers/ata/ata_piix.c | 6 +- drivers/ata/libata-core.c | 16 +- drivers/ata/libata-eh.c | 2 +- drivers/ata/libata-sff.c | 344 +++++++++++++++++++------------------- drivers/ata/pata_acpi.c | 16 +- drivers/ata/pata_ali.c | 6 +- drivers/ata/pata_amd.c | 10 +- drivers/ata/pata_artop.c | 6 +- drivers/ata/pata_at32.c | 2 +- drivers/ata/pata_atiixp.c | 6 +- drivers/ata/pata_bf54x.c | 84 +++++----- drivers/ata/pata_cmd640.c | 16 +- drivers/ata/pata_cmd64x.c | 4 +- drivers/ata/pata_cs5520.c | 8 +- drivers/ata/pata_cs5530.c | 12 +- 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 | 10 +- drivers/ata/pata_hpt3x2n.c | 10 +- drivers/ata/pata_hpt3x3.c | 6 +- drivers/ata/pata_icside.c | 8 +- drivers/ata/pata_isapnp.c | 4 +- drivers/ata/pata_it8213.c | 4 +- drivers/ata/pata_it821x.c | 20 +- drivers/ata/pata_ixp4xx_cf.c | 4 +- drivers/ata/pata_jmicron.c | 4 +- drivers/ata/pata_legacy.c | 32 ++-- drivers/ata/pata_marvell.c | 4 +- drivers/ata/pata_mpc52xx.c | 4 +- drivers/ata/pata_mpiix.c | 18 +- drivers/ata/pata_netcell.c | 4 +- drivers/ata/pata_ninja32.c | 6 +- drivers/ata/pata_ns87410.c | 12 +- drivers/ata/pata_ns87415.c | 8 +- drivers/ata/pata_oldpiix.c | 12 +- drivers/ata/pata_opti.c | 4 +- drivers/ata/pata_optidma.c | 4 +- drivers/ata/pata_pcmcia.c | 6 +- drivers/ata/pata_pdc2027x.c | 10 +- drivers/ata/pata_pdc202xx_old.c | 2 +- drivers/ata/pata_platform.c | 4 +- drivers/ata/pata_qdi.c | 14 +- drivers/ata/pata_radisys.c | 10 +- drivers/ata/pata_rb500_cf.c | 6 +- drivers/ata/pata_rz1000.c | 2 +- drivers/ata/pata_sc1200.c | 12 +- drivers/ata/pata_scc.c | 80 +++++----- drivers/ata/pata_serverworks.c | 12 +- drivers/ata/pata_sil680.c | 10 +- drivers/ata/pata_sis.c | 4 +- drivers/ata/pata_sl82c105.c | 4 +- drivers/ata/pata_triflex.c | 4 +- drivers/ata/pata_via.c | 6 +- drivers/ata/pata_winbond.c | 6 +- drivers/ata/pdc_adma.c | 12 +- drivers/ata/sata_inic162x.c | 12 +- drivers/ata/sata_mv.c | 6 +- drivers/ata/sata_nv.c | 32 ++-- drivers/ata/sata_promise.c | 12 +- drivers/ata/sata_qstor.c | 10 +- drivers/ata/sata_sil.c | 8 +- drivers/ata/sata_sis.c | 6 +- drivers/ata/sata_svw.c | 4 +- drivers/ata/sata_sx4.c | 26 ++-- drivers/ata/sata_uli.c | 12 +- drivers/ata/sata_via.c | 12 +- drivers/ata/sata_vsc.c | 4 +- include/linux/libata.h | 103 ++++++------ 73 files changed, 599 insertions(+), 596 deletions(-)
drivers/ata/ahci.c +5 -5
@@ -1303,9 +1303,9 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class,ahci_exec_polled_cmd (ap, pmp, &tf,0 ,0 ,0 );/* wait a while before checking status */ -ata_wait_after_reset (ap, deadline); +ata_sff_wait_after_reset (ap, deadline); - rc =ata_wait_ready (ap, deadline); + rc =ata_sff_wait_ready (ap, deadline);/* link occupied, -ENODEV too is an error */ if (rc) { reason ="device not ready" ;
@@ -1350,7 +1350,7 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class, tf.command =0x80 ;ata_tf_to_fis (&tf,0 ,0 , d2h_fis); - rc =sata_std_hardreset (link, class, deadline); + rc =sata_sff_hardreset (link, class, deadline);ahci_start_engine (ap);
@@ -1431,7 +1431,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,* have to be reset again. For most cases, this should * suffice while making probing snappish enough. */ - rc =ata_wait_ready (ap, jiffies +2 *HZ ); + rc =ata_sff_wait_ready (ap, jiffies +2 *HZ );if (rc)ahci_kick_engine (ap,0 );
@@ -1444,7 +1444,7 @@ static void ahci_postreset(struct ata_link *link, unsigned int *class)void __iomem *port_mmio =ahci_port_base (ap);u32 new_tmp, tmp; -ata_std_postreset (link, class); +ata_sff_postreset (link, class);/* Make sure port's ATAPI bit is set appropriately */ new_tmp = tmp =readl (port_mmio +PORT_CMD );
drivers/ata/ata_generic.c +2 -2
@@ -150,9 +150,9 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_idreturn -ENODEV ;if (dev->vendor ==PCI_VENDOR_ID_AL ) -ata_pci_clear_simplex (dev); +ata_pci_bmdma_clear_simplex (dev); -return ata_pci_init_one (dev, ppi, &generic_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &generic_sht,NULL ); }static struct pci_device_id ata_generic[] = {
drivers/ata/ata_piix.c +3 -3
@@ -643,7 +643,7 @@ static int piix_pata_prereset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &piix_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -1497,7 +1497,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_prepare_sff_host (pdev, ppi, &host); + rc =ata_pci_sff_prepare_host (pdev, ppi, &host);if (rc)return rc; host->private_data = hpriv;
@@ -1541,7 +1541,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, }pci_set_master (pdev); -return ata_pci_activate_sff_host (host, ata_interrupt, &piix_sht); +return ata_pci_sff_activate_host (host, ata_sff_interrupt, &piix_sht); }static int __init piix_init (void )
drivers/ata/libata-core.c +8 -8
@@ -75,9 +75,9 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };const struct ata_port_operations ata_base_port_ops = { .irq_clear = ata_noop_irq_clear, - .prereset = ata_std_prereset, - .hardreset = sata_std_hardreset, - .postreset = ata_std_postreset, + .prereset = ata_sff_prereset, + .hardreset = sata_sff_hardreset, + .postreset = ata_sff_postreset, .error_handler = ata_std_error_handler, };
@@ -3387,7 +3387,7 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, }/** -* ata_std_prereset - prepare for reset +* ata_sff_prereset - prepare for reset * @link: ATA link to be reset * @deadline: deadline jiffies for the operation *
@@ -3403,7 +3403,7 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,* RETURNS: * 0 on success, -errno otherwise. */ -int ata_std_prereset (struct ata_link *link,unsigned long deadline) +int ata_sff_prereset (struct ata_link *link,unsigned long deadline) {struct ata_port *ap = link->ap;struct ata_eh_context *ehc = &link->eh_context;
@@ -3425,7 +3425,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)/* wait for !BSY if we don't know that no device is attached */ if (!ata_link_offline (link)) { - rc =ata_wait_ready (ap, deadline); + rc =ata_sff_wait_ready (ap, deadline);if (rc && rc != -ENODEV ) {ata_link_printk (link,KERN_WARNING ,"device not ready " "(errno=%d), forcing hardreset\n" , rc);
@@ -3497,7 +3497,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, }/** -* ata_std_postreset - standard postreset callback +* ata_sff_postreset - standard postreset callback * @link: the target ata_link * @classes: classes of attached devices *
@@ -3508,7 +3508,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,* LOCKING: * Kernel thread context (may sleep) */ -void ata_std_postreset (struct ata_link *link,unsigned int *classes) +void ata_sff_postreset (struct ata_link *link,unsigned int *classes) {struct ata_port *ap = link->ap;u32 serror;
drivers/ata/libata-eh.c +1 -1
@@ -2863,7 +2863,7 @@ void ata_std_error_handler(struct ata_port *ap)* ata_base_port_ops. Ignore it if SCR access is not * available. */ -if (hardreset == sata_std_hardreset && !sata_scr_valid (&ap->link)) +if (hardreset == sata_sff_hardreset && !sata_scr_valid (&ap->link)) hardreset =NULL ;ata_do_eh (ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
drivers/ata/libata-sff.c +172 -172
971 lines not on this page · raw message
drivers/ata/pata_acpi.c +8 -8
@@ -47,7 +47,7 @@ static int pacpi_pre_reset(struct ata_link *link, unsigned long deadline)if (ap->acpi_handle ==NULL ||ata_acpi_gtm (ap, &acpi->gtm) <0 )return -ENODEV ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -106,7 +106,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_pci_default_filter (adev, mask & acpi->mask[adev->devno]); +return ata_bmdma_mode_filter (adev, mask & acpi->mask[adev->devno]); }/**
@@ -162,7 +162,7 @@ static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev) }/** -* pacpi_qc_issue_prot - command issue +* pacpi_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -170,14 +170,14 @@ static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev)* neccessary. */ -static unsigned int pacpi_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int pacpi_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;struct pata_acpi *acpi = ap->private_data;if (acpi->gtm.flags &0x10 ) -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc);if (adev != acpi->last) {pacpi_set_piomode (ap, adev);
@@ -185,7 +185,7 @@ static unsigned int pacpi_qc_issue_prot(struct ata_queued_cmd *qc)pacpi_set_dmamode (ap, adev); acpi->last = adev; } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }/**
@@ -223,7 +223,7 @@ static struct scsi_host_template pacpi_sht = {static struct ata_port_operations pacpi_ops = { .inherits = &ata_bmdma_port_ops, - .qc_issue = pacpi_qc_issue_prot, + .qc_issue = pacpi_qc_issue, .cable_detect = pacpi_cable_detect, .mode_filter = pacpi_mode_filter, .set_piomode = pacpi_set_piomode,
@@ -259,7 +259,7 @@ static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) .port_ops = &pacpi_ops, };const struct ata_port_info *ppi[] = { &info,NULL }; -return ata_pci_init_one (pdev, ppi, &pacpi_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &pacpi_sht,NULL ); }static const struct pci_device_id pacpi_pci_tbl[] = {
drivers/ata/pata_ali.c +3 -3
@@ -117,7 +117,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_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }/**
@@ -409,7 +409,7 @@ static void ali_init_chipset(struct pci_dev *pdev) }pci_dev_put (isa_bridge);pci_dev_put (north); -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev); }/** * ali_init_one - discovery callback
@@ -512,7 +512,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ppi[0 ] = &info_20_udma;pci_dev_put (isa_bridge); } -return ata_pci_init_one (pdev, ppi, &ali_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &ali_sht,NULL ); }#ifdef CONFIG_PM
drivers/ata/pata_amd.c +5 -5
@@ -141,7 +141,7 @@ static int amd_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &amd_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }static int amd_cable_detect (struct ata_port *ap)
@@ -291,7 +291,7 @@ static int nv_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &nv_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -501,7 +501,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ppi[0 ] = &info[type];if (type <3 ) -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev);/* Check for AMD7411 */ if (type ==3 )
@@ -521,7 +521,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) }/* And fire it up */ -return ata_pci_init_one (pdev, ppi, &amd_sht, hpriv); +return ata_pci_sff_init_one (pdev, ppi, &amd_sht, hpriv); }#ifdef CONFIG_PM
@@ -544,7 +544,7 @@ static int amd_reinit_one(struct pci_dev *pdev)pci_write_config_byte (pdev,0x41 , fifo |0xF0 );if (pdev->device ==PCI_DEVICE_ID_AMD_VIPER_7409 || pdev->device ==PCI_DEVICE_ID_AMD_COBRA_7401 ) -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev); }ata_host_resume (host);
drivers/ata/pata_artop.c +3 -3
@@ -52,7 +52,7 @@ static int artop6210_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &artop_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -78,7 +78,7 @@ static int artop6260_pre_reset(struct ata_link *link, unsigned long deadline)if (pdev->device %1 && !pci_test_config_bits (pdev, &artop_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -400,7 +400,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)BUG_ON (ppi[0 ] ==NULL ); -return ata_pci_init_one (pdev, ppi, &artop_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &artop_sht,NULL ); }static const struct pci_device_id artop_pci_tbl[] = {
drivers/ata/pata_at32.c +1 -1
@@ -223,7 +223,7 @@ static int __init pata_at32_init_one(struct device *dev, host->private_data = info;/* Register ATA device and return */ -return ata_host_activate (host, info->irq, ata_interrupt, +return ata_host_activate (host, info->irq, ata_sff_interrupt,IRQF_SHARED |IRQF_TRIGGER_RISING , &at32_sht); }
drivers/ata/pata_atiixp.c +3 -3
@@ -45,7 +45,7 @@ static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &atiixp_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }static int atiixp_cable_detect (struct ata_port *ap)
@@ -223,7 +223,7 @@ static struct scsi_host_template atiixp_sht = {static struct ata_port_operations atiixp_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_dumb_qc_prep, + .qc_prep = ata_sff_dumb_qc_prep, .bmdma_start = atiixp_bmdma_start, .bmdma_stop = atiixp_bmdma_stop,
@@ -243,7 +243,7 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) .port_ops = &atiixp_port_ops };const struct ata_port_info *ppi[] = { &info,NULL }; -return ata_pci_init_one (dev, ppi, &atiixp_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &atiixp_sht,NULL ); }static const struct pci_device_id atiixp[] = {
drivers/ata/pata_bf54x.c +42 -42
252 lines not on this page · raw message
drivers/ata/pata_cmd640.c +8 -8
@@ -107,8 +107,8 @@ static void cmd640_set_piomode(struct ata_port *ap, struct ata_device *adev)pci_write_config_byte (pdev, arttim +1 , (t.active <<4 ) | t.recover); }else {/* Save the shared timings for channel, they will be loaded -by qc_issue_prot. Reloading the setup time is expensive -so we keep a merged one loaded */ +by qc_issue. Reloading the setup time is expensive so we +keep a merged one loaded */ pci_read_config_byte (pdev,ARTIM23 , ®); reg &=0x3F ; reg |= t.setup;
@@ -119,14 +119,14 @@ static void cmd640_set_piomode(struct ata_port *ap, struct ata_device *adev)/** -* cmd640_qc_issue_prot - command preparation hook +* cmd640_qc_issue - command preparation hook * @qc: Command to be issued * * Channel 1 has shared timings. We must reprogram the * clock each drive 2/3 switch we do. */ -static unsigned int cmd640_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int cmd640_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -137,7 +137,7 @@ static unsigned int cmd640_qc_issue_prot(struct ata_queued_cmd *qc)pci_write_config_byte (pdev,DRWTIM23 , timing->reg58[adev->devno]); timing->last = adev->devno; } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }/**
@@ -172,8 +172,8 @@ static struct scsi_host_template cmd640_sht = {static struct ata_port_operations cmd640_port_ops = { .inherits = &ata_bmdma_port_ops,/* In theory xfer_noirq is not needed once we kill the prefetcher */ - .data_xfer = ata_data_xfer_noirq, - .qc_issue = cmd640_qc_issue_prot, + .data_xfer = ata_sff_data_xfer_noirq, + .qc_issue = cmd640_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = cmd640_set_piomode, .port_start = cmd640_port_start,
@@ -224,7 +224,7 @@ static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id)cmd640_hardware_init (pdev); -return ata_pci_init_one (pdev, ppi, &cmd640_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &cmd640_sht,NULL ); }#ifdef CONFIG_PM
drivers/ata/pata_cmd64x.c +2 -2
@@ -349,7 +349,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) class_rev &=0xFF ;if (id->driver_data ==0 )/* 643 */ -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev);if (pdev->device ==PCI_DEVICE_ID_CMD_646 ) {/* Does UDMA work ? */
@@ -373,7 +373,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_init_one (pdev, ppi, &cmd64x_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &cmd64x_sht,NULL ); }#ifdef CONFIG_PM
drivers/ata/pata_cs5520.c +4 -4
@@ -146,7 +146,7 @@ static struct scsi_host_template cs5520_sht = {static struct ata_port_operations cs5520_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_dumb_qc_prep, + .qc_prep = ata_sff_dumb_qc_prep, .cable_detect = ata_cable_40wire, .set_piomode = cs5520_set_piomode, .set_dmamode = cs5520_set_dmamode,
@@ -227,7 +227,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi ioaddr->ctl_addr = iomap[1 ]; ioaddr->altstatus_addr = iomap[1 ]; ioaddr->bmdma_addr = iomap[4 ]; -ata_std_ports (ioaddr); +ata_sff_std_ports (ioaddr);ata_port_desc (host->ports[0 ],"cmd 0x%x ctl 0x%x" , cmd_port[0 ], ctl_port[0 ]);
@@ -238,7 +238,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi ioaddr->ctl_addr = iomap[3 ]; ioaddr->altstatus_addr = iomap[3 ]; ioaddr->bmdma_addr = iomap[4 ] +8 ; -ata_std_ports (ioaddr); +ata_sff_std_ports (ioaddr);ata_port_desc (host->ports[1 ],"cmd 0x%x ctl 0x%x" , cmd_port[1 ], ctl_port[1 ]);
@@ -258,7 +258,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_interrupt,0 ,DRV_NAME , host); + ata_sff_interrupt,0 ,DRV_NAME , host);if (rc)return rc;
drivers/ata/pata_cs5530.c +6 -6
@@ -133,7 +133,7 @@ static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev) }/** -* cs5530_qc_issue_prot - command issue +* cs5530_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -142,7 +142,7 @@ static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev)* one MWDMA/UDMA bit. */ -static unsigned int cs5530_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int cs5530_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -157,7 +157,7 @@ static unsigned int cs5530_qc_issue_prot(struct ata_queued_cmd *qc)cs5530_set_dmamode (ap, adev); } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }static struct scsi_host_template cs5530_sht = {
@@ -168,8 +168,8 @@ static struct scsi_host_template cs5530_sht = {static struct ata_port_operations cs5530_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_dumb_qc_prep, - .qc_issue = cs5530_qc_issue_prot, + .qc_prep = ata_sff_dumb_qc_prep, + .qc_issue = cs5530_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = cs5530_set_piomode,
@@ -325,7 +325,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_init_one (pdev, ppi, &cs5530_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &cs5530_sht,NULL ); }#ifdef CONFIG_PM
drivers/ata/pata_cs5535.c +1 -1
@@ -199,7 +199,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_init_one (dev, ppi, &cs5535_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &cs5535_sht,NULL ); }static const struct pci_device_id cs5535[] = {
drivers/ata/pata_cs5536.c +1 -1
@@ -261,7 +261,7 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id)return -ENODEV ; } -return ata_pci_init_one (dev, ppi, &cs5536_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &cs5536_sht,NULL ); }static const struct pci_device_id cs5536[] = {
drivers/ata/pata_cypress.c +1 -1
@@ -136,7 +136,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_init_one (pdev, ppi, &cy82c693_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &cy82c693_sht,NULL ); }static const struct pci_device_id cy82c693[] = {
drivers/ata/pata_efar.c +2 -2
@@ -45,7 +45,7 @@ static int efar_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &efar_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -262,7 +262,7 @@ 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_init_one (pdev, ppi, &efar_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &efar_sht,NULL ); }static const struct pci_device_id efar_pci_tbl[] = {
drivers/ata/pata_hpt366.c +2 -2
@@ -184,7 +184,7 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask)if (hpt_dma_blacklisted (adev,"UDMA4" , bad_ata66_4)) mask &= ~(0xF0 <<ATA_SHIFT_UDMA ); } -return ata_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }/**
@@ -393,7 +393,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_init_one (dev, ppi, &hpt36x_sht, hpriv); +return ata_pci_sff_init_one (dev, ppi, &hpt36x_sht, hpriv); }#ifdef CONFIG_PM
drivers/ata/pata_hpt37x.c +5 -5
@@ -283,7 +283,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_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }/**
@@ -299,7 +299,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_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }/**
@@ -338,7 +338,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline)pci_write_config_byte (pdev,0x50 +4 * ap->port_no,0x37 );udelay (100 ); -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }static int hpt374_fn1_pre_reset (struct ata_link *link,unsigned long deadline)
@@ -374,7 +374,7 @@ static int hpt374_fn1_pre_reset(struct ata_link *link, unsigned long deadline)pci_write_config_byte (pdev,0x50 +4 * ap->port_no,0x37 );udelay (100 ); -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -1019,7 +1019,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_init_one (dev, ppi, &hpt37x_sht, private_data); +return ata_pci_sff_init_one (dev, ppi, &hpt37x_sht, private_data); }static const struct pci_device_id hpt37x[] = {
drivers/ata/pata_hpt3x2n.c +5 -5
@@ -156,7 +156,7 @@ static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline)pci_write_config_byte (pdev,0x50 +4 * ap->port_no,0x37 );udelay (100 ); -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -308,7 +308,7 @@ static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)return 0 ; } -static unsigned int hpt3x2n_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int hpt3x2n_qc_issue (struct ata_queued_cmd *qc) {struct ata_taskfile *tf = &qc->tf;struct ata_port *ap = qc->ap;
@@ -323,7 +323,7 @@ static unsigned int hpt3x2n_qc_issue_prot(struct ata_queued_cmd *qc)hpt3x2n_set_clock (ap,0x23 ); } } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }static struct scsi_host_template hpt3x2n_sht = {
@@ -338,7 +338,7 @@ static struct ata_port_operations hpt3x2n_port_ops = { .inherits = &ata_bmdma_port_ops, .bmdma_stop = hpt3x2n_bmdma_stop, - .qc_issue = hpt3x2n_qc_issue_prot, + .qc_issue = hpt3x2n_qc_issue, .cable_detect = hpt3x2n_cable_detect, .set_piomode = hpt3x2n_set_piomode,
@@ -554,7 +554,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) }/* Now kick off ATA set up */ -return ata_pci_init_one (dev, ppi, &hpt3x2n_sht, hpriv); +return ata_pci_sff_init_one (dev, ppi, &hpt3x2n_sht, hpriv); }static const struct pci_device_id hpt3x2n[] = {
drivers/ata/pata_hpt3x3.c +3 -3
@@ -202,15 +202,15 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ioaddr->altstatus_addr = ioaddr->ctl_addr = base + offset_ctl[i]; ioaddr->scr_addr =NULL ; -ata_std_ports (ioaddr); +ata_sff_std_ports (ioaddr); ioaddr->bmdma_addr = base +8 * i;ata_port_pbar_desc (ap,4 ,-1 ,"ioport" );ata_port_pbar_desc (ap,4 , offset_cmd[i],"cmd" ); }pci_set_master (pdev); -return ata_host_activate (host, pdev->irq, ata_interrupt,IRQF_SHARED , - &hpt3x3_sht); +return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +IRQF_SHARED , &hpt3x3_sht); }#ifdef CONFIG_PM
drivers/ata/pata_icside.c +4 -4
@@ -270,7 +270,7 @@ static void pata_icside_bmdma_stop(struct ata_queued_cmd *qc)disable_dma (state->dma);/* see ata_bmdma_stop */ -ata_altstatus (ap); +ata_sff_altstatus (ap); }static u8 pata_icside_bmdma_status (struct ata_port *ap)
@@ -316,7 +316,7 @@ static void pata_icside_postreset(struct ata_link *link, unsigned int *classes)struct pata_icside_state *state = ap->host->private_data;if (classes[0 ] !=ATA_DEV_NONE || classes[1 ] !=ATA_DEV_NONE ) -return ata_std_postreset (link, classes); +return ata_sff_postreset (link, classes); state->port[ap->port_no].disabled =1 ;
@@ -336,7 +336,7 @@ static struct ata_port_operations pata_icside_port_ops = { .inherits = &ata_sff_port_ops,/* no need to build any PRD tables for DMA */ .qc_prep = ata_noop_qc_prep, - .data_xfer = ata_data_xfer_noirq, + .data_xfer = ata_sff_data_xfer_noirq, .bmdma_setup = pata_icside_bmdma_setup, .bmdma_start = pata_icside_bmdma_start, .bmdma_stop = pata_icside_bmdma_stop,
@@ -481,7 +481,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_interrupt,0 , +return ata_host_activate (host, ec->irq, ata_sff_interrupt,0 , &pata_icside_sht); }
drivers/ata/pata_isapnp.c +2 -2
@@ -50,7 +50,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *devif (pnp_irq_valid (idev,0 )) { irq =pnp_irq (idev,0 ); - handler = ata_interrupt; + handler = ata_sff_interrupt; }/* allocate host */
@@ -78,7 +78,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev ap->ioaddr.ctl_addr = ctl_addr; } -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr); ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx", (unsigned long long)pnp_port_start(idev, 0),
drivers/ata/pata_it8213.c +2 -2
@@ -40,7 +40,7 @@ static int it8213_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &it8213_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -274,7 +274,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_init_one (pdev, ppi, &it8213_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &it8213_sht,NULL ); }static const struct pci_device_id it8213_pci_tbl[] = {
drivers/ata/pata_it821x.c +10 -10
@@ -395,11 +395,11 @@ static void it821x_passthru_dev_select(struct ata_port *ap,it821x_program (ap, adev, itdev->pio[adev->devno]); itdev->last_device = device; } -ata_std_dev_select (ap, device); +ata_sff_dev_select (ap, device); }/** -* it821x_smart_qc_issue_prot - wrap qc issue prot +* it821x_smart_qc_issue - wrap qc issue prot * @qc: command * * Wrap the command issue sequence for the IT821x. We need to
@@ -407,7 +407,7 @@ static void it821x_passthru_dev_select(struct ata_port *ap,* usual happenings kick off */ -static unsigned int it821x_smart_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int it821x_smart_qc_issue (struct ata_queued_cmd *qc) {switch (qc->tf.command) {
@@ -427,14 +427,14 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc)case ATA_CMD_ID_ATA :/* Arguably should just no-op this one */ case ATA_CMD_SET_FEATURES : -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }printk (KERN_DEBUG "it821x: can't process command 0x%02X\n" , qc->tf.command);return AC_ERR_DEV ; }/** -* it821x_passthru_qc_issue_prot - wrap qc issue prot +* it821x_passthru_qc_issue - wrap qc issue prot * @qc: command * * Wrap the command issue sequence for the IT821x. We need to
@@ -442,10 +442,10 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc)* usual happenings kick off */ -static unsigned int it821x_passthru_qc_issue_prot (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_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }/**
@@ -639,7 +639,7 @@ static struct ata_port_operations it821x_smart_port_ops = { .inherits = &ata_bmdma_port_ops, .check_atapi_dma= it821x_check_atapi_dma, - .qc_issue = it821x_smart_qc_issue_prot, + .qc_issue = it821x_smart_qc_issue, .cable_detect = it821x_ident_hack, .set_mode = it821x_smart_set_mode,
@@ -655,7 +655,7 @@ static struct ata_port_operations it821x_passthru_port_ops = { .dev_select = it821x_passthru_dev_select, .bmdma_start = it821x_passthru_bmdma_start, .bmdma_stop = it821x_passthru_bmdma_stop, - .qc_issue = it821x_passthru_qc_issue_prot, + .qc_issue = it821x_passthru_qc_issue, .cable_detect = ata_cable_unknown, .set_piomode = it821x_passthru_set_piomode,
@@ -722,7 +722,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)else ppi[0 ] = &info_smart; -return ata_pci_init_one (pdev, ppi, &it821x_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &it821x_sht,NULL ); }#ifdef CONFIG_PM
drivers/ata/pata_ixp4xx_cf.c +2 -2
@@ -110,7 +110,7 @@ static void ixp4xx_setup_port(struct ata_port *ap, ioaddr->altstatus_addr = data->cs1 +0x06 ; ioaddr->ctl_addr = data->cs1 +0x06 ; -ata_std_ports (ioaddr); +ata_sff_std_ports (ioaddr);#ifndef __ARMEB__
@@ -186,7 +186,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)dev_printk (KERN_INFO , &pdev->dev,"version " DRV_VERSION "\n" );/* activate host */ -return ata_host_activate (host, irq, ata_interrupt,0 , &ixp4xx_sht); +return ata_host_activate (host, irq, ata_sff_interrupt,0 , &ixp4xx_sht); } static __devexit int ixp4xx_pata_remove(struct platform_device *dev)
drivers/ata/pata_jmicron.c +2 -2
@@ -102,7 +102,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline) ap->cbl =ATA_CBL_SATA ;break ; } -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/* No PIO or DMA methods needed for this device */
@@ -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_init_one (pdev, ppi, &jmicron_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &jmicron_sht,NULL ); }static const struct pci_device_id jmicron_pci_tbl[] = {
drivers/ata/pata_legacy.c +16 -16
@@ -226,12 +226,12 @@ static const struct ata_port_operations legacy_base_port_ops = {static struct ata_port_operations simple_port_ops = { .inherits = &legacy_base_port_ops, - .data_xfer = ata_data_xfer_noirq, + .data_xfer = ata_sff_data_xfer_noirq, };static struct ata_port_operations legacy_port_ops = { .inherits = &legacy_base_port_ops, - .data_xfer = ata_data_xfer_noirq, + .data_xfer = ata_sff_data_xfer_noirq, .set_mode = legacy_set_mode, };
@@ -317,7 +317,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, }local_irq_restore (flags); }else - buflen =ata_data_xfer_noirq (dev, buf, buflen, rw); + buflen =ata_sff_data_xfer_noirq (dev, buf, buflen, rw);return buflen; }
@@ -579,7 +579,7 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev) }/** -* opt82c465mv_qc_issue_prot - command issue +* opt82c465mv_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -593,7 +593,7 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev)* FIXME: dual channel needs ->serialize support */ -static unsigned int opti82c46x_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int opti82c46x_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -604,13 +604,13 @@ static unsigned int opti82c46x_qc_issue_prot(struct ata_queued_cmd *qc) && ap->host->private_data != NULL)opti82c46x_set_piomode (ap, adev); -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }static struct ata_port_operations opti82c46x_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = opti82c46x_set_piomode, - .qc_issue = opti82c46x_qc_issue_prot, + .qc_issue = opti82c46x_qc_issue, };static void qdi6500_set_piomode (struct ata_port *ap,struct ata_device *adev)
@@ -644,7 +644,7 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)* @irq: interrupt line * * In dual channel mode the 6580 has one clock per channel and we have -* to software clockswitch in qc_issue_prot. +* to software clockswitch in qc_issue. */ static void qdi6580dp_set_piomode (struct ata_port *ap,struct ata_device *adev)
@@ -710,14 +710,14 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) }/** -* qdi_qc_issue_prot - command issue +* qdi_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap * this interface so that we can load the correct ATA timings. */ -static unsigned int qdi_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int qdi_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -730,7 +730,7 @@ static unsigned int qdi_qc_issue_prot(struct ata_queued_cmd *qc) 2 * ap->port_no); } } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); } static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf,
@@ -759,7 +759,7 @@ static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, }return (buflen +3 ) & ~3 ; }else -return ata_data_xfer (adev, buf, buflen, rw); +return ata_sff_data_xfer (adev, buf, buflen, rw); } static int qdi_port(struct platform_device *dev,
@@ -774,7 +774,7 @@ static int qdi_port(struct platform_device *dev,static struct ata_port_operations qdi6500_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = qdi6500_set_piomode, - .qc_issue = qdi_qc_issue_prot, + .qc_issue = qdi_qc_issue, .data_xfer = vlb32_data_xfer, };
@@ -1016,13 +1016,13 @@ static __init int legacy_init_one(struct legacy_probe *probe) ap->ioaddr.cmd_addr = io_addr; ap->ioaddr.altstatus_addr = ctrl_addr; ap->ioaddr.ctl_addr = ctrl_addr; -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr); ap->host->private_data = ld;ata_port_desc (ap,"cmd 0x%lx ctl 0x%lx" , io, io +0x0206 ); - ret =ata_host_activate (host, probe->irq, ata_interrupt,0 , - &legacy_sht); + ret =ata_host_activate (host, probe->irq, ata_sff_interrupt,0 , + &legacy_sht);if (ret) goto fail; ld->platform_dev = pdev;
drivers/ata/pata_marvell.c +2 -2
@@ -55,7 +55,7 @@ static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) (!(devices & 0x10))) /* PATA enable ? */return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }static int marvell_cable_detect (struct ata_port *ap)
@@ -128,7 +128,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *iif (pdev->device ==0x6101 ) ppi[1 ] = &ata_dummy_port_info; -return ata_pci_init_one (pdev, ppi, &marvell_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &marvell_sht,NULL ); }static const struct pci_device_id marvell_pci_tbl[] = {
drivers/ata/pata_mpc52xx.c +2 -2
@@ -252,7 +252,7 @@ mpc52xx_ata_dev_select(struct ata_port *ap, unsigned int device)if (device != priv->csel)mpc52xx_ata_apply_timings (priv, device); -ata_std_dev_select (ap,device); +ata_sff_dev_select (ap,device); }static struct scsi_host_template mpc52xx_ata_sht = {
@@ -305,7 +305,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_interrupt,0 , +return ata_host_activate (host, priv->ata_irq, ata_sff_interrupt,0 , &mpc52xx_ata_sht); }
drivers/ata/pata_mpiix.c +9 -9
@@ -55,7 +55,7 @@ static int mpiix_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &mpiix_enable_bits))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -69,8 +69,8 @@ static int mpiix_pre_reset(struct ata_link *link, unsigned long deadline)* * This would get very ugly because we can only program timing for one * device at a time, the other gets PIO0. Fortunately libata calls -* our qc_issue_prot command before a command is issued so we can -* flip the timings back and forth to reduce the pain. +* our qc_issue command before a command is issued so we can flip the +* timings back and forth to reduce the pain. */ static void mpiix_set_piomode (struct ata_port *ap,struct ata_device *adev)
@@ -110,7 +110,7 @@ static void mpiix_set_piomode(struct ata_port *ap, struct ata_device *adev) }/** -* mpiix_qc_issue_prot - command issue +* mpiix_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -120,7 +120,7 @@ static void mpiix_set_piomode(struct ata_port *ap, struct ata_device *adev)* be made PIO0. */ -static unsigned int mpiix_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int mpiix_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -133,7 +133,7 @@ static unsigned int mpiix_qc_issue_prot(struct ata_queued_cmd *qc)if (adev->pio_mode && adev != ap->private_data)mpiix_set_piomode (ap, adev); -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }static struct scsi_host_template mpiix_sht = {
@@ -142,7 +142,7 @@ static struct scsi_host_template mpiix_sht = {static struct ata_port_operations mpiix_port_ops = { .inherits = &ata_sff_port_ops, - .qc_issue = mpiix_qc_issue_prot, + .qc_issue = mpiix_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = mpiix_set_piomode, .prereset = mpiix_pre_reset,
@@ -207,10 +207,10 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) ap->ioaddr.altstatus_addr = ctl_addr;/* Let libata fill in the port details */ -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr);/* activate host */ -return ata_host_activate (host, irq, ata_interrupt,IRQF_SHARED , +return ata_host_activate (host, irq, ata_sff_interrupt,IRQF_SHARED , &mpiix_sht); }
drivers/ata/pata_netcell.c +2 -2
@@ -68,10 +68,10 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ereturn rc;/* Any chip specific setup/optimisation/messages here */ -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev);/* And let the library code do the work */ -return ata_pci_init_one (pdev, port_info, &netcell_sht,NULL ); +return ata_pci_sff_init_one (pdev, port_info, &netcell_sht,NULL ); }static const struct pci_device_id netcell_pci_tbl[] = {
drivers/ata/pata_ninja32.c +3 -3
@@ -73,7 +73,7 @@ static void ninja32_dev_select(struct ata_port *ap, unsigned int device)struct ata_device *adev = &ap->link.device[device];if (ap->private_data != adev) {iowrite8 (0xd6 , ap->ioaddr.bmdma_addr +0x1f ); -ata_std_dev_select (ap, device); +ata_sff_dev_select (ap, device);ninja32_set_piomode (ap, adev); } }
@@ -132,7 +132,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) ap->ioaddr.ctl_addr = base +0x1E ; ap->ioaddr.altstatus_addr = base +0x1E ; ap->ioaddr.bmdma_addr = base; -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr);iowrite8 (0x05 , base +0x01 );/* Enable interrupt lines */ iowrite8 (0xBE , base +0x02 );/* Burst, ?? setup */
@@ -142,7 +142,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)iowrite8 (0xa4 , base +0x1c );/* Unknown */ iowrite8 (0x83 , base +0x1d );/* BMDMA control: WAIT0 */ /* FIXME: Should we disable them at remove ? */ -return ata_host_activate (host, dev->irq, ata_interrupt, +return ata_host_activate (host, dev->irq, ata_sff_interrupt,IRQF_SHARED , &ninja32_sht); }
drivers/ata/pata_ns87410.c +6 -6
@@ -50,7 +50,7 @@ static int ns87410_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &ns87410_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -105,7 +105,7 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev) }/** -* ns87410_qc_issue_prot - command issue +* ns87410_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -113,7 +113,7 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev)* necessary. */ -static unsigned int ns87410_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int ns87410_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -126,7 +126,7 @@ static unsigned int ns87410_qc_issue_prot(struct ata_queued_cmd *qc)if (adev->pio_mode && adev != ap->private_data)ns87410_set_piomode (ap, adev); -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }static struct scsi_host_template ns87410_sht = {
@@ -135,7 +135,7 @@ static struct scsi_host_template ns87410_sht = {static struct ata_port_operations ns87410_port_ops = { .inherits = &ata_sff_port_ops, - .qc_issue = ns87410_qc_issue_prot, + .qc_issue = ns87410_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = ns87410_set_piomode, .prereset = ns87410_pre_reset,
@@ -149,7 +149,7 @@ static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) .port_ops = &ns87410_port_ops };const struct ata_port_info *ppi[] = { &info,NULL }; -return ata_pci_init_one (dev, ppi, &ns87410_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &ns87410_sht,NULL ); }static const struct pci_device_id ns87410[] = {
drivers/ata/pata_ns87415.c +4 -4
@@ -172,14 +172,14 @@ static void ns87415_bmdma_stop(struct ata_queued_cmd *qc) }/** -* ns87415_bmdma_irq_clear - Clear interrupt +* ns87415_irq_clear - Clear interrupt * @ap: Channel to clear * * Erratum: Due to a chip bug regisers 02 and 0A bit 1 and 2 (the * error bits) are reset by writing to register 00 or 08. */ -static void ns87415_bmdma_irq_clear (struct ata_port *ap) +static void ns87415_irq_clear (struct ata_port *ap) {void __iomem *mmio = ap->ioaddr.bmdma_addr;
@@ -306,7 +306,7 @@ static struct ata_port_operations ns87415_pata_ops = { .bmdma_setup = ns87415_bmdma_setup, .bmdma_start = ns87415_bmdma_start, .bmdma_stop = ns87415_bmdma_stop, - .irq_clear = ns87415_bmdma_irq_clear, + .irq_clear = ns87415_irq_clear, .cable_detect = ata_cable_40wire, .set_piomode = ns87415_set_piomode,
@@ -375,7 +375,7 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *epci_write_config_byte (pdev,0x55 ,0xEE );/* Select PIO0 8bit clocking */ pci_write_config_byte (pdev,0x54 ,0xB7 ); -return ata_pci_init_one (pdev, ppi, &ns87415_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &ns87415_sht,NULL ); }static const struct pci_device_id ns87415_pci_tbl[] = {
drivers/ata/pata_oldpiix.c +6 -6
@@ -47,7 +47,7 @@ static int oldpiix_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &oldpiix_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -181,7 +181,7 @@ static void oldpiix_set_dmamode (struct ata_port *ap, struct ata_device *adev) }/** -* oldpiix_qc_issue_prot - command issue +* oldpiix_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -191,7 +191,7 @@ static void oldpiix_set_dmamode (struct ata_port *ap, struct ata_device *adev)* be made PIO0. */ -static unsigned int oldpiix_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int oldpiix_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -201,7 +201,7 @@ static unsigned int oldpiix_qc_issue_prot(struct ata_queued_cmd *qc)if (adev->dma_mode)oldpiix_set_dmamode (ap, adev); } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }
@@ -211,7 +211,7 @@ static struct scsi_host_template oldpiix_sht = {static struct ata_port_operations oldpiix_pata_ops = { .inherits = &ata_bmdma_port_ops, - .qc_issue = oldpiix_qc_issue_prot, + .qc_issue = oldpiix_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = oldpiix_set_piomode, .set_dmamode = oldpiix_set_dmamode,
@@ -249,7 +249,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_init_one (pdev, ppi, &oldpiix_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &oldpiix_sht,NULL ); }static const struct pci_device_id oldpiix_pci_tbl[] = {
drivers/ata/pata_opti.c +2 -2
@@ -64,7 +64,7 @@ static int opti_pre_reset(struct ata_link *link, unsigned long deadline)if (!pci_test_config_bits (pdev, &opti_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -173,7 +173,7 @@ static int opti_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_init_one (dev, ppi, &opti_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &opti_sht,NULL ); }static const struct pci_device_id opti[] = {
drivers/ata/pata_optidma.c +2 -2
@@ -64,7 +64,7 @@ static int optidma_pre_reset(struct ata_link *link, unsigned long deadline)if (ap->port_no && !pci_test_config_bits (pdev, &optidma_enable_bits))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -430,7 +430,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_init_one (dev, ppi, &optidma_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &optidma_sht,NULL ); }static const struct pci_device_id optidma[] = {
drivers/ata/pata_pcmcia.c +3 -3
@@ -133,7 +133,7 @@ static struct scsi_host_template pcmcia_sht = {static struct ata_port_operations pcmcia_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = ata_data_xfer_noirq, + .data_xfer = ata_sff_data_xfer_noirq, .cable_detect = ata_cable_40wire, .set_mode = pcmcia_set_mode, };
@@ -323,13 +323,13 @@ next_entry: ap->ioaddr.cmd_addr = io_addr +0x10 * p; ap->ioaddr.altstatus_addr = ctl_addr +0x10 * p; ap->ioaddr.ctl_addr = ctl_addr +0x10 * p; -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr);ata_port_desc (ap,"cmd 0x%lx ctl 0x%lx" , io_base, ctl_base); }/* activate */ - ret =ata_host_activate (host, pdev->irq.AssignedIRQ, ata_interrupt, + ret =ata_host_activate (host, pdev->irq.AssignedIRQ, ata_sff_interrupt,IRQF_SHARED , &pcmcia_sht);if (ret) goto failed;
drivers/ata/pata_pdc2027x.c +5 -5
@@ -248,7 +248,7 @@ static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline)/* Check whether port enabled */ if (!pdc2027x_port_enabled (link->ap))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }/**
@@ -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_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, 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_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }/**
@@ -759,8 +759,8 @@ 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_interrupt,IRQF_SHARED , - &pdc2027x_sht); +return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +IRQF_SHARED , &pdc2027x_sht); }/**
drivers/ata/pata_pdc202xx_old.c +1 -1
@@ -324,7 +324,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *idreturn -ENODEV ; } } -return ata_pci_init_one (dev, ppi, &pdc202xx_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &pdc202xx_sht,NULL ); }static const struct pci_device_id pdc202xx[] = {
drivers/ata/pata_platform.c +2 -2
@@ -52,7 +52,7 @@ static struct scsi_host_template pata_platform_sht = {static struct ata_port_operations pata_platform_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = ata_data_xfer_noirq, + .data_xfer = ata_sff_data_xfer_noirq, .cable_detect = ata_cable_unknown, .set_mode = pata_platform_set_mode, .port_start =ATA_OP_NULL ,
@@ -176,7 +176,7 @@ int __devinit __pata_platform_probe(struct device *dev, (unsigned long long)ctl_res->start);/* activate */ -return ata_host_activate (host, irq, irq ? ata_interrupt :NULL , +return ata_host_activate (host, irq, irq ? ata_sff_interrupt :NULL , irq_flags, &pata_platform_sht); }EXPORT_SYMBOL_GPL (__pata_platform_probe);
drivers/ata/pata_qdi.c +7 -7
@@ -102,14 +102,14 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) }/** -* qdi_qc_issue_prot - command issue +* qdi_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap * this interface so that we can load the correct ATA timings. */ -static unsigned int qdi_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int qdi_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -121,7 +121,7 @@ static unsigned int qdi_qc_issue_prot(struct ata_queued_cmd *qc)outb (qdi->clock[adev->devno], qdi->timing); } } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); } static unsigned int qdi_data_xfer(struct ata_device *dev, unsigned char *buf,
@@ -148,7 +148,7 @@ static unsigned int qdi_data_xfer(struct ata_device *dev, unsigned char *buf, buflen +=4 - slop; } }else - buflen =ata_data_xfer (dev, buf, buflen, rw); + buflen =ata_sff_data_xfer (dev, buf, buflen, rw);return buflen; }
@@ -159,7 +159,7 @@ static struct scsi_host_template qdi_sht = {static struct ata_port_operations qdi6500_port_ops = { .inherits = &ata_sff_port_ops, - .qc_issue = qdi_qc_issue_prot, + .qc_issue = qdi_qc_issue, .data_xfer = qdi_data_xfer, .cable_detect = ata_cable_40wire, .set_piomode = qdi6500_set_piomode,
@@ -223,7 +223,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i ap->ioaddr.cmd_addr = io_addr; ap->ioaddr.altstatus_addr = ctl_addr; ap->ioaddr.ctl_addr = ctl_addr; -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr);ata_port_desc (ap,"cmd %lx ctl %lx" , io, ctl);
@@ -239,7 +239,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i printk(KERN_INFO DRV_NAME": qd%d at 0x%lx.\n", type, io);/* activate */ - ret =ata_host_activate (host, irq, ata_interrupt,0 , &qdi_sht); + ret =ata_host_activate (host, irq, ata_sff_interrupt,0 , &qdi_sht);if (ret) goto fail;
drivers/ata/pata_radisys.c +5 -5
@@ -156,7 +156,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev) }/** -* radisys_qc_issue_prot - command issue +* radisys_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -166,7 +166,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev)* be made PIO0. */ -static unsigned int radisys_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int radisys_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -180,7 +180,7 @@ static unsigned int radisys_qc_issue_prot(struct ata_queued_cmd *qc)radisys_set_piomode (ap, adev); } } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }
@@ -190,7 +190,7 @@ static struct scsi_host_template radisys_sht = {static struct ata_port_operations radisys_pata_ops = { .inherits = &ata_bmdma_port_ops, - .qc_issue = radisys_qc_issue_prot, + .qc_issue = radisys_qc_issue, .cable_detect = ata_cable_unknown, .set_piomode = radisys_set_piomode, .set_dmamode = radisys_set_dmamode,
@@ -228,7 +228,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_init_one (pdev, ppi, &radisys_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &radisys_sht,NULL ); }static const struct pci_device_id radisys_pci_tbl[] = {
drivers/ata/pata_rb500_cf.c +3 -3
@@ -57,7 +57,7 @@ static inline void rb500_pata_finish_io(struct ata_port *ap)struct ata_host *ah = ap->host;struct rb500_cf_info *info = ah->private_data; -ata_altstatus (ap); +ata_sff_altstatus (ap);ndelay (RB500_CF_IO_DELAY );set_irq_type (info->irq,IRQ_TYPE_LEVEL_HIGH );
@@ -109,7 +109,7 @@ static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance)if (gpio_get_value (info->gpio_line)) {set_irq_type (info->irq,IRQ_TYPE_LEVEL_LOW );if (!info->frozen) -ata_interrupt (info->irq, dev_instance); +ata_sff_interrupt (info->irq, dev_instance); }else {set_irq_type (info->irq,IRQ_TYPE_LEVEL_HIGH ); }
@@ -148,7 +148,7 @@ static void rb500_pata_setup_ports(struct ata_host *ah) ap->ioaddr.ctl_addr = info->iobase +RB500_CF_REG_CTRL ; ap->ioaddr.altstatus_addr = info->iobase +RB500_CF_REG_CTRL ; -ata_std_ports (&ap->ioaddr); +ata_sff_std_ports (&ap->ioaddr); ap->ioaddr.data_addr = info->iobase +RB500_CF_REG_DATA ; }
drivers/ata/pata_rz1000.c +1 -1
@@ -99,7 +99,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");if (rz1000_fifo_disable (pdev) ==0 ) -return ata_pci_init_one (pdev, ppi, &rz1000_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &rz1000_sht,NULL ); printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n");/* Not safe to use so skip */
drivers/ata/pata_sc1200.c +6 -6
@@ -151,7 +151,7 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev) }/** -* sc1200_qc_issue_prot - command issue +* sc1200_qc_issue - command issue * @qc: command pending * * Called when the libata layer is about to issue a command. We wrap
@@ -160,7 +160,7 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)* one MWDMA/UDMA bit. */ -static unsigned int sc1200_qc_issue_prot (struct ata_queued_cmd *qc) +static unsigned int sc1200_qc_issue (struct ata_queued_cmd *qc) {struct ata_port *ap = qc->ap;struct ata_device *adev = qc->dev;
@@ -175,7 +175,7 @@ static unsigned int sc1200_qc_issue_prot(struct ata_queued_cmd *qc)sc1200_set_dmamode (ap, adev); } -return ata_qc_issue_prot (qc); +return ata_sff_qc_issue (qc); }static struct scsi_host_template sc1200_sht = {
@@ -185,8 +185,8 @@ static struct scsi_host_template sc1200_sht = {static struct ata_port_operations sc1200_port_ops = { .inherits = &ata_bmdma_port_ops, - .qc_prep = ata_dumb_qc_prep, - .qc_issue = sc1200_qc_issue_prot, + .qc_prep = ata_sff_dumb_qc_prep, + .qc_issue = sc1200_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = sc1200_set_piomode, .set_dmamode = sc1200_set_dmamode,
@@ -213,7 +213,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)/* Can't enable port 2 yet, see top comments */ const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; -return ata_pci_init_one (dev, ppi, &sc1200_sht,NULL ); +return ata_pci_sff_init_one (dev, ppi, &sc1200_sht,NULL ); }static const struct pci_device_id sc1200[] = {
drivers/ata/pata_scc.c +40 -40
250 lines not on this page · raw message
drivers/ata/pata_serverworks.c +6 -6
@@ -199,7 +199,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_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }
@@ -219,7 +219,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo/* Disk, UDMA */ if (adev->class !=ATA_DEV_ATA ) -return ata_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask);/* Actually do need to check */ ata_id_c_string (adev->id, model_num,ATA_ID_PROD ,sizeof (model_num));
@@ -228,7 +228,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned loif (!strcmp (p, model_num)) mask &= ~(0xE0 <<ATA_SHIFT_UDMA ); } -return ata_pci_default_filter (adev, mask); +return ata_bmdma_mode_filter (adev, mask); }/**
@@ -459,9 +459,9 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_idserverworks_fixup_ht1000 (pdev);if (pdev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB5IDE ) -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev); -return ata_pci_init_one (pdev, ppi, &serverworks_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &serverworks_sht,NULL ); }#ifdef CONFIG_PM
@@ -482,7 +482,7 @@ static int serverworks_reinit_one(struct pci_dev *pdev)serverworks_fixup_osb4 (pdev);break ;case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE : -ata_pci_clear_simplex (pdev); +ata_pci_bmdma_clear_simplex (pdev);/* fall through */ case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE :case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 :
drivers/ata/pata_sil680.c +5 -5
@@ -346,19 +346,19 @@ static int __devinit sil680_init_one(struct pci_dev *pdev, host->ports[0 ]->ioaddr.cmd_addr = mmio_base +0x80 ; host->ports[0 ]->ioaddr.ctl_addr = mmio_base +0x8a ; host->ports[0 ]->ioaddr.altstatus_addr = mmio_base +0x8a ; -ata_std_ports (&host->ports[0 ]->ioaddr); +ata_sff_std_ports (&host->ports[0 ]->ioaddr); host->ports[1 ]->ioaddr.bmdma_addr = mmio_base +0x08 ; host->ports[1 ]->ioaddr.cmd_addr = mmio_base +0xc0 ; host->ports[1 ]->ioaddr.ctl_addr = mmio_base +0xca ; host->ports[1 ]->ioaddr.altstatus_addr = mmio_base +0xca ; -ata_std_ports (&host->ports[1 ]->ioaddr); +ata_sff_std_ports (&host->ports[1 ]->ioaddr);/* Register & activate */ -return ata_host_activate (host, pdev->irq, ata_interrupt,IRQF_SHARED , - &sil680_sht); +return ata_host_activate (host, pdev->irq, ata_sff_interrupt, +IRQF_SHARED , &sil680_sht); use_ioports: -return ata_pci_init_one (pdev, ppi, &sil680_sht,NULL ); +return ata_pci_sff_init_one (pdev, ppi, &sil680_sht,NULL ); }#ifdef CONFIG_PM
drivers/ata/pata_sis.c +2 -2
@@ -156,7 +156,7 @@ static int sis_pre_reset(struct ata_link *link, unsigned long deadline)/* Clear the FIFO settings. We can't enable the FIFO until we know we are poking at a disk */ pci_write_config_byte (pdev,0x4B ,0 ); -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }
@@ -821,7 +821,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)sis_fixup (pdev, chipset); -return ata_pci_init_one (pdev, ppi, &sis_sht, chipset); +return ata_pci_sff_init_one (pdev, ppi, &sis_sht, chipset); }static const struct pci_device_id sis_pci_tbl[] = {
drivers/ata/pata_sl82c105.c +2 -2
@@ -60,7 +60,7 @@ static int sl82c105_pre_reset(struct ata_link *link, unsigned long deadline)if (ap->port_no && !pci_test_config_bits (pdev, &sl82c105_enable_bits[ap->port_no]))return -ENOENT ; -return ata_std_prereset (link, deadline); +return ata_sff_prereset (link, deadline); }
Lines of this file are not shown. View the raw message.
include/linux/libata.h +53 -50
103 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.2.4
Part of the diff is not shown here. View the raw message.
PATCH 10/27 libata: separate out ata_std_prereset() from ata_sff_prereset()
In reply to Tejun HeoSeparate out generic ATA portion from ata_sff_prereset() into ata_std_prereset() and implement ata_sff_prereset() using the std version. Waiting for device readiness is the only SFF specific part.
ata_base_port_ops now has ata_std_prereset() for its prereset and ata_sff_port_ops overrides it to ata_sff_prereset(). This change can affect pdc_adma, ahci, sata_fsl and sata_sil24. pdc_adma implements its own prereset using ata_sff_prereset() and the rest has hardreset and thus are unaffected by this change.
This change reflects real world situation. There is no generic way to wait for device readiness for non-SFF controllers and some of them don't have any mechanism for that. Non-sff drivers which don't have hardreset should wrap ata_std_prereset() and wait for device readiness itself but there's no such driver now and isn't likely to be popular in the future either.
--- drivers/ata/libata-core.c | 17 ++++------------- drivers/ata/libata-sff.c | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/libata.h | 1 + 3 files changed, 48 insertions(+), 13 deletions(-)
drivers/ata/libata-core.c +4 -13
@@ -74,7 +74,7 @@ const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };const unsigned long sata_deb_timing_long[] = {100 ,2000 ,5000 };const struct ata_port_operations ata_base_port_ops = { - .prereset = ata_sff_prereset, + .prereset = ata_std_prereset, .hardreset = sata_sff_hardreset, .postreset = ata_sff_postreset, .error_handler = ata_std_error_handler,
@@ -3378,7 +3378,7 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, }/** -* ata_sff_prereset - prepare for reset +* ata_std_prereset - prepare for reset * @link: ATA link to be reset * @deadline: deadline jiffies for the operation *
@@ -3394,7 +3394,7 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,* RETURNS: * 0 on success, -errno otherwise. */ -int ata_sff_prereset (struct ata_link *link,unsigned long deadline) +int ata_std_prereset (struct ata_link *link,unsigned long deadline) {struct ata_port *ap = link->ap;struct ata_eh_context *ehc = &link->eh_context;
@@ -3414,16 +3414,6 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline) "link for reset (errno=%d)\n", rc); } -/* wait for !BSY if we don't know that no device is attached */ -if (!ata_link_offline (link)) { - rc =ata_sff_wait_ready (ap, deadline); -if (rc && rc != -ENODEV ) { -ata_link_printk (link,KERN_WARNING ,"device not ready " -"(errno=%d), forcing hardreset\n" , rc); - ehc->i.action |=ATA_EH_HARDRESET ; - } - } -return 0 ; }
@@ -6051,6 +6041,7 @@ EXPORT_SYMBOL_GPL(ata_dev_disable);EXPORT_SYMBOL_GPL (sata_set_spd);EXPORT_SYMBOL_GPL (sata_link_debounce);EXPORT_SYMBOL_GPL (sata_link_resume); +EXPORT_SYMBOL_GPL (ata_std_prereset);EXPORT_SYMBOL_GPL (sata_link_hardreset);EXPORT_SYMBOL_GPL (ata_dev_classify);EXPORT_SYMBOL_GPL (ata_dev_pair);
drivers/ata/libata-sff.c +43 -0
55 lines not on this page · raw message
include/linux/libata.h +1 -0
@@ -822,6 +822,7 @@ static inline int ata_port_is_dummy(struct ata_port *ap)extern void sata_print_link_status (struct ata_link *link);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 sata_link_debounce (struct ata_link *link,const unsigned long *params,unsigned long deadline); extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
Signature · 1 line
1.5.2.4
PATCH 11/27 libata: separate out ata_std_postreset() from ata_sff_postreset()
In reply to Tejun HeoSeparate out generic ATA portion from ata_sff_postreset() into ata_std_postreset() and implement ata_sff_postreset() using the std version.
ata_base_port_ops now has ata_std_postreset() for its postreset and ata_sff_port_ops overrides it to ata_sff_postreset().
This change affects pdc_adma, ahci, sata_fsl and sata_sil24. pdc_adma now specifies postreset to ata_sff_postreset() explicitly. sata_fsl and sata_sil24 now use ata_std_postreset() which makes no difference to them. ahci now calls ata_std_postreset() from its own postreset method, which causes no behavior difference.
--- drivers/ata/ahci.c | 2 +- drivers/ata/libata-core.c | 24 ++++-------------------- drivers/ata/libata-sff.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/libata.h | 1 + 4 files changed, 42 insertions(+), 21 deletions(-)
drivers/ata/ahci.c +1 -1
@@ -1444,7 +1444,7 @@ static void ahci_postreset(struct ata_link *link, unsigned int *class)void __iomem *port_mmio =ahci_port_base (ap);u32 new_tmp, tmp; -ata_sff_postreset (link, class); +ata_std_postreset (link, class);/* Make sure port's ATAPI bit is set appropriately */ new_tmp = tmp =readl (port_mmio +PORT_CMD );
drivers/ata/libata-core.c +4 -20
@@ -76,7 +76,7 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };const struct ata_port_operations ata_base_port_ops = { .prereset = ata_std_prereset, .hardreset = sata_sff_hardreset, - .postreset = ata_sff_postreset, + .postreset = ata_std_postreset, .error_handler = ata_std_error_handler, };
@@ -3478,7 +3478,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, }/** -* ata_sff_postreset - standard postreset callback +* ata_std_postreset - standard postreset callback * @link: the target ata_link * @classes: classes of attached devices *
@@ -3489,9 +3489,8 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,* LOCKING: * Kernel thread context (may sleep) */ -void ata_sff_postreset (struct ata_link *link,unsigned int *classes) +void ata_std_postreset (struct ata_link *link,unsigned int *classes) { -struct ata_port *ap = link->ap;u32 serror;DPRINTK ("ENTER\n" );
@@ -3504,22 +3503,6 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)sata_scr_write (link,SCR_ERROR , serror); link->eh_info.serror =0 ; -/* is double-select really necessary? */ -if (classes[0 ] !=ATA_DEV_NONE ) - ap->ops->sff_dev_select (ap,1 ); -if (classes[1 ] !=ATA_DEV_NONE ) - ap->ops->sff_dev_select (ap,0 ); - -/* bail out if no device is present */ -if (classes[0 ] ==ATA_DEV_NONE && classes[1 ] ==ATA_DEV_NONE ) { -DPRINTK ("EXIT, no device\n" ); -return ; - } - -/* set up device control */ -if (ap->ioaddr.ctl_addr) -iowrite8 (ap->ctl, ap->ioaddr.ctl_addr); -DPRINTK ("EXIT\n" ); }
@@ -6043,6 +6026,7 @@ EXPORT_SYMBOL_GPL(sata_link_debounce);EXPORT_SYMBOL_GPL (sata_link_resume);EXPORT_SYMBOL_GPL (ata_std_prereset);EXPORT_SYMBOL_GPL (sata_link_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);
drivers/ata/libata-sff.c +36 -0
@@ -49,6 +49,7 @@ const struct ata_port_operations ata_sff_port_ops = { .thaw = ata_sff_thaw, .prereset = ata_sff_prereset, .softreset = ata_sff_softreset, + .postreset = ata_sff_postreset, .error_handler = ata_sff_error_handler, .post_internal_cmd = ata_sff_post_internal_cmd,
@@ -2032,6 +2033,41 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class, }/** +* ata_sff_postreset - SFF postreset callback +* @link: the target SFF ata_link +* @classes: classes of attached devices +* +* This function is invoked after a successful reset. It first +* calls ata_std_postreset() and performs SFF specific postreset +* processing. +* +* LOCKING: +* Kernel thread context (may sleep) +*/ +void ata_sff_postreset (struct ata_link *link,unsigned int *classes) +{ +struct ata_port *ap = link->ap; + +ata_std_postreset (link, classes); + +/* is double-select really necessary? */ +if (classes[0 ] !=ATA_DEV_NONE ) + ap->ops->sff_dev_select (ap,1 ); +if (classes[1 ] !=ATA_DEV_NONE ) + ap->ops->sff_dev_select (ap,0 ); + +/* bail out if no device is present */ +if (classes[0 ] ==ATA_DEV_NONE && classes[1 ] ==ATA_DEV_NONE ) { +DPRINTK ("EXIT, no device\n" ); +return ; + } + +/* set up device control */ +if (ap->ioaddr.ctl_addr) +iowrite8 (ap->ctl, ap->ioaddr.ctl_addr); +} + +/** * ata_sff_error_handler - Stock error handler for BMDMA controller * @ap: port to handle error for *
include/linux/libata.h +1 -0
@@ -829,6 +829,7 @@ extern int sata_link_resume(struct ata_link *link, const unsigned long *params, unsigned long deadline);extern int sata_link_hardreset (struct ata_link *link,const unsigned long *timing,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);
Signature · 1 line
1.5.2.4
PATCH 12/27 libata: restructure SFF post-reset readiness waits
In reply to Tejun HeoPreviously, post-softreset readiness is waited as follows.
1. ata_sff_wait_after_reset() waits for 150ms and then for ATA_TMOUT_FF_WAIT if status is 0xff and other conditions meet.
2. ata_bus_softreset() finishes with -ENODEV if status is still 0xff. If not, continue to #3.
3. ata_bus_post_reset() waits readiness of dev0 and/or dev1 depending on devmask using ata_sff_wait_ready().
And for post-hardreset readiness,
1. ata_sff_wait_after_reset() waits for 150ms and then for ATA_TMOUT_FF_WAIT if status is 0xff and other conditions meet.
2. sata_sff_hardreset waits for device readiness using ata_sff_wait_ready().
This patch merges and unifies post-reset readiness waits into ata_sff_wait_ready() and ata_sff_wait_after_reset().
ATA_TMOUT_FF_WAIT handling is merged into ata_sff_wait_ready(). If TF status is 0xff, link status is unknown and the port is SATA, it will continue polling till ATA_TMOUT_FF_WAIT.
ata_sff_wait_after_reset() is updated to perform the following steps.
1. waits for 150ms.
2. waits for dev0 readiness using ata_sff_wait_ready(). Note that this is done regardless of devmask, as ata_sff_wait_ready() handles 0xff status correctly, this preserves the original behavior except that it may wait longer after softreset if link is online but status is 0xff. This behavior change is very unlikely to cause any actual difference and is intended. It brings softreset behavior to that of hardreset.
3. waits for dev1 readiness just the same way ata_bus_post_reset() did.
Now both soft and hard resets call ata_sff_wait_after_reset() after reset to wait for readiness after resets. As ata_sff_wait_after_reset() contains calls to ->sff_dev_select(), explicit call near the end of sata_sff_hardreset() is removed.
This change makes reset implementation simpler and more consistent.
While at it, make the magical 150ms wait post-reset wait duration a constant and ata_sff_wait_ready() and ata_sff_wait_after_reset() take @link instead of @ap. This is to make them consistent with other reset helpers and ease core changes.
pata_scc is updated accordingly.
--- drivers/ata/ahci.c | 11 +-- drivers/ata/libata-sff.c | 161 ++++++++++++++++++------------------------- drivers/ata/pata_scc.c | 91 ++++++++++++++----------- drivers/ata/sata_inic162x.c | 6 +- drivers/ata/sata_via.c | 2 +- include/linux/libata.h | 18 ++++- 6 files changed, 139 insertions(+), 150 deletions(-)
drivers/ata/ahci.c +3 -8
@@ -1302,10 +1302,8 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, tf.ctl &= ~ATA_SRST ;ahci_exec_polled_cmd (ap, pmp, &tf,0 ,0 ,0 ); -/* wait a while before checking status */ -ata_sff_wait_after_reset (ap, deadline); - - rc =ata_sff_wait_ready (ap, deadline); +/* wait for link to become ready */ + rc =ata_sff_wait_after_reset (link,1 , deadline);/* link occupied, -ENODEV too is an error */ if (rc) { reason ="device not ready" ;
@@ -1415,9 +1413,6 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,if (rc ||ata_link_offline (link))return rc; -/* spec mandates ">= 2ms" before checking status */ -msleep (150 ); -/* The pseudo configuration device on SIMG4726 attached to * ASUS P5W-DH Deluxe doesn't send signature FIS after * hardreset if no device is attached to the first downstream
@@ -1431,7 +1426,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,* have to be reset again. For most cases, this should * suffice while making probing snappish enough. */ - rc =ata_sff_wait_ready (ap, jiffies +2 *HZ ); + rc =ata_sff_wait_after_reset (link,1 , jiffies +2 *HZ );if (rc)ahci_kick_engine (ap,0 );
drivers/ata/libata-sff.c +67 -94
252 lines not on this page · raw message
drivers/ata/pata_scc.c +51 -40
122 lines not on this page · raw message
drivers/ata/sata_inic162x.c +2 -4
@@ -417,10 +417,8 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,if (ata_link_online (link)) {struct ata_taskfile tf; -/* wait a while before checking status */ -ata_sff_wait_after_reset (ap, deadline); - - rc =ata_sff_wait_ready (ap, deadline); +/* wait for link to become ready */ + rc =ata_sff_wait_after_reset (link,1 , deadline);/* link occupied, -ENODEV too is an error */ if (rc) { ata_link_printk(link, KERN_WARNING, "device not ready "
drivers/ata/sata_via.c +1 -1
@@ -242,7 +242,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) skip_scr:/* wait for !BSY */ -ata_sff_wait_ready (ap, deadline); +ata_sff_wait_ready (link, deadline);return 0 ; }
include/linux/libata.h +15 -3
@@ -248,6 +248,18 @@ enum {*/ ATA_TMOUT_FF_WAIT =4 *HZ /5 , +/* Spec mandates to wait for ">= 2ms" before checking status +* after reset. We wait 150ms, because that was the magic +* delay used for ATAPI devices in Hale Landis's ATADRVR, for +* the period of time between when the ATA command register is +* written, and then status is checked. Because waiting for +* "a while" before checking status is fine, post SRST, we +* perform this magic delay here as well. +* +* Old drivers/ide uses the 2mS rule and then waits for ready. +*/ +ATA_WAIT_AFTER_RESET_MSECS =150 , +/* ATA bus states */ BUS_UNKNOWN =0 , BUS_DMA = 1,
@@ -1369,7 +1381,7 @@ extern u8 ata_sff_check_status(struct ata_port *ap);extern u8 ata_sff_altstatus (struct ata_port *ap);extern int ata_sff_busy_sleep (struct ata_port *ap,unsigned long timeout_pat,unsigned long timeout); -extern int ata_sff_wait_ready (struct ata_port *ap,unsigned long deadline); +extern int ata_sff_wait_ready (struct ata_link *link,unsigned long deadline);extern void ata_sff_tf_load (struct ata_port *ap,const struct ata_taskfile *tf);extern void ata_sff_tf_read (struct ata_port *ap,struct ata_taskfile *tf); extern void ata_sff_exec_command(struct ata_port *ap,
@@ -1391,8 +1403,8 @@ extern void ata_sff_thaw(struct ata_port *ap);extern int ata_sff_prereset (struct ata_link *link,unsigned long deadline);extern unsigned int ata_sff_dev_classify (struct ata_device *dev,int present,u8 *r_err); -extern void ata_sff_wait_after_reset (struct ata_port *ap, -unsigned long deadline); +extern int ata_sff_wait_after_reset (struct ata_link *link,unsigned int devmask, +unsigned long deadline);extern int ata_sff_softreset (struct ata_link *link,unsigned int *classes,unsigned long deadline); extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
Signature · 1 line
1.5.2.4
PATCH 9/27 libata: clean up port_ops->sff_irq_clear()
In reply to Tejun Heo->sff_irq_clear() is called only from SFF interrupt handler, so there is no reason to initialize it for non-SFF controllers. Also, ata_sff_irq_clear() can handle both BMDMA and non-BMDMA SFF controllers.
This patch kills ata_noop_irq_clear() and removes it from base port_ops and sets ->sff_irq_clear to ata_sff_irq_clear() in sff port_ops instead of bmdma port_ops.
--- drivers/ata/libata-core.c | 10 ---------- drivers/ata/libata-sff.c | 2 +- include/linux/libata.h | 1 - 3 files changed, 1 insertions(+), 12 deletions(-)
drivers/ata/libata-core.c +0 -10
@@ -74,7 +74,6 @@ const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };const unsigned long sata_deb_timing_long[] = {100 ,2000 ,5000 };const struct ata_port_operations ata_base_port_ops = { - .sff_irq_clear = ata_noop_irq_clear, .prereset = ata_sff_prereset, .hardreset = sata_sff_hardreset, .postreset = ata_sff_postreset,
@@ -349,14 +348,6 @@ static void ata_force_horkage(struct ata_device *dev) }/** -* ata_noop_irq_clear - Noop placeholder for irq_clear -* @ap: Port associated with this ATA transaction. -*/ -void ata_noop_irq_clear (struct ata_port *ap) -{ -} - -/** * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure * @tf: Taskfile to convert * @pmp: Port multiplier port
@@ -6055,7 +6046,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_noop_irq_clear);EXPORT_SYMBOL_GPL (ata_port_probe);EXPORT_SYMBOL_GPL (ata_dev_disable);EXPORT_SYMBOL_GPL (sata_set_spd);
drivers/ata/libata-sff.c +1 -1
@@ -58,6 +58,7 @@ 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, .port_start = ata_sff_port_start, };
@@ -71,7 +72,6 @@ const struct ata_port_operations ata_bmdma_port_ops = { .bmdma_start = ata_bmdma_start, .bmdma_stop = ata_bmdma_stop, .bmdma_status = ata_bmdma_status, - .sff_irq_clear = ata_sff_irq_clear, };/**
include/linux/libata.h +0 -1
@@ -893,7 +893,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s, unsigned int ofs, unsigned int len);extern void ata_id_c_string (const u16 *id,unsigned char *s,unsigned int ofs,unsigned int len); -extern void ata_noop_irq_clear (struct ata_port *ap);extern void ata_qc_complete (struct ata_queued_cmd *qc);extern int ata_qc_complete_multiple (struct ata_port *ap,u32 qc_active,void (*finish_qc)(struct ata_queued_cmd *));
Signature · 1 line
1.5.2.4
PATCH 3/27 libata: reorganize SFF related stuff
In reply to Tejun Heo* Move SFF related functions from libata-core.c to libata-sff.c.
ata_[bmdma_]sff_port_ops, ata_devchk(), ata_dev_try_classify(), ata_std_dev_select(), ata_tf_to_host(), ata_busy_sleep(), ata_wait_after_reset(), ata_wait_ready(), ata_bus_post_reset(), ata_bus_softreset(), ata_bus_reset(), ata_std_softreset(), sata_std_hardreset(), ata_fill_sg(), ata_fill_sg_dumb(), ata_qc_prep(), ata_dump_qc_prep(), ata_data_xfer(), ata_data_xfer_noirq(), ata_pio_sector(), ata_pio_sectors(), atapi_send_cdb(), __atapi_pio_bytes(), atapi_pio_bytes(), ata_hsm_ok_in_wq(), ata_hsm_qc_complete(), ata_hsm_move(), ata_pio_task(), ata_qc_issue_prot(), ata_host_intr(), ata_interrupt(), ata_std_ports()
* Make ata_pio_queue_task() global as it's now called from libata-sff.c.
* Move SFF related stuff in include/linux/libata.h and drivers/ata/libata.h into one place. While at it, move timing constants into the global enum definition and fortify comments a bit.
This patch strictly moves stuff around and as such doesn't cause any functional difference.
--- drivers/ata/libata-core.c | 1884 +-------------------------------------------- drivers/ata/libata-sff.c | 1859 ++++++++++++++++++++++++++++++++++++++++++++- drivers/ata/libata.h | 8 +- include/linux/libata.h | 379 +++++----- 4 files changed, 2060 insertions(+), 2070 deletions(-)
drivers/ata/libata-core.c +9 -1875
@@ -46,7 +46,6 @@#include <linux/init.h> #include <linux/list.h> #include <linux/mm.h> -#include <linux/highmem.h> #include <linux/spinlock.h> #include <linux/blkdev.h> #include <linux/delay.h>
@@ -98,41 +97,6 @@ const struct ata_port_operations sata_pmp_port_ops = { .error_handler = sata_pmp_error_handler, }; -const struct ata_port_operations ata_sff_port_ops = { - .inherits = &ata_base_port_ops, - - .qc_prep = ata_qc_prep, - .qc_issue = ata_qc_issue_prot, - - .freeze = ata_bmdma_freeze, - .thaw = ata_bmdma_thaw, - .softreset = ata_std_softreset, - .error_handler = ata_bmdma_error_handler, - .post_internal_cmd = ata_bmdma_post_internal_cmd, - - .dev_select = ata_std_dev_select, - .check_status = ata_check_status, - .tf_load = ata_tf_load, - .tf_read = ata_tf_read, - .exec_command = ata_exec_command, - .data_xfer = ata_data_xfer, - .irq_on = ata_irq_on, - - .port_start = ata_sff_port_start, -}; - -const struct ata_port_operations ata_bmdma_port_ops = { - .inherits = &ata_sff_port_ops, - - .mode_filter = ata_pci_default_filter, - - .bmdma_setup = ata_bmdma_setup, - .bmdma_start = ata_bmdma_start, - .bmdma_stop = ata_bmdma_stop, - .bmdma_status = ata_bmdma_status, - .irq_clear = ata_bmdma_irq_clear, -}; -static unsigned int ata_dev_init_params (struct ata_device *dev,u16 heads,u16 sectors);static unsigned int ata_dev_set_xfermode (struct ata_device *dev);
@@ -385,6 +349,14 @@ static void ata_force_horkage(struct ata_device *dev) }/** +* ata_noop_irq_clear - Noop placeholder for irq_clear +* @ap: Port associated with this ATA transaction. +*/ +void ata_noop_irq_clear (struct ata_port *ap) +{ +} + +/** * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure * @tf: Taskfile to convert * @pmp: Port multiplier port
@@ -1064,50 +1036,6 @@ static void ata_lpm_disable(struct ata_host *host) }#endif /* CONFIG_PM */ - -/** -* ata_devchk - PATA device presence detection -* @ap: ATA channel to examine -* @device: Device to examine (starting at zero) -* -* This technique was originally described in -* Hale Landis's ATADRVR (www.ata-atapi.com), and -* later found its way into the ATA/ATAPI spec. -* -* Write a pattern to the ATA shadow registers, -* and if a device is present, it will respond by -* correctly storing and echoing back the -* ATA shadow register contents. -* -* LOCKING: -* caller. -*/ - -static unsigned int ata_devchk (struct ata_port *ap,unsigned int device) -{ -struct ata_ioports *ioaddr = &ap->ioaddr; -u8 nsect, lbal; - - ap->ops->dev_select (ap, device); - -iowrite8 (0x55 , ioaddr->nsect_addr); -iowrite8 (0xaa , ioaddr->lbal_addr); - -iowrite8 (0xaa , ioaddr->nsect_addr); -iowrite8 (0x55 , ioaddr->lbal_addr); - -iowrite8 (0x55 , ioaddr->nsect_addr); -iowrite8 (0xaa , ioaddr->lbal_addr); - - nsect =ioread8 (ioaddr->nsect_addr); - lbal =ioread8 (ioaddr->lbal_addr); - -if ((nsect ==0x55 ) && (lbal ==0xaa )) -return 1 ;/* we found a device */ - -return 0 ;/* nothing found */ -} -/** * ata_dev_classify - determine device type based on ATA-spec signature * @tf: ATA taskfile register set for device to be identified
@@ -1168,75 +1096,6 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf) }/** -* ata_dev_try_classify - Parse returned ATA device signature -* @dev: ATA device to classify (starting at zero) -* @present: device seems present -* @r_err: Value of error register on completion -* -* After an event -- SRST, E.D.D., or SATA COMRESET -- occurs, -* an ATA/ATAPI-defined set of values is placed in the ATA -* shadow registers, indicating the results of device detection -* and diagnostics. -* -* Select the ATA device, and read the values from the ATA shadow -* registers. Then parse according to the Error register value, -* and the spec-defined values examined by ata_dev_classify(). -* -* LOCKING: -* caller. -* -* RETURNS: -* Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE. -*/ -unsigned int ata_dev_try_classify (struct ata_device *dev,int present, -u8 *r_err) -{ -struct ata_port *ap = dev->link->ap; -struct ata_taskfile tf; -unsigned int class; -u8 err; - - ap->ops->dev_select (ap, dev->devno); - -memset (&tf,0 ,sizeof (tf)); - - ap->ops->tf_read (ap, &tf); - err = tf.feature; -if (r_err) - *r_err = err; - -/* see if device passed diags: continue and warn later */ -if (err ==0 ) -/* diagnostic fail : do nothing _YET_ */ - dev->horkage |=ATA_HORKAGE_DIAGNOSTIC ; -else if (err ==1 ) -/* do nothing */ ; -else if ((dev->devno ==0 ) && (err ==0x81 )) -/* do nothing */ ; -else -return ATA_DEV_NONE ; - -/* determine if device is ATA or ATAPI */ - class =ata_dev_classify (&tf); - -if (class ==ATA_DEV_UNKNOWN ) { -/* If the device failed diagnostic, it's likely to -* have reported incorrect device signature too. -* Assume ATA device if the device seems present but -* device signature is invalid with diagnostic -* failure. -*/ -if (present && (dev->horkage &ATA_HORKAGE_DIAGNOSTIC )) - class =ATA_DEV_ATA ; -else - class =ATA_DEV_NONE ; - }else if ((class ==ATA_DEV_ATA ) && (ata_chk_status (ap) ==0 )) - class =ATA_DEV_NONE ; - -return class; -} - -/** * ata_id_string - Convert IDENTIFY DEVICE page into string * @id: IDENTIFY DEVICE results we will examine * @s: string into which data is output
@@ -1559,73 +1418,6 @@ void ata_noop_dev_select(struct ata_port *ap, unsigned int device) { } - -/** -* ata_std_dev_select - Select device 0/1 on ATA bus -* @ap: ATA channel to manipulate -* @device: ATA device (numbered from zero) to select -* -* Use the method defined in the ATA specification to -* make either device 0, or device 1, active on the -* ATA channel. Works with both PIO and MMIO. -* -* May be used as the dev_select() entry in ata_port_operations. -* -* LOCKING: -* caller. -*/ - -void ata_std_dev_select (struct ata_port *ap,unsigned int device) -{ -u8 tmp; - -if (device ==0 ) - tmp =ATA_DEVICE_OBS ; -else - tmp =ATA_DEVICE_OBS |ATA_DEV1 ; - -iowrite8 (tmp, ap->ioaddr.device_addr); -ata_pause (ap);/* needed; also flushes, for mmio */ -} - -/** -* ata_dev_select - Select device 0/1 on ATA bus -* @ap: ATA channel to manipulate -* @device: ATA device (numbered from zero) to select -* @wait: non-zero to wait for Status register BSY bit to clear -* @can_sleep: non-zero if context allows sleeping -* -* Use the method defined in the ATA specification to -* make either device 0, or device 1, active on the -* ATA channel. -* -* This is a high-level version of ata_std_dev_select(), -* which additionally provides the services of inserting -* the proper pauses and status polling, where needed. -* -* LOCKING: -* caller. -*/ - -void ata_dev_select (struct ata_port *ap,unsigned int device, -unsigned int wait,unsigned int can_sleep) -{ -if (ata_msg_probe (ap)) -ata_port_printk (ap,KERN_INFO ,"ata_dev_select: ENTER, " -"device %u, wait %u\n" , device, wait); - -if (wait) -ata_wait_idle (ap); - - ap->ops->dev_select (ap, device); - -if (wait) { -if (can_sleep && ap->link.device[device].class ==ATA_DEV_ATAPI ) -msleep (150 ); -ata_wait_idle (ap); - } -} -/** * ata_dump_id - IDENTIFY DEVICE info debugging output * @id: IDENTIFY DEVICE page to dump
@@ -1753,8 +1545,7 @@ unsigned long ata_id_xfermask(const u16 *id)* LOCKING: * Inherited from caller. */ -static void ata_pio_queue_task (struct ata_port *ap,void *data, -unsigned long delay) +void ata_pio_queue_task (struct ata_port *ap,void *data,unsigned long delay) { ap->port_task_data = data;
@@ -3494,353 +3285,6 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) }/** -* ata_tf_to_host - issue ATA taskfile to host controller -* @ap: port to which command is being issued -* @tf: ATA taskfile register set -* -* Issues ATA taskfile register set to ATA host controller, -* with proper synchronization with interrupt handler and -* other threads. -* -* LOCKING: -* spin_lock_irqsave(host lock) -*/ - -static inline void ata_tf_to_host (struct ata_port *ap, -const struct ata_taskfile *tf) -{ - ap->ops->tf_load (ap, tf); - ap->ops->exec_command (ap, tf); -} - -/** -* ata_busy_sleep - sleep until BSY clears, or timeout -* @ap: port containing status register to be polled -* @tmout_pat: impatience timeout -* @tmout: overall timeout -* -* Sleep until ATA Status register bit BSY clears, -* or a timeout occurs. -* -* LOCKING: -* Kernel thread context (may sleep). -* -* RETURNS: -* 0 on success, -errno otherwise. -*/ -int ata_busy_sleep (struct ata_port *ap, -unsigned long tmout_pat,unsigned long tmout) -{ -unsigned long timer_start, timeout; -u8 status; - - status =ata_busy_wait (ap,ATA_BUSY ,300 ); - timer_start = jiffies; - timeout = timer_start + tmout_pat; -while (status !=0xff && (status &ATA_BUSY ) && -time_before (jiffies, timeout)) { -msleep (50 ); - status =ata_busy_wait (ap,ATA_BUSY ,3 ); - } - -if (status !=0xff && (status &ATA_BUSY )) -ata_port_printk (ap,KERN_WARNING , -"port is slow to respond, please be patient " -"(Status 0x%x)\n" , status); - - timeout = timer_start + tmout; -while (status !=0xff && (status &ATA_BUSY ) && -time_before (jiffies, timeout)) { -msleep (50 ); - status =ata_chk_status (ap); - } - -if (status ==0xff ) -return -ENODEV ; - -if (status &ATA_BUSY ) { -ata_port_printk (ap,KERN_ERR ,"port failed to respond " -"(%lu secs, Status 0x%x)\n" , - tmout /HZ , status); -return -EBUSY ; - } - -return 0 ; -} - -/** -* ata_wait_after_reset - wait before checking status after reset -* @ap: port containing status register to be polled -* @deadline: deadline jiffies for the operation -* -* After reset, we need to pause a while before reading status. -* Also, certain combination of controller and device report 0xff -* for some duration (e.g. until SATA PHY is up and running) -* which is interpreted as empty port in ATA world. This -* function also waits for such devices to get out of 0xff -* status. -* -* LOCKING: -* Kernel thread context (may sleep). -*/ -void ata_wait_after_reset (struct ata_port *ap,unsigned long deadline) -{ -unsigned long until = jiffies +ATA_TMOUT_FF_WAIT ; - -if (time_before (until, deadline)) - deadline = until; - -/* Spec mandates ">= 2ms" before checking status. We wait -* 150ms, because that was the magic delay used for ATAPI -* devices in Hale Landis's ATADRVR, for the period of time -* between when the ATA command register is written, and then -* status is checked. Because waiting for "a while" before -* checking status is fine, post SRST, we perform this magic -* delay here as well. -* -* Old drivers/ide uses the 2mS rule and then waits for ready. -*/ -msleep (150 ); - -/* Wait for 0xff to clear. Some SATA devices take a long time -* to clear 0xff after reset. For example, HHD424020F7SV00 -* iVDR needs >= 800ms while. Quantum GoVault needs even more -* than that. -* -* Note that some PATA controllers (pata_ali) explode if -* status register is read more than once when there's no -* device attached. -*/ -if (ap->flags &ATA_FLAG_SATA ) { -while (1 ) { -u8 status =ata_chk_status (ap); - -if (status !=0xff ||time_after (jiffies, deadline)) -return ; - -msleep (50 ); - } - } -} - -/** -* ata_wait_ready - sleep until BSY clears, or timeout -* @ap: port containing status register to be polled -* @deadline: deadline jiffies for the operation -* -* Sleep until ATA Status register bit BSY clears, or timeout -* occurs. -* -* LOCKING: -* Kernel thread context (may sleep). -* -* RETURNS: -* 0 on success, -errno otherwise. -*/ -int ata_wait_ready (struct ata_port *ap,unsigned long deadline) -{ -unsigned long start = jiffies; -int warned =0 ; - -while (1 ) { -u8 status =ata_chk_status (ap); -unsigned long now = jiffies; - -if (!(status &ATA_BUSY )) -return 0 ; -if (!ata_link_online (&ap->link) && status ==0xff ) -return -ENODEV ; -if (time_after (now, deadline)) -return -EBUSY ; - -if (!warned &&time_after (now, start +5 *HZ ) && - (deadline - now >3 *HZ )) { -ata_port_printk (ap,KERN_WARNING , -"port is slow to respond, please be patient " -"(Status 0x%x)\n" , status); - warned =1 ; - } - -msleep (50 ); - } -} - -static int ata_bus_post_reset (struct ata_port *ap,unsigned int devmask, -unsigned long deadline) -{ -struct ata_ioports *ioaddr = &ap->ioaddr; -unsigned int dev0 = devmask & (1 <<0 ); -unsigned int dev1 = devmask & (1 <<1 ); -int rc, ret =0 ; - -/* if device 0 was found in ata_devchk, wait for its -* BSY bit to clear -*/ -if (dev0) { - rc =ata_wait_ready (ap, deadline); -if (rc) { -if (rc != -ENODEV ) -return rc; - ret = rc; - } - } - -/* if device 1 was found in ata_devchk, wait for register -* access briefly, then wait for BSY to clear. -*/ -if (dev1) { -int i; - - ap->ops->dev_select (ap,1 ); - -/* Wait for register access. Some ATAPI devices fail -* to set nsect/lbal after reset, so don't waste too -* much time on it. We're gonna wait for !BSY anyway. -*/ -for (i =0 ; i <2 ; i++) { -u8 nsect, lbal; - - nsect =ioread8 (ioaddr->nsect_addr); - lbal =ioread8 (ioaddr->lbal_addr); -if ((nsect ==1 ) && (lbal ==1 )) -break ; -msleep (50 );/* give drive a breather */ - } - - rc =ata_wait_ready (ap, deadline); -if (rc) { -if (rc != -ENODEV ) -return rc; - ret = rc; - } - } - -/* is all this really necessary? */ - ap->ops->dev_select (ap,0 ); -if (dev1) - ap->ops->dev_select (ap,1 ); -if (dev0) - ap->ops->dev_select (ap,0 ); - -return ret; -} - -static int ata_bus_softreset (struct ata_port *ap,unsigned int devmask, -unsigned long deadline) -{ -struct ata_ioports *ioaddr = &ap->ioaddr; - -DPRINTK ("ata%u: bus reset via SRST\n" , ap->print_id); - -/* software reset. causes dev0 to be selected */ -iowrite8 (ap->ctl, ioaddr->ctl_addr); -udelay (20 );/* FIXME: flush */ -iowrite8 (ap->ctl |ATA_SRST , ioaddr->ctl_addr); -udelay (20 );/* FIXME: flush */ -iowrite8 (ap->ctl, ioaddr->ctl_addr); - -/* wait a while before checking status */ -ata_wait_after_reset (ap, deadline); - -/* Before we perform post reset processing we want to see if -* the bus shows 0xFF because the odd clown forgets the D7 -* pulldown resistor. -*/ -if (ata_chk_status (ap) ==0xFF ) -return -ENODEV ; - -return ata_bus_post_reset (ap, devmask, deadline); -} - -/** -* ata_bus_reset - reset host port and associated ATA channel -* @ap: port to reset -* -* This is typically the first time we actually start issuing -* commands to the ATA channel. We wait for BSY to clear, then -* issue EXECUTE DEVICE DIAGNOSTIC command, polling for its -* result. Determine what devices, if any, are on the channel -* by looking at the device 0/1 error register. Look at the signature -* stored in each device's taskfile registers, to determine if -* the device is ATA or ATAPI. -* -* LOCKING: -* PCI/etc. bus probe sem. -* Obtains host lock. -* -* SIDE EFFECTS: -* Sets ATA_FLAG_DISABLED if bus reset fails. -*/ - -void ata_bus_reset (struct ata_port *ap) -{ -struct ata_device *device = ap->link.device; -struct ata_ioports *ioaddr = &ap->ioaddr; -unsigned int slave_possible = ap->flags &ATA_FLAG_SLAVE_POSS ; -u8 err; -unsigned int dev0, dev1 =0 , devmask =0 ; -int rc; - -DPRINTK ("ENTER, host %u, port %u\n" , ap->print_id, ap->port_no); - -/* determine if device 0/1 are present */ -if (ap->flags &ATA_FLAG_SATA_RESET ) - dev0 =1 ; -else { - dev0 =ata_devchk (ap,0 ); -if (slave_possible) - dev1 =ata_devchk (ap,1 ); - } - -if (dev0) - devmask |= (1 <<0 ); -if (dev1) - devmask |= (1 <<1 ); - -/* select device 0 again */ - ap->ops->dev_select (ap,0 ); - -/* issue bus reset */ -if (ap->flags &ATA_FLAG_SRST ) { - rc =ata_bus_softreset (ap, devmask, jiffies +40 *HZ ); -if (rc && rc != -ENODEV ) - goto err_out; - } - -/* -* determine by signature whether we have ATA or ATAPI devices -*/ - device[0 ].class =ata_dev_try_classify (&device[0 ], dev0, &err); -if ((slave_possible) && (err !=0x81 )) - device[1 ].class =ata_dev_try_classify (&device[1 ], dev1, &err); - -/* is double-select really necessary? */ -if (device[1 ].class !=ATA_DEV_NONE ) - ap->ops->dev_select (ap,1 ); -if (device[0 ].class !=ATA_DEV_NONE ) - ap->ops->dev_select (ap,0 ); - -/* if no devices were detected, disable this port */ -if ((device[0 ].class ==ATA_DEV_NONE ) && - (device[1 ].class ==ATA_DEV_NONE )) - goto err_out; - -if (ap->flags & (ATA_FLAG_SATA_RESET |ATA_FLAG_SRST )) { -/* set up device control for ATA_FLAG_SATA_RESET */ -iowrite8 (ap->ctl, ioaddr->ctl_addr); - } - -DPRINTK ("EXIT\n" ); -return ; - -err_out: -ata_port_printk (ap,KERN_ERR ,"disabling port\n" ); -ata_port_disable (ap); - -DPRINTK ("EXIT\n" ); -} - -/** * sata_link_debounce - debounce SATA phy status * @link: ATA link to debounce SATA phy status for * @params: timing parameters { interval, duratinon, timeout } in msec
@@ -3996,66 +3440,6 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline) }/** -* ata_std_softreset - reset host port via ATA SRST -* @link: ATA link to reset -* @classes: resulting classes of attached devices -* @deadline: deadline jiffies for the operation -* -* Reset host port using ATA SRST. -* -* LOCKING: -* Kernel thread context (may sleep) -* -* RETURNS: -* 0 on success, -errno otherwise. -*/ -int ata_std_softreset (struct ata_link *link,unsigned int *classes, -unsigned long deadline) -{ -struct ata_port *ap = link->ap; -unsigned int slave_possible = ap->flags &ATA_FLAG_SLAVE_POSS ; -unsigned int devmask =0 ; -int rc; -u8 err; - -DPRINTK ("ENTER\n" ); - -if (ata_link_offline (link)) { - classes[0 ] =ATA_DEV_NONE ; - goto out; - } - -/* determine if device 0/1 are present */ -if (ata_devchk (ap,0 )) - devmask |= (1 <<0 ); -if (slave_possible &&ata_devchk (ap,1 )) - devmask |= (1 <<1 ); - -/* select device 0 again */ - ap->ops->dev_select (ap,0 ); - -/* issue bus reset */ -DPRINTK ("about to softreset, devmask=%x\n" , devmask); - rc =ata_bus_softreset (ap, devmask, deadline); -/* if link is occupied, -ENODEV too is an error */ -if (rc && (rc != -ENODEV ||sata_scr_valid (link))) { -ata_link_printk (link,KERN_ERR ,"SRST failed (errno=%d)\n" , rc); -return rc; - } - -/* determine by signature whether we have ATA or ATAPI devices */ - classes[0 ] =ata_dev_try_classify (&link->device[0 ], - devmask & (1 <<0 ), &err); -if (slave_possible && err !=0x81 ) - classes[1 ] =ata_dev_try_classify (&link->device[1 ], - devmask & (1 <<1 ), &err); - - out: -DPRINTK ("EXIT, classes[0]=%u [1]=%u\n" , classes[0 ], classes[1 ]); -return 0 ; -} - -/** * sata_link_hardreset - reset link via SATA phy reset * @link: link to reset * @timing: timing parameters { interval, duratinon, timeout } in msec
@@ -4116,74 +3500,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, }/** -* sata_std_hardreset - reset host port via SATA phy reset -* @link: link to reset -* @class: resulting class of attached device -* @deadline: deadline jiffies for the operation -* -* SATA phy-reset host port using DET bits of SControl register, -* wait for !BSY and classify the attached device. -* -* LOCKING: -* Kernel thread context (may sleep) -* -* RETURNS: -* 0 on success, -errno otherwise. -*/ -int sata_std_hardreset (struct ata_link *link,unsigned int *class, -unsigned long deadline) -{ -struct ata_port *ap = link->ap; -const unsigned long *timing =sata_ehc_deb_timing (&link->eh_context); -int rc; - -DPRINTK ("ENTER\n" ); - -/* do hardreset */ - rc =sata_link_hardreset (link, timing, deadline); -if (rc) { -ata_link_printk (link,KERN_ERR , -"COMRESET failed (errno=%d)\n" , rc); -return rc; - } - -/* TODO: phy layer with polling, timeouts, etc. */ -if (ata_link_offline (link)) { - *class =ATA_DEV_NONE ; -DPRINTK ("EXIT, link offline\n" ); -return 0 ; - } - -/* wait a while before checking status */ -ata_wait_after_reset (ap, deadline); - -/* If PMP is supported, we have to do follow-up SRST. Note -* that some PMPs don't send D2H Reg FIS after hardreset at -* all if the first port is empty. Wait for it just for a -* second and request follow-up SRST. -*/ -if (ap->flags &ATA_FLAG_PMP ) { -ata_wait_ready (ap, jiffies +HZ ); -return -EAGAIN ; - } - - rc =ata_wait_ready (ap, deadline); -/* link occupied, -ENODEV too is an error */ -if (rc) { -ata_link_printk (link,KERN_ERR , -"COMRESET failed (errno=%d)\n" , rc); -return rc; - } - - ap->ops->dev_select (ap,0 );/* probably unnecessary */ - - *class =ata_dev_try_classify (link->device,1 ,NULL ); - -DPRINTK ("EXIT, class=%u\n" , *class); -return 0 ; -} - -/** * ata_std_postreset - standard postreset callback * @link: the target ata_link * @classes: classes of attached devices
@@ -4766,112 +4082,6 @@ void ata_sg_clean(struct ata_queued_cmd *qc) }/** -* 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_check_atapi_dma - Check whether ATAPI DMA can be supported * @qc: Metadata associated with taskfile to check *
@@ -4931,40 +4141,6 @@ int ata_std_qc_defer(struct ata_queued_cmd *qc)return ATA_DEFER_LINK ; } -/** -* ata_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_qc_prep (struct ata_queued_cmd *qc) -{ -if (!(qc->flags &ATA_QCFLAG_DMAMAP )) -return ; - -ata_fill_sg (qc); -} - -/** -* ata_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_dumb_qc_prep (struct ata_queued_cmd *qc) -{ -if (!(qc->flags &ATA_QCFLAG_DMAMAP )) -return ; - -ata_fill_sg_dumb (qc); -} -void ata_noop_qc_prep (struct ata_queued_cmd *qc) { }/**
@@ -5043,698 +4219,6 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) }/** -* ata_data_xfer - Transfer data by PIO -* @dev: device to target -* @buf: data buffer -* @buflen: buffer length -* @rw: read/write -* -* Transfer data from/to the device data register by PIO. -* -* LOCKING: -* Inherited from caller. -* -* RETURNS: -* Bytes consumed. -*/ -unsigned int ata_data_xfer (struct ata_device *dev,unsigned char *buf, -unsigned int buflen,int rw) -{ -struct ata_port *ap = dev->link->ap; -void __iomem *data_addr = ap->ioaddr.data_addr; -unsigned int words = buflen >>1 ; - -/* Transfer multiple of 2 bytes */ -if (rw ==READ ) -ioread16_rep (data_addr, buf, words); -else -iowrite16_rep (data_addr, buf, words); - -/* Transfer trailing 1 byte, if any. */ -if (unlikely (buflen &0x01 )) { -__le16 align_buf[1 ] = {0 }; -unsigned char *trailing_buf = buf + buflen -1 ; - -if (rw ==READ ) { - align_buf[0 ] =cpu_to_le16 (ioread16 (data_addr)); -memcpy (trailing_buf, align_buf,1 ); - }else { -memcpy (align_buf, trailing_buf,1 ); -iowrite16 (le16_to_cpu (align_buf[0 ]), data_addr); - } - words++; - } - -return words <<1 ; -} - -/** -* ata_data_xfer_noirq - Transfer data by PIO -* @dev: device to target -* @buf: data buffer -* @buflen: buffer length -* @rw: read/write -* -* Transfer data from/to the device data register by PIO. Do the -* transfer with interrupts disabled. -* -* LOCKING: -* Inherited from caller. -* -* RETURNS: -* Bytes consumed. -*/ -unsigned int ata_data_xfer_noirq (struct ata_device *dev,unsigned char *buf, -unsigned int buflen,int rw) -{ -unsigned long flags; -unsigned int consumed; - -local_irq_save (flags); - consumed =ata_data_xfer (dev, buf, buflen, rw); -local_irq_restore (flags); - -return consumed; -} - - -/** -* ata_pio_sector - Transfer a sector of data. -* @qc: Command on going -* -* Transfer qc->sect_size bytes of data from/to the ATA device. -* -* LOCKING: -* Inherited from caller. -*/ - -static void ata_pio_sector (struct ata_queued_cmd *qc) -{ -int do_write = (qc->tf.flags &ATA_TFLAG_WRITE ); -struct ata_port *ap = qc->ap; -struct page *page; -unsigned int offset; -unsigned char *buf; - -if (qc->curbytes == qc->nbytes - qc->sect_size) - ap->hsm_task_state =HSM_ST_LAST ; - - page =sg_page (qc->cursg); - offset = qc->cursg->offset + qc->cursg_ofs; - -/* get the current page and offset */ - page =nth_page (page, (offset >>PAGE_SHIFT )); - offset %=PAGE_SIZE ; - -DPRINTK ("data %s\n" , qc->tf.flags &ATA_TFLAG_WRITE ?"write" :"read" ); - -if (PageHighMem (page)) { -unsigned long flags; - -/* FIXME: use a bounce buffer */ -local_irq_save (flags); - buf =kmap_atomic (page,KM_IRQ0 ); - -/* do the actual data transfer */ - ap->ops->data_xfer (qc->dev, buf + offset, qc->sect_size, do_write); - -kunmap_atomic (buf,KM_IRQ0 ); -local_irq_restore (flags); - }else { - buf =page_address (page); - ap->ops->data_xfer (qc->dev, buf + offset, qc->sect_size, do_write); - } - - qc->curbytes += qc->sect_size; - qc->cursg_ofs += qc->sect_size; - -if (qc->cursg_ofs == qc->cursg->length) { - qc->cursg =sg_next (qc->cursg); - qc->cursg_ofs =0 ; - } -} - -/** -* ata_pio_sectors - Transfer one or many sectors. -* @qc: Command on going -* -* Transfer one or many sectors of data from/to the -* ATA device for the DRQ request. -* -* LOCKING: -* Inherited from caller. -*/ - -static void ata_pio_sectors (struct ata_queued_cmd *qc) -{ -if (is_multi_taskfile (&qc->tf)) { -/* READ/WRITE MULTIPLE */ -unsigned int nsect; - -WARN_ON (qc->dev->multi_count ==0 ); - - nsect =min ((qc->nbytes - qc->curbytes) / qc->sect_size, - qc->dev->multi_count); -while (nsect--) -ata_pio_sector (qc); - }else -ata_pio_sector (qc); - -ata_altstatus (qc->ap);/* flush */ -} - -/** -* atapi_send_cdb - Write CDB bytes to hardware -* @ap: Port to which ATAPI device is attached. -* @qc: Taskfile currently active -* -* When device has indicated its readiness to accept -* a CDB, this function is called. Send the CDB. -* -* LOCKING: -* caller. -*/ - -static void atapi_send_cdb (struct ata_port *ap,struct ata_queued_cmd *qc) -{ -/* send SCSI cdb */ -DPRINTK ("send cdb\n" ); -WARN_ON (qc->dev->cdb_len <12 ); - - ap->ops->data_xfer (qc->dev, qc->cdb, qc->dev->cdb_len,1 ); -ata_altstatus (ap);/* flush */ - -switch (qc->tf.protocol) { -case ATAPI_PROT_PIO : - ap->hsm_task_state =HSM_ST ; -break ; -case ATAPI_PROT_NODATA : - ap->hsm_task_state =HSM_ST_LAST ; -break ; -case ATAPI_PROT_DMA : - ap->hsm_task_state =HSM_ST_LAST ; -/* initiate bmdma */ - ap->ops->bmdma_start (qc); -break ; - } -} - -/** -* __atapi_pio_bytes - Transfer data from/to the ATAPI device. -* @qc: Command on going -* @bytes: number of bytes -* -* Transfer Transfer data from/to the ATAPI device. -* -* LOCKING: -* Inherited from caller. -* -*/ -static int __atapi_pio_bytes (struct ata_queued_cmd *qc,unsigned int bytes) -{ -int rw = (qc->tf.flags &ATA_TFLAG_WRITE ) ?WRITE :READ ; -struct ata_port *ap = qc->ap; -struct ata_device *dev = qc->dev; -struct ata_eh_info *ehi = &dev->link->eh_info; -struct scatterlist *sg; -struct page *page; -unsigned char *buf; -unsigned int offset, count, consumed; - -next_sg: - sg = qc->cursg; -if (unlikely (!sg)) { -ata_ehi_push_desc (ehi,"unexpected or too much trailing data " -"buf=%u cur=%u bytes=%u" , - qc->nbytes, qc->curbytes, bytes); -return -1 ; - } - - page =sg_page (sg); - offset = sg->offset + qc->cursg_ofs; - -/* get the current page and offset */ - page =nth_page (page, (offset >>PAGE_SHIFT )); - offset %=PAGE_SIZE ; - -/* don't overrun current sg */ - count =min (sg->length - qc->cursg_ofs, bytes); - -/* don't cross page boundaries */ - count =min (count, (unsigned int )PAGE_SIZE - offset); - -DPRINTK ("data %s\n" , qc->tf.flags &ATA_TFLAG_WRITE ?"write" :"read" ); - -if (PageHighMem (page)) { -unsigned long flags; - -/* FIXME: use bounce buffer */ -local_irq_save (flags); - buf =kmap_atomic (page,KM_IRQ0 ); - -/* do the actual data transfer */ - consumed = ap->ops->data_xfer (dev, buf + offset, count, rw); - -kunmap_atomic (buf,KM_IRQ0 ); -local_irq_restore (flags); - }else { - buf =page_address (page); - consumed = ap->ops->data_xfer (dev, buf + offset, count, rw); - } - - bytes -=min (bytes, consumed); - qc->curbytes += count; - qc->cursg_ofs += count; - -if (qc->cursg_ofs == sg->length) { - qc->cursg =sg_next (qc->cursg); - qc->cursg_ofs =0 ; - } - -/* consumed can be larger than count only for the last transfer */ -WARN_ON (qc->cursg && count != consumed); - -if (bytes) - goto next_sg; -return 0 ; -} - -/** -* atapi_pio_bytes - Transfer data from/to the ATAPI device. -* @qc: Command on going -* -* Transfer Transfer data from/to the ATAPI device. -* -* LOCKING: -* Inherited from caller. -*/ - -static void atapi_pio_bytes (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -struct ata_device *dev = qc->dev; -struct ata_eh_info *ehi = &dev->link->eh_info; -unsigned int ireason, bc_lo, bc_hi, bytes; -int i_write, do_write = (qc->tf.flags &ATA_TFLAG_WRITE ) ?1 :0 ; - -/* Abuse qc->result_tf for temp storage of intermediate TF -* here to save some kernel stack usage. -* For normal completion, qc->result_tf is not relevant. For -* error, qc->result_tf is later overwritten by ata_qc_complete(). -* So, the correctness of qc->result_tf is not affected. -*/ - ap->ops->tf_read (ap, &qc->result_tf); - ireason = qc->result_tf.nsect; - bc_lo = qc->result_tf.lbam; - bc_hi = qc->result_tf.lbah; - bytes = (bc_hi <<8 ) | bc_lo; - -/* shall be cleared to zero, indicating xfer of data */ -if (unlikely (ireason & (1 <<0 ))) - goto atapi_check; - -/* make sure transfer direction matches expected */ - i_write = ((ireason & (1 <<1 )) ==0 ) ?1 :0 ; -if (unlikely (do_write != i_write)) - goto atapi_check; - -if (unlikely (!bytes)) - goto atapi_check; - -VPRINTK ("ata%u: xfering %d bytes\n" , ap->print_id, bytes); - -if (unlikely (__atapi_pio_bytes (qc, bytes))) - goto err_out; -ata_altstatus (ap);/* flush */ - -return ; - - atapi_check: -ata_ehi_push_desc (ehi,"ATAPI check failed (ireason=0x%x bytes=%u)" , - ireason, bytes); - err_out: - qc->err_mask |=AC_ERR_HSM ; - ap->hsm_task_state =HSM_ST_ERR ; -} - -/** -* ata_hsm_ok_in_wq - Check if the qc can be handled in the workqueue. -* @ap: the target ata_port -* @qc: qc on going -* -* RETURNS: -* 1 if ok in workqueue, 0 otherwise. -*/ - -static inline int ata_hsm_ok_in_wq (struct ata_port *ap,struct ata_queued_cmd *qc) -{ -if (qc->tf.flags &ATA_TFLAG_POLLING ) -return 1 ; - -if (ap->hsm_task_state ==HSM_ST_FIRST ) { -if (qc->tf.protocol ==ATA_PROT_PIO && - (qc->tf.flags &ATA_TFLAG_WRITE )) -return 1 ; - -if (ata_is_atapi (qc->tf.protocol) && - !(qc->dev->flags &ATA_DFLAG_CDB_INTR )) -return 1 ; - } - -return 0 ; -} - -/** -* ata_hsm_qc_complete - finish a qc running on standard HSM -* @qc: Command to complete -* @in_wq: 1 if called from workqueue, 0 otherwise -* -* Finish @qc which is running on standard HSM. -* -* LOCKING: -* If @in_wq is zero, spin_lock_irqsave(host lock). -* Otherwise, none on entry and grabs host lock. -*/ -static void ata_hsm_qc_complete (struct ata_queued_cmd *qc,int in_wq) -{ -struct ata_port *ap = qc->ap; -unsigned long flags; - -if (ap->ops->error_handler) { -if (in_wq) { -spin_lock_irqsave (ap->lock, flags); - -/* EH might have kicked in while host lock is -* released. -*/ - qc =ata_qc_from_tag (ap, qc->tag); -if (qc) { -if (likely (!(qc->err_mask &AC_ERR_HSM ))) { - ap->ops->irq_on (ap); -ata_qc_complete (qc); - }else -ata_port_freeze (ap); - } - -spin_unlock_irqrestore (ap->lock, flags); - }else { -if (likely (!(qc->err_mask &AC_ERR_HSM ))) -ata_qc_complete (qc); -else -ata_port_freeze (ap); - } - }else { -if (in_wq) { -spin_lock_irqsave (ap->lock, flags); - ap->ops->irq_on (ap); -ata_qc_complete (qc); -spin_unlock_irqrestore (ap->lock, flags); - }else -ata_qc_complete (qc); - } -} - -/** -* ata_hsm_move - move the HSM to the next state. -* @ap: the target ata_port -* @qc: qc on going -* @status: current device status -* @in_wq: 1 if called from workqueue, 0 otherwise -* -* RETURNS: -* 1 when poll next status needed, 0 otherwise. -*/ -int ata_hsm_move (struct ata_port *ap,struct ata_queued_cmd *qc, -u8 status,int in_wq) -{ -unsigned long flags =0 ; -int poll_next; - -WARN_ON ((qc->flags &ATA_QCFLAG_ACTIVE ) ==0 ); - -/* Make sure ata_qc_issue_prot() does not throw things -* like DMA polling into the workqueue. Notice that -* in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING). -*/ -WARN_ON (in_wq !=ata_hsm_ok_in_wq (ap, qc)); - -fsm_start: -DPRINTK ("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n" , - ap->print_id, qc->tf.protocol, ap->hsm_task_state, status); - -switch (ap->hsm_task_state) { -case HSM_ST_FIRST : -/* Send first data block or PACKET CDB */ - -/* If polling, we will stay in the work queue after -* sending the data. Otherwise, interrupt handler -* takes over after sending the data. -*/ - poll_next = (qc->tf.flags &ATA_TFLAG_POLLING ); - -/* check device status */ -if (unlikely ((status &ATA_DRQ ) ==0 )) { -/* handle BSY=0, DRQ=0 as error */ -if (likely (status & (ATA_ERR |ATA_DF ))) -/* device stops HSM for abort/error */ - qc->err_mask |=AC_ERR_DEV ; -else -/* HSM violation. Let EH handle this */ - qc->err_mask |=AC_ERR_HSM ; - - ap->hsm_task_state =HSM_ST_ERR ; - goto fsm_start; - } - -/* Device should not ask for data transfer (DRQ=1) -* when it finds something wrong. -* We ignore DRQ here and stop the HSM by -* changing hsm_task_state to HSM_ST_ERR and -* let the EH abort the command or reset the device. -*/ -if (unlikely (status & (ATA_ERR |ATA_DF ))) { -/* Some ATAPI tape drives forget to clear the ERR bit -* when doing the next command (mostly request sense). -* We ignore ERR here to workaround and proceed sending -* the CDB. -*/ -if (!(qc->dev->horkage &ATA_HORKAGE_STUCK_ERR )) { -ata_port_printk (ap,KERN_WARNING , -"DRQ=1 with device error, " -"dev_stat 0x%X\n" , status); - qc->err_mask |=AC_ERR_HSM ; - ap->hsm_task_state =HSM_ST_ERR ; - goto fsm_start; - } - } - -/* Send the CDB (atapi) or the first data block (ata pio out). -* During the state transition, interrupt handler shouldn't -* be invoked before the data transfer is complete and -* hsm_task_state is changed. Hence, the following locking. -*/ -if (in_wq) -spin_lock_irqsave (ap->lock, flags); - -if (qc->tf.protocol ==ATA_PROT_PIO ) { -/* PIO data out protocol. -* send first data block. -*/ - -/* ata_pio_sectors() might change the state -* to HSM_ST_LAST. so, the state is changed here -* before ata_pio_sectors(). -*/ - ap->hsm_task_state =HSM_ST ; -ata_pio_sectors (qc); - }else -/* send CDB */ -atapi_send_cdb (ap, qc); - -if (in_wq) -spin_unlock_irqrestore (ap->lock, flags); - -/* if polling, ata_pio_task() handles the rest. -* otherwise, interrupt handler takes over from here. -*/ -break ; - -case HSM_ST : -/* complete command or read/write the data register */ -if (qc->tf.protocol ==ATAPI_PROT_PIO ) { -/* ATAPI PIO protocol */ -if ((status &ATA_DRQ ) ==0 ) { -/* No more data to transfer or device error. -* Device error will be tagged in HSM_ST_LAST. -*/ - ap->hsm_task_state =HSM_ST_LAST ; - goto fsm_start; - } - -/* Device should not ask for data transfer (DRQ=1) -* when it finds something wrong. -* We ignore DRQ here and stop the HSM by -* changing hsm_task_state to HSM_ST_ERR and -* let the EH abort the command or reset the device. -*/ -if (unlikely (status & (ATA_ERR |ATA_DF ))) { -ata_port_printk (ap,KERN_WARNING ,"DRQ=1 with " -"device error, dev_stat 0x%X\n" , - status); - qc->err_mask |=AC_ERR_HSM ; - ap->hsm_task_state =HSM_ST_ERR ; - goto fsm_start; - } - -atapi_pio_bytes (qc); - -if (unlikely (ap->hsm_task_state ==HSM_ST_ERR )) -/* bad ireason reported by device */ - goto fsm_start; - - }else { -/* ATA PIO protocol */ -if (unlikely ((status &ATA_DRQ ) ==0 )) { -/* handle BSY=0, DRQ=0 as error */ -if (likely (status & (ATA_ERR |ATA_DF ))) -/* device stops HSM for abort/error */ - qc->err_mask |=AC_ERR_DEV ; -else -/* HSM violation. Let EH handle this. -* Phantom devices also trigger this -* condition. Mark hint. -*/ - qc->err_mask |=AC_ERR_HSM | -AC_ERR_NODEV_HINT ; - - ap->hsm_task_state =HSM_ST_ERR ; - goto fsm_start; - } - -/* For PIO reads, some devices may ask for -* data transfer (DRQ=1) alone with ERR=1. -* We respect DRQ here and transfer one -* block of junk data before changing the -* hsm_task_state to HSM_ST_ERR. -* -* For PIO writes, ERR=1 DRQ=1 doesn't make -* sense since the data block has been -* transferred to the device. -*/ -if (unlikely (status & (ATA_ERR |ATA_DF ))) { -/* data might be corrputed */ - qc->err_mask |=AC_ERR_DEV ; - -if (!(qc->tf.flags &ATA_TFLAG_WRITE )) { -ata_pio_sectors (qc); - status =ata_wait_idle (ap); - } - -if (status & (ATA_BUSY |ATA_DRQ )) - qc->err_mask |=AC_ERR_HSM ; - -/* ata_pio_sectors() might change the -* state to HSM_ST_LAST. so, the state -* is changed after ata_pio_sectors(). -*/ - ap->hsm_task_state =HSM_ST_ERR ; - goto fsm_start; - } - -ata_pio_sectors (qc); - -if (ap->hsm_task_state ==HSM_ST_LAST && - (!(qc->tf.flags &ATA_TFLAG_WRITE ))) { -/* all data read */ - status =ata_wait_idle (ap); - goto fsm_start; - } - } - - poll_next =1 ; -break ; - -case HSM_ST_LAST : -if (unlikely (!ata_ok (status))) { - qc->err_mask |=__ac_err_mask (status); - ap->hsm_task_state =HSM_ST_ERR ; - goto fsm_start; - } - -/* no more data to transfer */ -DPRINTK ("ata%u: dev %u command complete, drv_stat 0x%x\n" , - ap->print_id, qc->dev->devno, status); - -WARN_ON (qc->err_mask); - - ap->hsm_task_state =HSM_ST_IDLE ; - -/* complete taskfile transaction */ -ata_hsm_qc_complete (qc, in_wq); - - poll_next =0 ; -break ; - -case HSM_ST_ERR : -/* make sure qc->err_mask is available to -* know what's wrong and recover -*/ -WARN_ON (qc->err_mask ==0 ); - - ap->hsm_task_state =HSM_ST_IDLE ; - -/* complete taskfile transaction */ -ata_hsm_qc_complete (qc, in_wq); - - poll_next =0 ; -break ; -default : - poll_next =0 ; -BUG (); - } - -return poll_next; -} - -static void ata_pio_task (struct work_struct *work) -{ -struct ata_port *ap = - container_of(work, struct ata_port, port_task.work); -struct ata_queued_cmd *qc = ap->port_task_data; -u8 status; -int poll_next; - -fsm_start: -WARN_ON (ap->hsm_task_state ==HSM_ST_IDLE ); - -/* -* This is purely heuristic. This is a fast path. -* Sometimes when we enter, BSY will be cleared in -* a chk-status or two. If not, the drive is probably seeking -* or something. Snooze for a couple msecs, then -* chk-status again. If still busy, queue delayed work. -*/ - status =ata_busy_wait (ap,ATA_BUSY ,5 ); -if (status &ATA_BUSY ) { -msleep (2 ); - status =ata_busy_wait (ap,ATA_BUSY ,10 ); -if (status &ATA_BUSY ) { -ata_pio_queue_task (ap, qc,ATA_SHORT_PAUSE ); -return ; - } - } - -/* move the HSM */ - poll_next =ata_hsm_move (ap, qc, status,1 ); - -/* another command or interrupt handler -* may be running at this point. -*/ -if (poll_next) - goto fsm_start; -} - -/** * ata_qc_new - Request an available ATA command, for queueing * @ap: Port associated with device @dev * @dev: Device from whom we request an available command structure
@@ -6084,285 +4568,6 @@ err: }/** -* ata_qc_issue_prot - issue taskfile to device in proto-dependent manner -* @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. -* -* LOCKING: -* spin_lock_irqsave(host lock) -* -* RETURNS: -* Zero on success, AC_ERR_* mask on failure -*/ - -unsigned int ata_qc_issue_prot (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; - -/* 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 ; - } - } - -/* select the device */ -ata_dev_select (ap, qc->dev->devno,1 ,0 ); - -/* start the command */ -switch (qc->tf.protocol) { -case ATA_PROT_NODATA : -if (qc->tf.flags &ATA_TFLAG_POLLING ) -ata_qc_set_polling (qc); - -ata_tf_to_host (ap, &qc->tf); - ap->hsm_task_state =HSM_ST_LAST ; - -if (qc->tf.flags &ATA_TFLAG_POLLING ) -ata_pio_queue_task (ap, qc,0 ); - -break ; - -case ATA_PROT_DMA : -WARN_ON (qc->tf.flags &ATA_TFLAG_POLLING ); - - ap->ops->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); - -ata_tf_to_host (ap, &qc->tf); - -if (qc->tf.flags &ATA_TFLAG_WRITE ) { -/* PIO data out protocol */ - ap->hsm_task_state =HSM_ST_FIRST ; -ata_pio_queue_task (ap, qc,0 ); - -/* always send first data block using -* the ata_pio_task() codepath. -*/ - }else { -/* PIO data in protocol */ - ap->hsm_task_state =HSM_ST ; - -if (qc->tf.flags &ATA_TFLAG_POLLING ) -ata_pio_queue_task (ap, qc,0 ); - -/* if polling, ata_pio_task() handles the rest. -* otherwise, interrupt handler takes over from here. -*/ - } - -break ; - -case ATAPI_PROT_PIO : -case ATAPI_PROT_NODATA : -if (qc->tf.flags &ATA_TFLAG_POLLING ) -ata_qc_set_polling (qc); - -ata_tf_to_host (ap, &qc->tf); - - ap->hsm_task_state =HSM_ST_FIRST ; - -/* send cdb by polling if no cdb interrupt */ -if ((!(qc->dev->flags &ATA_DFLAG_CDB_INTR )) || - (qc->tf.flags &ATA_TFLAG_POLLING )) -ata_pio_queue_task (ap, qc,0 ); -break ; - -case ATAPI_PROT_DMA : -WARN_ON (qc->tf.flags &ATA_TFLAG_POLLING ); - - ap->ops->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_pio_queue_task (ap, qc,0 ); -break ; - -default : -WARN_ON (1 ); -return AC_ERR_SYSTEM ; - } - -return 0 ; -} - -/** -* ata_host_intr - Handle host interrupt for given (port, task) -* @ap: Port on which interrupt arrived (possibly...) -* @qc: Taskfile currently active in engine -* -* Handle host interrupt for given queued command. Currently, -* only DMA interrupts are handled. All other commands are -* handled via polling with interrupts disabled (nIEN bit). -* -* LOCKING: -* spin_lock_irqsave(host lock) -* -* RETURNS: -* One if interrupt was handled, zero if not (shared irq). -*/ - -inline unsigned int ata_host_intr (struct ata_port *ap, -struct ata_queued_cmd *qc) -{ -struct ata_eh_info *ehi = &ap->link.eh_info; -u8 status, host_stat =0 ; - -VPRINTK ("ata%u: protocol %d task_state %d\n" , - ap->print_id, qc->tf.protocol, ap->hsm_task_state); - -/* Check whether we are expecting interrupt in this state */ -switch (ap->hsm_task_state) { -case HSM_ST_FIRST : -/* Some pre-ATAPI-4 devices assert INTRQ -* at this state when ready to receive CDB. -*/ - -/* Check the ATA_DFLAG_CDB_INTR flag is enough here. -* The flag was turned on only for atapi devices. No -* need to check ata_is_atapi(qc->tf.protocol) again. -*/ -if (!(qc->dev->flags &ATA_DFLAG_CDB_INTR )) - goto idle_irq; -break ; -case HSM_ST_LAST : -if (qc->tf.protocol ==ATA_PROT_DMA || - qc->tf.protocol ==ATAPI_PROT_DMA ) { -/* check status of DMA engine */ - host_stat = ap->ops->bmdma_status (ap); -VPRINTK ("ata%u: host_stat 0x%X\n" , - ap->print_id, host_stat); - -/* if it's not our irq... */ -if (!(host_stat &ATA_DMA_INTR )) - goto idle_irq; - -/* before we do anything else, clear DMA-Start bit */ - ap->ops->bmdma_stop (qc); - -if (unlikely (host_stat &ATA_DMA_ERR )) { -/* error when transfering data to/from memory */ - qc->err_mask |=AC_ERR_HOST_BUS ; - ap->hsm_task_state =HSM_ST_ERR ; - } - } -break ; -case HSM_ST : -break ; -default : - goto idle_irq; - } - -/* check altstatus */ - status =ata_altstatus (ap); -if (status &ATA_BUSY ) - goto idle_irq; - -/* check main status, clearing INTRQ */ - status =ata_chk_status (ap); -if (unlikely (status &ATA_BUSY )) - goto idle_irq; - -/* ack bmdma irq events */ - ap->ops->irq_clear (ap); - -ata_hsm_move (ap, qc, status,0 ); - -if (unlikely (qc->err_mask) && (qc->tf.protocol ==ATA_PROT_DMA || - qc->tf.protocol ==ATAPI_PROT_DMA )) -ata_ehi_push_desc (ehi,"BMDMA stat 0x%x" , host_stat); - -return 1 ;/* irq handled */ - -idle_irq: - ap->stats.idle_irq++; - -#ifdef ATA_IRQ_TRAP -if ((ap->stats.idle_irq %1000 ) ==0 ) { -ata_chk_status (ap); - ap->ops->irq_clear (ap); -ata_port_printk (ap,KERN_WARNING ,"irq trap\n" ); -return 1 ; - } -#endif -return 0 ;/* irq not handled */ -} - -/** -* ata_interrupt - Default ATA host interrupt handler -* @irq: irq line (unused) -* @dev_instance: pointer to our ata_host information structure -* -* Default interrupt handler for PCI IDE devices. Calls -* ata_host_intr() for each port that is not disabled. -* -* LOCKING: -* Obtains host lock during operation. -* -* RETURNS: -* IRQ_NONE or IRQ_HANDLED. -*/ - -irqreturn_t ata_interrupt (int irq,void *dev_instance) -{ -struct ata_host *host = dev_instance; -unsigned int i; -unsigned int handled =0 ; -unsigned long flags; - -/* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ -spin_lock_irqsave (&host->lock, flags); - -for (i =0 ; i < host->n_ports; i++) { -struct ata_port *ap; - - 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 |=ata_host_intr (ap, qc); - } - } - -spin_unlock_irqrestore (&host->lock, flags); - -return IRQ_RETVAL (handled); -} - -/** * sata_scr_valid - test whether SCRs are accessible * @link: ATA link to test SCR accessibility for *
@@ -7394,33 +5599,6 @@ void ata_host_detach(struct ata_host *host)ata_acpi_dissociate (host); } -/** -* ata_std_ports - initialize ioaddr with standard port offsets. -* @ioaddr: IO address structure to be initialized -* -* Utility function which initializes data_addr, error_addr, -* feature_addr, nsect_addr, lbal_addr, lbam_addr, lbah_addr, -* device_addr, status_addr, and command_addr to standard offsets -* relative to cmd_addr. -* -* Does not set ctl_addr, altstatus_addr, bmdma_addr, or scr_addr. -*/ - -void ata_std_ports (struct ata_ioports *ioaddr) -{ - ioaddr->data_addr = ioaddr->cmd_addr +ATA_REG_DATA ; - ioaddr->error_addr = ioaddr->cmd_addr +ATA_REG_ERR ; - ioaddr->feature_addr = ioaddr->cmd_addr +ATA_REG_FEATURE ; - ioaddr->nsect_addr = ioaddr->cmd_addr +ATA_REG_NSECT ; - ioaddr->lbal_addr = ioaddr->cmd_addr +ATA_REG_LBAL ; - ioaddr->lbam_addr = ioaddr->cmd_addr +ATA_REG_LBAM ; - ioaddr->lbah_addr = ioaddr->cmd_addr +ATA_REG_LBAH ; - ioaddr->device_addr = ioaddr->cmd_addr +ATA_REG_DEVICE ; - ioaddr->status_addr = ioaddr->cmd_addr +ATA_REG_STATUS ; - ioaddr->command_addr = ioaddr->cmd_addr +ATA_REG_CMD ; -} - -#ifdef CONFIG_PCI /**
@@ -7852,12 +6030,9 @@ EXPORT_SYMBOL_GPL(sata_deb_timing_long);EXPORT_SYMBOL_GPL (ata_base_port_ops);EXPORT_SYMBOL_GPL (sata_port_ops);EXPORT_SYMBOL_GPL (sata_pmp_port_ops); -EXPORT_SYMBOL_GPL (ata_sff_port_ops); -EXPORT_SYMBOL_GPL (ata_bmdma_port_ops);EXPORT_SYMBOL_GPL (ata_dummy_port_ops);EXPORT_SYMBOL_GPL (ata_dummy_port_info);EXPORT_SYMBOL_GPL (ata_std_bios_param); -EXPORT_SYMBOL_GPL (ata_std_ports);EXPORT_SYMBOL_GPL (ata_host_init);EXPORT_SYMBOL_GPL (ata_host_alloc);EXPORT_SYMBOL_GPL (ata_host_alloc_pinfo);
@@ -7866,14 +6041,9 @@ EXPORT_SYMBOL_GPL(ata_host_register);EXPORT_SYMBOL_GPL (ata_host_activate);EXPORT_SYMBOL_GPL (ata_host_detach);EXPORT_SYMBOL_GPL (ata_sg_init); -EXPORT_SYMBOL_GPL (ata_hsm_move);EXPORT_SYMBOL_GPL (ata_qc_complete);EXPORT_SYMBOL_GPL (ata_qc_complete_multiple); -EXPORT_SYMBOL_GPL (ata_qc_issue_prot); -EXPORT_SYMBOL_GPL (ata_tf_load); -EXPORT_SYMBOL_GPL (ata_tf_read);EXPORT_SYMBOL_GPL (ata_noop_dev_select); -EXPORT_SYMBOL_GPL (ata_std_dev_select);EXPORT_SYMBOL_GPL (sata_print_link_status);EXPORT_SYMBOL_GPL (ata_tf_to_fis);EXPORT_SYMBOL_GPL (ata_tf_from_fis);
@@ -7884,54 +6054,27 @@ 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_check_status); -EXPORT_SYMBOL_GPL (ata_altstatus); -EXPORT_SYMBOL_GPL (ata_exec_command);EXPORT_SYMBOL_GPL (ata_port_start); -EXPORT_SYMBOL_GPL (ata_sff_port_start); -EXPORT_SYMBOL_GPL (ata_interrupt);EXPORT_SYMBOL_GPL (ata_do_set_mode); -EXPORT_SYMBOL_GPL (ata_data_xfer); -EXPORT_SYMBOL_GPL (ata_data_xfer_noirq);EXPORT_SYMBOL_GPL (ata_std_qc_defer); -EXPORT_SYMBOL_GPL (ata_qc_prep); -EXPORT_SYMBOL_GPL (ata_dumb_qc_prep);EXPORT_SYMBOL_GPL (ata_noop_qc_prep); -EXPORT_SYMBOL_GPL (ata_bmdma_setup); -EXPORT_SYMBOL_GPL (ata_bmdma_start); -EXPORT_SYMBOL_GPL (ata_bmdma_irq_clear);EXPORT_SYMBOL_GPL (ata_noop_irq_clear); -EXPORT_SYMBOL_GPL (ata_bmdma_status); -EXPORT_SYMBOL_GPL (ata_bmdma_stop); -EXPORT_SYMBOL_GPL (ata_bmdma_freeze); -EXPORT_SYMBOL_GPL (ata_bmdma_thaw); -EXPORT_SYMBOL_GPL (ata_bmdma_error_handler); -EXPORT_SYMBOL_GPL (ata_bmdma_post_internal_cmd);EXPORT_SYMBOL_GPL (ata_port_probe);EXPORT_SYMBOL_GPL (ata_dev_disable);EXPORT_SYMBOL_GPL (sata_set_spd);EXPORT_SYMBOL_GPL (sata_link_debounce);EXPORT_SYMBOL_GPL (sata_link_resume); -EXPORT_SYMBOL_GPL (ata_bus_reset); -EXPORT_SYMBOL_GPL (ata_std_prereset); -EXPORT_SYMBOL_GPL (ata_std_softreset);EXPORT_SYMBOL_GPL (sata_link_hardreset); -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_busy_sleep); -EXPORT_SYMBOL_GPL (ata_wait_after_reset); -EXPORT_SYMBOL_GPL (ata_wait_ready);EXPORT_SYMBOL_GPL (ata_scsi_ioctl);EXPORT_SYMBOL_GPL (ata_scsi_queuecmd);EXPORT_SYMBOL_GPL (ata_scsi_slave_config);EXPORT_SYMBOL_GPL (ata_scsi_slave_destroy);EXPORT_SYMBOL_GPL (ata_scsi_change_queue_depth); -EXPORT_SYMBOL_GPL (ata_host_intr);EXPORT_SYMBOL_GPL (sata_scr_valid);EXPORT_SYMBOL_GPL (sata_scr_read);EXPORT_SYMBOL_GPL (sata_scr_write);
@@ -7954,11 +6097,6 @@ EXPORT_SYMBOL_GPL(ata_timing_cycle2mode);#ifdef CONFIG_PCI EXPORT_SYMBOL_GPL (pci_test_config_bits); -EXPORT_SYMBOL_GPL (ata_pci_init_sff_host); -EXPORT_SYMBOL_GPL (ata_pci_init_bmdma); -EXPORT_SYMBOL_GPL (ata_pci_prepare_sff_host); -EXPORT_SYMBOL_GPL (ata_pci_activate_sff_host); -EXPORT_SYMBOL_GPL (ata_pci_init_one);EXPORT_SYMBOL_GPL (ata_pci_remove_one);#ifdef CONFIG_PM EXPORT_SYMBOL_GPL (ata_pci_device_do_suspend);
@@ -7966,8 +6104,6 @@ EXPORT_SYMBOL_GPL(ata_pci_device_do_resume);EXPORT_SYMBOL_GPL (ata_pci_device_suspend);EXPORT_SYMBOL_GPL (ata_pci_device_resume);#endif /* CONFIG_PM */ -EXPORT_SYMBOL_GPL (ata_pci_default_filter); -EXPORT_SYMBOL_GPL (ata_pci_clear_simplex);#endif /* CONFIG_PCI */ EXPORT_SYMBOL_GPL (sata_pmp_qc_defer_cmd_switch);
@@ -7994,8 +6130,6 @@ EXPORT_SYMBOL_GPL(ata_eh_qc_complete);EXPORT_SYMBOL_GPL (ata_eh_qc_retry);EXPORT_SYMBOL_GPL (ata_do_eh);EXPORT_SYMBOL_GPL (ata_std_error_handler); -EXPORT_SYMBOL_GPL (ata_irq_on); -EXPORT_SYMBOL_GPL (ata_dev_try_classify);EXPORT_SYMBOL_GPL (ata_cable_40wire);EXPORT_SYMBOL_GPL (ata_cable_80wire);
drivers/ata/libata-sff.c +1856 -3
963 lines not on this page · raw message
include/linux/libata.h +190 -189
379 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.2.4
Part of the diff is not shown here. View the raw message.
PATCH 6/27 libata: kill ata_chk_status()
In reply to Tejun Heoata_chk_status() just calls ops->check_status and it only adds confusion with other status functions. Kill it.
--- drivers/ata/libata-sff.c | 22 +++++++++++----------- drivers/ata/pata_bf54x.c | 2 +- drivers/ata/pata_scc.c | 2 +- drivers/ata/sata_inic162x.c | 10 +++++----- drivers/ata/sata_sil.c | 6 +++--- drivers/ata/sata_via.c | 2 +- drivers/ata/sata_vsc.c | 2 +- include/linux/libata.h | 7 +------ 8 files changed, 24 insertions(+), 29 deletions(-)
drivers/ata/libata-sff.c +11 -11
@@ -290,7 +290,7 @@ int ata_busy_sleep(struct ata_port *ap,while (status !=0xff && (status &ATA_BUSY ) &&time_before (jiffies, timeout)) {msleep (50 ); - status =ata_chk_status (ap); + status = ap->ops->check_status (ap); }if (status ==0xff )
@@ -326,7 +326,7 @@ int ata_wait_ready(struct ata_port *ap, unsigned long deadline)int warned =0 ;while (1 ) { -u8 status =ata_chk_status (ap); +u8 status = ap->ops->check_status (ap);unsigned long now = jiffies;if (!(status &ATA_BUSY ))
@@ -1486,7 +1486,7 @@ inline unsigned int ata_host_intr(struct ata_port *ap, goto idle_irq;/* check main status, clearing INTRQ */ - status =ata_chk_status (ap); + status = ap->ops->check_status (ap);if (unlikely (status &ATA_BUSY )) goto idle_irq;
@@ -1506,7 +1506,7 @@ idle_irq:#ifdef ATA_IRQ_TRAP if ((ap->stats.idle_irq %1000 ) ==0 ) { -ata_chk_status (ap); + ap->ops->check_status (ap); ap->ops->irq_clear (ap);ata_port_printk (ap,KERN_WARNING ,"irq trap\n" );return 1 ;
@@ -1582,7 +1582,7 @@ void ata_bmdma_freeze(struct ata_port *ap)* ATA_NIEN manipulation. Also, many controllers fail to mask * previously pending IRQ on ATA_NIEN assertion. Clear it. */ -ata_chk_status (ap); + ap->ops->check_status (ap); ap->ops->irq_clear (ap); }
@@ -1599,7 +1599,7 @@ void ata_bmdma_freeze(struct ata_port *ap)void ata_bmdma_thaw (struct ata_port *ap) {/* clear & re-enable interrupts */ -ata_chk_status (ap); + ap->ops->check_status (ap); ap->ops->irq_clear (ap); ap->ops->irq_on (ap); }
@@ -1709,7 +1709,7 @@ unsigned int ata_dev_try_classify(struct ata_device *dev, int present, class =ATA_DEV_ATA ; else class =ATA_DEV_NONE ; - }else if ((class ==ATA_DEV_ATA ) && (ata_chk_status (ap) ==0 )) + }else if ((class ==ATA_DEV_ATA ) && (ap->ops->check_status (ap) ==0 )) class =ATA_DEV_NONE ;return class;
@@ -1820,7 +1820,7 @@ void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline)*/ if (ap->flags &ATA_FLAG_SATA ) {while (1 ) { -u8 status =ata_chk_status (ap); +u8 status = ap->ops->check_status (ap);if (status !=0xff ||time_after (jiffies, deadline))return ;
@@ -1851,7 +1851,7 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,* the bus shows 0xFF because the odd clown forgets the D7 * pulldown resistor. */ -if (ata_chk_status (ap) ==0xFF ) +if (ap->ops->check_status (ap) ==0xFF )return -ENODEV ;return ata_bus_post_reset (ap, devmask, deadline);
@@ -2035,7 +2035,7 @@ void ata_bmdma_error_handler(struct ata_port *ap) }ata_altstatus (ap); -ata_chk_status (ap); + ap->ops->check_status (ap); ap->ops->irq_clear (ap);spin_unlock_irqrestore (ap->lock, flags);
@@ -2726,7 +2726,6 @@ EXPORT_SYMBOL_GPL(ata_sff_port_ops);EXPORT_SYMBOL_GPL (ata_bmdma_port_ops);EXPORT_SYMBOL_GPL (ata_qc_prep);EXPORT_SYMBOL_GPL (ata_dumb_qc_prep); -EXPORT_SYMBOL_GPL (ata_pci_default_filter);EXPORT_SYMBOL_GPL (ata_std_dev_select);EXPORT_SYMBOL_GPL (ata_check_status);EXPORT_SYMBOL_GPL (ata_altstatus);
@@ -2755,6 +2754,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_error_handler);EXPORT_SYMBOL_GPL (ata_bmdma_post_internal_cmd);EXPORT_SYMBOL_GPL (ata_sff_port_start);EXPORT_SYMBOL_GPL (ata_std_ports); +EXPORT_SYMBOL_GPL (ata_pci_default_filter);EXPORT_SYMBOL_GPL (ata_bmdma_setup);EXPORT_SYMBOL_GPL (ata_bmdma_start);EXPORT_SYMBOL_GPL (ata_bmdma_stop);
drivers/ata/pata_bf54x.c +1 -1
@@ -1264,7 +1264,7 @@ static void bfin_bmdma_freeze(struct ata_port *ap)* ATA_NIEN manipulation. Also, many controllers fail to mask * previously pending IRQ on ATA_NIEN assertion. Clear it. */ -ata_chk_status (ap); + ap->ops->check_status (ap);bfin_irq_clear (ap); }
drivers/ata/pata_scc.c +1 -1
@@ -854,7 +854,7 @@ static void scc_bmdma_freeze (struct ata_port *ap)* ATA_NIEN manipulation. Also, many controllers fail to mask * previously pending IRQ on ATA_NIEN assertion. Clear it. */ -ata_chk_status (ap); + ap->ops->check_status (ap); ap->ops->irq_clear (ap); }
drivers/ata/sata_inic162x.c +5 -5
@@ -267,14 +267,14 @@ static void inic_host_intr(struct ata_port *ap)ata_qc_from_tag (ap, ap->link.active_tag);if (unlikely (!qc || (qc->tf.flags &ATA_TFLAG_POLLING ))) { -ata_chk_status (ap);/* clear ATA interrupt */ + ap->ops->check_status (ap);/* clear ATA interrupt */ return ; }if (likely (ata_host_intr (ap, qc)))return ; -ata_chk_status (ap);/* clear ATA interrupt */ + ap->ops->check_status (ap);/* clear ATA interrupt */ ata_port_printk (ap,KERN_WARNING ,"unhandled " "interrupt, irq_stat=%x\n" , irq_stat);return ;
@@ -351,7 +351,7 @@ static unsigned int inic_qc_issue(struct ata_queued_cmd *qc)*/ if (unlikely (qc->tf.command ==ATA_CMD_ID_ATA || qc->tf.command ==ATA_CMD_ID_ATAPI )) { -u8 stat =ata_chk_status (ap); +u8 stat = ap->ops->check_status (ap);if (stat ==0x7f || stat ==0xff )return AC_ERR_HSM ; }
@@ -365,7 +365,7 @@ static void inic_freeze(struct ata_port *ap)__inic_set_pirq_mask (ap,PIRQ_MASK_FREEZE ); -ata_chk_status (ap); + ap->ops->check_status (ap);writeb (0xff , port_base +PORT_IRQ_STAT );readb (port_base +PORT_IRQ_STAT );/* flush */
@@ -375,7 +375,7 @@ static void inic_thaw(struct ata_port *ap) {void __iomem *port_base =inic_port_base (ap); -ata_chk_status (ap); + ap->ops->check_status (ap);writeb (0xff , port_base +PORT_IRQ_STAT );__inic_set_pirq_mask (ap,PIRQ_MASK_OTHER );
drivers/ata/sata_sil.c +3 -3
@@ -369,7 +369,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)if (unlikely (!qc || (qc->tf.flags &ATA_TFLAG_POLLING ))) {/* this sometimes happens, just clear IRQ */ -ata_chk_status (ap); + ap->ops->check_status (ap);return ; }
@@ -405,7 +405,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) }/* check main status, clearing INTRQ */ - status =ata_chk_status (ap); + status = ap->ops->check_status (ap);if (unlikely (status &ATA_BUSY )) goto err_hsm;
@@ -480,7 +480,7 @@ static void sil_thaw(struct ata_port *ap)u32 tmp;/* clear IRQ */ -ata_chk_status (ap); + ap->ops->check_status (ap);ata_bmdma_irq_clear (ap);/* turn on SATA IRQ if supported */
drivers/ata/sata_via.c +1 -1
@@ -173,7 +173,7 @@ static void svia_noop_freeze(struct ata_port *ap)/* Some VIA controllers choke if ATA_NIEN is manipulated in * certain way. Leave it alone and just clear pending IRQ. */ -ata_chk_status (ap); + ap->ops->check_status (ap);ata_bmdma_irq_clear (ap); }
drivers/ata/sata_vsc.c +1 -1
@@ -251,7 +251,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)* simply clear the interrupt */ if (unlikely (!handled)) -ata_chk_status (ap); + ap->ops->check_status (ap); }/*
include/linux/libata.h +1 -6
@@ -1420,11 +1420,6 @@ extern int ata_pci_init_one(struct pci_dev *pdev, struct scsi_host_template *sht, void *host_priv);#endif /* CONFIG_PCI */ -static inline u8 ata_chk_status (struct ata_port *ap) -{ -return ap->ops->check_status (ap); -} -/** * ata_pause - Flush writes and pause 400 nanoseconds. * @ap: Port to wait for.
@@ -1458,7 +1453,7 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,do {udelay (10 ); - status =ata_chk_status (ap); + status = ap->ops->check_status (ap); max--; }while (status !=0xff && (status & bits) && (max >0 ));
Signature · 1 line
1.5.2.4
PATCH 15/27 libata: move generic hardreset code from sata_sff_hardreset() to sata_link_hardreset()
In reply to Tejun Heosata_sff_hardreset() contains link readiness wait logic which isn't SFF specific. Move that part into sata_link_hardreset(), which now takes two more parameters - @online and @check_ready. Both are optional. The former is out parameter for link onlineness after reset. The latter is used to wait for link readiness after hardreset.
Users of sata_link_hardreset() is updated to use new funtionality and ahci_hardreset() is updated to use sata_link_hardreset() instead of sata_sff_hardreset(). This doesn't really cause any behavior change.
--- drivers/ata/ahci.c | 35 ++++++++++++++++++------------- drivers/ata/ata_piix.c | 2 +- drivers/ata/libata-core.c | 50 ++++++++++++++++++++++++++++++++++++++++++++- drivers/ata/libata-pmp.c | 7 +++-- drivers/ata/libata-sff.c | 49 ++++++++------------------------------------ include/linux/libata.h | 10 ++++++++- 6 files changed, 92 insertions(+), 61 deletions(-)
drivers/ata/ahci.c +20 -15
@@ -1343,10 +1343,12 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,static int ahci_hardreset (struct ata_link *link,unsigned int *class,unsigned long deadline) { +const unsigned long *timing =sata_ehc_deb_timing (&link->eh_context);struct ata_port *ap = link->ap;struct ahci_port_priv *pp = ap->private_data;u8 *d2h_fis = pp->rx_fis +RX_FIS_D2H_REG ;struct ata_taskfile tf; +bool online;int rc;DPRINTK ("ENTER\n" );
@@ -1358,14 +1360,14 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class, tf.command =0x80 ;ata_tf_to_fis (&tf,0 ,0 , d2h_fis); - rc =sata_sff_hardreset (link, class, deadline); + rc =sata_link_hardreset (link, timing, deadline, &online, + ahci_check_ready);ahci_start_engine (ap); -if (rc ==0 &&ata_link_online (link)) + *class =ATA_DEV_NONE ; +if (online) *class =ahci_dev_classify (ap); -if (rc != -EAGAIN && *class ==ATA_DEV_UNKNOWN ) - *class =ATA_DEV_NONE ;DPRINTK ("EXIT, rc=%d, class=%u\n" , rc, *class);return rc;
@@ -1376,6 +1378,7 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, {struct ata_port *ap = link->ap;u32 serror; +bool online;int rc;DPRINTK ("ENTER\n" );
@@ -1383,7 +1386,7 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,ahci_stop_engine (ap); rc =sata_link_hardreset (link,sata_ehc_deb_timing (&link->eh_context), - deadline); + deadline, &online,NULL );/* vt8251 needs SError cleared for the port to operate */ ahci_scr_read (ap,SCR_ERROR , &serror);
@@ -1396,7 +1399,8 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,/* vt8251 doesn't clear BSY on signature FIS reception, * request follow-up softreset. */ -return rc ?: -EAGAIN ; + *class =ATA_DEV_NONE ; +return online ? -EAGAIN : rc; } static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
@@ -1406,6 +1410,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,struct ahci_port_priv *pp = ap->private_data;u8 *d2h_fis = pp->rx_fis +RX_FIS_D2H_REG ;struct ata_taskfile tf; +bool online;int rc;ahci_stop_engine (ap);
@@ -1416,13 +1421,10 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,ata_tf_to_fis (&tf,0 ,0 , d2h_fis); rc =sata_link_hardreset (link,sata_ehc_deb_timing (&link->eh_context), - deadline); + deadline, &online,NULL );ahci_start_engine (ap); -if (rc ||ata_link_offline (link)) -return rc; -/* The pseudo configuration device on SIMG4726 attached to * ASUS P5W-DH Deluxe doesn't send signature FIS after * hardreset if no device is attached to the first downstream
@@ -1436,11 +1438,14 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,* have to be reset again. For most cases, this should * suffice while making probing snappish enough. */ - rc =ata_wait_after_reset (link, jiffies +2 *HZ , ahci_check_ready); -if (rc) -ahci_kick_engine (ap,0 ); - -return 0 ; +if (online) { + rc =ata_wait_after_reset (link, jiffies +2 *HZ , + ahci_check_ready); +if (rc) +ahci_kick_engine (ap,0 ); + } + *class =ATA_DEV_NONE ; +return rc; }static void ahci_postreset (struct ata_link *link,unsigned int *class)
drivers/ata/ata_piix.c +1 -1
@@ -1036,7 +1036,7 @@ static int piix_sidpr_hardreset(struct ata_link *link, unsigned int *class,int rc;/* do hardreset */ - rc =sata_link_hardreset (link, timing, deadline); + rc =sata_link_hardreset (link, timing, deadline,NULL ,NULL );if (rc) {ata_link_printk (link,KERN_ERR ,"COMRESET failed (errno=%d)\n" , rc);
drivers/ata/libata-core.c +49 -1
77 lines not on this page · raw message
drivers/ata/libata-pmp.c +4 -3
@@ -239,13 +239,14 @@ int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class, unsigned long deadline) {const unsigned long *timing =sata_ehc_deb_timing (&link->eh_context); +bool online;u32 tmp;int rc;DPRINTK ("ENTER\n" );/* do hardreset */ - rc =sata_link_hardreset (link, timing, deadline); + rc =sata_link_hardreset (link, timing, deadline, &online,NULL );if (rc) {ata_link_printk (link,KERN_ERR ,"COMRESET failed (errno=%d)\n" , rc);
@@ -261,7 +262,7 @@ int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class, }/* if device is present, follow up with srst to wait for !BSY */ -if (ata_link_online (link)) +if (online) rc = -EAGAIN ; out:/* if SCR isn't accessible, we need to reset the PMP */
@@ -916,7 +917,7 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap)* SError.N working. */ sata_link_hardreset (link, sata_deb_timing_normal, - jiffies +ATA_TMOUT_INTERNAL_QUICK ); + jiffies +ATA_TMOUT_INTERNAL_QUICK ,NULL ,NULL );/* unconditionally clear SError.N */ rc =sata_scr_write (link,SCR_ERROR ,SERR_PHYRDY_CHG );
drivers/ata/libata-sff.c +9 -40
59 lines not on this page · raw message
include/linux/libata.h +9 -1
@@ -260,6 +260,13 @@ enum {*/ ATA_WAIT_AFTER_RESET_MSECS =150 , +/* If PMP is supported, we have to do follow-up SRST. As some +* PMPs don't send D2H Reg FIS after hardreset, LLDs are +* advised to wait only for the following duration before +* doing SRST. +*/ +ATA_TMOUT_PMP_SRST_WAIT =1 *HZ , +/* ATA bus states */ BUS_UNKNOWN =0 , BUS_DMA = 1,
@@ -842,7 +849,8 @@ extern int sata_link_debounce(struct ata_link *link,extern int sata_link_resume (struct ata_link *link,const unsigned long *params,unsigned long deadline);extern int sata_link_hardreset (struct ata_link *link, -const unsigned long *timing,unsigned long deadline); +const unsigned long *timing,unsigned long deadline, +bool *online,int (*check_ready)(struct ata_link *));extern void ata_std_postreset (struct ata_link *link,unsigned int *classes);extern void ata_port_disable (struct ata_port *);
Signature · 1 line
1.5.2.4
PATCH 8/27 libata: rename SFF port ops
In reply to Tejun HeoAdd sff_ prefix to SFF specific port ops.
This rename is in preparation of separating SFF support out of libata core layer. This patch strictly renames ops and doesn't introduce any behavior difference.
--- drivers/ata/ahci.c | 6 +- drivers/ata/libata-core.c | 18 +++--- drivers/ata/libata-scsi.c | 2 +- drivers/ata/libata-sff.c | 109 +++++++++++++++++++++-------------------- drivers/ata/pata_bf54x.c | 20 ++++---- drivers/ata/pata_cmd640.c | 2 +- drivers/ata/pata_icside.c | 4 +- drivers/ata/pata_it821x.c | 2 +- drivers/ata/pata_ixp4xx_cf.c | 2 +- drivers/ata/pata_legacy.c | 14 +++--- drivers/ata/pata_mpc52xx.c | 2 +- drivers/ata/pata_ninja32.c | 2 +- drivers/ata/pata_ns87415.c | 8 ++-- drivers/ata/pata_pcmcia.c | 4 +- drivers/ata/pata_platform.c | 2 +- drivers/ata/pata_qdi.c | 2 +- drivers/ata/pata_rb500_cf.c | 4 +- drivers/ata/pata_scc.c | 42 ++++++++-------- drivers/ata/pata_via.c | 2 +- drivers/ata/pata_winbond.c | 2 +- drivers/ata/sata_fsl.c | 6 +- drivers/ata/sata_inic162x.c | 12 ++-- drivers/ata/sata_nv.c | 20 ++++---- drivers/ata/sata_promise.c | 6 +- drivers/ata/sata_sil.c | 6 +- drivers/ata/sata_sil24.c | 6 +- drivers/ata/sata_svw.c | 10 ++-- drivers/ata/sata_sx4.c | 16 +++--- drivers/ata/sata_via.c | 2 +- drivers/ata/sata_vsc.c | 6 +- drivers/scsi/ipr.c | 8 ++-- drivers/scsi/libsas/sas_ata.c | 8 ++-- include/linux/libata.h | 25 +++++----- 33 files changed, 192 insertions(+), 188 deletions(-)
drivers/ata/ahci.c +3 -3
@@ -292,10 +292,10 @@ static struct scsi_host_template ahci_sht = {static struct ata_port_operations ahci_ops = { .inherits = &sata_pmp_port_ops, - .check_status = ahci_check_status, - .check_altstatus = ahci_check_status, + .sff_check_status = ahci_check_status, + .sff_check_altstatus = ahci_check_status, - .tf_read = ahci_tf_read, + .sff_tf_read = ahci_tf_read, .qc_defer = sata_pmp_qc_defer_cmd_switch, .qc_prep = ahci_qc_prep, .qc_issue = ahci_qc_issue,
drivers/ata/libata-core.c +9 -9
@@ -74,7 +74,7 @@ const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };const unsigned long sata_deb_timing_long[] = {100 ,2000 ,5000 };const struct ata_port_operations ata_base_port_ops = { - .irq_clear = ata_noop_irq_clear, + .sff_irq_clear = ata_noop_irq_clear, .prereset = ata_sff_prereset, .hardreset = sata_sff_hardreset, .postreset = ata_sff_postreset,
@@ -85,7 +85,7 @@ const struct ata_port_operations sata_port_ops = { .inherits = &ata_base_port_ops, .qc_defer = ata_std_qc_defer, - .dev_select = ata_noop_dev_select, + .sff_dev_select = ata_noop_dev_select, };const struct ata_port_operations sata_pmp_port_ops = {
@@ -3525,9 +3525,9 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)/* is double-select really necessary? */ if (classes[0 ] !=ATA_DEV_NONE ) - ap->ops->dev_select (ap,1 ); + ap->ops->sff_dev_select (ap,1 );if (classes[1 ] !=ATA_DEV_NONE ) - ap->ops->dev_select (ap,0 ); + ap->ops->sff_dev_select (ap,0 );/* bail out if no device is present */ if (classes[0 ] ==ATA_DEV_NONE && classes[1 ] ==ATA_DEV_NONE ) {
@@ -4338,7 +4338,7 @@ static void fill_result_tf(struct ata_queued_cmd *qc)struct ata_port *ap = qc->ap; qc->result_tf.flags = qc->tf.flags; - ap->ops->tf_read (ap, &qc->result_tf); + ap->ops->sff_tf_read (ap, &qc->result_tf); }static void ata_verify_xfer (struct ata_queued_cmd *qc)
@@ -5997,16 +5997,16 @@ static unsigned int ata_dummy_qc_issue(struct ata_queued_cmd *qc) }struct ata_port_operations ata_dummy_port_ops = { - .check_status = ata_dummy_check_status, - .check_altstatus = ata_dummy_check_status, - .dev_select = ata_noop_dev_select, + .sff_check_status = ata_dummy_check_status, + .sff_check_altstatus = ata_dummy_check_status, + .sff_dev_select = ata_noop_dev_select, .qc_prep = ata_noop_qc_prep, .qc_issue = ata_dummy_qc_issue, .freeze = ata_dummy_noret, .thaw = ata_dummy_noret, .error_handler = ata_dummy_noret, .post_internal_cmd = ata_dummy_qc_noret, - .irq_clear = ata_dummy_noret, + .sff_irq_clear = ata_dummy_noret, .port_start = ata_dummy_ret0, .port_stop = ata_dummy_noret, };
drivers/ata/libata-scsi.c +1 -1
@@ -2393,7 +2393,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)/* FIXME: is this needed? */ memset (cmd->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE ); - ap->ops->tf_read (ap, &qc->tf); + ap->ops->sff_tf_read (ap, &qc->tf);/* fill these in, for the case where they are -not- overwritten */ cmd->sense_buffer[0 ] =0x70 ;
drivers/ata/libata-sff.c +56 -53
328 lines not on this page · raw message
drivers/ata/pata_bf54x.c +10 -10
@@ -1264,7 +1264,7 @@ static void bfin_freeze(struct ata_port *ap)* ATA_NIEN manipulation. Also, many controllers fail to mask * previously pending IRQ on ATA_NIEN assertion. Clear it. */ - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap);bfin_irq_clear (ap); }
@@ -1357,18 +1357,18 @@ static const struct ata_port_operations bfin_pata_ops = { .set_piomode = bfin_set_piomode, .set_dmamode = bfin_set_dmamode, - .tf_load = bfin_tf_load, - .tf_read = bfin_tf_read, - .exec_command = bfin_exec_command, - .check_status = bfin_check_status, - .check_altstatus = bfin_check_altstatus, - .dev_select = bfin_dev_select, + .sff_tf_load = bfin_tf_load, + .sff_tf_read = bfin_tf_read, + .sff_exec_command = bfin_exec_command, + .sff_check_status = bfin_check_status, + .sff_check_altstatus = bfin_check_altstatus, + .sff_dev_select = bfin_dev_select, .bmdma_setup = bfin_bmdma_setup, .bmdma_start = bfin_bmdma_start, .bmdma_stop = bfin_bmdma_stop, .bmdma_status = bfin_bmdma_status, - .data_xfer = bfin_data_xfer, + .sff_data_xfer = bfin_data_xfer, .qc_prep = ata_noop_qc_prep,
@@ -1378,8 +1378,8 @@ static const struct ata_port_operations bfin_pata_ops = { .postreset = bfin_postreset, .post_internal_cmd = bfin_bmdma_stop, - .irq_clear = bfin_irq_clear, - .irq_on = bfin_irq_on, + .sff_irq_clear = bfin_irq_clear, + .sff_irq_on = bfin_irq_on, .port_start = bfin_port_start, .port_stop = bfin_port_stop,
drivers/ata/pata_cmd640.c +1 -1
@@ -172,7 +172,7 @@ static struct scsi_host_template cmd640_sht = {static struct ata_port_operations cmd640_port_ops = { .inherits = &ata_bmdma_port_ops,/* In theory xfer_noirq is not needed once we kill the prefetcher */ - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, .qc_issue = cmd640_qc_issue, .cable_detect = ata_cable_40wire, .set_piomode = cmd640_set_piomode,
drivers/ata/pata_icside.c +2 -2
@@ -250,7 +250,7 @@ static void pata_icside_bmdma_setup(struct ata_queued_cmd *qc)set_dma_mode (state->dma, write ?DMA_MODE_WRITE :DMA_MODE_READ );/* issue r/w command */ - ap->ops->exec_command (ap, &qc->tf); + ap->ops->sff_exec_command (ap, &qc->tf); }static void pata_icside_bmdma_start (struct ata_queued_cmd *qc)
@@ -336,7 +336,7 @@ static struct ata_port_operations pata_icside_port_ops = { .inherits = &ata_sff_port_ops,/* no need to build any PRD tables for DMA */ .qc_prep = ata_noop_qc_prep, - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, .bmdma_setup = pata_icside_bmdma_setup, .bmdma_start = pata_icside_bmdma_start, .bmdma_stop = pata_icside_bmdma_stop,
drivers/ata/pata_it821x.c +1 -1
@@ -652,7 +652,7 @@ static struct ata_port_operations it821x_passthru_port_ops = { .inherits = &ata_bmdma_port_ops, .check_atapi_dma= it821x_check_atapi_dma, - .dev_select = it821x_passthru_dev_select, + .sff_dev_select = it821x_passthru_dev_select, .bmdma_start = it821x_passthru_bmdma_start, .bmdma_stop = it821x_passthru_bmdma_stop, .qc_issue = it821x_passthru_qc_issue,
drivers/ata/pata_ixp4xx_cf.c +1 -1
@@ -93,7 +93,7 @@ static struct scsi_host_template ixp4xx_sht = {static struct ata_port_operations ixp4xx_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = ixp4xx_mmio_data_xfer, + .sff_data_xfer = ixp4xx_mmio_data_xfer, .cable_detect = ata_cable_40wire, .set_mode = ixp4xx_set_mode, };
drivers/ata/pata_legacy.c +7 -7
@@ -226,12 +226,12 @@ static const struct ata_port_operations legacy_base_port_ops = {static struct ata_port_operations simple_port_ops = { .inherits = &legacy_base_port_ops, - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, };static struct ata_port_operations legacy_port_ops = { .inherits = &legacy_base_port_ops, - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, .set_mode = legacy_set_mode, };
@@ -325,7 +325,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_device *dev,static struct ata_port_operations pdc20230_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = pdc20230_set_piomode, - .data_xfer = pdc_data_xfer_vlb, + .sff_data_xfer = pdc_data_xfer_vlb, };/*
@@ -775,19 +775,19 @@ static struct ata_port_operations qdi6500_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = qdi6500_set_piomode, .qc_issue = qdi_qc_issue, - .data_xfer = vlb32_data_xfer, + .sff_data_xfer = vlb32_data_xfer, };static struct ata_port_operations qdi6580_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = qdi6580_set_piomode, - .data_xfer = vlb32_data_xfer, + .sff_data_xfer = vlb32_data_xfer, };static struct ata_port_operations qdi6580dp_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = qdi6580dp_set_piomode, - .data_xfer = vlb32_data_xfer, + .sff_data_xfer = vlb32_data_xfer, };static DEFINE_SPINLOCK (winbond_lock);
@@ -858,7 +858,7 @@ static int winbond_port(struct platform_device *dev,static struct ata_port_operations winbond_port_ops = { .inherits = &legacy_base_port_ops, .set_piomode = winbond_set_piomode, - .data_xfer = vlb32_data_xfer, + .sff_data_xfer = vlb32_data_xfer, };static struct legacy_controller controllers[] = {
drivers/ata/pata_mpc52xx.c +1 -1
@@ -261,7 +261,7 @@ static struct scsi_host_template mpc52xx_ata_sht = {static struct ata_port_operations mpc52xx_ata_port_ops = { .inherits = &ata_sff_port_ops, - .dev_select = mpc52xx_ata_dev_select, + .sff_dev_select = mpc52xx_ata_dev_select, .cable_detect = ata_cable_40wire, .set_piomode = mpc52xx_ata_set_piomode, .post_internal_cmd =ATA_OP_NULL ,
drivers/ata/pata_ninja32.c +1 -1
@@ -84,7 +84,7 @@ static struct scsi_host_template ninja32_sht = {static struct ata_port_operations ninja32_port_ops = { .inherits = &ata_bmdma_port_ops, - .dev_select = ninja32_dev_select, + .sff_dev_select = ninja32_dev_select, .cable_detect = ata_cable_40wire, .set_piomode = ninja32_set_piomode, };
drivers/ata/pata_ns87415.c +4 -4
@@ -138,7 +138,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc) dmactl |=ATA_DMA_WR ;iowrite8 (dmactl, ap->ioaddr.bmdma_addr +ATA_DMA_CMD );/* issue r/w command */ - ap->ops->exec_command (ap, &qc->tf); + ap->ops->sff_exec_command (ap, &qc->tf); }/**
@@ -306,7 +306,7 @@ static struct ata_port_operations ns87415_pata_ops = { .bmdma_setup = ns87415_bmdma_setup, .bmdma_start = ns87415_bmdma_start, .bmdma_stop = ns87415_bmdma_stop, - .irq_clear = ns87415_irq_clear, + .sff_irq_clear = ns87415_irq_clear, .cable_detect = ata_cable_40wire, .set_piomode = ns87415_set_piomode,
@@ -315,8 +315,8 @@ static struct ata_port_operations ns87415_pata_ops = {#if defined(CONFIG_SUPERIO )static struct ata_port_operations ns87560_pata_ops = { .inherits = &ns87415_pata_ops, - .tf_read = ns87560_tf_read, - .check_status = ns87560_check_status, + .sff_tf_read = ns87560_tf_read, + .sff_check_status = ns87560_check_status, .bmdma_status = ns87560_bmdma_status, };#endif
drivers/ata/pata_pcmcia.c +2 -2
@@ -133,14 +133,14 @@ static struct scsi_host_template pcmcia_sht = {static struct ata_port_operations pcmcia_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, .cable_detect = ata_cable_40wire, .set_mode = pcmcia_set_mode, };static struct ata_port_operations pcmcia_8bit_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = ata_data_xfer_8bit, + .sff_data_xfer = ata_data_xfer_8bit, .cable_detect = ata_cable_40wire, .set_mode = pcmcia_set_mode_8bit, };
drivers/ata/pata_platform.c +1 -1
@@ -52,7 +52,7 @@ static struct scsi_host_template pata_platform_sht = {static struct ata_port_operations pata_platform_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, .cable_detect = ata_cable_unknown, .set_mode = pata_platform_set_mode, .port_start =ATA_OP_NULL ,
drivers/ata/pata_qdi.c +1 -1
@@ -160,7 +160,7 @@ static struct scsi_host_template qdi_sht = {static struct ata_port_operations qdi6500_port_ops = { .inherits = &ata_sff_port_ops, .qc_issue = qdi_qc_issue, - .data_xfer = qdi_data_xfer, + .sff_data_xfer = qdi_data_xfer, .cable_detect = ata_cable_40wire, .set_piomode = qdi6500_set_piomode, };
drivers/ata/pata_rb500_cf.c +2 -2
@@ -119,8 +119,8 @@ static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance)static struct ata_port_operations rb500_pata_port_ops = { .inherits = &ata_sff_port_ops, - .exec_command = rb500_pata_exec_command, - .data_xfer = rb500_pata_data_xfer, + .sff_exec_command = rb500_pata_exec_command, + .sff_data_xfer = rb500_pata_data_xfer, .freeze = rb500_pata_freeze, .thaw = rb500_pata_thaw, };
drivers/ata/pata_scc.c +21 -21
111 lines not on this page · raw message
drivers/ata/pata_via.c +1 -1
@@ -336,7 +336,7 @@ static struct ata_port_operations via_port_ops = {static struct ata_port_operations via_port_ops_noirq = { .inherits = &via_port_ops, - .data_xfer = ata_sff_data_xfer_noirq, + .sff_data_xfer = ata_sff_data_xfer_noirq, };/**
drivers/ata/pata_winbond.c +1 -1
@@ -127,7 +127,7 @@ static struct scsi_host_template winbond_sht = {static struct ata_port_operations winbond_port_ops = { .inherits = &ata_sff_port_ops, - .data_xfer = winbond_data_xfer, + .sff_data_xfer = winbond_data_xfer, .cable_detect = ata_cable_40wire, .set_piomode = winbond_set_piomode, };
drivers/ata/sata_fsl.c +3 -3
@@ -1190,10 +1190,10 @@ static struct scsi_host_template sata_fsl_sht = {static const struct ata_port_operations sata_fsl_ops = { .inherits = &sata_port_ops, - .check_status = sata_fsl_check_status, - .check_altstatus = sata_fsl_check_status, + .sff_check_status = sata_fsl_check_status, + .sff_check_altstatus = sata_fsl_check_status, - .tf_read = sata_fsl_tf_read, + .sff_tf_read = sata_fsl_tf_read, .qc_prep = sata_fsl_qc_prep, .qc_issue = sata_fsl_qc_issue,
drivers/ata/sata_inic162x.c +6 -6
@@ -222,7 +222,7 @@ static void inic_bmdma_setup(struct ata_queued_cmd *qc)writeb (pp->cached_prdctl, port_base +PORT_PRD_CTL );/* issue r/w command */ - ap->ops->exec_command (ap, &qc->tf); + ap->ops->sff_exec_command (ap, &qc->tf); }static void inic_bmdma_start (struct ata_queued_cmd *qc)
@@ -267,14 +267,14 @@ static void inic_host_intr(struct ata_port *ap)ata_qc_from_tag (ap, ap->link.active_tag);if (unlikely (!qc || (qc->tf.flags &ATA_TFLAG_POLLING ))) { - ap->ops->check_status (ap);/* clear ATA interrupt */ + ap->ops->sff_check_status (ap);/* clear ATA interrupt */ return ; }if (likely (ata_sff_host_intr (ap, qc)))return ; - ap->ops->check_status (ap);/* clear ATA interrupt */ + ap->ops->sff_check_status (ap);/* clear ATA interrupt */ ata_port_printk (ap,KERN_WARNING ,"unhandled " "interrupt, irq_stat=%x\n" , irq_stat);return ;
@@ -351,7 +351,7 @@ static unsigned int inic_qc_issue(struct ata_queued_cmd *qc)*/ if (unlikely (qc->tf.command ==ATA_CMD_ID_ATA || qc->tf.command ==ATA_CMD_ID_ATAPI )) { -u8 stat = ap->ops->check_status (ap); +u8 stat = ap->ops->sff_check_status (ap);if (stat ==0x7f || stat ==0xff )return AC_ERR_HSM ; }
@@ -365,7 +365,7 @@ static void inic_freeze(struct ata_port *ap)__inic_set_pirq_mask (ap,PIRQ_MASK_FREEZE ); - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap);writeb (0xff , port_base +PORT_IRQ_STAT );readb (port_base +PORT_IRQ_STAT );/* flush */
@@ -375,7 +375,7 @@ static void inic_thaw(struct ata_port *ap) {void __iomem *port_base =inic_port_base (ap); - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap);writeb (0xff , port_base +PORT_IRQ_STAT );__inic_set_pirq_mask (ap,PIRQ_MASK_OTHER );
drivers/ata/sata_nv.c +10 -10
@@ -429,11 +429,11 @@ static struct ata_port_operations nv_adma_ops = { .inherits = &nv_generic_ops, .check_atapi_dma = nv_adma_check_atapi_dma, - .tf_read = nv_adma_tf_read, + .sff_tf_read = nv_adma_tf_read, .qc_defer = ata_std_qc_defer, .qc_prep = nv_adma_qc_prep, .qc_issue = nv_adma_qc_issue, - .irq_clear = nv_adma_irq_clear, + .sff_irq_clear = nv_adma_irq_clear, .freeze = nv_adma_freeze, .thaw = nv_adma_thaw,
@@ -1440,7 +1440,7 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance)else // No request pending? Clear interrupt status // anyway, in case there's one pending. - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap); } }
@@ -1739,7 +1739,7 @@ static void nv_swncq_ncq_stop(struct ata_port *ap) pp->dhfis_bits, pp->dmafis_bits, pp->sdbfis_bits);ata_port_printk (ap,KERN_ERR ,"ATA_REG 0x%X ERR_REG 0x%X\n" , - ap->ops->check_status (ap), + ap->ops->sff_check_status (ap),ioread8 (ap->ioaddr.error_addr)); sactive =readl (pp->sactive_block);
@@ -1765,7 +1765,7 @@ static void nv_swncq_ncq_stop(struct ata_port *ap) }nv_swncq_pp_reinit (ap); - ap->ops->irq_clear (ap); + ap->ops->sff_irq_clear (ap);__ata_bmdma_stop (ap);nv_swncq_irq_clear (ap,0xffff ); }
@@ -1987,8 +1987,8 @@ static unsigned int nv_swncq_issue_atacmd(struct ata_port *ap, pp->dmafis_bits &= ~(1 << qc->tag); pp->qc_active |= (0x1 << qc->tag); - ap->ops->tf_load (ap, &qc->tf);/* load tf registers */ - ap->ops->exec_command (ap, &qc->tf); + ap->ops->sff_tf_load (ap, &qc->tf);/* load tf registers */ + ap->ops->sff_exec_command (ap, &qc->tf);DPRINTK ("Issued tag %u\n" , qc->tag);
@@ -2060,7 +2060,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)return -EINVAL ; } - ap->ops->irq_clear (ap); + ap->ops->sff_irq_clear (ap);__ata_bmdma_stop (ap); sactive =readl (pp->sactive_block);
@@ -2182,7 +2182,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)u8 ata_stat;int rc =0 ; - ata_stat = ap->ops->check_status (ap); + ata_stat = ap->ops->sff_check_status (ap);nv_swncq_irq_clear (ap, fis);if (!fis)return ;
@@ -2245,7 +2245,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)if (!(fis &NV_SWNCQ_IRQ_DMASETUP ) && !(pp->ncq_flags & ncq_saw_dmas)) { - ata_stat = ap->ops->check_status (ap); + ata_stat = ap->ops->sff_check_status (ap);if (ata_stat &ATA_BUSY ) goto irq_exit;
drivers/ata/sata_promise.c +3 -3
@@ -162,12 +162,12 @@ static struct scsi_host_template pdc_ata_sht = {static const struct ata_port_operations pdc_common_ops = { .inherits = &ata_sff_port_ops, - .tf_load = pdc_tf_load_mmio, - .exec_command = pdc_exec_command_mmio, + .sff_tf_load = pdc_tf_load_mmio, + .sff_exec_command = pdc_exec_command_mmio, .check_atapi_dma = pdc_check_atapi_dma, .qc_prep = pdc_qc_prep, .qc_issue = pdc_qc_issue, - .irq_clear = pdc_irq_clear, + .sff_irq_clear = pdc_irq_clear, .post_internal_cmd = pdc_post_internal_cmd, .error_handler = pdc_error_handler,
drivers/ata/sata_sil.c +3 -3
@@ -369,7 +369,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)if (unlikely (!qc || (qc->tf.flags &ATA_TFLAG_POLLING ))) {/* this sometimes happens, just clear IRQ */ - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap);return ; }
@@ -405,7 +405,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) }/* check main status, clearing INTRQ */ - status = ap->ops->check_status (ap); + status = ap->ops->sff_check_status (ap);if (unlikely (status &ATA_BUSY )) goto err_hsm;
@@ -480,7 +480,7 @@ static void sil_thaw(struct ata_port *ap)u32 tmp;/* clear IRQ */ - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap);ata_sff_irq_clear (ap);/* turn on SATA IRQ if supported */
drivers/ata/sata_sil24.c +3 -3
@@ -401,9 +401,9 @@ static struct scsi_host_template sil24_sht = {static struct ata_port_operations sil24_ops = { .inherits = &sata_pmp_port_ops, - .check_status = sil24_check_status, - .check_altstatus = sil24_check_status, - .tf_read = sil24_tf_read, + .sff_check_status = sil24_check_status, + .sff_check_altstatus = sil24_check_status, + .sff_tf_read = sil24_tf_read, .qc_defer = sil24_qc_defer, .qc_prep = sil24_qc_prep, .qc_issue = sil24_qc_issue,
drivers/ata/sata_svw.c +5 -5
@@ -233,7 +233,7 @@ static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc)/* issue r/w command if this is not a ATA DMA command*/ if (qc->tf.protocol !=ATA_PROT_DMA ) - ap->ops->exec_command (ap, &qc->tf); + ap->ops->sff_exec_command (ap, &qc->tf); }/**
@@ -269,7 +269,7 @@ static void k2_bmdma_start_mmio(struct ata_queued_cmd *qc)and the start command. */ /* issue r/w command if the access is to ATA*/ if (qc->tf.protocol ==ATA_PROT_DMA ) - ap->ops->exec_command (ap, &qc->tf); + ap->ops->sff_exec_command (ap, &qc->tf); }
@@ -336,9 +336,9 @@ static struct scsi_host_template k2_sata_sht = {static struct ata_port_operations k2_sata_ops = { .inherits = &ata_bmdma_port_ops, - .tf_load = k2_sata_tf_load, - .tf_read = k2_sata_tf_read, - .check_status = k2_stat_check_status, + .sff_tf_load = k2_sata_tf_load, + .sff_tf_read = k2_sata_tf_read, + .sff_check_status = k2_stat_check_status, .check_atapi_dma = k2_sata_check_atapi_dma, .bmdma_setup = k2_bmdma_setup_mmio, .bmdma_start = k2_bmdma_start_mmio,
drivers/ata/sata_sx4.c +8 -8
@@ -243,18 +243,18 @@ static struct scsi_host_template pdc_sata_sht = {/* TODO: inherit from base port_ops after converting to new EH */ static struct ata_port_operations pdc_20621_ops = { - .tf_load = pdc_tf_load_mmio, - .tf_read = ata_sff_tf_read, - .check_status = ata_sff_check_status, - .exec_command = pdc_exec_command_mmio, - .dev_select = ata_sff_dev_select, + .sff_tf_load = pdc_tf_load_mmio, + .sff_tf_read = ata_sff_tf_read, + .sff_check_status = ata_sff_check_status, + .sff_exec_command = pdc_exec_command_mmio, + .sff_dev_select = ata_sff_dev_select, .phy_reset = pdc_20621_phy_reset, .qc_prep = pdc20621_qc_prep, .qc_issue = pdc20621_qc_issue, - .data_xfer = ata_sff_data_xfer, + .sff_data_xfer = ata_sff_data_xfer, .eng_timeout = pdc_eng_timeout, - .irq_clear = pdc20621_irq_clear, - .irq_on = ata_sff_irq_on, + .sff_irq_clear = pdc20621_irq_clear, + .sff_irq_on = ata_sff_irq_on, .port_start = pdc_port_start, };
drivers/ata/sata_via.c +1 -1
@@ -173,7 +173,7 @@ static void svia_noop_freeze(struct ata_port *ap)/* Some VIA controllers choke if ATA_NIEN is manipulated in * certain way. Leave it alone and just clear pending IRQ. */ - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap);ata_sff_irq_clear (ap); }
drivers/ata/sata_vsc.c +3 -3
@@ -251,7 +251,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)* simply clear the interrupt */ if (unlikely (!handled)) - ap->ops->check_status (ap); + ap->ops->sff_check_status (ap); }/*
@@ -306,8 +306,8 @@ static struct scsi_host_template vsc_sata_sht = {static struct ata_port_operations vsc_sata_ops = { .inherits = &ata_bmdma_port_ops, - .tf_load = vsc_sata_tf_load, - .tf_read = vsc_sata_tf_read, + .sff_tf_load = vsc_sata_tf_load, + .sff_tf_read = vsc_sata_tf_read, .freeze = vsc_freeze, .thaw = vsc_thaw, .scr_read = vsc_sata_scr_read,
drivers/scsi/ipr.c +4 -4
@@ -5271,13 +5271,13 @@ static u8 ipr_ata_check_altstatus(struct ata_port *ap) }static struct ata_port_operations ipr_sata_ops = { - .check_status = ipr_ata_check_status, - .check_altstatus = ipr_ata_check_altstatus, - .dev_select = ata_noop_dev_select, + .sff_check_status = ipr_ata_check_status, + .sff_check_altstatus = ipr_ata_check_altstatus, + .sff_dev_select = ata_noop_dev_select, .phy_reset = ipr_ata_phy_reset, .hardreset = ipr_sata_reset, .post_internal_cmd = ipr_ata_post_internal, - .tf_read = ipr_tf_read, + .sff_tf_read = ipr_tf_read, .qc_prep = ata_noop_qc_prep, .qc_issue = ipr_qc_issue, .port_start = ata_sas_port_start,
drivers/scsi/libsas/sas_ata.c +4 -4
@@ -348,12 +348,12 @@ static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in, }static struct ata_port_operations sas_sata_ops = { - .check_status = sas_ata_check_status, - .check_altstatus = sas_ata_check_status, - .dev_select = ata_noop_dev_select, + .sff_check_status = sas_ata_check_status, + .sff_check_altstatus = sas_ata_check_status, + .sff_dev_select = ata_noop_dev_select, .phy_reset = sas_ata_phy_reset, .post_internal_cmd = sas_ata_post_internal, - .tf_read = sas_ata_tf_read, + .sff_tf_read = sas_ata_tf_read, .qc_prep = ata_noop_qc_prep, .qc_issue = sas_ata_qc_issue, .port_start = ata_sas_port_start,
include/linux/libata.h +13 -12
@@ -741,17 +741,18 @@ struct ata_port_operations {/* * SFF / taskfile oriented ops */ -void (*dev_select)(struct ata_port *ap,unsigned int device); -u8 (*check_status)(struct ata_port *ap); -u8 (*check_altstatus)(struct ata_port *ap); -void (*tf_load)(struct ata_port *ap,const struct ata_taskfile *tf); -void (*tf_read)(struct ata_port *ap,struct ata_taskfile *tf); -void (*exec_command)(struct ata_port *ap,const struct ata_taskfile *tf); -unsigned int (*data_xfer)(struct ata_device *dev,unsigned char *buf, -unsigned int buflen,int rw); -u8 (*irq_on)(struct ata_port *); - -void (*irq_clear)(struct ata_port *); +void (*sff_dev_select)(struct ata_port *ap,unsigned int device); +u8 (*sff_check_status)(struct ata_port *ap); +u8 (*sff_check_altstatus)(struct ata_port *ap); +void (*sff_tf_load)(struct ata_port *ap,const struct ata_taskfile *tf); +void (*sff_tf_read)(struct ata_port *ap,struct ata_taskfile *tf); +void (*sff_exec_command)(struct ata_port *ap, +const struct ata_taskfile *tf); +unsigned int (*sff_data_xfer)(struct ata_device *dev, +unsigned char *buf,unsigned int buflen,int rw); +u8 (*sff_irq_on)(struct ata_port *); +void (*sff_irq_clear)(struct ata_port *); +void (*bmdma_setup)(struct ata_queued_cmd *qc);void (*bmdma_start)(struct ata_queued_cmd *qc);void (*bmdma_stop)(struct ata_queued_cmd *qc);
@@ -1456,7 +1457,7 @@ static inline u8 ata_sff_busy_wait(struct ata_port *ap, unsigned int bits,do {udelay (10 ); - status = ap->ops->check_status (ap); + status = ap->ops->sff_check_status (ap); max--; }while (status !=0xff && (status & bits) && (max >0 ));
Signature · 1 line
1.5.2.4
PATCH 20/27 libata: add qc_fill_rtf port operation
In reply to Tejun HeoOn command completion, ata_qc_complete() directly called ops->tf_read to fill qc->result_tf. This patch adds ops->qc_fill_rtf to replace hardcoded ops->tf_read usage.
ata_sff_qc_fill_rtf() which uses ops->tf_read to fill result_tf is implemented and set in ata_base_port_ops and other ops tables which don't inherit from ata_base_port_ops, so this patch doesn't introduce any behavior change.
ops->qc_fill_rtf() is similar to ops->sff_tf_read() but can only be called when a command finishes. As some non-SFF controllers don't have TF registers defined unless they're associated with in-flight commands, this limited operation makes life easier for those drivers and help lifting SFF assumptions from libata core layer.
--- drivers/ata/libata-core.c | 3 ++- drivers/ata/libata-sff.c | 20 ++++++++++++++++++++ drivers/ata/sata_sx4.c | 1 + drivers/scsi/ipr.c | 1 + drivers/scsi/libsas/sas_ata.c | 1 + include/linux/libata.h | 2 ++ 6 files changed, 27 insertions(+), 1 deletions(-)
drivers/ata/libata-core.c +2 -1
@@ -74,6 +74,7 @@ const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };const unsigned long sata_deb_timing_long[] = {100 ,2000 ,5000 };const struct ata_port_operations ata_base_port_ops = { + .qc_fill_rtf = ata_sff_qc_fill_rtf, .prereset = ata_std_prereset, .postreset = ata_std_postreset, .error_handler = ata_std_error_handler,
@@ -4484,7 +4485,7 @@ static void fill_result_tf(struct ata_queued_cmd *qc)struct ata_port *ap = qc->ap; qc->result_tf.flags = qc->tf.flags; - ap->ops->sff_tf_read (ap, &qc->result_tf); + ap->ops->qc_fill_rtf (qc); }static void ata_verify_xfer (struct ata_queued_cmd *qc)
drivers/ata/libata-sff.c +20 -0
@@ -1408,6 +1408,25 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) }/** +* ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read +* @qc: qc to fill result TF for +* +* @qc is finished and result TF needs to be filled. Fill it +* using ->sff_tf_read. +* +* LOCKING: +* spin_lock_irqsave(host lock) +* +* RETURNS: +* true indicating that result TF is successfully filled. +*/ +bool ata_sff_qc_fill_rtf (struct ata_queued_cmd *qc) +{ + qc->ap->ops->sff_tf_read (qc->ap, &qc->result_tf); +return true; +} + +/** * ata_sff_host_intr - Handle host interrupt for given (port, task) * @ap: Port on which interrupt arrived (possibly...) * @qc: Taskfile currently active in engine
@@ -2724,6 +2743,7 @@ EXPORT_SYMBOL_GPL(ata_sff_irq_on);EXPORT_SYMBOL_GPL (ata_sff_irq_clear);EXPORT_SYMBOL_GPL (ata_sff_hsm_move);EXPORT_SYMBOL_GPL (ata_sff_qc_issue); +EXPORT_SYMBOL_GPL (ata_sff_qc_fill_rtf);EXPORT_SYMBOL_GPL (ata_sff_host_intr);EXPORT_SYMBOL_GPL (ata_sff_interrupt);EXPORT_SYMBOL_GPL (ata_sff_freeze);
drivers/ata/sata_sx4.c +1 -0
@@ -251,6 +251,7 @@ static struct ata_port_operations pdc_20621_ops = { .phy_reset = pdc_20621_phy_reset, .qc_prep = pdc20621_qc_prep, .qc_issue = pdc20621_qc_issue, + .qc_fill_rtf = ata_sff_qc_fill_rtf, .sff_data_xfer = ata_sff_data_xfer, .eng_timeout = pdc_eng_timeout, .sff_irq_clear = pdc20621_irq_clear,
drivers/scsi/ipr.c +1 -0
@@ -5280,6 +5280,7 @@ static struct ata_port_operations ipr_sata_ops = { .sff_tf_read = ipr_tf_read, .qc_prep = ata_noop_qc_prep, .qc_issue = ipr_qc_issue, + .qc_fill_rtf = ata_sff_qc_fill_rtf, .port_start = ata_sas_port_start, .port_stop = ata_sas_port_stop };
drivers/scsi/libsas/sas_ata.c +1 -0
@@ -356,6 +356,7 @@ static struct ata_port_operations sas_sata_ops = { .sff_tf_read = sas_ata_tf_read, .qc_prep = ata_noop_qc_prep, .qc_issue = sas_ata_qc_issue, + .qc_fill_rtf = ata_sff_qc_fill_rtf, .port_start = ata_sas_port_start, .port_stop = ata_sas_port_stop, .scr_read = sas_ata_scr_read,
include/linux/libata.h +2 -0
@@ -713,6 +713,7 @@ struct ata_port_operations {int (*check_atapi_dma)(struct ata_queued_cmd *qc);void (*qc_prep)(struct ata_queued_cmd *qc);unsigned int (*qc_issue)(struct ata_queued_cmd *qc); +bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);/* * Configuration and exception handling
@@ -1403,6 +1404,7 @@ 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 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,struct ata_queued_cmd *qc);extern irqreturn_t ata_sff_interrupt (int irq,void *dev_instance);
Signature · 1 line
1.5.2.4
PATCH 22/27 libata: replace tf_read with qc_fill_rtf for non-SFF drivers
In reply to Tejun HeoNow that all SFF stuff is separated out of core layer, core layer doesn't call ops->tf_read directly. It gets called only via ops->qc_fill_rtf() for non-SFF drivers. This patch directly implements private ops->qc_fill_rtf() for non-SFF controllers and kill ops->tf_read().
This is much cleaner for non-SFF controllers as some of them have to cache SFF register values in private data structure and report the cached values via ops->tf_read(). Also, ops->tf_read() gets nasty for controllers which don't have clear notion of TF registers when operation is not in progress.
As this change makes default ops->qc_fill_rtf unnecessary, move ata_sff_qc_fill_rtf() form ata_base_port_ops to ata_sff_port_ops where it belongs.
--- drivers/ata/ahci.c | 21 +++++++------- drivers/ata/libata-core.c | 1 - drivers/ata/libata-sff.c | 1 + drivers/ata/sata_fsl.c | 24 ++++++++++------ drivers/ata/sata_sil24.c | 8 ----- drivers/scsi/ipr.c | 59 +++++++++++++++++++++-------------------- drivers/scsi/libsas/sas_ata.c | 17 ++++++----- 7 files changed, 66 insertions(+), 65 deletions(-)
drivers/ata/ahci.c +11 -10
@@ -243,9 +243,9 @@ static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);static int ahci_scr_write (struct ata_port *ap,unsigned int sc_reg,u32 val);static int ahci_init_one (struct pci_dev *pdev,const struct pci_device_id *ent);static unsigned int ahci_qc_issue (struct ata_queued_cmd *qc); +static bool ahci_qc_fill_rtf (struct ata_queued_cmd *qc);static int ahci_port_start (struct ata_port *ap);static void ahci_port_stop (struct ata_port *ap); -static void ahci_tf_read (struct ata_port *ap,struct ata_taskfile *tf);static void ahci_qc_prep (struct ata_queued_cmd *qc);static u8 ahci_check_status (struct ata_port *ap);static void ahci_freeze (struct ata_port *ap);
@@ -295,10 +295,10 @@ static struct ata_port_operations ahci_ops = { .sff_check_status = ahci_check_status, .sff_check_altstatus = ahci_check_status, - .sff_tf_read = ahci_tf_read, .qc_defer = sata_pmp_qc_defer_cmd_switch, .qc_prep = ahci_qc_prep, .qc_issue = ahci_qc_issue, + .qc_fill_rtf = ahci_qc_fill_rtf, .freeze = ahci_freeze, .thaw = ahci_thaw,
@@ -1473,14 +1473,6 @@ static u8 ahci_check_status(struct ata_port *ap)return readl (mmio +PORT_TFDATA ) &0xFF ; } -static void ahci_tf_read (struct ata_port *ap,struct ata_taskfile *tf) -{ -struct ahci_port_priv *pp = ap->private_data; -u8 *d2h_fis = pp->rx_fis +RX_FIS_D2H_REG ; - -ata_tf_from_fis (d2h_fis, tf); -} -static unsigned int ahci_fill_sg (struct ata_queued_cmd *qc,void *cmd_tbl) {struct scatterlist *sg;
@@ -1779,6 +1771,15 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)return 0 ; } +static bool ahci_qc_fill_rtf (struct ata_queued_cmd *qc) +{ +struct ahci_port_priv *pp = qc->ap->private_data; +u8 *d2h_fis = pp->rx_fis +RX_FIS_D2H_REG ; + +ata_tf_from_fis (d2h_fis, &qc->result_tf); +return true; +} +static void ahci_freeze (struct ata_port *ap) {void __iomem *port_mmio =ahci_port_base (ap);
drivers/ata/libata-core.c +0 -1
@@ -74,7 +74,6 @@ const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };const unsigned long sata_deb_timing_long[] = {100 ,2000 ,5000 };const struct ata_port_operations ata_base_port_ops = { - .qc_fill_rtf = ata_sff_qc_fill_rtf, .prereset = ata_std_prereset, .postreset = ata_std_postreset, .error_handler = ata_std_error_handler,
drivers/ata/libata-sff.c +1 -0
@@ -44,6 +44,7 @@ const struct ata_port_operations ata_sff_port_ops = { .qc_prep = ata_sff_qc_prep, .qc_issue = ata_sff_qc_issue, + .qc_fill_rtf = ata_sff_qc_fill_rtf, .freeze = ata_sff_freeze, .thaw = ata_sff_thaw,
drivers/ata/sata_fsl.c +15 -9
@@ -464,6 +464,20 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc)return 0 ; } +static bool sata_fsl_qc_fill_rtf (struct ata_queued_cmd *qc) +{ +struct sata_fsl_port_priv *pp = qc->ap->private_data; +struct sata_fsl_host_priv *host_priv = qc->ap->host->private_data; +void __iomem *hcr_base = host_priv->hcr_base; +unsigned int tag =sata_fsl_tag (qc->tag, hcr_base); +struct command_desc *cd; + + cd = pp->cmdentry + tag; + +ata_tf_from_fis (cd->sfis, &qc->result_tf); +return true; +} +static int sata_fsl_scr_write (struct ata_port *ap,unsigned int sc_reg_in,u32 val) {
@@ -580,13 +594,6 @@ static u8 sata_fsl_check_status(struct ata_port *ap)return pp->tf.command; } -static void sata_fsl_tf_read (struct ata_port *ap,struct ata_taskfile *tf) -{ -struct sata_fsl_port_priv *pp = ap->private_data; - - *tf = pp->tf; -} -static int sata_fsl_port_start (struct ata_port *ap) {struct device *dev = ap->host->dev;
@@ -1193,10 +1200,9 @@ static const struct ata_port_operations sata_fsl_ops = { .sff_check_status = sata_fsl_check_status, .sff_check_altstatus = sata_fsl_check_status, - .sff_tf_read = sata_fsl_tf_read, - .qc_prep = sata_fsl_qc_prep, .qc_issue = sata_fsl_qc_issue, + .qc_fill_rtf = sata_fsl_qc_fill_rtf, .scr_read = sata_fsl_scr_read, .scr_write = sata_fsl_scr_write,
drivers/ata/sata_sil24.c +0 -8
@@ -344,7 +344,6 @@ static void sil24_dev_config(struct ata_device *dev);static u8 sil24_check_status (struct ata_port *ap);static int sil24_scr_read (struct ata_port *ap,unsigned sc_reg,u32 *val);static int sil24_scr_write (struct ata_port *ap,unsigned sc_reg,u32 val); -static void sil24_tf_read (struct ata_port *ap,struct ata_taskfile *tf);static int sil24_qc_defer (struct ata_queued_cmd *qc);static void sil24_qc_prep (struct ata_queued_cmd *qc);static unsigned int sil24_qc_issue (struct ata_queued_cmd *qc);
@@ -404,7 +403,6 @@ static struct ata_port_operations sil24_ops = { .sff_check_status = sil24_check_status, .sff_check_altstatus = sil24_check_status, - .sff_tf_read = sil24_tf_read, .qc_defer = sil24_qc_defer, .qc_prep = sil24_qc_prep, .qc_issue = sil24_qc_issue,
@@ -533,12 +531,6 @@ static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val)return -EINVAL ; } -static void sil24_tf_read (struct ata_port *ap,struct ata_taskfile *tf) -{ -struct sil24_port_priv *pp = ap->private_data; - *tf = pp->tf; -} -static void sil24_config_port (struct ata_port *ap) {void __iomem *port = ap->ioaddr.cmd_addr;
drivers/scsi/ipr.c +30 -29
79 lines not on this page · raw message
drivers/scsi/libsas/sas_ata.c +9 -8
@@ -225,6 +225,14 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)return 0 ; } +static bool sas_ata_qc_fill_rtf (struct ata_queued_cmd *qc) +{ +struct domain_device *dev = qc->ap->private_data; + +memcpy (&qc->result_tf, &dev->sata_dev.tf,sizeof (qc->result_tf)); +return true; +} +static u8 sas_ata_check_status (struct ata_port *ap) {struct domain_device *dev = ap->private_data;
@@ -292,12 +300,6 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc) } } -static void sas_ata_tf_read (struct ata_port *ap,struct ata_taskfile *tf) -{ -struct domain_device *dev = ap->private_data; -memcpy (tf, &dev->sata_dev.tf,sizeof (*tf)); -} -static int sas_ata_scr_write (struct ata_port *ap,unsigned int sc_reg_in,u32 val) {
@@ -353,10 +355,9 @@ static struct ata_port_operations sas_sata_ops = { .sff_dev_select = ata_noop_dev_select, .phy_reset = sas_ata_phy_reset, .post_internal_cmd = sas_ata_post_internal, - .sff_tf_read = sas_ata_tf_read, .qc_prep = ata_noop_qc_prep, .qc_issue = sas_ata_qc_issue, - .qc_fill_rtf = ata_sff_qc_fill_rtf, + .qc_fill_rtf = sas_ata_qc_fill_rtf, .port_start = ata_sas_port_start, .port_stop = ata_sas_port_stop, .scr_read = sas_ata_scr_read,
Signature · 1 line
1.5.2.4
PATCH 5/27 libata: kill ata_chk_status() call from ata_dev_configure()
In reply to Tejun Heoata_dev_configure() isn't tied to any controller interface except for the probe debug message printing at the end of the function. Kill the message.
This is to help separating out SFF support from core layer.
--- drivers/ata/libata-core.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/ata/libata-core.c +0 -3
@@ -2369,9 +2369,6 @@ int ata_dev_configure(struct ata_device *dev) } } -if (ata_msg_probe (ap)) -ata_dev_printk (dev,KERN_DEBUG ,"%s: EXIT, drv_stat = 0x%x\n" , - __func__,ata_chk_status (ap));return 0 ; err_out_nosup:
Signature · 1 line
1.5.2.4
PATCH 19/27 libata: unify mechanism to request follow-up SRST
In reply to Tejun HeoPreviously, there were two ways to trigger follow-up SRST from hardreset method - returning -EAGAIN and leaving all device classes unmodified. Drivers never used the latter mechanism and the only use case for the former was when hardreset couldn't classify.
Drop the latter mechanism and let -EAGAIN mean "perform follow-up SRST if classification is required". This change removes unnecessary follow-up SRSTs and simplifies reset implementations.
--- drivers/ata/ahci.c | 3 --- drivers/ata/libata-core.c | 1 - drivers/ata/libata-eh.c | 26 ++++++++------------------ drivers/ata/libata-sff.c | 1 - 4 files changed, 8 insertions(+), 23 deletions(-)
drivers/ata/ahci.c +0 -3
@@ -1365,7 +1365,6 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,ahci_start_engine (ap); - *class =ATA_DEV_NONE ;if (online) *class =ahci_dev_classify (ap);
@@ -1394,7 +1393,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,/* vt8251 doesn't clear BSY on signature FIS reception, * request follow-up softreset. */ - *class =ATA_DEV_NONE ;return online ? -EAGAIN : rc; }
@@ -1439,7 +1437,6 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,if (rc)ahci_kick_engine (ap,0 ); } - *class =ATA_DEV_NONE ;return rc; }
drivers/ata/libata-core.c +0 -1
@@ -3663,7 +3663,6 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,/* do hardreset */ rc =sata_link_hardreset (link, timing, deadline, &online,NULL ); - *class =ATA_DEV_NONE ;return online ? -EAGAIN : rc; }
drivers/ata/libata-eh.c +8 -18
@@ -2050,20 +2050,10 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,if (rc)return rc; -/* If any class isn't ATA_DEV_UNKNOWN, consider classification -* is complete and convert all ATA_DEV_UNKNOWN to -* ATA_DEV_NONE. -*/ +/* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ ata_link_for_each_dev (dev, link) -if (classes[dev->devno] !=ATA_DEV_UNKNOWN ) -break ; - -if (dev) { -ata_link_for_each_dev (dev, link) { -if (classes[dev->devno] ==ATA_DEV_UNKNOWN ) - classes[dev->devno] =ATA_DEV_NONE ; - } - } +if (classes[dev->devno] ==ATA_DEV_UNKNOWN ) + classes[dev->devno] =ATA_DEV_NONE ;return 0 ; }
@@ -2074,15 +2064,15 @@ static int ata_eh_followup_srst_needed(struct ata_link *link, {if (link->flags &ATA_LFLAG_NO_SRST )return 0 ; -if (rc == -EAGAIN ) -return 1 ; +if (rc == -EAGAIN ) { +if (classify) +return 1 ; + rc =0 ; + }if (rc !=0 )return 0 ;if ((link->ap->flags &ATA_FLAG_PMP ) &&ata_is_host_link (link))return 1 ; -if (classify && !(link->flags &ATA_LFLAG_ASSUME_CLASS ) && - classes[0 ] ==ATA_DEV_UNKNOWN ) -return 1 ;return 0 ; }
drivers/ata/libata-sff.c +0 -1
@@ -1929,7 +1929,6 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class, rc =sata_link_hardreset (link, timing, deadline, &online, ata_sff_check_ready); - *class =ATA_DEV_NONE ;if (online) *class =ata_sff_dev_classify (link->device,1 ,NULL );
Signature · 1 line
1.5.2.4
PATCH 14/27 ahci: use ata_wait_after_reset() instead of ata_sff_wait_ready()
In reply to Tejun HeoImplement ahci_check_ready() and replace ata_sff_wait_after_reset() with ata_wait_after_reset(). As ahci was faking TF access, this change doesn't result in any functional difference.
--- drivers/ata/ahci.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
drivers/ata/ahci.c +12 -2
@@ -1256,6 +1256,16 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,return 0 ; } +static int ahci_check_ready (struct ata_link *link) +{ +void __iomem *mmio = link->ap->ioaddr.cmd_addr; +u8 status =readl (mmio +PORT_TFDATA ) &0xFF ; + +if (!(status &ATA_BUSY )) +return 1 ; +return 0 ; +} +static int ahci_do_softreset (struct ata_link *link,unsigned int *class,int pmp,unsigned long deadline) {
@@ -1303,7 +1313,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class,ahci_exec_polled_cmd (ap, pmp, &tf,0 ,0 ,0 );/* wait for link to become ready */ - rc =ata_sff_wait_after_reset (link,1 , deadline); + rc =ata_wait_after_reset (link, deadline, ahci_check_ready);/* link occupied, -ENODEV too is an error */ if (rc) { reason ="device not ready" ;
@@ -1426,7 +1436,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,* have to be reset again. For most cases, this should * suffice while making probing snappish enough. */ - rc =ata_sff_wait_after_reset (link,1 , jiffies +2 *HZ ); + rc =ata_wait_after_reset (link, jiffies +2 *HZ , ahci_check_ready);if (rc)ahci_kick_engine (ap,0 );
Signature · 1 line
1.5.2.4
PATCH 23/27 libata: remove check_status from non-SFF drivers
In reply to Tejun HeoNow that all SFF stuff is separated out of core layer, core layer doesn't call ops->[alt_]check_status(). In fact, no one calls them for non-SFF drivers anymore. Kill them.
--- drivers/ata/ahci.c | 14 +-------- drivers/ata/sata_fsl.c | 60 +++-------------------------------------- drivers/ata/sata_sil24.c | 17 +---------- drivers/scsi/ipr.c | 28 ------------------- drivers/scsi/libsas/sas_ata.c | 8 ----- 5 files changed, 8 insertions(+), 119 deletions(-)
drivers/ata/ahci.c +2 -12
@@ -247,7 +247,6 @@ static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc);static int ahci_port_start (struct ata_port *ap);static void ahci_port_stop (struct ata_port *ap);static void ahci_qc_prep (struct ata_queued_cmd *qc); -static u8 ahci_check_status (struct ata_port *ap);static void ahci_freeze (struct ata_port *ap);static void ahci_thaw (struct ata_port *ap);static void ahci_pmp_attach (struct ata_port *ap);
@@ -292,9 +291,6 @@ static struct scsi_host_template ahci_sht = {static struct ata_port_operations ahci_ops = { .inherits = &sata_pmp_port_ops, - .sff_check_status = ahci_check_status, - .sff_check_altstatus = ahci_check_status, - .qc_defer = sata_pmp_qc_defer_cmd_switch, .qc_prep = ahci_qc_prep, .qc_issue = ahci_qc_issue,
@@ -1185,11 +1181,12 @@ static int ahci_kick_engine(struct ata_port *ap, int force_restart) {void __iomem *port_mmio = ap->ioaddr.cmd_addr;struct ahci_host_priv *hpriv = ap->host->private_data; +u8 status =readl (port_mmio +PORT_TFDATA ) &0xFF ;u32 tmp;int busy, rc;/* do we need to kick the port? */ - busy =ahci_check_status (ap) & (ATA_BUSY |ATA_DRQ ); + busy = status & (ATA_BUSY |ATA_DRQ );if (!busy && !force_restart)return 0 ;
@@ -1466,13 +1463,6 @@ static int ahci_pmp_softreset(struct ata_link *link, unsigned int *class,return ahci_do_softreset (link, class, link->pmp, deadline); } -static u8 ahci_check_status (struct ata_port *ap) -{ -void __iomem *mmio = ap->ioaddr.cmd_addr; - -return readl (mmio +PORT_TFDATA ) &0xFF ; -} -static unsigned int ahci_fill_sg (struct ata_queued_cmd *qc,void *cmd_tbl) {struct scatterlist *sg;
drivers/ata/sata_fsl.c +4 -56
105 lines not on this page · raw message
drivers/ata/sata_sil24.c +2 -15
@@ -336,12 +336,10 @@ static struct sil24_cerr_info {struct sil24_port_priv {union sil24_cmd_block *cmd_block;/* 32 cmd blocks */ dma_addr_t cmd_block_dma;/* DMA base addr for them */ -struct ata_taskfile tf;/* Cached taskfile registers */ int do_port_rst; };static void sil24_dev_config (struct ata_device *dev); -static u8 sil24_check_status (struct ata_port *ap);static int sil24_scr_read (struct ata_port *ap,unsigned sc_reg,u32 *val);static int sil24_scr_write (struct ata_port *ap,unsigned sc_reg,u32 val);static int sil24_qc_defer (struct ata_queued_cmd *qc);
@@ -401,8 +399,6 @@ static struct scsi_host_template sil24_sht = {static struct ata_port_operations sil24_ops = { .inherits = &sata_pmp_port_ops, - .sff_check_status = sil24_check_status, - .sff_check_altstatus = sil24_check_status, .qc_defer = sil24_qc_defer, .qc_prep = sil24_qc_prep, .qc_issue = sil24_qc_issue,
@@ -492,12 +488,6 @@ static void sil24_read_tf(struct ata_port *ap, int tag, struct ata_taskfile *tf)ata_tf_from_fis (fis, tf); } -static u8 sil24_check_status (struct ata_port *ap) -{ -struct sil24_port_priv *pp = ap->private_data; -return pp->tf.command; -} -static int sil24_scr_map[] = { [SCR_CONTROL ] =0 , [SCR_STATUS ] =1 ,
@@ -1074,10 +1064,9 @@ static void sil24_error_intr(struct ata_port *ap) }/* record error info */ -if (qc) { -sil24_read_tf (ap, qc->tag, &pp->tf); +if (qc) qc->err_mask |= err_mask; - }else +else ehi->err_mask |= err_mask; ehi->action |= action;
@@ -1210,8 +1199,6 @@ static int sil24_port_start(struct ata_port *ap)if (!pp)return -ENOMEM ; - pp->tf.command =ATA_DRDY ; - cb =dmam_alloc_coherent (dev, cb_size, &cb_dma,GFP_KERNEL );if (!cb)return -ENOMEM ;
drivers/scsi/ipr.c +0 -28
@@ -5246,35 +5246,7 @@ static bool ipr_qc_fill_rtf(struct ata_queued_cmd *qc)return true; } -/** -* ipr_ata_check_status - Return last ATA status -* @ap: ATA port -* -* Return value: -* ATA status -**/ -static u8 ipr_ata_check_status (struct ata_port *ap) -{ -struct ipr_sata_port *sata_port = ap->private_data; -return sata_port->ioasa.status; -} - -/** -* ipr_ata_check_altstatus - Return last ATA altstatus -* @ap: ATA port -* -* Return value: -* Alt ATA status -**/ -static u8 ipr_ata_check_altstatus (struct ata_port *ap) -{ -struct ipr_sata_port *sata_port = ap->private_data; -return sata_port->ioasa.alt_status; -} -static struct ata_port_operations ipr_sata_ops = { - .sff_check_status = ipr_ata_check_status, - .sff_check_altstatus = ipr_ata_check_altstatus, .sff_dev_select = ata_noop_dev_select, .phy_reset = ipr_ata_phy_reset, .hardreset = ipr_sata_reset,
drivers/scsi/libsas/sas_ata.c +0 -8
@@ -233,12 +233,6 @@ static bool sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc)return true; } -static u8 sas_ata_check_status (struct ata_port *ap) -{ -struct domain_device *dev = ap->private_data; -return dev->sata_dev.tf.command; -} -static void sas_ata_phy_reset (struct ata_port *ap) {struct domain_device *dev = ap->private_data;
@@ -350,8 +344,6 @@ static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in, }static struct ata_port_operations sas_sata_ops = { - .sff_check_status = sas_ata_check_status, - .sff_check_altstatus = sas_ata_check_status, .sff_dev_select = ata_noop_dev_select, .phy_reset = sas_ata_phy_reset, .post_internal_cmd = sas_ata_post_internal,
Signature · 1 line
1.5.2.4
PATCH 25/27 libata: clean up dummy port_ops
In reply to Tejun HeoNow that SFF assumptions are removed from core layer, dummy port_ops can be slimmed down. Chop it down.
--- drivers/ata/libata-core.c | 22 +++++----------------- 1 files changed, 5 insertions(+), 17 deletions(-)
drivers/ata/libata-core.c +5 -17
@@ -6107,32 +6107,20 @@ u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,/* * Dummy port_ops */ -static void ata_dummy_noret (struct ata_port *ap) { } -static int ata_dummy_ret0 (struct ata_port *ap) {return 0 ; } -static void ata_dummy_qc_noret (struct ata_queued_cmd *qc) { } - -static u8 ata_dummy_check_status (struct ata_port *ap) +static unsigned int ata_dummy_qc_issue (struct ata_queued_cmd *qc) { -return ATA_DRDY ; +return AC_ERR_SYSTEM ; } -static unsigned int ata_dummy_qc_issue (struct ata_queued_cmd *qc) +static void ata_dummy_error_handler (struct ata_port *ap) { -return AC_ERR_SYSTEM ; +/* truly dummy */ }struct ata_port_operations ata_dummy_port_ops = { - .sff_check_status = ata_dummy_check_status, - .sff_check_altstatus = ata_dummy_check_status, .qc_prep = ata_noop_qc_prep, .qc_issue = ata_dummy_qc_issue, - .freeze = ata_dummy_noret, - .thaw = ata_dummy_noret, - .error_handler = ata_dummy_noret, - .post_internal_cmd = ata_dummy_qc_noret, - .sff_irq_clear = ata_dummy_noret, - .port_start = ata_dummy_ret0, - .port_stop = ata_dummy_noret, + .error_handler = ata_dummy_error_handler, };const struct ata_port_info ata_dummy_port_info = {
Signature · 1 line
1.5.2.4
PATCH 26/27 libata: don't use ap->ioaddr in non-SFF drivers
In reply to Tejun Heoap->ioaddr is to carry addresses for TF and BMDMA registers of a SFF controller, don't abuse it in non-SFF controllers.
--- drivers/ata/ahci.c | 15 ++++------- drivers/ata/sata_fsl.c | 5 ---- drivers/ata/sata_sil24.c | 60 +++++++++++++++++++++++---------------------- 3 files changed, 36 insertions(+), 44 deletions(-)
drivers/ata/ahci.c +5 -10
@@ -1179,7 +1179,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,static int ahci_kick_engine (struct ata_port *ap,int force_restart) { -void __iomem *port_mmio = ap->ioaddr.cmd_addr; +void __iomem *port_mmio =ahci_port_base (ap);struct ahci_host_priv *hpriv = ap->host->private_data;u8 status =readl (port_mmio +PORT_TFDATA ) &0xFF ;u32 tmp;
@@ -1255,8 +1255,8 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,static int ahci_check_ready (struct ata_link *link) { -void __iomem *mmio = link->ap->ioaddr.cmd_addr; -u8 status =readl (mmio +PORT_TFDATA ) &0xFF ; +void __iomem *port_mmio =ahci_port_base (link->ap); +u8 status =readl (port_mmio +PORT_TFDATA ) &0xFF ;if (!(status &ATA_BUSY ))return 1 ;
@@ -1616,7 +1616,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)static void ahci_port_intr (struct ata_port *ap) { -void __iomem *port_mmio = ap->ioaddr.cmd_addr; +void __iomem *port_mmio =ahci_port_base (ap);struct ata_eh_info *ehi = &ap->link.eh_info;struct ahci_port_priv *pp = ap->private_data;struct ahci_host_priv *hpriv = ap->host->private_data;
@@ -2210,7 +2210,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)for (i =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i]; -void __iomem *port_mmio =ahci_port_base (ap);ata_port_pbar_desc (ap,AHCI_PCI_BAR ,-1 ,"abar" ); ata_port_pbar_desc(ap, AHCI_PCI_BAR,
@@ -2219,12 +2218,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)/* set initial link pm policy */ ap->pm_policy =NOT_AVAILABLE ; -/* standard SATA port setup */ -if (hpriv->port_map & (1 << i)) - ap->ioaddr.cmd_addr = port_mmio; -/* disabled/not-implemented port */ -else +if (!(hpriv->port_map & (1 << i))) ap->ops = &ata_dummy_port_ops; }
drivers/ata/sata_fsl.c +0 -5
@@ -1225,11 +1225,6 @@ static int sata_fsl_probe(struct of_device *ofdev,/* host->iomap is not used currently */ host->private_data = host_priv; -/* setup port(s) */ - - host->ports[0 ]->ioaddr.cmd_addr = host_priv->hcr_base; - host->ports[0 ]->ioaddr.scr_addr = host_priv->ssr_base; -/* initialize host controller */ sata_fsl_init_controller (host);
drivers/ata/sata_sil24.c +31 -29
176 lines not on this page · raw message
Signature · 1 line
1.5.2.4
PATCH 27/27 libata: make SFF support optional
In reply to Tejun HeoNow that SFF support is completely separated out from the core layer, it can be made optional. Add CONFIG_ATA_SFF and let SFF drivers depend on it. If CONFIG_ATA_SFF isn't set, all codes in libata-sff.c and data structures for SFF support are disabled. This saves good number of bytes for small systems.
--- drivers/ata/Kconfig | 44 +++++++++++++++++++++++++++----------------- drivers/ata/Makefile | 4 ++-- drivers/ata/libata-core.c | 2 ++ drivers/ata/libata-scsi.c | 2 ++ drivers/ata/libata.h | 4 ++++ include/linux/libata.h | 9 +++++++++ 6 files changed, 46 insertions(+), 19 deletions(-)
drivers/ata/Kconfig +27 -17
@@ -49,6 +49,32 @@ config SATA_AHCI If unsure, say N. +config SATA_SIL24 + tristate "Silicon Image 3124/3132 SATA support" + depends on PCI + help + This option enables support for Silicon Image 3124/3132 Serial ATA. + + If unsure, say N. + +config SATA_FSL + tristate "Freescale 3.0Gbps SATA support" + depends on FSL_SOC + help + This option enables support for Freescale 3.0Gbps SATA controller. + It can be found on MPC837x and MPC8315. + + If unsure, say N. + +config ATA_SFF + bool "ATA SFF support" + default y + help + This option adds support for ATA controllers with SFF + compliant or similar programming interface. + +if ATA_SFF + config SATA_SVW tristate "ServerWorks Frodo / Apple K2 SATA support" depends on PCI
@@ -125,14 +151,6 @@ config SATA_SIL If unsure, say N. -config SATA_SIL24 - tristate "Silicon Image 3124/3132 SATA support" - depends on PCI - help - This option enables support for Silicon Image 3124/3132 Serial ATA. - - If unsure, say N. - config SATA_SIS tristate "SiS 964/965/966/180 SATA support" depends on PCI
@@ -183,15 +201,6 @@ config PATA_ACPI firmware in the BIOS. This driver can sometimes handle otherwise unsupported hardware. -config SATA_FSL - tristate "Freescale 3.0Gbps SATA support" - depends on FSL_SOC - help - This option enables support for Freescale 3.0Gbps SATA controller. - It can be found on MPC837x and MPC8315. - - If unsure, say N. - config PATA_ALI tristate "ALi PATA support (Experimental)" depends on PCI && EXPERIMENTAL
@@ -679,4 +688,5 @@ config PATA_BF54X If unsure, say N. +endif # ATA_SFF endif # ATA
drivers/ata/Makefile +2 -2
@@ -78,6 +78,6 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o # Should be last libata driver obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o -libata-objs := libata-core.o libata-scsi.o libata-sff.o libata-eh.o \ - libata-pmp.o +libata-objs := libata-core.o libata-scsi.o libata-eh.o libata-pmp.o +libata-$(CONFIG_ATA_SFF) += libata-sff.o libata-$(CONFIG_ATA_ACPI) += libata-acpi.o
drivers/ata/libata-core.c +2 -0
@@ -5143,7 +5143,9 @@ 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); +#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);
drivers/ata/libata-scsi.c +2 -0
@@ -2393,7 +2393,9 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)/* FIXME: is this needed? */ memset (cmd->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE ); +#ifdef CONFIG_ATA_SFF ap->ops->sff_tf_read (ap, &qc->tf); +#endif /* fill these in, for the case where they are -not- overwritten */ cmd->sense_buffer[0 ] =0x70 ;
drivers/ata/libata.h +4 -0
@@ -42,8 +42,10 @@ 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 ; }
@@ -205,9 +207,11 @@ extern int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,extern void ata_eh_finish (struct ata_port *ap);/* 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 */ #endif /* __LIBATA_H__ */
include/linux/libata.h +9 -0
@@ -443,6 +443,7 @@ enum link_pm { };extern struct class_device_attribute class_device_attr_link_power_management_policy; +#ifdef CONFIG_ATA_SFF struct ata_ioports { void __iomem *cmd_addr; void __iomem *data_addr;
@@ -460,6 +461,7 @@ struct ata_ioports {void __iomem *bmdma_addr;void __iomem *scr_addr; }; +#endif /* CONFIG_ATA_SFF */ struct ata_host {spinlock_t lock;
@@ -646,7 +648,9 @@ struct ata_port {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 */ +#endif /* CONFIG_ATA_SFF */ u8 ctl;/* cache of ATA control register */ u8 last_ctl;/* Cache last written value */
@@ -758,6 +762,7 @@ struct ata_port_operations {void (*port_stop)(struct ata_port *ap);void (*host_stop)(struct ata_host *host); +#ifdef CONFIG_ATA_SFF /* * SFF / taskfile oriented ops */
@@ -777,6 +782,7 @@ struct ata_port_operations {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_SFF */ /* * Obsolete
@@ -1367,6 +1373,8 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)/************************************************************************** * SFF - drivers/ata/libata-sff.c */ +#ifdef CONFIG_ATA_SFF +extern const struct ata_port_operations ata_sff_port_ops;extern const struct ata_port_operations ata_bmdma_port_ops;
@@ -1507,5 +1515,6 @@ static inline u8 ata_wait_idle(struct ata_port *ap)return status; } +#endif /* CONFIG_ATA_SFF */ #endif /* __LINUX_LIBATA_H__ */
Signature · 1 line
1.5.2.4
PATCH 17/27 libata: clear SError after link resume
In reply to Tejun HeoSError used to be cleared in ->postreset. This has small hotplug race condition. If a device is plugged in after reset is complete but postreset hasn't run yet, its hotplug event gets lost when SError is cleared. This patch makes sata_link_resume() clear SError. This kills the race condition and makes a lot of sense as some PMP and host PHYs don't work properly without SError cleared.
This change makes sata_pmp_std_{pre|post}_reset()'s unnecessary as they become identical to ata_std counterparts. It also simplifies sata_pmp_hardreset() and ahci_vt8251_hardreset().
--- drivers/ata/ahci.c | 5 -- drivers/ata/libata-core.c | 35 +++++++++++------ drivers/ata/libata-pmp.c | 93 +-------------------------------------------- include/linux/libata.h | 2 - 4 files changed, 23 insertions(+), 112 deletions(-)
drivers/ata/ahci.c +0 -5
@@ -1377,7 +1377,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, unsigned long deadline) {struct ata_port *ap = link->ap; -u32 serror;bool online;int rc;
@@ -1388,10 +1387,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, rc =sata_link_hardreset (link,sata_ehc_deb_timing (&link->eh_context), deadline, &online,NULL ); -/* vt8251 needs SError cleared for the port to operate */ -ahci_scr_read (ap,SCR_ERROR , &serror); -ahci_scr_write (ap,SCR_ERROR , serror); -ahci_start_engine (ap);DPRINTK ("EXIT, rc=%d, class=%u\n" , rc, *class);
drivers/ata/libata-core.c +22 -13
@@ -90,9 +90,9 @@ const struct ata_port_operations sata_port_ops = {const struct ata_port_operations sata_pmp_port_ops = { .inherits = &sata_port_ops, - .pmp_prereset = sata_pmp_std_prereset, + .pmp_prereset = ata_std_prereset, .pmp_hardreset = sata_pmp_std_hardreset, - .pmp_postreset = sata_pmp_std_postreset, + .pmp_postreset = ata_std_postreset, .error_handler = sata_pmp_error_handler, };
@@ -3455,7 +3455,7 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params,int sata_link_resume (struct ata_link *link,const unsigned long *params,unsigned long deadline) { -u32 scontrol; +u32 scontrol, serror;int rc;if ((rc =sata_scr_read (link,SCR_CONTROL , &scontrol)))
@@ -3471,7 +3471,25 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,*/ msleep (200 ); -return sata_link_debounce (link, params, deadline); +if ((rc =sata_link_debounce (link, params, deadline))) +return rc; + +/* Clear SError. PMP and some host PHYs require this to +* operate and clearing should be done before checking PHY +* online status to avoid race condition (hotplugging between +* link resume and status check). +*/ +if (!(rc =sata_scr_read (link,SCR_ERROR , &serror))) + rc =sata_scr_write (link,SCR_ERROR , serror); +if (rc ==0 || rc == -EINVAL ) { +unsigned long flags; + +spin_lock_irqsave (link->ap->lock, flags); + link->eh_info.serror =0 ; +spin_unlock_irqrestore (link->ap->lock, flags); + rc =0 ; + } +return rc; }/**
@@ -3663,18 +3681,11 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,*/ void ata_std_postreset (struct ata_link *link,unsigned int *classes) { -u32 serror; -DPRINTK ("ENTER\n" );/* print link status */ sata_print_link_status (link); -/* clear SError */ -if (sata_scr_read (link,SCR_ERROR , &serror) ==0 ) -sata_scr_write (link,SCR_ERROR , serror); - link->eh_info.serror =0 ; -DPRINTK ("EXIT\n" ); }
@@ -6243,9 +6254,7 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume);#endif /* CONFIG_PCI */ EXPORT_SYMBOL_GPL (sata_pmp_qc_defer_cmd_switch); -EXPORT_SYMBOL_GPL (sata_pmp_std_prereset);EXPORT_SYMBOL_GPL (sata_pmp_std_hardreset); -EXPORT_SYMBOL_GPL (sata_pmp_std_postreset);EXPORT_SYMBOL_GPL (sata_pmp_error_handler);EXPORT_SYMBOL_GPL (__ata_ehi_push_desc);
drivers/ata/libata-pmp.c +1 -92
117 lines not on this page · raw message
include/linux/libata.h +0 -2
@@ -1022,10 +1022,8 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,* PMP - drivers/ata/libata-pmp.c */ extern int sata_pmp_qc_defer_cmd_switch (struct ata_queued_cmd *qc); -extern int sata_pmp_std_prereset (struct ata_link *link,unsigned long deadline);extern int sata_pmp_std_hardreset (struct ata_link *link,unsigned int *class,unsigned long deadline); -extern void sata_pmp_std_postreset (struct ata_link *link,unsigned int *class);extern void sata_pmp_error_handler (struct ata_port *ap);/*
Signature · 1 line
1.5.2.4
PATCH 13/27 libata: separate out ata_wait_ready() and implement ata_wait_after_reset()
In reply to Tejun HeoFactor out waiting logic (which is common to all ATA controllers) from ata_sff_wait_ready() into ata_wait_ready(). ata_wait_ready() takes @check_ready function pointer and uses it to poll for readiness. This allows non-SFF controllers to use ata_wait_ready() to wait for link readiness.
This patch also implements ata_wait_after_reset() - generic version of ata_sff_wait_after_reset() - using ata_wait_ready().
ata_sff_wait_ready() is reimplemented using ata_wait_ready() and ata_sff_check_ready(). Functionality remains the same.
--- drivers/ata/libata-core.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ drivers/ata/libata-sff.c | 62 +++++----------------------- drivers/ata/libata.h | 2 + include/linux/libata.h | 2 + 4 files changed, 114 insertions(+), 50 deletions(-)
drivers/ata/libata-core.c +98 -0
@@ -3273,6 +3273,103 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) }/** +* ata_wait_ready - wait for link to become ready +* @link: link to be waited on +* @deadline: deadline jiffies for the operation +* @check_ready: callback to check link readiness +* +* Wait for @link to become ready. @check_ready should return +* positive number if @link is ready, 0 if it isn't, -ENODEV if +* link doesn't seem to be occupied, other errno for other error +* conditions. +* +* Transient -ENODEV conditions are allowed for +* ATA_TMOUT_FF_WAIT. +* +* LOCKING: +* EH context. +* +* RETURNS: +* 0 if @linke is ready before @deadline; otherwise, -errno. +*/ +int ata_wait_ready (struct ata_link *link,unsigned long deadline, +int (*check_ready)(struct ata_link *link)) +{ +unsigned long start = jiffies; +unsigned long nodev_deadline = start +ATA_TMOUT_FF_WAIT ; +int warned =0 ; + +if (time_after (nodev_deadline, deadline)) + nodev_deadline = deadline; + +while (1 ) { +unsigned long now = jiffies; +int ready, tmp; + + ready = tmp =check_ready (link); +if (ready >0 ) +return 0 ; + +/* -ENODEV could be transient. Ignore -ENODEV if link +* is online. Also, some SATA devices take a long +* time to clear 0xff after reset. For example, +* HHD424020F7SV00 iVDR needs >= 800ms while Quantum +* GoVault needs even more than that. Wait for +* ATA_TMOUT_FF_WAIT on -ENODEV if link isn't offline. +* +* Note that some PATA controllers (pata_ali) explode +* if status register is read more than once when +* there's no device attached. +*/ +if (ready == -ENODEV ) { +if (ata_link_online (link)) + ready =0 ; +else if ((link->ap->flags &ATA_FLAG_SATA ) && + !ata_link_offline (link) && +time_before (now, nodev_deadline)) + ready =0 ; + } + +if (ready) +return ready; +if (time_after (now, deadline)) +return -EBUSY ; + +if (!warned &&time_after (now, start +5 *HZ ) && + (deadline - now >3 *HZ )) { +ata_link_printk (link,KERN_WARNING , +"link is slow to respond, please be patient " +"(ready=%d)\n" , tmp); + warned =1 ; + } + +msleep (50 ); + } +} + +/** +* ata_wait_after_reset - wait for link to become ready after reset +* @link: link to be waited on +* @deadline: deadline jiffies for the operation +* @check_ready: callback to check link readiness +* +* Wait for @link to become ready after reset. +* +* LOCKING: +* EH context. +* +* RETURNS: +* 0 if @linke is ready before @deadline; otherwise, -errno. +*/ +extern int ata_wait_after_reset (struct ata_link *link,unsigned long deadline, +int (*check_ready)(struct ata_link *link)) +{ +msleep (ATA_WAIT_AFTER_RESET_MSECS ); + +return ata_wait_ready (link, deadline, check_ready); +} + +/** * sata_link_debounce - debounce SATA phy status * @link: ATA link to debounce SATA phy status for * @params: timing parameters { interval, duratinon, timeout } in msec
@@ -6022,6 +6119,7 @@ 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);EXPORT_SYMBOL_GPL (sata_link_debounce);EXPORT_SYMBOL_GPL (sata_link_resume);EXPORT_SYMBOL_GPL (ata_std_prereset);
drivers/ata/libata-sff.c +12 -50
74 lines not on this page · raw message
drivers/ata/libata.h +2 -0
@@ -79,6 +79,8 @@ extern unsigned ata_exec_internal_sg(struct ata_device *dev, int dma_dir, struct scatterlist *sg, unsigned int n_elem, unsigned long timeout);extern unsigned int ata_do_simple_cmd (struct ata_device *dev,u8 cmd); +extern int ata_wait_ready (struct ata_link *link,unsigned long deadline, +int (*check_ready)(struct ata_link *link));extern int ata_dev_read_id (struct ata_device *dev,unsigned int *p_class,unsigned int flags,u16 *id);extern int ata_dev_reread_id (struct ata_device *dev,unsigned int readid_flags);
include/linux/libata.h +2 -0
@@ -835,6 +835,8 @@ extern void sata_print_link_status(struct ata_link *link);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, +int (*check_ready)(struct ata_link *link));extern int sata_link_debounce (struct ata_link *link,const unsigned long *params,unsigned long deadline); extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
Signature · 1 line
1.5.2.4
PATCH 16/27 libata: implement and use sata_std_hardreset()
In reply to Tejun HeoImplement sata_std_hardreset(), which simply wraps around sata_link_hardreset(). sata_std_hardreset() becomes new standard hardreset method for sata_port_ops and sata_sff_hardreset() moves from ata_base_port_ops to ata_sff_port_ops, which is where it really belongs.
ata_is_builtin_hardreset() is added so that both ata_std_error_handler() and ata_sff_error_handler() skip both builtin hardresets if SCR isn't accessible.
piix_sidpr_hardreset() in ata_piix.c is identical to sata_std_hardreset() in functionality and got replaced with the standard function.
--- drivers/ata/ata_piix.c | 27 +-------------------------- drivers/ata/libata-core.c | 30 +++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 7 ++----- drivers/ata/libata-sff.c | 9 ++++----- drivers/ata/libata.h | 9 +++++++++ include/linux/libata.h | 2 ++ 6 files changed, 47 insertions(+), 37 deletions(-)
drivers/ata/ata_piix.c +1 -26
@@ -168,8 +168,6 @@ static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);static void ich_set_dmamode (struct ata_port *ap,struct ata_device *adev);static int ich_pata_cable_detect (struct ata_port *ap);static u8 piix_vmw_bmdma_status (struct ata_port *ap); -static int piix_sidpr_hardreset (struct ata_link *link,unsigned int *class, -unsigned long deadline);static int piix_sidpr_scr_read (struct ata_port *ap,unsigned int reg,u32 *val);static int piix_sidpr_scr_write (struct ata_port *ap,unsigned int reg,u32 val);#ifdef CONFIG_PM
@@ -320,7 +318,7 @@ static struct ata_port_operations piix_sata_ops = {static struct ata_port_operations piix_sidpr_sata_ops = { .inherits = &piix_sata_ops, - .hardreset = piix_sidpr_hardreset, + .hardreset = sata_std_hardreset, .scr_read = piix_sidpr_scr_read, .scr_write = piix_sidpr_scr_write, };
@@ -1029,29 +1027,6 @@ static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val)return 0 ; } -static int piix_sidpr_hardreset (struct ata_link *link,unsigned int *class, -unsigned long deadline) -{ -const unsigned long *timing =sata_ehc_deb_timing (&link->eh_context); -int rc; - -/* do hardreset */ - rc =sata_link_hardreset (link, timing, deadline,NULL ,NULL ); -if (rc) { -ata_link_printk (link,KERN_ERR , -"COMRESET failed (errno=%d)\n" , rc); -return rc; - } - -/* TODO: phy layer with polling, timeouts, etc. */ -if (ata_link_offline (link)) { - *class =ATA_DEV_NONE ; -return 0 ; - } - -return -EAGAIN ; -} -#ifdef CONFIG_PM static int piix_broken_suspend (void ) {
drivers/ata/libata-core.c +29 -1
@@ -75,7 +75,6 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };const struct ata_port_operations ata_base_port_ops = { .prereset = ata_std_prereset, - .hardreset = sata_sff_hardreset, .postreset = ata_std_postreset, .error_handler = ata_std_error_handler, };
@@ -84,6 +83,7 @@ const struct ata_port_operations sata_port_ops = { .inherits = &ata_base_port_ops, .qc_defer = ata_std_qc_defer, + .hardreset = sata_std_hardreset, .sff_dev_select = ata_noop_dev_select, };
@@ -3623,6 +3623,33 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, }/** +* sata_std_hardreset - COMRESET w/o waiting or classification +* @link: link to reset +* @class: resulting class of attached device +* @deadline: deadline jiffies for the operation +* +* Standard SATA COMRESET w/o waiting or classification. +* +* LOCKING: +* Kernel thread context (may sleep) +* +* RETURNS: +* 0 if link offline, -EAGAIN if link online, -errno on errors. +*/ +int sata_std_hardreset (struct ata_link *link,unsigned int *class, +unsigned long deadline) +{ +const unsigned long *timing =sata_ehc_deb_timing (&link->eh_context); +bool online; +int rc; + +/* do hardreset */ + rc =sata_link_hardreset (link, timing, deadline, &online,NULL ); + *class =ATA_DEV_NONE ; +return online ? -EAGAIN : rc; +} + +/** * ata_std_postreset - standard postreset callback * @link: the target ata_link * @classes: classes of attached devices
@@ -6172,6 +6199,7 @@ EXPORT_SYMBOL_GPL(sata_link_debounce);EXPORT_SYMBOL_GPL (sata_link_resume);EXPORT_SYMBOL_GPL (ata_std_prereset);EXPORT_SYMBOL_GPL (sata_link_hardreset); +EXPORT_SYMBOL_GPL (sata_std_hardreset);EXPORT_SYMBOL_GPL (ata_std_postreset);EXPORT_SYMBOL_GPL (ata_dev_classify);EXPORT_SYMBOL_GPL (ata_dev_pair);
drivers/ata/libata-eh.c +2 -5
@@ -2859,11 +2859,8 @@ void ata_std_error_handler(struct ata_port *ap)struct ata_port_operations *ops = ap->ops;ata_reset_fn_t hardreset = ops->hardreset; -/* sata_std_hardreset is inherited to all drivers from -* ata_base_port_ops. Ignore it if SCR access is not -* available. -*/ -if (hardreset == sata_sff_hardreset && !sata_scr_valid (&ap->link)) +/* ignore built-in hardreset if SCR access is not available */ +if (ata_is_builtin_hardreset (hardreset) && !sata_scr_valid (&ap->link)) hardreset =NULL ;ata_do_eh (ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
drivers/ata/libata-sff.c +4 -5
@@ -49,6 +49,7 @@ const struct ata_port_operations ata_sff_port_ops = { .thaw = ata_sff_thaw, .prereset = ata_sff_prereset, .softreset = ata_sff_softreset, + .hardreset = sata_sff_hardreset, .postreset = ata_sff_postreset, .error_handler = ata_sff_error_handler, .post_internal_cmd = ata_sff_post_internal_cmd,
@@ -2031,14 +2032,12 @@ void ata_sff_error_handler(struct ata_port *ap)/* PIO and DMA engines have been stopped, perform recovery */ -/* ata_sff_softreset and sata_sff_hardreset are inherited to -* all SFF drivers from ata_sff_port_ops. Ignore softreset if -* ctl isn't accessible. Ignore hardreset if SCR access isn't -* available. +/* Ignore ata_sff_softreset if ctl isn't accessible and +* built-in hardresets if SCR access isn't available. */ if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr) softreset =NULL ; -if (hardreset == sata_sff_hardreset && !sata_scr_valid (&ap->link)) +if (ata_is_builtin_hardreset (hardreset) && !sata_scr_valid (&ap->link)) hardreset =NULL ; ata_do_eh(ap, ap->ops->prereset, softreset, hardreset,
drivers/ata/libata.h +9 -0
@@ -38,6 +38,15 @@ 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 ; +if (reset == sata_sff_hardreset) +return 1 ; +return 0 ; +} +/* libata-core.c */ enum {/* flags for ata_dev_read_id() */
include/linux/libata.h +2 -0
@@ -851,6 +851,8 @@ extern int sata_link_resume(struct ata_link *link, const unsigned long *params,extern int sata_link_hardreset (struct ata_link *link,const unsigned long *timing,unsigned long deadline,bool *online,int (*check_ready)(struct ata_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 *);
Signature · 1 line
1.5.2.4
PATCH 18/27 libata: move PMP SCR access failure during reset to ata_eh_reset()
In reply to Tejun HeoIf PMP fan-out reset fails and SCR isn't accessible, PMP should be reset. This used to be tested by sata_pmp_std_hardreset() and communicated to EH by -ERESTART. However, this logic is generic and doesn't really have much to do with specific hardreset implementation.
This patch moves SCR access failure detection logic to ata_eh_reset() where it belongs. As this makes sata_pmp_std_hardreset() identical to sata_std_hardreset(), the function is killed and replaced with the standard method.
--- drivers/ata/libata-core.c | 3 +-- drivers/ata/libata-eh.c | 5 +++++ drivers/ata/libata-pmp.c | 35 ----------------------------------- drivers/ata/sata_sil24.c | 2 +- include/linux/libata.h | 2 -- 5 files changed, 7 insertions(+), 40 deletions(-)
drivers/ata/libata-core.c +1 -2
@@ -91,7 +91,7 @@ const struct ata_port_operations sata_pmp_port_ops = { .inherits = &sata_port_ops, .pmp_prereset = ata_std_prereset, - .pmp_hardreset = sata_pmp_std_hardreset, + .pmp_hardreset = sata_std_hardreset, .pmp_postreset = ata_std_postreset, .error_handler = sata_pmp_error_handler, };
@@ -6254,7 +6254,6 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume);#endif /* CONFIG_PCI */ EXPORT_SYMBOL_GPL (sata_pmp_qc_defer_cmd_switch); -EXPORT_SYMBOL_GPL (sata_pmp_std_hardreset);EXPORT_SYMBOL_GPL (sata_pmp_error_handler);EXPORT_SYMBOL_GPL (__ata_ehi_push_desc);
drivers/ata/libata-eh.c +5 -0
@@ -2271,6 +2271,11 @@ int ata_eh_reset(struct ata_link *link, int classify,return rc; fail: +/* if SCR isn't accessible on a fan-out port, PMP needs to be reset */ +if (!ata_is_host_link (link) && +sata_scr_read (link,SCR_STATUS , &sstatus)) + rc = -ERESTART ; +if (rc == -ERESTART || try >= max_tries) goto out;
drivers/ata/libata-pmp.c +0 -35
@@ -176,41 +176,6 @@ int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val) }/** -* sata_pmp_std_hardreset - standard hardreset method for PMP link -* @link: link to be reset -* @class: resulting class of attached device -* @deadline: deadline jiffies for the operation -* -* Hardreset PMP port @link. Note that this function doesn't -* wait for BSY clearance. There simply isn't a generic way to -* wait the event. Instead, this function return -EAGAIN thus -* telling libata-EH to followup with softreset. -* -* LOCKING: -* Kernel thread context (may sleep) -* -* RETURNS: -* 0 on success, -errno otherwise. -*/ -int sata_pmp_std_hardreset (struct ata_link *link,unsigned int *class, -unsigned long deadline) -{ -u32 tmp; -int rc; - -DPRINTK ("ENTER\n" ); - - rc =sata_std_hardreset (link, class, deadline); - -/* if SCR isn't accessible, we need to reset the PMP */ -if (rc && rc != -EAGAIN &&sata_scr_read (link,SCR_STATUS , &tmp)) - rc = -ERESTART ; - -DPRINTK ("EXIT, rc=%d\n" , rc); -return rc; -} - -/** * sata_pmp_read_gscr - read GSCR block of SATA PMP * @dev: PMP device * @gscr: buffer to read GSCR block into
drivers/ata/sata_sil24.c +1 -1
@@ -944,7 +944,7 @@ static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class,return rc; } -return sata_pmp_std_hardreset (link, class, deadline); +return sata_std_hardreset (link, class, deadline); }static void sil24_freeze (struct ata_port *ap)
include/linux/libata.h +0 -2
@@ -1022,8 +1022,6 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,* PMP - drivers/ata/libata-pmp.c */ extern int sata_pmp_qc_defer_cmd_switch (struct ata_queued_cmd *qc); -extern int sata_pmp_std_hardreset (struct ata_link *link,unsigned int *class, -unsigned long deadline);extern void sata_pmp_error_handler (struct ata_port *ap);/*
Signature · 1 line
1.5.2.4
PATCH 24/27 libata: kill ata_noop_dev_select()
In reply to Tejun HeoNow that SFF assumptions are separated out from non-SFF reset sequence, port_ops->sff_dev_select() is no longer necessary for non-SFF controllers. Kill ata_noop_dev_select() and ->sff_dev_select initialization from base and other non-SFF port_ops.
--- drivers/ata/libata-core.c | 19 ------------------- drivers/scsi/ipr.c | 1 - drivers/scsi/libsas/sas_ata.c | 1 - include/linux/libata.h | 1 - 4 files changed, 0 insertions(+), 22 deletions(-)
drivers/ata/libata-core.c +0 -19
@@ -84,7 +84,6 @@ const struct ata_port_operations sata_port_ops = { .qc_defer = ata_std_qc_defer, .hardreset = sata_std_hardreset, - .sff_dev_select = ata_noop_dev_select, };const struct ata_port_operations sata_pmp_port_ops = {
@@ -1394,22 +1393,6 @@ static int ata_hpa_resize(struct ata_device *dev) }/** -* ata_noop_dev_select - Select device 0/1 on ATA bus -* @ap: ATA channel to manipulate -* @device: ATA device (numbered from zero) to select -* -* This function performs no actual function. -* -* May be used as the dev_select() entry in ata_port_operations. -* -* LOCKING: -* caller. -*/ -void ata_noop_dev_select (struct ata_port *ap,unsigned int device) -{ -} - -/** * ata_dump_id - IDENTIFY DEVICE info debugging output * @id: IDENTIFY DEVICE page to dump *
@@ -6141,7 +6124,6 @@ static unsigned int ata_dummy_qc_issue(struct ata_queued_cmd *qc)struct ata_port_operations ata_dummy_port_ops = { .sff_check_status = ata_dummy_check_status, .sff_check_altstatus = ata_dummy_check_status, - .sff_dev_select = ata_noop_dev_select, .qc_prep = ata_noop_qc_prep, .qc_issue = ata_dummy_qc_issue, .freeze = ata_dummy_noret,
@@ -6182,7 +6164,6 @@ EXPORT_SYMBOL_GPL(ata_host_detach);EXPORT_SYMBOL_GPL (ata_sg_init);EXPORT_SYMBOL_GPL (ata_qc_complete);EXPORT_SYMBOL_GPL (ata_qc_complete_multiple); -EXPORT_SYMBOL_GPL (ata_noop_dev_select);EXPORT_SYMBOL_GPL (sata_print_link_status);EXPORT_SYMBOL_GPL (ata_tf_to_fis);EXPORT_SYMBOL_GPL (ata_tf_from_fis);
drivers/scsi/ipr.c +0 -1
@@ -5247,7 +5247,6 @@ static bool ipr_qc_fill_rtf(struct ata_queued_cmd *qc) }static struct ata_port_operations ipr_sata_ops = { - .sff_dev_select = ata_noop_dev_select, .phy_reset = ipr_ata_phy_reset, .hardreset = ipr_sata_reset, .post_internal_cmd = ipr_ata_post_internal,
drivers/scsi/libsas/sas_ata.c +0 -1
@@ -344,7 +344,6 @@ static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in, }static struct ata_port_operations sas_sata_ops = { - .sff_dev_select = ata_noop_dev_select, .phy_reset = sas_ata_phy_reset, .post_internal_cmd = sas_ata_post_internal, .qc_prep = ata_noop_qc_prep,
include/linux/libata.h +0 -1
@@ -908,7 +908,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 void ata_noop_dev_select (struct ata_port *ap,unsigned int device);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);
Signature · 1 line
1.5.2.4
PATCH 21/27 libata: drop @finish_qc from ata_qc_complete_multiple()
In reply to Tejun Heoata_qc_complete_multiple() took @finish_qc and called it on every qc before completing it. This was to give opportunity to update TF cache before ata_qc_complete() tries to fill result_tf. Now that result TF is a separate operation, this is no longer necessary.
Update sata_sil24, which was the only user of this mechanism, such that it implements its own ops->qc_fill_rtf() and drop @finish_qc from ata_qc_complete_multiple().
--- drivers/ata/ahci.c | 2 +- drivers/ata/libata-core.c | 6 +----- drivers/ata/sata_sil24.c | 19 +++++++++---------- include/linux/libata.h | 3 +-- 4 files changed, 12 insertions(+), 18 deletions(-)
drivers/ata/ahci.c +1 -1
@@ -1696,7 +1696,7 @@ static void ahci_port_intr(struct ata_port *ap)else qc_active =readl (port_mmio +PORT_CMD_ISSUE ); - rc =ata_qc_complete_multiple (ap, qc_active,NULL ); + rc =ata_qc_complete_multiple (ap, qc_active);/* while resetting, invalid completions are expected */ if (unlikely (rc <0 && !resetting)) {
drivers/ata/libata-core.c +1 -5
@@ -4595,7 +4595,6 @@ void ata_qc_complete(struct ata_queued_cmd *qc)* ata_qc_complete_multiple - Complete multiple qcs successfully * @ap: port in question * @qc_active: new qc_active mask -* @finish_qc: LLDD callback invoked before completing a qc * * Complete in-flight commands. This functions is meant to be * called from low-level driver's interrupt routine to complete
@@ -4608,8 +4607,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)* RETURNS: * Number of completed commands on success, -errno otherwise. */ -int ata_qc_complete_multiple (struct ata_port *ap,u32 qc_active, -void (*finish_qc)(struct ata_queued_cmd *)) +int ata_qc_complete_multiple (struct ata_port *ap,u32 qc_active) {int nr_done =0 ;u32 done_mask;
@@ -4630,8 +4628,6 @@ int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active,continue ;if ((qc =ata_qc_from_tag (ap, i))) { -if (finish_qc) -finish_qc (qc);ata_qc_complete (qc); nr_done++; }
drivers/ata/sata_sil24.c +9 -10
@@ -348,6 +348,7 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf);static int sil24_qc_defer (struct ata_queued_cmd *qc);static void sil24_qc_prep (struct ata_queued_cmd *qc);static unsigned int sil24_qc_issue (struct ata_queued_cmd *qc); +static bool sil24_qc_fill_rtf (struct ata_queued_cmd *qc);static void sil24_pmp_attach (struct ata_port *ap);static void sil24_pmp_detach (struct ata_port *ap);static void sil24_freeze (struct ata_port *ap);
@@ -407,6 +408,7 @@ static struct ata_port_operations sil24_ops = { .qc_defer = sil24_qc_defer, .qc_prep = sil24_qc_prep, .qc_issue = sil24_qc_issue, + .qc_fill_rtf = sil24_qc_fill_rtf, .freeze = sil24_freeze, .thaw = sil24_thaw,
@@ -914,6 +916,12 @@ static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc)return 0 ; } +static bool sil24_qc_fill_rtf (struct ata_queued_cmd *qc) +{ +sil24_read_tf (qc->ap, qc->tag, &qc->result_tf); +return true; +} +static void sil24_pmp_attach (struct ata_port *ap) {sil24_config_pmp (ap,1 );
@@ -1098,15 +1106,6 @@ static void sil24_error_intr(struct ata_port *ap) } } -static void sil24_finish_qc (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -struct sil24_port_priv *pp = ap->private_data; - -if (qc->flags &ATA_QCFLAG_RESULT_TF ) -sil24_read_tf (ap, qc->tag, &pp->tf); -} -static inline void sil24_host_intr (struct ata_port *ap) {void __iomem *port = ap->ioaddr.cmd_addr;
@@ -1131,7 +1130,7 @@ static inline void sil24_host_intr(struct ata_port *ap) } qc_active = slot_stat & ~HOST_SSTAT_ATTN ; - rc =ata_qc_complete_multiple (ap, qc_active, sil24_finish_qc); + rc =ata_qc_complete_multiple (ap, qc_active);if (rc >0 )return ;if (rc <0 ) {
include/linux/libata.h +1 -2
@@ -921,8 +921,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,extern void ata_id_c_string (const u16 *id,unsigned char *s,unsigned int ofs,unsigned int len);extern void ata_qc_complete (struct ata_queued_cmd *qc); -extern int ata_qc_complete_multiple (struct ata_port *ap,u32 qc_active, -void (*finish_qc)(struct ata_queued_cmd *)); +extern int ata_qc_complete_multiple (struct ata_port *ap,u32 qc_active);extern void ata_scsi_simulate (struct ata_device *dev,struct scsi_cmnd *cmd,void (*done)(struct scsi_cmnd *)); extern int ata_std_bios_param(struct scsi_device *sdev,
Signature · 1 line
1.5.2.4
Re: [PATCH 12/27] libata: restructure SFF post-reset readiness waits
In reply to Tejun HeoQuoted 55 lines · Tejun Heo
Previously, post-softreset readiness is waited as follows.
1.
ata_sff_wait_after_reset()waits for 150ms and then forATA_TMOUT_FF_WAITif status is0xffand other conditions meet.2.
ata_bus_softreset()finishes with-ENODEVif status is still0xff. If not, continue to #3.3.
ata_bus_post_reset()waits readiness of dev0 and/or dev1 depending on devmask usingata_sff_wait_ready().And for post-hardreset readiness,
1.
ata_sff_wait_after_reset()waits for 150ms and then forATA_TMOUT_FF_WAITif status is0xffand other conditions meet.2.
sata_sff_hardresetwaits for device readiness usingata_sff_wait_ready().This patch merges and unifies post-reset readiness waits into
ata_sff_wait_ready()andata_sff_wait_after_reset().
ATA_TMOUT_FF_WAIThandling is merged intoata_sff_wait_ready(). If TF status is0xff, link status is unknown and the port is SATA, it will continue polling tillATA_TMOUT_FF_WAIT.
ata_sff_wait_after_reset()is updated to perform the following steps.1. waits for 150ms.
2. waits for dev0 readiness using
ata_sff_wait_ready(). Note that this is done regardless of devmask, asata_sff_wait_ready()handles0xffstatus correctly, this preserves the original behavior except that it may wait longer after softreset if link is online but status is0xff. This behavior change is very unlikely to cause any actual difference and is intended. It brings softreset behavior to that of hardreset.3. waits for dev1 readiness just the same way
ata_bus_post_reset()did.Now both soft and hard resets call
ata_sff_wait_after_reset()after reset to wait for readiness after resets. Asata_sff_wait_after_reset()contains calls to ->sff_dev_select(), explicit call near the end ofsata_sff_hardreset()is removed.This change makes reset implementation simpler and more consistent.
While at it, make the magical 150ms wait post-reset wait duration a constant and
ata_sff_wait_ready()andata_sff_wait_after_reset()take @link instead of @ap. This is to make them consistent with other reset helpers and ease core changes.
pata_sccis updated accordingly.Signed-off-by Tejun Heo <[email protected]>
Quoted 8 lines
--- drivers/ata/ahci.c | 11 +-- drivers/ata/libata-sff.c | 161 ++++++++++++++++++------------------------- drivers/ata/pata_scc.c | 91 ++++++++++++++----------- drivers/ata/sata_inic162x.c | 6 +- drivers/ata/sata_via.c | 2 +- include/linux/libata.h | 18 ++++- 6 files changed, 139 insertions(+), 150 deletions(-)
This could definitely use some focused PATA testing... master/slave and slave-only setups can be tricky and annoying, and this area is very very fragile.
I'm applying, but just a note to watch for bug reports related to probing caused by this (hopefully none...)
Jeff
Re: [PATCH 19/27] libata: unify mechanism to request follow-up SRST
In reply to Tejun HeoQuoted 9 lines · Tejun Heo
Previously, there were two ways to trigger follow-up SRST from hardreset method - returning
-EAGAINand leaving all device classes unmodified. Drivers never used the latter mechanism and the only use case for the former was when hardreset couldn't classify.Drop the latter mechanism and let
-EAGAINmean "perform follow-up SRST if classification is required". This change removes unnecessary follow-up SRSTs and simplifies reset implementations.
Quoted 7 lines
Signed-off-by Tejun Heo <[email protected]>--- drivers/ata/ahci.c | 3 --- drivers/ata/libata-core.c | 1 - drivers/ata/libata-eh.c | 26 ++++++++------------------ drivers/ata/libata-sff.c | 1 - 4 files changed, 8 insertions(+), 23 deletions(-)
related long term to-do item: support hard and soft resets delivered via SG_IO according to the SAT standard
Re: [PATCH 06/27] libata: kill ata_chk_status()
In reply to Tejun HeoQuoted 4 lines · Tejun Heo
ata_chk_status()just callsops->check_statusand it only adds confusion with other status functions. Kill it.Signed-off-by Tejun Heo <[email protected]>
Quoted 10 lines
--- drivers/ata/libata-sff.c | 22 +++++++++++----------- drivers/ata/pata_bf54x.c | 2 +- drivers/ata/pata_scc.c | 2 +- drivers/ata/sata_inic162x.c | 10 +++++----- drivers/ata/sata_sil.c | 6 +++--- drivers/ata/sata_via.c | 2 +- drivers/ata/sata_vsc.c | 2 +- include/linux/libata.h | 7 +------ 8 files changed, 24 insertions(+), 29 deletions(-)
ACK patches 1-27
applied patches 1-6
patch #7 killed the build at that point:
drivers/ata/pdc_adma.c:154: error: ‘ata_std_dev_select’ undeclared here (not in a function) drivers/ata/pdc_adma.c:155: error: ‘ata_tf_load’ undeclared here (not in a function) drivers/ata/pdc_adma.c:156: error: ‘ata_tf_read’ undeclared here (not in a function) drivers/ata/pdc_adma.c:157: error: ‘ata_check_status’ undeclared here (not in a function) drivers/ata/pdc_adma.c:158: error: ‘ata_exec_command’ undeclared here (not in a function) drivers/ata/pdc_adma.c:159: error: ‘ata_data_xfer’ undeclared here (not in a function) drivers/ata/pdc_adma.c:165: error: ‘ata_irq_on’ undeclared here (not in a function) drivers/ata/pdc_adma.c:170: error: ‘ata_std_softreset’ undeclared here (not in a function) make[2]: *** [drivers/ata/pdc_adma.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [drivers/ata] Error 2
make: *** [drivers] Error 2