aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 21:19:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 21:19:53 -0400
commit357397a14117f0c2eeafcac06a1f8412a02aa6af (patch)
tree8420d5aab6b80fc211979d894174462c9806b26e /drivers/ata/libata-scsi.c
parent9ee52a1633a77961cb7b7fb5bd40be682f8412c7 (diff)
parent86a565e61bcb9574bae3b622799682fef2d855bb (diff)
Merge branch 'for-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata changes from Tejun Heo: "Two interesting changes. - libata acpi handling has been restructured so that the association between ata devices and ACPI handles are less convoluted. This change shouldn't change visible behavior. - Queued TRIM support, which enables sending TRIM to the device without draining in-flight RW commands, is added. Currently only enabled for ahci (and likely to stay that way for the foreseeable future). Other changes are driver-specific updates / fixes" * 'for-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: libata: bugfix: Remove __le32 in ata_tf_to_fis() libata: acpi: Remove ata_dev_acpi_handle stub in libata.h libata: Add support for queued DSM TRIM libata: Add support for SEND/RECEIVE FPDMA QUEUED libata: Add H2D FIS "auxiliary" port flag libata: Populate host-to-device FIS "auxiliary" field ata: acpi: rework the ata acpi bind support sata, highbank: send extra clock cycles in SGPIO patterns sata, highbank: set tx_atten override bits devicetree: create a separate binding description for sata_highbank drivers/ata/sata_rcar.c: simplify use of devm_ioremap_resource sata highbank: enable 64-bit DMA mask when using LPAE ata: pata_samsung_cf: add missing __iomem annotation ata: pata_arasan: Staticize local symbols sata_mv: Remove unneeded CONFIG_HAVE_CLK ifdefs ata: use dev_get_platdata() sata_mv: Remove unneeded forward declaration libata: acpi: remove dead code for ata_acpi_(un)bind libata: move 'struct ata_taskfile' and friends from ata.h to libata.h
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b1e880a3c3da..97a0cef12959 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -49,7 +49,6 @@
49#include <linux/hdreg.h> 49#include <linux/hdreg.h>
50#include <linux/uaccess.h> 50#include <linux/uaccess.h>
51#include <linux/suspend.h> 51#include <linux/suspend.h>
52#include <linux/pm_qos.h>
53#include <asm/unaligned.h> 52#include <asm/unaligned.h>
54 53
55#include "libata.h" 54#include "libata.h"
@@ -3100,12 +3099,25 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
3100 buf = page_address(sg_page(scsi_sglist(scmd))); 3099 buf = page_address(sg_page(scsi_sglist(scmd)));
3101 size = ata_set_lba_range_entries(buf, 512, block, n_block); 3100 size = ata_set_lba_range_entries(buf, 512, block, n_block);
3102 3101
3103 tf->protocol = ATA_PROT_DMA; 3102 if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
3104 tf->hob_feature = 0; 3103 /* Newer devices support queued TRIM commands */
3105 tf->feature = ATA_DSM_TRIM; 3104 tf->protocol = ATA_PROT_NCQ;
3106 tf->hob_nsect = (size / 512) >> 8; 3105 tf->command = ATA_CMD_FPDMA_SEND;
3107 tf->nsect = size / 512; 3106 tf->hob_nsect = ATA_SUBCMD_FPDMA_SEND_DSM & 0x1f;
3108 tf->command = ATA_CMD_DSM; 3107 tf->nsect = qc->tag << 3;
3108 tf->hob_feature = (size / 512) >> 8;
3109 tf->feature = size / 512;
3110
3111 tf->auxiliary = 1;
3112 } else {
3113 tf->protocol = ATA_PROT_DMA;
3114 tf->hob_feature = 0;
3115 tf->feature = ATA_DSM_TRIM;
3116 tf->hob_nsect = (size / 512) >> 8;
3117 tf->nsect = size / 512;
3118 tf->command = ATA_CMD_DSM;
3119 }
3120
3109 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 | 3121 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 |
3110 ATA_TFLAG_WRITE; 3122 ATA_TFLAG_WRITE;
3111 3123
@@ -3667,9 +3679,7 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
3667 if (!IS_ERR(sdev)) { 3679 if (!IS_ERR(sdev)) {
3668 dev->sdev = sdev; 3680 dev->sdev = sdev;
3669 scsi_device_put(sdev); 3681 scsi_device_put(sdev);
3670 if (zpodd_dev_enabled(dev)) 3682 ata_scsi_acpi_bind(dev);
3671 dev_pm_qos_expose_flags(
3672 &sdev->sdev_gendev, 0);
3673 } else { 3683 } else {
3674 dev->sdev = NULL; 3684 dev->sdev = NULL;
3675 } 3685 }
@@ -3757,6 +3767,8 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3757 struct scsi_device *sdev; 3767 struct scsi_device *sdev;
3758 unsigned long flags; 3768 unsigned long flags;
3759 3769
3770 ata_scsi_acpi_unbind(dev);
3771
3760 /* Alas, we need to grab scan_mutex to ensure SCSI device 3772 /* Alas, we need to grab scan_mutex to ensure SCSI device
3761 * state doesn't change underneath us and thus 3773 * state doesn't change underneath us and thus
3762 * scsi_device_get() always succeeds. The mutex locking can 3774 * scsi_device_get() always succeeds. The mutex locking can
@@ -3766,9 +3778,6 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3766 mutex_lock(&ap->scsi_host->scan_mutex); 3778 mutex_lock(&ap->scsi_host->scan_mutex);
3767 spin_lock_irqsave(ap->lock, flags); 3779 spin_lock_irqsave(ap->lock, flags);
3768 3780
3769 if (zpodd_dev_enabled(dev))
3770 zpodd_exit(dev);
3771
3772 /* clearing dev->sdev is protected by host lock */ 3781 /* clearing dev->sdev is protected by host lock */
3773 sdev = dev->sdev; 3782 sdev = dev->sdev;
3774 dev->sdev = NULL; 3783 dev->sdev = NULL;
@@ -3818,6 +3827,9 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
3818 dev->flags &= ~ATA_DFLAG_DETACHED; 3827 dev->flags &= ~ATA_DFLAG_DETACHED;
3819 spin_unlock_irqrestore(ap->lock, flags); 3828 spin_unlock_irqrestore(ap->lock, flags);
3820 3829
3830 if (zpodd_dev_enabled(dev))
3831 zpodd_exit(dev);
3832
3821 ata_scsi_remove_dev(dev); 3833 ata_scsi_remove_dev(dev);
3822 } 3834 }
3823} 3835}