summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2009-03-19 16:19:52 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2009-03-19 16:19:52 +0000
commit2fddcd7c4f88c041f8bafef312042a061bd67400 (patch)
tree8cbd32e7a8a1fea5d32d5e4fb72af698abeffb2f
parentd33b521bf262a622395a652449ec014f463f9224 (diff)
For pass-through commands adjust timeout value to what controller
supports. Make sure our timeout will be fired after controller gives up.
-rw-r--r--sys/dev/pci/ips.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c
index 2f7db15cf31..50c43b81efe 100644
--- a/sys/dev/pci/ips.c
+++ b/sys/dev/pci/ips.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ips.c,v 1.76 2009/03/19 16:07:14 grange Exp $ */
+/* $OpenBSD: ips.c,v 1.77 2009/03/19 16:19:51 grange Exp $ */
/*
* Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org>
@@ -1032,12 +1032,22 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs)
dcdb->attr |= IPS_DCDB_DATAIN;
if (xs->flags & SCSI_DATA_OUT)
dcdb->attr |= IPS_DCDB_DATAOUT;
- if (xs->timeout <= 10000)
+
+ /*
+ * Adjust timeout value to what controller supports. Make sure our
+ * timeout will be fired after controller gives up.
+ */
+ if (xs->timeout <= 10000) {
dcdb->attr |= IPS_DCDB_TIMO10;
- else if (xs->timeout <= 60000)
+ xs->timeout = 11000;
+ } else if (xs->timeout <= 60000) {
dcdb->attr |= IPS_DCDB_TIMO60;
- else
+ xs->timeout = 61000;
+ } else {
dcdb->attr |= IPS_DCDB_TIMO20M;
+ xs->timeout = 20 * 60000 + 1000;
+ }
+
dcdb->attr |= IPS_DCDB_DISCON;
dcdb->datalen = htole16(xs->datalen);
dcdb->cdblen = xs->cmdlen;