Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Dec 2001 07:07:11 -0700
From:      Scott Long <scott_long@btc.adaptec.com>
To:        John Baldwin <jhb@freebsd.org>
Subject:   Re: Need some help with CAM and UMASS
Message-ID:  <20011211070711.A1544@hollin.btc.adaptec.com>
In-Reply-To: <XFMail.011211014610.jhb@FreeBSD.org>
References:  <XFMail.011211014610.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, Dec 11, 2001 at 01:46:10AM -0800, John Baldwin wrote:
> I have a simple task I need to perform, but the surface reading of the code has
> me convinced that I need to ask some experts for advice. :)  Basically, I need
> a way to have the umass driver inform the da driver of quirks.  USB mass
> storage devices use several different protocols to communicate.  Two of those
> protocols are UFI and it's limited ATAPI support.  The way that umass works is
> to take SCSI commands from da(4) and translate those as appropriate before
> sending them out to the USB device.  Neither the UFI or ATAPI commands support
> 6 byte commands or the Synchronize cache commands.  What we have done so far is
> to add a quirk entry for _every_ single USB device that uses UFI or ATAPI to
> turn these off.  Obviously, this doesn't scale.

Yes, this is very ugly.  There were two proposals discussed here a few weeks
ago:

1) Add infrastructure so that SIMs can inform the XPT of SIM-wide quirks at
   registration time, similar to what you describe below.

2) Teach the da driver to automatically revert to 10 byte commands when a
   6 byte command fails.

Both solutions could be implemented and exist together, IMO.

> However, it just got worse. 
> I've got a neat little MP3 player here that uses a USB2IDE interface that takes
> any laptop IDE hard drive.  da(4) gets the name of the actual drive, so to get
> it to work I have to use a bogus quirk on the ATA drive name!
> 
> umass0: SL IDE SL IDE, rev 1.10/2.6c, addr 2
> da0 at umass-sim0 bus 0 target 0 lun 0
> da0: <IBM-DARA -206000 AR2H> Fixed Direct Access SCSI-CCS device 
> da0: 650KB/s transfers
> da0: 4887MB (10009441 512 byte sectors: 64H 32S/T 4887C)
> umass0: Unsupported UFI command 0x08, 6 byte command should have been converted
> da0: reading primary partition table: error reading fsbn 0
> umass0: Unsupported UFI command 0x35
> (da0:umass-sim0:0:0:0): Synchronize cache failed, status == 0x6, scsi status == 
> 0x0
> 
> Obviously this is less than desirable.  Now there are a few ways of fixing
> this.  One way would be to teach the USB code how to transform a 6 byte command
> into a 10 byte command.

No!

> This still doesn't address the syncache problem however. 

It was pointed out recently that this quirk should only be used on devices
that actually go haywire when they receive this command.  Non-fatal errors
could be masked by bootverbose.

> What I would like to do is be able to have the umass driver pass in a
> flag to daregister() somehow that instructs it to turn on the NO_6_BYTE and
> NO_SYNCACHE quirks for this device.  This would eliminate all the USB quirks in
> da.c I think and really fix this problem in a central location.  However, here
> is where I have a problem: trying to figure out how we get from a USB device in
> umass to a da device under the umass sim bus, and how to pass the quirks in
> across that boundary.  So, what are your ideas cam wizards?  Creating quirks
> for each USB device just doesn't scale and this problem really should be fixed
> the right way IMO.

Patches are welcome!  Ken, Justin, and I are over our heads in work right
now, hopefully one of us can devote some effort to CAM in a few months.

It is interesting that you are working on the ATAPI support in umass.c.  The
last time I talked to Nick about it, he said it was a gross hack and didn't
want it to be turned on.  Has he changed his mind?

Scott

> 
> -- 
> 
> John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-scsi" in the body of the message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011211070711.A1544>