summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2009-01-08 10:16:02 +0000
committerraj <raj@FreeBSD.org>2009-01-08 10:16:02 +0000
commit6c794050fae360d868aee73697e67d847787a0b5 (patch)
treeb4cab490ce862689df0f189682ab63ff12d1e83b
parent128be91e61347b01ba97af54fb6f94e6e2638141 (diff)
downloadFreeBSD-src-6c794050fae360d868aee73697e67d847787a0b5.zip
FreeBSD-src-6c794050fae360d868aee73697e67d847787a0b5.tar.gz
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
-rw-r--r--sys/cam/cam_xpt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index f2a2d9d..77fb62a 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 */
OpenPOWER on IntegriCloud