aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptscsih.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion/mptscsih.c')
-rw-r--r--drivers/message/fusion/mptscsih.c264
1 files changed, 141 insertions, 123 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 3bd94f11e7d6..d35617376f87 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -4,7 +4,7 @@
4 * running LSI Logic Fusion MPT (Message Passing Technology) firmware. 4 * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
5 * 5 *
6 * Copyright (c) 1999-2007 LSI Logic Corporation 6 * Copyright (c) 1999-2007 LSI Logic Corporation
7 * (mailto:mpt_linux_developer@lsi.com) 7 * (mailto:DL-MPTFusionLinux@lsi.com)
8 * 8 *
9 */ 9 */
10/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 10/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -44,7 +44,6 @@
44*/ 44*/
45/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 45/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
46 46
47#include "linux_compat.h" /* linux-2.6 tweaks */
48#include <linux/module.h> 47#include <linux/module.h>
49#include <linux/kernel.h> 48#include <linux/kernel.h>
50#include <linux/init.h> 49#include <linux/init.h>
@@ -260,30 +259,13 @@ mptscsih_AddSGE(MPT_ADAPTER *ioc, struct scsi_cmnd *SCpnt,
260 /* Map the data portion, if any. 259 /* Map the data portion, if any.
261 * sges_left = 0 if no data transfer. 260 * sges_left = 0 if no data transfer.
262 */ 261 */
263 if ( (sges_left = SCpnt->use_sg) ) { 262 sges_left = scsi_dma_map(SCpnt);
264 sges_left = pci_map_sg(ioc->pcidev, 263 if (sges_left < 0)
265 (struct scatterlist *) SCpnt->request_buffer, 264 return FAILED;
266 SCpnt->use_sg,
267 SCpnt->sc_data_direction);
268 if (sges_left == 0)
269 return FAILED;
270 } else if (SCpnt->request_bufflen) {
271 SCpnt->SCp.dma_handle = pci_map_single(ioc->pcidev,
272 SCpnt->request_buffer,
273 SCpnt->request_bufflen,
274 SCpnt->sc_data_direction);
275 dsgprintk((MYIOC_s_INFO_FMT "SG: non-SG for %p, len=%d\n",
276 ioc->name, SCpnt, SCpnt->request_bufflen));
277 mptscsih_add_sge((char *) &pReq->SGL,
278 0xD1000000|MPT_SGE_FLAGS_ADDRESSING|sgdir|SCpnt->request_bufflen,
279 SCpnt->SCp.dma_handle);
280
281 return SUCCESS;
282 }
283 265
284 /* Handle the SG case. 266 /* Handle the SG case.
285 */ 267 */
286 sg = (struct scatterlist *) SCpnt->request_buffer; 268 sg = scsi_sglist(SCpnt);
287 sg_done = 0; 269 sg_done = 0;
288 sgeOffset = sizeof(SCSIIORequest_t) - sizeof(SGE_IO_UNION); 270 sgeOffset = sizeof(SCSIIORequest_t) - sizeof(SGE_IO_UNION);
289 chainSge = NULL; 271 chainSge = NULL;
@@ -465,7 +447,12 @@ mptscsih_issue_sep_command(MPT_ADAPTER *ioc, VirtTarget *vtarget,
465 MPT_FRAME_HDR *mf; 447 MPT_FRAME_HDR *mf;
466 SEPRequest_t *SEPMsg; 448 SEPRequest_t *SEPMsg;
467 449
468 if (ioc->bus_type == FC) 450 if (ioc->bus_type != SAS)
451 return;
452
453 /* Not supported for hidden raid components
454 */
455 if (vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT)
469 return; 456 return;
470 457
471 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { 458 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
@@ -662,7 +649,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
662 scsi_state = pScsiReply->SCSIState; 649 scsi_state = pScsiReply->SCSIState;
663 scsi_status = pScsiReply->SCSIStatus; 650 scsi_status = pScsiReply->SCSIStatus;
664 xfer_cnt = le32_to_cpu(pScsiReply->TransferCount); 651 xfer_cnt = le32_to_cpu(pScsiReply->TransferCount);
665 sc->resid = sc->request_bufflen - xfer_cnt; 652 scsi_set_resid(sc, scsi_bufflen(sc) - xfer_cnt);
666 log_info = le32_to_cpu(pScsiReply->IOCLogInfo); 653 log_info = le32_to_cpu(pScsiReply->IOCLogInfo);
667 654
668 /* 655 /*
@@ -767,7 +754,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
767 break; 754 break;
768 755
769 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */ 756 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
770 sc->resid = sc->request_bufflen - xfer_cnt; 757 scsi_set_resid(sc, scsi_bufflen(sc) - xfer_cnt);
771 if((xfer_cnt==0)||(sc->underflow > xfer_cnt)) 758 if((xfer_cnt==0)||(sc->underflow > xfer_cnt))
772 sc->result=DID_SOFT_ERROR << 16; 759 sc->result=DID_SOFT_ERROR << 16;
773 else /* Sufficient data transfer occurred */ 760 else /* Sufficient data transfer occurred */
@@ -816,7 +803,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
816 break; 803 break;
817 804
818 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */ 805 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
819 sc->resid=0; 806 scsi_set_resid(sc, 0);
820 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ 807 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
821 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */ 808 case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */
822 sc->result = (DID_OK << 16) | scsi_status; 809 sc->result = (DID_OK << 16) | scsi_status;
@@ -899,23 +886,18 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
899 scsi_state, scsi_status, log_info)); 886 scsi_state, scsi_status, log_info));
900 887
901 dreplyprintk(("%s: [%d:%d:%d:%d] resid=%d " 888 dreplyprintk(("%s: [%d:%d:%d:%d] resid=%d "
902 "bufflen=%d xfer_cnt=%d\n", __FUNCTION__, 889 "bufflen=%d xfer_cnt=%d\n", __FUNCTION__,
903 sc->device->host->host_no, sc->device->channel, sc->device->id, 890 sc->device->host->host_no,
904 sc->device->lun, sc->resid, sc->request_bufflen, 891 sc->device->channel, sc->device->id,
905 xfer_cnt)); 892 sc->device->lun, scsi_get_resid(sc),
893 scsi_bufflen(sc), xfer_cnt));
906 } 894 }
907#endif 895#endif
908 896
909 } /* end of address reply case */ 897 } /* end of address reply case */
910 898
911 /* Unmap the DMA buffers, if any. */ 899 /* Unmap the DMA buffers, if any. */
912 if (sc->use_sg) { 900 scsi_dma_unmap(sc);
913 pci_unmap_sg(ioc->pcidev, (struct scatterlist *) sc->request_buffer,
914 sc->use_sg, sc->sc_data_direction);
915 } else if (sc->request_bufflen) {
916 pci_unmap_single(ioc->pcidev, sc->SCp.dma_handle,
917 sc->request_bufflen, sc->sc_data_direction);
918 }
919 901
920 sc->scsi_done(sc); /* Issue the command callback */ 902 sc->scsi_done(sc); /* Issue the command callback */
921 903
@@ -970,17 +952,8 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
970 /* Set status, free OS resources (SG DMA buffers) 952 /* Set status, free OS resources (SG DMA buffers)
971 * Do OS callback 953 * Do OS callback
972 */ 954 */
973 if (SCpnt->use_sg) { 955 scsi_dma_unmap(SCpnt);
974 pci_unmap_sg(ioc->pcidev, 956
975 (struct scatterlist *) SCpnt->request_buffer,
976 SCpnt->use_sg,
977 SCpnt->sc_data_direction);
978 } else if (SCpnt->request_bufflen) {
979 pci_unmap_single(ioc->pcidev,
980 SCpnt->SCp.dma_handle,
981 SCpnt->request_bufflen,
982 SCpnt->sc_data_direction);
983 }
984 SCpnt->result = DID_RESET << 16; 957 SCpnt->result = DID_RESET << 16;
985 SCpnt->host_scribble = NULL; 958 SCpnt->host_scribble = NULL;
986 959
@@ -1023,14 +996,19 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
1023 mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(hd->ioc, ii); 996 mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(hd->ioc, ii);
1024 if (mf == NULL) 997 if (mf == NULL)
1025 continue; 998 continue;
999 /* If the device is a hidden raid component, then its
1000 * expected that the mf->function will be RAID_SCSI_IO
1001 */
1002 if (vdevice->vtarget->tflags &
1003 MPT_TARGET_FLAGS_RAID_COMPONENT && mf->Function !=
1004 MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)
1005 continue;
1006
1026 int_to_scsilun(vdevice->lun, &lun); 1007 int_to_scsilun(vdevice->lun, &lun);
1027 if ((mf->Bus != vdevice->vtarget->channel) || 1008 if ((mf->Bus != vdevice->vtarget->channel) ||
1028 (mf->TargetID != vdevice->vtarget->id) || 1009 (mf->TargetID != vdevice->vtarget->id) ||
1029 memcmp(lun.scsi_lun, mf->LUN, 8)) 1010 memcmp(lun.scsi_lun, mf->LUN, 8))
1030 continue; 1011 continue;
1031 dsprintk(( "search_running: found (sc=%p, mf = %p) "
1032 "channel %d id %d, lun %d \n", hd->ScsiLookup[ii],
1033 mf, mf->Bus, mf->TargetID, vdevice->lun));
1034 1012
1035 /* Cleanup 1013 /* Cleanup
1036 */ 1014 */
@@ -1039,19 +1017,12 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
1039 mpt_free_msg_frame(hd->ioc, (MPT_FRAME_HDR *)mf); 1017 mpt_free_msg_frame(hd->ioc, (MPT_FRAME_HDR *)mf);
1040 if ((unsigned char *)mf != sc->host_scribble) 1018 if ((unsigned char *)mf != sc->host_scribble)
1041 continue; 1019 continue;
1042 if (sc->use_sg) { 1020 scsi_dma_unmap(sc);
1043 pci_unmap_sg(hd->ioc->pcidev,
1044 (struct scatterlist *) sc->request_buffer,
1045 sc->use_sg,
1046 sc->sc_data_direction);
1047 } else if (sc->request_bufflen) {
1048 pci_unmap_single(hd->ioc->pcidev,
1049 sc->SCp.dma_handle,
1050 sc->request_bufflen,
1051 sc->sc_data_direction);
1052 }
1053 sc->host_scribble = NULL; 1021 sc->host_scribble = NULL;
1054 sc->result = DID_NO_CONNECT << 16; 1022 sc->result = DID_NO_CONNECT << 16;
1023 dsprintk(( "search_running: found (sc=%p, mf = %p) "
1024 "channel %d id %d, lun %d \n", sc, mf,
1025 vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun));
1055 sc->scsi_done(sc); 1026 sc->scsi_done(sc);
1056 } 1027 }
1057 } 1028 }
@@ -1380,10 +1351,10 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1380 * will be no data transfer! GRRRRR... 1351 * will be no data transfer! GRRRRR...
1381 */ 1352 */
1382 if (SCpnt->sc_data_direction == DMA_FROM_DEVICE) { 1353 if (SCpnt->sc_data_direction == DMA_FROM_DEVICE) {
1383 datalen = SCpnt->request_bufflen; 1354 datalen = scsi_bufflen(SCpnt);
1384 scsidir = MPI_SCSIIO_CONTROL_READ; /* DATA IN (host<--ioc<--dev) */ 1355 scsidir = MPI_SCSIIO_CONTROL_READ; /* DATA IN (host<--ioc<--dev) */
1385 } else if (SCpnt->sc_data_direction == DMA_TO_DEVICE) { 1356 } else if (SCpnt->sc_data_direction == DMA_TO_DEVICE) {
1386 datalen = SCpnt->request_bufflen; 1357 datalen = scsi_bufflen(SCpnt);
1387 scsidir = MPI_SCSIIO_CONTROL_WRITE; /* DATA OUT (host-->ioc-->dev) */ 1358 scsidir = MPI_SCSIIO_CONTROL_WRITE; /* DATA OUT (host-->ioc-->dev) */
1388 } else { 1359 } else {
1389 datalen = 0; 1360 datalen = 0;
@@ -1768,20 +1739,45 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1768 u32 ctx2abort; 1739 u32 ctx2abort;
1769 int scpnt_idx; 1740 int scpnt_idx;
1770 int retval; 1741 int retval;
1771 VirtDevice *vdev; 1742 VirtDevice *vdevice;
1772 ulong sn = SCpnt->serial_number; 1743 ulong sn = SCpnt->serial_number;
1744 MPT_ADAPTER *ioc;
1773 1745
1774 /* If we can't locate our host adapter structure, return FAILED status. 1746 /* If we can't locate our host adapter structure, return FAILED status.
1775 */ 1747 */
1776 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { 1748 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
1777 SCpnt->result = DID_RESET << 16; 1749 SCpnt->result = DID_RESET << 16;
1778 SCpnt->scsi_done(SCpnt); 1750 SCpnt->scsi_done(SCpnt);
1779 dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: " 1751 dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: Can't locate "
1780 "Can't locate host! (sc=%p)\n", 1752 "host! (sc=%p)\n", SCpnt));
1781 SCpnt));
1782 return FAILED; 1753 return FAILED;
1783 } 1754 }
1784 1755
1756 ioc = hd->ioc;
1757 printk(MYIOC_s_INFO_FMT "attempting task abort! (sc=%p)\n",
1758 ioc->name, SCpnt);
1759 scsi_print_command(SCpnt);
1760
1761 vdevice = SCpnt->device->hostdata;
1762 if (!vdevice || !vdevice->vtarget) {
1763 dtmprintk((MYIOC_s_DEBUG_FMT "task abort: device has been "
1764 "deleted (sc=%p)\n", ioc->name, SCpnt));
1765 SCpnt->result = DID_NO_CONNECT << 16;
1766 SCpnt->scsi_done(SCpnt);
1767 retval = 0;
1768 goto out;
1769 }
1770
1771 /* Task aborts are not supported for hidden raid components.
1772 */
1773 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
1774 dtmprintk((MYIOC_s_DEBUG_FMT "task abort: hidden raid "
1775 "component (sc=%p)\n", ioc->name, SCpnt));
1776 SCpnt->result = DID_RESET << 16;
1777 retval = FAILED;
1778 goto out;
1779 }
1780
1785 /* Find this command 1781 /* Find this command
1786 */ 1782 */
1787 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { 1783 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) {
@@ -1790,21 +1786,20 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1790 */ 1786 */
1791 SCpnt->result = DID_RESET << 16; 1787 SCpnt->result = DID_RESET << 16;
1792 dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: " 1788 dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: "
1793 "Command not in the active list! (sc=%p)\n", 1789 "Command not in the active list! (sc=%p)\n", ioc->name,
1794 hd->ioc->name, SCpnt)); 1790 SCpnt));
1795 return SUCCESS; 1791 retval = 0;
1792 goto out;
1796 } 1793 }
1797 1794
1798 if (hd->resetPending) 1795 if (hd->resetPending) {
1799 return FAILED; 1796 retval = FAILED;
1797 goto out;
1798 }
1800 1799
1801 if (hd->timeouts < -1) 1800 if (hd->timeouts < -1)
1802 hd->timeouts++; 1801 hd->timeouts++;
1803 1802
1804 printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n",
1805 hd->ioc->name, SCpnt);
1806 scsi_print_command(SCpnt);
1807
1808 /* Most important! Set TaskMsgContext to SCpnt's MsgContext! 1803 /* Most important! Set TaskMsgContext to SCpnt's MsgContext!
1809 * (the IO to be ABORT'd) 1804 * (the IO to be ABORT'd)
1810 * 1805 *
@@ -1817,18 +1812,17 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1817 1812
1818 hd->abortSCpnt = SCpnt; 1813 hd->abortSCpnt = SCpnt;
1819 1814
1820 vdev = SCpnt->device->hostdata;
1821 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1815 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
1822 vdev->vtarget->channel, vdev->vtarget->id, vdev->lun, 1816 vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun,
1823 ctx2abort, mptscsih_get_tm_timeout(hd->ioc)); 1817 ctx2abort, mptscsih_get_tm_timeout(ioc));
1824 1818
1825 if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx && 1819 if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx &&
1826 SCpnt->serial_number == sn) 1820 SCpnt->serial_number == sn)
1827 retval = FAILED; 1821 retval = FAILED;
1828 1822
1829 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1823 out:
1830 hd->ioc->name, 1824 printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
1831 ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1825 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1832 1826
1833 if (retval == 0) 1827 if (retval == 0)
1834 return SUCCESS; 1828 return SUCCESS;
@@ -1850,32 +1844,47 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1850{ 1844{
1851 MPT_SCSI_HOST *hd; 1845 MPT_SCSI_HOST *hd;
1852 int retval; 1846 int retval;
1853 VirtDevice *vdev; 1847 VirtDevice *vdevice;
1848 MPT_ADAPTER *ioc;
1854 1849
1855 /* If we can't locate our host adapter structure, return FAILED status. 1850 /* If we can't locate our host adapter structure, return FAILED status.
1856 */ 1851 */
1857 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1852 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1858 dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: " 1853 dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: Can't "
1859 "Can't locate host! (sc=%p)\n", 1854 "locate host! (sc=%p)\n", SCpnt));
1860 SCpnt));
1861 return FAILED; 1855 return FAILED;
1862 } 1856 }
1863 1857
1864 if (hd->resetPending) 1858 ioc = hd->ioc;
1865 return FAILED; 1859 printk(MYIOC_s_INFO_FMT "attempting target reset! (sc=%p)\n",
1866 1860 ioc->name, SCpnt);
1867 printk(KERN_WARNING MYNAM ": %s: attempting target reset! (sc=%p)\n",
1868 hd->ioc->name, SCpnt);
1869 scsi_print_command(SCpnt); 1861 scsi_print_command(SCpnt);
1870 1862
1871 vdev = SCpnt->device->hostdata; 1863 if (hd->resetPending) {
1864 retval = FAILED;
1865 goto out;
1866 }
1867
1868 vdevice = SCpnt->device->hostdata;
1869 if (!vdevice || !vdevice->vtarget) {
1870 retval = 0;
1871 goto out;
1872 }
1873
1874 /* Target reset to hidden raid component is not supported
1875 */
1876 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
1877 retval = FAILED;
1878 goto out;
1879 }
1880
1872 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1881 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
1873 vdev->vtarget->channel, vdev->vtarget->id, 1882 vdevice->vtarget->channel, vdevice->vtarget->id, 0, 0,
1874 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1883 mptscsih_get_tm_timeout(ioc));
1875 1884
1876 printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", 1885 out:
1877 hd->ioc->name, 1886 printk (MYIOC_s_INFO_FMT "target reset: %s (sc=%p)\n",
1878 ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1887 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1879 1888
1880 if (retval == 0) 1889 if (retval == 0)
1881 return SUCCESS; 1890 return SUCCESS;
@@ -1899,18 +1908,19 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1899 MPT_SCSI_HOST *hd; 1908 MPT_SCSI_HOST *hd;
1900 int retval; 1909 int retval;
1901 VirtDevice *vdev; 1910 VirtDevice *vdev;
1911 MPT_ADAPTER *ioc;
1902 1912
1903 /* If we can't locate our host adapter structure, return FAILED status. 1913 /* If we can't locate our host adapter structure, return FAILED status.
1904 */ 1914 */
1905 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1915 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1906 dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: " 1916 dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: Can't "
1907 "Can't locate host! (sc=%p)\n", 1917 "locate host! (sc=%p)\n", SCpnt ));
1908 SCpnt ) );
1909 return FAILED; 1918 return FAILED;
1910 } 1919 }
1911 1920
1912 printk(KERN_WARNING MYNAM ": %s: attempting bus reset! (sc=%p)\n", 1921 ioc = hd->ioc;
1913 hd->ioc->name, SCpnt); 1922 printk(MYIOC_s_INFO_FMT "attempting bus reset! (sc=%p)\n",
1923 ioc->name, SCpnt);
1914 scsi_print_command(SCpnt); 1924 scsi_print_command(SCpnt);
1915 1925
1916 if (hd->timeouts < -1) 1926 if (hd->timeouts < -1)
@@ -1918,11 +1928,10 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1918 1928
1919 vdev = SCpnt->device->hostdata; 1929 vdev = SCpnt->device->hostdata;
1920 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, 1930 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
1921 vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1931 vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(ioc));
1922 1932
1923 printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", 1933 printk(MYIOC_s_INFO_FMT "bus reset: %s (sc=%p)\n",
1924 hd->ioc->name, 1934 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1925 ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1926 1935
1927 if (retval == 0) 1936 if (retval == 0)
1928 return SUCCESS; 1937 return SUCCESS;
@@ -1943,37 +1952,38 @@ int
1943mptscsih_host_reset(struct scsi_cmnd *SCpnt) 1952mptscsih_host_reset(struct scsi_cmnd *SCpnt)
1944{ 1953{
1945 MPT_SCSI_HOST * hd; 1954 MPT_SCSI_HOST * hd;
1946 int status = SUCCESS; 1955 int retval;
1956 MPT_ADAPTER *ioc;
1947 1957
1948 /* If we can't locate the host to reset, then we failed. */ 1958 /* If we can't locate the host to reset, then we failed. */
1949 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1959 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1950 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " 1960 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: Can't "
1951 "Can't locate host! (sc=%p)\n", 1961 "locate host! (sc=%p)\n", SCpnt));
1952 SCpnt ) );
1953 return FAILED; 1962 return FAILED;
1954 } 1963 }
1955 1964
1956 printk(KERN_WARNING MYNAM ": %s: Attempting host reset! (sc=%p)\n", 1965 ioc = hd->ioc;
1957 hd->ioc->name, SCpnt); 1966 printk(MYIOC_s_INFO_FMT "attempting host reset! (sc=%p)\n",
1967 ioc->name, SCpnt);
1958 1968
1959 /* If our attempts to reset the host failed, then return a failed 1969 /* If our attempts to reset the host failed, then return a failed
1960 * status. The host will be taken off line by the SCSI mid-layer. 1970 * status. The host will be taken off line by the SCSI mid-layer.
1961 */ 1971 */
1962 if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){ 1972 if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) {
1963 status = FAILED; 1973 retval = FAILED;
1964 } else { 1974 } else {
1965 /* Make sure TM pending is cleared and TM state is set to 1975 /* Make sure TM pending is cleared and TM state is set to
1966 * NONE. 1976 * NONE.
1967 */ 1977 */
1978 retval = 0;
1968 hd->tmPending = 0; 1979 hd->tmPending = 0;
1969 hd->tmState = TM_STATE_NONE; 1980 hd->tmState = TM_STATE_NONE;
1970 } 1981 }
1971 1982
1972 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " 1983 printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n",
1973 "Status = %s\n", 1984 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1974 (status == SUCCESS) ? "SUCCESS" : "FAILED" ) );
1975 1985
1976 return status; 1986 return retval;
1977} 1987}
1978 1988
1979/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1989/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -3150,6 +3160,16 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
3150{ 3160{
3151 INTERNAL_CMD iocmd; 3161 INTERNAL_CMD iocmd;
3152 3162
3163 /* Ignore hidden raid components, this is handled when the command
3164 * is sent to the volume
3165 */
3166 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT)
3167 return;
3168
3169 if (vdevice->vtarget->type != TYPE_DISK || vdevice->vtarget->deleted ||
3170 !vdevice->configured_lun)
3171 return;
3172
3153 /* Following parameters will not change 3173 /* Following parameters will not change
3154 * in this routine. 3174 * in this routine.
3155 */ 3175 */
@@ -3164,9 +3184,7 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
3164 iocmd.id = vdevice->vtarget->id; 3184 iocmd.id = vdevice->vtarget->id;
3165 iocmd.lun = vdevice->lun; 3185 iocmd.lun = vdevice->lun;
3166 3186
3167 if ((vdevice->vtarget->type == TYPE_DISK) && 3187 mptscsih_do_cmd(hd, &iocmd);
3168 (vdevice->configured_lun))
3169 mptscsih_do_cmd(hd, &iocmd);
3170} 3188}
3171 3189
3172EXPORT_SYMBOL(mptscsih_remove); 3190EXPORT_SYMBOL(mptscsih_remove);