aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-eh.c18
-rw-r--r--drivers/ata/libata-scsi.c9
-rw-r--r--drivers/ata/libata.h1
-rw-r--r--include/linux/ata.h2
4 files changed, 2 insertions, 28 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 16125be34893..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}
@@ -1791,18 +1789,6 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
1791 memcpy(&qc->result_tf, &tf, sizeof(tf)); 1789 memcpy(&qc->result_tf, &tf, sizeof(tf));
1792 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; 1790 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
1793 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; 1791 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ;
1794 if (qc->result_tf.auxiliary) {
1795 char sense_key, asc, ascq;
1796
1797 sense_key = (qc->result_tf.auxiliary >> 16) & 0xff;
1798 asc = (qc->result_tf.auxiliary >> 8) & 0xff;
1799 ascq = qc->result_tf.auxiliary & 0xff;
1800 ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n",
1801 sense_key, asc, ascq);
1802 ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq);
1803 qc->flags |= ATA_QCFLAG_SENSE_VALID;
1804 }
1805
1806 ehc->i.err_mask &= ~AC_ERR_DEV; 1792 ehc->i.err_mask &= ~AC_ERR_DEV;
1807} 1793}
1808 1794
@@ -1832,10 +1818,6 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
1832 return ATA_EH_RESET; 1818 return ATA_EH_RESET;
1833 } 1819 }
1834 1820
1835 /* Set by NCQ autosense */
1836 if (qc->flags & ATA_QCFLAG_SENSE_VALID)
1837 return 0;
1838
1839 if (stat & (ATA_ERR | ATA_DF)) 1821 if (stat & (ATA_ERR | ATA_DF))
1840 qc->err_mask |= AC_ERR_DEV; 1822 qc->err_mask |= AC_ERR_DEV;
1841 else 1823 else
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index e1ecd2ab3724..0d7f0da3a269 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -270,11 +270,8 @@ DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
270 ata_scsi_park_show, ata_scsi_park_store); 270 ata_scsi_park_show, ata_scsi_park_store);
271EXPORT_SYMBOL_GPL(dev_attr_unload_heads); 271EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
272 272
273void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) 273static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
274{ 274{
275 if (!cmd)
276 return;
277
278 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; 275 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
279 276
280 scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); 277 scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
@@ -1780,9 +1777,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1780 ((cdb[2] & 0x20) || need_sense)) { 1777 ((cdb[2] & 0x20) || need_sense)) {
1781 ata_gen_passthru_sense(qc); 1778 ata_gen_passthru_sense(qc);
1782 } else { 1779 } else {
1783 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { 1780 if (!need_sense) {
1784 cmd->result = SAM_STAT_CHECK_CONDITION;
1785 } else if (!need_sense) {
1786 cmd->result = SAM_STAT_GOOD; 1781 cmd->result = SAM_STAT_GOOD;
1787 } else { 1782 } else {
1788 /* TODO: decide which descriptor format to use 1783 /* TODO: decide which descriptor format to use
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 8cfdd9616d16..f840ca18a7c0 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -137,7 +137,6 @@ extern int ata_scsi_add_hosts(struct ata_host *host,
137 struct scsi_host_template *sht); 137 struct scsi_host_template *sht);
138extern void ata_scsi_scan_host(struct ata_port *ap, int sync); 138extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
139extern int ata_scsi_offline_dev(struct ata_device *dev); 139extern int ata_scsi_offline_dev(struct ata_device *dev);
140extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq);
141extern void ata_scsi_media_change_notify(struct ata_device *dev); 140extern void ata_scsi_media_change_notify(struct ata_device *dev);
142extern void ata_scsi_hotplug(struct work_struct *work); 141extern void ata_scsi_hotplug(struct work_struct *work);
143extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); 142extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 0e6a782575b5..d2992bfa1706 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -528,8 +528,6 @@ struct ata_bmdma_prd {
528#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) 528#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
529#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) 529#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
530#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) 530#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
531#define ata_id_has_ncq_autosense(id) \
532 ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
533 531
534static inline bool ata_id_has_hipm(const u16 *id) 532static inline bool ata_id_has_hipm(const u16 *id)
535{ 533{