Add an ioctl framework for doing FC task management functions from

a user space tool- useful for doing FC target mode certification.
This commit is contained in:
Matt Jacob 2005-10-29 02:46:59 +00:00
parent 068b664206
commit 8e62a8ac99
4 changed files with 73 additions and 1 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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)

View File

@ -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