* [PATCH] [libata]Set proper SK when CK_COND is set.
@ 2013-01-18 2:18 Gwendal Grignou
2013-01-18 11:17 ` Sergei Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Gwendal Grignou @ 2013-01-18 2:18 UTC (permalink / raw)
To: jgarzik; +Cc: linux-ide, Gwendal Grignou
When the user application sends a ATA_12 or ATA_16 PASSTHROUGH
scsi command, put the task file register in the sense data with the
proper Sense Key. Instead of NO SENSE, set RECOVERED, as
specified in [SAT2]12.2.5 Table 92.
Change-Id: Ia7d77d09f6db6db4796310b4dc9789ac0d7af69b
Tested:
Using udev ata_id to generate a passthrough command, IDENTIFY:
before:
sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
a1 08 2e 00 01 00 00 00 00 ec 00 00
sd 0:0:0:0: [sda] Sense Key : No Sense [current] [descriptor]
Descriptor sense data with sense descriptors (in hex):
72 00 00 00 00 00 00 0e 09 0c 00 00 00 00 00 3f
00 18 00 a6 e0 50
after
sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
a1 08 2e 00 01 00 00 00 00 ec 00 00
sd 0:0:0:0: [sda] Sense Key : Recovered Error [current] [descriptor]
Descriptor sense data with sense descriptors (in hex):
72 01 00 1d 00 00 00 0e 09 0c 00 00 00 01 00 00
00 00 00 00 00 50
Signed-off-by: Gwendal Grignou <gwendal@google.com>
---
drivers/ata/libata-scsi.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7c337e7..d5f81b2 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -933,7 +933,11 @@ static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk,
* block specified for the ATA pass through commands. Regardless
* of whether the command errored or not, return a sense
* block. Copy all controller registers into the sense
- * block. Clear sense key, ASC & ASCQ if there is no error.
+ * block. If there was no error, we get the request from an ATA
+ * passthrough command, so we use the following sense data:
+ * sk = RECOVERED ERROR
+ * asc,ascq = ATA PASS-THROUGH INFORMATION AVAILABLE
+ *
*
* LOCKING:
* None.
@@ -959,6 +963,10 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose);
sb[1] &= 0x0f;
+ } else {
+ sb[1] = RECOVERED_ERROR;
+ sb[2] = 0;
+ sb[3] = 0x1D;
}
/*
@@ -1733,10 +1741,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
/* For ATA pass thru (SAT) commands, generate a sense block if
* user mandated it or if there's an error. Note that if we
- * generate because the user forced us to, a check condition
- * is generated and the ATA register values are returned
+ * generate because the user forced us to [CK_COND =1 ], a check
+ * condition is generated and the ATA register values are returned
* whether the command completed successfully or not. If there
- * was no error, SK, ASC and ASCQ will all be zero.
+ * was no error, we use the following sense data:
+ * sk = RECOVERED ERROR
+ * asc,ascq = ATA PASS-THROUGH INFORMATION AVAILABLE
*/
if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) &&
((cdb[2] & 0x20) || need_sense)) {
--
1.7.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [libata]Set proper SK when CK_COND is set.
2013-01-18 2:18 [PATCH] [libata]Set proper SK when CK_COND is set Gwendal Grignou
@ 2013-01-18 11:17 ` Sergei Shtylyov
2013-01-18 18:56 ` Gwendal Grignou
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2013-01-18 11:17 UTC (permalink / raw)
To: Gwendal Grignou; +Cc: jgarzik, linux-ide
Hello.
On 18-01-2013 6:18, Gwendal Grignou wrote:
> When the user application sends a ATA_12 or ATA_16 PASSTHROUGH
> scsi command, put the task file register in the sense data with the
> proper Sense Key. Instead of NO SENSE, set RECOVERED, as
> specified in [SAT2]12.2.5 Table 92.
> Change-Id: Ia7d77d09f6db6db4796310b4dc9789ac0d7af69b
Remove this line please.
> Tested:
> Using udev ata_id to generate a passthrough command, IDENTIFY:
> before:
> sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
> a1 08 2e 00 01 00 00 00 00 ec 00 00
> sd 0:0:0:0: [sda] Sense Key : No Sense [current] [descriptor]
> Descriptor sense data with sense descriptors (in hex):
> 72 00 00 00 00 00 00 0e 09 0c 00 00 00 00 00 3f
> 00 18 00 a6 e0 50
> after
> sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
> a1 08 2e 00 01 00 00 00 00 ec 00 00
> sd 0:0:0:0: [sda] Sense Key : Recovered Error [current] [descriptor]
> Descriptor sense data with sense descriptors (in hex):
> 72 01 00 1d 00 00 00 0e 09 0c 00 00 00 01 00 00
> 00 00 00 00 00 50
> Signed-off-by: Gwendal Grignou <gwendal@google.com>
> ---
> drivers/ata/libata-scsi.c | 18 ++++++++++++++----
> 1 files changed, 14 insertions(+), 4 deletions(-)
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 7c337e7..d5f81b2 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
[...]
> @@ -1733,10 +1741,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
>
> /* For ATA pass thru (SAT) commands, generate a sense block if
> * user mandated it or if there's an error. Note that if we
> - * generate because the user forced us to, a check condition
> - * is generated and the ATA register values are returned
> + * generate because the user forced us to [CK_COND =1 ], a check
Space before ] not needed.
MBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] [libata]Set proper SK when CK_COND is set.
2013-01-18 11:17 ` Sergei Shtylyov
@ 2013-01-18 18:56 ` Gwendal Grignou
0 siblings, 0 replies; 3+ messages in thread
From: Gwendal Grignou @ 2013-01-18 18:56 UTC (permalink / raw)
To: jgarzik; +Cc: linux-ide, Gwendal Grignou
When the user application sends a ATA_12 or ATA_16 PASSTHROUGH
scsi command, put the task file register in the sense data with the
proper Sense Key. Instead of NO SENSE, set RECOVERED, as
specified in [SAT2]12.2.5 Table 92.
Tested:
Using udev ata_id to generate a passthrough command, IDENTIFY:
before:
sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
a1 08 2e 00 01 00 00 00 00 ec 00 00
sd 0:0:0:0: [sda] Sense Key : No Sense [current] [descriptor]
Descriptor sense data with sense descriptors (in hex):
72 00 00 00 00 00 00 0e 09 0c 00 00 00 00 00 3f
00 18 00 a6 e0 50
after
sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
a1 08 2e 00 01 00 00 00 00 ec 00 00
sd 0:0:0:0: [sda] Sense Key : Recovered Error [current] [descriptor]
Descriptor sense data with sense descriptors (in hex):
72 01 00 1d 00 00 00 0e 09 0c 00 00 00 01 00 00
00 00 00 00 00 50
Signed-off-by: Gwendal Grignou <gwendal@google.com>
---
drivers/ata/libata-scsi.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7c337e7..edc7f43 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -933,7 +933,11 @@ static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk,
* block specified for the ATA pass through commands. Regardless
* of whether the command errored or not, return a sense
* block. Copy all controller registers into the sense
- * block. Clear sense key, ASC & ASCQ if there is no error.
+ * block. If there was no error, we get the request from an ATA
+ * passthrough command, so we use the following sense data:
+ * sk = RECOVERED ERROR
+ * asc,ascq = ATA PASS-THROUGH INFORMATION AVAILABLE
+ *
*
* LOCKING:
* None.
@@ -959,6 +963,10 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose);
sb[1] &= 0x0f;
+ } else {
+ sb[1] = RECOVERED_ERROR;
+ sb[2] = 0;
+ sb[3] = 0x1D;
}
/*
@@ -1733,10 +1741,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
/* For ATA pass thru (SAT) commands, generate a sense block if
* user mandated it or if there's an error. Note that if we
- * generate because the user forced us to, a check condition
- * is generated and the ATA register values are returned
+ * generate because the user forced us to [CK_COND =1], a check
+ * condition is generated and the ATA register values are returned
* whether the command completed successfully or not. If there
- * was no error, SK, ASC and ASCQ will all be zero.
+ * was no error, we use the following sense data:
+ * sk = RECOVERED ERROR
+ * asc,ascq = ATA PASS-THROUGH INFORMATION AVAILABLE
*/
if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) &&
((cdb[2] & 0x20) || need_sense)) {
--
1.7.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-18 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 2:18 [PATCH] [libata]Set proper SK when CK_COND is set Gwendal Grignou
2013-01-18 11:17 ` Sergei Shtylyov
2013-01-18 18:56 ` Gwendal Grignou
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.