diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2007-06-17 14:32:27 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-19 22:52:18 -0400 |
commit | 4a904a65fab83bcdd6b00470ac6c4aa80518e6a9 (patch) | |
tree | 16ebdbe481fc16bd495882ef8f5ff23db2ec6b05 /drivers/scsi/tmscsim.c | |
parent | 462b7859a07c9c2b060fa2b5b1d49f8b33706d4e (diff) |
[SCSI] tmscsim: clean-up status codes
Remove redundant defines from the header, replace all occurances in the
code with standard SAM_STAT_ macros. Also fix what seems to be a typo in
testing for (status == H_OVER_UNDER_RUN)...
Signed-off-by: G. Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/tmscsim.c')
-rw-r--r-- | drivers/scsi/tmscsim.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 73c5ca082e65..e8260f2dba0f 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -1564,7 +1564,8 @@ dc390_Disconnect( struct dc390_acb* pACB ) | |||
1564 | if( (pSRB->SRBState & (SRB_START_+SRB_MSGOUT)) || | 1564 | if( (pSRB->SRBState & (SRB_START_+SRB_MSGOUT)) || |
1565 | !(pSRB->SRBState & (SRB_DISCONNECT+SRB_COMPLETED)) ) | 1565 | !(pSRB->SRBState & (SRB_DISCONNECT+SRB_COMPLETED)) ) |
1566 | { /* Selection time out */ | 1566 | { /* Selection time out */ |
1567 | pSRB->TargetStatus = SCSI_STAT_SEL_TIMEOUT; | 1567 | pSRB->AdaptStatus = H_SEL_TIMEOUT; |
1568 | pSRB->TargetStatus = 0; | ||
1568 | goto disc1; | 1569 | goto disc1; |
1569 | } | 1570 | } |
1570 | else if (!(pSRB->SRBState & SRB_DISCONNECT) && (pSRB->SRBState & SRB_COMPLETED)) | 1571 | else if (!(pSRB->SRBState & SRB_DISCONNECT) && (pSRB->SRBState & SRB_COMPLETED)) |
@@ -1713,17 +1714,17 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* | |||
1713 | { /* Last command was a Request Sense */ | 1714 | { /* Last command was a Request Sense */ |
1714 | pSRB->SRBFlag &= ~AUTO_REQSENSE; | 1715 | pSRB->SRBFlag &= ~AUTO_REQSENSE; |
1715 | pSRB->AdaptStatus = 0; | 1716 | pSRB->AdaptStatus = 0; |
1716 | pSRB->TargetStatus = CHECK_CONDITION << 1; | 1717 | pSRB->TargetStatus = SAM_STAT_CHECK_CONDITION; |
1717 | 1718 | ||
1718 | //pcmd->result = MK_RES(DRIVER_SENSE,DID_OK,0,status); | 1719 | //pcmd->result = MK_RES(DRIVER_SENSE,DID_OK,0,status); |
1719 | if (status == (CHECK_CONDITION << 1)) | 1720 | if (status == SAM_STAT_CHECK_CONDITION) |
1720 | pcmd->result = MK_RES_LNX(0, DID_BAD_TARGET, 0, /*CHECK_CONDITION*/0); | 1721 | pcmd->result = MK_RES_LNX(0, DID_BAD_TARGET, 0, /*CHECK_CONDITION*/0); |
1721 | else /* Retry */ | 1722 | else /* Retry */ |
1722 | { | 1723 | { |
1723 | if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */) | 1724 | if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */) |
1724 | { | 1725 | { |
1725 | /* Don't retry on TEST_UNIT_READY */ | 1726 | /* Don't retry on TEST_UNIT_READY */ |
1726 | pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION); | 1727 | pcmd->result = MK_RES_LNX(DRIVER_SENSE, DID_OK, 0, SAM_STAT_CHECK_CONDITION); |
1727 | REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n",pSRB->pcmd->cmnd[0],\ | 1728 | REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n",pSRB->pcmd->cmnd[0],\ |
1728 | (u32) pcmd->result, (u32) pSRB->TotalXferredLen)); | 1729 | (u32) pcmd->result, (u32) pSRB->TotalXferredLen)); |
1729 | } else { | 1730 | } else { |
@@ -1739,7 +1740,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* | |||
1739 | } | 1740 | } |
1740 | if( status ) | 1741 | if( status ) |
1741 | { | 1742 | { |
1742 | if( status_byte(status) == CHECK_CONDITION ) | 1743 | if (status == SAM_STAT_CHECK_CONDITION) |
1743 | { | 1744 | { |
1744 | if (dc390_RequestSense(pACB, pDCB, pSRB)) { | 1745 | if (dc390_RequestSense(pACB, pDCB, pSRB)) { |
1745 | SET_RES_DID(pcmd->result, DID_ERROR); | 1746 | SET_RES_DID(pcmd->result, DID_ERROR); |
@@ -1747,7 +1748,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* | |||
1747 | } | 1748 | } |
1748 | return; | 1749 | return; |
1749 | } | 1750 | } |
1750 | else if( status_byte(status) == QUEUE_FULL ) | 1751 | else if (status == SAM_STAT_TASK_SET_FULL) |
1751 | { | 1752 | { |
1752 | scsi_track_queue_full(pcmd->device, pDCB->GoingSRBCnt - 1); | 1753 | scsi_track_queue_full(pcmd->device, pDCB->GoingSRBCnt - 1); |
1753 | scsi_sg_count(pcmd) = pSRB->SavedSGCount; | 1754 | scsi_sg_count(pcmd) = pSRB->SavedSGCount; |
@@ -1755,14 +1756,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* | |||
1755 | pSRB->TotalXferredLen = 0; | 1756 | pSRB->TotalXferredLen = 0; |
1756 | SET_RES_DID(pcmd->result, DID_SOFT_ERROR); | 1757 | SET_RES_DID(pcmd->result, DID_SOFT_ERROR); |
1757 | } | 1758 | } |
1758 | else if(status == SCSI_STAT_SEL_TIMEOUT) | 1759 | else if (status == SAM_STAT_BUSY && |
1759 | { | ||
1760 | pSRB->AdaptStatus = H_SEL_TIMEOUT; | ||
1761 | pSRB->TargetStatus = 0; | ||
1762 | pcmd->result = MK_RES(0,DID_NO_CONNECT,0,0); | ||
1763 | /* Devices are removed below ... */ | ||
1764 | } | ||
1765 | else if (status_byte(status) == BUSY && | ||
1766 | (pcmd->cmnd[0] == TEST_UNIT_READY || pcmd->cmnd[0] == INQUIRY) && | 1760 | (pcmd->cmnd[0] == TEST_UNIT_READY || pcmd->cmnd[0] == INQUIRY) && |
1767 | pACB->scan_devices) | 1761 | pACB->scan_devices) |
1768 | { | 1762 | { |
@@ -1780,12 +1774,17 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* | |||
1780 | else | 1774 | else |
1781 | { /* Target status == 0 */ | 1775 | { /* Target status == 0 */ |
1782 | status = pSRB->AdaptStatus; | 1776 | status = pSRB->AdaptStatus; |
1783 | if(status & H_OVER_UNDER_RUN) | 1777 | if (status == H_OVER_UNDER_RUN) |
1784 | { | 1778 | { |
1785 | pSRB->TargetStatus = 0; | 1779 | pSRB->TargetStatus = 0; |
1786 | SET_RES_DID(pcmd->result,DID_OK); | 1780 | SET_RES_DID(pcmd->result,DID_OK); |
1787 | SET_RES_MSG(pcmd->result,pSRB->EndMessage); | 1781 | SET_RES_MSG(pcmd->result,pSRB->EndMessage); |
1788 | } | 1782 | } |
1783 | else if (status == H_SEL_TIMEOUT) | ||
1784 | { | ||
1785 | pcmd->result = MK_RES(0, DID_NO_CONNECT, 0, 0); | ||
1786 | /* Devices are removed below ... */ | ||
1787 | } | ||
1789 | else if( pSRB->SRBStatus & PARITY_ERROR) | 1788 | else if( pSRB->SRBStatus & PARITY_ERROR) |
1790 | { | 1789 | { |
1791 | //pcmd->result = MK_RES(0,DID_PARITY,pSRB->EndMessage,0); | 1790 | //pcmd->result = MK_RES(0,DID_PARITY,pSRB->EndMessage,0); |