diff options
author | Rafal Jaworowski <raj@FreeBSD.org> | 2009-01-08 10:16:02 +0000 |
---|---|---|
committer | Rafal Jaworowski <raj@FreeBSD.org> | 2009-01-08 10:16:02 +0000 |
commit | 2872efae880631e6052fccaabc11cfcd0ba731ec (patch) | |
tree | b4cab490ce862689df0f189682ab63ff12d1e83b /sys | |
parent | 0cab1fd2369c938361ed93befa9191632ef91e2d (diff) | |
download | src-2872efae880631e6052fccaabc11cfcd0ba731ec.tar.gz src-2872efae880631e6052fccaabc11cfcd0ba731ec.zip |
cam: Retry TEST UNIT READY command if not successful.
This fixes problems with discovering some USB devices that are very slow to
respond during initialisation.
When a USB device is inserted, CAM performs the sequence:
1) INQUIRY
2) INQUIRY (second time with other parameters)
3) TEST UNIT READY
4) READ CAPACITY
Before this change CAM didn't check if TEST UNIT READY was successful and went
on blindly to the next state and sent READ CAPACITY. If the device was still
not ready by then, CAM ended with error message. This patch adds checking for the
status of TEST UNIT READY command and retrying up to 10 times with 0.5 sec
interval.
Submitted by: Grzegorz Bernacki gjb ! semihalf dot com
Reviewed by: scottl
Notes
Notes:
svn path=/head/; revision=186891
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/cam_xpt.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index f2a2d9dfa033..77fb62a05410 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -5611,7 +5611,7 @@ probestart(struct cam_periph *periph, union ccb *start_ccb) case PROBE_DV_EXIT: { scsi_test_unit_ready(csio, - /*retries*/4, + /*retries*/10, probedone, MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, @@ -6218,6 +6218,13 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) break; } case PROBE_TUR_FOR_NEGOTIATION: + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + DELAY(500000); + if (cam_periph_error(done_ccb, 0, SF_RETRY_UA, + NULL) == ERESTART) + return; + } + /* FALLTHROUGH */ case PROBE_DV_EXIT: if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ |