* Status_byte() in drivers/scsi/scsi.h
@ 2003-06-19 8:47 Sachin Sant
2003-06-19 9:10 ` Douglas Gilbert
0 siblings, 1 reply; 6+ messages in thread
From: Sachin Sant @ 2003-06-19 8:47 UTC (permalink / raw)
To: linux-scsi
There seems to be some problem with the status_byte( ) in scsi.h
A SAM status code SAM_STAT_TASK_ABORTED is ignored by status_byte() - it
returns a status GOOD. If SAM status code SAM_STAT_TASK_ABORTED is set
status_byte() must return 0x20.
In kernel file include/scsi/scsi.h new SCSI Architecture Model (SAM)
Status Codes were presented as following:
#define SAM_STAT_GOOD 0x00
#define SAM_STAT_CHECK_CONDITION 0x02
#define SAM_STAT_CONDITION_MET 0x04
#define SAM_STAT_BUSY 0x08
#define SAM_STAT_INTERMEDIATE 0x10
#define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14
#define SAM_STAT_RESERVATION_CONFLICT 0x18
#define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */
#define SAM_STAT_TASK_SET_FULL 0x28
#define SAM_STAT_ACA_ACTIVE 0x30
#define SAM_STAT_TASK_ABORTED 0x40
This means that an implementation of a status_byte() function in
drivers/scsi/scsi.h has to be changed from:
#define status_byte(result) (((result) >> 1) & 0x1f)
to:
#define status_byte(result) (((result) >> 1) & 0x3f)
Otherwise it would ignore a status code SAM_STAT_TASK_ABORTED and return
GOOD.
Please let me know your thoughts.
Thanks
-Sachin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Status_byte() in drivers/scsi/scsi.h
2003-06-19 8:47 Status_byte() in drivers/scsi/scsi.h Sachin Sant
@ 2003-06-19 9:10 ` Douglas Gilbert
2003-06-20 8:40 ` [Patch]Status_byte() " Sachin Sant
0 siblings, 1 reply; 6+ messages in thread
From: Douglas Gilbert @ 2003-06-19 9:10 UTC (permalink / raw)
To: Sachin Sant; +Cc: linux-scsi
Sachin Sant wrote:
> There seems to be some problem with the status_byte( ) in scsi.h
>
> A SAM status code SAM_STAT_TASK_ABORTED is ignored by status_byte() - it
> returns a status GOOD. If SAM status code SAM_STAT_TASK_ABORTED is set
> status_byte() must return 0x20.
>
> In kernel file include/scsi/scsi.h new SCSI Architecture Model (SAM)
> Status Codes were presented as following:
> #define SAM_STAT_GOOD 0x00
> #define SAM_STAT_CHECK_CONDITION 0x02
> #define SAM_STAT_CONDITION_MET 0x04
> #define SAM_STAT_BUSY 0x08
> #define SAM_STAT_INTERMEDIATE 0x10
> #define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14
> #define SAM_STAT_RESERVATION_CONFLICT 0x18
> #define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */
> #define SAM_STAT_TASK_SET_FULL 0x28
> #define SAM_STAT_ACA_ACTIVE 0x30
> #define SAM_STAT_TASK_ABORTED 0x40
>
> This means that an implementation of a status_byte() function in
> drivers/scsi/scsi.h has to be changed from:
>
> #define status_byte(result) (((result) >> 1) & 0x1f)
> to:
> #define status_byte(result) (((result) >> 1) & 0x3f)
>
> Otherwise it would ignore a status code SAM_STAT_TASK_ABORTED and return
> GOOD.
Sachin,
The status_byte() macro is for SCSI-2 and earlier and
matches a Linux-specific set of defines that are
shifted from the "standard" values (e.g. CHECK_CONDITION).
In those days bit 6 was not in use.
We are still arguing about the exact form of the macro
to use that matches the SAM_STAT_ defines show above.
In the meantime you could use:
#define sam_status_value(scmd_result) ((scmd_result) & 0x7e)
and compare the result with the SAM_STAT_ defines above.
Doug Gilbert
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Patch]Status_byte() in drivers/scsi/scsi.h
2003-06-19 9:10 ` Douglas Gilbert
@ 2003-06-20 8:40 ` Sachin Sant
2003-06-20 12:37 ` James Bottomley
0 siblings, 1 reply; 6+ messages in thread
From: Sachin Sant @ 2003-06-20 8:40 UTC (permalink / raw)
To: linux-scsi
According to Dougs comments , here is the patch to include new macros
for SAM status codes . Patch is in drivers/scsi/scsi.h
--- scsi.h 2003-06-19 14:26:54.000000000 +0530
+++ scsi.h.new 2003-06-20 13:54:46.000000000 +0530
@@ -95,6 +95,13 @@
* host_byte = set by low-level driver to indicate status.
* driver_byte = set by mid-level.
*/
+
+/*
+ * Define a new macro sam_status_value for the status codes
+ * defined for new SCSI Architecture Model SAM
+ */
+#define sam_status_value(scmd_result) ((scmd_result) & 0x7e)
+
#define status_byte(result) (((result) >> 1) & 0x1f)
#define msg_byte(result) (((result) >> 8) & 0xff)
Any comments are welcome.
Thanks
-Sachin
-----------------------------------------------------------------------------------
Douglas Gilbert wrote:
> Sachin,
> The status_byte() macro is for SCSI-2 and earlier and
> matches a Linux-specific set of defines that are
> shifted from the "standard" values (e.g. CHECK_CONDITION).
> In those days bit 6 was not in use.
>
> We are still arguing about the exact form of the macro
> to use that matches the SAM_STAT_ defines show above.
> In the meantime you could use:
> #define sam_status_value(scmd_result) ((scmd_result) & 0x7e)
> and compare the result with the SAM_STAT_ defines above.
>
> Doug Gilbert
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch]Status_byte() in drivers/scsi/scsi.h
2003-06-20 8:40 ` [Patch]Status_byte() " Sachin Sant
@ 2003-06-20 12:37 ` James Bottomley
2003-06-20 13:52 ` Douglas Gilbert
0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2003-06-20 12:37 UTC (permalink / raw)
To: Sachin Sant; +Cc: SCSI Mailing List
On Fri, 2003-06-20 at 03:40, Sachin Sant wrote:
>
> According to Dougs comments , here is the patch to include new macros
> for SAM status codes . Patch is in drivers/scsi/scsi.h
>
> +#define sam_status_value(scmd_result) ((scmd_result) & 0x7e)
This is not the correct thing to do. Our problems with the status byte
stem from its evolving meaning. In SCSI-1, it was a bitmap, in SCSI-2 a
value in a bitrange of reserved bits and in SCSI-3 it covers an entire
byte. In SAM-3 all the defined codes have bit zero set to zero, so your
current patch would do no harm for now, but bit zero is no-longer a
reserved bit.
James
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch]Status_byte() in drivers/scsi/scsi.h
2003-06-20 12:37 ` James Bottomley
@ 2003-06-20 13:52 ` Douglas Gilbert
2003-06-20 14:39 ` Jeff Garzik
0 siblings, 1 reply; 6+ messages in thread
From: Douglas Gilbert @ 2003-06-20 13:52 UTC (permalink / raw)
To: James Bottomley; +Cc: Sachin Sant, SCSI Mailing List
James Bottomley wrote:
> On Fri, 2003-06-20 at 03:40, Sachin Sant wrote:
>
>>According to Dougs comments , here is the patch to include new macros
>>for SAM status codes . Patch is in drivers/scsi/scsi.h
>>
>>+#define sam_status_value(scmd_result) ((scmd_result) & 0x7e)
>
>
> This is not the correct thing to do. Our problems with the status byte
> stem from its evolving meaning. In SCSI-1, it was a bitmap, in SCSI-2 a
> value in a bitrange of reserved bits and in SCSI-3 it covers an entire
> byte. In SAM-3 all the defined codes have bit zero set to zero, so your
> current patch would do no harm for now, but bit zero is no-longer a
> reserved bit.
SAM-3 (rev 7) doesn't say status is a byte either.
However since it doesn't define the endianess of
status then it is probably safe to assume it is.
If we choose a mask of 0xff we could only upset
SCSI-1 (and perhaps CCS) devices. Many of those
around?
On a related subject, SPC-3 defines a new "descriptor" sense
data format (see section 4.5). It is a lot cleaner and more
compact than the original one and is controlled by the D_SENSE
bit in the control mode page. Has anybody seen a target
that supports these?
Doug Gilbert
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch]Status_byte() in drivers/scsi/scsi.h
2003-06-20 13:52 ` Douglas Gilbert
@ 2003-06-20 14:39 ` Jeff Garzik
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2003-06-20 14:39 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: James Bottomley, Sachin Sant, SCSI Mailing List
On Fri, Jun 20, 2003 at 11:52:39PM +1000, Douglas Gilbert wrote:
> On a related subject, SPC-3 defines a new "descriptor" sense
> data format (see section 4.5). It is a lot cleaner and more
> compact than the original one and is controlled by the D_SENSE
> bit in the control mode page. Has anybody seen a target
> that supports these?
If it's in the spec, I'm sure I could create one... <evil grin>
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-06-20 14:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-19 8:47 Status_byte() in drivers/scsi/scsi.h Sachin Sant
2003-06-19 9:10 ` Douglas Gilbert
2003-06-20 8:40 ` [Patch]Status_byte() " Sachin Sant
2003-06-20 12:37 ` James Bottomley
2003-06-20 13:52 ` Douglas Gilbert
2003-06-20 14:39 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox