diff options
author | mjacob <mjacob@FreeBSD.org> | 2005-10-29 02:46:59 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2005-10-29 02:46:59 +0000 |
commit | ccffddac5ccb3fc8a6cef9b5f7587cf9d3aac4e1 (patch) | |
tree | 510b1fcd2af2e73684cebdb6dfc7d6fa652382c5 /sys/dev/isp/isp_freebsd.c | |
parent | d00054e9687cf86fb1c8e3adc69ff77986e95902 (diff) | |
download | FreeBSD-src-ccffddac5ccb3fc8a6cef9b5f7587cf9d3aac4e1.zip FreeBSD-src-ccffddac5ccb3fc8a6cef9b5f7587cf9d3aac4e1.tar.gz |
Add an ioctl framework for doing FC task management functions from
a user space tool- useful for doing FC target mode certification.
Diffstat (limited to 'sys/dev/isp/isp_freebsd.c')
-rw-r--r-- | sys/dev/isp/isp_freebsd.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 623ebf0..de468f5 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -503,6 +503,65 @@ ispioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *t retval = EINVAL; break; } + case ISP_TSK_MGMT: + { + int needmarker; + struct isp_fc_tsk_mgmt *fct = (struct isp_fc_tsk_mgmt *) addr; + mbreg_t mbs; + + if (IS_SCSI(isp)) { + retval = EINVAL; + break; + } + + memset(&mbs, 0, sizeof (mbs)); + needmarker = retval = 0; + + switch (fct->action) { + case CLEAR_ACA: + mbs.param[0] = MBOX_CLEAR_ACA; + mbs.param[1] = fct->loopid << 8; + mbs.param[2] = fct->lun; + break; + case TARGET_RESET: + mbs.param[0] = MBOX_TARGET_RESET; + mbs.param[1] = fct->loopid << 8; + needmarker = 1; + break; + case LUN_RESET: + mbs.param[0] = MBOX_LUN_RESET; + mbs.param[1] = fct->loopid << 8; + mbs.param[2] = fct->lun; + needmarker = 1; + break; + case CLEAR_TASK_SET: + mbs.param[0] = MBOX_CLEAR_TASK_SET; + mbs.param[1] = fct->loopid << 8; + mbs.param[2] = fct->lun; + needmarker = 1; + break; + case ABORT_TASK_SET: + mbs.param[0] = MBOX_ABORT_TASK_SET; + mbs.param[1] = fct->loopid << 8; + mbs.param[2] = fct->lun; + needmarker = 1; + break; + default: + retval = EINVAL; + break; + } + if (retval == 0) { + ISP_LOCK(isp); + if (needmarker) { + isp->isp_sendmarker |= 1; + } + retval = isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); + ISP_UNLOCK(isp); + if (retval) + retval = EIO; + } + break; + } default: break; } |