Open Firmware

Open Firmware Commit Details

Date:2014-05-10 05:44:05 (3 months 20 days ago)
Author:quozl
Commit:3726
Parents: 3725
Message:scsidisk - retry TEST UNIT READY once Some USB flash drives violate section 3.4 of the USB Mass Storage Specification For Bootability 1.0, October 25, 2004, by responding to TEST UNIT READY with CHECK CONDITION status with a sense key of NOT READY, and an additional sense code of MEDIUM NOT PRESENT. Section 3.4 says "If the Device cannot become operational or in a state such that a Host Computer action is required to make the Device ready, the Device returns CHECK CONDITION status with a sense key of NOT READY." So the device either cannot become operational, or requires action of the host. However, a second TEST UNIT READY is successful, without any other action of the host other than trying again. READ CAPACITY and READ commands also fail if they are done first, before the device admits to being ready. Section 3.4 also says "Devices are expected to respond promptly to indicate the current status of the Device." Section 6.1 of the USB Mass Storage Class - Compliance Test Specification 0.9a, June 30, 2006, says "Issue a Test Unit Ready command. Repeat until the device indicates a ready state."
Changes:
M/dev/usb2/device/storage/scsidisk.fth

File differences

dev/usb2/device/storage/scsidisk.fth
4343
4444
4545
46
47
48
49
50
51
52
53
4654
4755
4856
......
206214
207215
208216
209
217
210218
211219
212220
" "(00 00 00 00 00 00)" drop no-data-command 0=
;
\ Some devices require a second TEST UNIT READY, despite returning
\ CHECK CONDITION, with sense NOT READY and MEDIUM NOT PRESENT.
: retry-unit-ready? ( -- ready? )
unit-ready? ?dup if exit then
unit-ready?
;
\ Ensures that the disk is spinning, but doesn't wait forever
create sstart-cmd h# 1b c, 0 c, 0 c, 0 c, 1 c, 0 c,
\ up to 30 secs to spin up.
d# 45 d# 1000 * set-timeout
unit-ready? 0= if false exit then
retry-unit-ready? 0= if false exit then
\ It might be a good idea to do an inquiry here to determine the
\ device configuration, checking the result to see if the device

Archive Download the corresponding diff file

Revision: 3726