summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2007-02-23 05:51:57 +0000
committermjacob <mjacob@FreeBSD.org>2007-02-23 05:51:57 +0000
commit915edfc6181812aef4328b273b73f567dc354014 (patch)
tree313531e53c900a9911440fd2d06b2fad48fb6a55 /sys/dev/isp
parent5688edd0032e2541fedeaa58a3f918aa0af73835 (diff)
downloadFreeBSD-src-915edfc6181812aef4328b273b73f567dc354014.zip
FreeBSD-src-915edfc6181812aef4328b273b73f567dc354014.tar.gz
Use the new xpt_rescan function to truly now have dynamic
attachment of new devices that arrive (and we notice them via async Fibre Channel events). We've always had the right thing (of sorts) happen when devices go away- this is the corollary function that makes multipath failover actually work. MFC after: 2 weeks
Diffstat (limited to 'sys/dev/isp')
-rw-r--r--sys/dev/isp/isp_freebsd.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 124a6ee..dc4e5b8 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -2129,21 +2129,44 @@ isp_watchdog(void *arg)
#if __FreeBSD_version >= 500000
-#define isp_make_here(isp, tgt) isp_announce(isp, tgt, AC_FOUND_DEVICE)
-#define isp_make_gone(isp, tgt) isp_announce(isp, tgt, AC_LOST_DEVICE)
-
/*
- * Support function for Announcement
+ * Support functions for Found/Lost
*/
static void
-isp_announce(ispsoftc_t *isp, int tgt, int action)
+isp_make_here(ispsoftc_t *isp, int tgt)
{
- struct cam_path *tmppath;
+ union ccb *ccb;
+ ISPLOCK_2_CAMLOCK(mpt);
+ /*
+ * Allocate a CCB, create a wildcard path for this bus,
+ * and schedule a rescan.
+ */
+ ccb = xpt_alloc_ccb_nowait();
+ if (ccb == NULL) {
+ isp_prt(isp, ISP_LOGWARN, "unable to alloc CCB for rescan");
+ CAMLOCK_2_ISPLOCK(mpt);
+ return;
+ }
+ if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
+ cam_sim_path(isp->isp_sim), tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ CAMLOCK_2_ISPLOCK(mpt);
+ isp_prt(isp, ISP_LOGWARN, "unable to create path for rescan");
+ xpt_free_ccb(ccb);
+ return;
+ }
+ xpt_rescan(ccb);
+ CAMLOCK_2_ISPLOCK(mpt);
+}
+
+static void
+isp_make_gone(ispsoftc_t *isp, int tgt)
+{
+ struct cam_path *tp;
ISPLOCK_2_CAMLOCK(isp);
- if (xpt_create_path(&tmppath, NULL, cam_sim_path(isp->isp_sim), tgt,
+ if (xpt_create_path(&tp, NULL, cam_sim_path(isp->isp_sim), tgt,
CAM_LUN_WILDCARD) == CAM_REQ_CMP) {
- xpt_async(action, tmppath, NULL);
- xpt_free_path(tmppath);
+ xpt_async(AC_LOST_DEVICE, tp, NULL);
+ xpt_free_path(tp);
}
CAMLOCK_2_ISPLOCK(isp);
}
@@ -3651,9 +3674,9 @@ isp_mbox_wait_complete(ispsoftc_t *isp, mbreg_t *mbp)
}
if (isp->isp_osinfo.mboxcmd_done == 0) {
isp_prt(isp, ISP_LOGWARN,
- "%s Mailbox Command (0x%x) Timeout",
+ "%s Mailbox Command (0x%x) Timeout (%uus)",
isp->isp_osinfo.mbox_sleep_ok? "Interrupting" : "Polled",
- isp->isp_lastmbxcmd);
+ isp->isp_lastmbxcmd, usecs);
mbp->param[0] = MBOX_TIMEOUT;
isp->isp_osinfo.mboxcmd_done = 1;
}
OpenPOWER on IntegriCloud