Commit b525e773 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Tejun Heo

libata-scsi: use ata_scsi_set_sense()

Use ata_scsi_set_sense() throughout to ensure the sense code
format is consistent.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 492bf621
...@@ -1000,6 +1000,7 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) ...@@ -1000,6 +1000,7 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
unsigned char *sb = cmd->sense_buffer; unsigned char *sb = cmd->sense_buffer;
unsigned char *desc = sb + 8; unsigned char *desc = sb + 8;
int verbose = qc->ap->ops->error_handler == NULL; int verbose = qc->ap->ops->error_handler == NULL;
u8 sense_key, asc, ascq;
memset(sb, 0, SCSI_SENSE_BUFFERSIZE); memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
...@@ -1012,12 +1013,11 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) ...@@ -1012,12 +1013,11 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
if (qc->err_mask || if (qc->err_mask ||
tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature, ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose); &sense_key, &asc, &ascq, verbose);
sb[1] &= 0x0f; ata_scsi_set_sense(cmd, sense_key, asc, ascq);
} else { } else {
sb[1] = RECOVERED_ERROR; /* ATA PASS-THROUGH INFORMATION AVAILABLE */
sb[2] = 0; ata_scsi_set_sense(cmd, RECOVERED_ERROR, 0, 0x1D);
sb[3] = 0x1D;
} }
/* /*
...@@ -1074,22 +1074,20 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc) ...@@ -1074,22 +1074,20 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
unsigned char *sb = cmd->sense_buffer; unsigned char *sb = cmd->sense_buffer;
int verbose = qc->ap->ops->error_handler == NULL; int verbose = qc->ap->ops->error_handler == NULL;
u64 block; u64 block;
u8 sense_key, asc, ascq;
memset(sb, 0, SCSI_SENSE_BUFFERSIZE); memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
/* sense data is current and format is descriptor */
sb[0] = 0x72;
/* Use ata_to_sense_error() to map status register bits /* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq. * onto sense key, asc & ascq.
*/ */
if (qc->err_mask || if (qc->err_mask ||
tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature, ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose); &sense_key, &asc, &ascq, verbose);
sb[1] &= 0x0f; ata_scsi_set_sense(cmd, sense_key, asc, ascq);
} else { } else {
/* Could not decode error */ /* Could not decode error */
ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n", ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment