Index: dc390/2035-scsi-singlelun.diff =================================================================== RCS file: 2035-scsi-singlelun.diff diff -N 2035-scsi-singlelun.diff --- /tmp/30986aaa Fri Dec 25 19:04:41 1998 +++ /dev/null Mon Dec 22 21:49:24 1997 @@ -1,45 +0,0 @@ -From: Edgar Toernig -Subject: [PATCH] 2.0.35 scsi.c single_lun flag - -Hi, - -as I (or better Derrick) noticed, the fix for the single_lun flag never -made it to the 2.0 kernels. It's already present in the 2.1 kernels -since 2.1.75 and in my 2.0 kernel for over a year now. - -This patch is required by some CD-changers. Without it, you may get -spurious scsi lockups when accessing multiple LUNs at the same time. - -Ciao, ET. - ---- /usr/src/linux-2.0.35/drivers/scsi/scsi.c.orig Fri Aug 7 02:21:37 1998 -+++ /usr/src/linux-2.0.35/drivers/scsi/scsi.c Fri Aug 7 02:24:12 1998 -@@ -750,6 +750,13 @@ - SDpnt->borken = 0; - -+ /* -+ * If we want to only allow I/O to one of the luns attached to this device -+ * at a time, then we set this flag. -+ */ -+ if (bflags & BLIST_SINGLELUN) -+ SDpnt->single_lun = 1; -+ - /* - * These devices need this "key" to unlock the devices so we can use it - */ - if ((bflags & BLIST_KEY) != 0) { -@@ -790,13 +797,6 @@ - */ - if (bflags & BLIST_NOLUN) - return 0; /* break; */ - -- /* -- * If we want to only allow I/O to one of the luns attached to this device -- * at a time, then we set this flag. -- */ -- if (bflags & BLIST_SINGLELUN) -- SDpnt->single_lun = 1; -- - /* - * If this device is known to support sparse multiple units, override the - Index: dc390/README.tmscsim =================================================================== RCS file: /usr/local/cvsroot/dc390/README.tmscsim,v retrieving revision 2.6 retrieving revision 2.9 diff -u -r2.6 -r2.9 --- README.tmscsim 1998/11/27 15:38:08 2.6 +++ README.tmscsim 1998/12/25 18:04:20 2.9 @@ -45,7 +45,8 @@ 1.12, then 1.20a to 1.20t. Finally I decided to use the ncr53c8xx scheme. So the next revisions will be 2.0a to 2.0X (stable), 2.1a to 2.1X (experimental), 2.2a to 2.2X (stable, again) etc. (X = anything between a and z.) If I send -fixes to people for testing, those will have a digit appended, e.g. 2.0a1. +fixes to people for testing, I create intermediate versions with a digit +appended, e.g. 2.0c3. 2. Installation @@ -56,32 +57,36 @@ support into your kernel or as module when configuring your kernel for compiling. -If you got an older kernel with an old version of this driver included, you -should copy the files (dc390.h, tmscsim.h, tmscsim.c, scsiiom.c and -README.tmscsim) from this directory to linux/drivers/scsi. You have to -recompile your kernel/module of course. - -You should apply the three patches included in dc390-20-kernel.diff -(Applying them: cd /usr/src; patch -p0 <~/dc390-20-kernel.diff) -The patches are against 2.1.103, so you might have to manually resolve -rejections when applying to another kernel version. - -The patches will update the kernel startup code to allow boot parameters to -be passed to the driver, update the Documentation and finally offer you the -possibility to omit the non-DC390 parts of the driver. -(By selecting "Omit support for non DC390" you basically disable the -emulation of a DC390 EEPROM for non DC390 adapters. This saves a few bytes -of memory.) + If you got an old kernel (pre 2.1.127, pre 2.0.37p1) with an old version of + this driver: Get dc390-21125-20b.diff.gz or dc390-2036p21-20b1.diff.gz from + my website and apply the patch. + + If you want to do it manually, you should copy the files (dc390.h, + tmscsim.h, tmscsim.c, scsiiom.c and README.tmscsim) from this directory to + linux/drivers/scsi. You have to recompile your kernel/module of course. + + You should apply the three patches included in dc390-120-kernel.diff + (Applying them: cd /usr/src; patch -p0 <~/dc390-120-kernel.diff) + The patches are against 2.1.125, so you might have to manually resolve + rejections when applying to another kernel version. + + The patches will update the kernel startup code to allow boot parameters to + be passed to the driver, update the Documentation and finally offer you the + possibility to omit the non-DC390 parts of the driver. + (By selecting "Omit support for non DC390" you basically disable the + emulation of a DC390 EEPROM for non DC390 adapters. This saves a few bytes + of memory.) If you got a very old kernel without the tmscsim driver (pre 2.0.31) I recommend upgrading your kernel. However, if you don't want to, please contact me to get the appropriate patches. -Testing a SCSI driver is always a delicate thing to do. The 2.0 driver has + +Upgrading a SCSI driver is always a delicate thing to do. The 2.0 driver has proven stable on many systems, but it's still a good idea to take some precautions. In an ideal world you would have a full backup of your disks. The world isn't ideal and most people don't have full backups (me neither). -So take at least the following two measures: +So take at least the following measures: * make your kernel remount the FS read-only on detecting an error: tune2fs -e remount-ro /dev/sd?? * have copies of your SCSI disk's partition tables on some safe location: @@ -104,18 +109,19 @@ 3.Features ---------- - SCSI - * Tagged queueing + * Tagged command queueing * Sync speed up to 10 MHz * Disconnection * Multiple LUNs - General / Linux interface - * Support for up to 4 adapters. + * Support for up to 4 AM53C974 adapters. * DC390 EEPROM usage or boot/module params * Information via cat /proc/scsi/tmscsim/? * Dynamically configurable by writing to /proc/scsi/tmscsim/? * Dynamic allocation of resources - * SMP support: Adapter specific locks (Linux 2.1.x) + * SMP support: Locking on io_request lock (Linux 2.1/2.2) or adapter + specific locks (Linux 2.3) * Uniform source code for Linux-2.x.y * Support for dyn. addition/removal of devices via add/remove-single-device (Try: echo "scsi add-single-device H C I L" >/proc/scsi/scsi @@ -337,8 +343,7 @@ Further investigation on these problems: -* Driver crashes with sync readcdda (xcdroast) (most probably VIA PCI error) -* TagQ and Disconnection (Resel: SRB Tag Selection) (most probably no problem) +* Driver hangs with sync readcdda (xcdroast) (most probably VIA PCI error) Known problems: @@ -362,12 +367,9 @@ Richard Waltham or Doug Ledford , if you want to help further debugging it. * 2.0.35: CD changers (e.g. NAKAMICHI MBR-7.{0,2}) have problems because - the mid-level code doesn't handle BLIST_SINGLELUN correctly. Apply - the patch 2035-scsi-singlelun.diff. Thanks to Chiaki Ishikawa. - I was told that this fix will be in 2.0.36, so you don't need it for - 2.0.36. -[The patch file is contained in the dc390-XXX.tar.gz files which can be found -on the ftp server. See below.] + the mid-level code doesn't handle BLIST_SINGLELUN correctly. There used + to be a patch included here to fix this, but I was told that it is fixed + in 2.0.36. 7. Bug reports, debugging and updates @@ -379,7 +381,7 @@ Please append the output of /proc/scsi/scsi, /proc/scsi/tmscsim/? and maybe the DC390 log messages to the report. -Bug reports should be send to me (Kurt Garloff ) as well +Bug reports should be send to me (Kurt Garloff ) as well as to the linux-scsi list (), as sometimes bugs are caused by the SCSI mid-level code. @@ -391,7 +393,10 @@ having your box spending most of its time doing the logging. The latest version of the driver can be found at: -ftp://student.physik.uni-dortmund.de/pub/linux/kernel/dc390/ + http://www.garloff.de/kurt/linux/dc390/ +and + ftp://student.physik.uni-dortmund.de/pub/linux/kernel/dc390/ +(The latter might shut down some day.) 8. Acknowledgements @@ -408,6 +413,6 @@ ------------------------------------------------------------------------- -Written by Kurt Garloff 1998/06/11 -Last updated 1998/11/27, driver revision 2.0c1 -$Id: README.tmscsim,v 2.6 1998/11/27 15:38:08 garloff Exp $ +Written by Kurt Garloff 1998/06/11 +Last updated 1998/12/25, driver revision 2.0d +$Id: README.tmscsim,v 2.9 1998/12/25 18:04:20 garloff Exp $ Index: dc390/dc390-120-kernel.diff =================================================================== RCS file: /usr/local/cvsroot/dc390/dc390-120-kernel.diff,v retrieving revision 2.2 retrieving revision 2.3 diff -u -r2.2 -r2.3 --- dc390-120-kernel.diff 1998/10/24 10:14:54 2.2 +++ dc390-120-kernel.diff 1998/12/25 18:04:20 2.3 @@ -1,6 +1,6 @@ # dc390-kernel.diff # patches against 2.1.125 kernel for DC390/AM53C974 driver integration -# $Id: dc390-120-kernel.diff,v 2.2 1998/10/24 10:14:54 garloff Exp $ # +# $Id: dc390-120-kernel.diff,v 2.3 1998/12/25 18:04:20 garloff Exp $ # 8<---------------------------------------------------------------------- Patch for allowing omission of the non DC390 parts of the driver: @@ -118,8 +118,8 @@ +DC390/AM53C974 SCSI driver +P: Kurt Garloff -+M: K.Garloff@ping.de -+W: ftp://student.physik.uni-dortmund.de/pub/linux/kernel/dc390/ ++M: kurt@garloff.de ++W: http://www.garloff.de/kurt/linux/dc390 +S: Maintained + DECnet NETWORK LAYER Index: dc390/dc390.h =================================================================== RCS file: /usr/local/cvsroot/dc390/dc390.h,v retrieving revision 2.11 retrieving revision 2.12 diff -u -r2.11 -r2.12 --- dc390.h 1998/12/01 14:42:21 2.11 +++ dc390.h 1998/12/25 17:33:27 2.12 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390(T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: dc390.h,v 2.11 1998/12/01 14:42:21 garloff Exp $ */ +/* $Id: dc390.h,v 2.12 1998/12/25 17:33:27 garloff Exp $ */ #include @@ -16,7 +16,7 @@ #define DC390_H #define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.0c4 1998/12/01" +#define DC390_VERSION "2.0d 1998/12/25" #if defined(HOSTS_C) || defined(MODULE) Index: dc390/scsiiom.c =================================================================== RCS file: /usr/local/cvsroot/dc390/scsiiom.c,v retrieving revision 2.14 retrieving revision 2.15 diff -u -r2.14 -r2.15 --- scsiiom.c 1998/12/01 15:01:36 2.14 +++ scsiiom.c 1998/12/25 17:33:27 2.15 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390 (T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: scsiiom.c,v 2.14 1998/12/01 15:01:36 garloff Exp $ */ +/* $Id: scsiiom.c,v 2.15 1998/12/25 17:33:27 garloff Exp $ */ UCHAR dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB ) @@ -276,15 +276,7 @@ DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus);) if( !pACB ) { DC390_UNLOCK_DRV; return; }; -#ifdef DC390_POLL_IRQ - if (pACB->Ignore_IRQ) - { - DEBUG0 (printk (KERN_INFO "DC390: Ignore IRQ in polling mode!\n");) - DC390_UNLOCK_DRV; - return; - }; -#endif - + #if DMA_INT DC390_LOCK_IO; DC390_LOCK_ACB; @@ -753,12 +745,7 @@ /* The old code handled it in another way, indicating, that on * every message byte an IRQ is generated and every byte has to * be manually ACKed. Hmmm ? (KG, 98/11/28) */ -/* Probably the old implementation was correct. Sigh! */ -/* If we wanted to increase performance by not requiring more IRQs, - * we should try to do something as ugly as the AM53C974 driver's - * poll_int (). There are SMP issues, which make this even more ugly. - * (In my view, the AM53C974 isn't SMP-safe, here.) */ - +/* The old implementation was correct. Sigh! */ /* Check if the message is complete */ static UCHAR __inline__ @@ -775,45 +762,6 @@ } -#ifdef DC390_POLL_IRQ - -/* Poll IRQ (!!!) */ -static UCHAR -dc390_poll_irq (PACB pACB) -{ - int ctr; - pACB->Ignore_IRQ = 1; /* UGLY */ - for (ctr = 0xa000; ctr; ctr--) - if (DC390_read8 (Scsi_Status) & INTERRUPT) break; - DEBUG0 (printk(KERN_INFO "DC390: Poll IRQ (ctr=%i).\n", ctr);) - - if (!ctr) - printk (KERN_WARNING "DC390: Timeout in polling IRQ!\n"); - else - DC390_read8 (INT_Status); // clear IRQ - - pACB->Ignore_IRQ = 0; - return (ctr? 1: 0); -}; - -/* Poll (!!!) the remaining message bytes */ -static void -dc390_MsgIn_get_remain (PACB pACB, PSRB pSRB) -{ - while (! dc390_MsgIn_complete (pSRB->MsgInBuf, pACB->MsgLen) ) - { - //DC390_read8 (INT_Status); /* clear pending IRQ */ - DC390_write8 (ScsiCmd, MSG_ACCEPTED_CMD); - if (!dc390_poll_irq (pACB)) break; - DC390_write8 (ScsiCmd, INFO_XFER_CMD); - if (dc390_poll_irq (pACB)) - pSRB->MsgInBuf[pACB->MsgLen++] = DC390_read8 (ScsiFifo); - else break; - }; -}; - -#endif /* DC390_POLL_IRQ */ - /* read and eval received messages */ void @@ -824,10 +772,6 @@ /* Read the msg */ pSRB->MsgInBuf[pACB->MsgLen++] = DC390_read8 (ScsiFifo); -#ifdef DC390_POLL_IRQ - dc390_MsgIn_get_remain (pACB, pSRB); -#endif - //pSRB->SRBState = 0; /* Msg complete ? */ Index: dc390/tmscsim.c =================================================================== RCS file: /usr/local/cvsroot/dc390/tmscsim.c,v retrieving revision 2.14 retrieving revision 2.16 diff -u -r2.14 -r2.16 --- tmscsim.c 1998/12/01 15:01:36 2.14 +++ tmscsim.c 1998/12/25 17:54:44 2.16 @@ -7,9 +7,9 @@ ***********************************************************************/ /* (C) Copyright: put under GNU GPL in 10/96 * *************************************************************************/ -/* $Id: tmscsim.c,v 2.14 1998/12/01 15:01:36 garloff Exp $ */ +/* $Id: tmscsim.c,v 2.16 1998/12/25 17:54:44 garloff Exp $ */ /* Enhancements and bugfixes by * - * Kurt Garloff * + * Kurt Garloff * ***********************************************************************/ /* HISTORY: * * * @@ -94,25 +94,14 @@ * Disallow illegal idx in INQUIRY/REMOVE * * 2.0c 98/11/19 KG Cleaned up detect/init for SMP boxes, * * Write Erase DMA (1.20t) caused problems * - * 2.0c1 98/11/27 KG Rewrote Message In: Read all bytes w/o * - * needing more interrupts. Fixed handling * - * of target initiated SDTR. Fixed bug * - * which prevented msg rejection. * - * 2.0c2 98/11/28 KG POINTER messages should be ignored * - * rather than rejected. * - * 2.0c3 98/11/28 KG It seems (in contr. to docu), that every* - * Msg byte generates an IRQ and has to be * - * ACKed. Answer with SDTR to SDTR. * - * Optional polling for multibyte msgs. * - * 2.0c4 98/12/01 KG Optional Polling should work now. * + * 2.0d 98/12/25 KG Christmas release ;-) Message handling * + * competely reworked. Handle target ini- * + * tiated SDTR correctly. * ***********************************************************************/ /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */ #define DC390_IRQ SA_SHIRQ /* | SA_INTERRUPT */ -/* Reading multibyte messages without generating additional IRQs */ -//#define DC390_POLL_IRQ - /* DEBUG options */ //#define DC390_DEBUG0 //#define DC390_DEBUG1 @@ -1279,7 +1268,7 @@ DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT); PDEVSET1; PCI_READ_CONFIG_WORD(PDEV, PCI_STATUS, &pstat); printk ("DC390: Register dump: PCI Status: %04x\n", pstat); - printk ("DC390: Please report driver trouble to K.Garloff@ping.de\n"); + printk ("DC390: In case of driver trouble read linux/drivers/scsi/README.tmscsim\n"); }; Index: dc390/tmscsim.h =================================================================== RCS file: /usr/local/cvsroot/dc390/tmscsim.h,v retrieving revision 2.3 retrieving revision 2.4 diff -u -r2.3 -r2.4 --- tmscsim.h 1998/11/28 11:33:30 2.3 +++ tmscsim.h 1998/12/25 17:33:27 2.4 @@ -3,7 +3,7 @@ ;* TEKRAM DC-390(T) PCI SCSI Bus Master Host Adapter * ;* Device Driver * ;***********************************************************************/ -/* $Id: tmscsim.h,v 2.3 1998/11/28 11:33:30 garloff Exp $ */ +/* $Id: tmscsim.h,v 2.4 1998/12/25 17:33:27 garloff Exp $ */ #ifndef _TMSCSIM_H #define _TMSCSIM_H @@ -217,7 +217,7 @@ UCHAR glitch_cfg; UCHAR MsgLen; -UCHAR Ignore_IRQ; +UCHAR Ignore_IRQ; /* Not used */ PDEVDECL1; /* Pointer to PCI cfg. space */ /* 0x40/0x3c: */