FreeBSD kernel CAM code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/poll.h>
#include <sys/vnode.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/devicestat.h>
#include <sys/proc.h>
#include <sys/types.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_periph.h>
#include <cam/cam_xpt_periph.h>
#include <cam/cam_sim.h>
#include <cam/scsi/scsi_targetio.h>
Go to the source code of this file.
Data Structures | |
struct | targ_cmd_descr |
struct | targ_softc |
Macros | |
#define | targ_descr periph_priv.entries[1].ptr |
Enumerations | |
enum | targ_state { TARG_STATE_RESV = 0x00 , TARG_STATE_OPENED = 0x01 , TARG_STATE_LUN_ENABLED = 0x02 } |
Functions | |
__FBSDID ("$FreeBSD$") | |
TAILQ_HEAD (descr_queue, targ_cmd_descr) | |
static void | targreadfiltdetach (struct knote *kn) |
static int | targreadfilt (struct knote *kn, long hint) |
static cam_status | targendislun (struct cam_path *path, int enable, int grp6_len, int grp7_len) |
static cam_status | targenable (struct targ_softc *softc, struct cam_path *path, int grp6_len, int grp7_len) |
static cam_status | targdisable (struct targ_softc *softc) |
static int | targusermerge (struct targ_softc *softc, struct targ_cmd_descr *descr, union ccb *ccb) |
static int | targsendccb (struct targ_softc *softc, union ccb *ccb, struct targ_cmd_descr *descr) |
static void | targdone (struct cam_periph *periph, union ccb *done_ccb) |
static int | targreturnccb (struct targ_softc *softc, union ccb *ccb) |
static union ccb * | targgetccb (struct targ_softc *softc, xpt_opcode type, int priority) |
static void | targfreeccb (struct targ_softc *softc, union ccb *ccb) |
static struct targ_cmd_descr * | targgetdescr (struct targ_softc *softc) |
static void | targasync (void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) |
static void | abort_all_pending (struct targ_softc *softc) |
static void | notify_user (struct targ_softc *softc) |
static int | targcamstatus (cam_status status) |
static size_t | targccblen (xpt_opcode func_code) |
PERIPHDRIVER_DECLARE (targ, targdriver) | |
static | MALLOC_DEFINE (M_TARG, "TARG", "TARG data") |
static void | targcdevdtor (void *data) |
static int | targopen (struct cdev *dev, int flags, int fmt, struct thread *td) |
static int | targioctl (struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) |
static int | targpoll (struct cdev *dev, int poll_events, struct thread *td) |
static int | targkqfilter (struct cdev *dev, struct knote *kn) |
static cam_status | targctor (struct cam_periph *periph, void *arg) |
static void | targdtor (struct cam_periph *periph) |
static int | targwrite (struct cdev *dev, struct uio *uio, int ioflag) |
static void | targstart (struct cam_periph *periph, union ccb *start_ccb) |
static int | targread (struct cdev *dev, struct uio *uio, int ioflag) |
Variables | |
static d_open_t | targopen |
static d_read_t | targread |
static d_write_t | targwrite |
static d_ioctl_t | targioctl |
static d_poll_t | targpoll |
static d_kqfilter_t | targkqfilter |
static struct filterops | targread_filtops |
static struct cdevsw | targ_cdevsw |
static periph_ctor_t | targctor |
static periph_dtor_t | targdtor |
static periph_start_t | targstart |
static periph_init_t | targinit |
static struct periph_driver | targdriver |
#define targ_descr periph_priv.entries[1].ptr |
Definition at line 67 of file scsi_target.c.
enum targ_state |
Enumerator | |
---|---|
TARG_STATE_RESV | |
TARG_STATE_OPENED | |
TARG_STATE_LUN_ENABLED |
Definition at line 71 of file scsi_target.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 1014 of file scsi_target.c.
References ccb_abort::abort_ccb, targ_softc::abort_queue, ccb::cab, CAM_DEBUG, CAM_DEBUG_PERIPH, cam_periph_lock, cam_periph_sleep, cam_periph_unlock, CAM_PRIORITY_NORMAL, CAM_REQ_CMP, CAM_REQ_CMP_ERR, ccb_abort::ccb_h, ccb::ccb_h, ccb_hdr::func_code, notify_user(), ccb_hdr::path, targ_softc::path, targ_softc::pending_ccb_queue, targ_softc::periph, ccb_hdr::periph_links, ccb_hdr::status, targ_softc::user_ccb_queue, targ_softc::work_queue, XPT_ABORT, xpt_action(), xpt_print(), and xpt_setup_ccb().
Referenced by targdisable().
|
static |
|
static |
Definition at line 1067 of file scsi_target.c.
References targ_softc::read_select, and targ_softc::user_ccb_queue.
Referenced by abort_all_pending(), targdone(), and targstart().
PERIPHDRIVER_DECLARE | ( | targ | , |
targdriver | |||
) |
TAILQ_HEAD | ( | descr_queue | , |
targ_cmd_descr | |||
) |
|
static |
Definition at line 1006 of file scsi_target.c.
Referenced by targenable().
|
static |
Definition at line 1080 of file scsi_target.c.
References CAM_BUSY, CAM_CMD_TIMEOUT, CAM_DEV_NOT_THERE, CAM_FUNC_NOTAVAIL, CAM_LUN_ALRDY_ENA, CAM_PATH_INVALID, CAM_PROVIDE_FAIL, CAM_REQ_ABORTED, CAM_REQ_CMP, CAM_REQ_CMP_ERR, CAM_REQ_INPROG, CAM_REQ_INVALID, CAM_REQUEUE_REQ, CAM_RESRC_UNAVAIL, CAM_STATUS_MASK, and CAM_UA_ABORT.
Referenced by targioctl().
|
static |
Definition at line 1117 of file scsi_target.c.
References XPT_ABORT, XPT_ACCEPT_TARGET_IO, XPT_CONT_TARGET_IO, XPT_DEBUG, XPT_EN_LUN, XPT_IMMED_NOTIFY, XPT_IMMEDIATE_NOTIFY, XPT_PATH_INQ, XPT_REL_SIMQ, and XPT_SCSI_IO.
Referenced by targgetccb(), targreturnccb(), and targusermerge().
|
static |
Definition at line 169 of file scsi_target.c.
References cam_periph_acquire(), cam_periph_invalidate(), cam_periph_lock, cam_periph_release(), cam_periph_unlock, cam_periph::softc, and targdisable().
Referenced by targopen().
|
static |
Definition at line 482 of file scsi_target.c.
References CAM_REQ_CMP, cam_periph::path, targ_softc::path, targ_softc::periph, and cam_periph::softc.
|
static |
Definition at line 457 of file scsi_target.c.
References abort_all_pending(), CAM_DEBUG, CAM_DEBUG_PERIPH, CAM_REQ_CMP, targ_softc::path, targ_softc::state, TARG_STATE_LUN_ENABLED, and targendislun().
Referenced by targcdevdtor(), and targioctl().
|
static |
Definition at line 761 of file scsi_target.c.
References CAM_DEBUG, CAM_DEBUG_PERIPH, cam_periph_lock, cam_periph_unlock, ccb::ccb_h, ccb_hdr::func_code, notify_user(), cam_periph::path, targ_softc::pending_ccb_queue, targ_softc::periph, cam_periph::softc, targ_softc::state, TARG_STATE_LUN_ENABLED, targfreeccb(), targ_softc::user_ccb_queue, XPT_ACCEPT_TARGET_IO, XPT_CONT_TARGET_IO, XPT_IMMED_NOTIFY, and XPT_IMMEDIATE_NOTIFY.
Referenced by targgetccb(), targioctl(), and targsendccb().
|
static |
Definition at line 495 of file scsi_target.c.
References targ_softc::abort_queue, targ_softc::path, targ_softc::periph, cam_periph::softc, targfreeccb(), and targ_softc::user_ccb_queue.
|
static |
Definition at line 383 of file scsi_target.c.
References CAM_FUNC_NOTAVAIL, CAM_LUN_ALRDY_ENA, cam_periph_alloc(), CAM_PERIPH_BIO, cam_periph_find(), cam_periph_invalidate(), CAM_REQ_CMP, CAM_STATUS_MASK, ccb_pathinq::ccb_h, ccb_pathinq::maxio, targ_softc::maxio, targ_softc::path, targ_softc::periph, PIT_PROCESSOR, cam_periph::softc, targ_softc::state, ccb_hdr::status, TARG_STATE_LUN_ENABLED, targasync(), targctor, targdtor, targendislun(), ccb_pathinq::target_sprt, targstart, cam_periph::unit_number, and xpt_path_inq().
Referenced by targioctl().
|
static |
Definition at line 359 of file scsi_target.c.
References CAM_PRIORITY_NORMAL, CAM_REQ_CMP, CAM_STATUS_MASK, ccb_en_lun::ccb_h, ccb_en_lun::enable, ccb_hdr::func_code, ccb_en_lun::grp6_len, ccb_en_lun::grp7_len, ccb_hdr::status, xpt_action(), XPT_EN_LUN, xpt_print(), and xpt_setup_ccb().
Referenced by targdisable(), and targenable().
|
static |
Definition at line 954 of file scsi_target.c.
References CAM_DEBUG_PERIPH, CAM_DEBUG_PRINT, ccb::ccb_h, ccb_hdr::func_code, XPT_ACCEPT_TARGET_IO, XPT_FC_IS_QUEUED, XPT_IMMED_NOTIFY, XPT_IMMEDIATE_NOTIFY, and xpt_release_ccb().
Referenced by targdone(), targdtor(), and targreturnccb().
|
static |
Definition at line 931 of file scsi_target.c.
References CAM_DEBUG, CAM_DEBUG_PERIPH, ccb_hdr::cbfcnp, ccb, ccb::ccb_h, ccb_hdr::func_code, targ_softc::path, targccblen(), targdone(), targgetdescr(), and xpt_setup_ccb().
Referenced by targwrite().
|
static |
Definition at line 983 of file scsi_target.c.
References targ_cmd_descr::mapinfo, and cam_periph_map_info::num_bufs_used.
Referenced by targgetccb(), and targwrite().
|
static |
Definition at line 227 of file scsi_target.c.
References CAM_DEBUG_NONE, CAM_DEBUG_PERIPH, CAM_DEV_NOT_THERE, cam_periph_lock, cam_periph_unlock, CAM_PRIORITY_NORMAL, CAM_PROVIDE_FAIL, CAM_REQ_CMP, CAM_STATUS_MASK, ccb_hdr::cbfcnp, ccb_debug::ccb_h, ccb_debug::flags, ccb_hdr::func_code, ioc_enable_lun::grp6_len, ioc_enable_lun::grp7_len, ioc_enable_lun::lun_id, targ_softc::path, ioc_enable_lun::path_id, targ_softc::periph, targ_softc::state, ccb_hdr::status, TARG_STATE_LUN_ENABLED, targcamstatus(), targdisable(), targdone(), targenable(), ioc_enable_lun::target_id, TARGIOCDEBUG, TARGIOCDISABLE, TARGIOCENABLE, xpt_action(), xpt_create_path(), XPT_DEBUG, xpt_free_path(), xpt_path_lock, xpt_path_unlock, and xpt_setup_ccb().
|
static |
Definition at line 322 of file scsi_target.c.
References targ_softc::read_select, and targread_filtops.
|
static |
Definition at line 204 of file scsi_target.c.
References targ_softc::abort_queue, targ_softc::path, targ_softc::pending_ccb_queue, targ_softc::periph, targ_softc::read_select, targ_softc::state, TARG_STATE_OPENED, targcdevdtor(), targ_softc::user_ccb_queue, and targ_softc::work_queue.
|
static |
Definition at line 296 of file scsi_target.c.
References targ_softc::abort_queue, cam_periph_lock, cam_periph_unlock, targ_softc::periph, targ_softc::read_select, and targ_softc::user_ccb_queue.
|
static |
Definition at line 800 of file scsi_target.c.
References targ_softc::abort_queue, CAM_DEBUG, CAM_DEBUG_PERIPH, cam_periph_lock, cam_periph_sleep, cam_periph_unlock, CAM_REQ_ABORTED, ccb::ccb_h, targ_softc::path, targ_softc::periph, ccb_hdr::status, targreturnccb(), and targ_softc::user_ccb_queue.
|
static |
Definition at line 344 of file scsi_target.c.
References targ_softc::abort_queue, cam_periph_lock, cam_periph_unlock, targ_softc::periph, and targ_softc::user_ccb_queue.
|
static |
Definition at line 334 of file scsi_target.c.
References targ_softc::read_select.
|
static |
Definition at line 899 of file scsi_target.c.
References CAM_DEBUG, CAM_DEBUG_PERIPH, cam_periph_unmapmem(), ccb::ccb_h, ccb_hdr::func_code, targ_cmd_descr::mapinfo, cam_periph_map_info::num_bufs_used, targ_softc::path, ccb_hdr::retry_count, targccblen(), targfreeccb(), and xpt_print().
Referenced by targread(), and targwrite().
|
static |
Definition at line 710 of file scsi_target.c.
References CAM_DEBUG, CAM_DEBUG_PERIPH, cam_periph_mapmem(), CAM_REQ_CMP_ERR, ccb_hdr::cbfcnp, ccb::ccb_h, ccb_hdr::func_code, targ_cmd_descr::mapinfo, targ_softc::maxio, cam_periph_map_info::num_bufs_used, targ_softc::path, targ_softc::pending_ccb_queue, ccb_hdr::periph_links, ccb_hdr::status, targdone(), xpt_action(), XPT_CONT_TARGET_IO, XPT_DEV_MATCH, and XPT_FC_IS_QUEUED.
Referenced by targstart(), and targwrite().
|
static |
Definition at line 616 of file scsi_target.c.
References targ_softc::abort_queue, CAM_DEBUG, CAM_DEBUG_PERIPH, CAM_REQ_CMP_ERR, notify_user(), cam_periph::path, targ_softc::path, targ_softc::periph, cam_periph::softc, targsendccb(), targusermerge(), targ_softc::work_queue, xpt_print(), xpt_release_ccb(), and xpt_schedule().
|
static |
Definition at line 653 of file scsi_target.c.
References ccb_abort::abort_ccb, CAM_DEBUG, CAM_DEBUG_PERIPH, CAM_PATH_INVALID, CAM_REQ_CMP_ERR, ccb_abort::ccb_h, ccb::ccb_h, ccb_hdr::flags, ccb_hdr::func_code, targ_softc::path, targ_softc::pending_ccb_queue, ccb_hdr::retry_count, ccb_hdr::status, targccblen(), ccb_hdr::timeout, XPT_ABORT, and xpt_setup_ccb().
Referenced by targstart(), and targwrite().
|
static |
Definition at line 524 of file scsi_target.c.
References CAM_DEBUG, CAM_DEBUG_PERIPH, cam_periph_lock, cam_periph_unlock, CAM_PRIORITY_NONE, ccb, ccb::ccb_h, targ_softc::path, targ_softc::pending_ccb_queue, targ_softc::periph, targgetccb(), targgetdescr(), targreturnccb(), targsendccb(), targusermerge(), targ_softc::work_queue, XPT_ACCEPT_TARGET_IO, xpt_action(), XPT_FC_QUEUED, XPT_IMMED_NOTIFY, XPT_IMMEDIATE_NOTIFY, and xpt_schedule().
|
static |
Definition at line 116 of file scsi_target.c.
|
static |
Definition at line 133 of file scsi_target.c.
Referenced by targenable().
|
static |
Definition at line 158 of file scsi_target.c.
|
static |
Definition at line 134 of file scsi_target.c.
Referenced by targenable().
|
static |
Definition at line 150 of file scsi_target.c.
|
static |
Definition at line 105 of file scsi_target.c.
|
static |
Definition at line 107 of file scsi_target.c.
|
static |
Definition at line 102 of file scsi_target.c.
|
static |
Definition at line 106 of file scsi_target.c.
|
static |
Definition at line 103 of file scsi_target.c.
|
static |
Definition at line 110 of file scsi_target.c.
Referenced by targkqfilter().
|
static |
Definition at line 135 of file scsi_target.c.
Referenced by targenable().
|
static |
Definition at line 104 of file scsi_target.c.