Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Dec 2002 16:25:40 -0800 (PST)
From:      Nate Lawson <nate@root.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: UMASS USB bug? (getting the Sony disk-on-key device working)
Message-ID:  <Pine.BSF.4.21.0212191442450.60085-100000@root.org>
In-Reply-To: <200212191848.gBJImgOq099846@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Dec 2002, Matthew Dillon wrote:
>     Yes, this is a USB DiskKey - UMASS storage, SCSI over bulk only device.
> 
>     I've done some further testing on both -current and -stable.  I cannot
>     get the device to work unless I have the quirk entry in scsi_da.c.
> 
>     -Current has a quirk table for umass.c and already has a flag which
>     disables the residue test.  The patch for current thus does not require
>     #if 0'ing out that code, only a quirk entry.  Since I don't need any
>     hacks beyond what is there already I am going to commit the two quirk
>     entries for -current now.

Please respect the maintainer of da(4).  There's info about quirk
documentation at:
   http://www.root.org/~nate/freebsd/quirks.html

I still have a broken finger and a job so slow responses do not mean I am
ignoring you.

>     However, I am still unable to get the device to work properly in 
>     -Current.  This is what happens (see below). 
> 
> test2 kernel: umass0: Sony USB Storage Media, rev 1.10/2.00, addr 2
> test2 kernel: umass0: Get Max Lun not supported (IOERROR)
> test2 kernel: da2 at umass-sim0 bus 0 target 0 lun 0
> test2 kernel: da2: <Sony Storage Media 2.51> Removable Direct Access SCSI-0 device
> test2 kernel: da2: 1.000MB/s transfers
> test2 kernel: da2: Attempt to query device size failed: UNIT ATTENTION, Medium not present

Bus scan is probably happening before the device is fully powered up.  
One problem I noticed was that umass_cam_rescan() doesn't fill out the ccb
properly, leaving timeout as 0 for instance.  This probably won't hurt but
I'm not sure.  Another bug available from cursory overview is:

                if (csio->ccb_h.flags & CAM_CDB_POINTER) {
                        cmd = (unsigned char *) csio->cdb_io.cdb_ptr;
                } else {
                        cmd = (unsigned char *) &csio->cdb_io.cdb_bytes;
                }

The & is extraneous.  Not sure why this doesn't bomb horribly later.

> test2 kernel: (da2:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0
> test2 kernel: (da2:umass-sim0:0:0:0): CAM Status: SCSI Status Error
> test2 kernel: (da2:umass-sim0:0:0:0): SCSI Status: Check Condition
> test2 kernel: (da2:umass-sim0:0:0:0): UNIT ATTENTION asc:3a,0
> test2 kernel: (da2:umass-sim0:0:0:0): Medium not present
> test2 kernel: (da2:umass-sim0:0:0:0): Retrying Command (per Sense Data)

CAM retries the CCB as requested by scsi_da.c in daopen().

> test2 kernel: Opened disk da2 -> 6
> 
>    But then I get this:
> 
> test2 kernel: (da2:umass-sim0:0:0:0): Not ready to ready change, medium may have changed
> test2 kernel: (da2:umass-sim0:0:0:0): Retrying Command (per Sense Data)
> 	(no retry occurs)
> 
>    And if I tell cam to rescan a different Lun it works:

Because the device has had time to power up.

>     I am not sure what is going on but I think in -current CAM is
>     exhausting its retries too quickly (the messages are instantanious)
>     and not giving the device enough time to boot up.  This is because,
>     I believe, the usb controller is now a kerneland thread instead of
>     a userland usbd and is responding instantly to the device presence.

No, umass is attaching before the device is ready.  Note the difference in
delay between camcontrol rescan on a SPI bus vs. USB.  The SPI controller
is taking the appropriate time per device for it to respond to select.  
umass_cam_attach attempts to delay the bus scan to have the same effect
but may not be working properly here.  I have no idea what the USB spec
says here.
 
>     I would have expected 'camcontrol rescan 2:0:0' but it doesn't.
>     It just says:
> 
>     # camcontrol rescan 2:0:0
>     Re-scan of 2:0:0 was successful
> 
>     But then doesn't do anything.

umass is not calling the attach code again for some reason.

-Nate


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0212191442450.60085-100000>