Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2007 15:08:47 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 119975 for review
Message-ID:  <200705171508.l4HF8lFe062677@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119975

Change 119975 by jhb@jhb_mutex on 2007/05/17 15:08:33

	IFC @119973

Affected files ...

.. //depot/projects/smpng/sys/cam/cam_xpt.c#46 integrate
.. //depot/projects/smpng/sys/cam/cam_xpt.h#6 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_cd.c#33 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_ch.c#17 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_da.c#77 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_pass.c#18 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_pt.c#15 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_sa.c#29 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_ses.c#16 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_sg.c#3 integrate
.. //depot/projects/smpng/sys/cam/scsi/scsi_targ_bh.c#12 integrate
.. //depot/projects/smpng/sys/conf/Makefile.amd64#16 integrate
.. //depot/projects/smpng/sys/conf/Makefile.arm#26 integrate
.. //depot/projects/smpng/sys/conf/Makefile.i386#28 integrate
.. //depot/projects/smpng/sys/conf/Makefile.ia64#34 integrate
.. //depot/projects/smpng/sys/conf/Makefile.pc98#27 integrate
.. //depot/projects/smpng/sys/conf/Makefile.powerpc#35 integrate
.. //depot/projects/smpng/sys/conf/Makefile.sparc64#30 integrate
.. //depot/projects/smpng/sys/conf/Makefile.sun4v#3 integrate
.. //depot/projects/smpng/sys/conf/NOTES#144 integrate
.. //depot/projects/smpng/sys/conf/files#208 integrate
.. //depot/projects/smpng/sys/dev/acpica/acpi_hpet.c#7 integrate
.. //depot/projects/smpng/sys/dev/bce/if_bce.c#17 integrate
.. //depot/projects/smpng/sys/dev/bce/if_bcefw.h#3 integrate
.. //depot/projects/smpng/sys/dev/bce/if_bcereg.h#8 integrate
.. //depot/projects/smpng/sys/dev/cardbus/cardbus.c#32 integrate
.. //depot/projects/smpng/sys/dev/cardbus/cardbus_cis.c#28 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_80003es2lan.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_80003es2lan.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82540.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82541.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82541.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82542.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82543.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82543.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82571.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82571.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82575.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_82575.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_api.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_api.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_defines.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_hw.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_ich8lan.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_ich8lan.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_mac.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_mac.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_manage.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_manage.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_nvm.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_nvm.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_osdep.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_phy.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_phy.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/e1000_regs.h#2 integrate
.. //depot/projects/smpng/sys/dev/em/if_em.c#83 integrate
.. //depot/projects/smpng/sys/dev/em/if_em.h#41 integrate
.. //depot/projects/smpng/sys/dev/mfi/mfi.c#18 integrate
.. //depot/projects/smpng/sys/dev/mfi/mfi_cam.c#1 branch
.. //depot/projects/smpng/sys/dev/mfi/mfireg.h#7 integrate
.. //depot/projects/smpng/sys/dev/mfi/mfivar.h#7 integrate
.. //depot/projects/smpng/sys/dev/pccbb/pccbb.c#65 integrate
.. //depot/projects/smpng/sys/dev/pci/pci.c#94 integrate
.. //depot/projects/smpng/sys/dev/pci/pci_private.h#22 integrate
.. //depot/projects/smpng/sys/dev/pci/pcireg.h#24 integrate
.. //depot/projects/smpng/sys/dev/uart/uart_bus_pci.c#9 integrate
.. //depot/projects/smpng/sys/geom/part/g_part.c#5 integrate
.. //depot/projects/smpng/sys/kern/kern_mib.c#31 integrate
.. //depot/projects/smpng/sys/kern/uipc_domain.c#19 integrate
.. //depot/projects/smpng/sys/kern/uipc_mbuf.c#54 integrate
.. //depot/projects/smpng/sys/kern/uipc_sockbuf.c#8 integrate
.. //depot/projects/smpng/sys/kern/uipc_socket.c#106 integrate
.. //depot/projects/smpng/sys/kern/uipc_syscalls.c#105 integrate
.. //depot/projects/smpng/sys/modules/mfi/Makefile#4 integrate
.. //depot/projects/smpng/sys/modules/mfi/mfip/Makefile#1 branch
.. //depot/projects/smpng/sys/net/ieee8023ad_lacp.c#7 integrate
.. //depot/projects/smpng/sys/net/if.c#95 integrate
.. //depot/projects/smpng/sys/net/if.h#34 integrate
.. //depot/projects/smpng/sys/net/if_lagg.c#6 integrate
.. //depot/projects/smpng/sys/net/if_var.h#50 integrate
.. //depot/projects/smpng/sys/netgraph/ng_car.c#2 integrate
.. //depot/projects/smpng/sys/netinet/ip_input.c#85 integrate
.. //depot/projects/smpng/sys/netinet/sctp.h#6 integrate
.. //depot/projects/smpng/sys/netinet/sctp_asconf.c#10 integrate
.. //depot/projects/smpng/sys/netinet/sctp_auth.c#10 integrate
.. //depot/projects/smpng/sys/netinet/sctp_constants.h#12 integrate
.. //depot/projects/smpng/sys/netinet/sctp_indata.c#14 integrate
.. //depot/projects/smpng/sys/netinet/sctp_input.c#14 integrate
.. //depot/projects/smpng/sys/netinet/sctp_output.c#14 integrate
.. //depot/projects/smpng/sys/netinet/sctp_pcb.c#14 integrate
.. //depot/projects/smpng/sys/netinet/sctp_sysctl.c#5 integrate
.. //depot/projects/smpng/sys/netinet/sctp_timer.c#11 integrate
.. //depot/projects/smpng/sys/netinet/sctp_uio.h#11 integrate
.. //depot/projects/smpng/sys/netinet/sctp_usrreq.c#15 integrate
.. //depot/projects/smpng/sys/netinet/sctputil.c#16 integrate
.. //depot/projects/smpng/sys/netinet/tcp_input.c#107 integrate
.. //depot/projects/smpng/sys/netinet/tcp_subr.c#95 integrate
.. //depot/projects/smpng/sys/netinet/tcp_timer.c#38 integrate
.. //depot/projects/smpng/sys/netinet/tcp_timer.h#15 integrate
.. //depot/projects/smpng/sys/netinet/tcp_timewait.c#2 integrate
.. //depot/projects/smpng/sys/netinet/tcp_var.h#53 integrate
.. //depot/projects/smpng/sys/netinet/udp_usrreq.c#79 integrate
.. //depot/projects/smpng/sys/netinet6/sctp6_usrreq.c#13 integrate

Differences ...

==== //depot/projects/smpng/sys/cam/cam_xpt.c#46 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.184 2007/05/14 21:48:52 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.187 2007/05/16 16:57:21 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1197,6 +1197,7 @@
 			error = ENOTSUP;
 			break;
 		}
+		xpt_release_bus(bus);
 		break;
 	}
 	/*
@@ -4139,7 +4140,6 @@
 void
 xpt_print_path(struct cam_path *path)
 {
-	mtx_assert(path->bus->sim->mtx, MA_OWNED);
 
 	if (path == NULL)
 		printf("(nopath): ");
@@ -7029,6 +7029,39 @@
 		xpt_free_ccb(done_ccb);
 }
 
+cam_status
+xpt_register_async(int event, ac_callback_t *cbfunc, void *cbarg,
+		   struct cam_path *path)
+{
+	struct ccb_setasync csa;
+	cam_status status;
+	int xptpath = 0;
+
+	if (path == NULL) {
+		mtx_lock(&xsoftc.xpt_lock);
+		status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
+					 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
+		if (status != CAM_REQ_CMP) {
+			mtx_unlock(&xsoftc.xpt_lock);
+			return (status);
+		}
+		xptpath = 1;
+	}
+
+	xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
+	csa.ccb_h.func_code = XPT_SASYNC_CB;
+	csa.event_enable = event;
+	csa.callback = cbfunc;
+	csa.callback_arg = cbarg;
+	xpt_action((union ccb *)&csa);
+	status = csa.ccb_h.status;
+	if (xptpath) {
+		xpt_free_path(path);
+		mtx_unlock(&xsoftc.xpt_lock);
+	}
+	return (status);
+}
+
 static void
 xptaction(struct cam_sim *sim, union ccb *work_ccb)
 {

==== //depot/projects/smpng/sys/cam/cam_xpt.h#6 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/cam/cam_xpt.h,v 1.8 2007/04/15 08:49:09 scottl Exp $
+ * $FreeBSD: src/sys/cam/cam_xpt.h,v 1.9 2007/05/16 16:54:23 scottl Exp $
  */
 
 #ifndef _CAM_CAM_XPT_H
@@ -79,6 +79,8 @@
 void			xpt_rescan(union ccb *ccb);
 void			xpt_lock_buses(void);
 void			xpt_unlock_buses(void);
+cam_status		xpt_register_async(int event, ac_callback_t *cbfunc,
+					   void *cbarg, struct cam_path *path);
 #endif /* _KERNEL */
 
 #endif /* _CAM_CAM_XPT_H */

==== //depot/projects/smpng/sys/cam/scsi/scsi_cd.c#33 (text+ko) ====

@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.100 2007/05/14 21:48:53 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.101 2007/05/16 16:54:23 scottl Exp $");
 
 #include "opt_cd.h"
 
@@ -335,7 +335,6 @@
 cdinit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	mtx_init(&changerq_mtx, "cdchangerq", "SCSI CD Changer List", MTX_DEF);
 	STAILQ_INIT(&changerq);
@@ -344,21 +343,7 @@
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
-
-                xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
-                csa.ccb_h.func_code = XPT_SASYNC_CB;
-                csa.event_enable = AC_FOUND_DEVICE;
-                csa.callback = cdasync;
-                csa.callback_arg = NULL;
-                xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-                xpt_free_path(path);
-        }
+	status = xpt_register_async(AC_FOUND_DEVICE, cdasync, NULL, NULL);
 
 	if (status != CAM_REQ_CMP) {
 		printf("cd: Failed to attach master async callback "
@@ -370,20 +355,13 @@
 cdoninvalidate(struct cam_periph *periph)
 {
 	struct cd_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct cd_softc *)periph->softc;
 
 	/*
 	 * De-register any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = cdasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, cdasync, periph, periph->path);
 
 	softc->flags |= CD_FLAG_INVALID;
 
@@ -639,7 +617,6 @@
 cdregister(struct cam_periph *periph, void *arg)
 {
 	struct cd_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_pathinq cpi;
 	struct ccb_getdev *cgd;
 	char tmpstr[80];
@@ -751,13 +728,8 @@
 	 * Add an async callback so that we get
 	 * notified if this device goes away.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE;
-	csa.callback = cdasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE,
+			   cdasync, periph, periph->path);
 
 	/*
 	 * If the target lun is greater than 0, we most likely have a CD

==== //depot/projects/smpng/sys/cam/scsi/scsi_ch.c#17 (text+ko) ====

@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_ch.c,v 1.45 2007/05/14 21:48:53 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_ch.c,v 1.46 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -224,27 +224,12 @@
 chinit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
-
-                xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
-                csa.ccb_h.func_code = XPT_SASYNC_CB;
-                csa.event_enable = AC_FOUND_DEVICE;
-                csa.callback = chasync;
-                csa.callback_arg = NULL;
-                xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-                xpt_free_path(path);
-        }
+	status = xpt_register_async(AC_FOUND_DEVICE, chasync, NULL, NULL);
 
 	if (status != CAM_REQ_CMP) {
 		printf("ch: Failed to attach master async callback "
@@ -256,20 +241,13 @@
 choninvalidate(struct cam_periph *periph)
 {
 	struct ch_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct ch_softc *)periph->softc;
 
 	/*
 	 * De-register any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = chasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, chasync, periph, periph->path);
 
 	softc->flags |= CH_FLAG_INVALID;
 
@@ -338,7 +316,6 @@
 chregister(struct cam_periph *periph, void *arg)
 {
 	struct ch_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_getdev *cgd;
 
 	cgd = (struct ccb_getdev *)arg;
@@ -369,6 +346,7 @@
 	 * Changers don't have a blocksize, and obviously don't support
 	 * tagged queueing.
 	 */
+	cam_periph_unlock(periph);
 	softc->device_stats = devstat_new_entry("ch",
 			  periph->unit_number, 0,
 			  DEVSTAT_NO_BLOCKSIZE | DEVSTAT_NO_ORDERED_TAGS,
@@ -376,7 +354,6 @@
 			  DEVSTAT_PRIORITY_OTHER);
 
 	/* Register the device */
-	cam_periph_unlock(periph);
 	softc->dev = make_dev(&ch_cdevsw, periph->unit_number, UID_ROOT,
 			      GID_OPERATOR, 0600, "%s%d", periph->periph_name,
 			      periph->unit_number);
@@ -387,12 +364,7 @@
 	 * Add an async callback so that we get
 	 * notified if this device goes away.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_LOST_DEVICE;
-	csa.callback = chasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_LOST_DEVICE, chasync, periph, periph->path);
 
 	/*
 	 * Lock this periph until we are setup.

==== //depot/projects/smpng/sys/cam/scsi/scsi_da.c#77 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.209 2007/05/14 21:48:53 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.210 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 
@@ -695,8 +695,8 @@
 
 	softc->flags &= ~DA_FLAG_OPEN;
 	cam_periph_unhold(periph);
+	cam_periph_release(periph);
 	cam_periph_unlock(periph);
-	cam_periph_release(periph);
 	return (0);	
 }
 
@@ -858,28 +858,13 @@
 dainit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
+	status = xpt_register_async(AC_FOUND_DEVICE, daasync, NULL, NULL);
 
-                xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
-                csa.ccb_h.func_code = XPT_SASYNC_CB;
-                csa.event_enable = AC_FOUND_DEVICE;
-                csa.callback = daasync;
-                csa.callback_arg = NULL;
-                xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-                xpt_free_path(path);
-        }
-
 	if (status != CAM_REQ_CMP) {
 		printf("da: Failed to attach master async callback "
 		       "due to status 0x%x!\n", status);
@@ -896,20 +881,13 @@
 daoninvalidate(struct cam_periph *periph)
 {
 	struct da_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct da_softc *)periph->softc;
 
 	/*
 	 * De-register any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = daasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, daasync, periph, periph->path);
 
 	softc->flags |= DA_FLAG_PACK_INVALID;
 
@@ -1087,7 +1065,6 @@
 daregister(struct cam_periph *periph, void *arg)
 {
 	struct da_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_pathinq cpi;
 	struct ccb_getdev *cgd;
 	char tmpstr[80];
@@ -1202,12 +1179,8 @@
 	 * them and the only alternative would be to
 	 * not attach the device on failure.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /*priority*/5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE;
-	csa.callback = daasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE,
+			   daasync, periph, periph->path);
 
 	/*
 	 * Take an exclusive refcount on the periph while dastart is called

==== //depot/projects/smpng/sys/cam/scsi/scsi_pass.c#18 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.47 2007/04/18 04:58:52 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.48 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,27 +118,12 @@
 passinit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
-
-                xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
-                csa.ccb_h.func_code = XPT_SASYNC_CB;
-                csa.event_enable = AC_FOUND_DEVICE;
-                csa.callback = passasync;
-                csa.callback_arg = NULL;
-                xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-                xpt_free_path(path);
-        }
+	status = xpt_register_async(AC_FOUND_DEVICE, passasync, NULL, NULL);
 
 	if (status != CAM_REQ_CMP) {
 		printf("pass: Failed to attach master async callback "
@@ -151,20 +136,13 @@
 passoninvalidate(struct cam_periph *periph)
 {
 	struct pass_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct pass_softc *)periph->softc;
 
 	/*
 	 * De-register any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = passasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, passasync, periph, periph->path);
 
 	softc->flags |= PASS_FLAG_INVALID;
 
@@ -250,7 +228,6 @@
 passregister(struct cam_periph *periph, void *arg)
 {
 	struct pass_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_getdev *cgd;
 	int    no_tags;
 
@@ -285,6 +262,7 @@
 	 * know what the blocksize of this device is, if 
 	 * it even has a blocksize.
 	 */
+	mtx_unlock(periph->sim->mtx);
 	no_tags = (cgd->inq_data.flags & SID_CmdQue) == 0;
 	softc->device_stats = devstat_new_entry("pass",
 			  unit2minor(periph->unit_number), 0,
@@ -296,7 +274,6 @@
 			  DEVSTAT_PRIORITY_PASS);
 
 	/* Register the device */
-	mtx_unlock(periph->sim->mtx);
 	softc->dev = make_dev(&pass_cdevsw, unit2minor(periph->unit_number),
 			      UID_ROOT, GID_OPERATOR, 0600, "%s%d",
 			      periph->periph_name, periph->unit_number);
@@ -307,12 +284,7 @@
 	 * Add an async callback so that we get
 	 * notified if this device goes away.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_LOST_DEVICE;
-	csa.callback = passasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_LOST_DEVICE, passasync, periph, periph->path);
 
 	if (bootverbose)
 		xpt_announce_periph(periph, NULL);

==== //depot/projects/smpng/sys/cam/scsi/scsi_pt.c#15 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.46 2007/04/19 18:14:33 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.47 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -234,27 +234,12 @@
 ptinit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
-
-                xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
-                csa.ccb_h.func_code = XPT_SASYNC_CB;
-                csa.event_enable = AC_FOUND_DEVICE;
-                csa.callback = ptasync;
-                csa.callback_arg = NULL;
-                xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-                xpt_free_path(path);
-        }
+	status = xpt_register_async(AC_FOUND_DEVICE, ptasync, NULL, NULL);
 
 	if (status != CAM_REQ_CMP) {
 		printf("pt: Failed to attach master async callback "
@@ -266,7 +251,6 @@
 ptctor(struct cam_periph *periph, void *arg)
 {
 	struct pt_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_getdev *cgd;
 
 	cgd = (struct ccb_getdev *)arg;
@@ -297,13 +281,13 @@
 
 	periph->softc = softc;
 	
+	cam_periph_unlock(periph);
 	softc->device_stats = devstat_new_entry("pt",
 			  periph->unit_number, 0,
 			  DEVSTAT_NO_BLOCKSIZE,
 			  SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI,
 			  DEVSTAT_PRIORITY_OTHER);
 
-	cam_periph_unlock(periph);
 	softc->dev = make_dev(&pt_cdevsw, periph->unit_number, UID_ROOT,
 			      GID_OPERATOR, 0600, "%s%d", periph->periph_name,
 			      periph->unit_number);
@@ -318,12 +302,8 @@
 	 * them and the only alternative would be to
 	 * not attach the device on failure.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /*priority*/5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE;
-	csa.callback = ptasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE,
+			   ptasync, periph, periph->path);
 
 	/* Tell the user we've attached to the device */
 	xpt_announce_periph(periph, NULL);
@@ -335,20 +315,13 @@
 ptoninvalidate(struct cam_periph *periph)
 {
 	struct pt_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct pt_softc *)periph->softc;
 
 	/*
 	 * De-register any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = ptasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, ptasync, periph, periph->path);
 
 	softc->flags |= PT_FLAG_DEVICE_INVALID;
 

==== //depot/projects/smpng/sys/cam/scsi/scsi_sa.c#29 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.110 2007/05/14 21:48:53 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.111 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -1331,30 +1331,12 @@
 sainit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.
 	 */
-	status = xpt_create_path(&path, NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
+	status = xpt_register_async(AC_FOUND_DEVICE, saasync, NULL, NULL);
 
-	if (status == CAM_REQ_CMP) {
-		/* Register the async callbacks of interrest */
-		struct ccb_setasync csa; /*
-					  * This is an immediate CCB,
-					  * so using the stack is OK
-					  */
-		xpt_setup_ccb(&csa.ccb_h, path, 5);
-		csa.ccb_h.func_code = XPT_SASYNC_CB;
-		csa.event_enable = AC_FOUND_DEVICE;
-		csa.callback = saasync;
-		csa.callback_arg = NULL;
-		xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-		xpt_free_path(path);
-	}
-
 	if (status != CAM_REQ_CMP) {
 		printf("sa: Failed to attach master async callback "
 		       "due to status 0x%x!\n", status);
@@ -1365,20 +1347,13 @@
 saoninvalidate(struct cam_periph *periph)
 {
 	struct sa_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct sa_softc *)periph->softc;
 
 	/*
 	 * De-register any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path,
-		      /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = saasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, saasync, periph, periph->path);
 
 	softc->flags |= SA_FLAG_INVALID;
 
@@ -1462,7 +1437,6 @@
 saregister(struct cam_periph *periph, void *arg)
 {
 	struct sa_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_getdev *cgd;
 	caddr_t match;
 	int i;
@@ -1517,11 +1491,11 @@
 	 * blocksize until we media is inserted.  So, set a flag to
 	 * indicate that the blocksize is unavailable right now.
 	 */
+	cam_periph_unlock(periph);
 	softc->device_stats = devstat_new_entry("sa", periph->unit_number, 0,
 	    DEVSTAT_BS_UNAVAILABLE, SID_TYPE(&cgd->inq_data) |
 	    DEVSTAT_TYPE_IF_SCSI, DEVSTAT_PRIORITY_TAPE);
 
-	cam_periph_unlock(periph);
 	softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV,
 	    periph->unit_number, 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR,
 	    0660, "%s%d.ctl", periph->periph_name, periph->unit_number);
@@ -1570,12 +1544,7 @@
 	 * Add an async callback so that we get
 	 * notified if this device goes away.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /* priority */ 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_LOST_DEVICE;
-	csa.callback = saasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_LOST_DEVICE, saasync, periph, periph->path);
 
 	xpt_announce_periph(periph, NULL);
 

==== //depot/projects/smpng/sys/cam/scsi/scsi_ses.c#16 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_ses.c,v 1.34 2007/04/15 08:49:11 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_ses.c,v 1.35 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -190,28 +190,13 @@
 sesinit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, NULL, CAM_XPT_PATH_ID,
-	    CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
+	status = xpt_register_async(AC_FOUND_DEVICE, sesasync, NULL, NULL);
 
-                xpt_setup_ccb(&csa.ccb_h, path, 5);
-                csa.ccb_h.func_code = XPT_SASYNC_CB;
-                csa.event_enable = AC_FOUND_DEVICE;
-                csa.callback = sesasync;
-                csa.callback_arg = NULL;
-                xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-                xpt_free_path(path);
-        }
-
 	if (status != CAM_REQ_CMP) {
 		printf("ses: Failed to attach master async callback "
 		       "due to status 0x%x!\n", status);
@@ -222,19 +207,13 @@
 sesoninvalidate(struct cam_periph *periph)
 {
 	struct ses_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct ses_softc *)periph->softc;
 
 	/*
 	 * Unregister any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = sesasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, sesasync, periph, periph->path);
 
 	softc->ses_flags |= SES_FLAG_INVALID;
 
@@ -310,7 +289,6 @@
 sesregister(struct cam_periph *periph, void *arg)
 {
 	struct ses_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_getdev *cgd;
 	char *tname;
 
@@ -375,12 +353,7 @@
 	 * Add an async callback so that we get
 	 * notified if this device goes away.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_LOST_DEVICE;
-	csa.callback = sesasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_LOST_DEVICE, sesasync, periph, periph->path);
 
 	switch (softc->ses_type) {
 	default:

==== //depot/projects/smpng/sys/cam/scsi/scsi_sg.c#3 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sg.c,v 1.8 2007/04/18 04:58:52 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sg.c,v 1.9 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -156,27 +156,12 @@
 sginit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will receive aync
 	 * callbacks like "new device found".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
-	if (status == CAM_REQ_CMP) {
-		struct ccb_setasync csa;
-
-		xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
-		csa.ccb_h.func_code = XPT_SASYNC_CB;
-		csa.event_enable = AC_FOUND_DEVICE;
-		csa.callback = sgasync;
-		csa.callback_arg = NULL;
-		xpt_action((union ccb *)&csa);
-		status = csa.ccb_h.status;
-		xpt_free_path(path);
-	}
+	status = xpt_register_async(AC_FOUND_DEVICE, sgasync, NULL, NULL);
 
 	if (status != CAM_REQ_CMP) {
 		printf("sg: Failed to attach master async callbac "
@@ -188,19 +173,13 @@
 sgoninvalidate(struct cam_periph *periph)
 {
 	struct sg_softc *softc;
-	struct ccb_setasync csa;
 
 	softc = (struct sg_softc *)periph->softc;
 
 	/*
 	 * Deregister any async callbacks.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /*priority*/5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = 0;
-	csa.callback = sgasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(0, sgasync, periph, periph->path);
 
 	softc->flags |= SG_FLAG_INVALID;
 
@@ -274,7 +253,6 @@
 sgregister(struct cam_periph *periph, void *arg)
 {
 	struct sg_softc *softc;
-	struct ccb_setasync csa;
 	struct ccb_getdev *cgd;
 	int no_tags;
 
@@ -306,6 +284,7 @@
 	 * We pass in 0 for all blocksize, since we don't know what the
 	 * blocksize of the device is, if it even has a blocksize.
 	 */
+	cam_periph_unlock(periph);
 	no_tags = (cgd->inq_data.flags & SID_CmdQue) == 0;
 	softc->device_stats = devstat_new_entry("sg",
 			unit2minor(periph->unit_number), 0,
@@ -317,7 +296,6 @@
 			DEVSTAT_PRIORITY_PASS);
 
 	/* Register the device */
-	cam_periph_unlock(periph);
 	softc->dev = make_dev(&sg_cdevsw, unit2minor(periph->unit_number),
 			      UID_ROOT, GID_OPERATOR, 0600, "%s%d",
 			      periph->periph_name, periph->unit_number);
@@ -329,12 +307,7 @@
 	 * Add as async callback so that we get
 	 * notified if this device goes away.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, periph->path, /*priority*/5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable = AC_LOST_DEVICE;
-	csa.callback = sgasync;
-	csa.callback_arg = periph;
-	xpt_action((union ccb *)&csa);
+	xpt_register_async(AC_LOST_DEVICE, sgasync, periph, periph->path);
 
 	if (bootverbose)
 		xpt_announce_periph(periph, NULL);

==== //depot/projects/smpng/sys/cam/scsi/scsi_targ_bh.c#12 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_targ_bh.c,v 1.24 2007/04/15 08:49:11 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_targ_bh.c,v 1.25 2007/05/16 16:54:23 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -156,27 +156,13 @@
 targbhinit(void)
 {
 	cam_status status;
-	struct cam_path *path;
 
 	/*
 	 * Install a global async callback.  This callback will
 	 * receive async callbacks like "new path registered".
 	 */
-	status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
-				 CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705171508.l4HF8lFe062677>