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 | |
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')
-rw-r--r-- | sys/dev/isp/isp.c | 2 | ||||
-rw-r--r-- | sys/dev/isp/isp_freebsd.c | 59 | ||||
-rw-r--r-- | sys/dev/isp/isp_ioctl.h | 12 | ||||
-rw-r--r-- | sys/dev/isp/ispmbox.h | 1 |
4 files changed, 73 insertions, 1 deletions
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index d009cd7..cc0c3c1 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -5166,7 +5166,7 @@ static const u_int16_t mbpfc[] = { ISPOPMAP(0x00, 0x00), /* 0x7b: */ ISPOPMAP(0x4f, 0x03), /* 0x7c: Get ID List */ ISPOPMAP(0xcf, 0x01), /* 0x7d: SEND LFA */ - ISPOPMAP(0x07, 0x01) /* 0x7e: Lun RESET */ + ISPOPMAP(0x0f, 0x01) /* 0x7e: LUN RESET */ }; /* * Footnotes 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; } diff --git a/sys/dev/isp/isp_ioctl.h b/sys/dev/isp/isp_ioctl.h index 921272a..099b104 100644 --- a/sys/dev/isp/isp_ioctl.h +++ b/sys/dev/isp/isp_ioctl.h @@ -185,3 +185,15 @@ struct isp_fc_param { #define ISP_GET_FC_PARAM _IOWR(ISP_IOC, 98, struct isp_fc_param) #define ISP_SET_FC_PARAM _IOWR(ISP_IOC, 99, struct isp_fc_param) + +/* + * Various Reset Goodies + */ +struct isp_fc_tsk_mgmt { + u_int32_t loopid; /* 0..255 */ + u_int32_t lun; + enum { + CLEAR_ACA, TARGET_RESET, LUN_RESET, CLEAR_TASK_SET, ABORT_TASK_SET + } action; +}; +#define ISP_TSK_MGMT _IOWR(ISP_IOC, 97, struct isp_fc_tsk_mgmt) diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h index 4834fd3..b810faa 100644 --- a/sys/dev/isp/ispmbox.h +++ b/sys/dev/isp/ispmbox.h @@ -143,6 +143,7 @@ #define MBOX_SEND_CHANGE_REQUEST 0x0070 #define MBOX_FABRIC_LOGOUT 0x0071 #define MBOX_INIT_LIP_LOGIN 0x0072 +#define MBOX_LUN_RESET 0x007E #define MBOX_DRIVER_HEARTBEAT 0x005B #define MBOX_FW_HEARTBEAT 0x005C |