Index: dc390/dc390.h =================================================================== RCS file: /usr/local/cvsroot/dc390/dc390.h,v retrieving revision 2.30 retrieving revision 2.32 diff -u -r2.30 -r2.32 --- dc390/dc390.h 1999/07/05 11:41:35 2.30 +++ dc390/dc390.h 1999/07/12 11:43:39 2.32 @@ -4,10 +4,8 @@ * Description: Device Driver for Tekram DC-390(T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: dc390.h,v 2.30 1999/07/05 11:41:35 garloff Exp $ */ +/* $Id: dc390.h,v 2.32 1999/07/12 11:43:39 garloff Exp $ */ -#include - /* * DC390/AMD 53C974 driver, header file */ @@ -15,8 +13,13 @@ #ifndef DC390_H #define DC390_H +#include +#ifndef KERNEL_VERSION +# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + #define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.0d14 1999/07/05" +#define DC390_VERSION "2.0d15 1999/07/12" #if defined(HOSTS_C) || defined(MODULE) @@ -35,6 +38,12 @@ extern struct proc_dir_entry DC390_proc_scsi_tmscsim; extern int DC390_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout); +#if LINUX_VERSION_CODE < 0x020200 +# define NO_NEW_EH +#else +# define NO_NEW_EH use_new_eh_code: 0, +#endif + #define DC390_T { \ proc_dir: &DC390_proc_scsi_tmscsim, \ proc_info: DC390_proc_info, \ @@ -49,6 +58,8 @@ this_id: 7, \ sg_tablesize: SG_ALL, \ cmd_per_lun: 8, \ + NO_NEW_EH \ + unchecked_isa_dma: 0, \ use_clustering: DISABLE_CLUSTERING \ } Index: dc390/scsiiom.c =================================================================== RCS file: /usr/local/cvsroot/dc390/scsiiom.c,v retrieving revision 2.42 retrieving revision 2.43 diff -u -r2.42 -r2.43 --- dc390/scsiiom.c 1999/07/05 11:41:35 2.42 +++ dc390/scsiiom.c 1999/07/12 11:43:39 2.43 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390 (T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: scsiiom.c,v 2.42 1999/07/05 11:41:35 garloff Exp $ */ +/* $Id: scsiiom.c,v 2.43 1999/07/12 11:43:39 garloff Exp $ */ static void __inline__ dc390_freetag (PDCB pDCB, PSRB pSRB) @@ -25,7 +25,7 @@ if (pACB->Connected) { - DEBUG0(printk (KERN_WARNING "DC390: Can't select when connected! (%08lx,%02x)\n", + DEBUG0(printk (KERN_WARNING "DC390: Can't select when connected! (%08x,%02x)\n", pSRB->SRBState, pSRB->SRBFlag);) pSRB->SRBState = SRB_READY; pACB->SelLost++; @@ -160,7 +160,7 @@ }; if (dstate & DMA_XFER_DONE) { - ULONG residual, xferCnt; int ctr = 6000000; + UINT residual, xferCnt; int ctr = 6000000; if (! (DC390_read8 (DMA_Cmd) & READ_DIRECTION)) { do @@ -276,7 +276,7 @@ if (sstatus & ILLEGAL_OP_ERR) { - printk ("DC390: Illegal Operation detected (%08lx)!\n", dc390_laststatus); + printk ("DC390: Illegal Operation detected (%08x)!\n", dc390_laststatus); dc390_dumpinfo (pACB, pACB->pActiveDCB, pACB->pActiveDCB->pActiveSRB); } @@ -356,7 +356,7 @@ { UCHAR sstatus; PSGL psgl; - ULONG ResidCnt, xferCnt; + UINT ResidCnt, xferCnt; UCHAR dstate = 0; sstatus = *psstatus; @@ -387,10 +387,10 @@ } else { - ResidCnt = (ULONG) DC390_read8 (Current_Fifo) & 0x1f; - ResidCnt |= (ULONG) DC390_read8 (CtcReg_High) << 16; - ResidCnt |= (ULONG) DC390_read8 (CtcReg_Mid) << 8; - ResidCnt += (ULONG) DC390_read8 (CtcReg_Low); + ResidCnt = (UINT) DC390_read8 (Current_Fifo) & 0x1f; + ResidCnt |= (UINT) DC390_read8 (CtcReg_High) << 16; + ResidCnt |= (UINT) DC390_read8 (CtcReg_Mid) << 8; + ResidCnt += (UINT) DC390_read8 (CtcReg_Low); xferCnt = pSRB->SGToBeXferLen - ResidCnt; pSRB->SGBusAddr += xferCnt; @@ -406,7 +406,8 @@ { UCHAR sstatus, residual, bval; PSGL psgl; - ULONG ResidCnt, xferCnt, i; + UINT ResidCnt, i; + ULONG xferCnt; PUCHAR ptr; sstatus = *psstatus; @@ -427,7 +428,7 @@ DEBUG1(ResidCnt = ((ULONG) DC390_read8 (CtcReg_High) << 16) \ + ((ULONG) DC390_read8 (CtcReg_Mid) << 8) \ + ((ULONG) DC390_read8 (CtcReg_Low));) - DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%li,ToBeXfer=%li),", ResidCnt, pSRB->SGToBeXferLen);) + DEBUG1(printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li),", ResidCnt, pSRB->SGToBeXferLen);) DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ @@ -481,12 +482,12 @@ //DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */ dc390_laststatus &= ~0xff000000; dc390_laststatus |= bval << 24; - DEBUG1(printk (KERN_DEBUG "Blast: Read %li times DMA_Status %02x", 0xa000-i, bval);) - ResidCnt = (ULONG) DC390_read8 (CtcReg_High); + DEBUG1(printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x", 0xa000-i, bval);) + ResidCnt = (UINT) DC390_read8 (CtcReg_High); ResidCnt <<= 8; - ResidCnt |= (ULONG) DC390_read8 (CtcReg_Mid); + ResidCnt |= (UINT) DC390_read8 (CtcReg_Mid); ResidCnt <<= 8; - ResidCnt |= (ULONG) DC390_read8 (CtcReg_Low); + ResidCnt |= (UINT) DC390_read8 (CtcReg_Low); xferCnt = pSRB->SGToBeXferLen - ResidCnt; pSRB->SGBusAddr += xferCnt; @@ -771,15 +772,15 @@ /* Check if the message is complete */ static UCHAR __inline__ -dc390_MsgIn_complete (UCHAR *msgbuf, ULONG len) +dc390_MsgIn_complete (UCHAR *msgbuf, UINT len) { if (*msgbuf == EXTENDED_MESSAGE) - { - if (len < 2) return 0; - if (len < msgbuf[1] + 2) return 0; - } + { + if (len < 2) return 0; + if (len < msgbuf[1] + 2) return 0; + } else if (*msgbuf >= 0x20 && *msgbuf <= 0x2f) // two byte messages - if (len < 2) return 0; + if (len < 2) return 0; return 1; } @@ -1098,8 +1099,8 @@ if (!pDCB) { int j = 400; - DEBUG0(printk(KERN_ERR "ACB:%08lx->ActiveDCB:%08lx IOPort:%04x IRQ:%02x !\n",\ - (ULONG)pACB,(ULONG)pDCB,pACB->IOPortBase,pACB->IRQLevel);) + DEBUG0(printk(KERN_ERR "ACB:%p->ActiveDCB:%p IOPort:%04x IRQ:%02x !\n",\ + pACB, pDCB, pACB->IOPortBase, pACB->IRQLevel);) while (--j) udelay (1000); DC390_read8 (INT_Status); /* Reset Pending INT */ DC390_write8 (ScsiCmd, EN_SEL_RESEL); @@ -1382,7 +1383,7 @@ } if(pSRB->RetryCnt == 0) { - //(ULONG)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0]; + //(UINT)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0]; pSRB->TotalXferredLen = pSRB->SavedTotXLen; if( (pSRB->TotalXferredLen) && (pSRB->TotalXferredLen >= pcmd->underflow) ) @@ -1398,8 +1399,8 @@ pSRB->RetryCnt--; pSRB->AdaptStatus = 0; pSRB->TargetStatus = 0; - //*((PULONG) &(pSRB->CmdBlock[0])) = pSRB->Segment0[0]; - //*((PULONG) &(pSRB->CmdBlock[4])) = pSRB->Segment0[1]; + //*((PUINT) &(pSRB->CmdBlock[0])) = pSRB->Segment0[0]; + //*((PUINT) &(pSRB->CmdBlock[4])) = pSRB->Segment0[1]; /* Don't retry on TEST_UNIT_READY */ if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */) { @@ -1660,14 +1661,14 @@ static void dc390_ScsiRstDetect( PACB pACB ) { - printk ("DC390: Rst_Detect: laststat = %08lx\n", dc390_laststatus); + printk ("DC390: Rst_Detect: laststat = %08x\n", dc390_laststatus); //DEBUG0(printk(KERN_INFO "RST_DETECT,");) DC390_write8 (DMA_Cmd, DMA_IDLE_CMD); pACB->pScsiHost->last_reset = jiffies; /* Unlock before ? */ - /* delay a second */ - { unsigned int msec = 500; while (--msec) udelay(1000); } + /* delay half a second */ + { unsigned int msec = 600; while (--msec) udelay(1000); } DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); pACB->Connected = 0; @@ -1697,9 +1698,9 @@ pSRB->pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN);) pSRB->SRBFlag |= AUTO_REQSENSE; - //pSRB->Segment0[0] = (ULONG) pSRB->CmdBlock[0]; - //pSRB->Segment0[1] = (ULONG) pSRB->CmdBlock[4]; - //pSRB->Segment1[0] = ((ULONG)(pSRB->pcmd->cmd_len) << 8) + pSRB->SGcount; + //pSRB->Segment0[0] = (UINT) pSRB->CmdBlock[0]; + //pSRB->Segment0[1] = (UINT) pSRB->CmdBlock[4]; + //pSRB->Segment1[0] = ((UINT)(pSRB->pcmd->cmd_len) << 8) + pSRB->SGcount; //pSRB->Segment1[1] = pSRB->TotalXferredLen; pSRB->SavedSGCount = pSRB->SGcount; pSRB->SavedTotXLen = pSRB->TotalXferredLen; Index: dc390/tmscsim.c =================================================================== RCS file: /usr/local/cvsroot/dc390/tmscsim.c,v retrieving revision 2.46 retrieving revision 2.48 diff -u -r2.46 -r2.48 --- dc390/tmscsim.c 1999/07/05 11:41:35 2.46 +++ dc390/tmscsim.c 1999/07/12 11:43:39 2.48 @@ -7,7 +7,7 @@ ***********************************************************************/ /* (C) Copyright: put under GNU GPL in 10/96 (see README.tmscsim) * *************************************************************************/ -/* $Id: tmscsim.c,v 2.46 1999/07/05 11:41:35 garloff Exp $ */ +/* $Id: tmscsim.c,v 2.48 1999/07/12 11:43:39 garloff Exp $ */ /* Enhancements and bugfixes by * * Kurt Garloff * ***********************************************************************/ @@ -124,6 +124,8 @@ * 2.0d1299/07/04 KG Changed order of processing in IRQ * * 2.0d1399/07/05 KG Don't update DCB fields if removed * * 2.0d1499/07/05 KG remove_dev: Move kfree() to the end * + * 2.0d1599/07/12 KG use_new_eh_code: 0, ULONG -> UINT where * + * appropriate * ***********************************************************************/ /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */ @@ -227,20 +229,18 @@ //#define DEBUG_SPINLOCKS 2 /* Set to 0, 1 or 2 in include/asm/spinlock.h */ -#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s)) - -#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30) # include # include #endif -#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93) # define USE_SPINLOCKS 1 # define NEW_PCI 1 #else # undef NEW_PCI -# if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30) # define USE_SPINLOCKS 2 # endif #endif @@ -429,9 +429,9 @@ //static PSH dc390_pSH_current = NULL; static PACB dc390_pACB_start= NULL; static PACB dc390_pACB_current = NULL; -static UCHAR dc390_adapterCnt = 0; static ULONG dc390_lastabortedpid = 0; -static ULONG dc390_laststatus = 0; +static UINT dc390_laststatus = 0; +static UCHAR dc390_adapterCnt = 0; #ifndef CONFIG_SCSI_DC390T_NOGENSUPP /* Startup values, to be overriden on the commandline */ @@ -445,14 +445,14 @@ # endif , 3 /* 16 Tags per LUN */, 1 /* s delay after Reset */ }; -# if defined(MODULE) && LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30) +# if defined(MODULE) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30) MODULE_PARM(tmscsim, "1-6i"); MODULE_PARM_DESC(tmscsim, "Host SCSI ID, Speed (0=10MHz), Device Flags, Adapter Flags, Max Tags (log2(tags)-1), DelayReset (s)"); # endif #endif /* CONFIG_SCSI_DC390T_NOGENSUPP */ -#if defined(MODULE) && LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30) +#if defined(MODULE) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30) MODULE_AUTHOR("C.L. Huang / Kurt Garloff"); MODULE_DESCRIPTION("SCSI host adapter driver for Tekram DC390 and other AMD53C974A based PCI SCSI adapters"); MODULE_SUPPORTED_DEVICE("sd,sr,sg,st"); @@ -1175,7 +1175,7 @@ }; DC390_UNLOCK_ACB; - DEBUG1(printk (KERN_DEBUG " ... command (%02x) queued successfully.\n", pcmd->cmnd[0]);) + DEBUG1(printk (KERN_DEBUG " ... command (pid %li) queued successfully.\n", cmd->pid);) return(0); } @@ -1318,12 +1318,12 @@ if (pSRB) { - printk ("DC390: SRB: Xferred %08lx, Remain %08lx, State %08lx, Phase %02x\n", + printk ("DC390: SRB: Xferred %08lx, Remain %08lx, State %08x, Phase %02x\n", pSRB->TotalXferredLen, pSRB->SGToBeXferLen, pSRB->SRBState, pSRB->ScsiPhase); printk ("DC390: AdpaterStatus: %02x, SRB Status %02x\n", pSRB->AdaptStatus, pSRB->SRBStatus); }; - printk ("DC390: Status of last IRQ (DMA/SC/Int/IRQ): %08lx\n", dc390_laststatus); + printk ("DC390: Status of last IRQ (DMA/SC/Int/IRQ): %08x\n", dc390_laststatus); printk ("DC390: Register dump: SCSI block:\n"); printk ("DC390: XferCnt Cmd Stat IntS IRQS FFIS Ctl1 Ctl2 Ctl3 Ctl4\n"); printk ("DC390: %06x %02x %02x %02x", @@ -1368,7 +1368,7 @@ { PDCB pDCB; PSRB pSRB, psrb; - ULONG count, i; + UINT count, i; PSCSICMD pcmd; int status; //ULONG sbac; @@ -1559,7 +1559,7 @@ { PDCB pDCB, pdcb; PSRB psrb, psrb2; - ULONG cnt, i; + UINT cnt, i; pDCB = pACB->pLinkDCB; if( !pDCB ) return; @@ -1606,7 +1606,7 @@ int DC390_reset(Scsi_Cmnd *cmd, unsigned int resetFlags) { UCHAR bval; - ULONG i; + UINT i; DC390_AFLAGS PACB pACB = (PACB) cmd->host->hostdata; @@ -1798,7 +1798,7 @@ void dc390_linkSRB( PACB pACB ) { - ULONG count, i; + UINT count, i; count = pACB->SRBCount; for( i=0; iTagMaxNum, pACB->status, pACB->ACBFlag, GLITCH_TO_NS(pACB->glitch_cfg)*12); - SPRINTF("Statistics: Cmnds %li, Cmnds not sent directly %li, Out of SRB conds %li\n", + SPRINTF("Statistics: Cmnds %li, Cmnds not sent directly %i, Out of SRB conds %i\n", pACB->Cmds, pACB->CmdInQ, pACB->CmdOutOfSRB); - SPRINTF(" Lost arbitrations %li, Connected: %s\n", + SPRINTF(" Lost arbitrations %i, Connected: %s\n", pACB->SelLost, pACB->Connected? "Yes": "No"); SPRINTF("Nr of attached devices: %i, Nr of DCBs: %i\n", pACB->DeviceCnt, pACB->DCBCnt); Index: dc390/tmscsim.h =================================================================== RCS file: /usr/local/cvsroot/dc390/tmscsim.h,v retrieving revision 2.12 retrieving revision 2.13 diff -u -r2.12 -r2.13 --- dc390/tmscsim.h 1999/06/21 07:02:08 2.12 +++ dc390/tmscsim.h 1999/07/12 11:43:39 2.13 @@ -3,7 +3,7 @@ ;* TEKRAM DC-390(T) PCI SCSI Bus Master Host Adapter * ;* Device Driver * ;***********************************************************************/ -/* $Id: tmscsim.h,v 2.12 1999/06/21 07:02:08 garloff Exp $ */ +/* $Id: tmscsim.h,v 2.13 1999/07/12 11:43:39 garloff Exp $ */ #ifndef _TMSCSIM_H #define _TMSCSIM_H @@ -21,16 +21,17 @@ #define END_SCAN 2 -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned long ULONG; -typedef unsigned int UINT; +typedef unsigned char UCHAR; /* 8 bits */ +typedef unsigned short USHORT; /* 16 bits */ +typedef unsigned int UINT; /* 32 bits */ +typedef unsigned long ULONG; /* 32/64 bits */ typedef UCHAR *PUCHAR; typedef USHORT *PUSHORT; +typedef UINT *PUINT; typedef ULONG *PULONG; -typedef Scsi_Host_Template *PSHT; -typedef struct Scsi_Host *PSH; +typedef Scsi_Host_Template *PSHT; +typedef struct Scsi_Host *PSH; typedef Scsi_Device *PSCSIDEV; typedef Scsi_Cmnd *PSCSICMD; typedef void *PVOID; @@ -84,11 +85,11 @@ SGL Segmentx; /* make a one entry of S/G list table */ /* 0x1c: */ -ULONG TotalXferredLen; -ULONG SavedTotXLen; ULONG SGBusAddr; /*;a segment starting address as seen by AM53C974A*/ ULONG SGToBeXferLen; /*; to be xfer length */ -ULONG SRBState; +ULONG TotalXferredLen; +ULONG SavedTotXLen; +UINT SRBState; /* 0x30: */ UCHAR SRBStatus; @@ -150,7 +151,7 @@ UCHAR MaxCommand; /* 0x20: */ -ULONG TagMask; +UINT TagMask; UCHAR UnitSCSIID; /*; SCSI Target ID (SCSI Only) */ UCHAR UnitSCSILUN; /*; SCSI Log. Unit (SCSI Only) */ @@ -231,9 +232,9 @@ PDEVDECL1; /* Pointer to PCI cfg. space */ /* 0x4c/0x48: */ ULONG Cmds; -ULONG CmdInQ; -ULONG CmdOutOfSRB; -ULONG SelLost; +UINT SelLost; +UINT CmdInQ; +UINT CmdOutOfSRB; /* 0x5c/0x58: */