[openfirmware] [commit] r1741 - dev/usb2/device/storage
repository service
svn at openfirmware.info
Sat Feb 13 06:59:36 CET 2010
Author: wmb
Date: Sat Feb 13 06:59:35 2010
New Revision: 1741
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1741
Log:
USB mass storage driver - fixed a potential coherence problem that could result from having multiple deblocker instances open on the same device.
Modified:
dev/usb2/device/storage/scsicom.fth
dev/usb2/device/storage/scsidisk.fth
Modified: dev/usb2/device/storage/scsicom.fth
==============================================================================
--- dev/usb2/device/storage/scsicom.fth Sat Feb 13 06:58:02 2010 (r1740)
+++ dev/usb2/device/storage/scsicom.fth Sat Feb 13 06:59:35 2010 (r1741)
@@ -73,7 +73,7 @@
\ block or record oriented, but the OBP external interface is byte-oriented,
\ in order to be independent of particular device block sizes.
-0 instance value deblocker
+0 value deblocker
: init-deblocker ( -- okay? )
" " " deblocker" $open-package to deblocker
deblocker if
Modified: dev/usb2/device/storage/scsidisk.fth
==============================================================================
--- dev/usb2/device/storage/scsidisk.fth Sat Feb 13 06:58:02 2010 (r1740)
+++ dev/usb2/device/storage/scsidisk.fth Sat Feb 13 06:59:35 2010 (r1741)
@@ -139,8 +139,8 @@
\ This method is called by the deblocker
-0 instance value #blocks
-0 instance value block-size
+0 value #blocks
+0 value block-size
headers
@@ -193,40 +193,54 @@
\ Methods used by external clients
+0 value open-count
+
: open ( -- flag )
my-unit parent-set-address
- \ Set timeout to 45 sec: some large (>1GB) drives take
- \ up to 30 secs to spin up.
- d# 45 d# 1000 * set-timeout
+ open-count if
+ d# 2000 set-timeout
+ else
- unit-ready? 0= if false exit then
+ \ Set timeout to 45 sec: some large (>1GB) drives take
+ \ up to 30 secs to spin up.
+ d# 45 d# 1000 * set-timeout
- \ It might be a good idea to do an inquiry here to determine the
- \ device configuration, checking the result to see if the device
- \ really is a disk.
+ unit-ready? 0= if false exit then
- \ Make sure the disk is spinning
+ \ It might be a good idea to do an inquiry here to determine the
+ \ device configuration, checking the result to see if the device
+ \ really is a disk.
- timed-spin if false exit then
+ \ Make sure the disk is spinning
- read-block-extent if false exit then ( block-size #blocks )
- to #blocks to block-size
+ timed-spin if false exit then
- d# 2000 set-timeout
+ read-block-extent if false exit then ( block-size #blocks )
+ to #blocks to block-size
- init-deblocker 0= if false exit then
+ d# 2000 set-timeout
+ init-deblocker 0= if false exit then
+ then
init-label-package 0= if
- deblocker close-package false exit
+ open-count 0= if
+ deblocker close-package
+ then
+ false exit
then
+ open-count 1+ to open-count
+
true
;
: close ( -- )
- label-package close-package
- deblocker close-package
+ open-count dup 1- 0 max to open-count ( old-open-count )
+ label-package close-package ( old-open-count )
+ 1 = if
+ deblocker close-package
+ then
;
: seek ( offset.low offset.high -- okay? )
More information about the openfirmware
mailing list