public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* RE: [usb-storage] [Merging ATA passthru] on integratingSMART/ATA-Security in usb-storage driver
@ 2005-11-04 19:59 Timothy Thelin
  2005-11-04 20:40 ` James Bottomley
  0 siblings, 1 reply; 6+ messages in thread
From: Timothy Thelin @ 2005-11-04 19:59 UTC (permalink / raw)
  To: James Bottomley
  Cc: Matthew Dharm, t.schorpp, usb-storage, linux-ide, Linux SCSI list

> 
> On Fri, 2005-11-04 at 10:30 -0800, Timothy Thelin wrote:
> > And for an even more concrete example:
> > The CY7C68300B cypress bridge board (has various siblings as well
> > on their site that act very similar) implements SCSI spec 0 (ie it
> > doesn't claim to support any scsi spec).  Now usb-storage sees
> > this in inquiry, and decides to export the device as a scsi2 device
> > since based on the usb-storage devs' experience most usb devices
> > really want scsi2 cdbs.  So SCSI core thinks this is a scsi2 device
> > and procedes to mangle the cdbs as they're going through.
> 
> What happens if you prevent USB mangling the scsi_level?  I think, for
> the most part, we would handle 0 in about the same way as we handle 2.
> However, we could gate the if around the CDB[1] mangling as
> 
> if (scsi_level != SCSI_UNKNOWN && scsi_level <= SCSI_2)
> 
> which should fix your problem, I think.
> 
> James
> 

Irconically that was one of the solutions I was investigating
first.  Here is the usb mailing list discussion on it:
http://marc.theaimsgroup.com/?t=112672009700004&r=1&w=2

In summary, the idea of making the scsi stack "level 0 aware" was
suggested and rejected because usb devs want to keep promoting
the devices to level 2 for various reaons.  At the end of it
they suggested using SG_FLAG_LUN_INHIBIT so that the usb device
could stay level 2 yet vendor specific commands could get passed
through un-touched. Neither of us knew that flag didn't work
anymore, and after I wasn't able to get it to work, that
other conversation I posted previously occured to figure out
what was going on with SG_FLAG_LUN_INHIBIT.

Regards,
Tim Thelin

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [usb-storage] [Merging ATA passthru] on integratingSMART/ATA-Security in usb-storage driver
@ 2005-11-07 22:50 Timothy Thelin
  0 siblings, 0 replies; 6+ messages in thread
From: Timothy Thelin @ 2005-11-07 22:50 UTC (permalink / raw)
  To: James Bottomley, Alan Stern
  Cc: Patrick Mansfield, Matthew Dharm, thomas schorpp,
	USB Storage list, Linux SCSI list, linux-ide




> On Mon, 2005-11-07 at 15:59 -0500, Alan Stern wrote:
> > > That is, is usb-storage forcing scsi-2 when the device 
> tells us it is
> > > scsi-3 compliant, or is the hardware reporting devices 
> are scsi-2, yet
> > > requiring non-LUN value in cdb[1]?
> > 
> > I think we may have both.  However I don't know how this 
> Cypress chip
> > reports itself.  A system log showing the INQUIRY data would be very
> > helpful.
> 
> We were told in prior emails that it actually reports a level of zero
> (i.e. no compliance with any SCSI standard).  My original proposal was
> just not to modify the CDB[1] for this case if we could get 
> the INQUIRY
> passed through unmangled.

Here is the inquiry data on my CY7C68300B:
00-03: 00 00 00 00
04-07: 1F 00 00 00
08-11: 57 44 43 20
12-15: 57 44 34 30
16-19: 30 55 45 2D
20-23: 30 30 48 43
24-27: 54 30 20 20
28-31: 20 20 20 20
32-35: 30 30 30 30
36-39: 00 00 00 00
40-43: 00 00 00 00

Regards,
Tim Thelin

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [usb-storage] [Merging ATA passthru] on integrating SMART/ATA-Security in usb-storage driver
@ 2005-11-07 18:57 Patrick Mansfield
       [not found] ` <Pine.LNX.4.44L0.051107144956 0.5078-100000@iolanthe.rowland.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Mansfield @ 2005-11-07 18:57 UTC (permalink / raw)
  To: thomas schorpp
  Cc: James Bottomley, Timothy Thelin, usb-storage, linux-ide,
	Linux SCSI list

On Mon, Nov 07, 2005 at 06:54:58PM +0100, thomas schorpp wrote:
> Bus 004 Device 003: ID 04b4:6830 Cypress Semiconductor Corp. USB-2.0 IDE Adapter
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        64
>   idVendor           0x04b4 Cypress Semiconductor Corp.
>   idProduct          0x6830 USB-2.0 IDE Adapter

So this is a USB to ATA/ATAPI bridge?

Can we trigger black listing based on the above vendor/product values?
i.e. can you check for these values in usb-storage slave_configure code?

I am ATA ignorant ... how does this thing pass multi-lun values to the ATA
side? Is it just effectively not allowed in ATA?

Per earlier email, datasheet is here:

http://www.cypress.com/portal/server.pt?space=CommunityPage&control=SetCommunity&CommunityID=209&PageID=259&fid=14&rpn=CY7C68320

On page 13 of datasheet:

Sounds like this device has special snooping of cdb[1], so if it sees 0x24
in there it looks for an embedded ATA command, and translates and sends
that to the underlying device, so we can never black list based on the
device that we are using to send the SG_IO ioctl.

Yeh, some other hardware might want lun inihibit in the future, and that
could still be added back, but IMHO black list is better.

-- Patrick Mansfield

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [usb-storage] [Merging ATA passthru] on integratingSMART/ATA-Security in usb-storage driver
@ 2005-11-07 18:53 Timothy Thelin
  0 siblings, 0 replies; 6+ messages in thread
From: Timothy Thelin @ 2005-11-07 18:53 UTC (permalink / raw)
  To: James Bottomley, Matthew Dharm
  Cc: t.schorpp, usb-storage, linux-ide, Linux SCSI list


> 
> Well, that might be a problem if it weren't for the fact that this
> LUN_INHIBIT flag was removed in 2002.  If it's taken three 
> years to find
> a device that has a problem with it, I don't really think it's a
> particularly widespread problem.  
>
> ...snip....
>
> James
> 

Just as an FYI to shed some light....

It took Western Digital 3 years to find the problem because September
(back when I started the other conversation about this topic) was the
first time we've tried to get access to a USB storage device under
Linux using a passthru CDB.  Maxtor and Seagate might be in a similar
boat (but obviously that's just speculation), and it's not like thumb
drives need ATA passthru support.

This also isn't the first time a kernel issue has been around for a
while, but nobody noticed. Fixed in 2.6.14 was a bug that existed for
(as far as I can tell) all of 2.6.x.  The kernel would oops on pio-out
HDIO_DRIVE_TASKFILE ioctls because of a null pointer.  The first
time I tried to do a pio-out command I hit it, yet nobody had
complained about it as far as I could tell.  The kernel 2.6.x series
has been out how long?  I was baffled and my only guess was that
even though the API was there for pio-out, nobody was using it.

I wonder if it's the same issue with vendor specific cdbs to USB
storage devices; nobody is really using it?

The cypress passthru CDB works fine under Windows, and since
most companies only care about Windows, they probably didn't
even try to get it to work under Linux.  For instance I wasn't
even told to support it under Linux until some people hit a 
Windows limitation they couldn't get around.

The other possibility is that for groups that do use vendor specific
CDBs and have never had this issue, they probably have CDBs that don't
stick meaningful bits where the LUN goes, so therefore it was never an
issue.  However, both the ATACB and the SAT passthru CDB have
meaningful bits there.


Regards,
Tim Thelin

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [usb-storage] [Merging ATA passthru] on integrating SMART/ATA-Security in usb-storage driver
@ 2005-11-04 18:30 Timothy Thelin
  2005-11-04 23:46 ` Pete Zaitcev
  0 siblings, 1 reply; 6+ messages in thread
From: Timothy Thelin @ 2005-11-04 18:30 UTC (permalink / raw)
  To: Matthew Dharm, James Bottomley
  Cc: t.schorpp, usb-storage, linux-ide, Linux SCSI list

> 
> On Thu, Nov 03, 2005 at 11:08:07PM -0500, James Bottomley wrote:
> > On Wed, 2005-11-02 at 15:45 -0800, Matthew Dharm wrote:
> > > On Wed, Nov 02, 2005 at 02:18:52PM -0800, Timothy Thelin wrote:
> > > > 
> > > > If you had time to spare, instead of touching usb-storage,
> > > > it might be better spent resurecting SG_FLAG_LUN_INHIBIT to
> > > > stop the above behavior so that SG_IO cdbs can be passed
> > > > through untouched.
> > > > (SG_FLAG_FUN_INHIBIT was a flag SG_IO used to support a long
> > > > time ago, and I have no idea why it was dropped, but it was)
> > > 
> > > I didn't realize that had been removed.  Anyone that sends a
> > > vendor-specific command to a device needs this flag to 
> make sure it goes
> > > through unmangled.
> > > 
> > > Perhaps someone on linux-scsi can comment on why this was 
> removed and how
> > > we might get it back?
> > 
> > I've no distinct recollection of someone removing this, but if I
> > remember correctly what it used to do, it was a hack to stop us from
> > mangling SCSI-3 CDB's.  We fixed the mid-layer not to 
> require the hack
> > by only setting the CDB[1] lun field for SCSI-1 and SCSI-2 
> devices (as
> > the standards mandate).  What's the actual problem?  No 
> SCSI-1 or SCSI-2
> > device should have any vendor specific CDBs that uses these bits in
> > CDB[1].
> 
> Unfortunately, reality appears to disagree with the last 
> "should".  I've
> personally seen devices with vendor-specific commands that 
> want to control
> CDB[1] in SCSI-2.
> 
> I didn't know it was removed; I only know what Timothy Thelin 
> told me.  Can
> we get the feature back?
> 
> Matt

And for an even more concrete example:
The CY7C68300B cypress bridge board (has various siblings as well
on their site that act very similar) implements SCSI spec 0 (ie it
doesn't claim to support any scsi spec).  Now usb-storage sees
this in inquiry, and decides to export the device as a scsi2 device
since based on the usb-storage devs' experience most usb devices
really want scsi2 cdbs.  So SCSI core thinks this is a scsi2 device
and procedes to mangle the cdbs as they're going through.

The problem then is with vendor specific commands as SCSI core
mangles those as well.  The vendor specific command I had issues
with is the "ATACB" ATA passthru cdb that cypress boards understand.
CDB[1] is a signature byte that must be 0x24.  Needless to say,
that leading 2 gets masked off to a 0, and the drive aborts the
ATACB.  Now cypress could have been smarter about designing their
cdb, but they wern't, and so there really needs to be a way to tell
SCSI core "hands off the cdb".

This is also going to be an issue with USB devices that implement
SAT passthru but state they implement SCSI spec 0, as SAT passthru
CDB[1] can't afford to be mangled either.

I started this conversation a little over a month ago, but it died.
http://marc.theaimsgroup.com/?l=linux-scsi&m=112714917116713&w=2

Regards,
Tim Thelin






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-11-08 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-04 19:59 [usb-storage] [Merging ATA passthru] on integratingSMART/ATA-Security in usb-storage driver Timothy Thelin
2005-11-04 20:40 ` James Bottomley
  -- strict thread matches above, loose matches on Subject: below --
2005-11-07 22:50 Timothy Thelin
2005-11-07 18:57 [usb-storage] [Merging ATA passthru] on integrating SMART/ATA-Security " Patrick Mansfield
     [not found] ` <Pine.LNX.4.44L0.051107144956 0.5078-100000@iolanthe.rowland.org>
2005-11-07 20:47   ` Patrick Mansfield
2005-11-08 13:51     ` [usb-storage] [Merging ATA passthru] on integratingSMART/ATA-Security " Pat LaVarre
2005-11-07 18:53 Timothy Thelin
2005-11-04 18:30 [usb-storage] [Merging ATA passthru] on integrating SMART/ATA-Security " Timothy Thelin
2005-11-04 23:46 ` Pete Zaitcev
2005-11-05 16:20   ` thomas schorpp
2005-11-05 18:01     ` [usb-storage] [Merging ATA passthru] on integratingSMART/ATA-Security " Pat LaVarre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox