[OpenBIOS] r751 - dev/usb2/device/storage

svn at openbios.org svn at openbios.org
Thu Dec 6 00:12:36 CET 2007


Author: wmb
Date: 2007-12-06 00:12:36 +0100 (Thu, 06 Dec 2007)
New Revision: 751

Modified:
   dev/usb2/device/storage/scsidisk.fth
Log:
OLPC trac 5354 - retry read-capacity command for USB mass storage devices
that need extra startup time.


Modified: dev/usb2/device/storage/scsidisk.fth
===================================================================
--- dev/usb2/device/storage/scsidisk.fth	2007-12-05 03:44:34 UTC (rev 750)
+++ dev/usb2/device/storage/scsidisk.fth	2007-12-05 23:12:36 UTC (rev 751)
@@ -67,11 +67,18 @@
    \ The SCSI-2 standard requires disk devices to implement
    \ the "read capacity" command.
 
-   8  read-capacity-cmd 0a  short-data-command  if  ( )
-      true
-   else                                             ( adr )
-      dup 4 + 4c@  swap 4c@  1+  false
-   then
+   \ Retry it a few times just in case that helps
+   d# 20  0  do
+      8  read-capacity-cmd 0a  short-data-command  0=  if  ( )
+         dup 4 + 4c@  swap 4c@  1+  false
+         unloop exit
+      then
+      d# 200 ms
+   loop
+
+   \ If it fails, we just guess.  Some devices violate the spec and
+   \ fail to implement read_capacity
+   d# 512  h# ffffffff  false
 ;
 
 external




More information about the OpenBIOS mailing list