Lines Matching defs:sim

73 	struct cam_sim *sim;
75 sim = malloc(sizeof(struct cam_sim), M_CAMSIM, M_ZERO | M_NOWAIT);
76 if (sim == NULL)
79 sim->sim_action = sim_action;
80 sim->sim_poll = sim_poll;
81 sim->sim_name = sim_name;
82 sim->softc = softc;
83 sim->path_id = CAM_PATH_ANY;
84 sim->sim_dev = NULL; /* set only by cam_sim_alloc_dev */
85 sim->unit_number = unit;
86 sim->bus_id = 0; /* set in xpt_bus_register */
87 sim->max_tagged_dev_openings = max_tagged_dev_transactions;
88 sim->max_dev_openings = max_dev_transactions;
89 sim->flags = 0;
90 sim->refcount = 1;
91 sim->devq = queue;
92 sim->mtx = mtx;
93 callout_init(&sim->callout, 1);
94 return (sim);
103 struct cam_sim *sim;
108 sim = cam_sim_alloc(sim_action, sim_poll, sim_name, softc,
111 if (sim != NULL)
112 sim->sim_dev = dev;
113 return (sim);
117 cam_sim_free(struct cam_sim *sim, int free_devq)
122 if (sim->mtx == NULL) {
126 mtx = sim->mtx;
129 KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
130 sim->refcount--;
131 if (sim->refcount > 0) {
132 error = msleep(sim, mtx, PRIBIO, "simfree", 0);
135 KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
136 if (mtx == &cam_sim_free_mtx) /* sim->mtx == NULL */
140 cam_simq_free(sim->devq);
141 free(sim, M_CAMSIM);
145 cam_sim_release(struct cam_sim *sim)
149 if (sim->mtx == NULL)
151 else if (!mtx_owned(sim->mtx))
152 mtx = sim->mtx;
157 KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
158 sim->refcount--;
159 if (sim->refcount == 0)
160 wakeup(sim);
166 cam_sim_hold(struct cam_sim *sim)
170 if (sim->mtx == NULL)
172 else if (!mtx_owned(sim->mtx))
173 mtx = sim->mtx;
178 KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
179 sim->refcount++;
185 cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id)
187 sim->path_id = path_id;