diff options
Diffstat (limited to 'drivers/scsi/tmscsim.c')
-rw-r--r-- | drivers/scsi/tmscsim.c | 98 |
1 files changed, 9 insertions, 89 deletions
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 3158949ffa62..bc0a007eb893 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -625,70 +625,6 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr | |||
625 | return 0; | 625 | return 0; |
626 | } | 626 | } |
627 | 627 | ||
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 | 628 | ||
693 | static void __inline__ | 629 | static void __inline__ |
694 | dc390_InvalidCmd(struct dc390_acb* pACB) | 630 | dc390_InvalidCmd(struct dc390_acb* pACB) |
@@ -708,9 +644,6 @@ DC390_Interrupt(void *dev_id) | |||
708 | u8 phase; | 644 | u8 phase; |
709 | void (*stateV)( struct dc390_acb*, struct dc390_srb*, u8 *); | 645 | void (*stateV)( struct dc390_acb*, struct dc390_srb*, u8 *); |
710 | u8 istate, istatus; | 646 | u8 istate, istatus; |
711 | #if DMA_INT | ||
712 | u8 dstatus; | ||
713 | #endif | ||
714 | 647 | ||
715 | sstatus = DC390_read8 (Scsi_Status); | 648 | sstatus = DC390_read8 (Scsi_Status); |
716 | if( !(sstatus & INTERRUPT) ) | 649 | if( !(sstatus & INTERRUPT) ) |
@@ -718,22 +651,9 @@ DC390_Interrupt(void *dev_id) | |||
718 | 651 | ||
719 | DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus)); | 652 | DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus)); |
720 | 653 | ||
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); | 654 | //DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT); |
734 | //dstatus = DC390_read8 (DMA_Status); | 655 | //dstatus = DC390_read8 (DMA_Status); |
735 | //DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); | 656 | //DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); |
736 | #endif | ||
737 | 657 | ||
738 | spin_lock_irq(pACB->pScsiHost->host_lock); | 658 | spin_lock_irq(pACB->pScsiHost->host_lock); |
739 | 659 | ||
@@ -879,7 +799,7 @@ dc390_DataOut_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
879 | } | 799 | } |
880 | if ((*psstatus & 7) != SCSI_DATA_OUT) | 800 | if ((*psstatus & 7) != SCSI_DATA_OUT) |
881 | { | 801 | { |
882 | DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 802 | DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); |
883 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); | 803 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); |
884 | } | 804 | } |
885 | } | 805 | } |
@@ -924,7 +844,7 @@ dc390_DataIn_0( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus) | |||
924 | + ((unsigned long) DC390_read8 (CtcReg_Low))); | 844 | + ((unsigned long) DC390_read8 (CtcReg_Low))); |
925 | DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li),", ResidCnt, pSRB->SGToBeXferLen)); | 845 | DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li),", ResidCnt, pSRB->SGToBeXferLen)); |
926 | 846 | ||
927 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 847 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
928 | 848 | ||
929 | pSRB->TotalXferredLen += pSRB->SGToBeXferLen; | 849 | pSRB->TotalXferredLen += pSRB->SGToBeXferLen; |
930 | pSRB->SGIndex++; | 850 | pSRB->SGIndex++; |
@@ -973,7 +893,7 @@ din_1: | |||
973 | } | 893 | } |
974 | /* It seems a DMA Blast abort isn't that bad ... */ | 894 | /* It seems a DMA Blast abort isn't that bad ... */ |
975 | if (!i) printk (KERN_ERR "DC390: DMA Blast aborted unfinished!\n"); | 895 | if (!i) printk (KERN_ERR "DC390: DMA Blast aborted unfinished!\n"); |
976 | //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 896 | //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
977 | dc390_laststatus &= ~0xff000000; dc390_laststatus |= bval << 24; | 897 | dc390_laststatus &= ~0xff000000; dc390_laststatus |= bval << 24; |
978 | 898 | ||
979 | DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval)); | 899 | DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval)); |
@@ -1013,7 +933,7 @@ din_1: | |||
1013 | if ((*psstatus & 7) != SCSI_DATA_IN) | 933 | if ((*psstatus & 7) != SCSI_DATA_IN) |
1014 | { | 934 | { |
1015 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); | 935 | DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); |
1016 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ | 936 | DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); |
1017 | } | 937 | } |
1018 | } | 938 | } |
1019 | 939 | ||
@@ -1391,7 +1311,7 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1391 | 1311 | ||
1392 | if( pSRB->SGIndex < pSRB->SGcount ) | 1312 | if( pSRB->SGIndex < pSRB->SGcount ) |
1393 | { | 1313 | { |
1394 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir /* | DMA_INT */); | 1314 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1395 | if( !pSRB->SGToBeXferLen ) | 1315 | if( !pSRB->SGToBeXferLen ) |
1396 | { | 1316 | { |
1397 | psgl = pSRB->pSegmentList; | 1317 | psgl = pSRB->pSegmentList; |
@@ -1410,12 +1330,12 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1410 | DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen); | 1330 | DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen); |
1411 | DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr); | 1331 | DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr); |
1412 | 1332 | ||
1413 | //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); /* | DMA_INT; */ | 1333 | //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1414 | pSRB->SRBState = SRB_DATA_XFER; | 1334 | pSRB->SRBState = SRB_DATA_XFER; |
1415 | 1335 | ||
1416 | DC390_write8 (ScsiCmd, DMA_COMMAND+INFO_XFER_CMD); | 1336 | DC390_write8 (ScsiCmd, DMA_COMMAND+INFO_XFER_CMD); |
1417 | 1337 | ||
1418 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir | DMA_INT); | 1338 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir); |
1419 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT)); | 1339 | //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))); | 1340 | //DEBUG1(printk (KERN_DEBUG "DC390: DMA_Status: %02x\n", DC390_read8 (DMA_Status))); |
1421 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT)); | 1341 | //DEBUG1(DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT)); |
@@ -1436,8 +1356,8 @@ dc390_DataIO_Comm( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 ioDir) | |||
1436 | pSRB->SRBState |= SRB_XFERPAD; | 1356 | pSRB->SRBState |= SRB_XFERPAD; |
1437 | DC390_write8 (ScsiCmd, DMA_COMMAND+XFER_PAD_BYTE); | 1357 | DC390_write8 (ScsiCmd, DMA_COMMAND+XFER_PAD_BYTE); |
1438 | /* | 1358 | /* |
1439 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); // | DMA_INT; | 1359 | DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir); |
1440 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir | DMA_INT); | 1360 | DC390_write8 (DMA_Cmd, DMA_START_CMD | ioDir); |
1441 | */ | 1361 | */ |
1442 | } | 1362 | } |
1443 | } | 1363 | } |