diff options
author | Hannes Reinecke <hare@suse.de> | 2016-04-04 11:43:54 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-04-04 12:07:40 -0400 |
commit | 5b01e4b9efa0b78672cbbea830c9fbcc7f239e29 (patch) | |
tree | 86eab8729d8327160e5c632befcea455a6e3bd32 /drivers/ata/libata-eh.c | |
parent | d991c872ac7ffaacc4df93efbfbcb4189cee6440 (diff) | |
download | linux-5b01e4b9efa0b78672cbbea830c9fbcc7f239e29.tar.gz linux-5b01e4b9efa0b78672cbbea830c9fbcc7f239e29.tar.bz2 linux-5b01e4b9efa0b78672cbbea830c9fbcc7f239e29.zip |
libata: Implement NCQ autosense
Some newer devices support NCQ autosense (cf ACS-4), so we should
be using it to retrieve the sense code and speed up recovery.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 961acc788f44..8c8355f0792e 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -1600,6 +1600,8 @@ static int ata_eh_read_log_10h(struct ata_device *dev, tf->hob_lbah = buf[10]; tf->nsect = buf[12]; tf->hob_nsect = buf[13]; + if (ata_id_has_ncq_autosense(dev->id)) + tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16]; return 0; } @@ -1797,6 +1799,16 @@ void ata_eh_analyze_ncq_error(struct ata_link *link) memcpy(&qc->result_tf, &tf, sizeof(tf)); qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; + if (qc->result_tf.auxiliary) { + char sense_key, asc, ascq; + + sense_key = (qc->result_tf.auxiliary >> 16) & 0xff; + asc = (qc->result_tf.auxiliary >> 8) & 0xff; + ascq = qc->result_tf.auxiliary & 0xff; + ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq); + qc->flags |= ATA_QCFLAG_SENSE_VALID; + } + ehc->i.err_mask &= ~AC_ERR_DEV; } |