? .kversion ? .tmscsim.o.flags ? Rules.make Index: dc390.h =================================================================== RCS file: /home/cvsroot/dc390/dc390.h,v retrieving revision 2.43.2.22 retrieving revision 2.43.2.23 diff -u -r2.43.2.22 -r2.43.2.23 --- dc390.h 2000/12/20 00:39:36 2.43.2.22 +++ dc390.h 2001/11/14 01:36:16 2.43.2.23 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390(T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: dc390.h,v 2.43.2.22 2000/12/20 00:39:36 garloff Exp $ */ +/* $Id: dc390.h,v 2.43.2.23 2001/11/14 01:36:16 garloff Exp $ */ /* * DC390/AMD 53C974 driver, header file @@ -19,7 +19,7 @@ #endif #define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.0f 2000-12-20" +#define DC390_VERSION "2.0f1 2001-11-14" /* We don't have eh_abort_handler, eh_device_reset_handler, * eh_bus_reset_handler, eh_host_reset_handler yet! Index: scsiiom.c =================================================================== RCS file: /home/cvsroot/dc390/scsiiom.c,v retrieving revision 2.55.2.17 retrieving revision 2.55.2.20 diff -u -r2.55.2.17 -r2.55.2.20 --- scsiiom.c 2000/12/20 00:39:37 2.55.2.17 +++ scsiiom.c 2001/11/14 02:39:38 2.55.2.20 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390 (T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: scsiiom.c,v 2.55.2.17 2000/12/20 00:39:37 garloff Exp $ */ +/* $Id: scsiiom.c,v 2.55.2.20 2001/11/14 02:39:38 garloff Exp $ */ static void __inline__ dc390_freetag (PDCB pDCB, PSRB pSRB) @@ -351,11 +351,40 @@ DEBUG1(printk (".. IRQ returned\n");) } +int DC390_set_next_SG (PSRB pSRB) +{ + //pSRB->pSegmentList++; + PSGL psgl = pSRB->pSegmentList; + int idx = pSRB->SGIndex; + int ctr = 0; + + pSRB->SGBusAddr = virt_to_bus( psgl->address ); + pSRB->SGToBeXferLen = (ULONG) psgl->length; + DEBUG1( + printk ("DC390: SG %i/%i: %08lx(%06lx)\n", idx, pSRB->SGcount, + pSRB->SGBusAddr, pSRB->SGToBeXferLen); + ) + while (++idx < pSRB->SGcount && + virt_to_bus ((++psgl)->address) == pSRB->SGBusAddr + pSRB->SGToBeXferLen && + psgl->length + pSRB->SGToBeXferLen <= 131072) { + DEBUG0( + printk ("DC390: Merge SG segments %i:%08lx(%06lx)+%i:%08lx(%06x)->%i:%08lx(%06lx)\n", + pSRB->SGIndex, pSRB->SGBusAddr, pSRB->SGToBeXferLen, + idx, virt_to_bus (psgl->address), psgl->length, + pSRB->SGIndex, pSRB->SGBusAddr, pSRB->SGToBeXferLen + psgl->length); + ) + pSRB->pSegmentList++; + pSRB->SGToBeXferLen += psgl->length; + ctr++; + } + pSRB->SGIndex = --idx; + return ctr; +} + void dc390_DataOut_0( PACB pACB, PSRB pSRB, PUCHAR psstatus) { UCHAR sstatus; - PSGL psgl; UINT ResidCnt, xferCnt; UCHAR dstate = 0; @@ -374,15 +403,10 @@ dc390_laststatus &= ~0xff000000; dc390_laststatus |= dstate << 24; pSRB->TotalXferredLen += pSRB->SGToBeXferLen; pSRB->SGIndex++; - if( pSRB->SGIndex < pSRB->SGcount ) - { + if( pSRB->SGIndex < pSRB->SGcount ) { pSRB->pSegmentList++; - psgl = pSRB->pSegmentList; - - pSRB->SGBusAddr = virt_to_bus( psgl->address ); - pSRB->SGToBeXferLen = (ULONG) psgl->length; - } - else + DC390_set_next_SG (pSRB); + } else pSRB->SGToBeXferLen = 0; } else @@ -409,7 +433,6 @@ dc390_DataIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus) { UCHAR sstatus, residual, bval; - PSGL psgl; UINT ResidCnt, i; ULONG xferCnt; PUCHAR ptr; @@ -438,15 +461,10 @@ pSRB->TotalXferredLen += pSRB->SGToBeXferLen; pSRB->SGIndex++; - if( pSRB->SGIndex < pSRB->SGcount ) - { + if( pSRB->SGIndex < pSRB->SGcount ) { pSRB->pSegmentList++; - psgl = pSRB->pSegmentList; - - pSRB->SGBusAddr = virt_to_bus( psgl->address ); - pSRB->SGToBeXferLen = (ULONG) psgl->length; - } - else + DC390_set_next_SG (pSRB); + } else pSRB->SGToBeXferLen = 0; } else /* phase changed */ @@ -744,6 +762,7 @@ pSRB->SGBusAddr = virt_to_bus( psgl->address ); pSRB->SGToBeXferLen = (ULONG) psgl->length; + // TODO: SG segment merging } else pSRB->SGToBeXferLen = 0; @@ -873,7 +892,6 @@ void dc390_DataIO_Comm( PACB pACB, PSRB pSRB, UCHAR ioDir) { - PSGL psgl; ULONG lval; PDCB pDCB = pACB->pActiveDCB; @@ -882,7 +900,12 @@ if (pDCB) printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (%02i-%i)\n", pDCB->TargetID, pDCB->TargetLUN); else printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (DCB 0!)\n"); - dc390_EnableMsgOut_Abort (pACB, pSRB); + if (!pSRB->pSRBDCB) { + printk ("DC390: pSRB->pSRBDCB == 0!\n"); + pSRB->pSRBDCB = pDCB; + } + if (pSRB->pSRBDCB) + dc390_EnableMsgOut_Abort (pACB, pSRB); if (pDCB) pDCB->DCBFlag |= ABORT_DEV; return; } @@ -891,10 +914,8 @@ { DC390_write8 (DMA_Cmd, DMA_IDLE_CMD | ioDir /* | DMA_INT */); if( !pSRB->SGToBeXferLen ) - { - psgl = pSRB->pSegmentList; - pSRB->SGBusAddr = virt_to_bus( psgl->address ); - pSRB->SGToBeXferLen = (ULONG) psgl->length; + { + DC390_set_next_SG (pSRB); DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.");) } lval = pSRB->SGToBeXferLen; @@ -1327,21 +1348,18 @@ dc390_disc_tagq_set (PDCB pDCB, PSCSI_INQDATA ptr) { /* Check for SCSI format (ANSI and Response data format) */ - if ( (ptr->Vers & 0x07) >= 2 || (ptr->RDF & 0x0F) == 2 ) - { - if ( (ptr->Flags & SCSI_INQ_CMDQUEUE) && - (pDCB->DevMode & TAG_QUEUEING_) && - /* ((pDCB->DevType == TYPE_DISK) - || (pDCB->DevType == TYPE_MOD)) &&*/ - !dc390_tagq_blacklist (((char*)ptr)+8) ) - { - if (pDCB->MaxCommand ==1) pDCB->MaxCommand = pDCB->pDCBACB->TagMaxNum; - pDCB->SyncMode |= EN_TAG_QUEUEING /* | EN_ATN_STOP */; - //pDCB->TagMask = 0; - } - else - pDCB->MaxCommand = 1; - } + if ( ptr && ((ptr->Vers & 0x07) >= 2 || (ptr->RDF & 0x0F) == 2 ) + && (ptr->Flags & SCSI_INQ_CMDQUEUE) + && (pDCB->DevMode & TAG_QUEUEING_) + /* && ((pDCB->DevType == TYPE_DISK) + || (pDCB->DevType == TYPE_MOD)) */ + && !dc390_tagq_blacklist (((char*)ptr)+8) ) { + if (pDCB->MaxCommand ==1) pDCB->MaxCommand = pDCB->pDCBACB->TagMaxNum; + pDCB->SyncMode |= EN_TAG_QUEUEING /* | EN_ATN_STOP */; + //pDCB->TagMask = 0; + } + else + pDCB->MaxCommand = 1; }; @@ -1351,7 +1369,7 @@ UCHAR bval1 = ptr->DevType & SCSI_DEVTYPE; pDCB->DevType = bval1; /* if (bval1 == TYPE_DISK || bval1 == TYPE_MOD) */ - dc390_disc_tagq_set (pDCB, ptr); + dc390_disc_tagq_set (pDCB, ptr); }; @@ -1609,12 +1627,14 @@ if( pcmd->cmnd[0] == INQUIRY && (pcmd->result == (DID_OK << 16) || status_byte(pcmd->result) & CHECK_CONDITION) ) { - if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV && !DCB_removed) + if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV) { //printk ("DC390: Type = nodev! (%02i-%i)\n", pcmd->target, pcmd->lun); /* device not present: remove */ //dc390_Going_remove (pDCB, pSRB); - dc390_remove_dev (pACB, pDCB); DCB_removed = 1; + if (!DCB_removed) { + dc390_remove_dev (pACB, pDCB); DCB_removed = 1; + } } else { Index: tmscsim.c =================================================================== RCS file: /home/cvsroot/dc390/tmscsim.c,v retrieving revision 2.60.2.30 retrieving revision 2.60.2.34 diff -u -r2.60.2.30 -r2.60.2.34 --- tmscsim.c 2000/12/20 01:07:12 2.60.2.30 +++ tmscsim.c 2001/11/14 02:39:38 2.60.2.34 @@ -7,7 +7,7 @@ ***********************************************************************/ /* (C) Copyright: put under GNU GPL in 10/96 (see README.tmscsim) * *************************************************************************/ -/* $Id: tmscsim.c,v 2.60.2.30 2000/12/20 01:07:12 garloff Exp $ */ +/* $Id: tmscsim.c,v 2.60.2.34 2001/11/14 02:39:38 garloff Exp $ */ /* Enhancements and bugfixes by * * Kurt Garloff * ***********************************************************************/ @@ -164,6 +164,8 @@ * 2.4 PCI device table (Thx to A.Richter) * * 2.0e7 00/11/28 KG Allow overriding of BIOS settings * * 2.0f 00/12/20 KG Handle failed INQUIRYs during scan * + * 2.0f1 01/11/14 KG Merge SG segments. * + * Prevent Oops in DataIO_Comm() * ***********************************************************************/ /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */ @@ -1832,7 +1834,7 @@ PDCB pDCB, pDCB2; pDCB = kmalloc (sizeof(DC390_DCB), GFP_ATOMIC); - DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n" \ + DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n", \ id, lun, pDCB);) *ppDCB = pDCB; pDCB2 = 0; @@ -2080,15 +2082,15 @@ int i; pACB = (PACB) psh->hostdata; - - if (check_region (io_port, psh->n_io_port)) - { + +#if (LINUX_VERSION_CODE >= 132096) + if (!(request_region (io_port, psh->n_io_port, "tmscsim"))) { printk(KERN_ERR "DC390: register IO ports error!\n"); return( -1 ); - } - else - request_region (io_port, psh->n_io_port, "tmscsim"); - + } +#else + request_region (io_port, psh->n_io_port, "tmscsim"); +#endif DC390_read8_ (INT_Status, io_port); /* Reset Pending INT */ if( (i = request_irq(Irq, do_DC390_Interrupt, DC390_IRQ, "tmscsim", pACB) ))