[openfirmware] r1449 - dev/usb2/device/storage
svn at openfirmware.info
svn at openfirmware.info
Fri Oct 30 08:52:42 CET 2009
Author: wmb
Date: 2009-10-30 08:52:42 +0100 (Fri, 30 Oct 2009)
New Revision: 1449
Modified:
dev/usb2/device/storage/scsi.fth
dev/usb2/device/storage/scsidisk.fth
Log:
OLPC trac 9423 - USB mass storage driver - Made csw timeouts retryable
to work around a problem with a Kingston USB key. The problem could
be in the hardware but I was unable to solve it and the retry seems to
make the system work stably.
Modified: dev/usb2/device/storage/scsi.fth
===================================================================
--- dev/usb2/device/storage/scsi.fth 2009-10-30 07:46:16 UTC (rev 1448)
+++ dev/usb2/device/storage/scsi.fth 2009-10-30 07:52:42 UTC (rev 1449)
@@ -104,12 +104,14 @@
r> /cbw ( cbw-adr,len )
;
-: (get-csw) ( -- len usberr ) csw /csw bulk-in-pipe bulk-in ;
+: (get-csw) ( -- len usberr ) csw /csw erase csw /csw bulk-in-pipe bulk-in ;
: get-csw ( -- len usberr )
(get-csw) dup if 2drop (get-csw) then
;
-d# 15,000 constant bulk-timeout
+\ This used to be 15 seconds but I shortened it so timeouts can be
+\ retried without having to wait too long.
+d# 2,000 constant bulk-timeout
: (execute-command) ( data-adr,len dir cbw-adr,len -- actual-len cswStatus )
debug? if
@@ -136,7 +138,13 @@
rot drop ( actual csw-len csw-usberror )
- ?dup if nip exit then ( actual csw-len csw-usberror )
+ ?dup if ( actual csw-len csw-usberror )
+ nip ( actual csw-usberror )
+ dup h# 10000000 = if ( actual csw-usberror )
+ 2drop 0 2 ( 0 2 ) \ Convert timeout error to a retry
+ then ( actual usberror )
+ exit
+ then ( actual csw-len csw-usberror )
drop ( actual )
debug? if
Modified: dev/usb2/device/storage/scsidisk.fth
===================================================================
--- dev/usb2/device/storage/scsidisk.fth 2009-10-30 07:46:16 UTC (rev 1448)
+++ dev/usb2/device/storage/scsidisk.fth 2009-10-30 07:52:42 UTC (rev 1449)
@@ -213,6 +213,8 @@
read-block-extent if false exit then ( block-size #blocks )
to #blocks to block-size
+ d# 2000 set-timeout
+
init-deblocker 0= if false exit then
init-label-package 0= if
More information about the openfirmware
mailing list