diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index d009cd7273ec..cc0c3c1ddca5 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 623ebf0f3c82..de468f5f33fb 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 921272aa2490..099b10478771 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 4834fd32c79b..b810faaa6344 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