aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/a100u2w.c50
1 files changed, 17 insertions, 33 deletions
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 7f4241bfb9c4..7cedc722fad9 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -796,7 +796,7 @@ static void orc_interrupt(
796*****************************************************************************/ 796*****************************************************************************/
797static void inia100BuildSCB(ORC_HCS * pHCB, ORC_SCB * pSCB, struct scsi_cmnd * SCpnt) 797static void inia100BuildSCB(ORC_HCS * pHCB, ORC_SCB * pSCB, struct scsi_cmnd * SCpnt)
798{ /* Create corresponding SCB */ 798{ /* Create corresponding SCB */
799 struct scatterlist *pSrbSG; 799 struct scatterlist *sg;
800 ORC_SG *pSG; /* Pointer to SG list */ 800 ORC_SG *pSG; /* Pointer to SG list */
801 int i, count_sg; 801 int i, count_sg;
802 ESCB *pEScb; 802 ESCB *pEScb;
@@ -813,30 +813,22 @@ static void inia100BuildSCB(ORC_HCS * pHCB, ORC_SCB * pSCB, struct scsi_cmnd * S
813 pSCB->SCB_Reserved1 = 0; 813 pSCB->SCB_Reserved1 = 0;
814 pSCB->SCB_SGLen = 0; 814 pSCB->SCB_SGLen = 0;
815 815
816 if ((pSCB->SCB_XferLen = (U32) SCpnt->request_bufflen)) { 816 pSCB->SCB_XferLen = (U32) scsi_bufflen(SCpnt);
817 pSG = (ORC_SG *) & pEScb->ESCB_SGList[0]; 817 pSG = (ORC_SG *) & pEScb->ESCB_SGList[0];
818 if (SCpnt->use_sg) { 818
819 pSrbSG = (struct scatterlist *) SCpnt->request_buffer; 819 count_sg = scsi_dma_map(SCpnt);
820 count_sg = pci_map_sg(pHCB->pdev, pSrbSG, SCpnt->use_sg, 820 BUG_ON(count_sg < 0);
821 SCpnt->sc_data_direction); 821 if (count_sg) {
822 pSCB->SCB_SGLen = (U32) (count_sg * 8); 822 pSCB->SCB_SGLen = (U32) (count_sg * 8);
823 for (i = 0; i < count_sg; i++, pSG++, pSrbSG++) { 823 scsi_for_each_sg(SCpnt, sg, count_sg, i) {
824 pSG->SG_Ptr = (U32) sg_dma_address(pSrbSG); 824 pSG->SG_Ptr = (U32) sg_dma_address(sg);
825 pSG->SG_Len = (U32) sg_dma_len(pSrbSG); 825 pSG->SG_Len = (U32) sg_dma_len(sg);
826 } 826 pSG++;
827 } else if (SCpnt->request_bufflen != 0) {/* Non SG */
828 pSCB->SCB_SGLen = 0x8;
829 SCpnt->SCp.dma_handle = pci_map_single(pHCB->pdev,
830 SCpnt->request_buffer,
831 SCpnt->request_bufflen,
832 SCpnt->sc_data_direction);
833 pSG->SG_Ptr = (U32) SCpnt->SCp.dma_handle;
834 pSG->SG_Len = (U32) SCpnt->request_bufflen;
835 } else {
836 pSCB->SCB_SGLen = 0;
837 pSG->SG_Ptr = 0;
838 pSG->SG_Len = 0;
839 } 827 }
828 } else {
829 pSCB->SCB_SGLen = 0;
830 pSG->SG_Ptr = 0;
831 pSG->SG_Len = 0;
840 } 832 }
841 pSCB->SCB_SGPAddr = (U32) pSCB->SCB_SensePAddr; 833 pSCB->SCB_SGPAddr = (U32) pSCB->SCB_SensePAddr;
842 pSCB->SCB_HaStat = 0; 834 pSCB->SCB_HaStat = 0;
@@ -995,15 +987,7 @@ static void inia100SCBPost(BYTE * pHcb, BYTE * pScb)
995 } 987 }
996 pSRB->result = pSCB->SCB_TaStat | (pSCB->SCB_HaStat << 16); 988 pSRB->result = pSCB->SCB_TaStat | (pSCB->SCB_HaStat << 16);
997 989
998 if (pSRB->use_sg) { 990 scsi_dma_unmap(pSRB);
999 pci_unmap_sg(pHCB->pdev,
1000 (struct scatterlist *)pSRB->request_buffer,
1001 pSRB->use_sg, pSRB->sc_data_direction);
1002 } else if (pSRB->request_bufflen != 0) {
1003 pci_unmap_single(pHCB->pdev, pSRB->SCp.dma_handle,
1004 pSRB->request_bufflen,
1005 pSRB->sc_data_direction);
1006 }
1007 991
1008 pSRB->scsi_done(pSRB); /* Notify system DONE */ 992 pSRB->scsi_done(pSRB); /* Notify system DONE */
1009 993