aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorPrakash, Sathya <sathya.prakash@lsi.com>2007-08-14 06:38:40 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:40:40 -0400
commit7a195f464e0692607aca8150c8489a838fab684b (patch)
tree55368ee04d0ad6209fae6fe375b977046488c4b6 /drivers/message/fusion
parent232f08fc82b15fdcaffc68c558115bfb2b34db86 (diff)
[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: Sathya Prakash <sathya.prakash@lsi.com> Acked-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptbase.c33
-rw-r--r--drivers/message/fusion/mptbase.h4
-rw-r--r--drivers/message/fusion/mptctl.c44
-rw-r--r--drivers/message/fusion/mptsas.c8
-rw-r--r--drivers/message/fusion/mptscsih.c14
5 files changed, 75 insertions, 28 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 828f0ca7c1b3..7ef86cb3aa55 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -842,6 +842,38 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
842 CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr); 842 CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr);
843} 843}
844 844
845/**
846 * mpt_put_msg_frame_hi_pri - Send a protocol specific MPT request frame
847 * to a IOC using hi priority request queue.
848 * @handle: Handle of registered MPT protocol driver
849 * @ioc: Pointer to MPT adapter structure
850 * @mf: Pointer to MPT request frame
851 *
852 * This routine posts a MPT request frame to the request post FIFO of a
853 * specific MPT adapter.
854 **/
855void
856mpt_put_msg_frame_hi_pri(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
857{
858 u32 mf_dma_addr;
859 int req_offset;
860 u16 req_idx; /* Request index */
861
862 /* ensure values are reset properly! */
863 mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle;
864 req_offset = (u8 *)mf - (u8 *)ioc->req_frames;
865 req_idx = req_offset / ioc->req_sz;
866 mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx);
867 mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
868
869 DBG_DUMP_PUT_MSG_FRAME(ioc, (u32 *)mf);
870
871 mf_dma_addr = (ioc->req_frames_low_dma + req_offset);
872 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mf_dma_addr=%x req_idx=%d\n",
873 ioc->name, mf_dma_addr, req_idx));
874 CHIPREG_WRITE32(&ioc->chip->RequestHiPriFifo, mf_dma_addr);
875}
876
845/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 877/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
846/** 878/**
847 * mpt_free_msg_frame - Place MPT request frame back on FreeQ. 879 * mpt_free_msg_frame - Place MPT request frame back on FreeQ.
@@ -7315,6 +7347,7 @@ EXPORT_SYMBOL(mpt_device_driver_register);
7315EXPORT_SYMBOL(mpt_device_driver_deregister); 7347EXPORT_SYMBOL(mpt_device_driver_deregister);
7316EXPORT_SYMBOL(mpt_get_msg_frame); 7348EXPORT_SYMBOL(mpt_get_msg_frame);
7317EXPORT_SYMBOL(mpt_put_msg_frame); 7349EXPORT_SYMBOL(mpt_put_msg_frame);
7350EXPORT_SYMBOL(mpt_put_msg_frame_hi_pri);
7318EXPORT_SYMBOL(mpt_free_msg_frame); 7351EXPORT_SYMBOL(mpt_free_msg_frame);
7319EXPORT_SYMBOL(mpt_add_sge); 7352EXPORT_SYMBOL(mpt_add_sge);
7320EXPORT_SYMBOL(mpt_send_handshake_request); 7353EXPORT_SYMBOL(mpt_send_handshake_request);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index a8c80805e170..012be5ea906e 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -336,7 +336,8 @@ typedef struct _SYSIF_REGS
336 u32 Reserved2[2]; /* 38-3F reserved for future use */ 336 u32 Reserved2[2]; /* 38-3F reserved for future use */
337 u32 RequestFifo; /* 40 Request Post/Free FIFO */ 337 u32 RequestFifo; /* 40 Request Post/Free FIFO */
338 u32 ReplyFifo; /* 44 Reply Post/Free FIFO */ 338 u32 ReplyFifo; /* 44 Reply Post/Free FIFO */
339 u32 Reserved3[2]; /* 48-4F reserved for future use */ 339 u32 RequestHiPriFifo; /* 48 Hi Priority Request FIFO */
340 u32 Reserved3; /* 4C-4F reserved for future use */
340 u32 HostIndex; /* 50 Host Index register */ 341 u32 HostIndex; /* 50 Host Index register */
341 u32 Reserved4[15]; /* 54-8F */ 342 u32 Reserved4[15]; /* 54-8F */
342 u32 Fubar; /* 90 For Fubar usage */ 343 u32 Fubar; /* 90 For Fubar usage */
@@ -893,6 +894,7 @@ extern void mpt_device_driver_deregister(int cb_idx);
893extern MPT_FRAME_HDR *mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc); 894extern MPT_FRAME_HDR *mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc);
894extern void mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); 895extern void mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf);
895extern void mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); 896extern void mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf);
897extern void mpt_put_msg_frame_hi_pri(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf);
896extern void mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr); 898extern void mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr);
897 899
898extern int mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag); 900extern int mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag);
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 89695e705bdc..dce1e9c2cdc0 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -342,7 +342,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
342 SCSITaskMgmt_t *pScsiTm; 342 SCSITaskMgmt_t *pScsiTm;
343 MPT_SCSI_HOST *hd; 343 MPT_SCSI_HOST *hd;
344 int ii; 344 int ii;
345 int retval; 345 int retval=0;
346 346
347 347
348 ioctl->reset &= ~MPTCTL_RESET_OK; 348 ioctl->reset &= ~MPTCTL_RESET_OK;
@@ -395,12 +395,19 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
395 DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf); 395 DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf);
396 396
397 ioctl->wait_done=0; 397 ioctl->wait_done=0;
398 if ((retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc, 398
399 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) { 399 if ((ioctl->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
400 dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!" 400 (ioctl->ioc->facts.MsgVersion >= MPI_VERSION_01_05))
401 " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd, 401 mpt_put_msg_frame_hi_pri(mptctl_id, ioctl->ioc, mf);
402 hd->ioc, mf)); 402 else {
403 goto mptctl_bus_reset_done; 403 retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
404 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
405 if (retval != 0) {
406 dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
407 " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
408 hd->ioc, mf));
409 goto mptctl_bus_reset_done;
410 }
404 } 411 }
405 412
406 /* Now wait for the command to complete */ 413 /* Now wait for the command to complete */
@@ -2187,15 +2194,20 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2187 2194
2188 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf); 2195 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
2189 2196
2190 if (mpt_send_handshake_request(mptctl_id, ioc, 2197 if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
2191 sizeof(SCSITaskMgmt_t), (u32*)mf, 2198 (ioc->facts.MsgVersion >= MPI_VERSION_01_05))
2192 CAN_SLEEP) != 0) { 2199 mpt_put_msg_frame_hi_pri(mptctl_id, ioc, mf);
2193 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!" 2200 else {
2194 " (ioc %p, mf %p) \n", ioc->name, 2201 rc =mpt_send_handshake_request(mptctl_id, ioc,
2195 ioc, mf)); 2202 sizeof(SCSITaskMgmt_t), (u32*)mf, CAN_SLEEP);
2196 mptctl_free_tm_flags(ioc); 2203 if (rc != 0) {
2197 rc = -ENODATA; 2204 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2198 goto done_free_mem; 2205 "_send_handshake FAILED! (ioc %p, mf %p)\n",
2206 ioc->name, ioc, mf));
2207 mptctl_free_tm_flags(ioc);
2208 rc = -ENODATA;
2209 goto done_free_mem;
2210 }
2199 } 2211 }
2200 2212
2201 } else 2213 } else
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index b9c69bff218c..fe3b505b895e 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -623,13 +623,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
623 623
624 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf); 624 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
625 625
626 if (mpt_send_handshake_request(ioc->TaskCtx, ioc, 626 mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf);
627 sizeof(SCSITaskMgmt_t), (u32 *)mf, NO_SLEEP)) {
628 mpt_free_msg_frame(ioc, mf);
629 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, tm handshake failed @%d!!\n",
630 ioc->name,__FUNCTION__, __LINE__));
631 return 0;
632 }
633 627
634 return 1; 628 return 1;
635} 629}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 5431529741ad..b8b059807600 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1717,12 +1717,18 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
1717 1717
1718 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm); 1718 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm);
1719 1719
1720 if ((retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc, 1720 if ((hd->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
1721 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) { 1721 (hd->ioc->facts.MsgVersion >= MPI_VERSION_01_05))
1722 dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!" 1722 mpt_put_msg_frame_hi_pri(hd->ioc->TaskCtx, hd->ioc, mf);
1723 else {
1724 retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc,
1725 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
1726 if (retval) {
1727 dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!"
1723 " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd, 1728 " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd,
1724 hd->ioc, mf, retval)); 1729 hd->ioc, mf, retval));
1725 goto fail_out; 1730 goto fail_out;
1731 }
1726 } 1732 }
1727 1733
1728 if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) { 1734 if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) {