Commit 11093cb1 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Tejun Heo

libata-scsi: generate correct ATA pass-through sense

Generate ATA pass-through sense for both fixed and descriptor
format sense.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 3852e373
...@@ -1016,21 +1016,28 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) ...@@ -1016,21 +1016,28 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
&sense_key, &asc, &ascq, verbose); &sense_key, &asc, &ascq, verbose);
ata_scsi_set_sense(cmd, sense_key, asc, ascq); ata_scsi_set_sense(cmd, sense_key, asc, ascq);
} else { } else {
/* ATA PASS-THROUGH INFORMATION AVAILABLE */
ata_scsi_set_sense(cmd, RECOVERED_ERROR, 0, 0x1D);
}
/* /*
* Sense data is current and format is descriptor. * ATA PASS-THROUGH INFORMATION AVAILABLE
* Always in descriptor format sense.
*/ */
sb[0] = 0x72; scsi_build_sense_buffer(1, cmd->sense_buffer,
RECOVERED_ERROR, 0, 0x1D);
}
desc[0] = 0x09; if ((cmd->sense_buffer[0] & 0x7f) >= 0x72) {
u8 len;
/* set length of additional sense data */ /* descriptor format */
sb[7] = 14; len = sb[7];
desc = (char *)scsi_sense_desc_find(sb, len + 8, 9);
if (!desc) {
if (SCSI_SENSE_BUFFERSIZE < len + 14)
return;
sb[7] = len + 14;
desc = sb + 8 + len;
}
desc[0] = 9;
desc[1] = 12; desc[1] = 12;
/* /*
* Copy registers into sense buffer. * Copy registers into sense buffer.
*/ */
...@@ -1054,6 +1061,24 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) ...@@ -1054,6 +1061,24 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
desc[8] = tf->hob_lbam; desc[8] = tf->hob_lbam;
desc[10] = tf->hob_lbah; desc[10] = tf->hob_lbah;
} }
} else {
/* Fixed sense format */
desc[0] = tf->feature;
desc[1] = tf->command; /* status */
desc[2] = tf->device;
desc[3] = tf->nsect;
desc[0] = 0;
if (tf->flags & ATA_TFLAG_LBA48) {
desc[8] |= 0x80;
if (tf->hob_nsect)
desc[8] |= 0x40;
if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah)
desc[8] |= 0x20;
}
desc[9] = tf->lbal;
desc[10] = tf->lbam;
desc[11] = tf->lbah;
}
} }
/** /**
......
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