Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_sim.c
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
struct cam_sim * | struct cam_sim * | ||||
cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, | cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, | ||||
const char *sim_name, void *softc, u_int32_t unit, | const char *sim_name, void *softc, u_int32_t unit, | ||||
struct mtx *mtx, int max_dev_transactions, | struct mtx *mtx, int max_dev_transactions, | ||||
int max_tagged_dev_transactions, struct cam_devq *queue) | int max_tagged_dev_transactions, struct cam_devq *queue) | ||||
{ | { | ||||
struct cam_sim *sim; | struct cam_sim *sim; | ||||
sim = (struct cam_sim *)malloc(sizeof(struct cam_sim), | sim = malloc(sizeof(struct cam_sim), M_CAMSIM, M_ZERO | M_NOWAIT); | ||||
M_CAMSIM, M_ZERO | M_NOWAIT); | |||||
if (sim == NULL) | if (sim == NULL) | ||||
return (NULL); | return (NULL); | ||||
sim->sim_action = sim_action; | sim->sim_action = sim_action; | ||||
sim->sim_poll = sim_poll; | sim->sim_poll = sim_poll; | ||||
sim->sim_name = sim_name; | sim->sim_name = sim_name; | ||||
sim->softc = softc; | sim->softc = softc; | ||||
sim->path_id = CAM_PATH_ANY; | sim->path_id = CAM_PATH_ANY; | ||||
sim->sim_dev = NULL; /* set only by cam_sim_alloc_dev */ | sim->sim_dev = NULL; /* set only by cam_sim_alloc_dev */ | ||||
sim->unit_number = unit; | sim->unit_number = unit; | ||||
sim->bus_id = 0; /* set in xpt_bus_register */ | sim->bus_id = 0; /* set in xpt_bus_register */ | ||||
sim->max_tagged_dev_openings = max_tagged_dev_transactions; | sim->max_tagged_dev_openings = max_tagged_dev_transactions; | ||||
sim->max_dev_openings = max_dev_transactions; | sim->max_dev_openings = max_dev_transactions; | ||||
sim->flags = 0; | sim->flags = 0; | ||||
sim->refcount = 1; | sim->refcount = 1; | ||||
sim->devq = queue; | sim->devq = queue; | ||||
sim->mtx = mtx; | sim->mtx = mtx; | ||||
if (mtx == &Giant) { | |||||
sim->flags |= 0; | |||||
callout_init(&sim->callout, 0); | |||||
} else { | |||||
sim->flags |= CAM_SIM_MPSAFE; | |||||
callout_init(&sim->callout, 1); | callout_init(&sim->callout, 1); | ||||
} | |||||
return (sim); | return (sim); | ||||
} | } | ||||
struct cam_sim * | struct cam_sim * | ||||
cam_sim_alloc_dev(sim_action_func sim_action, sim_poll_func sim_poll, | cam_sim_alloc_dev(sim_action_func sim_action, sim_poll_func sim_poll, | ||||
const char *sim_name, void *softc, device_t dev, | const char *sim_name, void *softc, device_t dev, | ||||
struct mtx *mtx, int max_dev_transactions, | struct mtx *mtx, int max_dev_transactions, | ||||
int max_tagged_dev_transactions, struct cam_devq *queue) | int max_tagged_dev_transactions, struct cam_devq *queue) | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |