aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mpt
diff options
context:
space:
mode:
authorSteven Hartland <smh@FreeBSD.org>2014-11-21 21:01:24 +0000
committerSteven Hartland <smh@FreeBSD.org>2014-11-21 21:01:24 +0000
commit85c9dd9d895261632d58cf98da6608b93dd5d7f8 (patch)
tree5ebdafcf9900ec8ee871257dadfca8fdc7f4aa95 /sys/dev/mpt
parent7db6c5cde6083b3cf76f1f85225c19052722dfd5 (diff)
Notes
Diffstat (limited to 'sys/dev/mpt')
-rw-r--r--sys/dev/mpt/mpt.c14
-rw-r--r--sys/dev/mpt/mpt.h8
-rw-r--r--sys/dev/mpt/mpt_cam.c6
3 files changed, 15 insertions, 13 deletions
diff --git a/sys/dev/mpt/mpt.c b/sys/dev/mpt/mpt.c
index ea8b556ee3ad..2f7bfc25c703 100644
--- a/sys/dev/mpt/mpt.c
+++ b/sys/dev/mpt/mpt.c
@@ -1320,17 +1320,19 @@ mpt_wait_req(struct mpt_softc *mpt, request_t *req,
mpt_req_state_t state, mpt_req_state_t mask,
int sleep_ok, int time_ms)
{
- int error;
int timeout;
u_int saved_cnt;
+ sbintime_t sbt;
/*
- * timeout is in ms. 0 indicates infinite wait.
- * Convert to ticks or 500us units depending on
+ * time_ms is in ms, 0 indicates infinite wait.
+ * Convert to sbintime_t or 500us units depending on
* our sleep mode.
*/
if (sleep_ok != 0) {
- timeout = (time_ms * hz) / 1000;
+ sbt = SBT_1MS * time_ms;
+ /* Set timeout as well so final timeout check works. */
+ timeout = time_ms;
} else {
timeout = time_ms * 2;
}
@@ -1339,8 +1341,8 @@ mpt_wait_req(struct mpt_softc *mpt, request_t *req,
saved_cnt = mpt->reset_cnt;
while ((req->state & mask) != state && mpt->reset_cnt == saved_cnt) {
if (sleep_ok != 0) {
- error = mpt_sleep(mpt, req, PUSER, "mptreq", timeout);
- if (error == EWOULDBLOCK) {
+ if (mpt_sleep(mpt, req, PUSER, "mptreq", sbt) ==
+ EWOULDBLOCK) {
timeout = 0;
break;
}
diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h
index 3835d21bde01..1dcd76f52480 100644
--- a/sys/dev/mpt/mpt.h
+++ b/sys/dev/mpt/mpt.h
@@ -771,10 +771,10 @@ mpt_assign_serno(struct mpt_softc *mpt, request_t *req)
#define MPT_UNLOCK(mpt) mtx_unlock(&(mpt)->mpt_lock)
#define MPT_OWNED(mpt) mtx_owned(&(mpt)->mpt_lock)
#define MPT_LOCK_ASSERT(mpt) mtx_assert(&(mpt)->mpt_lock, MA_OWNED)
-#define mpt_sleep(mpt, ident, priority, wmesg, timo) \
- msleep(ident, &(mpt)->mpt_lock, priority, wmesg, timo)
-#define mpt_req_timeout(req, ticks, func, arg) \
- callout_reset(&(req)->callout, (ticks), (func), (arg))
+#define mpt_sleep(mpt, ident, priority, wmesg, sbt) \
+ msleep_sbt(ident, &(mpt)->mpt_lock, priority, wmesg, sbt, 0, 0)
+#define mpt_req_timeout(req, sbt, func, arg) \
+ callout_reset_sbt(&(req)->callout, (sbt), 0, (func), (arg), 0)
#define mpt_req_untimeout(req, func, arg) \
callout_stop(&(req)->callout)
#define mpt_callout_init(mpt, c) \
diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c
index 25c4f33584f5..b60afe124125 100644
--- a/sys/dev/mpt/mpt_cam.c
+++ b/sys/dev/mpt/mpt_cam.c
@@ -1630,7 +1630,7 @@ out:
ccb->ccb_h.status |= CAM_SIM_QUEUED;
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
- mpt_req_timeout(req, (ccb->ccb_h.timeout * hz) / 1000,
+ mpt_req_timeout(req, SBT_1MS * ccb->ccb_h.timeout,
mpt_timeout, ccb);
}
if (mpt->verbose > MPT_PRT_DEBUG) {
@@ -2016,7 +2016,7 @@ out:
ccb->ccb_h.status |= CAM_SIM_QUEUED;
if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) {
- mpt_req_timeout(req, (ccb->ccb_h.timeout * hz) / 1000,
+ mpt_req_timeout(req, SBT_1MS * ccb->ccb_h.timeout,
mpt_timeout, ccb);
}
if (mpt->verbose > MPT_PRT_DEBUG) {
@@ -4752,7 +4752,7 @@ mpt_scsi_tgt_status(struct mpt_softc *mpt, union ccb *ccb, request_t *cmd_req,
req->serno, tgt->resid);
if (ccb) {
ccb->ccb_h.status = CAM_SIM_QUEUED | CAM_REQ_INPROG;
- mpt_req_timeout(req, 60 * hz, mpt_timeout, ccb);
+ mpt_req_timeout(req, SBT_1S * 60, mpt_timeout, ccb);
}
mpt_send_cmd(mpt, req);
}