Commit 7a195f46 authored by Prakash, Sathya's avatar Prakash, Sathya Committed by James Bottomley

[SCSI] mpt fusion: Usage of high priority request FIFO to send task management commands

Added support for sending the task management requests through High priority
request FIFO instead of Doorbell writes when firmware support High priority
FIFO.
signed-off-by: default avatarSathya Prakash <sathya.prakash@lsi.com>
Acked-by: default avatarEric Moore <Eric.Moore@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 232f08fc
...@@ -842,6 +842,38 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) ...@@ -842,6 +842,38 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr); CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr);
} }
/**
* mpt_put_msg_frame_hi_pri - Send a protocol specific MPT request frame
* to a IOC using hi priority request queue.
* @handle: Handle of registered MPT protocol driver
* @ioc: Pointer to MPT adapter structure
* @mf: Pointer to MPT request frame
*
* This routine posts a MPT request frame to the request post FIFO of a
* specific MPT adapter.
**/
void
mpt_put_msg_frame_hi_pri(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
{
u32 mf_dma_addr;
int req_offset;
u16 req_idx; /* Request index */
/* ensure values are reset properly! */
mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle;
req_offset = (u8 *)mf - (u8 *)ioc->req_frames;
req_idx = req_offset / ioc->req_sz;
mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx);
mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
DBG_DUMP_PUT_MSG_FRAME(ioc, (u32 *)mf);
mf_dma_addr = (ioc->req_frames_low_dma + req_offset);
dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mf_dma_addr=%x req_idx=%d\n",
ioc->name, mf_dma_addr, req_idx));
CHIPREG_WRITE32(&ioc->chip->RequestHiPriFifo, mf_dma_addr);
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/** /**
* mpt_free_msg_frame - Place MPT request frame back on FreeQ. * mpt_free_msg_frame - Place MPT request frame back on FreeQ.
...@@ -7315,6 +7347,7 @@ EXPORT_SYMBOL(mpt_device_driver_register); ...@@ -7315,6 +7347,7 @@ EXPORT_SYMBOL(mpt_device_driver_register);
EXPORT_SYMBOL(mpt_device_driver_deregister); EXPORT_SYMBOL(mpt_device_driver_deregister);
EXPORT_SYMBOL(mpt_get_msg_frame); EXPORT_SYMBOL(mpt_get_msg_frame);
EXPORT_SYMBOL(mpt_put_msg_frame); EXPORT_SYMBOL(mpt_put_msg_frame);
EXPORT_SYMBOL(mpt_put_msg_frame_hi_pri);
EXPORT_SYMBOL(mpt_free_msg_frame); EXPORT_SYMBOL(mpt_free_msg_frame);
EXPORT_SYMBOL(mpt_add_sge); EXPORT_SYMBOL(mpt_add_sge);
EXPORT_SYMBOL(mpt_send_handshake_request); EXPORT_SYMBOL(mpt_send_handshake_request);
......
...@@ -336,7 +336,8 @@ typedef struct _SYSIF_REGS ...@@ -336,7 +336,8 @@ typedef struct _SYSIF_REGS
u32 Reserved2[2]; /* 38-3F reserved for future use */ u32 Reserved2[2]; /* 38-3F reserved for future use */
u32 RequestFifo; /* 40 Request Post/Free FIFO */ u32 RequestFifo; /* 40 Request Post/Free FIFO */
u32 ReplyFifo; /* 44 Reply Post/Free FIFO */ u32 ReplyFifo; /* 44 Reply Post/Free FIFO */
u32 Reserved3[2]; /* 48-4F reserved for future use */ u32 RequestHiPriFifo; /* 48 Hi Priority Request FIFO */
u32 Reserved3; /* 4C-4F reserved for future use */
u32 HostIndex; /* 50 Host Index register */ u32 HostIndex; /* 50 Host Index register */
u32 Reserved4[15]; /* 54-8F */ u32 Reserved4[15]; /* 54-8F */
u32 Fubar; /* 90 For Fubar usage */ u32 Fubar; /* 90 For Fubar usage */
...@@ -893,6 +894,7 @@ extern void mpt_device_driver_deregister(int cb_idx); ...@@ -893,6 +894,7 @@ extern void mpt_device_driver_deregister(int cb_idx);
extern MPT_FRAME_HDR *mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc); extern MPT_FRAME_HDR *mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc);
extern void mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); extern void mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf);
extern void mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); extern void mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf);
extern void mpt_put_msg_frame_hi_pri(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf);
extern void mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr); extern void mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr);
extern int mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag); extern int mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag);
......
...@@ -342,7 +342,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl) ...@@ -342,7 +342,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
SCSITaskMgmt_t *pScsiTm; SCSITaskMgmt_t *pScsiTm;
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
int ii; int ii;
int retval; int retval=0;
ioctl->reset &= ~MPTCTL_RESET_OK; ioctl->reset &= ~MPTCTL_RESET_OK;
...@@ -395,12 +395,19 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl) ...@@ -395,12 +395,19 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf); DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf);
ioctl->wait_done=0; ioctl->wait_done=0;
if ((retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) { if ((ioctl->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!" (ioctl->ioc->facts.MsgVersion >= MPI_VERSION_01_05))
" (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd, mpt_put_msg_frame_hi_pri(mptctl_id, ioctl->ioc, mf);
hd->ioc, mf)); else {
goto mptctl_bus_reset_done; retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
if (retval != 0) {
dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
" (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
hd->ioc, mf));
goto mptctl_bus_reset_done;
}
} }
/* Now wait for the command to complete */ /* Now wait for the command to complete */
...@@ -2187,15 +2194,20 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) ...@@ -2187,15 +2194,20 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf); DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
if (mpt_send_handshake_request(mptctl_id, ioc, if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
sizeof(SCSITaskMgmt_t), (u32*)mf, (ioc->facts.MsgVersion >= MPI_VERSION_01_05))
CAN_SLEEP) != 0) { mpt_put_msg_frame_hi_pri(mptctl_id, ioc, mf);
dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!" else {
" (ioc %p, mf %p) \n", ioc->name, rc =mpt_send_handshake_request(mptctl_id, ioc,
ioc, mf)); sizeof(SCSITaskMgmt_t), (u32*)mf, CAN_SLEEP);
mptctl_free_tm_flags(ioc); if (rc != 0) {
rc = -ENODATA; dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
goto done_free_mem; "_send_handshake FAILED! (ioc %p, mf %p)\n",
ioc->name, ioc, mf));
mptctl_free_tm_flags(ioc);
rc = -ENODATA;
goto done_free_mem;
}
} }
} else } else
......
...@@ -623,13 +623,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id) ...@@ -623,13 +623,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf); DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
if (mpt_send_handshake_request(ioc->TaskCtx, ioc, mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf);
sizeof(SCSITaskMgmt_t), (u32 *)mf, NO_SLEEP)) {
mpt_free_msg_frame(ioc, mf);
dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, tm handshake failed @%d!!\n",
ioc->name,__FUNCTION__, __LINE__));
return 0;
}
return 1; return 1;
} }
......
...@@ -1717,12 +1717,18 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i ...@@ -1717,12 +1717,18 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm); DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm);
if ((retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc, if ((hd->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) { (hd->ioc->facts.MsgVersion >= MPI_VERSION_01_05))
dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!" mpt_put_msg_frame_hi_pri(hd->ioc->TaskCtx, hd->ioc, mf);
else {
retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc,
sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
if (retval) {
dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!"
" (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd, " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd,
hd->ioc, mf, retval)); hd->ioc, mf, retval));
goto fail_out; goto fail_out;
}
} }
if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) { if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment