aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-08-17 19:20:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-08-17 19:20:45 -0400
commit4e7fca0d0afdfa6be0f429f9a2649b3cf92197e7 (patch)
tree91ef397b12a6a8ea9e89aa2b162709ddea2a6127
parente9ab22d292aa168ed8d4cb45353a626a3d6f1522 (diff)
parentf9114d357858c1429dcde022706db7443918f49f (diff)
Merge branch 'for-4.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata fixes from Tejun Heo: "Three minor device-specific fixes and revert of NCQ autosense added during this -rc1. It turned out that NCQ autosense as currently implemented interferes with the usual error handling behavior. It will be revisited in the near future" * 'for-4.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ata: ahci_brcmstb: Fix misuse of IS_ENABLED sata_sx4: Check return code from pdc20621_i2c_read() Revert "libata: Implement NCQ autosense" Revert "libata: Implement support for sense data reporting" Revert "libata-eh: Set 'information' field for autosense" ata: ahci_brcmstb: Fix warnings with CONFIG_PM_SLEEP=n
-rw-r--r--drivers/ata/ahci_brcmstb.c6
-rw-r--r--drivers/ata/libata-core.c24
-rw-r--r--drivers/ata/libata-eh.c105
-rw-r--r--drivers/ata/libata-scsi.c21
-rw-r--r--drivers/ata/libata.h6
-rw-r--r--drivers/ata/sata_sx4.c16
-rw-r--r--drivers/scsi/scsi_error.c31
-rw-r--r--include/linux/ata.h18
-rw-r--r--include/scsi/scsi_eh.h1
9 files changed, 24 insertions, 204 deletions
diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c
index ce1e3a885981..14b7305d2ba0 100644
--- a/drivers/ata/ahci_brcmstb.c
+++ b/drivers/ata/ahci_brcmstb.c
@@ -92,7 +92,7 @@ static inline u32 brcm_sata_readreg(void __iomem *addr)
92 * Other architectures (e.g., ARM) either do not support big endian, or 92 * Other architectures (e.g., ARM) either do not support big endian, or
93 * else leave I/O in little endian mode. 93 * else leave I/O in little endian mode.
94 */ 94 */
95 if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) 95 if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
96 return __raw_readl(addr); 96 return __raw_readl(addr);
97 else 97 else
98 return readl_relaxed(addr); 98 return readl_relaxed(addr);
@@ -101,7 +101,7 @@ static inline u32 brcm_sata_readreg(void __iomem *addr)
101static inline void brcm_sata_writereg(u32 val, void __iomem *addr) 101static inline void brcm_sata_writereg(u32 val, void __iomem *addr)
102{ 102{
103 /* See brcm_sata_readreg() comments */ 103 /* See brcm_sata_readreg() comments */
104 if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) 104 if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
105 __raw_writel(val, addr); 105 __raw_writel(val, addr);
106 else 106 else
107 writel_relaxed(val, addr); 107 writel_relaxed(val, addr);
@@ -209,6 +209,7 @@ static void brcm_sata_init(struct brcm_ahci_priv *priv)
209 priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL); 209 priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL);
210} 210}
211 211
212#ifdef CONFIG_PM_SLEEP
212static int brcm_ahci_suspend(struct device *dev) 213static int brcm_ahci_suspend(struct device *dev)
213{ 214{
214 struct ata_host *host = dev_get_drvdata(dev); 215 struct ata_host *host = dev_get_drvdata(dev);
@@ -231,6 +232,7 @@ static int brcm_ahci_resume(struct device *dev)
231 brcm_sata_phys_enable(priv); 232 brcm_sata_phys_enable(priv);
232 return ahci_platform_resume(dev); 233 return ahci_platform_resume(dev);
233} 234}
235#endif
234 236
235static struct scsi_host_template ahci_platform_sht = { 237static struct scsi_host_template ahci_platform_sht = {
236 AHCI_SHT(DRV_NAME), 238 AHCI_SHT(DRV_NAME),
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index db5d9f79a247..19bcb80b2031 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -694,11 +694,11 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev)
694 * RETURNS: 694 * RETURNS:
695 * Block address read from @tf. 695 * Block address read from @tf.
696 */ 696 */
697u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) 697u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
698{ 698{
699 u64 block = 0; 699 u64 block = 0;
700 700
701 if (!dev || tf->flags & ATA_TFLAG_LBA) { 701 if (tf->flags & ATA_TFLAG_LBA) {
702 if (tf->flags & ATA_TFLAG_LBA48) { 702 if (tf->flags & ATA_TFLAG_LBA48) {
703 block |= (u64)tf->hob_lbah << 40; 703 block |= (u64)tf->hob_lbah << 40;
704 block |= (u64)tf->hob_lbam << 32; 704 block |= (u64)tf->hob_lbam << 32;
@@ -2147,24 +2147,6 @@ static int ata_dev_config_ncq(struct ata_device *dev,
2147 return 0; 2147 return 0;
2148} 2148}
2149 2149
2150static void ata_dev_config_sense_reporting(struct ata_device *dev)
2151{
2152 unsigned int err_mask;
2153
2154 if (!ata_id_has_sense_reporting(dev->id))
2155 return;
2156
2157 if (ata_id_sense_reporting_enabled(dev->id))
2158 return;
2159
2160 err_mask = ata_dev_set_feature(dev, SETFEATURE_SENSE_DATA, 0x1);
2161 if (err_mask) {
2162 ata_dev_dbg(dev,
2163 "failed to enable Sense Data Reporting, Emask 0x%x\n",
2164 err_mask);
2165 }
2166}
2167
2168/** 2150/**
2169 * ata_dev_configure - Configure the specified ATA/ATAPI device 2151 * ata_dev_configure - Configure the specified ATA/ATAPI device
2170 * @dev: Target device to configure 2152 * @dev: Target device to configure
@@ -2387,7 +2369,7 @@ int ata_dev_configure(struct ata_device *dev)
2387 dev->devslp_timing[i] = sata_setting[j]; 2369 dev->devslp_timing[i] = sata_setting[j];
2388 } 2370 }
2389 } 2371 }
2390 ata_dev_config_sense_reporting(dev); 2372
2391 dev->cdb_len = 16; 2373 dev->cdb_len = 16;
2392 } 2374 }
2393 2375
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 7465031a893c..cb0508af1459 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1592,8 +1592,6 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
1592 tf->hob_lbah = buf[10]; 1592 tf->hob_lbah = buf[10];
1593 tf->nsect = buf[12]; 1593 tf->nsect = buf[12];
1594 tf->hob_nsect = buf[13]; 1594 tf->hob_nsect = buf[13];
1595 if (ata_id_has_ncq_autosense(dev->id))
1596 tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16];
1597 1595
1598 return 0; 1596 return 0;
1599} 1597}
@@ -1630,70 +1628,6 @@ unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key)
1630} 1628}
1631 1629
1632/** 1630/**
1633 * ata_eh_request_sense - perform REQUEST_SENSE_DATA_EXT
1634 * @dev: device to perform REQUEST_SENSE_SENSE_DATA_EXT to
1635 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
1636 * @dfl_sense_key: default sense key to use
1637 *
1638 * Perform REQUEST_SENSE_DATA_EXT after the device reported CHECK
1639 * SENSE. This function is EH helper.
1640 *
1641 * LOCKING:
1642 * Kernel thread context (may sleep).
1643 *
1644 * RETURNS:
1645 * encoded sense data on success, 0 on failure or if sense data
1646 * is not available.
1647 */
1648static u32 ata_eh_request_sense(struct ata_queued_cmd *qc,
1649 struct scsi_cmnd *cmd)
1650{
1651 struct ata_device *dev = qc->dev;
1652 struct ata_taskfile tf;
1653 unsigned int err_mask;
1654
1655 if (!cmd)
1656 return 0;
1657
1658 DPRINTK("ATA request sense\n");
1659 ata_dev_warn(dev, "request sense\n");
1660 if (!ata_id_sense_reporting_enabled(dev->id)) {
1661 ata_dev_warn(qc->dev, "sense data reporting disabled\n");
1662 return 0;
1663 }
1664 ata_tf_init(dev, &tf);
1665
1666 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1667 tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
1668 tf.command = ATA_CMD_REQ_SENSE_DATA;
1669 tf.protocol = ATA_PROT_NODATA;
1670
1671 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1672 /*
1673 * ACS-4 states:
1674 * The device may set the SENSE DATA AVAILABLE bit to one in the
1675 * STATUS field and clear the ERROR bit to zero in the STATUS field
1676 * to indicate that the command returned completion without an error
1677 * and the sense data described in table 306 is available.
1678 *
1679 * IOW the 'ATA_SENSE' bit might not be set even though valid
1680 * sense data is available.
1681 * So check for both.
1682 */
1683 if ((tf.command & ATA_SENSE) ||
1684 tf.lbah != 0 || tf.lbam != 0 || tf.lbal != 0) {
1685 ata_scsi_set_sense(cmd, tf.lbah, tf.lbam, tf.lbal);
1686 qc->flags |= ATA_QCFLAG_SENSE_VALID;
1687 ata_dev_warn(dev, "sense data %02x/%02x/%02x\n",
1688 tf.lbah, tf.lbam, tf.lbal);
1689 } else {
1690 ata_dev_warn(dev, "request sense failed stat %02x emask %x\n",
1691 tf.command, err_mask);
1692 }
1693 return err_mask;
1694}
1695
1696/**
1697 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE 1631 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
1698 * @dev: device to perform REQUEST_SENSE to 1632 * @dev: device to perform REQUEST_SENSE to
1699 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) 1633 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
@@ -1855,19 +1789,6 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
1855 memcpy(&qc->result_tf, &tf, sizeof(tf)); 1789 memcpy(&qc->result_tf