aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2007-06-15 19:24:14 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-17 17:10:53 -0400
commit958d4a32077f1d7d863e67f40f81c577c3c0c037 (patch)
treeb32ab7b4a81c3e8b9af477cc746d7aeaeee4a8fa
parent4023c4747861e8c56f46e5fa50bd4feb63fc91fc (diff)
[SCSI] mpt fusion: cleanup eh handlers
nice cosmetic cleaning of eh thread callback funtions Signed-off-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/message/fusion/mptscsih.c132
1 files changed, 77 insertions, 55 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index d1538eb6a53a..f0456d26a4af 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1727,20 +1727,35 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1727 u32 ctx2abort; 1727 u32 ctx2abort;
1728 int scpnt_idx; 1728 int scpnt_idx;
1729 int retval; 1729 int retval;
1730 VirtDevice *vdev; 1730 VirtDevice *vdevice;
1731 ulong sn = SCpnt->serial_number; 1731 ulong sn = SCpnt->serial_number;
1732 MPT_ADAPTER *ioc;
1732 1733
1733 /* If we can't locate our host adapter structure, return FAILED status. 1734 /* If we can't locate our host adapter structure, return FAILED status.
1734 */ 1735 */
1735 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { 1736 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
1736 SCpnt->result = DID_RESET << 16; 1737 SCpnt->result = DID_RESET << 16;
1737 SCpnt->scsi_done(SCpnt); 1738 SCpnt->scsi_done(SCpnt);
1738 dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: " 1739 dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: Can't locate "
1739 "Can't locate host! (sc=%p)\n", 1740 "host! (sc=%p)\n", SCpnt));
1740 SCpnt));
1741 return FAILED; 1741 return FAILED;
1742 } 1742 }
1743 1743
1744 ioc = hd->ioc;
1745 printk(MYIOC_s_INFO_FMT "attempting task abort! (sc=%p)\n",
1746 ioc->name, SCpnt);
1747 scsi_print_command(SCpnt);
1748
1749 vdevice = SCpnt->device->hostdata;
1750 if (!vdevice || !vdevice->vtarget) {
1751 dtmprintk((MYIOC_s_DEBUG_FMT "task abort: device has been "
1752 "deleted (sc=%p)\n", ioc->name, SCpnt));
1753 SCpnt->result = DID_NO_CONNECT << 16;
1754 SCpnt->scsi_done(SCpnt);
1755 retval = 0;
1756 goto out;
1757 }
1758
1744 /* Find this command 1759 /* Find this command
1745 */ 1760 */
1746 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { 1761 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) {
@@ -1749,21 +1764,20 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1749 */ 1764 */
1750 SCpnt->result = DID_RESET << 16; 1765 SCpnt->result = DID_RESET << 16;
1751 dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: " 1766 dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: "
1752 "Command not in the active list! (sc=%p)\n", 1767 "Command not in the active list! (sc=%p)\n", ioc->name,
1753 hd->ioc->name, SCpnt)); 1768 SCpnt));
1754 return SUCCESS; 1769 retval = 0;
1770 goto out;
1755 } 1771 }
1756 1772
1757 if (hd->resetPending) 1773 if (hd->resetPending) {
1758 return FAILED; 1774 retval = FAILED;
1775 goto out;
1776 }
1759 1777
1760 if (hd->timeouts < -1) 1778 if (hd->timeouts < -1)
1761 hd->timeouts++; 1779 hd->timeouts++;
1762 1780
1763 printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n",
1764 hd->ioc->name, SCpnt);
1765 scsi_print_command(SCpnt);
1766
1767 /* Most important! Set TaskMsgContext to SCpnt's MsgContext! 1781 /* Most important! Set TaskMsgContext to SCpnt's MsgContext!
1768 * (the IO to be ABORT'd) 1782 * (the IO to be ABORT'd)
1769 * 1783 *
@@ -1776,18 +1790,17 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1776 1790
1777 hd->abortSCpnt = SCpnt; 1791 hd->abortSCpnt = SCpnt;
1778 1792
1779 vdev = SCpnt->device->hostdata;
1780 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1793 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
1781 vdev->vtarget->channel, vdev->vtarget->id, vdev->lun, 1794 vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun,
1782 ctx2abort, mptscsih_get_tm_timeout(hd->ioc)); 1795 ctx2abort, mptscsih_get_tm_timeout(ioc));
1783 1796
1784 if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx && 1797 if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx &&
1785 SCpnt->serial_number == sn) 1798 SCpnt->serial_number == sn)
1786 retval = FAILED; 1799 retval = FAILED;
1787 1800
1788 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1801 out:
1789 hd->ioc->name, 1802 printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
1790 ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1803 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1791 1804
1792 if (retval == 0) 1805 if (retval == 0)
1793 return SUCCESS; 1806 return SUCCESS;
@@ -1809,32 +1822,40 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1809{ 1822{
1810 MPT_SCSI_HOST *hd; 1823 MPT_SCSI_HOST *hd;
1811 int retval; 1824 int retval;
1812 VirtDevice *vdev; 1825 VirtDevice *vdevice;
1826 MPT_ADAPTER *ioc;
1813 1827
1814 /* If we can't locate our host adapter structure, return FAILED status. 1828 /* If we can't locate our host adapter structure, return FAILED status.
1815 */ 1829 */
1816 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1830 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1817 dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: " 1831 dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: Can't "
1818 "Can't locate host! (sc=%p)\n", 1832 "locate host! (sc=%p)\n", SCpnt));
1819 SCpnt));
1820 return FAILED; 1833 return FAILED;
1821 } 1834 }
1822 1835
1823 if (hd->resetPending) 1836 ioc = hd->ioc;
1824 return FAILED; 1837 printk(MYIOC_s_INFO_FMT "attempting target reset! (sc=%p)\n",
1825 1838 ioc->name, SCpnt);
1826 printk(KERN_WARNING MYNAM ": %s: attempting target reset! (sc=%p)\n",
1827 hd->ioc->name, SCpnt);
1828 scsi_print_command(SCpnt); 1839 scsi_print_command(SCpnt);
1829 1840
1830 vdev = SCpnt->device->hostdata; 1841 if (hd->resetPending) {
1842 retval = FAILED;
1843 goto out;
1844 }
1845
1846 vdevice = SCpnt->device->hostdata;
1847 if (!vdevice || !vdevice->vtarget) {
1848 retval = 0;
1849 goto out;
1850 }
1851
1831 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1852 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
1832 vdev->vtarget->channel, vdev->vtarget->id, 1853 vdevice->vtarget->channel, vdevice->vtarget->id, 0, 0,
1833 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1854 mptscsih_get_tm_timeout(ioc));
1834 1855
1835 printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", 1856 out:
1836 hd->ioc->name, 1857 printk (MYIOC_s_INFO_FMT "target reset: %s (sc=%p)\n",
1837 ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1858 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1838 1859
1839 if (retval == 0) 1860 if (retval == 0)
1840 return SUCCESS; 1861 return SUCCESS;
@@ -1858,18 +1879,19 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1858 MPT_SCSI_HOST *hd; 1879 MPT_SCSI_HOST *hd;
1859 int retval; 1880 int retval;
1860 VirtDevice *vdev; 1881 VirtDevice *vdev;
1882 MPT_ADAPTER *ioc;
1861 1883
1862 /* If we can't locate our host adapter structure, return FAILED status. 1884 /* If we can't locate our host adapter structure, return FAILED status.
1863 */ 1885 */
1864 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1886 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1865 dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: " 1887 dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: Can't "
1866 "Can't locate host! (sc=%p)\n", 1888 "locate host! (sc=%p)\n", SCpnt ));
1867 SCpnt ) );
1868 return FAILED; 1889 return FAILED;
1869 } 1890 }
1870 1891
1871 printk(KERN_WARNING MYNAM ": %s: attempting bus reset! (sc=%p)\n", 1892 ioc = hd->ioc;
1872 hd->ioc->name, SCpnt); 1893 printk(MYIOC_s_INFO_FMT "attempting bus reset! (sc=%p)\n",
1894 ioc->name, SCpnt);
1873 scsi_print_command(SCpnt); 1895 scsi_print_command(SCpnt);
1874 1896
1875 if (hd->timeouts < -1) 1897 if (hd->timeouts < -1)
@@ -1877,11 +1899,10 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1877 1899
1878 vdev = SCpnt->device->hostdata; 1900 vdev = SCpnt->device->hostdata;
1879 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, 1901 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
1880 vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1902 vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(ioc));
1881 1903
1882 printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", 1904 printk(MYIOC_s_INFO_FMT "bus reset: %s (sc=%p)\n",
1883 hd->ioc->name, 1905 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1884 ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1885 1906
1886 if (retval == 0) 1907 if (retval == 0)
1887 return SUCCESS; 1908 return SUCCESS;
@@ -1902,37 +1923,38 @@ int
1902mptscsih_host_reset(struct scsi_cmnd *SCpnt) 1923mptscsih_host_reset(struct scsi_cmnd *SCpnt)
1903{ 1924{
1904 MPT_SCSI_HOST * hd; 1925 MPT_SCSI_HOST * hd;
1905 int status = SUCCESS; 1926 int retval;
1927 MPT_ADAPTER *ioc;
1906 1928
1907 /* If we can't locate the host to reset, then we failed. */ 1929 /* If we can't locate the host to reset, then we failed. */
1908 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1930 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1909 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " 1931 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: Can't "
1910 "Can't locate host! (sc=%p)\n", 1932 "locate host! (sc=%p)\n", SCpnt));
1911 SCpnt ) );
1912 return FAILED; 1933 return FAILED;
1913 } 1934 }
1914 1935
1915 printk(KERN_WARNING MYNAM ": %s: Attempting host reset! (sc=%p)\n", 1936 ioc = hd->ioc;
1916 hd->ioc->name, SCpnt); 1937 printk(MYIOC_s_INFO_FMT "attempting host reset! (sc=%p)\n",
1938 ioc->name, SCpnt);
1917 1939
1918 /* If our attempts to reset the host failed, then return a failed 1940 /* If our attempts to reset the host failed, then return a failed
1919 * status. The host will be taken off line by the SCSI mid-layer. 1941 * status. The host will be taken off line by the SCSI mid-layer.
1920 */ 1942 */
1921 if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){ 1943 if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) {
1922 status = FAILED; 1944 retval = FAILED;
1923 } else { 1945 } else {
1924 /* Make sure TM pending is cleared and TM state is set to 1946 /* Make sure TM pending is cleared and TM state is set to
1925 * NONE. 1947 * NONE.
1926 */ 1948 */
1949 retval = 0;
1927 hd->tmPending = 0; 1950 hd->tmPending = 0;
1928 hd->tmState = TM_STATE_NONE; 1951 hd->tmState = TM_STATE_NONE;
1929 } 1952 }
1930 1953
1931 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " 1954 printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n",
1932 "Status = %s\n", 1955 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1933 (status == SUCCESS) ? "SUCCESS" : "FAILED" ) );
1934 1956
1935 return status; 1957 return retval;
1936} 1958}
1937 1959
1938/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1960/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/