PERFORCE change 96464 for review

Scott Long scottl at FreeBSD.org
Mon May 1 03:19:43 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96464

Change 96464 by scottl at scottl-junior on 2006/05/01 03:18:47

	Have the SIMs provide a mutex when registering.  This mutex will
	be used to also lock the periph and its resources.  Also add a
	flags argument.  It is used right now for malloc flags for allocating
	the SIM object, but it might be used later to indicate what kind of
	lock is being registered.
	
	The assumption right now is that the SIMs will only use a standard
	MTX_DEF mutex.  It would be interesting to allow other kinds of
	synchronization primitives, but that involves either registering
	a lock/unlock function pointer, or detecting what kind of lock object
	is registered and acting on it accordingly.  Since there will be at
	least one lock/unlock operation in the fast path of CAM, having it
	be done through an indirect function call will likely create
	measurable overhead.  Thus, I doubt that this approach will be
	followed.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/cam_sim.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_sim.h#4 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#22 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aac/aac_cam.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/advansys/advansys.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/advansys/adwcam.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aha/aha.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ahb/ahb.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic/aic.c#3 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/amd/amd.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/amr/amr_cam.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/arcmsr/arcmsr.c#3 edit
.. //depot/projects/scottl-camlock/src/sys/dev/asr/asr.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ata/atapi-cam.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/buslogic/bt.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ciss/ciss.c#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/dpt/dpt_scsi.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/esp/ncr53c9x.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/firewire/sbp.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/firewire/sbp_targ.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/hptmv/entry.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/iir/iir.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/isp/isp_freebsd.c#8 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mly/mly.c#4 edit
.. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/dev/ppbus/vpo.c#3 edit
.. //depot/projects/scottl-camlock/src/sys/dev/rr232x/osm_bsd.c#2 edit
.. //depot/projects/scottl-camlock/src/sys/dev/sym/sym_hipd.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/trm/trm.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/twa/tw_osl_cam.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/usb/umass.c#8 edit
.. //depot/projects/scottl-camlock/src/sys/dev/wds/wd7000.c#3 edit
.. //depot/projects/scottl-camlock/src/sys/pci/ncr.c#6 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/cam_sim.c#5 (text+ko) ====

@@ -58,38 +58,30 @@
 struct cam_sim *
 cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll,
 	      const char *sim_name, void *softc, u_int32_t unit,
-	      int max_dev_transactions,
+	      struct mtx *mtx, int max_dev_transactions, int malloc_flags,
 	      int max_tagged_dev_transactions, struct cam_devq *queue)
 {
 	struct cam_sim *sim;
 
-	/*
-	 * If this is the xpt layer creating a sim, then it's OK
-	 * to wait for an allocation.
-	 *
-	 * XXX Should we pass in a flag to indicate that wait is OK?
-	 */
-	if (strcmp(sim_name, "xpt") == 0)
-		sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
-					       M_CAMSIM, M_WAITOK);
-	else
-		sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
-					       M_CAMSIM, M_NOWAIT);
+	sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
+	    M_CAMSIM, malloc_flags);
+
+	if (sim == NULL)
+		return (NULL);
 
-	if (sim != NULL) {
-		sim->sim_action = sim_action;
-		sim->sim_poll = sim_poll;
-		sim->sim_name = sim_name;
-		sim->softc = softc;
-		sim->path_id = CAM_PATH_ANY;
-		sim->unit_number = unit;
-		sim->bus_id = 0;	/* set in xpt_bus_register */
-		sim->max_tagged_dev_openings = max_tagged_dev_transactions;
-		sim->max_dev_openings = max_dev_transactions;
-		sim->flags = 0;
-		callout_handle_init(&sim->c_handle);
-		sim->devq = queue;
-	}
+	sim->sim_action = sim_action;
+	sim->sim_poll = sim_poll;
+	sim->sim_name = sim_name;
+	sim->softc = softc;
+	sim->path_id = CAM_PATH_ANY;
+	sim->unit_number = unit;
+	sim->bus_id = 0;	/* set in xpt_bus_register */
+	sim->max_tagged_dev_openings = max_tagged_dev_transactions;
+	sim->max_dev_openings = max_dev_transactions;
+	sim->flags = 0;
+	sim->mtx = mtx;
+	callout_handle_init(&sim->c_handle);
+	sim->devq = queue;
 
 	return (sim);
 }

==== //depot/projects/scottl-camlock/src/sys/cam/cam_sim.h#4 (text+ko) ====

@@ -56,6 +56,8 @@
 				const char *sim_name,
 				void *softc,
 				u_int32_t unit,
+				struct mtx *mtx,
+				int malloc_flags,
 				int max_dev_transactions,
 				int max_tagged_dev_transactions,
 				struct cam_devq *queue);
@@ -90,6 +92,7 @@
 	sim_poll_func		sim_poll;
 	const char		*sim_name;
 	void			*softc;
+	struct mtx		*mtx;
 	u_int32_t		path_id;/* The Boot device may set this to 0? */
 	u_int32_t		unit_number;
 	u_int32_t		bus_id;

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#22 (text+ko) ====

@@ -1431,6 +1431,8 @@
 				"xpt",
 				/*softc*/NULL,
 				/*unit*/0,
+				/*mtx*/&Giant,
+				/*flags*/M_WAITOK,
 				/*max_dev_transactions*/0,
 				/*max_tagged_dev_transactions*/0,
 				devq);

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#7 (text+ko) ====

@@ -1407,6 +1407,7 @@
 				scsi_low_poll_cam,
 				DEVPORT_DEVNAME(slp->sl_dev), slp,
 				DEVPORT_DEVUNIT(slp->sl_dev), 
+				&Giant, M_NOWAIT,
 				slp->sl_openings, tagged_openings, devq);
 
 	if (slp->sl_si.sim == NULL) {

==== //depot/projects/scottl-camlock/src/sys/dev/aac/aac_cam.c#5 (text+ko) ====

@@ -171,7 +171,7 @@
 		return (EIO);
 
 	sim = cam_sim_alloc(aac_cam_action, aac_cam_poll, "aacp", camsc,
-	    device_get_unit(dev), 1, 1, devq);
+	    device_get_unit(dev), &Giant, M_NOWAIT, 1, 1, devq);
 	if (sim == NULL) {
 		cam_simq_free(devq);
 		return (EIO);

==== //depot/projects/scottl-camlock/src/sys/dev/advansys/advansys.c#6 (text+ko) ====

@@ -1397,7 +1397,7 @@
 	 * Construct our SIM entry.
 	 */
 	adv->sim = cam_sim_alloc(adv_action, adv_poll, "adv", adv, adv->unit,
-				 1, adv->max_openings, devq);
+				 &Giant, M_NOWAIT, 1, adv->max_openings, devq);
 	if (adv->sim == NULL)
 		return (ENOMEM);
 

==== //depot/projects/scottl-camlock/src/sys/dev/advansys/adwcam.c#5 (text+ko) ====

@@ -1220,7 +1220,7 @@
 	 * Construct our SIM entry.
 	 */
 	adw->sim = cam_sim_alloc(adw_action, adw_poll, "adw", adw, adw->unit,
-				 1, adw->max_acbs, devq);
+				 &Giant, M_NOWAIT, 1, adw->max_acbs, devq);
 	if (adw->sim == NULL) {
 		error = ENOMEM;
 		goto fail;

==== //depot/projects/scottl-camlock/src/sys/dev/aha/aha.c#4 (text+ko) ====

@@ -604,8 +604,8 @@
 	/*
 	 * Construct our SIM entry
 	 */
-	aha->sim = cam_sim_alloc(ahaaction, ahapoll, "aha", aha, aha->unit, 2,
-	    tagged_dev_openings, devq);
+	aha->sim = cam_sim_alloc(ahaaction, ahapoll, "aha", aha, aha->unit,
+	     &Giant, M_NOWAIT, 2, tagged_dev_openings, devq);
 	if (aha->sim == NULL) {
 		cam_simq_free(devq);
 		return (ENOMEM);

==== //depot/projects/scottl-camlock/src/sys/dev/ahb/ahb.c#4 (text+ko) ====

@@ -550,7 +550,7 @@
 	 * Construct our SIM entry
 	 */
 	ahb->sim = cam_sim_alloc(ahbaction, ahbpoll, "ahb", ahb, ahb->unit,
-				 2, ahb->num_ecbs, devq);
+				 &Giant, M_NOWAIT, 2, ahb->num_ecbs, devq);
 	if (ahb->sim == NULL) {
 		cam_simq_free(devq);
 		return (ENOMEM);

==== //depot/projects/scottl-camlock/src/sys/dev/aic/aic.c#3 (text+ko) ====

@@ -30,6 +30,9 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/malloc.h>
 #include <sys/bus.h>
 
 #include <machine/bus.h>
@@ -1519,7 +1522,7 @@
 	 * Construct our SIM entry
 	 */
 	aic->sim = cam_sim_alloc(aic_action, aic_poll, "aic", aic,
-				 aic->unit, 2, 256, devq);
+				 aic->unit, &Giant, M_NOWAIT, 2, 256, devq);
 	if (aic->sim == NULL) {
 		cam_simq_free(devq);
 		return (ENOMEM);

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#7 (text+ko) ====

@@ -143,7 +143,7 @@
 	 */
 	sim = cam_sim_alloc(ahd_action, ahd_poll, "ahd", ahd,
 			    device_get_unit(ahd->dev_softc),
-			    1, /*XXX*/256, devq);
+			    &Giant, M_NOWAIT, 1, /*XXX*/256, devq);
 	if (sim == NULL) {
 		cam_simq_free(devq);
 		goto fail;

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#6 (text+ko) ====

@@ -194,7 +194,7 @@
 	 */
 	sim = cam_sim_alloc(ahc_action, ahc_poll, "ahc", ahc,
 			    device_get_unit(ahc->dev_softc),
-			    1, AHC_MAX_QUEUE, devq);
+			    &Giant, M_NOWAIT, 1, AHC_MAX_QUEUE, devq);
 	if (sim == NULL) {
 		cam_simq_free(devq);
 		goto fail;
@@ -225,7 +225,8 @@
 
 	if (ahc->features & AHC_TWIN) {
 		sim2 = cam_sim_alloc(ahc_action, ahc_poll, "ahc",
-				    ahc, device_get_unit(ahc->dev_softc), 1,
+				    ahc, device_get_unit(ahc->dev_softc),
+				    &Giant, M_NOWAIT,  1,
 				    AHC_MAX_QUEUE, devq);
 
 		if (sim2 == NULL) {

==== //depot/projects/scottl-camlock/src/sys/dev/amd/amd.c#5 (text+ko) ====

@@ -58,6 +58,7 @@
 #include <sys/module.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
+#include <sys/malloc.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -2456,8 +2457,8 @@
 	}
 
 	amd->psim = cam_sim_alloc(amd_action, amd_poll, "amd",
-				  amd, amd->unit, 1, MAX_TAGS_CMD_QUEUE,
-				  devq);
+				  amd, amd->unit, &Giant, M_NOWAIT,
+				  1, MAX_TAGS_CMD_QUEUE, devq);
 	if (amd->psim == NULL) {
 		cam_simq_free(devq);
 		if (bootverbose)

==== //depot/projects/scottl-camlock/src/sys/dev/amr/amr_cam.c#5 (text+ko) ====

@@ -148,6 +148,8 @@
 						  "amr",
 						  sc,
 						  device_get_unit(sc->amr_dev),
+						  &Giant,
+						  M_NOWAIT,
 						  1,
 						  AMR_MAX_SCSI_CMDS,
 						  devq)) == NULL) {

==== //depot/projects/scottl-camlock/src/sys/dev/arcmsr/arcmsr.c#3 (text+ko) ====

@@ -2405,7 +2405,7 @@
 		printf("arcmsr_attach: cam_simq_alloc failure!\n");
 		return ENXIO;
 	}
-	pACB->psim=cam_sim_alloc(arcmsr_action,arcmsr_poll,"arcmsr",pACB,pACB->pci_unit,1,ARCMSR_MAX_OUTSTANDING_CMD,devq);
+	pACB->psim=cam_sim_alloc(arcmsr_action,arcmsr_poll,"arcmsr",pACB,pACB->pci_unit,&Giant,M_NOWAIT,1,ARCMSR_MAX_OUTSTANDING_CMD,devq);
 	if(pACB->psim == NULL) 
 	{
 		arcmsr_free_resource(pACB);

==== //depot/projects/scottl-camlock/src/sys/dev/asr/asr.c#6 (text+ko) ====

@@ -2651,7 +2651,8 @@
 		 *	Construct our first channel SIM entry
 		 */
 		sc->ha_sim[bus] = cam_sim_alloc(asr_action, asr_poll, "asr", sc,
-						unit, 1, QueueSize, devq);
+						unit, &Giant, M_NOWAIT,
+						1, QueueSize, devq);
 		if (sc->ha_sim[bus] == NULL) {
 			continue;
 		}

==== //depot/projects/scottl-camlock/src/sys/dev/ata/atapi-cam.c#6 (text+ko) ====

@@ -210,7 +210,7 @@
     }
 
     if ((sim = cam_sim_alloc(atapi_action, atapi_poll, "ata",
-		 (void *)scp, unit, 1, 1, devq)) == NULL) {
+		 (void *)scp, unit, &Giant, M_NOWAIT, 1, 1, devq)) == NULL) {
 	error = ENOMEM;
 	goto out;
     }

==== //depot/projects/scottl-camlock/src/sys/dev/buslogic/bt.c#4 (text+ko) ====

@@ -873,7 +873,7 @@
 	 * Construct our SIM entry
 	 */
 	bt->sim = cam_sim_alloc(btaction, btpoll, "bt", bt, bt->unit,
-				2, tagged_dev_openings, devq);
+				&Giant, M_NOWAIT, 2, tagged_dev_openings, devq);
 	if (bt->sim == NULL) {
 		cam_simq_free(devq);
 		return (ENOMEM);

==== //depot/projects/scottl-camlock/src/sys/dev/ciss/ciss.c#7 (text+ko) ====

@@ -2475,8 +2475,8 @@
 	if ((sc->ciss_cam_sim[i] = cam_sim_alloc(ciss_cam_action, ciss_cam_poll,
 						 "ciss", sc,
 						 device_get_unit(sc->ciss_dev),
+						 &Giant, M_NOWAIT, 1,
 						 sc->ciss_max_requests - 2,
-						 1,
 						 sc->ciss_cam_devq)) == NULL) {
 	    ciss_printf(sc, "can't allocate CAM SIM for controller %d\n", i);
 	    return(ENOMEM);
@@ -2498,8 +2498,8 @@
 	if ((sc->ciss_cam_sim[i] = cam_sim_alloc(ciss_cam_action, ciss_cam_poll,
 						 "ciss", sc,
 						 device_get_unit(sc->ciss_dev),
+						 &Giant, M_NOWAIT, 1,
 						 sc->ciss_max_requests - 2,
-						 1,
 						 sc->ciss_cam_devq)) == NULL) {
 	    ciss_printf(sc, "can't allocate CAM SIM for controller %d\n", i);
 	    return (ENOMEM);

==== //depot/projects/scottl-camlock/src/sys/dev/dpt/dpt_scsi.c#4 (text+ko) ====

@@ -1548,7 +1548,8 @@
 		 * Construct our SIM entry
 		 */
 		dpt->sims[i] = cam_sim_alloc(dpt_action, dpt_poll, "dpt",
-					     dpt, dpt->unit, /*untagged*/2,
+					     dpt, dpt->unit, &Giant,
+					     M_NOWAIT, /*untagged*/2,
 					     /*tagged*/dpt->max_dccbs, devq);
 		if (dpt->sims[i] == NULL) {
 			if (i == 0)

==== //depot/projects/scottl-camlock/src/sys/dev/esp/ncr53c9x.c#5 (text+ko) ====

@@ -325,7 +325,7 @@
 	}
 
 	sim = cam_sim_alloc(ncr53c9x_action, ncr53c9x_poll, "esp", sc,
-			    device_get_unit(sc->sc_dev), 1,
+			    device_get_unit(sc->sc_dev), &Giant, M_NOWAIT, 1,
 			    NCR_TAG_DEPTH, devq);
 	if (sim == NULL) {
 		device_printf(sc->sc_dev, "cannot allocate SIM entry\n");

==== //depot/projects/scottl-camlock/src/sys/dev/firewire/sbp.c#5 (text+ko) ====

@@ -1960,6 +1960,7 @@
 
 	sbp->sim = cam_sim_alloc(sbp_action, sbp_poll, "sbp", sbp,
 				 device_get_unit(dev),
+				 &Giant, M_NOWAIT,
 				 /*untagged*/ 1,
 				 /*tagged*/ SBP_QUEUE_LEN - 1,
 				 devq);

==== //depot/projects/scottl-camlock/src/sys/dev/firewire/sbp_targ.c#4 (text+ko) ====

@@ -1627,7 +1627,7 @@
 		return (ENXIO);
 
 	sc->sim = cam_sim_alloc(sbp_targ_action, sbp_targ_poll,
-	    "sbp_targ", sc, device_get_unit(dev),
+	    "sbp_targ", sc, device_get_unit(dev), &Giant, M_NOWAIT,
 	    /*untagged*/ 1, /*tagged*/ 1, devq);
 	if (sc->sim == NULL) {
 		cam_simq_free(devq);

==== //depot/projects/scottl-camlock/src/sys/dev/hptmv/entry.c#4 (text+ko) ====

@@ -1967,7 +1967,8 @@
 	 * Construct our SIM entry
 	 */
 	if ((hpt_vsim = cam_sim_alloc(hpt_action, hpt_poll, __str(PROC_DIR_NAME),
-			pAdapter, device_get_unit(pAdapter->hpt_dev), /*untagged*/1, /*tagged*/8,  devq)) == NULL)	{
+			pAdapter, device_get_unit(pAdapter->hpt_dev),
+			&Giant, M_NOWAIT, /*untagged*/1, /*tagged*/8,  devq)) == NULL)	{
 		cam_simq_free(devq);
 		return ENOMEM;
 	}

==== //depot/projects/scottl-camlock/src/sys/dev/iir/iir.c#6 (text+ko) ====

@@ -503,7 +503,8 @@
          * Construct our SIM entry
          */
         gdt->sims[i] = cam_sim_alloc(iir_action, iir_poll, "iir",
-                                     gdt, gdt->sc_hanum, /*untagged*/1,
+                                     gdt, gdt->sc_hanum, &Giant,
+				     M_NOWAIT, /*untagged*/1,
                                      /*tagged*/GDT_MAXCMDS, devq);
         if (xpt_bus_register(gdt->sims[i], i) != CAM_SUCCESS) {
             cam_sim_free(gdt->sims[i], /*free_devq*/i == 0);

==== //depot/projects/scottl-camlock/src/sys/dev/isp/isp_freebsd.c#8 (text+ko) ====

@@ -110,7 +110,8 @@
 	 */
 	ISPLOCK_2_CAMLOCK(isp);
 	sim = cam_sim_alloc(isp_action, isp_poll, "isp", isp,
-	    device_get_unit(isp->isp_dev), 1, isp->isp_maxcmds, devq);
+	    device_get_unit(isp->isp_dev), &Giant, M_NOWAIT, 1,
+	    isp->isp_maxcmds, devq);
 	if (sim == NULL) {
 		cam_simq_free(devq);
 		CAMLOCK_2_ISPLOCK(isp);
@@ -187,7 +188,8 @@
 	if (IS_DUALBUS(isp)) {
 		ISPLOCK_2_CAMLOCK(isp);
 		sim = cam_sim_alloc(isp_action, isp_poll, "isp", isp,
-		    device_get_unit(isp->isp_dev), 1, isp->isp_maxcmds, devq);
+		    device_get_unit(isp->isp_dev), &Giant, M_NOWAIT, 1,
+		    isp->isp_maxcmds, devq);
 		if (sim == NULL) {
 			xpt_bus_deregister(cam_sim_path(isp->isp_sim));
 			xpt_free_path(isp->isp_path);

==== //depot/projects/scottl-camlock/src/sys/dev/mly/mly.c#4 (text+ko) ====

@@ -1943,6 +1943,7 @@
 
 	    if ((sc->mly_cam_sim[chn] = cam_sim_alloc(mly_cam_action, mly_cam_poll, "mly", sc,
 						      device_get_unit(sc->mly_dev),
+						      &Giant, M_NOWAIT,
 						      sc->mly_controllerinfo->maximum_parallel_commands,
 						      1, devq)) == NULL) {
 		return(ENOMEM);
@@ -1962,6 +1963,7 @@
     for (i = 0; i < sc->mly_controllerinfo->virtual_channels_present; i++, chn++) {
 	if ((sc->mly_cam_sim[chn] = cam_sim_alloc(mly_cam_action, mly_cam_poll, "mly", sc,
 						  device_get_unit(sc->mly_dev),
+						  &Giant, M_NOWAIT,
 						  sc->mly_controllerinfo->maximum_parallel_commands,
 						  0, devq)) == NULL) {
 	    return(ENOMEM);

==== //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.c#6 (text+ko) ====

@@ -290,7 +290,7 @@
 	 * Construct our SIM entry.
 	 */
 	mpt->sim = cam_sim_alloc(mpt_action, mpt_poll, "mpt", mpt,
-	    mpt->unit, 1, maxq, devq);
+	    mpt->unit, &Giant, M_NOWAIT, 1, maxq, devq);
 	if (mpt->sim == NULL) {
 		mpt_prt(mpt, "Unable to allocate CAM SIM!\n");
 		cam_simq_free(devq);
@@ -327,7 +327,7 @@
 	 * Create a "bus" to export all hidden disks to CAM.
 	 */
 	mpt->phydisk_sim = cam_sim_alloc(mpt_action, mpt_poll, "mpt", mpt,
-	    mpt->unit, 1, maxq, devq);
+	    mpt->unit, &Giant, M_NOWAIT, 1, maxq, devq);
 	if (mpt->phydisk_sim == NULL) {
 		mpt_prt(mpt, "Unable to allocate Physical Disk CAM SIM!\n");
 		error = ENOMEM;

==== //depot/projects/scottl-camlock/src/sys/dev/ppbus/vpo.c#3 (text+ko) ====

@@ -32,6 +32,8 @@
 #include <sys/systm.h>
 #include <sys/module.h>
 #include <sys/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
 #include <sys/malloc.h>
 
 #include <cam/cam.h>
@@ -161,6 +163,7 @@
 
 	vpo->sim = cam_sim_alloc(vpo_action, vpo_poll, "vpo", vpo,
 				 device_get_unit(dev),
+				 &Giant, M_NOWAIT,
 				 /*untagged*/1, /*tagged*/0, devq);
 	if (vpo->sim == NULL) {
 		cam_simq_free(devq);

==== //depot/projects/scottl-camlock/src/sys/dev/rr232x/osm_bsd.c#2 (text) ====

@@ -1087,7 +1087,8 @@
 		}
 	
 		vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name,
-				vbus_ext, 0, os_max_queue_comm, /*tagged*/8,  devq);
+				vbus_ext, 0, &Giant, M_NOWAIT,
+				os_max_queue_comm, /*tagged*/8,  devq);
 				
 		if (!vbus_ext->sim) {
 			os_printk("cam_sim_alloc failed");

==== //depot/projects/scottl-camlock/src/sys/dev/sym/sym_hipd.c#5 (text+ko) ====

@@ -9095,7 +9095,7 @@
 	 *  Construct our SIM entry.
 	 */
 	sim = cam_sim_alloc(sym_action, sym_poll, "sym", np, np->unit,
-			    1, SYM_SETUP_MAX_TAG, devq);
+			    &Giant, M_NOWAIT, 1, SYM_SETUP_MAX_TAG, devq);
 	if (!sim)
 		goto fail;
 	devq = 0;

==== //depot/projects/scottl-camlock/src/sys/dev/trm/trm.c#5 (text+ko) ====

@@ -3620,6 +3620,8 @@
 	    "trm",
 	    pACB,
 	    unit,
+	    &Giant,
+	    M_NOWAIT,
 	    1,
 	    TRM_MAX_TAGS_CMD_QUEUE,
 	    device_Q);

==== //depot/projects/scottl-camlock/src/sys/dev/twa/tw_osl_cam.c#5 (text+ko) ====

@@ -102,7 +102,7 @@
 	 */
 	tw_osli_dbg_dprintf(3, sc, "Calling cam_sim_alloc");
 	sc->sim = cam_sim_alloc(twa_action, twa_poll, "twa", sc,
-			device_get_unit(sc->bus_dev),
+			device_get_unit(sc->bus_dev), &Giant, M_NOWAIT,
 			TW_OSLI_MAX_NUM_IOS - 1, 1, devq);
 	if (sc->sim == NULL) {
 		cam_simq_free(devq);

==== //depot/projects/scottl-camlock/src/sys/dev/usb/umass.c#8 (text+ko) ====

@@ -110,6 +110,8 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
 #include <sys/bus.h>
 #include <sys/sysctl.h>
 
@@ -2245,6 +2247,7 @@
 				DEVNAME_SIM,
 				sc /*priv*/,
 				USBDEVUNIT(sc->sc_dev) /*unit number*/,
+				&Giant, M_NOWAIT,
 				1 /*maximum device openings*/,
 				0 /*maximum tagged device openings*/,
 				devq);

==== //depot/projects/scottl-camlock/src/sys/dev/wds/wd7000.c#3 (text+ko) ====

@@ -132,6 +132,7 @@
 #include <sys/errno.h>
 #include <sys/kernel.h>
 #include <sys/assym.h>
+#include <sys/malloc.h>
 
 #include <sys/bio.h>
 #include <sys/buf.h>
@@ -605,7 +606,7 @@
 		goto bad;
 
 	sim = cam_sim_alloc(wds_action, wds_poll, "wds", (void *) wp,
-			    wp->unit, 1, 1, devq);
+			    wp->unit, &Giant, M_NOWAIT, 1, 1, devq);
 	if (sim == NULL) {
 		cam_simq_free(devq);
 		goto bad;

==== //depot/projects/scottl-camlock/src/sys/pci/ncr.c#6 (text+ko) ====

@@ -184,6 +184,8 @@
 #include <sys/kernel.h>
 #include <sys/module.h>
 #include <sys/sysctl.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
 #include <sys/bus.h>
 #include <machine/md_var.h>
 #include <machine/bus.h>
@@ -3787,7 +3789,7 @@
 	**	about our bus.
 	*/
 	np->sim = cam_sim_alloc(ncr_action, ncr_poll, "ncr", np, np->unit,
-				1, MAX_TAGS, devq);
+				&Giant, M_NOWAIT, 1, MAX_TAGS, devq);
 	if (np->sim == NULL) {
 		cam_simq_free(devq);
 		return ENOMEM;


More information about the p4-projects mailing list