FreeBSD kernel CAM code
|
Go to the source code of this file.
Data Structures | |
struct | cam_sim |
Macros | |
#define | spriv_ptr0 sim_priv.entries[0].ptr |
#define | spriv_ptr1 sim_priv.entries[1].ptr |
#define | spriv_field0 sim_priv.entries[0].field |
#define | spriv_field1 sim_priv.entries[1].field |
Typedefs | |
typedef void(* | sim_action_func) (struct cam_sim *sim, union ccb *ccb) |
typedef void(* | sim_poll_func) (struct cam_sim *sim) |
Functions | |
struct cam_devq * | cam_simq_alloc (u_int32_t max_sim_transactions) |
void | cam_simq_free (struct cam_devq *devq) |
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, struct mtx *mtx, int max_dev_transactions, int max_tagged_dev_transactions, struct cam_devq *queue) |
allocate a new sim and fill in the details More... | |
struct cam_sim * | cam_sim_alloc_dev (sim_action_func sim_action, sim_poll_func sim_poll, const char *sim_name, void *softc, device_t dev, struct mtx *mtx, int max_dev_transactions, int max_tagged_dev_transactions, struct cam_devq *queue) |
void | cam_sim_free (struct cam_sim *sim, int free_devq) |
frees up the sim More... | |
void | cam_sim_hold (struct cam_sim *sim) |
void | cam_sim_release (struct cam_sim *sim) |
void | cam_sim_set_path (struct cam_sim *sim, u_int32_t path_id) |
static __inline u_int32_t | cam_sim_path (const struct cam_sim *sim) |
static __inline const char * | cam_sim_name (const struct cam_sim *sim) |
static __inline void * | cam_sim_softc (const struct cam_sim *sim) |
static __inline u_int32_t | cam_sim_unit (const struct cam_sim *sim) |
static __inline u_int32_t | cam_sim_bus (const struct cam_sim *sim) |
static __inline bool | cam_sim_pollable (const struct cam_sim *sim) |
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, | ||
struct mtx * | mtx, | ||
int | max_dev_transactions, | ||
int | max_tagged_dev_transactions, | ||
struct cam_devq * | queue | ||
) |
allocate a new sim and fill in the details
A Storage Interface Module (SIM) is the interface between CAM and hardware. SIM receives CCBs from CAM via sim_action
callback and translates them into DMA or other hardware transactions. During system dumps, it can be polled with the sim_poll
callback. CCB processing is terminated by calling xpt_done()
.
The mtx
acts as a perimeter lock for the SIM. All calls into the SIM's sim_action
are made with this lock held. It is also used to hold/release a SIM, managing its reference count. When the lock is NULL, the SIM is 100% responsible for locking (and the reference counting is done with a shared lock.
The cam_devq passed in (queue
) is used to arbitrate the number of outstanding transactions to the SIM. For HBAs that have global limits shared between the different buses, the same devq should be specified for each bus attached to the SIM.
sim_action | Function to call to process CCBs |
sim_poll | Function to poll the hardware for completions |
sim_name | Name of SIM class |
softc | Software context associated with the SIM |
unit | Unit number of SIM |
mtx | Mutex to lock while interacting with the SIM, or NULL for a SIM that handle its own locking to enable multi queue support. |
max_dev_transactions | Maximum number of concurrent untagged transactions possible |
max_tagged_dev_transactions | Maximum number of concurrent tagged transactions possible. |
queue | The cam_devq to use for this SIM. |
Definition at line 103 of file cam_sim.c.
References cam_sim::bus_id, CAM_PATH_ANY, cam_sim::devq, cam_sim::flags, cam_sim::max_dev_openings, cam_sim::max_tagged_dev_openings, cam_sim::mtx, cam_sim::path_id, cam_sim::refcount, cam_sim::sim_action, cam_sim::sim_name, cam_sim::sim_poll, cam_sim::softc, and cam_sim::unit_number.
Referenced by cfcs_init(), mmc_cam_sim_alloc(), and xpt_init().
struct cam_sim * cam_sim_alloc_dev | ( | sim_action_func | sim_action, |
sim_poll_func | sim_poll, | ||
const char * | sim_name, | ||
void * | softc, | ||
device_t | dev, | ||
struct mtx * | mtx, | ||
int | max_dev_transactions, | ||
int | max_tagged_dev_transactions, | ||
struct cam_devq * | queue | ||
) |
|
static |
Definition at line 133 of file cam_sim.h.
References cam_sim::bus_id.
Referenced by mmc_path_inq().
void cam_sim_free | ( | struct cam_sim * | sim, |
int | free_devq | ||
) |
frees up the sim
Frees up the CAM sim
and optionally the devq. If a mutex is associated with the sim, it must be locked on entry. It will remain locked on return.
This function will wait for all outstanding reference to the sim to clear before returning.
sim | The sim to free |
free_devq | Free the devq associated with the sim at creation. |
Definition at line 144 of file cam_sim.c.
References cam_sim_free_mtx, cam_simq_free(), cam_sim::devq, cam_sim::mtx, and cam_sim::refcount.
Referenced by cfcs_init(), cfcs_shutdown(), mmc_cam_sim_alloc(), and mmc_cam_sim_free().
void cam_sim_hold | ( | struct cam_sim * | sim | ) |
Definition at line 193 of file cam_sim.c.
References cam_sim_free_mtx, cam_sim::mtx, and cam_sim::refcount.
Referenced by xpt_bus_register().
|
static |
Definition at line 115 of file cam_sim.h.
References cam_sim::sim_name.
Referenced by cfcs_action(), mmc_path_inq(), and mmccam_start_discovery().
|
static |
Definition at line 109 of file cam_sim.h.
References cam_sim::path_id.
Referenced by cfcs_init(), cfcs_onoffline(), cfcs_shutdown(), mmc_cam_sim_free(), mmccam_start_discovery(), and sgioctl().
|
static |
Definition at line 139 of file cam_sim.h.
References cam_sim::sim_poll.
Referenced by adaregister(), cam_periph_runccb(), daregister(), ndaregister(), sdda_add_part(), xpt_poll_setup(), xpt_pollwait(), and xpt_sim_poll().
void cam_sim_release | ( | struct cam_sim * | sim | ) |
Definition at line 172 of file cam_sim.c.
References cam_sim_free_mtx, cam_sim::mtx, and cam_sim::refcount.
Referenced by xpt_release_bus().
void cam_sim_set_path | ( | struct cam_sim * | sim, |
u_int32_t | path_id | ||
) |
Definition at line 212 of file cam_sim.c.
References cam_sim::path_id.
|
static |
Definition at line 121 of file cam_sim.h.
References cam_sim::softc.
Referenced by cfcs_action(), mmc_cam_default_poll(), and mmc_cam_sim_default_action().
|
static |
Definition at line 127 of file cam_sim.h.
References cam_sim::unit_number.
Referenced by mmc_path_inq().
struct cam_devq * cam_simq_alloc | ( | u_int32_t | max_sim_transactions | ) |
Definition at line 55 of file cam_sim.c.
References cam_devq_alloc().
Referenced by cfcs_init(), mmc_cam_sim_alloc(), and xpt_init().
void cam_simq_free | ( | struct cam_devq * | devq | ) |
Definition at line 61 of file cam_sim.c.
References cam_devq_free().
Referenced by cam_sim_free(), cfcs_init(), mmc_cam_sim_alloc(), and mmc_cam_sim_free().