diff options
Diffstat (limited to 'drivers/scsi/tmscsim.c')
-rw-r--r-- | drivers/scsi/tmscsim.c | 225 |
1 files changed, 77 insertions, 148 deletions
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 3158949ffa62..e7b85e832eb5 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -351,6 +351,27 @@ static u8 dc390_clock_speed[] = {100,80,67,57,50, 40, 31, 20}; | |||
351 | * (DCBs, SRBs, Queueing) | 351 | * (DCBs, SRBs, Queueing) |
352 | * | 352 | * |
353 | **********************************************************************/ | 353 | **********************************************************************/ |
354 | static void inline dc390_start_segment(struct dc390_srb* pSRB) | ||
355 | { | ||
356 | struct scatterlist *psgl = pSRB->pSegmentList; | ||
357 | |||
358 | /* start new sg segment */ | ||
359 | pSRB->SGBusAddr = sg_dma_address(psgl); | ||
360 | pSRB->SGToBeXferLen = sg_dma_len(psgl); | ||
361 | } | ||
362 | |||
363 | static unsigned long inline dc390_advance_segment(struct dc390_srb* pSRB, u32 residue) | ||
364 | { | ||
365 | unsigned long xfer = pSRB->SGToBeXferLen - residue; | ||
366 | |||
367 | /* xfer more bytes transferred */ | ||
368 | pSRB->SGBusAddr += xfer; | ||
369 | pSRB->TotalXferredLen += xfer; | ||
370 | pSRB->SGToBeXferLen = residue; | ||
371 | |||
372 | return xfer; | ||
373 | } | ||
374 | |||
354 | static struct dc390_dcb __inline__ *dc390_findDCB ( struct dc390_acb* pACB, u8 id, u8 lun) | 375 | static struct dc390_dcb __inline__ *dc390_findDCB ( struct dc390_acb* pACB, u8 id, u8 lun) |
355 | { | 376 | { |
356 | struct dc390_dcb* pDCB = pACB->pLinkDCB; if (!pDCB) return NULL; | 377 | struct dc390_dcb* pDCB = pACB->pLinkDCB; if (!pDCB) return NULL; |
@@ -625,70 +646,6 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr | |||
625 | return 0; | 646 | return 0; |
626 | } | 647 | } |
627 | 648 | ||
628 | //#define DMA_INT EN_DMA_INT /*| EN_PAGE_INT*/ | ||
629 | #define DMA_INT 0 | ||
630 | |||
631 | #if DMA_INT | ||
632 | /* This is similar to AM53C974.c ... */ | ||
633 | static u8 | ||
634 | dc390_dma_intr (struct dc390_acb* pACB) | ||
635 | { | ||
636 | struct dc390_srb* pSRB; | ||
637 | u8 dstate; | ||
638 | DEBUG0(u16 pstate; struct pci_dev *pdev = pACB->pdev); | ||
639 | |||
640 | DEBUG0(pci_read_config_word(pdev, PCI_STATUS, &pstate)); | ||
641 | DEBUG0(if (pstate & (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY))\ | ||
642 | { printk(KERN_WARNING "DC390: PCI state = %04x!\n", pstate); \ | ||
643 | pci_write_config_word(pdev, PCI_STATUS, (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY));}); | ||
644 | |||
645 | dstate = DC390_read8 (DMA_Status); | ||
646 | |||
647 | if (! pACB->pActiveDCB || ! pACB->pActiveDCB->pActiveSRB) return dstate; | ||
648 | else pSRB = pACB->pActiveDCB->pActiveSRB; | ||
649 | |||
650 | if (dstate & (DMA_XFER_ABORT | DMA_XFER_ERROR | POWER_DOWN | PCI_MS_ABORT)) | ||
651 | { | ||
652 | printk (KERN_ERR "DC390: DMA error (%02x)!\n", dstate); | ||
653 | return dstate; | ||
654 | } | ||
655 | if (dstate & DMA_XFER_DONE) | ||
656 | { | ||
657 | u32 residual, xferCnt; int ctr = 6000000; | ||
658 | if (! (DC390_read8 (DMA_Cmd) & READ_DIRECTION)) | ||
659 | { | ||
660 | do | ||
661 | { | ||
662 | DEBUG1(printk (KERN_DEBUG "DC390: read residual bytes ... \n")); | ||
663 | dstate = DC390_read8 (DMA_Status); | ||
664 | residual = DC390_read8 (CtcReg_Low) | DC390_read8 (CtcReg_Mid) << 8 | | ||
665 | DC390_read8 (CtcReg_High) << 16; | ||
666 | residual += DC390_read8 (Current_Fifo) & 0x1f; | ||
667 | } while (residual && ! (dstate & SCSI_INTERRUPT) && --ctr); | ||
668 | if (!ctr) printk (KERN_CRIT "DC390: dma_intr: DMA aborted unfinished: %06x bytes remain!!\n", DC390_read32 (DMA_Wk_ByteCntr)); | ||
669 | /* residual = ... */ | ||
670 | } | ||
671 | else | ||
672 | residual = 0; | ||
673 | |||
674 | /* ??? */ | ||
675 | |||
676 | xferCnt = pSRB->SGToBeXferLen - residual; | ||
677 | pSRB->SGBusAddr += xferCnt; | ||
678 | pSRB->TotalXferredLen += xferCnt; | ||
679 | pSRB->SGToBeXferLen = residual; | ||
680 | # ifdef DC390_DEBUG0 | ||
681 | printk (KERN_INFO "DC390: DMA: residual = %i, xfer = %i\n", | ||
682 | (unsigned int)residual, (unsigned int)xferCnt); | ||
683 | # endif | ||
684 | |||
685 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD); | ||
686 | } | ||
687 | dc390_laststatus &= ~0xff000000; dc390_laststatus |= dstate << 24; | ||
688 | return dstate; | ||
689 | } | ||
690 | #endif | ||
691 | |||
692 | 649 | ||
693 | static void __inline__ | 650 | static void __inline__ |
694 | dc390_InvalidCmd(struct dc390_acb* pACB) | 651 | dc390_InvalidCmd(struct dc390_acb* pACB) |
@@ -708,9 +665,6 @@ DC390_Interrupt(void *dev_id) | |||
708 | u8 phase; | 665 | u8 phase; |
709 | void (*stateV)( struct dc390_acb*, struct dc390_srb*, u8 *); | 666 | void (*stateV)( struct dc390_acb*, struct dc390_srb*, u8 *); |
710 | u8 istate, istatus; | 667 | u8 istate, istatus; |
711 | #if DMA_INT | ||
712 | u8 dstatus; | ||
713 | #endif | ||
714 | 668 | ||
715 | sstatus = DC390_read8 (Scsi_Status); | 669 | sstatus = DC390_read8 (Scsi_Status); |
716 | if( !(sstatus & INTERRUPT) ) | 670 | if( !(sstatus & INTERRUPT) ) |
@@ -718,22 +672,9 @@ DC390_Interrupt(void *dev_id) | |||
718 | 672 | ||
719 | DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus)); | 673 | DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus)); |
720 | 674 | ||
721 | #if DMA_INT | ||
722 | spin_lock_irq(pACB->pScsiHost->host_lock); | ||
723 | dstatus = dc390_dma_intr (pACB); | ||
724 | spin_unlock_irq(pACB->pScsiHost->host_lock); | ||
725 | |||
726 | DEBUG1(printk (KERN_DEBUG "dstatus=%02x,", dstatus)); | ||
727 | if (! (dstatus & SCSI_INTERRUPT)) | ||
728 | { | ||
729 | DEBUG0(printk (KERN_WARNING "DC390 Int w/o SCSI actions (only DMA?)\n")); | ||
730 | return IRQ_NONE; | ||
731 | } | ||
732 | #else | ||
733 | //DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT); | 675 | //DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT); |
734 | //dstatus = DC390_read8 (DMA_Status); | 676 | //dstatus = DC390_read8 (DMA_Status); |
735 | //DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); | 677 | //DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); |
736 | #endif | ||
737 | 678 | ||
738 | spin_lock_irq(pACB->pScsiHost->host_lock); | 679 | spin_lock_irq(pACB->pScsiHost->host_lock); |
739 | 680 | ||
@@ -821,11 +762,10 @@ static irqreturn_t do_DC390_Interrupt(int irq, void *dev_id) | |||
821 | } | 762 | } |
822 | 763 | ||
823 | static void | 764 | static void |
824 | dc390_DataOut_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | 765 | dc390_DataOut_0(struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) |
825 | { | 766 | { |
826 | u8 sstatus; | 767 | u8 sstatus; |
827 | struct scatterlist *psgl; | 768 | u32 ResidCnt; |
828 | u32 ResidCnt, xferCnt; | ||
829 | u8 dstate = 0; | 769 | u8 dstate = 0; |
830 | 770 | ||
831 | sstatus = *psstatus; | 771 | sstatus = *psstatus; |
@@ -856,42 +796,35 @@ dc390_DataOut_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
856 | if( pSRB->SGIndex < pSRB->SGcount ) | 796 | if( pSRB->SGIndex < pSRB->SGcount ) |
857 | { | 797 | { |
858 | pSRB->pSegmentList++; | 798 | pSRB->pSegmentList++; |
859 | psgl = pSRB->pSegmentList; | ||
860 | 799 | ||
861 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 800 | dc390_start_segment(pSRB); |
862 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
863 | } | 801 | } |
864 | else | 802 | else |
865 | pSRB->SGToBeXferLen = 0; | 803 | pSRB->SGToBeXferLen = 0; |
866 | } | 804 | } |
867 | else | 805 | else |
868 | { | 806 | { |
869 | ResidCnt = (u32) DC390_read8 (Current_Fifo) & 0x1f; | 807 | ResidCnt = ((u32) DC390_read8 (Current_Fifo) & 0x1f) + |
870 | ResidCnt |= (u32) DC390_read8 (CtcReg_High) << 16; | 808 | (((u32) DC390_read8 (CtcReg_High) << 16) | |
871 | ResidCnt |= (u32) DC390_read8 (CtcReg_Mid) << 8; | 809 | ((u32) DC390_read8 (CtcReg_Mid) << 8) | |
872 | ResidCnt += (u32) DC390_read8 (CtcReg_Low); | 810 | (u32) DC390_read8 (CtcReg_Low)); |
873 | 811 | ||
874 | xferCnt = pSRB->SGToBeXferLen - ResidCnt; | 812 | dc390_advance_segment(pSRB, ResidCnt); |
875 | pSRB->SGBusAddr += xferCnt; | ||
876 | pSRB->TotalXferredLen += xferCnt; | ||
877 | pSRB->SGToBeXferLen = ResidCnt; | ||
878 | } | 813 | } |
879 | } | 814 | } |
880 | if ((*psstatus & 7) != SCSI_DATA_OUT) | 815 | if ((*psstatus & 7) != SCSI_DATA_OUT) |
881 | { | 816 | { |
882 | DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 817 | DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); |
883 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); | 818 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); |
884 | } | 819 | } |
885 | } | 820 | } |
886 | 821 | ||
887 | static void | 822 | static void |
888 | dc390_DataIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | 823 | dc390_DataIn_0(struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) |
889 | { | 824 | { |
890 | u8 sstatus, residual, bval; | 825 | u8 sstatus, residual, bval; |
891 | struct scatterlist *psgl; | 826 | u32 ResidCnt, i; |
892 | u32 ResidCnt, i; | ||
893 | unsigned long xferCnt; | 827 | unsigned long xferCnt; |
894 | u8 *ptr; | ||
895 | 828 | ||
896 | sstatus = *psstatus; | 829 | sstatus = *psstatus; |
897 | 830 | ||
@@ -922,19 +855,17 @@ dc390_DataIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
922 | DEBUG1(ResidCnt = ((unsigned long) DC390_read8 (CtcReg_High) << 16) \ | 855 | DEBUG1(ResidCnt = ((unsigned long) DC390_read8 (CtcReg_High) << 16) \ |
923 | + ((unsigned long) DC390_read8 (CtcReg_Mid) << 8) \ | 856 | + ((unsigned long) DC390_read8 (CtcReg_Mid) << 8) \ |
924 | + ((unsigned long) DC390_read8 (CtcReg_Low))); | 857 | + ((unsigned long) DC390_read8 (CtcReg_Low))); |
925 | DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li),", ResidCnt, pSRB->SGToBeXferLen)); | 858 | DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%u,ToBeXfer=%lu),", ResidCnt, pSRB->SGToBeXferLen)); |
926 | 859 | ||
927 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 860 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
928 | 861 | ||
929 | pSRB->TotalXferredLen += pSRB->SGToBeXferLen; | 862 | pSRB->TotalXferredLen += pSRB->SGToBeXferLen; |
930 | pSRB->SGIndex++; | 863 | pSRB->SGIndex++; |
931 | if( pSRB->SGIndex < pSRB->SGcount ) | 864 | if( pSRB->SGIndex < pSRB->SGcount ) |
932 | { | 865 | { |
933 | pSRB->pSegmentList++; | 866 | pSRB->pSegmentList++; |
934 | psgl = pSRB->pSegmentList; | ||
935 | 867 | ||
936 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 868 | dc390_start_segment(pSRB); |
937 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
938 | } | 869 | } |
939 | else | 870 | else |
940 | pSRB->SGToBeXferLen = 0; | 871 | pSRB->SGToBeXferLen = 0; |
@@ -973,47 +904,45 @@ din_1: | |||
973 | } | 904 | } |
974 | /* It seems a DMA Blast abort isn't that bad ... */ | 905 | /* It seems a DMA Blast abort isn't that bad ... */ |
975 | if (!i) printk (KERN_ERR "DC390: DMA Blast aborted unfinished!\n"); | 906 | if (!i) printk (KERN_ERR "DC390: DMA Blast aborted unfinished!\n"); |
976 | //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 907 | //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
977 | dc390_laststatus &= ~0xff000000; dc390_laststatus |= bval << 24; | 908 | dc390_laststatus &= ~0xff000000; |
909 | dc390_laststatus |= bval << 24; | ||
978 | 910 | ||
979 | DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval)); | 911 | DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval)); |
980 | ResidCnt = (u32) DC390_read8 (CtcReg_High); | 912 | ResidCnt = (((u32) DC390_read8 (CtcReg_High) << 16) | |
981 | ResidCnt <<= 8; | 913 | ((u32) DC390_read8 (CtcReg_Mid) << 8)) | |
982 | ResidCnt |= (u32) DC390_read8 (CtcReg_Mid); | 914 | (u32) DC390_read8 (CtcReg_Low); |
983 | ResidCnt <<= 8; | 915 | |
984 | ResidCnt |= (u32) DC390_read8 (CtcReg_Low); | 916 | xferCnt = dc390_advance_segment(pSRB, ResidCnt); |
985 | 917 | ||
986 | xferCnt = pSRB->SGToBeXferLen - ResidCnt; | 918 | if (residual) { |
987 | pSRB->SGBusAddr += xferCnt; | 919 | size_t count = 1; |
988 | pSRB->TotalXferredLen += xferCnt; | 920 | size_t offset = pSRB->SGBusAddr - sg_dma_address(pSRB->pSegmentList); |
989 | pSRB->SGToBeXferLen = ResidCnt; | 921 | unsigned long flags; |
990 | 922 | u8 *ptr; | |
991 | if( residual ) | 923 | |
992 | { | ||
993 | static int feedback_requested; | ||
994 | bval = DC390_read8 (ScsiFifo); /* get one residual byte */ | 924 | bval = DC390_read8 (ScsiFifo); /* get one residual byte */ |
995 | 925 | ||
996 | if (!feedback_requested) { | 926 | local_irq_save(flags); |
997 | feedback_requested = 1; | 927 | ptr = scsi_kmap_atomic_sg(pSRB->pSegmentList, pSRB->SGcount, &offset, &count); |
998 | printk(KERN_WARNING "%s: Please, contact <linux-scsi@vger.kernel.org> " | 928 | if (likely(ptr)) { |
999 | "to help improve support for your system.\n", __FILE__); | 929 | *(ptr + offset) = bval; |
930 | scsi_kunmap_atomic_sg(ptr); | ||
1000 | } | 931 | } |
932 | local_irq_restore(flags); | ||
933 | WARN_ON(!ptr); | ||
1001 | 934 | ||
1002 | ptr = (u8 *) bus_to_virt( pSRB->SGBusAddr ); | 935 | /* 1 more byte read */ |
1003 | *ptr = bval; | 936 | xferCnt += dc390_advance_segment(pSRB, pSRB->SGToBeXferLen - 1); |
1004 | pSRB->SGBusAddr++; xferCnt++; | ||
1005 | pSRB->TotalXferredLen++; | ||
1006 | pSRB->SGToBeXferLen--; | ||
1007 | } | 937 | } |
1008 | DEBUG1(printk (KERN_DEBUG "Xfered: %li, Total: %li, Remaining: %li\n", xferCnt,\ | 938 | DEBUG1(printk (KERN_DEBUG "Xfered: %lu, Total: %lu, Remaining: %lu\n", xferCnt,\ |
1009 | pSRB->TotalXferredLen, pSRB->SGToBeXferLen)); | 939 | pSRB->TotalXferredLen, pSRB->SGToBeXferLen)); |
1010 | |||
1011 | } | 940 | } |
1012 | } | 941 | } |
1013 | if ((*psstatus & 7) != SCSI_DATA_IN) | 942 | if ((*psstatus & 7) != SCSI_DATA_IN) |
1014 | { | 943 | { |
1015 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); | 944 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); |
1016 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 945 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
1017 | } | 946 | } |
1018 | } | 947 | } |
1019 | 948 | ||
@@ -1216,7 +1145,7 @@ dc390_MsgIn_set_sync (struct dc390_acb* pACB, struct dc390_srb* pSRB) | |||
1216 | 1145 | ||
1217 | 1146 | ||
1218 | /* handle RESTORE_PTR */ | 1147 | /* handle RESTORE_PTR */ |
1219 | /* I presume, this command is already mapped, so, have to remap. */ | 1148 | /* This doesn't look very healthy... to-be-fixed */ |
1220 | static void | 1149 | static void |
1221 | dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) | 1150 | dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) |
1222 | { | 1151 | { |
@@ -1225,6 +1154,7 @@ dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) | |||
1225 | pSRB->TotalXferredLen = 0; | 1154 | pSRB->TotalXferredLen = 0; |
1226 | pSRB->SGIndex = 0; | 1155 | pSRB->SGIndex = 0; |
1227 | if (pcmd->use_sg) { | 1156 | if (pcmd->use_sg) { |
1157 | size_t saved; | ||
1228 | pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; | 1158 | pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; |
1229 | psgl = pSRB->pSegmentList; | 1159 | psgl = pSRB->pSegmentList; |
1230 | //dc390_pci_sync(pSRB); | 1160 | //dc390_pci_sync(pSRB); |
@@ -1236,15 +1166,16 @@ dc390_restore_ptr (struct dc390_acb* pACB, struct dc390_srb* pSRB) | |||
1236 | if( pSRB->SGIndex < pSRB->SGcount ) | 1166 | if( pSRB->SGIndex < pSRB->SGcount ) |
1237 | { | 1167 | { |
1238 | pSRB->pSegmentList++; | 1168 | pSRB->pSegmentList++; |
1239 | psgl = pSRB->pSegmentList; | 1169 | |
1240 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 1170 | dc390_start_segment(pSRB); |
1241 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
1242 | } | 1171 | } |
1243 | else | 1172 | else |
1244 | pSRB->SGToBeXferLen = 0; | 1173 | pSRB->SGToBeXferLen = 0; |
1245 | } | 1174 | } |
1246 | pSRB->SGToBeXferLen -= (pSRB->Saved_Ptr - pSRB->TotalXferredLen); | 1175 | |
1247 | pSRB->SGBusAddr += (pSRB->Saved_Ptr - pSRB->TotalXferredLen); | 1176 | saved = pSRB->Saved_Ptr - pSRB->TotalXferredLen; |
1177 | pSRB->SGToBeXferLen -= saved; | ||
1178 | pSRB->SGBusAddr += saved; | ||
1248 | printk (KERN_INFO "DC390: Pointer restored. Segment %i, Total %li, Bus %08lx\n", | 1179 | printk (KERN_INFO "DC390: Pointer restored. Segment %i, Total %li, Bus %08lx\n", |
1249 | pSRB->SGIndex, pSRB->Saved_Ptr, pSRB->SGBusAddr); | 1180 | pSRB->SGIndex, pSRB->Saved_Ptr, pSRB->SGBusAddr); |
1250 | 1181 | ||
@@ -1365,7 +1296,6 @@ dc390_MsgIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
1365 | static void | 1296 | static void |
1366 | dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | 1297 | dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) |
1367 | { | 1298 | { |
1368 | struct scatterlist *psgl; | ||
1369 | unsigned long lval; | 1299 | unsigned long lval; |
1370 | struct dc390_dcb* pDCB = pACB->pActiveDCB; | 1300 | struct dc390_dcb* pDCB = pACB->pActiveDCB; |
1371 | 1301 | ||
@@ -1391,12 +1321,11 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1391 | 1321 | ||
1392 | if( pSRB->SGIndex < pSRB->SGcount ) | 1322 | if( pSRB->SGIndex < pSRB->SGcount ) |
1393 | { | 1323 | { |
1394 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir /* | DMA_INT */); | 1324 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1395 | if( !pSRB->SGToBeXferLen ) | 1325 | if( !pSRB->SGToBeXferLen ) |
1396 | { | 1326 | { |
1397 | psgl = pSRB->pSegmentList; | 1327 | dc390_start_segment(pSRB); |
1398 | pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl))); | 1328 | |
1399 | pSRB->SGToBeXferLen = cpu_to_le32(sg_dma_len(psgl)); | ||
1400 | DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.")); | 1329 | DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.")); |
1401 | } | 1330 | } |
1402 | lval = pSRB->SGToBeXferLen; | 1331 | lval = pSRB->SGToBeXferLen; |
@@ -1410,12 +1339,12 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1410 | DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen); | 1339 | DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen); |
1411 | DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr); | 1340 | DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr); |
1412 | 1341 | ||
1413 | //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); /* | DMA_INT; */ | 1342 | //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1414 | pSRB->SRBState = SRB_DATA_XFER; | 1343 | pSRB->SRBState = SRB_DATA_XFER; |
1415 | 1344 | ||
1416 | DC390_write8 (ScsiCmd, DMA_COMMAND+INFO_XFER_CMD); | 1345 | DC390_write8 (ScsiCmd, DMA_COMMAND+INFO_XFER_CMD); |
1417 | 1346 | ||
1418 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir | DMA_INT); | 1347 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir); |
1419 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT)); | 1348 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT)); |
1420 | //DEBUG1(printk (KERN_DEBUG "DC390: DMA_Status: %02x\n", DC390_read8 (DMA_Status))); | 1349 | //DEBUG1(printk (KERN_DEBUG "DC390: DMA_Status: %02x\n", DC390_read8 (DMA_Status))); |
1421 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT)); | 1350 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT)); |
@@ -1436,8 +1365,8 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1436 | pSRB->SRBState |= SRB_XFERPAD; | 1365 | pSRB->SRBState |= SRB_XFERPAD; |
1437 | DC390_write8 (ScsiCmd, DMA_COMMAND+XFER_PAD_BYTE); | 1366 | DC390_write8 (ScsiCmd, DMA_COMMAND+XFER_PAD_BYTE); |
1438 | /* | 1367 | /* |
1439 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); // | DMA_INT; | 1368 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1440 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir | DMA_INT); | 1369 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir); |
1441 | */ | 1370 | */ |
1442 | } | 1371 | } |
1443 | } | 1372 | } |