summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_sim.h
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2007-04-15 08:49:19 +0000
committerscottl <scottl@FreeBSD.org>2007-04-15 08:49:19 +0000
commit7605c12c0f2bf784960d36288b7cb6e451b99a15 (patch)
tree010146772b36d16e6f98671b4bed7ce094acd633 /sys/cam/cam_sim.h
parent3e3198a9661d5d1c3e35abc313ad0d4688c6eea6 (diff)
downloadFreeBSD-src-7605c12c0f2bf784960d36288b7cb6e451b99a15.zip
FreeBSD-src-7605c12c0f2bf784960d36288b7cb6e451b99a15.tar.gz
Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that SIM. Drivers that are not yet MPSAFE register Giant and operate as usual. RIght now, no drivers are MPSAFE, though a few will be changed in the coming week as this work settles down. The driver API has changed, so all CAM drivers will need to be recompiled. The userland API has not changed, so tools like camcontrol do not need to be recompiled.
Diffstat (limited to 'sys/cam/cam_sim.h')
-rw-r--r--sys/cam/cam_sim.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/cam/cam_sim.h b/sys/cam/cam_sim.h
index c4e3910..8976529 100644
--- a/sys/cam/cam_sim.h
+++ b/sys/cam/cam_sim.h
@@ -56,6 +56,7 @@ struct cam_sim * cam_sim_alloc(sim_action_func sim_action,
const char *sim_name,
void *softc,
u_int32_t unit,
+ struct mtx *mtx,
int max_dev_transactions,
int max_tagged_dev_transactions,
struct cam_devq *queue);
@@ -90,17 +91,33 @@ struct cam_sim {
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;
int max_tagged_dev_openings;
int max_dev_openings;
u_int32_t flags;
-#define CAM_SIM_REL_TIMEOUT_PENDING 0x01
- struct callout_handle c_handle;
+#define CAM_SIM_REL_TIMEOUT_PENDING 0x01
+#define CAM_SIM_MPSAFE 0x02
+ struct callout callout;
struct cam_devq *devq; /* Device Queue to use for this SIM */
+
+ /* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */
+ SLIST_HEAD(,ccb_hdr) ccb_freeq;
+ /*
+ * Maximum size of ccb pool. Modified as devices are added/removed
+ * or have their * opening counts changed.
+ */
+ u_int max_ccbs;
+ /* Current count of allocated ccbs */
+ u_int ccb_count;
+
};
+#define CAM_SIM_LOCK(sim) mtx_lock((sim)->mtx);
+#define CAM_SIM_UNLOCK(sim) mtx_unlock((sim)->mtx);
+
static __inline u_int32_t
cam_sim_path(struct cam_sim *sim)
{
OpenPOWER on IntegriCloud