diff options
author | Hannes Reinecke <hare@suse.de> | 2016-04-04 11:43:59 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-04-04 12:07:41 -0400 |
commit | 492bf62107347aca764070dbc9d412da6bda73d1 (patch) | |
tree | 6e91e0241f495f04789766492cd254b6f804afb7 /drivers/ata/libata-scsi.c | |
parent | cf8b49b0af39b8e8fa358623acda57f01251b6d4 (diff) | |
download | op-kernel-dev-492bf62107347aca764070dbc9d412da6bda73d1.zip op-kernel-dev-492bf62107347aca764070dbc9d412da6bda73d1.tar.gz |
libata-eh: Set 'information' field for autosense
If NCQ autosense or the sense data reporting feature is enabled
the LBA of the offending command should be stored in the sense
data 'information' field.
tj: s/(u64)-1/U64_MAX/
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r-- | drivers/ata/libata-scsi.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 47b103d..97e8f6b 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -280,6 +280,23 @@ void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); } +void ata_scsi_set_sense_information(struct ata_device *dev, + struct scsi_cmnd *cmd, + const struct ata_taskfile *tf) +{ + u64 information; + + if (!cmd) + return; + + information = ata_tf_read_block(tf, dev); + if (information == U64_MAX) + return; + + scsi_set_sense_information(cmd->sense_buffer, + SCSI_SENSE_BUFFERSIZE, information); +} + static ssize_t ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |