From: Douglas Gilbert <dougg@torque.net>
To: Sachin Sant <sachinp@in.ibm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: Status_byte() in drivers/scsi/scsi.h
Date: Thu, 19 Jun 2003 19:10:20 +1000 [thread overview]
Message-ID: <3EF17DFC.8030700@torque.net> (raw)
In-Reply-To: <3EF178AC.CEC2C720@in.ibm.com>
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
next prev parent reply other threads:[~2003-06-19 8:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-19 8:47 Status_byte() in drivers/scsi/scsi.h Sachin Sant
2003-06-19 9:10 ` Douglas Gilbert [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EF17DFC.8030700@torque.net \
--to=dougg@torque.net \
--cc=linux-scsi@vger.kernel.org \
--cc=sachinp@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.