? .dc395x_trm.o.flags ? .kversion ? Rules.make ? dc395x_trm.c.126 ? dc395x_trm.c.131 ? dc395x_trm.c.debug_nmi ? dc395x_trm.c.new ? dc395x_trm.h.131 Index: Makefile.dc395 =================================================================== RCS file: /home/cvsroot/dc395/Makefile.dc395,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile.dc395 2000/12/02 12:17:53 1.4 +++ Makefile.dc395 2002/05/10 17:17:53 1.5 @@ -34,14 +34,15 @@ @if test $(shell id -u) = 0; then \ echo "Install dc395x_trm"; install -o root -g root -d $(MODLIB)/$(TARGETMODDIR); \ install -o root -g root -m 0644 dc395x_trm.o $(MODLIB)/$(TARGETMODDIR)/; \ - echo "depmod -a $(KERNELRELEASE)"; depmod -a $(KERNELRELEASE); \ + echo "depmod -a $(KERNELRELEASE)"; depmod -ae $(KERNELRELEASE) || echo "(ignore errors)" ; \ else \ echo "Give root password for installation of kernel module"; \ su -c \ 'echo "Install dc395x_trm"; install -o root -g root -d $(MODLIB)/$(TARGETMODDIR); \ install -o root -g root -m 0644 dc395x_trm.o $(MODLIB)/$(TARGETMODDIR)/; \ - echo "depmod -a $(KERNELRELEASE)"; depmod -a $(KERNELRELEASE)'; \ - fi + echo "depmod -a $(KERNELRELEASE)"; depmod -ae $(KERNELRELEASE)' || echo "(ignore errors)"; \ + fi + @sync load_module: install_mod @if test $(shell id -u) = 0; then \ @@ -54,4 +55,4 @@ 'if test ! -z "$(shell lsmod | grep dc395x_trm)"; then echo "Remove dc395x_trm"; \ rmmod dc395x_trm; fi; \ echo "Load dc395x_trm"; modprobe dc395x_trm'; \ - fi + fi Index: dc395x_trm.c =================================================================== RCS file: /home/cvsroot/dc395/dc395x_trm.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- dc395x_trm.c 2002/04/24 00:02:59 1.80 +++ dc395x_trm.c 2002/05/10 17:17:53 1.81 @@ -12,7 +12,7 @@ //* Kurt Garloff //* (C) 1999-2000 Kurt Garloff //* License: GNU GPL -//* $Id: dc395x_trm.c,v 1.80 2002/04/24 00:02:59 garloff Exp $ +//* $Id: dc395x_trm.c,v 1.81 2002/05/10 17:17:53 garloff Exp $ //*********************************************************************** //* Tekram PCI SCSI adapter (DC395/U/UW/F or DC315/U) revision history //* @@ -108,6 +108,7 @@ //* Fix inconsistency SRB_array[] size vs. DC395x_MAX_SRB_CNT //* 1.39 02/04/24 KG PAGE_ADDRESS for pre2.4.16 kernels //* Locking in IRQ handler (thx to Paul Rolland) +//* 1.40 02/05/10 KG Init tmpSRB debugtrace buffer, fix double free of DCBs //*********************************************************************** /* ************************************************************************* @@ -150,6 +151,7 @@ //#define DC395x_DEBUGFIFO //#define DC395x_DEBUGRECURSION //#define DC395x_DEBUGPIO +//#define DC395x_DEBUGMALLOC /* DISable features */ //#define DC395x_NO_DISCONNECT @@ -251,6 +253,27 @@ #include "sd.h" #include "dc395x_trm.h" +#ifdef DC395x_DEBUGMALLOC +inline void* dc395x_kmalloc (size_t sz, int fl) +{ + void *ptr = kmalloc (sz, fl); + printk (KERN_DEBUG "DC395x: Alloc %i bytes @ %p w/ fl %08x\n", + sz, ptr, fl); + return ptr; +} +inline void dc395x_kfree (const void* adr) +{ + printk (KERN_DEBUG "DC395x: Free mem @ %p\n", + adr); + kfree (adr); +} +# define KMALLOC(sz,fl) dc395x_kmalloc(sz,fl) +# define KFREE(adr) dc395x_kfree(adr) +#else +# define KMALLOC(sz,fl) kmalloc(sz,fl) +# define KFREE(adr) kfree(adr) +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93) # include # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30) @@ -1564,7 +1587,7 @@ /* Read the parameters from the command line */ #if !defined(MODULE) # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) -void __init DC395x_trm_setup (char *str) +static int DC395x_trm_setup (char *str) { int i, im; int ints[8]; @@ -1583,6 +1606,9 @@ for (i = 0; i < im; i++) dc395x_trm[i] = ints[i+1]; /* DC395x_checkparams (); */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) + return 1; +#endif }; #if 0 // For the editor's indenting :-) } @@ -2896,6 +2922,7 @@ } +#if 0 /* Timer to work around chip flaw: When selecting and the bus is * busy, we sometimes miss a Selection timeout IRQ */ void DC395x_selection_timeout_missed (unsigned long ptr); @@ -2928,7 +2955,7 @@ DC395x_Disconnect (pACB); DC395x_UNLOCK_IO(pACB->pScsiHost); } - +#endif /* ********************************************************************** @@ -3183,8 +3210,6 @@ return; } - DC395x_LOCK_IO(pACB->pScsiHost); - DEBUGRECURSION(if (in_driver++ > NORM_REC_LVL) printk ("DC395x: %i interrupt recursion?\n", in_driver);) //DC395x_DRV_LOCK(drv_flags); @@ -3232,13 +3257,10 @@ if( pACB == (PACB)-1 ) { //printk("DC395x_Interrupt: Spurious interrupt detected!\n"); - pACB = DC395x_pACB_start; - goto out_unlock; - } - if (pACB != DC395x_pACB_start) { - DC395x_LOCK_IO(pACB->pScsiHost); - DC395x_UNLOCK_IO(DC395x_pACB_start->pScsiHost); + goto out; } + DC395x_LOCK_IO(pACB->pScsiHost); + /* This acknowledges the IRQ */ scsi_intstatus = DC395x_read8(TRM_S1040_SCSI_INTSTATUS ); if ((scsi_status & 0x2007) == 0x2002) @@ -3343,8 +3365,9 @@ DC395x_stateV( pACB, pSRB, &scsi_status ); } out_unlock: - DEBUGRECURSION(in_driver--;) DC395x_UNLOCK_IO(pACB->pScsiHost); + out: + DEBUGRECURSION(in_driver--;) //printk ("... done\n"); //DC395x_ACB_UNLOCK(pACB,acb_flags); return; @@ -5195,7 +5218,7 @@ if (pDCB == pACB->pLinkDCB) pACB->pLinkDCB = pDCB->pNextDCB; if (pDCB == pACB->pDCBRunRobin) pACB->pDCBRunRobin = pDCB->pNextDCB; pACB->DCBCnt--; - kfree (pDCB); + KFREE (pDCB); /* pACB->DeviceCnt--; */ }; @@ -5890,7 +5913,7 @@ #ifdef DC395x_DEBUG0 printk(KERN_INFO "DC395x_initDCB..............\n "); #endif - pDCB = kmalloc (sizeof(DC395X_TRM_DCB), GFP_ATOMIC); + pDCB = KMALLOC (sizeof(DC395X_TRM_DCB), GFP_ATOMIC); //pDCB = DC395x_findDCB (pACB, target, lun); *ppDCB = pDCB; pDCB2 = 0; if (!pDCB) return; @@ -5987,7 +6010,7 @@ for (srbidx = 0; srbidx < SRBIdx; srbidx += bufs_per_page) { //printk ("DC395x: Free tracebuf %p (for %i)\n", // pACB->SRB_array[srbidx].debugtrace, srbidx); - kfree (pACB->SRB_array[srbidx].debugtrace); + KFREE (pACB->SRB_array[srbidx].debugtrace); } } @@ -6000,7 +6023,7 @@ unsigned char *ptr; //printk ("DC395x: Alloc %i pages for tracebufs\n", pages); while (pages--) { - ptr = kmalloc (PAGE_SIZE, GFP_KERNEL); + ptr = KMALLOC (PAGE_SIZE, GFP_KERNEL); if (!ptr) { DC395x_free_tracebufs (pACB, SRBIdx); return 1; @@ -6012,9 +6035,10 @@ pACB->SRB_array[SRBIdx++].debugtrace = ptr + (i++*DEBUGTRACEBUFSZ); } - if (i < bufs_per_page) + if (i < bufs_per_page) { pACB->TmpSRB.debugtrace = ptr + (i*DEBUGTRACEBUFSZ); - else + pACB->TmpSRB.debugtrace[0] = 0; + } else printk ("DC395x: No space for tmpSRB tracebuf reserved?!\n"); return 0; } @@ -6028,7 +6052,7 @@ for (srbidx = 0; srbidx < SRBIdx; srbidx += SRBs_per_page) { //printk ("DC395x: Free SG segs %p (for %i)\n", // pACB->SRB_array[srbidx].SegmentX, srbidx); - kfree (pACB->SRB_array[srbidx].SegmentX); + KFREE (pACB->SRB_array[srbidx].SegmentX); } } @@ -6045,7 +6069,7 @@ PSGE0 ptr; //printk ("DC395x: Alloc %i pages for SG tables\n", pages); while (pages--) { - ptr = (PSGE0)kmalloc (PAGE_SIZE, GFP_KERNEL); + ptr = (PSGE0) KMALLOC (PAGE_SIZE, GFP_KERNEL); if (!ptr) { DC395x_free_SG_tables (pACB, SRBIdx); return 1; @@ -6860,7 +6884,7 @@ UINT io_port; #ifndef USE_NEW_EH - DWORD flags; + //DWORD flags; //DC395x_LOCK_IO; // Don't lock for new EH #endif @@ -6985,7 +7009,7 @@ printk ("DC395x: ERROR! No DCB existent for %02i-%i ?\n", cmd->target, cmd->lun); } - kfree (cmd); + KFREE (cmd); }; /* Perform INQUIRY */ @@ -6993,7 +7017,7 @@ { char* buffer; Scsi_Cmnd* cmd; - cmd = kmalloc (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC); + cmd = KMALLOC (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC); if (!cmd) { printk ("DC395x: kmalloc failed in inquiry!\n"); return; }; buffer = (char*)cmd + sizeof(Scsi_Cmnd); @@ -7629,8 +7653,7 @@ nDCB = pDCB->pNextDCB; DCBDEBUG(printk (KERN_INFO "DC395x: Free DCB (ID %i, LUN %i): %p\n",\ pDCB->TargetID, pDCB->TargetLUN, pDCB);) - DC395x_remove_dev (pACB, pDCB); - kfree (pDCB); + DC395x_remove_dev (pACB, pDCB); // includes a KFREE (pDCB); printk ("."); pDCB = nDCB; } while (pDCB && pACB->pLinkDCB); Index: dc395x_trm.h =================================================================== RCS file: /home/cvsroot/dc395/dc395x_trm.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- dc395x_trm.h 2002/04/24 00:03:00 1.40 +++ dc395x_trm.h 2002/05/10 17:17:53 1.41 @@ -8,7 +8,7 @@ ** ********************************************************************** */ -/* $Id: dc395x_trm.h,v 1.40 2002/04/24 00:03:00 garloff Exp $ */ +/* $Id: dc395x_trm.h,v 1.41 2002/05/10 17:17:53 garloff Exp $ */ /* ***************************************************** ** Tekram TRM_S1040 for DC395x driver, header file @@ -20,7 +20,7 @@ #include #define DC395x_BANNER "Tekram DC395U/UW/F DC315/U" -#define DC395x_VERSION "1.39, 2002-04-24" +#define DC395x_VERSION "1.40, 2002-05-10" /* Kernel version autodetection */ #include