linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: Timothy Thelin <Timothy.Thelin@wdc.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: SG_FLAG_LUN_INHIBIT broken?
Date: Mon, 19 Sep 2005 17:33:53 +1000	[thread overview]
Message-ID: <432E69E1.6030705@torque.net> (raw)
In-Reply-To: <CA45571DE57E1C45BF3552118BA92C9D69BE0F@WDSCEXBECL03.sc.wdc.com>

Timothy Thelin wrote:
> Can anyone confirm that this flag actually works when doing SG_IO? (I'm
> testing on a 2.6.13-rc6 kernel)

Timothy,
No it doesn't work. It hasn't worked since the lk 2.2
series. It has been renamed to:
SG_FLAG_UNUSED_LUN_INHIBIT

Notice that addition of the _UNUSED_ . It is pretty old
stuff, SCSI-2 commands reserved the 3 top bits in byte
one for the lun. Nowadays luns are 64 bit quantities that
are sent to the target outside the cdb which carries the
SCSI command.

I thought it had been removed from the mid level, but ...

> I'm attempting to do an ata-pt command on a cypress board:
> http://www.cypress.com/portal/server.pt?space=CommunityPage&control=SetCommu
> nity&CommunityID=209&PageID=259&fid=14&rpn=CY7C68320
> 
> It involves a 16-byte cdb with cdb[ 1 ] = 0x24 as a signature byte (Page 13
> of the datasheet).  So when the scsi stack adds lun info, it kills the
> signature byte.
> 
> I've tried adding SG_FLAG_LUN_INHIBIT to the SG_IO header, but neither sd or
> sg seem to obey it. After looking at the source neither driver seems to make
> any reference to SG_FLAG_LUN_INHIBIT.
> 
> Eventually all the commands seemed to be funneled to
> scsi.c:532:scsi_dispatch_cmd which does this:
> 	if (cmd->device->scsi_level <= SCSI_2) {
> 		cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
> 			       (cmd->device->lun << 5 & 0xe0);
> 	}
> So basically this is an unconditional "add lun info" if the scsi spec is
> <=2, which is what usb-storage devices end up being.
> 
> Is SG_FLAG_LUN_INHIBIT supposed to be supported still or is it deprecated or
> something?

The above code is a worry because a lot of devices
just place 0 in the version (byte 2 of an INQUIRY
response). Perhaps scsi_level in sysfs
(/sys/class/scsi_device/<h:c:i:l>/device/scsi_level)
should be writable.

Doug Gilbert

  reply	other threads:[~2005-09-19  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 23:45 SG_FLAG_LUN_INHIBIT broken? Timothy Thelin
2005-09-19  7:33 ` Douglas Gilbert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19 16:58 Timothy Thelin

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=432E69E1.6030705@torque.net \
    --to=dougg@torque.net \
    --cc=Timothy.Thelin@wdc.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).