## Automatically generated incremental diff
## From:   linux-2.2.19-pre3
## To:     linux-2.2.19-pre4
## Robot:  $Id: make-incremental-diff,v 1.6 2001/12/04 04:41:15 hpa Exp $

diff -urN linux-2.2.19-pre3/Documentation/Changes linux/Documentation/Changes
--- linux-2.2.19-pre3/Documentation/Changes	Mon Dec  3 20:54:06 2001
+++ linux/Documentation/Changes	Mon Dec  3 20:54:39 2001
@@ -521,31 +521,6 @@
 ====================
 
 A driver has been added to allow updating of Intel IA32 microcode,
-accessible as a misc character device.  If you have not done so already
-you might want to:
-
-mkdir /dev/cpu
-mknod /dev/cpu/microcode c 10 184
-chmod 0644 /dev/cpu/microcode
-
-as root before you can use this.  You'll probably also want to
-get the user-space microcode_ctl utility to use with this.  The utility is
-available at:
-
-http://www.urbanmyth.org/microcode
-
-If you have compiled the driver as a module you may need to add
-the following line:
-
-alias char-major-10-184 microcode
-
-to your /etc/modules.conf file.
-
-
-Intel IA32 microcode
-====================
-
-A driver has been added to allow updating of Intel IA32 microcode,
 accessible as both a devfs regular file and as a normal (misc)
 character device.  If you are not using devfs you may need to:
 
diff -urN linux-2.2.19-pre3/Documentation/devices.txt linux/Documentation/devices.txt
--- linux-2.2.19-pre3/Documentation/devices.txt	Wed May  3 17:16:30 2000
+++ linux/Documentation/devices.txt	Mon Dec  3 20:54:39 2001
@@ -1,8 +1,8 @@
 
 		       LINUX ALLOCATED DEVICES
-	     Maintained by H. Peter Anvin <hpa@zytor.com>
+	     Maintained by H. Peter Anvin <device@lanana.org>
 
-		     Last revised: March 23, 2000
+		   Last revised: December 29, 2000
 
 This list is the Linux Device List, the official registry of allocated
 device numbers and /dev directory nodes for the Linux operating
@@ -37,7 +37,7 @@
 reply.
 
 
-     **** PLEASE READ THIS BEFORE SUBMITTING A DEVICE ENTRY ****
+	  **** DEVICE DRIVERS AUTHORS PLEASE READ THIS ****
 
 To have a major number allocated, or a minor number in situations
 where that applies (e.g. busmice), please contact me with the
@@ -45,24 +45,32 @@
 information regarding any of the devices listed below, or if I have
 made a mistake, I would greatly appreciate a note.
 
-I do, however, make two requests about the nature of your report.
+I do, however, make a few requests about the nature of your report.
 This is necessary for me to be able to keep this list up to date and
-correct in a timely manner.  First of all, *please* include the word
-"device" in the subject so your mail won't accidentally get buried!  I
-receive hundreds of email messages a day, so mail sent with other
-subjects may very well get lost in the avalanche.
+correct in a timely manner.  First of all, *please* send it to the
+correct address... <device@lanana.org>.  I receive hundreds of email
+messages a day, so mail sent to other addresses may very well get lost
+in the avalanche.  Please put in a descriptive subject, so I can find
+your mail again should I need to.  Too many people send me email
+saying just "device number request" in the subject.
 
 Second, please include a description of the device *in the same format
 as this list*.	The reason for this is that it is the only way I have
 found to ensure I have all the requisite information to publish your
 device and avoid conflicts.
 
+Third, please don't assume that the distributed version of the list is
+up to date.  Due to the number of registrations I have to maintain it
+in "batch mode", so there is likely additional registrations that
+haven't been listed yet.
+
 Finally, sometimes I have to play "namespace police."  Please don't be
 offended.  I often get submissions for /dev names that would be bound
 to cause conflicts down the road.  I am trying to avoid getting in a
 situation where we would have to suffer an incompatible forward
-change.
-
+change.  Therefore, please consult with me *before* you make your
+device names and numbers in any way public, at least to the point
+where it would be at all difficult to get them changed.
 
 Your cooperation is appreciated.
 
@@ -80,16 +88,18 @@
 		  7 = /dev/full		Returns ENOSPC on write
 		  8 = /dev/random	Nondeterministic random number gen.
 		  9 = /dev/urandom	Faster, less secure random number gen.
+		 10 = /dev/aio		Asyncronous I/O notification interface
     block	RAM disk
 		  0 = /dev/ram0		First RAM disk
+		  1 = /dev/ram1		Second RAM disk
 		    ...
-		  7 = /dev/ram7		Eighth RAM disk
-		250 = /dev/initrd	Initial RAM disk
+		250 = /dev/initrd	Initial RAM disk {2.6}
 
 		Older kernels had /dev/ramdisk (1, 1) here.
 		/dev/initrd refers to a RAM disk which was preloaded
-		by the boot loader.
-		    
+		by the boot loader; newer kernels use /dev/ram0 for
+		the initrd.
+
   2 char	Pseudo-TTY masters
 		  0 = /dev/ptyp0	First PTY master
 		  1 = /dev/ptyp1	Second PTY master
@@ -200,6 +210,8 @@
 		    ...
 		255 = /dev/ttyS191	192nd UART serial port
 
+		UART serial ports refer to 8250/16450/16550 series devices.
+
 		Older versions of the Linux kernel used this major
 		number for BSD PTY devices.  As of Linux 2.1.115, this
 		is no longer supported.	 Use major numbers 2 and 3.
@@ -311,6 +323,8 @@
 		 10 = /dev/adbmouse	Apple Desktop Bus mouse
 		 11 = /dev/vrtpanel	Vr41xx embedded touch panel
 		 13 = /dev/vpcmouse	Connectix Virtual PC Mouse
+		 14 = /dev/touchscreen/ucb1x00  UCB 1x00 touchscreen
+		 15 = /dev/touchscreen/mk712	MK712 touchscreen
 		128 = /dev/beep		Fancy beep device
 		129 = /dev/modreq	Kernel module load request {2.6}
 		130 = /dev/watchdog	Watchdog timer port
@@ -322,7 +336,7 @@
 		139 = /dev/openprom	SPARC OpenBoot PROM
 		140 = /dev/relay8	Berkshire Products Octal relay card
 		141 = /dev/relay16	Berkshire Products ISO-16 relay card
-		142 = /dev/msr		x86 model-specific registers
+		142 = /dev/msr		x86 model-specific registers {2.6}
 		143 = /dev/pciconf	PCI configuration space
 		144 = /dev/nvram	Non-volatile configuration RAM
 		145 = /dev/hfmodem	Soundcard shortwave modem control {2.6}
@@ -364,6 +378,26 @@
 		182 = /dev/perfctr	Performance-monitoring counters
 		183 = /dev/intel_rng	Intel i8x0 random number generator
 		184 = /dev/cpu/microcode CPU microcode update interface
+		186 = /dev/atomicps	Atomic shapshot of process state data
+		187 = /dev/irnet	IrNET device
+		188 = /dev/smbusbios	SMBus BIOS
+		189 = /dev/ussp_ctl	User space serial port control
+		190 = /dev/crash	Mission Critical Linux crash dump facility
+		191 = /dev/pcl181	<information missing>
+		192 = /dev/nas_xbus	NAS xbus LCD/buttons access
+		193 = /dev/d7s		SPARC 7-segment display
+		194 = /dev/zkshim	Zero-Knowledge network shim control
+		195 = /dev/elographics/e2201	Elographics touchscreen E271-2201
+		198 = /dev/sexec	Signed executable interface
+		199 = /dev/scanners/cuecat :CueCat barcode scanner
+		200 = /dev/net/tun	TAP/TUN network device
+		201 = /dev/button/gulpb	Transmeta GULP-B buttons
+		204 = /dev/video/em8300	    EM8300 DVD decoder control
+		205 = /dev/video/em8300_mv  EM8300 DVD decoder video
+		206 = /dev/video/em8300_ma  EM8300 DVD decoder audio
+		207 = /dev/video/em8300_sp  EM8300 DVD decoder subpicture
+		208 = /dev/compaq/cpqphpc Compaq PCI Hot Plug Controller
+		209 = /dev/compaq/cpqrid  Compaq Remote Insight Driver
 		240-255			Reserved for local use
 
  11 char	Raw keyboard device
@@ -902,29 +936,62 @@
 		  0 = /dev/ttyL0	First RISCom port
 		  1 = /dev/ttyL1	Second RISCom port
 		    ...
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; first controller
+		  0 = /dev/rd/c0d0	First disk, whole disk
+		  8 = /dev/rd/c0d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c0d15	16th disk, whole disk
+
+		For partitions add:
+		  0 = /dev/rd/c?d?	Whole disk
+		  1 = /dev/rd/c?d?p1	First partition
+		    ...
+		  7 = /dev/rd/c?d?p7	Seventh partition
 
  49 char	SDL RISCom serial card - alternate devices
 		  0 = /dev/cul0		Callout device for ttyL0
 		  1 = /dev/cul1		Callout device for ttyL1
 		    ...
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; second controller
+		  0 = /dev/rd/c1d0	First disk, whole disk
+		  8 = /dev/rd/c1d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c1d15	16th disk, whole disk
+
+		Partitions are handled as for major 48.
 
  50 char	Reserved for GLINT
-    block	Reserved for Mylex DAC960 PCI RAID controller
+
+    block	Mylex DAC960 PCI RAID controller; third controller
+		  0 = /dev/rd/c2d0	First disk, whole disk
+		  8 = /dev/rd/c2d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c2d15	16th disk, whole disk
 
  51 char	Baycom radio modem
 		  0 = /dev/bc0		First Baycom radio modem
 		  1 = /dev/bc1		Second Baycom radio modem
 		    ...
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; fourth controller
+		  0 = /dev/rd/c3d0	First disk, whole disk
+		  8 = /dev/rd/c3d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c3d15	16th disk, whole disk
+
+		Partitions are handled as for major 48.
 
  52 char	Spellcaster DataComm/BRI ISDN card
 		  0 = /dev/dcbri0	First DataComm card
 		  1 = /dev/dcbri1	Second DataComm card
 		  2 = /dev/dcbri2	Third DataComm card
 		  3 = /dev/dcbri3	Fourth DataComm card
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; fifth controller
+		  0 = /dev/rd/c4d0	First disk, whole disk
+		  8 = /dev/rd/c4d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c4d15	16th disk, whole disk
+
+		Partitions are handled as for major 48.
 
  53 char	BDM interface for remote debugging MC683xx microcontrollers
 		  0 = /dev/pd_bdm0	PD BDM interface on lp0
@@ -940,7 +1007,13 @@
 		Domain Interface and ICD is the commercial interface
 		by P&E.
 
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; sixth controller
+		  0 = /dev/rd/c5d0	First disk, whole disk
+		  8 = /dev/rd/c5d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c5d15	16th disk, whole disk
+
+		Partitions are handled as for major 48.
 
  54 char	Electrocardiognosis Holter serial card
 		  0 = /dev/holter0	First Holter port
@@ -951,11 +1024,23 @@
 		<mseritan@ottonel.pub.ro> to transfer data from Holter
 		24-hour heart monitoring equipment.
 
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; seventh controller
+		  0 = /dev/rd/c6d0	First disk, whole disk
+		  8 = /dev/rd/c6d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c6d15	16th disk, whole disk
+
+		Partitions are handled as for major 48.
 
  55 char	DSP56001 digital signal processor
 		  0 = /dev/dsp56k	First DSP56001
-    block	Reserved for Mylex DAC960 PCI RAID controller
+    block	Mylex DAC960 PCI RAID controller; eigth controller
+		  0 = /dev/rd/c7d0	First disk, whole disk
+		  8 = /dev/rd/c7d1	Second disk, whole disk
+		    ...
+		248 = /dev/rd/c7d15	16th disk, whole disk
+
+		Partitions are handled as for major 48.
 
  56 char	Apple Desktop Bus
 		  0 = /dev/adb		ADB bus control
@@ -1002,6 +1087,8 @@
 		running small fs translation drivers) through serial /
 		IRDA / parallel links.
 
+		NAMING CONFLICT -- PROPOSED REVISED NAME /dev/rpda0 etc
+
  60-63		LOCAL/EXPERIMENTAL USE
 		Allocated for local/experimental use.  For devices not
 		assigned official numbers, these ranges should be
@@ -1176,6 +1263,16 @@
 		    ...
 		255 = /dev/cuf255	Callout device for ttyF255
 
+    block	Compaq Intelligent Drive Array, first controller
+		  0 = /dev/ida/c0d0	First logical drive whole disk
+		 16 = /dev/ida/c0d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c0d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
  73 char	Computone IntelliPort II serial card - control devices
 		  0 = /dev/ip2ipl0	Loadware device for board 0
 		  1 = /dev/ip2stat0	Status device for board 0
@@ -1186,6 +1283,16 @@
 		 12 = /dev/ip2ipl3	Loadware device for board 3
 		 13 = /dev/ip2stat3	Status device for board 3
 
+    block	Compaq Intelligent Drive Array, second controller
+		  0 = /dev/ida/c1d0	First logical drive whole disk
+		 16 = /dev/ida/c1d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c1d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
  74 char	SCI bridge
 		  0 = /dev/SCI/0	SCI device 0
 		  1 = /dev/SCI/1	SCI device 1
@@ -1194,6 +1301,16 @@
 		Currently for Dolphin Interconnect Solutions' PCI-SCI
 		bridge.
 
+    block	Compaq Intelligent Drive Array, third controller
+		  0 = /dev/ida/c2d0	First logical drive whole disk
+		 16 = /dev/ida/c2d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c2d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
  75 char	Specialix IO8+ serial card
 		  0 = /dev/ttyW0	First IO8+ port, first card
 		  1 = /dev/ttyW1	Second IO8+ port, first card
@@ -1201,6 +1318,16 @@
 		  8 = /dev/ttyW8	First IO8+ port, second card
 		    ...
 
+    block	Compaq Intelligent Drive Array, fourth controller
+		  0 = /dev/ida/c3d0	First logical drive whole disk
+		 16 = /dev/ida/c3d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c3d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
  76 char	Specialix IO8+ serial card - alternate devices
 		  0 = /dev/cuw0		Callout device for ttyW0
 		  1 = /dev/cuw1		Callout device for ttyW1
@@ -1208,19 +1335,63 @@
 		  8 = /dev/cuw8		Callout device for ttyW8
 		    ...
 
+    block	Compaq Intelligent Drive Array, fifth controller
+		  0 = /dev/ida/c4d0	First logical drive whole disk
+		 16 = /dev/ida/c4d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c4d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
+
  77 char	ComScire Quantum Noise Generator
 		  0 = /dev/qng		ComScire Quantum Noise Generator
 
+    block	Compaq Intelligent Drive Array, sixth controller
+		  0 = /dev/ida/c5d0	First logical drive whole disk
+		 16 = /dev/ida/c5d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c5d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
+
  78 char	PAM Software's multimodem boards
 		  0 = /dev/ttyM0	First PAM modem
 		  1 = /dev/ttyM1	Second PAM modem
 		    ...
 
+    block	Compaq Intelligent Drive Array, seventh controller
+		  0 = /dev/ida/c6d0	First logical drive whole disk
+		 16 = /dev/ida/c6d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c6d15	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
+
  79 char	PAM Software's multimodem boards - alternate devices
 		  0 = /dev/cum0		Callout device for ttyM0
 		  1 = /dev/cum1		Callout device for ttyM1
 		    ...
 
+    block	Compaq Intelligent Drive Array, eigth controller
+		  0 = /dev/ida/c7d0	First logical drive whole disk
+		 16 = /dev/ida/c7d1	Second logical drive whole disk
+		    ...
+		240 = /dev/ida/c715	16th logical drive whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
+
  80 char	Photometrics AT200 CCD camera
 		  0 = /dev/at200	Photometrics AT200 CCD camera
 
@@ -1497,14 +1668,13 @@
 		  1 = /dev/parport1	Second parallel port
 		    ...
 
-100 char	POTS (analogue telephone) A/B port {2.6}
-		  0 = /dev/phone0	First telephone port
-		  1 = /dev/phone1	Second telephone port
-		    ...
+    block	JavaStation flash disk
+		  0 = /dev/jsfd		JavaStation flash disk
 
-		The names have been reallocated to Telephony For
-		Linux, major 159.  All use of major 100 should be
-		considered legacy and deprecated.
+100 char	Telephony for Linux
+		  0 = /dev/phone0	First telephony device
+		  1 = /dev/phone1	Second telephony device
+		    ...
 
 101 char	Motorola DSP 56xxx board
 		  0 = /dev/mdspstat	Status information
@@ -1512,6 +1682,19 @@
 		    ...
 		 16 = /dev/mdsp16	16th DSP board I/O controls
 
+    block	AMI HyperDisk RAID controller
+		  0 = /dev/amiraid/ar0	First array whole disk
+		 16 = /dev/amiraid/ar1	Second array whole disk
+		    ...
+		240 = /dev/amiraid/ar15	16th array whole disk
+
+		For each device, partitions are added as:
+		  0 = /dev/amiraid/ar?	  Whole disk
+		  1 = /dev/amiraid/ar?p1  First partition
+		  2 = /dev/amiraid/ar?p2  Second partition
+		    ...
+		 15 = /dev/amiraid/ar?p15 15th partition
+
 102 char	Philips SAA5249 Teletext signal decoder {2.6}
 		  0 = /dev/tlk0		First Teletext decoder
 		  1 = /dev/tlk1		Second Teletext decoder
@@ -1528,36 +1711,119 @@
 		to the arla announce mailing list by sending a mail to
 		<arla-announce-request@stacken.kth.se>.
 
+    block	Audit device
+		  0 = /dev/audit	Audit device
+
 104 char	Flash BIOS support
 
+    block	Compaq Next Generation Drive Array, first controller
+		  0 = /dev/cciss/c0d0	First logical drive, whole disk
+		 16 = /dev/cciss/c0d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c0d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 105 char	Comtrol VS-1000 serial controller
 		  0 = /dev/ttyV0	First VS-1000 port
 		  1 = /dev/ttyV1	Second VS-1000 port
 		    ...
 
+    block	Compaq Next Generation Drive Array, second controller
+		  0 = /dev/cciss/c1d0	First logical drive, whole disk
+		 16 = /dev/cciss/c1d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c1d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 106 char	Comtrol VS-1000 serial controller - alternate devices
 		  0 = /dev/cuv0		First VS-1000 port
 		  1 = /dev/cuv1		Second VS-1000 port
 		    ...
 
+    block	Compaq Next Generation Drive Array, third controller
+		  0 = /dev/cciss/c2d0	First logical drive, whole disk
+		 16 = /dev/cciss/c2d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c2d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 107 char	3Dfx Voodoo Graphics device
 		  0 = /dev/3dfx		Primary 3Dfx graphics device
 
+    block	Compaq Next Generation Drive Array, fourth controller
+		  0 = /dev/cciss/c3d0	First logical drive, whole disk
+		 16 = /dev/cciss/c3d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c3d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 108 char	Device independent PPP interface
 		  0 = /dev/ppp		Device independent PPP interface
 
+    block	Compaq Next Generation Drive Array, fifth controller
+		  0 = /dev/cciss/c4d0	First logical drive, whole disk
+		 16 = /dev/cciss/c4d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c4d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 109 char	Reserved for logical volume manager
 
+    block	Compaq Next Generation Drive Array, sixth controller
+		  0 = /dev/cciss/c5d0	First logical drive, whole disk
+		 16 = /dev/cciss/c5d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c5d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 110 char	miroMEDIA Surround board
 		  0 = /dev/srnd0	First miroMEDIA Surround board
 		  1 = /dev/srnd1	Second miroMEDIA Surround board
 		    ...
 
+    block	Compaq Next Generation Drive Array, seventh controller
+		  0 = /dev/cciss/c6d0	First logical drive, whole disk
+		 16 = /dev/cciss/c6d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c6d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 111 char	Philips SAA7146-based audio/video card {2.6}
 		  0 = /dev/av0		First A/V card
 		  1 = /dev/av1		Second A/V card
 		    ...
 
+    block	Compaq Next Generation Drive Array, eigth controller
+		  0 = /dev/cciss/c7d0	First logical drive, whole disk
+		 16 = /dev/cciss/c7d1	Second logical drive, whole disk
+		    ...
+		240 = /dev/cciss/c7d15	16th logical drive, whole disk
+
+		Partitions are handled the same way as for Mylex
+		DAC960 (see major number 48) except that the limit on
+		partitions is 15.
+
 112 char	ISI serial card
 		  0 = /dev/ttyM0	First ISI port
 		  1 = /dev/ttyM1	Second ISI port
@@ -1718,10 +1984,7 @@
 		  1 = /dev/gfax1	GammaLink channel 1
 		    ...
 
-159 char	Telephony for Linux
-		  0 = /dev/phone0	First telephony device
-		  1 = /dev/phone1	Second telephony device
-		    ...
+159		RESERVED
 
 160 char	General Purpose Instrument Bus (GPIB)
 		  0 = /dev/gpib0	First GPIB bus
@@ -1945,7 +2208,244 @@
 		240 = /dev/mvideo/status15	16th device 
 		    ...
 
-195-239		UNALLOCATED
+195 char	Nvidia graphics devices
+		  0 = /dev/nvidia0		First Nvidia card
+		  1 = /dev/nvidia1		Second Nvidia card
+		    ...
+		255 = /dev/nvidiactl		Nvidia card control device
+
+196-197		UNASSIGNED
+
+198 char	Total Impact TPMP2 quad coprocessor PCI card
+		  0 = /dev/tpmp2/0		First card
+		  1 = /dev/tpmp2/1		Second card
+		    ...
+
+199 char	Veritas volume manager (VxVM) volumes
+		  0 = /dev/vx/rdsk/*/*		First volume
+		  1 = /dev/vx/rdsk/*/*		Second volume
+		    ...
+    block	Veritas volume manager (VxVM) volumes
+		  0 = /dev/vx/dsk/*/*		First volume
+		  1 = /dev/vx/dsk/*/*		First volume
+		    ...
+
+		The namespace in these directories is maintained by
+		the user space VxVM software.
+
+200 char	Veritas VxVM configuration interface
+                  0 = /dev/vx/config		Configuration access node
+                  1 = /dev/vx/trace		Volume i/o trace access node
+                  2 = /dev/vx/iod		Volume i/o daemon access node
+                  3 = /dev/vx/info		Volume information access node
+                  4 = /dev/vx/task		Volume tasks access node
+                  5 = /dev/vx/taskmon		Volume tasks monitor daemon
+
+201 char	Veritas VxVM dynamic multipathing driver
+		  0 = /dev/vx/rdmp/*		First multipath device
+		  1 = /dev/vx/rdmp/*		Second multipath device
+		    ...
+    block	Veritas VxVM dynamic multipathing driver
+		  0 = /dev/vx/dmp/*		First multipath device
+		  1 = /dev/vx/dmp/*		Second multipath device
+		    ...
+
+		The namespace in these directories is maintained by
+		the user space VxVM software.
+
+202 char	CPU model-specific registers
+		  0 = /dev/cpu/0/msr		MSRs on CPU 0
+		  1 = /dev/cpu/1/msr		MSRs on CPU 1
+		    ...
+
+203 char	CPU CPUID information
+		  0 = /dev/cpu/0/cpuid		CPUID on CPU 0
+		  1 = /dev/cpu/1/cpuid		CPUID on CPU 1
+		    ...
+
+204 char	Low-density serial ports
+		  0 = /dev/ttyLU0		LinkUp Systems L72xx UART - port 0
+		  1 = /dev/ttyLU1		LinkUp Systems L72xx UART - port 1
+		  2 = /dev/ttyLU2		LinkUp Systems L72xx UART - port 2
+		  3 = /dev/ttyLU3		LinkUp Systems L72xx UART - port 3
+		  4 = /dev/ttyFB0		Intel Footbridge (ARM)
+		  5 = /dev/ttySA0		StrongARM builtin serial port 0
+		  6 = /dev/ttySA1		StrongARM builtin serial port 1
+		  7 = /dev/ttySA2		StrongARM builtin serial port 2
+		  8 = /dev/ttySC0		SCI serial port (SuperH) - port 0
+		  9 = /dev/ttySC1		SCI serial port (SuperH) - port 1
+		 10 = /dev/ttySC2		SCI serial port (SuperH) - port 2
+		 11 = /dev/ttySC3		SCI serial port (SuperH) - port 3
+		 12 = /dev/ttyFW0		Firmware console - port 0
+		 13 = /dev/ttyFW1		Firmware console - port 1
+		 14 = /dev/ttyFW2		Firmware console - port 2
+		 15 = /dev/ttyFW3		Firmware console - port 3
+		 16 = /dev/ttyAM0		ARM "AMBA" serial port 0
+		    ...
+		 31 = /dev/ttyAM15		ARM "AMBA" serial port 15
+
+205 char	Low-density serial ports (alternate device)
+		  0 = /dev/culu0		Callout device for ttyLU0
+		  1 = /dev/culu1		Callout device for ttyLU1
+		  2 = /dev/culu2		Callout device for ttyLU2
+		  3 = /dev/culu3		Callout device for ttyLU3
+		  4 = /dev/cufb0		Callout device for ttyFB0
+		  5 = /dev/cusa0		Callout device for ttySA0
+		  6 = /dev/cusa1		Callout device for ttySA1
+		  7 = /dev/cusa2		Callout device for ttySA2
+		  8 = /dev/cusc0		Callout device for ttySC0
+		  9 = /dev/cusc1		Callout device for ttySC1
+		 10 = /dev/cusc2		Callout device for ttySC2
+		 11 = /dev/cusc3		Callout device for ttySC3
+		 12 = /dev/cufw0		Callout device for ttyFW0
+		 13 = /dev/cufw1		Callout device for ttyFW1
+		 14 = /dev/cufw2		Callout device for ttyFW2
+		 15 = /dev/cufw3		Callout device for ttyFW3
+		 16 = /dev/cuam0		Callout device for ttyAM0
+		    ...
+		 31 = /dev/cuam15		Callout device for ttyAM15
+
+206 char	OnStream SC-x0 tape devices
+		  0 = /dev/osst0		First OnStream SCSI tape, mode 0
+		  1 = /dev/osst1		Second OnStream SCSI tape, mode 0
+		    ...
+		 32 = /dev/osst0l		First OnStream SCSI tape, mode 1
+		 33 = /dev/osst1l		Second OnStream SCSI tape, mode 1
+		    ...
+		 64 = /dev/osst0m		First OnStream SCSI tape, mode 2
+		 65 = /dev/osst1m		Second OnStream SCSI tape, mode 2
+		    ...
+		 96 = /dev/osst0a		First OnStream SCSI tape, mode 3
+		 97 = /dev/osst1a		Second OnStream SCSI tape, mode 3
+		    ...
+		128 = /dev/nosst0		No rewind version of /dev/osst0
+		129 = /dev/nosst1		No rewind version of /dev/osst1
+		    ...
+		160 = /dev/nosst0l		No rewind version of /dev/osst0l
+		161 = /dev/nosst1l		No rewind version of /dev/osst1l
+		    ...
+		192 = /dev/nosst0m		No rewind version of /dev/osst0m
+		193 = /dev/nosst1m		No rewind version of /dev/osst1m
+		    ...
+		224 = /dev/nosst0a		No rewind version of /dev/osst0a
+		225 = /dev/nosst1a		No rewind version of /dev/osst1a
+		    ...
+
+		The OnStream SC-x0 SCSI tapes do not support the
+		standard SCSI SASD command set and therefore need
+		their own driver "osst". Note that the IDE, USB (and
+		maybe ParPort) versions may be driven via ide-scsi or
+		usb-storage SCSI emulation and this osst device and
+		driver as well.  The ADR-x0 drives are QIC-157
+		compliant and don't need osst.
+
+207 char	Compaq ProLiant health feature indicate
+		  0 = /dev/cpqhealth/cpqw	Redirector interface
+		  1 = /dev/cpqhealth/crom	EISA CROM
+		  2 = /dev/cpqhealth/cdt	Data Table
+		  3 = /dev/cpqhealth/cevt	Event Log
+		  4 = /dev/cpqhealth/casr	Automatic Server Recovery
+		  5 = /dev/cpqhealth/cecc	ECC Memory
+		  6 = /dev/cpqhealth/cmca	Machine Check Architecture
+		  7 = /dev/cpqhealth/ccsm	Deprecated CDT
+		  8 = /dev/cpqhealth/cnmi	NMI Handling
+		  9 = /dev/cpqhealth/css	Sideshow Management
+		 10 = /dev/cpqhealth/cram	CMOS interface
+		 11 = /dev/cpqhealth/cpci	PCI IRQ interface
+
+208 char	User space serial ports
+		  0 = /dev/ttyU0		First user space serial port
+		  1 = /dev/ttyU1		Second user space serial port
+		    ...
+
+209 char	User space serial ports (alternate devices)
+		  0 = /dev/cuu0			Callout device for ttyU0
+		  1 = /dev/cuu1			Callout device for ttyU1
+		    ...
+
+210 char	SBE, Inc. sync/async serial card
+		  0 = /dev/sbei/wxcfg0		Configuration device for board 0
+		  1 = /dev/sbei/dld0		Download device for board 0
+		  2 = /dev/sbei/wan00		WAN device, port 0, board 0
+		  3 = /dev/sbei/wan01		WAN device, port 1, board 0
+		  4 = /dev/sbei/wan02		WAN device, port 2, board 0
+		  5 = /dev/sbei/wan03		WAN device, port 3, board 0
+		  6 = /dev/sbei/wanc00		WAN clone device, port 0, board 0
+		  7 = /dev/sbei/wanc01		WAN clone device, port 1, board 0
+		  8 = /dev/sbei/wanc02		WAN clone device, port 2, board 0
+		  9 = /dev/sbei/wanc03		WAN clone device, port 3, board 0
+		 10 = /dev/sbei/wxcfg1		Configuration device for board 1
+		 11 = /dev/sbei/dld1		Download device for board 1
+		 12 = /dev/sbei/wan10		WAN device, port 0, board 1
+		 13 = /dev/sbei/wan11		WAN device, port 1, board 1
+		 14 = /dev/sbei/wan12		WAN device, port 2, board 1
+		 15 = /dev/sbei/wan13		WAN device, port 3, board 1
+		 16 = /dev/sbei/wanc10		WAN clone device, port 0, board 1
+		 17 = /dev/sbei/wanc11		WAN clone device, port 1, board 1
+		 18 = /dev/sbei/wanc12		WAN clone device, port 2, board 1
+		 19 = /dev/sbei/wanc13		WAN clone device, port 3, board 1
+		    ...
+
+		Yes, each board is really spaced 10 (decimal) apart.
+
+211 char	Addinum CPCI1500 digital I/O card
+		  0 = /dev/addinum/cpci1500/0	First CPCI1500 card
+		  1 = /dev/addinum/cpci1500/1	Second CPCI1500 card
+		    ...
+
+216 char	USB BlueTooth devices
+		  0 = /dev/ttyUB0		First USB BlueTooth device
+		  1 = /dev/ttyUB1		Second USB BlueTooth device
+		    ...
+
+217 char	USB BlueTooth devices (alternate devices)
+		  0 = /dev/cuub0		Callout device for ttyUB0
+		  1 = /dev/cuub1		Callout device for ttyUB1
+		    ...
+
+218 char	The Logical Company bus Unibus/Qbus adapters
+		  0 = /dev/logicalco/bci/0	First bus adapter
+		  1 = /dev/logicalco/bci/1	First bus adapter
+		    ...
+
+219 char	The Logical Company DCI-1300 digital I/O card
+		  0 = /dev/logicalco/dci1300/0	First DCI-1300 card
+		  1 = /dev/logicalco/dci1300/1	Second DCI-1300 card
+		    ...
+
+220 char	Myricom Myrinet "GM" board
+		  0 = /dev/myricom/gm0		First Myrinet GM board
+		  1 = /dev/myricom/gmp0		First board "root access"
+		  2 = /dev/myricom/gm1		Second Myrinet GM board
+		  3 = /dev/myricom/gmp1		Second board "root access"
+		    ...
+
+221 char	VME bus
+		  0 = /dev/bus/vme/m0		First master image
+		  1 = /dev/bus/vme/m1		Second master image
+		  2 = /dev/bus/vme/m2		Third master image
+		  3 = /dev/bus/vme/m3		Fourth master image
+		  4 = /dev/bus/vme/s0		First slave image
+		  5 = /dev/bus/vme/s1		Second slave image
+		  6 = /dev/bus/vme/s2		Third slave image
+		  7 = /dev/bus/vme/s3		Fourth slave image
+		  8 = /dev/bus/vme/ctl		Control
+
+		It is expected that all VME bus drivers will use the
+		same interface.  For interface documentation see
+		http://www.vmelinux.org/.
+
+224 char	A2232 serial card
+		  0 = /dev/ttyY0		First A2232 port
+		  1 = /dev/cuy0			Second A2232 port
+		    ...
+
+225 char	A2232 serial card (alternate devices)
+		  0 = /dev/cuy0			Callout device for ttyY0
+		  1 = /dev/cuy1			Callout device for ttyY1
+		    ...
+
+226-239		UNASSIGNED
 
 240-254		LOCAL/EXPERIMENTAL USE
 
@@ -2026,6 +2526,14 @@
 /dev/log	socket		syslog local socket
 /dev/gpmdata	socket		gpm mouse multiplexer
 
+	Mount points
+
+The following names are reserved for mounting special filesystems
+under /dev.  These special filesystems provide kernel interfaces that
+cannot be provided with standard device nodes.
+
+/dev/pts	devpts		PTY slave filesystem
+/dev/shm	shmfs		POSIX shared memory maintenance access
 
  ****	TERMINAL DEVICES
 
diff -urN linux-2.2.19-pre3/Documentation/isdn/README.HiSax linux/Documentation/isdn/README.HiSax
--- linux-2.2.19-pre3/Documentation/isdn/README.HiSax	Mon Dec  3 20:54:06 2001
+++ linux/Documentation/isdn/README.HiSax	Mon Dec  3 20:54:39 2001
@@ -442,6 +442,7 @@
 	Enrik Berkhan (enrik@starfleet.inka.de) for S0BOX specific stuff
 	Ton van Rosmalen for Teles PCI
 	Petr Novak <petr.novak@i.cz> for Winbond W6692 support
+	Werner Cornelius <werner@isdn4linux.de> for HFC-PCI, HFC-S(+/P) and supplementary services support
         and more people who are hunting bugs. (If I forgot somebody, please
 	send me a mail).
 
diff -urN linux-2.2.19-pre3/Documentation/isdn/README.hfc-pci linux/Documentation/isdn/README.hfc-pci
--- linux-2.2.19-pre3/Documentation/isdn/README.hfc-pci	Tue Oct 26 17:53:39 1999
+++ linux/Documentation/isdn/README.hfc-pci	Mon Dec  3 20:54:39 2001
@@ -35,7 +35,7 @@
 supplied else the parameter is assumed 0 and a auto search for a free card is
 invoked which may not give the wanted result. 
 
-Comments and reports to werner@isdn4linux.de or werner@titro.de .
+Comments and reports to werner@isdn4linux.de or werner@isdn-development.de
 
 
 
diff -urN linux-2.2.19-pre3/MAINTAINERS linux/MAINTAINERS
--- linux-2.2.19-pre3/MAINTAINERS	Mon Dec  3 20:54:06 2001
+++ linux/MAINTAINERS	Mon Dec  3 20:54:39 2001
@@ -251,7 +251,7 @@
 
 DC390/AM53C974 SCSI driver
 P:	Kurt Garloff
-M:	kurt@garloff.de
+M:	garloff@suse.de
 W:	http://www.garloff.de/kurt/linux/dc390/
 S:	Maintained
 
diff -urN linux-2.2.19-pre3/Makefile linux/Makefile
--- linux-2.2.19-pre3/Makefile	Mon Dec  3 20:54:06 2001
+++ linux/Makefile	Mon Dec  3 20:54:39 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 2
 SUBLEVEL = 19
-EXTRAVERSION = pre3
+EXTRAVERSION = pre4
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 
@@ -24,14 +24,12 @@
 LD	=$(CROSS_COMPILE)ld
 #
 #	foo-bar-gcc for cross builds
-#	kgcc for Conectiva, Red Hat, Mandrake
-#	gcc272 for Debian
+#	gcc272 for Debian's old compiler for kernels
+#	kgcc for Conectiva, Mandrake and Red Hat 7
 #	otherwise 'cc'
 #
-CCFOUND :=$(shell $(CONFIG_SHELL) scripts/kwhich kgcc gcc272 cc gcc)
-## Faster, but requires GNU make 3.78, which postdates Linux 2.2.0
-##CC	=$(if $(CROSS_COMPILE),$(CROSS_COMPILE)gcc,$(CCFOUND)) -D__KERNEL__ -I$(HPATH)
-CC	=$(shell if [ -n "$(CROSS_COMPILE)" ]; then echo $(CROSS_COMPILE)gcc; else echo $(CCFOUND); fi) \
+CC	=$(shell if [ -n "$(CROSS_COMPILE)" ]; then echo $(CROSS_COMPILE)gcc; else \
+	$(CONFIG_SHELL) scripts/kwhich gcc272 2>/dev/null || $(CONFIG_SHELL) scripts/kwhich kgcc 2>/dev/null || echo cc; fi) \
 	-D__KERNEL__ -I$(HPATH)
 CPP	=$(CC) -E
 AR	=$(CROSS_COMPILE)ar
diff -urN linux-2.2.19-pre3/arch/alpha/kernel/ptrace.c linux/arch/alpha/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/alpha/kernel/ptrace.c	Wed May  3 17:16:30 2000
+++ linux/arch/alpha/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -543,7 +543,7 @@
 		ret = -EPERM;
 		if (child == current)
 			goto out;
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		     (current->uid != child->euid) ||
 		     (current->uid != child->suid) ||
 		     (current->uid != child->uid) ||
diff -urN linux-2.2.19-pre3/arch/arm/kernel/ptrace.c linux/arch/arm/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/arm/kernel/ptrace.c	Sun Dec 10 16:49:41 2000
+++ linux/arch/arm/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -596,7 +596,7 @@
 	if (request == PTRACE_ATTACH) {
 		if (child == current)
 			goto out;
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->suid) ||
 		    (current->uid != child->uid) ||
diff -urN linux-2.2.19-pre3/arch/i386/boot/setup.S linux/arch/i386/boot/setup.S
--- linux-2.2.19-pre3/arch/i386/boot/setup.S	Mon Dec  3 20:54:06 2001
+++ linux/arch/i386/boot/setup.S	Mon Dec  3 20:54:39 2001
@@ -253,12 +253,12 @@
 #ifndef STANDARD_MEMORY_BIOS_CALL
 	mov     [0x1e8], al
 meme820:
-	mov     edx, #0x534d4150
 	xor     ebx, ebx
 	mov     di,#0x2d0
 
 jmpe820:
 	mov     eax,#0x0000e820
+	mov     edx,#0x534d4150		! Some biosen trash edx each call
 	mov     ecx,#20
 	push    ds
 	pop     es
diff -urN linux-2.2.19-pre3/arch/i386/kernel/microcode.c linux/arch/i386/kernel/microcode.c
--- linux-2.2.19-pre3/arch/i386/kernel/microcode.c	Mon Dec  3 20:54:06 2001
+++ linux/arch/i386/kernel/microcode.c	Mon Dec  3 20:54:39 2001
@@ -35,6 +35,8 @@
  *		Pentium 4 support + backported fixes from 2.4
  *	1.07	13 Dec 2000, Tigran Aivazian <tigran@veritas.com>
  *		More bugfixes backported from 2.4
+ *	1.08	27 Dec 2000, Tigran Aivazian <tigran@veritas.com>
+ *		Fix: X86_FEATURE_30 was used incorrectly (in a 2.4 manner)
  */
 
 #include <linux/init.h>
@@ -49,7 +51,7 @@
 #include <asm/uaccess.h>
 #include <asm/processor.h>
 
-#define MICROCODE_VERSION 	"1.07"
+#define MICROCODE_VERSION 	"1.08"
 
 MODULE_DESCRIPTION("Intel CPU (IA-32) microcode update driver");
 MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>");
@@ -161,7 +163,7 @@
 	req->err = 1; /* be pessimistic */
 
 	if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
-		test_bit(X86_FEATURE_30, &c->x86_capability)) { /* IA64 */
+		(c->x86_capability & X86_FEATURE_30) ) { /* IA64 */
 		printk(KERN_ERR "microcode: CPU%d not a capable Intel processor\n", cpu_num);
 		return;
 	}
@@ -307,8 +309,8 @@
 				memset(mc_applied, 0, mc_fsize);
 				kfree(mc_applied);
 				mc_applied = NULL;
-				printk(KERN_WARNING "microcode: freed %d bytes\n", bytes);
 				mc_fsize = 0;
+				printk(KERN_WARNING "microcode: freed %d bytes\n", bytes);
 				up(&microcode_sem);
 				return 0;
 			}
diff -urN linux-2.2.19-pre3/arch/i386/kernel/ptrace.c linux/arch/i386/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/i386/kernel/ptrace.c	Wed May  3 17:16:31 2000
+++ linux/arch/i386/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -413,7 +413,7 @@
 	if (request == PTRACE_ATTACH) {
 		if (child == current)
 			goto out;
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->suid) ||
 		    (current->uid != child->uid) ||
diff -urN linux-2.2.19-pre3/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
--- linux-2.2.19-pre3/arch/i386/kernel/setup.c	Mon Dec  3 20:54:06 2001
+++ linux/arch/i386/kernel/setup.c	Mon Dec  3 20:54:39 2001
@@ -376,8 +376,7 @@
 
                e820.nr_map = 0;
                add_memory_region(0, i386_endbase, E820_RAM);
-               add_memory_region(HIGH_MEMORY, (mem_size << 10)-HIGH_MEMORY,
-				 E820_RAM);
+               add_memory_region(HIGH_MEMORY, (mem_size << 10), E820_RAM);
        }
        printk("BIOS-provided physical RAM map:\n");
        print_memory_map(who);
diff -urN linux-2.2.19-pre3/arch/m68k/kernel/ptrace.c linux/arch/m68k/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/m68k/kernel/ptrace.c	Sun Dec 10 16:49:41 2000
+++ linux/arch/m68k/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -339,7 +339,7 @@
 	if (request == PTRACE_ATTACH) {
 		if (child == current)
 			goto out;
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->suid) ||
 		    (current->uid != child->uid) ||
diff -urN linux-2.2.19-pre3/arch/mips/kernel/ptrace.c linux/arch/mips/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/mips/kernel/ptrace.c	Mon Aug  9 12:04:38 1999
+++ linux/arch/mips/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -292,7 +292,7 @@
 			res = -EPERM;
 			goto out;
 		}
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->suid) ||
 		    (current->uid != child->uid) ||
diff -urN linux-2.2.19-pre3/arch/ppc/kernel/ptrace.c linux/arch/ppc/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/ppc/kernel/ptrace.c	Tue Jan  4 10:12:12 2000
+++ linux/arch/ppc/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -360,7 +360,7 @@
 	if (request == PTRACE_ATTACH) {
 		if (child == current)
 			goto out;
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->suid) ||
 		    (current->uid != child->uid) ||
diff -urN linux-2.2.19-pre3/arch/s390/kernel/ptrace.c linux/arch/s390/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/s390/kernel/ptrace.c	Sun Dec 10 16:49:41 2000
+++ linux/arch/s390/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -452,7 +452,7 @@
 	{
 		if (child == current)
 			goto out;
-		if ((!child->dumpable ||
+		if ((child->dumpable != 1 ||
 		     (current->uid != child->euid) ||
 		     (current->uid != child->uid) ||
 		     (current->gid != child->egid) ||
diff -urN linux-2.2.19-pre3/arch/sparc/kernel/ptrace.c linux/arch/sparc/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/sparc/kernel/ptrace.c	Tue Jan  4 10:12:12 2000
+++ linux/arch/sparc/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -567,7 +567,7 @@
 			pt_error_return(regs, EPERM);
 			goto out;
 		}
-		if((!child->dumpable ||
+		if((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->uid) ||
 		    (current->gid != child->egid) ||
diff -urN linux-2.2.19-pre3/arch/sparc64/kernel/ptrace.c linux/arch/sparc64/kernel/ptrace.c
--- linux-2.2.19-pre3/arch/sparc64/kernel/ptrace.c	Wed May  3 17:16:32 2000
+++ linux/arch/sparc64/kernel/ptrace.c	Mon Dec  3 20:54:39 2001
@@ -605,7 +605,7 @@
 			pt_error_return(regs, EPERM);
 			goto out;
 		}
-		if((!child->dumpable ||
+		if((child->dumpable != 1 ||
 		    (current->uid != child->euid) ||
 		    (current->uid != child->uid) ||
 		    (current->gid != child->egid) ||
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/avmcard.h linux/drivers/isdn/avmb1/avmcard.h
--- linux-2.2.19-pre3/drivers/isdn/avmb1/avmcard.h	Sun Dec 10 16:49:42 2000
+++ linux/drivers/isdn/avmb1/avmcard.h	Mon Dec  3 20:54:39 2001
@@ -1,9 +1,12 @@
 /*
- * $Id: avmcard.h,v 1.7 2000/01/25 14:33:38 calle Exp $
+ * $Id: avmcard.h,v 1.8 2000/10/10 17:44:19 kai Exp $
  *
  * Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  *
  * $Log: avmcard.h,v $
+ * Revision 1.8  2000/10/10 17:44:19  kai
+ * changes from/for 2.2.18
+ *
  * Revision 1.7  2000/01/25 14:33:38  calle
  * - Added Support AVM B1 PCI V4.0 (tested with prototype)
  *   - splitted up t1pci.c into b1dma.c for common function with b1pciv4
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/b1.c linux/drivers/isdn/avmb1/b1.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/b1.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/b1.c	Mon Dec  3 20:54:39 2001
@@ -94,7 +94,7 @@
 #include "capicmd.h"
 #include "capiutil.h"
 
-static char *revision = "$Revision: 1.14 $";
+static char *revision = "$Revision: 1.20 $";
 
 /* ------------------------------------------------------------- */
 
@@ -510,7 +510,7 @@
 	struct sk_buff *skb;
 
 	unsigned ApplId;
-	signed MsgLen;
+	unsigned MsgLen;
 	unsigned DataB3Len;
 	unsigned NCCI;
 	unsigned WindowSize;
@@ -596,25 +596,29 @@
 		ctrl->ready(ctrl);
 		break;
 
-        case RECEIVE_TASK_READY:
+	case RECEIVE_TASK_READY:
 		ApplId = (unsigned) b1_get_word(card->port);
 		MsgLen = b1_get_slice(card->port, card->msgbuf);
-		card->msgbuf[MsgLen--] = 0;
-		while (    MsgLen >= 0
-		       && (   card->msgbuf[MsgLen] == '\n'
-			   || card->msgbuf[MsgLen] == '\r'))
-			card->msgbuf[MsgLen--] = 0;
+		card->msgbuf[MsgLen] = 0;
+		while (    MsgLen > 0
+		       && (   card->msgbuf[MsgLen-1] == '\n'
+			   || card->msgbuf[MsgLen-1] == '\r')) {
+			card->msgbuf[MsgLen-1] = 0;
+			MsgLen--;
+		}
 		printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
 				card->name, ApplId, card->msgbuf);
 		break;
 
-        case RECEIVE_DEBUGMSG:
+	case RECEIVE_DEBUGMSG:
 		MsgLen = b1_get_slice(card->port, card->msgbuf);
-		card->msgbuf[MsgLen--] = 0;
-		while (    MsgLen >= 0
-		       && (   card->msgbuf[MsgLen] == '\n'
-			   || card->msgbuf[MsgLen] == '\r'))
-			card->msgbuf[MsgLen--] = 0;
+		card->msgbuf[MsgLen] = 0;
+		while (    MsgLen > 0
+		       && (   card->msgbuf[MsgLen-1] == '\n'
+			   || card->msgbuf[MsgLen-1] == '\r')) {
+			card->msgbuf[MsgLen-1] = 0;
+			MsgLen--;
+		}
 		printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
 		break;
 
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/b1dma.c linux/drivers/isdn/avmb1/b1dma.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/b1dma.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/b1dma.c	Mon Dec  3 20:54:39 2001
@@ -40,7 +40,7 @@
 #include "capicmd.h"
 #include "capiutil.h"
 
-static char *revision = "$Revision: 1.5 $";
+static char *revision = "$Revision: 1.11 $";
 
 /* ------------------------------------------------------------- */
 
@@ -468,8 +468,7 @@
 	struct capi_ctr *ctrl = cinfo->capi_ctrl;
 	struct sk_buff *skb;
 	void *p = dma->recvbuf+4;
-	__u32 ApplId, DataB3Len, NCCI, WindowSize;
-	__s32 MsgLen;
+	__u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize;
 	__u8 b1cmd =  _get_byte(&p);
 
 #ifdef CONFIG_B1DMA_DEBUG
@@ -558,22 +557,26 @@
 	case RECEIVE_TASK_READY:
 		ApplId = (unsigned) _get_word(&p);
 		MsgLen = _get_slice(&p, card->msgbuf);
-		card->msgbuf[MsgLen--] = 0;
-		while (    MsgLen >= 0
-		       && (   card->msgbuf[MsgLen] == '\n'
-			   || card->msgbuf[MsgLen] == '\r'))
-			card->msgbuf[MsgLen--] = 0;
+		card->msgbuf[MsgLen] = 0;
+		while (    MsgLen > 0
+		       && (   card->msgbuf[MsgLen-1] == '\n'
+			   || card->msgbuf[MsgLen-1] == '\r')) {
+			card->msgbuf[MsgLen-1] = 0;
+			MsgLen--;
+		}
 		printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
 				card->name, ApplId, card->msgbuf);
 		break;
 
 	case RECEIVE_DEBUGMSG:
 		MsgLen = _get_slice(&p, card->msgbuf);
-		card->msgbuf[MsgLen--] = 0;
-		while (    MsgLen >= 0
-		       && (   card->msgbuf[MsgLen] == '\n'
-			   || card->msgbuf[MsgLen] == '\r'))
-			card->msgbuf[MsgLen--] = 0;
+		card->msgbuf[MsgLen] = 0;
+		while (    MsgLen > 0
+		       && (   card->msgbuf[MsgLen-1] == '\n'
+			   || card->msgbuf[MsgLen-1] == '\r')) {
+			card->msgbuf[MsgLen-1] = 0;
+			MsgLen--;
+		}
 		printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
 		break;
 
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/b1isa.c linux/drivers/isdn/avmb1/b1isa.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/b1isa.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/b1isa.c	Mon Dec  3 20:54:39 2001
@@ -73,7 +73,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.8 $";
+static char *revision = "$Revision: 1.10 $";
 
 /* ------------------------------------------------------------- */
 
@@ -244,20 +244,20 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_driver b1isa_driver = {
-    "b1isa",
-    "0.0",
-    b1_load_firmware,
-    b1_reset_ctr,
-    b1isa_remove_ctr,
-    b1_register_appl,
-    b1_release_appl,
-    b1_send_message,
-
-    b1isa_procinfo,
-    b1ctl_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "b1isa",
+    revision: "0.0",
+    load_firmware: b1_load_firmware,
+    reset_ctr: b1_reset_ctr,
+    remove_ctr: b1isa_remove_ctr,
+    register_appl: b1_register_appl,
+    release_appl: b1_release_appl,
+    send_message: b1_send_message,
+
+    procinfo: b1isa_procinfo,
+    ctr_read_proc: b1ctl_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    b1isa_add_card,
+    add_card: b1isa_add_card,
 };
 
 #ifdef MODULE
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/b1pci.c linux/drivers/isdn/avmb1/b1pci.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/b1pci.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/b1pci.c	Mon Dec  3 20:54:39 2001
@@ -93,17 +93,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.25 $";
-
-/* ------------------------------------------------------------- */
-
-#ifndef PCI_VENDOR_ID_AVM
-#define PCI_VENDOR_ID_AVM	0x1244
-#endif
-
-#ifndef PCI_DEVICE_ID_AVM_B1
-#define PCI_DEVICE_ID_AVM_B1	0x700
-#endif
+static char *revision = "$Revision: 1.29.6.1 $";
 
 /* ------------------------------------------------------------- */
 
@@ -270,20 +260,20 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_driver b1pci_driver = {
-    "b1pci",
-    "0.0",
-    b1_load_firmware,
-    b1_reset_ctr,
-    b1pci_remove_ctr,
-    b1_register_appl,
-    b1_release_appl,
-    b1_send_message,
-
-    b1pci_procinfo,
-    b1ctl_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "b1pci",
+    revision: "0.0",
+    load_firmware: b1_load_firmware,
+    reset_ctr: b1_reset_ctr,
+    remove_ctr: b1pci_remove_ctr,
+    register_appl: b1_register_appl,
+    release_appl: b1_release_appl,
+    send_message: b1_send_message,
+
+    procinfo: b1pci_procinfo,
+    ctr_read_proc: b1ctl_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    0, /* no add_card function */
+    add_card: 0, /* no add_card function */
 };
 
 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
@@ -449,20 +439,20 @@
 
 
 static struct capi_driver b1pciv4_driver = {
-    "b1pciv4",
-    "0.0",
-    b1dma_load_firmware,
-    b1dma_reset_ctr,
-    b1pciv4_remove_ctr,
-    b1dma_register_appl,
-    b1dma_release_appl,
-    b1dma_send_message,
-
-    b1pciv4_procinfo,
-    b1dmactl_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "b1pciv4",
+    revision: "0.0",
+    load_firmware: b1dma_load_firmware,
+    reset_ctr: b1dma_reset_ctr,
+    remove_ctr: b1pciv4_remove_ctr,
+    register_appl: b1dma_register_appl,
+    release_appl: b1dma_release_appl,
+    send_message: b1dma_send_message,
+
+    procinfo: b1pciv4_procinfo,
+    ctr_read_proc: b1dmactl_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    0, /* no add_card function */
+    add_card: 0, /* no add_card function */
 };
 
 #endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/b1pcmcia.c linux/drivers/isdn/avmb1/b1pcmcia.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/b1pcmcia.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/b1pcmcia.c	Mon Dec  3 20:54:39 2001
@@ -83,7 +83,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.10 $";
+static char *revision = "$Revision: 1.12 $";
 
 /* ------------------------------------------------------------- */
 
@@ -245,20 +245,20 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_driver b1pcmcia_driver = {
-    "b1pcmcia",
-    "0.0",
-    b1_load_firmware,
-    b1_reset_ctr,
-    b1pcmcia_remove_ctr,
-    b1_register_appl,
-    b1_release_appl,
-    b1_send_message,
-
-    b1pcmcia_procinfo,
-    b1ctl_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "b1pcmcia",
+    revision: "0.0",
+    load_firmware: b1_load_firmware,
+    reset_ctr: b1_reset_ctr,
+    remove_ctr: b1pcmcia_remove_ctr,
+    register_appl: b1_register_appl,
+    release_appl: b1_release_appl,
+    send_message: b1_send_message,
+
+    procinfo: b1pcmcia_procinfo,
+    ctr_read_proc: b1ctl_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    0,
+    add_card: 0,
 };
 
 /* ------------------------------------------------------------- */
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/c4.c linux/drivers/isdn/avmb1/c4.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/c4.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/c4.c	Mon Dec  3 20:54:39 2001
@@ -67,35 +67,16 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.12 $";
+static char *revision = "$Revision: 1.20.6.1 $";
 
 #undef CONFIG_C4_DEBUG
 #undef CONFIG_C4_POLLDEBUG
 
 /* ------------------------------------------------------------- */
 
-#ifndef PCI_VENDOR_ID_DEC
-#define PCI_VENDOR_ID_DEC	0x1011
-#endif
-
-#ifndef PCI_DEVICE_ID_DEC_21285
-#define PCI_DEVICE_ID_DEC_21285	0x1065
-#endif
-
-#ifndef PCI_VENDOR_ID_AVM
-#define PCI_VENDOR_ID_AVM	0x1244
-#endif
-
-#ifndef PCI_DEVICE_ID_AVM_C4
-#define PCI_DEVICE_ID_AVM_C4	0x0800
-#endif
-
-/* ------------------------------------------------------------- */
-
-static int suppress_pollack = 0;
+static int suppress_pollack;
 
 MODULE_AUTHOR("Carsten Paeth <calle@calle.in-berlin.de>");
-
 MODULE_PARM(suppress_pollack, "0-1i");
 
 /* ------------------------------------------------------------- */
@@ -559,8 +540,7 @@
 	avmctrl_info *cinfo;
 	struct sk_buff *skb;
 	void *p = dma->recvbuf;
-	__u32 ApplId, DataB3Len, NCCI, WindowSize;
-	__s32 MsgLen;
+	__u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize;
 	__u8 b1cmd =  _get_byte(&p);
 	__u32 cidx;
 
@@ -679,22 +659,26 @@
 	case RECEIVE_TASK_READY:
 		ApplId = (unsigned) _get_word(&p);
 		MsgLen = _get_slice(&p, card->msgbuf);
-		card->msgbuf[MsgLen--] = 0;
-		while (    MsgLen >= 0
-		       && (   card->msgbuf[MsgLen] == '\n'
-			   || card->msgbuf[MsgLen] == '\r'))
-			card->msgbuf[MsgLen--] = 0;
+		card->msgbuf[MsgLen] = 0;
+		while (    MsgLen > 0
+		       && (   card->msgbuf[MsgLen-1] == '\n'
+			   || card->msgbuf[MsgLen-1] == '\r')) {
+			card->msgbuf[MsgLen-1] = 0;
+			MsgLen--;
+		}
 		printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
 				card->name, ApplId, card->msgbuf);
 		break;
 
 	case RECEIVE_DEBUGMSG:
 		MsgLen = _get_slice(&p, card->msgbuf);
-		card->msgbuf[MsgLen--] = 0;
-		while (    MsgLen >= 0
-		       && (   card->msgbuf[MsgLen] == '\n'
-			   || card->msgbuf[MsgLen] == '\r'))
-			card->msgbuf[MsgLen--] = 0;
+		card->msgbuf[MsgLen] = 0;
+		while (    MsgLen > 0
+		       && (   card->msgbuf[MsgLen-1] == '\n'
+			   || card->msgbuf[MsgLen-1] == '\r')) {
+			card->msgbuf[MsgLen-1] = 0;
+			MsgLen--;
+		}
 		printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
 		break;
 
@@ -1286,20 +1270,20 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_driver c4_driver = {
-    "c4",
-    "0.0",
-    c4_load_firmware,
-    c4_reset_ctr,
-    c4_remove_ctr,
-    c4_register_appl,
-    c4_release_appl,
-    c4_send_message,
-
-    c4_procinfo,
-    c4_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "c4",
+    revision: "0.0",
+    load_firmware: c4_load_firmware,
+    reset_ctr: c4_reset_ctr,
+    remove_ctr: c4_remove_ctr,
+    register_appl: c4_register_appl,
+    release_appl: c4_release_appl,
+    send_message: c4_send_message,
+
+    procinfo: c4_procinfo,
+    ctr_read_proc: c4_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    0, /* no add_card function */
+    add_card: 0, /* no add_card function */
 };
 
 #ifdef MODULE
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/capi.c linux/drivers/isdn/avmb1/capi.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/capi.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/capi.c	Mon Dec  3 20:54:39 2001
@@ -1,11 +1,57 @@
 /*
- * $Id: capi.c,v 1.35 2000/06/19 15:11:24 keil Exp $
+ * $Id: capi.c,v 1.44.6.3 2000/12/17 22:45:08 kai Exp $
  *
  * CAPI 2.0 Interface for Linux
  *
  * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
  *
  * $Log: capi.c,v $
+ * Revision 1.44.6.3  2000/12/17 22:45:08  kai
+ * That's hopefully it for test13-4
+ *
+ * Revision 1.44.6.2  2000/12/14 23:04:12  kai
+ * Makefile changes and the like for 2.4.0-test13-pre1
+ * No compatiblity code for older kernels yet, but note the branch
+ *
+ * Revision 1.45  2000/12/02 19:47:29  kai
+ * Change the Makefiles to new style.
+ * There may be problems there that I missed, so this shouldn't go into
+ * an offical kernel any time soon.
+ * However, if I didn't commit it, we wouldn't find the bugs...
+ *
+ * Revision 1.44  2000/11/25 17:00:59  kai
+ * compatibility cleanup - final part for the time being
+ *
+ * Revision 1.43  2000/11/23 20:45:14  kai
+ * fixed module_init/exit stuff
+ * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
+ *
+ * Revision 1.42  2000/11/19 17:03:55  kai
+ * compatibility cleanup - part 5
+ *
+ * Revision 1.41  2000/11/01 14:05:02  calle
+ * - use module_init/module_exit from linux/init.h.
+ * - all static struct variables are initialized with "membername:" now.
+ * - avm_cs.c, let it work with newer pcmcia-cs.
+ *
+ * Revision 1.40  2000/10/24 15:15:04  calle
+ * Workaround: pppd calls restoretty before reseting the ldisc and
+ *   ldisc "ppp_sync" didn't support this. So we call n_tty_ioctl
+ *   in the driver ioctl function. (remember: driver ioctl function is
+ *   only called if ldisc ioctl function did not handle the call)
+ *
+ * Revision 1.39  2000/07/24 13:42:50  calle
+ * - lock_kernel/unlock_kernel for _release functions. (from 2.4)
+ *
+ * Revision 1.38  2000/07/24 08:49:09  calle
+ * - Bugfix: capiminor_del_all_ack completely wrong :-(
+ *
+ * Revision 1.37  2000/07/20 10:22:27  calle
+ * - Made procfs function cleaner and removed variable "begin".
+ *
+ * Revision 1.36  2000/06/29 13:59:35  calle
+ * - call to devfs_register was wrong
+ *
  * Revision 1.35  2000/06/19 15:11:24  keil
  * avoid use of freed structs
  * changes from 2.4.0-ac21
@@ -203,7 +249,7 @@
 #include "capifs.h"
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
 
-static char *revision = "$Revision: 1.35 $";
+static char *revision = "$Revision: 1.44.6.3 $";
 
 MODULE_AUTHOR("Carsten Paeth (calle@calle.in-berlin.de)");
 
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/capidev.h linux/drivers/isdn/avmb1/capidev.h
--- linux-2.2.19-pre3/drivers/isdn/avmb1/capidev.h	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/capidev.h	Mon Dec  3 20:54:39 2001
@@ -1,11 +1,14 @@
 /*
- * $Id: capidev.h,v 1.5 2000/03/03 15:50:42 calle Exp $
+ * $Id: capidev.h,v 1.6 2000/11/25 17:00:59 kai Exp $
  *
  * CAPI 2.0 Interface for Linux
  *
  * (c) Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
  *
  * $Log: capidev.h,v $
+ * Revision 1.6  2000/11/25 17:00:59  kai
+ * compatibility cleanup - final part for the time being
+ *
  * Revision 1.5  2000/03/03 15:50:42  calle
  * - kernel CAPI:
  *   - Changed parameter "param" in capi_signal from __u32 to void *.
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/capidrv.c linux/drivers/isdn/avmb1/capidrv.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/capidrv.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/capidrv.c	Mon Dec  3 20:54:39 2001
@@ -1,11 +1,23 @@
 /*
- * $Id: capidrv.c,v 1.36 2000/06/26 15:13:41 keil Exp $
+ * $Id: capidrv.c,v 1.39 2000/11/23 20:45:14 kai Exp $
  *
  * ISDN4Linux Driver, using capi20 interface (kernelcapi)
  *
  * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
  *
  * $Log: capidrv.c,v $
+ * Revision 1.39  2000/11/23 20:45:14  kai
+ * fixed module_init/exit stuff
+ * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
+ *
+ * Revision 1.38  2000/11/14 08:43:07  calle
+ * Bugfix for v110. Connectparamters where setup for sync ...
+ *
+ * Revision 1.37  2000/11/01 14:05:02  calle
+ * - use module_init/module_exit from linux/init.h.
+ * - all static struct variables are initialized with "membername:" now.
+ * - avm_cs.c, let it work with newer pcmcia-cs.
+ *
  * Revision 1.36  2000/06/26 15:13:41  keil
  * features should be or'ed
  *
@@ -206,7 +218,7 @@
 #include "capicmd.h"
 #include "capidrv.h"
 
-static char *revision = "$Revision: 1.36 $";
+static char *revision = "$Revision: 1.39 $";
 static int debugmode = 0;
 
 MODULE_AUTHOR("Carsten Paeth <calle@calle.in-berlin.de>");
@@ -2463,8 +2475,8 @@
 }
 
 static struct capi_interface_user cuser = {
-	"capidrv",
-	lower_callback
+	name: "capidrv",
+	callback: lower_callback
 };
 
 #ifdef MODULE
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/capiutil.c linux/drivers/isdn/avmb1/capiutil.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/capiutil.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/capiutil.c	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /*
- * $Id: capiutil.c,v 1.11 2000/03/03 15:50:42 calle Exp $
+ * $Id: capiutil.c,v 1.13 2000/11/23 20:45:14 kai Exp $
  *
  * CAPI 2.0 convert capi message to capi message struct
  *
@@ -7,6 +7,15 @@
  * Rewritten for Linux 1996 by Carsten Paeth (calle@calle.in-berlin.de)
  *
  * $Log: capiutil.c,v $
+ * Revision 1.13  2000/11/23 20:45:14  kai
+ * fixed module_init/exit stuff
+ * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
+ *
+ * Revision 1.12  2000/11/01 14:05:02  calle
+ * - use module_init/module_exit from linux/init.h.
+ * - all static struct variables are initialized with "membername:" now.
+ * - avm_cs.c, let it work with newer pcmcia-cs.
+ *
  * Revision 1.11  2000/03/03 15:50:42  calle
  * - kernel CAPI:
  *   - Changed parameter "param" in capi_signal from __u32 to void *.
@@ -977,7 +986,6 @@
 	protocol_message_2_pars(cmsg, 1);
 	return buf;
 }
-
 
 EXPORT_SYMBOL(capi_cmsg2message);
 EXPORT_SYMBOL(capi_message2cmsg);
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/kcapi.c linux/drivers/isdn/avmb1/kcapi.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/kcapi.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/kcapi.c	Mon Dec  3 20:54:39 2001
@@ -115,7 +115,7 @@
 #include <linux/b1lli.h>
 #endif
 
-static char *revision = "$Revision: 1.17 $";
+static char *revision = "$Revision: 1.21.6.1 $";
 
 /* ------------------------------------------------------------- */
 
@@ -1758,7 +1758,6 @@
 	MOD_INC_USE_COUNT;
 
 	skb_queue_head_init(&recv_queue);
-	/* init_bh(CAPI_BH, do_capi_bh); */
 
 	tq_state_notify.routine = notify_handler;
 	tq_state_notify.data = 0;
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/t1isa.c linux/drivers/isdn/avmb1/t1isa.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/t1isa.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/t1isa.c	Mon Dec  3 20:54:39 2001
@@ -85,7 +85,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.11 $";
+static char *revision = "$Revision: 1.16 $";
 
 /* ------------------------------------------------------------- */
 
@@ -194,7 +194,7 @@
 	struct sk_buff *skb;
 
 	unsigned ApplId;
-	signed MsgLen;
+	unsigned MsgLen;
 	unsigned DataB3Len;
 	unsigned NCCI;
 	unsigned WindowSize;
@@ -282,25 +282,30 @@
 		case RECEIVE_TASK_READY:
 			ApplId = (unsigned) b1_get_word(card->port);
 			MsgLen = t1_get_slice(card->port, card->msgbuf);
-			card->msgbuf[MsgLen--] = 0;
-			while (    MsgLen >= 0
-			       && (   card->msgbuf[MsgLen] == '\n'
-				   || card->msgbuf[MsgLen] == '\r'))
-				card->msgbuf[MsgLen--] = 0;
+			card->msgbuf[MsgLen] = 0;
+			while (    MsgLen > 0
+			       && (   card->msgbuf[MsgLen-1] == '\n'
+				   || card->msgbuf[MsgLen-1] == '\r')) {
+				card->msgbuf[MsgLen-1] = 0;
+				MsgLen--;
+			}
 			printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
 					card->name, ApplId, card->msgbuf);
 			break;
 
 		case RECEIVE_DEBUGMSG:
 			MsgLen = t1_get_slice(card->port, card->msgbuf);
-			card->msgbuf[MsgLen--] = 0;
-			while (    MsgLen >= 0
-			       && (   card->msgbuf[MsgLen] == '\n'
-				   || card->msgbuf[MsgLen] == '\r'))
-				card->msgbuf[MsgLen--] = 0;
+			card->msgbuf[MsgLen] = 0;
+			while (    MsgLen > 0
+			       && (   card->msgbuf[MsgLen-1] == '\n'
+				   || card->msgbuf[MsgLen-1] == '\r')) {
+				card->msgbuf[MsgLen-1] = 0;
+				MsgLen--;
+			}
 			printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
 			break;
 
+
 		case 0xff:
 			printk(KERN_ERR "%s: card reseted ?\n", card->name);
 			return;
@@ -577,20 +582,20 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_driver t1isa_driver = {
-    "t1isa",
-    "0.0",
-    t1isa_load_firmware,
-    t1isa_reset_ctr,
-    t1isa_remove_ctr,
-    b1_register_appl,
-    b1_release_appl,
-    t1isa_send_message,
-
-    t1isa_procinfo,
-    b1ctl_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "t1isa",
+    revision: "0.0",
+    load_firmware: t1isa_load_firmware,
+    reset_ctr: t1isa_reset_ctr,
+    remove_ctr: t1isa_remove_ctr,
+    register_appl: b1_register_appl,
+    release_appl: b1_release_appl,
+    send_message: t1isa_send_message,
+
+    procinfo: t1isa_procinfo,
+    ctr_read_proc: b1ctl_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    t1isa_add_card,
+    add_card: t1isa_add_card,
 };
 
 #ifdef MODULE
diff -urN linux-2.2.19-pre3/drivers/isdn/avmb1/t1pci.c linux/drivers/isdn/avmb1/t1pci.c
--- linux-2.2.19-pre3/drivers/isdn/avmb1/t1pci.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/avmb1/t1pci.c	Mon Dec  3 20:54:39 2001
@@ -62,23 +62,13 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.9 $";
+static char *revision = "$Revision: 1.13.6.1 $";
 
 #undef CONFIG_T1PCI_DEBUG
 #undef CONFIG_T1PCI_POLLDEBUG
 
 /* ------------------------------------------------------------- */
 
-#ifndef PCI_VENDOR_ID_AVM
-#define PCI_VENDOR_ID_AVM	0x1244
-#endif
-
-#ifndef PCI_DEVICE_ID_AVM_T1
-#define PCI_DEVICE_ID_AVM_T1	0x1200
-#endif
-
-/* ------------------------------------------------------------- */
-
 MODULE_AUTHOR("Carsten Paeth <calle@calle.in-berlin.de>");
 
 /* ------------------------------------------------------------- */
@@ -253,20 +243,20 @@
 /* ------------------------------------------------------------- */
 
 static struct capi_driver t1pci_driver = {
-    "t1pci",
-    "0.0",
-    b1dma_load_firmware,
-    b1dma_reset_ctr,
-    t1pci_remove_ctr,
-    b1dma_register_appl,
-    b1dma_release_appl,
-    b1dma_send_message,
-
-    t1pci_procinfo,
-    b1dmactl_read_proc,
-    0,	/* use standard driver_read_proc */
+    name: "t1pci",
+    revision: "0.0",
+    load_firmware: b1dma_load_firmware,
+    reset_ctr: b1dma_reset_ctr,
+    remove_ctr: t1pci_remove_ctr,
+    register_appl: b1dma_register_appl,
+    release_appl: b1dma_release_appl,
+    send_message: b1dma_send_message,
+
+    procinfo: t1pci_procinfo,
+    ctr_read_proc: b1dmactl_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
 
-    0, /* no add_card function */
+    add_card: 0, /* no add_card function */
 };
 
 #ifdef MODULE
diff -urN linux-2.2.19-pre3/drivers/isdn/divert/divert_init.c linux/drivers/isdn/divert/divert_init.c
--- linux-2.2.19-pre3/drivers/isdn/divert/divert_init.c	Sun Dec 10 16:49:42 2000
+++ linux/drivers/isdn/divert/divert_init.c	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /* 
- * $Id: divert_init.c,v 1.5 2000/11/13 22:51:47 kai Exp $
+ * $Id: divert_init.c,v 1.5.6.1 2000/12/17 16:47:16 kai Exp $
  *
  * Module init for DSS1 diversion services for i4l.
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/divert/divert_procfs.c linux/drivers/isdn/divert/divert_procfs.c
--- linux-2.2.19-pre3/drivers/isdn/divert/divert_procfs.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/divert/divert_procfs.c	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /*
- * $Id: divert_procfs.c,v 1.10 2000/11/13 22:51:47 kai Exp $
+ * $Id: divert_procfs.c,v 1.11 2000/11/25 17:01:00 kai Exp $
  *
  * Filesystem handling for the diversion supplementary services.
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/divert/isdn_divert.c linux/drivers/isdn/divert/isdn_divert.c
--- linux-2.2.19-pre3/drivers/isdn/divert/isdn_divert.c	Tue Oct 26 17:53:40 1999
+++ linux/drivers/isdn/divert/isdn_divert.c	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /* 
- * $Id: isdn_divert.c,v 1.5 1999/08/31 11:20:04 paul Exp $
+ * $Id: isdn_divert.c,v 1.6 2000/11/13 22:51:47 kai Exp $
  *
  * DSS1 main diversion supplementary handling for i4l.
  *
@@ -18,25 +18,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
- *
- * $Log: isdn_divert.c,v $
- * Revision 1.5  1999/08/31 11:20:04  paul
- * various spelling corrections (new checksums may be needed, Karsten!)
- *
- * Revision 1.4  1999/08/25 20:02:21  werner
- * Changed return values for stat_icall(w) from 3->4 and 4->5 because of conflicts
- * with existing software definitions. (PtP incomplete called party number)
- *
- * Revision 1.3  1999/08/22 20:26:35  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.2  1999/07/04 21:37:32  werner
- * Ported from kernel version 2.0
- *
- *
  *
  */
 
diff -urN linux-2.2.19-pre3/drivers/isdn/divert/isdn_divert.h linux/drivers/isdn/divert/isdn_divert.h
--- linux-2.2.19-pre3/drivers/isdn/divert/isdn_divert.h	Tue Oct 26 17:53:40 1999
+++ linux/drivers/isdn/divert/isdn_divert.h	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /* 
- * $Id: isdn_divert.h,v 1.4 1999/09/02 13:24:12 paul Exp $
+ * $Id: isdn_divert.h,v 1.5 2000/11/13 22:51:47 kai Exp $
  *
  * Header for the diversion supplementary ioctl interface.
  *
@@ -18,19 +18,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
- *
- * $Log: isdn_divert.h,v $
- * Revision 1.4  1999/09/02 13:24:12  paul
- * cosmetics; text following #endif is not ANSI C
- *
- * Revision 1.3  1999/08/22 20:26:37  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.2  1999/07/04 21:37:33  werner
- * Ported from kernel version 2.0
  *
  */
 
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/amd7930.c linux/drivers/isdn/hisax/amd7930.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/amd7930.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/amd7930.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: amd7930.c,v 1.4 2000/06/26 08:59:12 keil Exp $
+/* $Id: amd7930.c,v 1.5 2000/11/24 17:05:37 kai Exp $
  *
  * HiSax ISDN driver - chip specific routines for AMD 7930
  *
@@ -94,7 +94,7 @@
 #include "rawhdlc.h"
 #include <linux/interrupt.h>
 
-static const char *amd7930_revision = "$Revision: 1.4 $";
+static const char *amd7930_revision = "$Revision: 1.5 $";
 
 #define RCV_BUFSIZE	1024	/* Size of raw receive buffer in bytes */
 #define RCV_BUFBLKS	4	/* Number of blocks to divide buffer into
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/arcofi.c linux/drivers/isdn/hisax/arcofi.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/arcofi.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/arcofi.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: arcofi.c,v 1.11 2000/06/26 08:59:12 keil Exp $
+/* $Id: arcofi.c,v 1.12 2000/11/25 17:01:00 kai Exp $
  *
  * arcofi.c   Ansteuerung ARCOFI 2165
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/asuscom.c linux/drivers/isdn/hisax/asuscom.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/asuscom.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/asuscom.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: asuscom.c,v 1.10 2000/06/26 08:59:12 keil Exp $
+/* $Id: asuscom.c,v 1.11 2000/11/24 17:05:37 kai Exp $
  *
  * asuscom.c     low level stuff for ASUSCOM NETWORK INC. ISDNLink cards
  *
@@ -19,7 +19,7 @@
 
 extern const char *CardType[];
 
-const char *Asuscom_revision = "$Revision: 1.10 $";
+const char *Asuscom_revision = "$Revision: 1.11 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/avm_a1.c linux/drivers/isdn/hisax/avm_a1.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/avm_a1.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/avm_a1.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: avm_a1.c,v 2.12 2000/06/26 08:59:12 keil Exp $
+/* $Id: avm_a1.c,v 2.13 2000/11/24 17:05:37 kai Exp $
  *
  * avm_a1.c     low level stuff for AVM A1 (Fritz) isdn cards
  *
@@ -14,7 +14,7 @@
 #include "isdnl1.h"
 
 extern const char *CardType[];
-static const char *avm_revision = "$Revision: 2.12 $";
+static const char *avm_revision = "$Revision: 2.13 $";
 
 #define	 AVM_A1_STAT_ISAC	0x01
 #define	 AVM_A1_STAT_HSCX	0x02
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/avm_a1p.c linux/drivers/isdn/hisax/avm_a1p.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/avm_a1p.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/avm_a1p.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: avm_a1p.c,v 2.6 2000/06/26 08:59:12 keil Exp $
+/* $Id: avm_a1p.c,v 2.7 2000/11/24 17:05:37 kai Exp $
  *
  * avm_a1p.c    low level stuff for the following AVM cards:
  *              A1 PCMCIA
@@ -52,7 +52,7 @@
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
 
-static const char *avm_revision = "$Revision: 2.6 $";
+static const char *avm_revision = "$Revision: 2.7 $";
 
 static inline u_char
 ReadISAC(struct IsdnCardState *cs, u_char offset)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/avm_pci.c linux/drivers/isdn/hisax/avm_pci.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/avm_pci.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/avm_pci.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: avm_pci.c,v 1.18 2000/08/20 07:34:04 keil Exp $
+/* $Id: avm_pci.c,v 1.22.6.2 2000/11/29 16:00:14 kai Exp $
  *
  * avm_pci.c    low level stuff for AVM Fritz!PCI and ISA PnP isdn cards
  *              Thanks to AVM, Berlin for informations
@@ -17,18 +17,11 @@
 #include <linux/interrupt.h>
 
 extern const char *CardType[];
-static const char *avm_pci_rev = "$Revision: 1.18 $";
+static const char *avm_pci_rev = "$Revision: 1.22.6.2 $";
 
 #define  AVM_FRITZ_PCI		1
 #define  AVM_FRITZ_PNP		2
 
-#ifndef PCI_VENDOR_ID_AVM
-#define PCI_VENDOR_ID_AVM	0x1244
-#endif
-#ifndef PCI_DEVICE_ID_AVM_FRITZ
-#define PCI_DEVICE_ID_AVM_FRITZ	0xa00
-#endif
-
 #define  HDLC_FIFO		0x0
 #define  HDLC_STATUS		0x4
 
@@ -788,7 +781,7 @@
 			return(0);
 		}
 		if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
-			PCI_DEVICE_ID_AVM_FRITZ,  dev_avm))) {
+			PCI_DEVICE_ID_AVM_A1,  dev_avm))) {
 			cs->irq = dev_avm->irq;
 			if (!cs->irq) {
 				printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n");
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/bkm_a4t.c linux/drivers/isdn/hisax/bkm_a4t.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/bkm_a4t.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/bkm_a4t.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: bkm_a4t.c,v 1.11 2000/06/26 08:59:12 keil Exp $
+/* $Id: bkm_a4t.c,v 1.13.6.2 2000/11/29 16:00:14 kai Exp $
  * bkm_a4t.c    low level stuff for T-Berkom A4T
  *              derived from the original file sedlbauer.c
  *              derived from the original file niccy.c
@@ -23,7 +23,7 @@
 
 extern const char *CardType[];
 
-const char *bkm_a4t_revision = "$Revision: 1.11 $";
+const char *bkm_a4t_revision = "$Revision: 1.13.6.2 $";
 
 
 static inline u_char
@@ -294,7 +294,7 @@
 
 		pci_read_config_word(dev_a4t, PCI_SUBSYSTEM_VENDOR_ID, &sub_vendor);
 		pci_read_config_word(dev_a4t, PCI_SUBSYSTEM_ID, &sub_sys);
-		if ((sub_sys == A4T_SUBSYS_ID) && (sub_vendor == A4T_SUBVEN_ID)) {
+		if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
 			if (pci_enable_device(dev_a4t))
 				return(0);
 			found = 1;
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/bkm_a8.c linux/drivers/isdn/hisax/bkm_a8.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/bkm_a8.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/bkm_a8.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: bkm_a8.c,v 1.12 2000/06/26 08:59:12 keil Exp $
+/* $Id: bkm_a8.c,v 1.14.6.2 2000/11/29 16:00:14 kai Exp $
  * bkm_a8.c     low level stuff for Scitel Quadro (4*S0, passive)
  *              derived from the original file sedlbauer.c
  *              derived from the original file niccy.c
@@ -26,7 +26,7 @@
 
 extern const char *CardType[];
 
-const char sct_quadro_revision[] = "$Revision: 1.12 $";
+const char sct_quadro_revision[] = "$Revision: 1.14.6.2 $";
 
 static const char *sct_quadro_subtypes[] =
 {
@@ -316,8 +316,8 @@
 			CardType[card->typ]);
 		return (0);
 	}
-	if ((cs->subtyp != SCT_1) && ((sub_sys_id != SCT_SUBSYS_ID) ||
-		(sub_vendor_id != SCT_SUBVEN_ID)))
+	if ((cs->subtyp != SCT_1) && ((sub_sys_id != PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) ||
+		(sub_vendor_id != PCI_VENDOR_ID_BERKOM)))
 		return (0);
 	if (cs->subtyp == SCT_1) {
 		if (!pci_present()) {
@@ -329,8 +329,8 @@
 			
 			pci_read_config_word(dev_a8, PCI_SUBSYSTEM_VENDOR_ID, &sub_vendor_id);
 			pci_read_config_word(dev_a8, PCI_SUBSYSTEM_ID, &sub_sys_id);
-			if ((sub_sys_id == SCT_SUBSYS_ID) &&
-				(sub_vendor_id == SCT_SUBVEN_ID)) {
+			if ((sub_sys_id == PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) &&
+				(sub_vendor_id == PCI_VENDOR_ID_BERKOM)) {
 				if (pci_enable_device(dev_a8))
 					return(0);
 				pci_ioaddr1 = dev_a8->base_address[ 1] & PCI_BASE_ADDRESS_IO_MASK;
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/bkm_ax.h linux/drivers/isdn/hisax/bkm_ax.h
--- linux-2.2.19-pre3/drivers/isdn/hisax/bkm_ax.h	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/bkm_ax.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: bkm_ax.h,v 1.4 2000/06/26 08:59:12 keil Exp $
+/* $Id: bkm_ax.h,v 1.5.6.1 2000/11/28 12:02:46 kai Exp $
  * bkm_ax.h   low level decls for T-Berkom cards A4T and Scitel Quadro (4*S0, passive)
  *
  * Author     Roland Klabunde (R.Klabunde@Berkom.de)
@@ -16,27 +16,6 @@
 #define	SCT_3		3
 #define	SCT_4		4
 #define BKM_A4T		5
-
-
-/* A4T																*/
-#ifndef PCI_VENDOR_ID_ZORAN
-#define PCI_VENDOR_ID_ZORAN	0x11DE
-#endif
-#ifndef PCI_DEVICE_ID_ZORAN_36120
-#define PCI_DEVICE_ID_ZORAN_36120	0x6120
-#endif
-#define	A4T_SUBVEN_ID		0x0871	
-#define	A4T_SUBSYS_ID		0xFFA4
-/* Scitel Quadro 																*/
-#ifndef PCI_VENDOR_ID_PLX
-#define PCI_VENDOR_ID_PLX	0x10B5
-#endif
-#ifndef PCI_DEVICE_ID_PLX_9050
-#define PCI_DEVICE_ID_PLX_9050	0x9050
-#endif
-#define	SCT_SUBVEN_ID		0x0871
-#define	SCT_SUBSYS_ID		0xFFA8
-
 
 #define	PLX_ADDR_PLX		0x14	/* Addr PLX configuration */
 #define	PLX_ADDR_ISAC		0x18	/* Addr ISAC */
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/callc.c linux/drivers/isdn/hisax/callc.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/callc.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/callc.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: callc.c,v 2.47 2000/06/26 08:59:12 keil Exp $
+/* $Id: callc.c,v 2.51 2000/11/24 17:05:37 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -20,7 +20,7 @@
 #define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module))
 #endif	/* MODULE */
 
-const char *lli_revision = "$Revision: 2.47 $";
+const char *lli_revision = "$Revision: 2.51 $";
 
 extern struct IsdnCard cards[];
 extern int nrcards;
@@ -30,10 +30,8 @@
 static int init_b_st(struct Channel *chanp, int incoming);
 static void release_b_st(struct Channel *chanp);
 
-static struct Fsm callcfsm =
-{NULL, 0, 0, NULL, NULL};
-
-static int chancount = 0;
+static struct Fsm callcfsm;
+static int chancount;
 
 /* experimental REJECT after ALERTING for CALLBACK to beat the 4s delay */
 #define ALERT_REJECT 0
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/config.c linux/drivers/isdn/hisax/config.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/config.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/config.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 2.52 2000/10/02 17:33:43 keil Exp $
+/* $Id: config.c,v 2.57.6.7 2000/12/17 16:47:17 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -338,18 +338,14 @@
 	EMPTY_CARD,
 };
 
-static char HiSaxID[64] HISAX_INITDATA = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
-"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
-"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-char *HiSax_id HISAX_INITDATA = HiSaxID;
+static char HiSaxID[64]  = { 0, };
+
+char *HiSax_id  = HiSaxID;
 #ifdef MODULE
 /* Variables for insmod */
-static int type[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
-static int protocol[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
-static int io[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
+static int type[8]  = { 0, };
+static int protocol[8]  = { 0, };
+static int io[8]  = { 0, };
 #undef IO0_IO1
 #ifdef CONFIG_HISAX_16_3
 #define IO0_IO1
@@ -359,16 +355,12 @@
 #define IO0_IO1
 #endif
 #ifdef IO0_IO1
-static int io0[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
-static int io1[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
-#endif
-static int irq[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
-static int mem[] HISAX_INITDATA =
-{0, 0, 0, 0, 0, 0, 0, 0};
-static char *id HISAX_INITDATA = HiSaxID;
+static int io0[8]  = { 0, };
+static int io1[8]  = { 0, };
+#endif
+static int irq[8]  = { 0, };
+static int mem[8]  = { 0, };
+static char *id  = HiSaxID;
 
 MODULE_AUTHOR("Karsten Keil");
 MODULE_PARM(type, "1-8i");
@@ -1296,7 +1288,7 @@
 	printk(KERN_DEBUG "HiSax: HiSax_reportcard address 0x%lX\n",
 		(ulong) & HiSax_reportcard);
 	printk(KERN_DEBUG "HiSax: cs 0x%lX\n", (ulong) cs);
-	printk(KERN_DEBUG "HiSax: HW_Flags %x bc0 flg %x bc1 flg %x\n",
+	printk(KERN_DEBUG "HiSax: HW_Flags %lx bc0 flg %lx bc1 flg %lx\n",
 		cs->HW_Flags, cs->bcs[0].Flag, cs->bcs[1].Flag);
 	printk(KERN_DEBUG "HiSax: bcs 0 mode %d ch%d\n",
 		cs->bcs[0].mode, cs->bcs[0].channel);
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/diva.c linux/drivers/isdn/hisax/diva.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/diva.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/diva.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: diva.c,v 1.21 2000/06/26 08:59:12 keil Exp $
+/* $Id: diva.c,v 1.25.6.2 2000/11/29 16:00:14 kai Exp $
  *
  * diva.c     low level stuff for Eicon.Diehl Diva Family ISDN cards
  *
@@ -23,7 +23,7 @@
 
 extern const char *CardType[];
 
-const char *Diva_revision = "$Revision: 1.21 $";
+const char *Diva_revision = "$Revision: 1.25.6.2 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
@@ -45,20 +45,6 @@
 #define DIVA_PCI	2
 #define DIVA_IPAC_ISA	3
 #define DIVA_IPAC_PCI	4
-
-/* PCI stuff */
-#ifndef PCI_VENDOR_ID_EICON
-#define PCI_VENDOR_ID_EICON	0x1133
-#endif
-#ifndef PCI_DEVICE_ID_EICON_DIVA20
-#define PCI_DEVICE_ID_EICON_DIVA20	0xe002
-#endif
-#ifndef PCI_DEVICE_ID_EICON_DIVA20_U
-#define PCI_DEVICE_ID_EICON_DIVA20_U	0xe004
-#endif
-#ifndef PCI_DEVICE_ID_EICON_DIVA201
-#define PCI_DEVICE_ID_EICON_DIVA201	0xe005
-#endif
 
 /* CTRL (Read) */
 #define DIVA_IRQ_STAT	0x01
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/elsa.c linux/drivers/isdn/hisax/elsa.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/elsa.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/elsa.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: elsa.c,v 2.23 2000/06/26 08:59:12 keil Exp $
+/* $Id: elsa.c,v 2.26.6.1 2000/11/28 12:02:46 kai Exp $
  *
  * elsa.c     low level stuff for Elsa isdn cards
  *
@@ -29,7 +29,7 @@
 
 extern const char *CardType[];
 
-const char *Elsa_revision = "$Revision: 2.23 $";
+const char *Elsa_revision = "$Revision: 2.26.6.1 $";
 const char *Elsa_Types[] =
 {"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
  "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI", 
@@ -66,15 +66,6 @@
 #define ELSA_PCMCIA_IPAC 11
 
 /* PCI stuff */
-#ifndef PCI_VENDOR_ID_ELSA
-#define PCI_VENDOR_ID_ELSA	0x1048
-#endif
-#ifndef PCI_DEVICE_ID_ELSA_MIRCOLINK
-#define PCI_DEVICE_ID_ELSA_MIRCOLINK	0x1000
-#endif
-#ifndef PCI_DEVICE_ID_ELSA_QS3000
-#define PCI_DEVICE_ID_ELSA_QS3000	0x3000
-#endif
 #define ELSA_PCI_IRQ_MASK	0x04
 
 /* ITAC Registeradressen (only Microlink PC) */
@@ -865,8 +856,8 @@
 	return (CARD_portlist[i]);
 }
 
-static 	struct pci_dev *dev_qs1000 __initdata = NULL;
-static 	struct pci_dev *dev_qs3000 __initdata = NULL;
+static 	struct pci_dev *dev_qs1000  = NULL;
+static 	struct pci_dev *dev_qs3000  = NULL;
 
 int
 setup_elsa(struct IsdnCard *card)
@@ -990,7 +981,7 @@
 		}
 		cs->subtyp = 0;
 		if ((dev_qs1000 = pci_find_device(PCI_VENDOR_ID_ELSA,
-			PCI_DEVICE_ID_ELSA_MIRCOLINK, dev_qs1000))) {
+			PCI_DEVICE_ID_ELSA_MICROLINK, dev_qs1000))) {
 			if (pci_enable_device(dev_qs1000))
 				return(0);
 			cs->subtyp = ELSA_QS1000PCI;
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/elsa_ser.c linux/drivers/isdn/hisax/elsa_ser.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/elsa_ser.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/elsa_ser.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: elsa_ser.c,v 2.9 2000/06/26 08:59:12 keil Exp $
+/* $Id: elsa_ser.c,v 2.10 2000/11/19 17:02:47 kai Exp $
  *
  * stuff for the serial modem on ELSA cards
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/fsm.c linux/drivers/isdn/hisax/fsm.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/fsm.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/fsm.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: fsm.c,v 1.13 2000/06/26 08:59:12 keil Exp $
+/* $Id: fsm.c,v 1.14 2000/11/24 17:05:37 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/gazel.c linux/drivers/isdn/hisax/gazel.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/gazel.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/gazel.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: gazel.c,v 2.8 2000/06/26 08:59:12 keil Exp $
+/* $Id: gazel.c,v 2.11.6.2 2000/11/29 16:00:14 kai Exp $
  *
  * gazel.c     low level stuff for Gazel isdn cards
  *
@@ -18,26 +18,12 @@
 #include <linux/pci.h>
 
 extern const char *CardType[];
-const char *gazel_revision = "$Revision: 2.8 $";
+const char *gazel_revision = "$Revision: 2.11.6.2 $";
 
 #define R647      1
 #define R685      2
 #define R753      3
 #define R742      4
-
-/* Gazel R685 stuff */
-#ifndef PCI_VENDOR_ID_PLX
-#define PCI_VENDOR_ID_PLX	0x10b5
-#endif
-#ifndef PCI_DEVICE_ID_PLX_R685
-#define PCI_DEVICE_ID_PLX_R685	0x1030
-#endif
-#ifndef PCI_DEVICE_ID_PLX_R753
-#define PCI_DEVICE_ID_PLX_R753	0x1152
-#endif
-#ifndef PCI_DEVICE_ID_PLX_DJINN_ITOO
-#define PCI_DEVICE_ID_PLX_DJINN_ITOO	0x1151
-#endif
 
 #define PLX_CNTRL    0x50	/* registre de controle PLX */
 #define RESET_GAZEL  0x4
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hfc_2bds0.c linux/drivers/isdn/hisax/hfc_2bds0.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hfc_2bds0.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hfc_2bds0.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_2bds0.c,v 1.13 2000/06/26 08:59:12 keil Exp $
+/* $Id: hfc_2bds0.c,v 1.15 2000/11/24 17:05:37 kai Exp $
  *
  *  specific routines for CCD's HFC 2BDS0
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hfc_2bs0.c linux/drivers/isdn/hisax/hfc_2bs0.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hfc_2bs0.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hfc_2bs0.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_2bs0.c,v 1.15 2000/07/26 20:46:47 keil Exp $
+/* $Id: hfc_2bs0.c,v 1.17 2000/11/24 17:05:37 kai Exp $
  *
  *  specific routines for CCD's HFC 2BS0
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hfc_pci.c linux/drivers/isdn/hisax/hfc_pci.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hfc_pci.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hfc_pci.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_pci.c,v 1.31 2000/08/20 07:32:55 keil Exp $
+/* $Id: hfc_pci.c,v 1.34.6.3 2000/12/10 23:39:19 kai Exp $
 
  * hfc_pci.c     low level driver for CCD´s hfc-pci based cards
  *
@@ -34,7 +34,7 @@
 
 extern const char *CardType[];
 
-static const char *hfcpci_revision = "$Revision: 1.31 $";
+static const char *hfcpci_revision = "$Revision: 1.34.6.3 $";
 
 /* table entry in the PCI devices list */
 typedef struct {
@@ -50,25 +50,26 @@
 
 static const PCI_ENTRY id_list[] =
 {
-	{0x1397, 0x2BD0, "CCD/Billion/Asuscom", "2BD0"},
-	{0x1397, 0xB000, "Billion", "B000"},
-	{0x1397, 0xB006, "Billion", "B006"},
-	{0x1397, 0xB007, "Billion", "B007"},
-	{0x1397, 0xB008, "Billion", "B008"},
-	{0x1397, 0xB009, "Billion", "B009"},
-	{0x1397, 0xB00A, "Billion", "B00A"},
-	{0x1397, 0xB00B, "Billion", "B00B"},
-	{0x1397, 0xB00C, "Billion", "B00C"},
-	{0x1043, 0x0675, "Asuscom/Askey", "675"},
-	{0x0871, 0xFFA2, "German telekom", "T-Concept"},
-	{0x0871, 0xFFA1, "German telekom", "A1T"},
-	{0x1051, 0x0100, "Motorola MC145575", "MC145575"},
-	{0x1397, 0xB100, "Seyeon", "B100"},
-	{0x15B0, 0x2BD0, "Zoltrix", "2BD0"},
-	{0x114F, 0x70,"Digi International", "Digi DataFire Micro V IOM2 (Europe)"},
-	{0x114F, 0x71,"Digi International", "Digi DataFire Micro V (Europe)"},
-	{0x114F, 0x72,"Digi International", "Digi DataFire Micro V IOM2 (North America)"},
-	{0x114F, 0x73,"Digi International", "Digi DataFire Micro V (North America)"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, "CCD/Billion/Asuscom", "2BD0"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, "Billion", "B000"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, "Billion", "B006"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, "Billion", "B007"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, "Billion", "B008"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, "Billion", "B009"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, "Billion", "B00A"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, "Billion", "B00B"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, "Billion", "B00C"},
+	{PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, "Seyeon", "B100"},
+	{PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, "Abocom/Magitek", "2BD1"},
+	{PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, "Asuscom/Askey", "675"},
+	{PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, "German telekom", "T-Concept"},
+	{PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, "German telekom", "A1T"},
+	{PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, "Motorola MC145575", "MC145575"},
+	{PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, "Zoltrix", "2BD0"},
+	{PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E,"Digi International", "Digi DataFire Micro V IOM2 (Europe)"},
+	{PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E,"Digi International", "Digi DataFire Micro V (Europe)"},
+	{PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A,"Digi International", "Digi DataFire Micro V IOM2 (North America)"},
+	{PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A,"Digi International", "Digi DataFire Micro V (North America)"},
 	{0, 0, NULL, NULL},
 };
 
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hfc_sx.c linux/drivers/isdn/hisax/hfc_sx.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hfc_sx.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hfc_sx.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_sx.c,v 1.7 2000/09/08 22:55:59 werner Exp $
+/* $Id: hfc_sx.c,v 1.9 2000/11/24 17:05:37 kai Exp $
 
  * hfc_sx.c     low level driver for CCD´s hfc-s+/sp based cards
  *
@@ -31,7 +31,7 @@
 
 extern const char *CardType[];
 
-static const char *hfcsx_revision = "$Revision: 1.7 $";
+static const char *hfcsx_revision = "$Revision: 1.9 $";
 
 /***************************************/
 /* IRQ-table for CCDs demo board       */
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hfcscard.c linux/drivers/isdn/hisax/hfcscard.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hfcscard.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hfcscard.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hfcscard.c,v 1.7 2000/06/26 08:59:13 keil Exp $
+/* $Id: hfcscard.c,v 1.8 2000/11/24 17:05:37 kai Exp $
  *
  * hfcscard.c     low level stuff for hfcs based cards (Teles3c, ACER P10)
  *
@@ -15,7 +15,7 @@
 
 extern const char *CardType[];
 
-static const char *hfcs_revision = "$Revision: 1.7 $";
+static const char *hfcs_revision = "$Revision: 1.8 $";
 
 static void
 hfcs_interrupt(int intno, void *dev_id, struct pt_regs *regs)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hisax.h linux/drivers/isdn/hisax/hisax.h
--- linux-2.2.19-pre3/drivers/isdn/hisax/hisax.h	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hisax.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hisax.h,v 2.49 2000/09/08 22:55:59 werner Exp $
+/* $Id: hisax.h,v 2.52.6.1 2000/12/06 16:59:19 kai Exp $
  *
  *   Basic declarations, defines and prototypes
  *
@@ -201,7 +201,7 @@
 	void *hardware;
 	struct BCState *bcs;
 	struct PStack **stlistp;
-	int Flags;
+	long Flags;
 	struct FsmInst l1m;
 	struct FsmTimer	timer;
 	void (*l1l2) (struct PStack *, int, void *);
@@ -240,7 +240,7 @@
 	int tei;
 	int sap;
 	int maxlen;
-	unsigned int flag;
+	unsigned long flag;
 	unsigned int vs, va, vr;
 	int rc;
 	unsigned int window;
@@ -365,7 +365,7 @@
 };
 
 struct isar_reg {
-	unsigned int Flags;
+	unsigned long Flags;
 	volatile u_char bstat;
 	volatile u_char iis;
 	volatile u_char cmsb;
@@ -482,7 +482,7 @@
 struct BCState {
 	int channel;
 	int mode;
-	int Flag;
+	long Flag; /* long req'd for set_bit --RR */
 	struct IsdnCardState *cs;
 	int tx_cnt;		/* B-Channel transmit counter */
 	struct sk_buff *tx_skb; /* B-Channel transmit Buffer */
@@ -527,7 +527,8 @@
 	int data_open;
 	struct l3_process *proc;
 	setup_parm setup;	/* from isdnif.h numbers and Serviceindicator */
-	int Flags;		/* for remembering action done in l4 */
+	long Flags;		/* for remembering action done in l4 */
+				/* long req'd for set_bit --RR */
 	int leased;
 };
 
@@ -864,7 +865,7 @@
 	int protocol;
 	unsigned int irq;
 	unsigned long irq_flags;
-	int HW_Flags;
+	long HW_Flags;
 	int *busy_flag;
         int chanlimit; /* limited number of B-chans to use */
         int logecho; /* log echo if supported by card */
@@ -931,7 +932,7 @@
 	int rcvidx;
 	struct sk_buff *tx_skb;
 	int tx_cnt;
-	int event;
+	long event;
 	struct tq_struct tqueue;
 	struct timer_list dbusytimer;
 #ifdef ERROR_STATISTIC
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hscx.c linux/drivers/isdn/hisax/hscx.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hscx.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hscx.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hscx.c,v 1.19 2000/06/26 08:59:13 keil Exp $
+/* $Id: hscx.c,v 1.21 2000/11/24 17:05:37 kai Exp $
  *
  * hscx.c   HSCX specific routines
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/hscx_irq.c linux/drivers/isdn/hisax/hscx_irq.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/hscx_irq.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/hscx_irq.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: hscx_irq.c,v 1.15 2000/06/26 08:59:13 keil Exp $
+/* $Id: hscx_irq.c,v 1.16 2000/11/19 17:02:47 kai Exp $
  *
  * hscx_irq.c     low level b-channel stuff for Siemens HSCX
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/icc.c linux/drivers/isdn/hisax/icc.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/icc.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/icc.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-// $Id: icc.c,v 1.3 2000/08/20 07:34:04 keil Exp $
+// $Id: icc.c,v 1.5 2000/11/24 17:05:37 kai Exp $
 //-----------------------------------------------------------------------------
 //
 // ICC specific routines
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/isac.c linux/drivers/isdn/hisax/isac.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/isac.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/isac.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isac.c,v 1.26 2000/06/26 08:59:13 keil Exp $
+/* $Id: isac.c,v 1.28 2000/11/24 17:05:37 kai Exp $
  *
  * isac.c   ISAC specific routines
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/isar.c linux/drivers/isdn/hisax/isar.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/isar.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/isar.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isar.c,v 1.15 2000/06/26 08:59:13 keil Exp $
+/* $Id: isar.c,v 1.17 2000/11/24 17:05:37 kai Exp $
  *
  * isar.c   ISAR (Siemens PSB 7110) specific routines
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/isdnl1.c linux/drivers/isdn/hisax/isdnl1.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/isdnl1.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/isdnl1.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnl1.c,v 2.39 2000/06/26 08:59:13 keil Exp $
+/* $Id: isdnl1.c,v 2.41.6.1 2000/12/10 22:01:04 kai Exp $
  *
  * isdnl1.c     common low level stuff for Siemens Chipsetbased isdn cards
  *              based on the teles driver from Jan den Ouden
@@ -15,7 +15,7 @@
  *
  */
 
-const char *l1_revision = "$Revision: 2.39 $";
+const char *l1_revision = "$Revision: 2.41.6.1 $";
 
 #define __NO_VERSION__
 #include "hisax.h"
@@ -23,13 +23,8 @@
 
 #define TIMER3_VALUE 7000
 
-static
-struct Fsm l1fsm_b =
-{NULL, 0, 0, NULL, NULL};
-
-static
-struct Fsm l1fsm_s =
-{NULL, 0, 0, NULL, NULL};
+static struct Fsm l1fsm_b;
+static struct Fsm l1fsm_s;
 
 enum {
 	ST_L1_F2,
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/isdnl2.c linux/drivers/isdn/hisax/isdnl2.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/isdnl2.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/isdnl2.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnl2.c,v 2.23 2000/06/26 08:59:13 keil Exp $
+/* $Id: isdnl2.c,v 2.25 2000/11/24 17:05:38 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -15,13 +15,11 @@
 #include "hisax.h"
 #include "isdnl2.h"
 
-const char *l2_revision = "$Revision: 2.23 $";
+const char *l2_revision = "$Revision: 2.25 $";
 
 static void l2m_debug(struct FsmInst *fi, char *fmt, ...);
 
-static
-struct Fsm l2fsm =
-{NULL, 0, 0, NULL, NULL};
+static struct Fsm l2fsm;
 
 enum {
 	ST_L2_1,
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/isdnl3.c linux/drivers/isdn/hisax/isdnl3.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/isdnl3.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/isdnl3.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnl3.c,v 2.14 2000/06/26 08:59:13 keil Exp $
+/* $Id: isdnl3.c,v 2.17 2000/11/24 17:05:38 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -11,16 +11,15 @@
  *              Fritz Elfert
  *
  */
+
 #define __NO_VERSION__
 #include "hisax.h"
 #include "isdnl3.h"
 #include <linux/config.h>
 
-const char *l3_revision = "$Revision: 2.14 $";
+const char *l3_revision = "$Revision: 2.17 $";
 
-static
-struct Fsm l3fsm =
-{NULL, 0, 0, NULL, NULL};
+static struct Fsm l3fsm;
 
 enum {
 	ST_L3_LC_REL,
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/isurf.c linux/drivers/isdn/hisax/isurf.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/isurf.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/isurf.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isurf.c,v 1.9 2000/06/26 08:59:13 keil Exp $
+/* $Id: isurf.c,v 1.10 2000/11/24 17:05:38 kai Exp $
  *
  * isurf.c  low level stuff for Siemens I-Surf/I-Talk cards
  *
@@ -16,7 +16,7 @@
 
 extern const char *CardType[];
 
-static const char *ISurf_revision = "$Revision: 1.9 $";
+static const char *ISurf_revision = "$Revision: 1.10 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/ix1_micro.c linux/drivers/isdn/hisax/ix1_micro.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/ix1_micro.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/ix1_micro.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: ix1_micro.c,v 2.9 2000/06/26 08:59:13 keil Exp $
+/* $Id: ix1_micro.c,v 2.10 2000/11/24 17:05:38 kai Exp $
  *
  * ix1_micro.c  low level stuff for ITK ix1-micro Rev.2 isdn cards
  *              derived from the original file teles3.c from Karsten Keil
@@ -49,7 +49,7 @@
 #include "isdnl1.h"
 
 extern const char *CardType[];
-const char *ix1_revision = "$Revision: 2.9 $";
+const char *ix1_revision = "$Revision: 2.10 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/jade.c linux/drivers/isdn/hisax/jade.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/jade.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/jade.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: jade.c,v 1.4 2000/06/26 08:59:14 keil Exp $
+/* $Id: jade.c,v 1.6 2000/11/24 17:05:38 kai Exp $
  *
  * jade.c   JADE stuff (derived from original hscx.c)
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/jade_irq.c linux/drivers/isdn/hisax/jade_irq.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/jade_irq.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/jade_irq.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: jade_irq.c,v 1.4 2000/06/26 08:59:14 keil Exp $
+/* $Id: jade_irq.c,v 1.5 2000/11/19 17:02:48 kai Exp $
  *
  * jade_irq.c   Low level JADE IRQ stuff (derived from original hscx_irq.c)
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/l3_1tr6.c linux/drivers/isdn/hisax/l3_1tr6.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/l3_1tr6.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/l3_1tr6.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: l3_1tr6.c,v 2.12 2000/08/20 07:31:30 keil Exp $
+/* $Id: l3_1tr6.c,v 2.13 2000/11/19 17:02:48 kai Exp $
  *
  *  German 1TR6 D-channel protocol
  *
@@ -17,7 +17,7 @@
 #include <linux/ctype.h>
 
 extern char *HiSax_getrev(const char *revision);
-const char *l3_1tr6_revision = "$Revision: 2.12 $";
+const char *l3_1tr6_revision = "$Revision: 2.13 $";
 
 #define MsgHead(ptr, cref, mty, dis) \
 	*ptr++ = dis; \
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/l3dss1.c linux/drivers/isdn/hisax/l3dss1.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/l3dss1.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/l3dss1.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: l3dss1.c,v 2.29 2000/06/26 08:59:14 keil Exp $
+/* $Id: l3dss1.c,v 2.30 2000/11/19 17:02:48 kai Exp $
  *
  * EURO/DSS1 D-channel protocol
  *
@@ -22,7 +22,7 @@
 #include <linux/config.h>
 
 extern char *HiSax_getrev(const char *revision);
-const char *dss1_revision = "$Revision: 2.29 $";
+const char *dss1_revision = "$Revision: 2.30 $";
 
 #define EXT_BEARER_CAPS 1
 
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/l3ni1.c linux/drivers/isdn/hisax/l3ni1.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/l3ni1.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/l3ni1.c	Mon Dec  3 20:54:39 2001
@@ -1,29 +1,32 @@
-// $Id: l3ni1.c,v 2.3 2000/06/26 08:59:14 keil Exp $
+// $Id: l3ni1.c,v 2.5.6.1 2000/12/06 16:59:19 kai Exp $
+//
 //-----------------------------------------------------------------------------
 //
 // NI1 D-channel protocol
 //
-// Author                Matt Henderson & Guy Ellis - Traverse Tecnologies Pty Ltd
-//                                www.traverse.com.au
+// Authors:
+// Matt Henderson & Guy Ellis - Traverse Tecnologies Pty Ltd
+// www.traverse.com.au
 //
 // 2000.6.6 Initial implementation of routines for US NI1 
 // Layer 3 protocol based on the EURO/DSS1 D-channel protocol 
-// driver written by Karsten Keil et al.  Thanks also for the 
-// code provided by Ragnar Paulson and Will Scales.
+// driver written by Karsten Keil et al.
+// NI-1 Hall of Fame - Thanks to....
+// Ragnar Paulson - for some handy code fragments
+// Will Scales - beta tester extraordinaire
+// Brett Whittacre - beta tester and remote devel system in Vegas
 //
 // This file is (c) under GNU PUBLIC LICENSE
 //
 //-----------------------------------------------------------------------------
-
 #define __NO_VERSION__
 #include "hisax.h"
 #include "isdnl3.h"
 #include "l3ni1.h"
 #include <linux/ctype.h>
-#include <linux/config.h>
 
 extern char *HiSax_getrev(const char *revision);
-const char *ni1_revision = "$Revision: 2.3 $";
+const char *ni1_revision = "$Revision: 2.5.6.1 $";
 
 #define EXT_BEARER_CAPS 1
 
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/l3ni1.h linux/drivers/isdn/hisax/l3ni1.h
--- linux-2.2.19-pre3/drivers/isdn/hisax/l3ni1.h	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/l3ni1.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-// $Id: l3ni1.h,v 2.2 2000/06/26 08:59:14 keil Exp $
+// $Id: l3ni1.h,v 2.3 2000/11/16 13:50:43 keil Exp $
 //-----------------------------------------------------------------------------
 //
 // NI1 D-channel protocol
@@ -11,6 +11,7 @@
 // driver written by Karsten Keil et al.  Thanks also for the 
 // code provided by Ragnar Paulson.
 //
+//
 // This file is (c) under GNU PUBLIC LICENSE
 //
 //-----------------------------------------------------------------------------
@@ -29,7 +30,7 @@
 #define T313	4000
 #define T318	4000
 #define T319	4000
-#define TSPID	2000
+#define TSPID	5000 /* was 2000 - Guy Ellis */
 
 /*
  * Message-Types
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/mic.c linux/drivers/isdn/hisax/mic.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/mic.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/mic.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: mic.c,v 1.9 2000/06/26 08:59:14 keil Exp $
+/* $Id: mic.c,v 1.10 2000/11/24 17:05:38 kai Exp $
  *
  * mic.c  low level stuff for mic cards
  *
@@ -18,7 +18,7 @@
 
 extern const char *CardType[];
 
-const char *mic_revision = "$Revision: 1.9 $";
+const char *mic_revision = "$Revision: 1.10 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/netjet.c linux/drivers/isdn/hisax/netjet.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/netjet.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/netjet.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: netjet.c,v 1.20 2000/06/26 08:59:14 keil Exp $
+/* $Id: netjet.c,v 1.24.6.2 2000/12/17 22:45:11 kai Exp $
  *
  * netjet.c     low level stuff for Traverse Technologie NETJet ISDN cards
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/netjet.h linux/drivers/isdn/hisax/netjet.h
--- linux-2.2.19-pre3/drivers/isdn/hisax/netjet.h	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/netjet.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-// $Id: netjet.h,v 2.3 2000/06/26 08:59:14 keil Exp $
+// $Id: netjet.h,v 2.5.6.1 2000/11/28 12:02:46 kai Exp $
 //-----------------------------------------------------------------------------
 //
 // NETjet common header file
@@ -15,13 +15,6 @@
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
 
-/* PCI stuff */
-#ifndef PCI_VENDOR_ID_TIGERJET
-#define PCI_VENDOR_ID_TIGERJET	0xe159
-#endif
-#ifndef PCI_DEVICE_ID_TIGERJET_300
-#define PCI_DEVICE_ID_TIGERJET_300	0x0001
-#endif
 #define NETJET_CTRL	0x00
 #define NETJET_DMACTRL	0x01
 #define NETJET_AUXCTRL	0x02
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/niccy.c linux/drivers/isdn/hisax/niccy.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/niccy.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/niccy.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: niccy.c,v 1.12 2000/06/26 08:59:14 keil Exp $
+/* $Id: niccy.c,v 1.15.6.2 2000/11/29 16:00:14 kai Exp $
  *
  * niccy.c  low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and
  *          compatible (SAGEM cybermodem)
@@ -21,7 +21,7 @@
 #include <linux/pci.h>
 
 extern const char *CardType[];
-const char *niccy_revision = "$Revision: 1.12 $";
+const char *niccy_revision = "$Revision: 1.15.6.2 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
@@ -38,12 +38,6 @@
 #define NICCY_PCI	2
 
 /* PCI stuff */
-#ifndef PCI_VENDOR_ID_SATSAGEM
-#define PCI_VENDOR_ID_SATSAGEM	0x1267
-#endif
-#ifndef PCI_DEVICE_ID_SATSAGEM_NICCY
-#define PCI_DEVICE_ID_SATSAGEM_NICCY	0x1016
-#endif
 #define PCI_IRQ_CTRL_REG	0x38
 #define PCI_IRQ_ENABLE		0x1f00
 #define PCI_IRQ_DISABLE		0xff0000
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/nj_s.c linux/drivers/isdn/hisax/nj_s.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/nj_s.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/nj_s.c	Mon Dec  3 20:54:39 2001
@@ -1,7 +1,8 @@
-// $Id: nj_s.c,v 2.3 2000/06/26 08:59:14 keil Exp $
+// $Id: nj_s.c,v 2.7.6.1 2000/11/29 16:00:14 kai Exp $
 //
 // This file is (c) under GNU PUBLIC LICENSE
 //
+
 #define __NO_VERSION__
 #include <linux/config.h>
 #include "hisax.h"
@@ -12,7 +13,7 @@
 #include <linux/ppp_defs.h>
 #include "netjet.h"
 
-const char *NETjet_S_revision = "$Revision: 2.3 $";
+const char *NETjet_S_revision = "$Revision: 2.7.6.1 $";
 
 static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
 {
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/nj_u.c linux/drivers/isdn/hisax/nj_u.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/nj_u.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/nj_u.c	Mon Dec  3 20:54:39 2001
@@ -1,8 +1,9 @@
-/* $Id: nj_u.c,v 2.4 2000/06/26 11:42:16 keil Exp $ 
+/* $Id: nj_u.c,v 2.8.6.1 2000/11/29 16:00:14 kai Exp $
  *
  * This file is (c) under GNU PUBLIC LICENSE
  *
  */
+
 #define __NO_VERSION__
 #include <linux/config.h>
 #include "hisax.h"
@@ -13,7 +14,7 @@
 #include <linux/ppp_defs.h>
 #include "netjet.h"
 
-const char *NETjet_U_revision = "$Revision: 2.4 $";
+const char *NETjet_U_revision = "$Revision: 2.8.6.1 $";
 
 static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
 {
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/s0box.c linux/drivers/isdn/hisax/s0box.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/s0box.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/s0box.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: s0box.c,v 2.3 2000/06/26 08:59:14 keil Exp $
+/* $Id: s0box.c,v 2.4 2000/11/24 17:05:38 kai Exp $
  *
  * s0box.c      low level stuff for Creatix S0BOX
  *
@@ -14,7 +14,7 @@
 #include "isdnl1.h"
 
 extern const char *CardType[];
-const char *s0box_revision = "$Revision: 2.3 $";
+const char *s0box_revision = "$Revision: 2.4 $";
 
 static inline void
 writereg(unsigned int padr, signed int addr, u_char off, u_char val) {
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/saphir.c linux/drivers/isdn/hisax/saphir.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/saphir.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/saphir.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: saphir.c,v 1.7 2000/06/26 08:59:14 keil Exp $
+/* $Id: saphir.c,v 1.8 2000/11/24 17:05:38 kai Exp $
  *
  * saphir.c low level stuff for HST Saphir 1
  *
@@ -18,7 +18,7 @@
 #include "isdnl1.h"
 
 extern const char *CardType[];
-static char *saphir_rev = "$Revision: 1.7 $";
+static char *saphir_rev = "$Revision: 1.8 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/sedlbauer.c linux/drivers/isdn/hisax/sedlbauer.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/sedlbauer.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/sedlbauer.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: sedlbauer.c,v 1.23 2000/06/26 08:59:14 keil Exp $
+/* $Id: sedlbauer.c,v 1.25.6.2 2000/11/29 17:48:59 kai Exp $
  *
  * sedlbauer.c  low level stuff for Sedlbauer cards
  *              includes support for the Sedlbauer speed star (speed star II),
@@ -51,19 +51,13 @@
 
 extern const char *CardType[];
 
-const char *Sedlbauer_revision = "$Revision: 1.23 $";
+const char *Sedlbauer_revision = "$Revision: 1.25.6.2 $";
 
 const char *Sedlbauer_Types[] =
 	{"None", "speed card/win", "speed star", "speed fax+", 
 	"speed win II / ISDN PC/104", "speed star II", "speed pci",
 	"speed fax+ pyramid", "speed fax+ pci"};
 
-#ifndef PCI_VENDOR_ID_TIGERJET
-#define PCI_VENDOR_ID_TIGERJET		0xe159
-#endif
-#ifndef PCI_DEVICE_ID_TIGERJET_100
-#define PCI_DEVICE_ID_TIGERJET_100	0x0002
-#endif
 #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID	0x51
 #define PCI_SUBVENDOR_SEDLBAUER_PCI	0x53
 #define PCI_SUBVENDOR_SPEEDFAX_PCI	0x54
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/sportster.c linux/drivers/isdn/hisax/sportster.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/sportster.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/sportster.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: sportster.c,v 1.13 2000/06/26 08:59:14 keil Exp $
+/* $Id: sportster.c,v 1.14 2000/11/24 17:05:38 kai Exp $
  *
  * sportster.c     low level stuff for USR Sportster internal TA
  *
@@ -16,7 +16,7 @@
 #include "isdnl1.h"
 
 extern const char *CardType[];
-const char *sportster_revision = "$Revision: 1.13 $";
+const char *sportster_revision = "$Revision: 1.14 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/tei.c linux/drivers/isdn/hisax/tei.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/tei.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/tei.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: tei.c,v 2.15 2000/06/26 08:59:14 keil Exp $
+/* $Id: tei.c,v 2.17 2000/11/24 17:05:38 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -16,7 +16,7 @@
 #include "isdnl2.h"
 #include <linux/random.h>
 
-const char *tei_revision = "$Revision: 2.15 $";
+const char *tei_revision = "$Revision: 2.17 $";
 
 #define ID_REQUEST	1
 #define ID_ASSIGNED	2
@@ -28,9 +28,7 @@
 
 #define TEI_ENTITY_ID	0xf
 
-static
-struct Fsm teifsm =
-{NULL, 0, 0, NULL, NULL};
+static struct Fsm teifsm;
 
 void tei_handler(struct PStack *st, u_char pr, struct sk_buff *skb);
 
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/teleint.c linux/drivers/isdn/hisax/teleint.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/teleint.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/teleint.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: teleint.c,v 1.13 2000/06/26 08:59:14 keil Exp $
+/* $Id: teleint.c,v 1.14 2000/11/24 17:05:38 kai Exp $
  *
  * teleint.c     low level stuff for TeleInt isdn cards
  *
@@ -16,7 +16,7 @@
 
 extern const char *CardType[];
 
-const char *TeleInt_revision = "$Revision: 1.13 $";
+const char *TeleInt_revision = "$Revision: 1.14 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/teles0.c linux/drivers/isdn/hisax/teles0.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/teles0.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/teles0.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: teles0.c,v 2.12 2000/06/26 08:59:14 keil Exp $
+/* $Id: teles0.c,v 2.13 2000/11/24 17:05:38 kai Exp $
  *
  * teles0.c     low level stuff for Teles Memory IO isdn cards
  *              based on the teles driver from Jan den Ouden
@@ -20,7 +20,7 @@
 
 extern const char *CardType[];
 
-const char *teles0_revision = "$Revision: 2.12 $";
+const char *teles0_revision = "$Revision: 2.13 $";
 
 #define TELES_IOMEM_SIZE	0x400
 #define byteout(addr,val) outb(val,addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/teles3.c linux/drivers/isdn/hisax/teles3.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/teles3.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/teles3.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: teles3.c,v 2.16 2000/06/26 08:59:15 keil Exp $
+/* $Id: teles3.c,v 2.17 2000/11/24 17:05:38 kai Exp $
  *
  * teles3.c     low level stuff for Teles 16.3 & PNP isdn cards
  *
@@ -20,7 +20,7 @@
 #include "isdnl1.h"
 
 extern const char *CardType[];
-const char *teles3_revision = "$Revision: 2.16 $";
+const char *teles3_revision = "$Revision: 2.17 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/telespci.c linux/drivers/isdn/hisax/telespci.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/telespci.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/telespci.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: telespci.c,v 2.13 2000/06/26 08:59:15 keil Exp $
+/* $Id: telespci.c,v 2.16.6.2 2000/11/29 16:00:14 kai Exp $
  *
  * telespci.c     low level stuff for Teles PCI isdn cards
  *
@@ -17,7 +17,7 @@
 #include <linux/pci.h>
 
 extern const char *CardType[];
-const char *telespci_revision = "$Revision: 2.13 $";
+const char *telespci_revision = "$Revision: 2.16.6.2 $";
 
 #define ZORAN_PO_RQ_PEN	0x02000000
 #define ZORAN_PO_WR	0x00800000
@@ -27,12 +27,6 @@
 #define ZORAN_PO_GREG1	0x00010000
 #define ZORAN_PO_DMASK	0xFF
 
-#ifndef PCI_VENDOR_ID_ZORAN
-#define PCI_VENDOR_ID_ZORAN	0x11DE
-#endif
-#ifndef PCI_DEVICE_ID_ZORAN_36120
-#define PCI_DEVICE_ID_ZORAN_36120	0x6120
-#endif
 #define WRITE_ADDR_ISAC	(ZORAN_PO_WR | ZORAN_PO_GID0 | ZORAN_PO_GREG0)
 #define READ_DATA_ISAC	(ZORAN_PO_GID0 | ZORAN_PO_GREG1)
 #define WRITE_DATA_ISAC	(ZORAN_PO_WR | ZORAN_PO_GID0 | ZORAN_PO_GREG1)
diff -urN linux-2.2.19-pre3/drivers/isdn/hisax/w6692.c linux/drivers/isdn/hisax/w6692.c
--- linux-2.2.19-pre3/drivers/isdn/hisax/w6692.c	Mon Dec  3 20:54:14 2001
+++ linux/drivers/isdn/hisax/w6692.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: w6692.c,v 1.8 2000/09/07 20:33:30 werner Exp $
+/* $Id: w6692.c,v 1.12.6.2 2000/11/29 16:00:14 kai Exp $
  *
  * w6692.c   Winbond W6692 specific routines
  *
@@ -17,18 +17,6 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 
-#ifndef PCI_VENDOR_ID_ASUSCOM
-#define PCI_VENDOR_ID_ASUSCOM	0x675
-#endif
-#ifndef PCI_DEVICE_ID_ASUSCOM_TA1
-#define PCI_DEVICE_ID_ASUSCOM_TA1	0x1702
-#endif
-#ifndef PCI_VENDOR_ID_WINBOND2
-#define PCI_VENDOR_ID_WINBOND2	0x1050
-#endif
-#ifndef PCI_DEVICE_ID_WINBOND_6692
-#define	PCI_DEVICE_ID_WINBOND_6692	0x6692
-#endif
 /* table entry in the PCI devices list */
 typedef struct {
 	int vendor_id;
@@ -39,18 +27,18 @@
 
 static const PCI_ENTRY id_list[] =
 {
-	{PCI_VENDOR_ID_ASUSCOM, PCI_DEVICE_ID_ASUSCOM_TA1, "AsusCom", "TA XXX"},
-	{PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND_6692, "Winbond", "W6692"},
+	{PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, "Dynalink/AsusCom", "IS64PH"},
+	{PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"},
 	{0, 0, NULL, NULL}
 };
 
 extern const char *CardType[];
 
-const char *w6692_revision = "$Revision: 1.8 $";
+const char *w6692_revision = "$Revision: 1.12.6.2 $";
 
 #define DBUSY_TIMER_VALUE 80
 
-static char *W6692Ver[] HISAX_INITDATA =
+static char *W6692Ver[] __initdata =
 {"W6692 V00", "W6692 V01", "W6692 V10",
  "W6692 V11"};
 
diff -urN linux-2.2.19-pre3/drivers/isdn/isdn_common.c linux/drivers/isdn/isdn_common.c
--- linux-2.2.19-pre3/drivers/isdn/isdn_common.c	Mon Dec  3 20:54:15 2001
+++ linux/drivers/isdn/isdn_common.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_common.c,v 1.113 2000/11/01 17:54:00 detabc Exp $
+/* $Id: isdn_common.c,v 1.114.6.3 2000/12/18 22:14:09 kai Exp $
 
  * Linux ISDN subsystem, common used functions (linklevel).
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/isdn_common.h linux/drivers/isdn/isdn_common.h
--- linux-2.2.19-pre3/drivers/isdn/isdn_common.h	Sun Dec 10 16:49:42 2000
+++ linux/drivers/isdn/isdn_common.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_common.h,v 1.20 2000/06/16 13:00:27 keil Exp $
+/* $Id: isdn_common.h,v 1.21 2000/11/25 17:00:59 kai Exp $
 
  * header for Linux ISDN subsystem, common used functions and debugging-switches (linklevel).
  *
diff -urN linux-2.2.19-pre3/drivers/isdn/isdn_net.c linux/drivers/isdn/isdn_net.c
--- linux-2.2.19-pre3/drivers/isdn/isdn_net.c	Mon Dec  3 20:54:15 2001
+++ linux/drivers/isdn/isdn_net.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_net.c,v 1.140 2000/11/01 17:54:01 detabc Exp $
+/* $Id: isdn_net.c,v 1.140.6.1 2000/12/10 22:01:04 kai Exp $
 
  * Linux ISDN subsystem, network interfaces and related functions (linklevel).
  *
@@ -181,7 +181,7 @@
 int isdn_net_force_dial_lp(isdn_net_local *);
 static int isdn_net_start_xmit(struct sk_buff *, struct device *);
 
-char *isdn_net_revision = "$Revision: 1.140 $";
+char *isdn_net_revision = "$Revision: 1.140.6.1 $";
 
  /*
   * Code for raw-networking over ISDN
diff -urN linux-2.2.19-pre3/drivers/isdn/isdn_ppp.c linux/drivers/isdn/isdn_ppp.c
--- linux-2.2.19-pre3/drivers/isdn/isdn_ppp.c	Mon Dec  3 20:54:15 2001
+++ linux/drivers/isdn/isdn_ppp.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_ppp.c,v 1.77 2000/06/12 16:46:34 keil Exp $
+/* $Id: isdn_ppp.c,v 1.85 2000/11/25 17:00:59 kai Exp $
  *
  * Linux ISDN subsystem, functions for synchronous PPP (linklevel).
  *
@@ -36,8 +36,6 @@
 #define PPP_IPX 0x002b
 #endif
 
-/* set this if you use dynamic addressing */
-
 /* Prototypes */
 static int isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot);
 static int isdn_ppp_closewait(int slot);
@@ -85,7 +83,7 @@
 static int isdn_ppp_bundle(struct ippp_struct *, int unit);
 #endif	/* CONFIG_ISDN_MPP */
   
-char *isdn_ppp_revision = "$Revision: 1.77 $";
+char *isdn_ppp_revision = "$Revision: 1.85 $";
 
 static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS];
 
diff -urN linux-2.2.19-pre3/drivers/isdn/isdn_tty.c linux/drivers/isdn/isdn_tty.c
--- linux-2.2.19-pre3/drivers/isdn/isdn_tty.c	Mon Dec  3 20:54:15 2001
+++ linux/drivers/isdn/isdn_tty.c	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_tty.c,v 1.93 2000/08/05 09:58:26 armin Exp $
+/* $Id: isdn_tty.c,v 1.94 2000/11/25 17:00:59 kai Exp $
 
  * Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
  *
@@ -66,7 +66,7 @@
 static int si2bit[8] =
 {4, 1, 4, 4, 4, 4, 4, 4};
 
-char *isdn_tty_revision = "$Revision: 1.93 $";
+char *isdn_tty_revision = "$Revision: 1.94 $";
 
 
 /* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
diff -urN linux-2.2.19-pre3/drivers/net/ne2k-pci.c linux/drivers/net/ne2k-pci.c
--- linux-2.2.19-pre3/drivers/net/ne2k-pci.c	Mon Dec  3 20:54:15 2001
+++ linux/drivers/net/ne2k-pci.c	Mon Dec  3 20:54:39 2001
@@ -243,7 +243,7 @@
 		{
 			static unsigned version_printed = 0;
 			if (version_printed++ == 0)
-				printk(KERN_INFO "%s", version);
+				printk(KERN_INFO "%s %s", version1, version2);
 		}
 #endif
 
diff -urN linux-2.2.19-pre3/drivers/scsi/README.osst linux/drivers/scsi/README.osst
--- linux-2.2.19-pre3/drivers/scsi/README.osst	Mon Dec  3 20:54:18 2001
+++ linux/drivers/scsi/README.osst	Mon Dec  3 20:54:39 2001
@@ -1,6 +1,6 @@
 README file for the osst driver
 ===============================
-(w) Kurt Garloff <garloff@suse.de> 10/2000
+(w) Kurt Garloff <garloff@suse.de> 11/2000
 
 This file describes the osst driver as of version 0.8.x/0.9.x, the released
 version of the osst driver.
@@ -34,8 +34,8 @@
 are character devices with major no 206 and minor numbers like the /dev/stX
 devices. If those are not present, you may create them by calling
 Makedevs.sh as root (see below).
-The driver started beig a copy of st and as such, the osst devices'
-behaviour looks very much the same as st to the userspace applications.
+The driver started being a copy of st and as such, the osst devices'
+behavior looks very much the same as st to the userspace applications.
 
 
 History
@@ -50,57 +50,9 @@
 
 Installation
 ------------
-There is an easy and a correct approach to install the osst driver
-(a) Without patching your kernel
-(b) Full integration into your kernel
-(c) The mainstream kernel does already include the osst driver
-
-While it is still possible to use possibility (a), i.e. to compile the osst
-driver as a module without patching your kernel, this is not recommended, as
-you then have only very limited possibility to take advantage of the possible
-coexistence of st and osst. This possibility will be removed later.
-Anyway here is a description of how installation works.
-
-Make sure you have a configured 2.2.1x Linux kernel in /usr/src/linux by
-installing the approriate packages from your distro or by fetching the 
-source tarball from ftp.kernel.org or mirror and unpacking it in /usr/src/
-If your kernel is not yet configure, get a reasonable config file by doing
-cd /usr/src/linux
-make oldconfig			# You may use make menuconfig if starting
-				# from scratch
-make dep
-
-(a) Without patching your kernel
-
-cd /path/to/onstream/driver/	# REPLACE THIS WITH THE REAL PATH
-make
-make install
-
-That's all. You will get a couple of warnings on compilation, which you may
-ignore. The osst.o module is now in your module directory ready for loading
-and the device nodes have been created.
-
-(b) Full integration into the kernel. You need to have a reasonable kernel
-    config, otherwise you may be unable to use your system, as the produced
-    kernel may not support your hardware! IF YOU NEVER COMPILED YOUR OWN
-    KERNEL BEFORE, DON'T PROCEED, UNLESS YOU SUCEEDED USING YOUR SELF-
-    COMPILED KERNELS.
-
-cd /usr/src/linux
-patch -p1 < /path/to/onstream/driver/osst-2X.diff	# USE REAL PATH! X = 2,3,4
-cp -p /path/to/onstream/driver/osst.? drivers/scsi/	# Install drv srcs
-cp -p /path/to/onstream/driver/osst_options.h drivers/scsi/
-
-(b) and (c)
-
-make oldconfig			# or menuconfig / xconfig if you prefer
-				# enable the OSST driver!
-make dep
-make bzlilo			# to recopmile your kernel and have it
-				# installed
-make modules			# to compile the kernel modules
-make modules_install		# to install your modules
-depmod -a			# append kernel version if necessary
+osst got integrated into the linux kernel. Select it during kernel
+configuration as module or compile statically into the kernel.
+Compile your kernel and install the modules.
 
 Now, your osst driver is inside the kernel or available as a module,
 depending on your choice during kernel config. You may still need to create
@@ -113,7 +65,7 @@
 recognized.
 
 If you want to have the module autoloaded on access to /dev/osst, you may
-add somethind like
+add something like
 alias char-major-206 osst
 to your /etc/modules.conf (old name: conf.modules).
 
@@ -122,6 +74,9 @@
 to make programs assuming a default name of /dev/tape more convenient to
 use.
 
+The device nodes for osst have to be created. Use the Makedevs.sh script
+attached to this file.
+
 
 Using it
 --------
@@ -131,7 +86,11 @@
 symlink trick. The IOCTLs to control tape operation are also mostly
 supported and you may try the mt (or mt_st) program to jump between
 filemarks, eject the tape, ...
-There's one limitation: You need to use a blocksize of 32kB.
+
+There's one limitation: You need to use a block size of 32kB.
+
+(This limitation is worked on and will be fixed in version 0.8.7 of
+ this driver.)
 
 If you just want to get started with standard software, here is an example
 for creating and restoring a full backup:
@@ -141,11 +100,11 @@
 buffer -s 32k -m 8M -B -t -i /dev/osst0 | tar xvf - -C /
 
 The buffer command has been used to buffer the data before it goes to the
-tape (or the filesystem) in order to smooth out the data stream and prevent
+tape (or the file system) in order to smooth out the data stream and prevent
 the tape from needing to stop and rewind. The OnStream does have an internal
 buffer and a variable speed which help this, but especially on writing, the
 buffering still proves useful in most cases. It also pads the data to
-guarantees the blocksize of 32k. (Otherwise you may pass the -b64 option to
+guarantees the block size of 32k. (Otherwise you may pass the -b64 option to
 tar.)
 Expect something like 1.8MB/s for the SC-x0 drives and 0.9MB/s for the DI-30.
 The USB drive will give you about 0.7MB/s.
@@ -164,9 +123,9 @@
 http://sourceforge.net/cvs/?group_id=3581
 
 Note that the ide-tape driver as of 1.16f uses a slightly outdated on-tape
-format and therefore is not compeletely interoperable with osst tapes.
+format and therefore is not completely interoperable with osst tapes.
 
-The ADR-x0 line is fully SCSI-2 compliant and is spported by st, not osst.
+The ADR-x0 line is fully SCSI-2 compliant and is supported by st, not osst.
 The on-tape format is supposed to be compatible with the one used by osst.
 
 
@@ -183,7 +142,7 @@
 to see whether the problem is already known and solved. Otherwise, please
 report it to the mailing list. Your feedback is welcome. (This holds also
 for reports of successful usage, of course.) 
-In case of trouble, please do always provide the following infos:
+In case of trouble, please do always provide the following info:
 * driver and kernel version used (see syslog)
 * driver messages (syslog)
 * SCSI config and OnStream Firmware (/proc/scsi/scsi)
@@ -201,7 +160,7 @@
 Check the web pages for more info about the current developments.
 
 
-Acknowledgements
+Acknowledgments
 ----------------
 The driver has been started by making a copy of Kai Makisara's st driver.
 Most of the development has been done by Willem Riede. The presence of the
@@ -229,7 +188,7 @@
 #!/bin/sh
 # Script to create OnStream SC-x0 device nodes (major 206)
 # Usage: Makedevs.sh [nos [path to dev]]
-# $Id: README.osst,v 1.5.6.1 2000/10/10 13:45:37 garloff Exp $
+# $Id: README.osst.kernel,v 1.1.2.2 2000/12/20 14:08:38 garloff Exp $
 major=206
 nrs=4
 dir=/dev
diff -urN linux-2.2.19-pre3/drivers/scsi/README.tmscsim linux/drivers/scsi/README.tmscsim
--- linux-2.2.19-pre3/drivers/scsi/README.tmscsim	Mon Sep  4 10:39:20 2000
+++ linux/drivers/scsi/README.tmscsim	Mon Dec  3 20:54:39 2001
@@ -9,6 +9,7 @@
 6. Potential improvements
 7. Bug reports, debugging and updates
 8. Acknowledgements
+9. Copyright
 
 
 1. Purpose and history
@@ -25,7 +26,7 @@
 Tekram DC390(T) adapter. This is where the name comes from: tm = Tekram
 scsi = SCSI driver, m = AMD (?) as opposed to w for the DC390W/U/F
 (NCR53c8X5, X=2/7) driver. Yes, there was also a driver for the latter,
-tmscsimw, which supported DC390W/U/F adapters. It's not maintained any more,
+tmscsiw, which supported DC390W/U/F adapters. It's not maintained any more,
 as the ncr53c8xx is perfectly supporting these adpaters since some time.
 
 The driver first appeared in April 1996, exclusively supported the DC390 
@@ -56,10 +57,13 @@
 driver. Of course you have to choose to compile SCSI support and DC390(T)
 support into your kernel or as module when configuring your kernel for
 compiling.
+NEW: You may as well compile this module outside your kernel, using the
+supplied Makefile.
 
  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. 
+ my web page and apply the patch. Apply further patches to upgrade to the 
+ latest version of the driver.
 
  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
@@ -91,6 +95,8 @@
   tune2fs -e remount-ro /dev/sd??
 * have copies of your SCSI disk's partition tables on some safe location:
   dd if=/dev/sda of=/mnt/floppy/sda bs=512 count=1
+  or just print it with:
+  fdisk -l | lpr
 * make sure you are able to boot Linux (e.g. from floppy disk using InitRD)
   if your SCSI disk gets corrupted. You can use 
   ftp://student.physik.uni-dortmund.de/pub/linux/kernel/bootdisk.gz
@@ -102,7 +108,7 @@
 than the 33.33 MHz being in the PCI spec.
 
 If you want to share the IRQ with another device and the driver refuses to
-do, you might succeed with changing the DC390_IRQ type in tmscsim.c to 
+do so, you might succeed with changing the DC390_IRQ type in tmscsim.c to 
 SA_SHIRQ | SA_INTERRUPT.
 
 
@@ -121,11 +127,12 @@
  * Dynamically configurable by writing to /proc/scsi/tmscsim/?
  * Dynamic allocation of resources
  * SMP support: Locking on io_request lock (Linux 2.1/2.2) or adapter 
-    specific locks (Linux 2.3)
+    specific locks (Linux 2.5?)
  * 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 
-    H = Host, C = Channel, I = SCSI ID, L = SCSI LUN.) Use with care!
+   (Try: echo "scsi add-single-device C B T U" >/proc/scsi/scsi 
+    C = Controller, B = Bus, T = Target SCSI ID, U = Unit SCSI LUN.) 
+    Use with care!
  * Try to use the partition table for the determination of the mapping
 
 
@@ -139,20 +146,21 @@
 the attached devices and their settings.
 
 Here's an example:
-garloff@kg1:/home/garloff > cat /proc/scsi/tmscsim/0
-Tekram DC390/AM53C974 PCI SCSI Host Adapter, Driver Version 1.20s, 1998/08/20
-SCSI Host Nr 0, AM53C974 Adapter Nr 0
-IOPortBase 0x6200, IRQLevel 0x09
-MaxID 7, MaxLUN 8, AdapterID 7, SelTimeout 250 ms
-TagMaxNum 16, Status 0, ACBFlag 0, GlitchEater 24 ns
-Statistics: Nr of Cmnds 39563, Cmnds not sent directly 0, Out of SRB conds 0
-            Nr of lost arbitrations 17
+garloff@kurt:/home/garloff > cat /proc/scsi/tmscsim/0
+Tekram DC390/AM53C974 PCI SCSI Host Adapter, Driver Version 2.0e7 2000-11-28
+SCSI Host Nr 1, AM53C974 Adapter Nr 0
+IOPortBase 0xb000, IRQ 10
+MaxID 8, MaxLUN 8, AdapterID 6, SelTimeout 250 ms, DelayReset 1 s
+TagMaxNum 16, Status 0x00, ACBFlag 0x00, GlitchEater 24 ns
+Statistics: Cmnds 1470165, Cmnds not sent directly 0, Out of SRB conds 0
+            Lost arbitrations 587,  Sel. connected 0, Connected: No
 Nr of attached devices: 4, Nr of DCBs: 4
-Idx ID LUN Prty Sync DsCn SndS TagQ STOP NegoPeriod SyncSpeed SyncOffs
-00  00  00  Yes  Yes  Yes  Yes  Yes  No    100 ns    10.0 M      15
-01  01  00  Yes  Yes  Yes  Yes  Yes  No    100 ns    10.0 M      15
-02  03  00  Yes  Yes  Yes  Yes  No   No    100 ns    10.0 M      15
-03  05  00  Yes  No   Yes  Yes  No   No   (200 ns)
+Map of attached LUNs: 01 00 00 03 01 00 00 00
+Idx ID LUN Prty Sync DsCn SndS TagQ NegoPeriod SyncSpeed SyncOffs MaxCmd
+00  00  00  Yes  Yes  Yes  Yes  Yes   100 ns    10.0 M      15      16
+01  03  00  Yes  Yes  Yes  Yes  No    100 ns    10.0 M      15      01
+02  03  01  Yes  Yes  Yes  Yes  No    100 ns    10.0 M      15      01
+03  04  00  Yes  Yes  Yes  Yes  No    100 ns    10.0 M      15      01
 
 Note that the settings MaxID and MaxLUN are not zero- but one-based, which
 means that a setting MaxLUN=4, will result in the support of LUNs 0..3. This
@@ -178,9 +186,8 @@
 The last values are only shown, if Sync is enabled. (NegoPeriod is still
 displayed in brackets to show the values which will be used after enabling
 Sync.)
-The STOP parameter is for testing/debugging purposes only and should bet set
-to No. Please don't fiddle with it, unless you want to get rid of the
-contents of your disk.
+MaxCmd ist the number of commands (=tags) which can be processed at the same
+time by the device.
 
 If you want to change a setting, you can do that by writing to
 /proc/scsi/tmscsim/?. Basically you have to imitate the output of driver.
@@ -196,8 +203,8 @@
      echo "MaxLUN=8 seltimeout 200" >/proc/scsi/tmscsim/0
 
     Note that you can only change MaxID, MaxLUN, AdapterID, SelTimeOut,
-    TagMaxNum, ACBFlag and GlitchEater. Don't change ACBFlag unless you
-    want to see what happens, if the driver hangs.
+    TagMaxNum, ACBFlag, GlitchEater and DelayReset. Don't change ACBFlag
+    unless you want to see what happens, if the driver hangs.
 
 (2) Change device settings: You write a config line to the driver. The Nr
     must match the ID and LUN given. If you give "-" as parameter, it is
@@ -207,8 +214,8 @@
     an INQUIRY on the device if necessary to check if it is capable to operate
     with the given settings (Sync, TagQ).
     Examples:
-     echo "0 0 0 y y y - y - 10" >/proc/scsi/tmscsim/0
-     echo "3 5 0 y n y" >/proc/scsi/tmscsim/0
+     echo "0 0 0 y y y - y - 10 " >/proc/scsi/tmscsim/0
+     echo "3 5 0 y n y " >/proc/scsi/tmscsim/0
 
     To give a short explanation of the first example: 
     The first three numbers, "0 0 0" (Device index 0, SCSI ID 0, SCSI LUN 0),
@@ -223,22 +230,26 @@
     discussed above. The values used in this example will result in maximum
     performance.
 
-(3) Special commands: You can force a SCSI bus reset, an INQUIRY command and
-    the removal of a device's DCB.
+(3) Special commands: You can force a SCSI bus reset, an INQUIRY command, the
+    removal or the addition of a device's DCB and a SCSI register dump.
     This is only used for debugging when you meet problems. The parameter of
-    the INQUIRY and remove command is the device index as shown by the
+    the INQUIRY and REMOVE commands is the device index as shown by the
     output of /proc/scsi/tmscsim/? in the device listing in the first column
-    (Idx).
+    (Idx). ADD takes the SCSI ID and LUN.
     Examples:
      echo "reset" >/proc/scsi/tmscsim/0
      echo "inquiry 1" >/proc/scsi/tmscsim/0
      echo "remove 2" >/proc/scsi/tmscsim/1
+     echo "add 2 3" >/proc/scsi/tmscsim/?
+     echo "dump" >/proc/scsi/tmscsim/0
 
-    Note that you will meet problems when you remove a device's DCB with the
+    Note that you will meet problems when you REMOVE a device's DCB with the
     remove command if it contains partitions which are mounted. Only use it
     after unmounting its partitions, telling the SCSI mid-level code to
     remove it (scsi remove-single-device) and you really need a few bytes of
     memory.
+    The ADD command allows you to configure a device before you tell the
+    mid-level code to try detection.
 
 
 I'd suggest reviewing the output of /proc/scsi/tmscsim/? after changing
@@ -247,18 +258,20 @@
 
 5. Configuration via boot/module parameters
 -------------------------------------------
-With the DC390, the driver reads its EEPROM settings and IGNORES boot / 
-module parameters. If you want to override the EEPROM settings of a DC390, 
-you have to use the /proc/scsi/tmscsim/? interface described in the above
-chapter.
-
-However, if you do have another AM53C974 based adapter you might want to
-adjust some settings before you are able to write to the /proc/scsi/tmscsim/?
-pseudo-file, e.g. if you want to use another adapter ID than 7. (Note that
-the log message "DC390: No EEPROM found!" is normal without a DC390.)
+With the DC390, the driver reads its EEPROM settings and tries to use them.
+But you may want to override the settings prior to being able to change the
+driver configuration via /proc/scsi/tmscsim/?.
+If you do have another AM53C974 based adapter, that's even the only
+possibility to adjust settings before you are able to write to the
+/proc/scsi/tmscsim/? pseudo-file, e.g. if you want to use another 
+adapter ID than 7.  
+(BTW, the log message "DC390: No EEPROM found!" is normal without a DC390.)
 For this purpose, you can pass options to the driver before it is initialised
 by using kernel or module parameters. See lilo(8) or modprobe(1) manual
 pages on how to pass params to the kernel or a module.
+[NOTE: Formerly, it was not possible to override the EEPROM supplied
+ settings of the DC390 with cmd line parameters. This has changed since
+ 2.0e7]
 
 The syntax of the params is much shorter than the syntax of the /proc/...
 interface. This makes it a little bit more difficult to use. However, long
@@ -269,7 +282,7 @@
 DC390 EEPROM, the settings are given in a DC390 BIOS' way.
 
 Here's the syntax:
-tmscsim=AdaptID,SpdIdx,DevMode,AdaptMode,TaggedCmnds
+tmscsim=AdaptID,SpdIdx,DevMode,AdaptMode,TaggedCmnds,DelayReset
 
 Each of the parameters is a number, containing the described information:
 
@@ -278,7 +291,7 @@
 
 * SpdIdx: The index of the maximum speed as in the DC390 BIOS. The values
   0..7 mean 10, 8.0, 6.7, 5.7, 5.0, 4.0, 3.1 and 2 MHz resp. Default is
-  1 (8.0 MHz).
+  0 (10.0 MHz).
 
 * DevMode is a bit mapped value describing the per-device features. It
   applies to all devices. (Sync, Disc and TagQ will only apply, if the
@@ -289,7 +302,7 @@
    *1	 0x02	    2	  Synchronous Negotiation
    *2	 0x04	    4	  Disconnection
    *3	 0x08	    8	  Send Start command on startup. (Not used)
-   *4	 0x10	   16	  Tagged Queueing
+   *4	 0x10	   16	  Tagged Command Queueing
 
   As usual, the desired value is obtained by adding the wanted values. If
   you want to enable all values, e.g., you would use 31(0x1f). Default is 31.
@@ -315,18 +328,23 @@
     *3		16
      4		32
 
+* DelayReset is the time in seconds (minus 0.5s), the adapter waits, after a
+  bus reset. Default is 1 (corresp. to 1.5s).
+
 Example:
  modprobe tmscsim tmscsim=6,2,31
 would set the adapter ID to 6, max. speed to 6.7 MHz, enable all device
-features and leave the adapter features and the number of Tagged Commands 
-to the defaults.
-
-As you can see, you don't need to specify all of the five params.
+features and leave the adapter features, the number of Tagged Commands
+and the Delay after a reset to the defaults.
 
-The defaults (7,1,31,15,3) are aggressive to allow good performance. You can
-use tmscsim=7,0,31,63,4 for maximum performance, if your SCSI chain is
-perfect. If you meet problems, you can use tmscsim=-1 which is a shortcut
-for tmscsim=7,4,9,15,2. 
+As you can see, you don't need to specify all of the six params.
+If you want values to be ignored (i.e. the EEprom settings or the defaults
+will be used), you may pass -2 (not 0!) at the corresponding position.
+
+The defaults (7,0,31,15,3,1) are aggressive to allow good performance. You
+can use tmscsim=7,0,31,63,4,0 for maximum performance, if your SCSI chain
+allows it. If you meet problems, you can use tmscsim=-1 which is a shortcut
+for tmscsim=7,4,9,15,2,10.
 
 
 6. Potential improvements
@@ -334,42 +352,47 @@
 Most of the intended work on the driver has been done. Here are a few ideas
 to further improve its usability:
 
+* Cleanly separate per-Target and per-LUN properties (DCB)
 * More intelligent abort() routine
-* Implement new_eh code (Linux-2.1+)
-* Have the mid-level code (and not the driver) handle more of the various
-  conditions.
-* Rework command queueing in the driver
+* Use new_eh code (Linux-2.1+)
+* Have the mid-level (ML) code (and not the driver) handle more of the
+  various conditions.
+* Command queueing in the driver: Eliminate Query list and use ML instead.
 * More user friendly boot/module param syntax
 
 Further investigation on these problems:
 
 * Driver hangs with sync readcdda (xcdroast) (most probably VIA PCI error)
 
-Known problems:
+Known problems: 
+Please see http://www.garloff.de/kurt/linux/dc390/problems.html
 
-* There was a report that with a certain Scanner, the last SCSI command
-  won't be finished correctly. This might be a command queueing bug or a bug
-  in SCSI implementation of the scanner. Issueing another command to the
-  scanner seems to help. (Try echo "INQUIRY x" >/proc/scsi/tmscsim/?, where
-  x is the index (not the SCSI ID!) of the scanner. See 4.(3).)
+* Changing the parameters of multi-lun by the tmscsim/? interface will
+  cause problems, cause these settings are mostly per Target and not per LUN
+  and should be updated accordingly. To be fixed for 2.0d24.
+* CDRs (eg Yam CRW4416) not recognized, because some buggy devices don't 
+  recover from a SCSI reset in time. Use a higher delay or don't issue
+  a SCSI bus reset on driver initialization. See problems page.
+  For the CRW4416S, this seems to be solved with firmware 1.0g (reported by 
+  Jean-Yves Barbier).
+* TEAC CD-532S not being recognized. (Works with 1.11).
+* Scanners (eg. Astra UMAX 1220S) don't work: Disable Sync Negotiation.
+  If this does not help, try echo "INQUIRY t" >/proc/scsi/tmscsim/? (t
+  replaced by the dev index of your scanner). You may try to reset your SCSI
+  bus afterwards (echo "RESET" >/proc/scsi/tmscsim/?).
+  The problem seems to be solved as of 2.0d18, thanks to Andreas Rick.
 * If there is a valid partition table, the driver will use it for determing
-  the mapping. Other operating systems may not like this mapping, though
+  the mapping. If there's none, a reasonable mapping (Symbios-like) will be
+  assumed. Other operating systems may not like this mapping, though
   it's consistent with the BIOS' behaviour. Old DC390 drivers ignored the
   partition table and used a H/S = 64/32 or 255/63 translation. So if you
   want to be compatible to those, use this old mapping when creating
-  partition tables.
-* In some situations, the driver will get stuck in an abort loop. Please
-  disable DsCn, if you meet this problem. Please contact me for further
-  debugging.
-* 2.1.115+: Linux misses locks in sr_ioctl.c and scsi_ioctl.c
-  There used to be a patch included here, which partially solved the
-  problem. I suggest you contact Chiaki Ishikawa <ishikawa@yk.rim.or.jp>, 
-  Richard Waltham <dormouse@farsrobt.demon.co.uk> or Doug Ledford
-  <dledford@dialnet.net>, 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. There used
-  to be a patch included here to fix this, but I was told that it is fixed
-  in 2.0.36.
+  partition tables. Even worse, on bootup the DC390 might complain if other
+  mappings are found, so auto rebooting may fail.
+* In some situations, the driver will get stuck in an abort loop. This is a
+  bad interaction between the Mid-Layer of Linux' SCSI code and the driver.
+  Try to disable DsCn, if you meet this problem. Please contact me for
+  further debugging.
 
 
 7. Bug reports, debugging and updates
@@ -394,25 +417,33 @@
 
 The latest version of the driver can be found at:
  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.)
+ ftp://ftp.suse.com/pub/people/garloff/linux/dc390/
 
 
 8. Acknowledgements
 -------------------
-Thanks to Linus Torvalds, Alan Cox, David Miller, Rik v. Riel, the FSF
-people, the XFree86 team and all the others for the wonderful OS and
-software. 
+Thanks to Linus Torvalds, Alan Cox, the FSF people, the XFree86 team and 
+all the others for the wonderful OS and software.
 Thanks to C.L. Huang and Philip Giang (Tekram) for the initial driver
 release and support.
-Thanks to Doug Ledford, Gerard Roudier for support with SCSI coding.
+Thanks to Doug Ledford, Gérard Roudier for support with SCSI coding.
 Thanks to a lot of people (espec. Chiaki Ishikawa, Andreas Haumer, Hubert 
 Tonneau) for intensively testing the driver (and even risking data loss
-doing this during early revisions). 
+doing this during early revisions).
+Recently, SuSE GmbH, Nuernberg, FRG, has been paying me for the driver
+development and maintenance. Special thanks!
+
 
+9. Copyright
+------------
+ This driver is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by   
+ the Free Software Foundation; version 2 of the License.
+ If you want to use any later version of the GNU GPL, you will probably
+ be allowed to, but you have to ask me and Tekram <erich@tekram.com.tw>
+ before.
 
 -------------------------------------------------------------------------
 Written by Kurt Garloff <kurt@garloff.de> 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 $
+Last updated 2000/11/28, driver revision 2.0e7
+$Id: README.tmscsim,v 2.25.2.7 2000/12/20 01:07:12 garloff Exp $
diff -urN linux-2.2.19-pre3/drivers/scsi/atp870u.c linux/drivers/scsi/atp870u.c
--- linux-2.2.19-pre3/drivers/scsi/atp870u.c	Sun Dec 10 16:49:43 2000
+++ linux/drivers/scsi/atp870u.c	Mon Dec  3 20:54:39 2001
@@ -10,6 +10,7 @@
  *		   support atp876 chip
  *		   enable 32 bit fifo transfer
  *		   support cdrom & remove device run ultra speed
+ *		   fix disconnect bug  2000/12/21
  */
 
 #include <linux/module.h>
@@ -76,6 +77,7 @@
 		unsigned char dirctu;
 		unsigned char devspu;
 		unsigned char devtypeu;
+		unsigned char devlcmdu;
 		unsigned long prdaddru;
 		unsigned long tran_lenu;
 		unsigned long last_lenu;
@@ -143,14 +145,6 @@
 		tmport -= 0x08;
 
 		i = inb(tmport);
-		if ((j & 0x40) == 0)
-		{
-			if ((dev->last_cmd & 0x40) == 0)
-			{
-				dev->last_cmd = 0xff;
-			}
-		}
-		else dev->last_cmd |= 0x40;
 
 		tmport -= 0x02;
 		target_id = inb(tmport);
@@ -166,8 +160,21 @@
 			target_id &= 0x07;
 		}
 
+		if ((j & 0x40) != 0)
+		{
+		     if (dev->last_cmd == 0xff)
+		     {
+			dev->last_cmd = target_id;
+		     }
+		     dev->last_cmd |= 0x40;
+		}
+
 		if (i == 0x85)
 		{
+			if ((dev->last_cmd & 0xf0) != 0x40)
+			{
+			   dev->last_cmd = 0xff;
+			}
 			/*
 			 *	Flip wide
 			 */
@@ -196,6 +203,10 @@
 		}
 		if (i == 0x21)
 		{
+			if ((dev->last_cmd & 0xf0) != 0x40)
+			{
+			   dev->last_cmd = 0xff;
+			}
 			tmport -= 0x05;
 			adrcntu = 0;
 			((unsigned char *) &adrcntu)[2] = inb(tmport++);
@@ -221,6 +232,10 @@
 				tmport += 0x0d;
 				lun = inb(tmport) & 0x07;
 			} else {
+				if ((dev->last_cmd & 0xf0) != 0x40)
+				{
+				   dev->last_cmd = 0xff;
+				}
 				if (j == 0x41)
 				{
 					tmport += 0x02;
@@ -251,6 +266,10 @@
 					return;
 				}
 			}
+			if (dev->last_cmd != 0xff)
+			{
+			   dev->last_cmd |= 0x40;
+			}
 			tmport = workportu + 0x10;
 			outb(0x45, tmport);
 			tmport += 0x06;
@@ -371,12 +390,20 @@
 		workrequ = dev->id[target_id].curr_req;
 
 		if (i == 0x42) {
+			if ((dev->last_cmd & 0xf0) != 0x40)
+			{
+			   dev->last_cmd = 0xff;
+			}
 			errstus = 0x02;
 			workrequ->result = errstus;
 			goto go_42;
 		}
 		if (i == 0x16)
 		{
+			if ((dev->last_cmd & 0xf0) != 0x40)
+			{
+			   dev->last_cmd = 0xff;
+			}
 			errstus = 0;
 			tmport -= 0x08;
 			errstus = inb(tmport);
@@ -387,13 +414,13 @@
 			 */
 			spin_lock_irqsave(&io_request_lock, flags);
 			(*workrequ->scsi_done) (workrequ);
-			spin_unlock_irqrestore(&io_request_lock, flags);
 
 			/*
 			 *	Clear it off the queue
 			 */
 			dev->id[target_id].curr_req = 0;
 			dev->working--;
+			spin_unlock_irqrestore(&io_request_lock, flags);
 			/*
 			 *	Take it back wide
 			 */
@@ -411,11 +438,15 @@
 			if (((dev->last_cmd != 0xff) || (dev->quhdu != dev->quendu)) &&
 			    (dev->in_snd == 0))
 			{
-				send_s870(h);
+			   send_s870(h);
 			}
 			dev->in_int = 0;
 			return;
 		}
+		if ((dev->last_cmd & 0xf0) != 0x40)
+		{
+		   dev->last_cmd = 0xff;
+		}
 		if (i == 0x4f) {
 			i = 0x89;
 		}
@@ -480,7 +511,7 @@
 
 int atp870u_queuecommand(Scsi_Cmnd * req_p, void (*done) (Scsi_Cmnd *))
 {
-	unsigned char i, h;
+	unsigned char h;
 	unsigned long flags;
 	unsigned short int m;
 	unsigned int tmport;
@@ -522,6 +553,8 @@
 	/*
 	 *	Count new command
 	 */
+	save_flags(flags);
+	cli();
 	dev->quendu++;
 	if (dev->quendu >= qcnt) {
 		dev->quendu = 0;
@@ -529,18 +562,17 @@
 	/*
 	 *	Check queue state
 	 */
-wait_que_empty:
 	if (dev->quhdu == dev->quendu) {
-		goto wait_que_empty;
+		if (dev->quendu == 0) {
+			dev->quendu = qcnt;
+		}
+		dev->quendu--;
+		req_p->result = 0x00020000;
+		done(req_p);
+		restore_flags(flags);
+		return 0;
 	}
-	save_flags(flags);
-	cli();
 	dev->querequ[dev->quendu] = req_p;
-	if (dev->quendu == 0) {
-		i = qcnt - 1;
-	} else {
-		i = dev->quendu - 1;
-	}
 	tmport = dev->ioport + 0x1c;
 	restore_flags(flags);
 	if ((inb(tmport) == 0) && (dev->in_int == 0) && (dev->in_snd == 0)) {
@@ -593,6 +625,12 @@
 		   return ;
 		}
 	}
+	if ((dev->last_cmd != 0xff) && (dev->working != 0))
+	{
+	     dev->in_snd = 0;
+	     restore_flags(flags);
+	     return ;
+	}
 	dev->working++;
 	j = dev->quhdu;
 	dev->quhdu++;
@@ -626,6 +664,7 @@
 	restore_flags(flags);
 	return;
 oktosend:
+	dev->id[workrequ->target].devlcmdu=0;
 	memcpy(&dev->ata_cdbu[0], &workrequ->cmnd[0], workrequ->cmd_len);
 	if (dev->ata_cdbu[0] == READ_CAPACITY) {
 		if (workrequ->request_bufflen > 8) {
@@ -635,15 +674,6 @@
 	if (dev->ata_cdbu[0] == 0x00) {
 		workrequ->request_bufflen = 0;
 	}
-	/*
-	 *	Why limit this ????
-	 */
-	if (dev->ata_cdbu[0] == INQUIRY) {
-		if (workrequ->request_bufflen > 0x24) {
-			workrequ->request_bufflen = 0x24;
-			dev->ata_cdbu[4] = 0x24;
-		}
-	}
 
 	tmport = workportu + 0x1b;
 	j = 0;
@@ -735,6 +765,7 @@
 		} else {
 			dev->last_cmd |= 0x40;
 		}
+		dev->id[target_id].devlcmdu=dev->last_cmd;
 		dev->in_snd = 0;
 		restore_flags(flags);
 		return;
@@ -809,6 +840,7 @@
 		} else {
 			dev->last_cmd |= 0x40;
 		}
+		dev->id[target_id].devlcmdu=dev->last_cmd;
 		dev->in_snd = 0;
 		restore_flags(flags);
 		return;
@@ -821,6 +853,7 @@
 	} else {
 		dev->last_cmd |= 0x40;
 	}
+	dev->id[target_id].devlcmdu=dev->last_cmd;
 	dev->in_snd = 0;
 	restore_flags(flags);
 	return;
@@ -1751,7 +1784,7 @@
 		if (chip_ver[h] > 0x07) 	  /* check if atp876 chip   */
 		{				  /* then enable terminator */
 		   tmport = base_io + 0x3e;
-		   outb(0x30, tmport);
+		   outb(0x00, tmport);
 		}
 
 		tmport = base_io + 0x3a;
@@ -1812,7 +1845,8 @@
 
 int atp870u_abort(Scsi_Cmnd * SCpnt)
 {
-	unsigned char h, j;
+	unsigned char h, j, k;
+	Scsi_Cmnd *workrequ;
 	unsigned int tmport;
 	struct atp_unit *dev;
 	for (h = 0; h <= admaxu; h++) {
@@ -1839,12 +1873,27 @@
 	printk(" r22=%2x", inb(tmport));
 	tmport += 0x18;
 	printk(" r3a=%2x \n",inb(tmport));
+	for(j=0;j<16;j++)
+	{
+	   if (dev->id[j].curr_req != NULL)
+	   {
+		workrequ = dev->id[j].curr_req;
+		printk("\n que cdb= ");
+		for (k=0; k < workrequ->cmd_len; k++)
+		{
+		    printk(" %2x ",workrequ->cmnd[k]);
+		}
+		printk(" last_lenu= %x ",dev->id[j].last_lenu);
+		printk(" dev_lcmd= %x ",dev->id[j].devlcmdu);
+	   }
+	}
 	return (SCSI_ABORT_SNOOZE);
 }
 
 int atp870u_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
 {
 	unsigned char h;
+	struct atp_unit *dev;
 	/*
 	 * See if a bus reset was suggested.
 	 */
@@ -1855,6 +1904,7 @@
 	}
 	panic("Reset bus host not found !");
 find_host:
+	dev=&atp_unit[h];
 /*	SCpnt->result = 0x00080000;
 	SCpnt->scsi_done(SCpnt);
 	dev->working=0;
@@ -1868,7 +1918,7 @@
 {
 	static char buffer[128];
 
-	strcpy(buffer, "ACARD AEC-6710/6712 PCI Ultra/W SCSI-3 Adapter Driver V2.1+ac ");
+	strcpy(buffer, "ACARD AEC-6710/6712 PCI Ultra/W SCSI-3 Adapter Driver V2.3+ac ");
 
 	return buffer;
 }
@@ -1913,7 +1963,7 @@
 	if (offset == 0) {
 		memset(buff, 0, sizeof(buff));
 	}
-	size += sprintf(BLS, "ACARD AEC-671X Driver Version: 2.1+ac\n");
+	size += sprintf(BLS, "ACARD AEC-671X Driver Version: 2.3+ac\n");
 	len += size;
 	pos = begin + len;
 	size = 0;
diff -urN linux-2.2.19-pre3/drivers/scsi/dc390.h linux/drivers/scsi/dc390.h
--- linux-2.2.19-pre3/drivers/scsi/dc390.h	Tue May 11 10:36:36 1999
+++ linux/drivers/scsi/dc390.h	Mon Dec  3 20:54:39 2001
@@ -4,9 +4,7 @@
  *	Description: Device Driver for Tekram DC-390(T) PCI SCSI       *
  *		     Bus Master Host Adapter			       *
  ***********************************************************************/
-/* $Id: dc390.h,v 2.12 1998/12/25 17:33:27 garloff Exp $ */
-
-#include <linux/version.h>
+/* $Id: dc390.h,v 2.43.2.22 2000/12/20 00:39:36 garloff Exp $ */
 
 /*
  * DC390/AMD 53C974 driver, header file
@@ -15,12 +13,27 @@
 #ifndef DC390_H
 #define DC390_H
 
+#include <linux/version.h>
+#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.0d 1998/12/25"
+#define DC390_VERSION "2.0f 2000-12-20"
 
-#if defined(HOSTS_C) || defined(MODULE)
+/* We don't have eh_abort_handler, eh_device_reset_handler, 
+ * eh_bus_reset_handler, eh_host_reset_handler yet! 
+ * So long: Use old exception handling :-( */
+#define OLD_EH
 
-#include <scsi/scsicam.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2,1,70) || defined (OLD_EH)
+# define NEW_EH
+#else
+# define NEW_EH use_new_eh_code: 1,
+# define USE_NEW_EH
+#endif
+
+#if defined(HOSTS_C) || defined(MODULE) || LINUX_VERSION_CODE > KERNEL_VERSION(2,3,99)
 
 extern int DC390_detect(Scsi_Host_Template *psht);
 extern int DC390_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
@@ -34,9 +47,29 @@
 # define DC390_release NULL
 #endif
 
-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 >= KERNEL_VERSION(2,3,30)
+#define DC390_T    {					\
+   proc_name:      "tmscsim",                           \
+   proc_info:      DC390_proc_info,			\
+   name:           DC390_BANNER " V" DC390_VERSION,	\
+   detect:         DC390_detect,			\
+   release:        DC390_release,			\
+   queuecommand:   DC390_queue_command,			\
+   abort:          DC390_abort,				\
+   reset:          DC390_reset,				\
+   bios_param:     DC390_bios_param,			\
+   can_queue:      42,					\
+   this_id:        7,					\
+   sg_tablesize:   SG_ALL,				\
+   cmd_per_lun:    16,					\
+   NEW_EH						\
+   unchecked_isa_dma: 0,				\
+   use_clustering: DISABLE_CLUSTERING			\
+   }
+#else
+extern struct proc_dir_entry DC390_proc_scsi_tmscsim;
 #define DC390_T    {					\
    proc_dir:       &DC390_proc_scsi_tmscsim,		\
    proc_info:      DC390_proc_info,			\
@@ -47,13 +80,15 @@
    abort:          DC390_abort,				\
    reset:          DC390_reset,				\
    bios_param:     DC390_bios_param,			\
-   can_queue:      17,					\
+   can_queue:      42,					\
    this_id:        7,					\
    sg_tablesize:   SG_ALL,				\
-   cmd_per_lun:    8,					\
+   cmd_per_lun:    16,					\
+   NEW_EH						\
+   unchecked_isa_dma: 0,				\
    use_clustering: DISABLE_CLUSTERING			\
    }
-
+#endif
 #endif /* defined(HOSTS_C) || defined(MODULE) */
 
 #endif /* DC390_H */
diff -urN linux-2.2.19-pre3/drivers/scsi/osst.c linux/drivers/scsi/osst.c
--- linux-2.2.19-pre3/drivers/scsi/osst.c	Mon Dec  3 20:54:18 2001
+++ linux/drivers/scsi/osst.c	Mon Dec  3 20:54:39 2001
@@ -16,14 +16,14 @@
   Copyright 1992 - 2000 Kai Makisara
 		 email Kai.Makisara@metla.fi
 
-  $Header: /home/cvsroot/Driver/osst.c,v 1.28.2.7 2000/10/05 00:45:52 riede Exp $
+  $Header: /home/cvsroot/Driver/osst.c,v 1.28.2.12.2.1 2000/12/15 20:36:12 garloff Exp $
 
   Last modified: Wed Feb  2 22:04:05 2000 by makisara@kai.makisara.local
   Some small formal changes - aeb, 950809
 */
 
-static const char * cvsid = "$Id: osst.c,v 1.28.2.7 2000/10/05 00:45:52 riede Exp $";
-const char * osst_version = "0.8.5";
+static const char * cvsid = "$Id: osst.c,v 1.28.2.12.2.1 2000/12/15 20:36:12 garloff Exp $";
+const char * osst_version = "0.8.6.1";
 
 /* The "failure to reconnect" firmware bug */
 #define OSST_FW_NEED_POLL_MIN 10602 /*(107A)*/
@@ -283,7 +283,8 @@
 {
   unsigned long flags;
   unsigned char *bp;
-
+//static int inject = 0; /* FIXME - take out inject occasional read errors */
+//static int repeat = 0;
   spin_lock_irqsave(&io_request_lock, flags);
   if (SCpnt == NULL)
     if ((SCpnt = scsi_allocate_device(NULL, STp->device, 1)) == NULL) {
@@ -316,6 +317,12 @@
       down(SCpnt->request.sem);
 
       (STp->buffer)->last_result_fatal = osst_chk_result(SCpnt);
+//if ((STp->buffer)->last_result_fatal == 0 &&
+//    cmd[0] == READ_6 && cmd[4] && ( /* (++ inject % 83) == 29  || */
+//     (STp->first_frame_position == 240 /* or STp->read_error_frame to fail again on the block calculated above */ && ++repeat < 3))) {
+//	printk(OSST_DEB_MSG "osst%d: injecting read error\n", TAPE_NR(STp->devt));
+//	STp->buffer->last_result_fatal = 1; /* FIXME - take out inject occasional read errors */
+//}
   }
 
   return SCpnt;
@@ -506,14 +513,16 @@
                 STps->eof = ST_FM_HIT;
 
 		i = ntohl(aux->filemark_cnt);
-		if (STp->header_cache != NULL && i < OS_FM_TAB_MAX &&
-		    STp->first_frame_position - 1 != ntohl(STp->header_cache->dat_fm_tab.fm_tab_ent[i])) {
+		if (STp->header_cache != NULL && i < OS_FM_TAB_MAX && (i > STp->filemark_cnt ||
+		    STp->first_frame_position - 1 != ntohl(STp->header_cache->dat_fm_tab.fm_tab_ent[i]))) {
 #if 1 //DEBUG
 			printk(OSST_DEB_MSG "osst%i: %s filemark %d at frame %d\n", dev,
 				  STp->header_cache->dat_fm_tab.fm_tab_ent[i] == 0?"Learned":"Corrected",
 				  i, STp->first_frame_position - 1);
 #endif
 			STp->header_cache->dat_fm_tab.fm_tab_ent[i] = htonl(STp->first_frame_position - 1);
+			if (i >= STp->filemark_cnt)
+				 STp->filemark_cnt = i+1;
 		}
         }
         if (aux->frame_type == OS_FRAME_TYPE_EOD) {
@@ -623,7 +632,32 @@
 	STp->ps[STp->partition].rw = ST_IDLE;
 	return (result);
 }
+/*
+static int osst_buffer_stats[64];
+
+static void osst_build_stats(OS_Scsi_Tape * STp, Scsi_Cmnd ** aSCpnt)
+{
+	unsigned int i;
+
+	osst_get_frame_position (STp, aSCpnt);
+	i = STp->cur_frames > 63 ? 63 : STp->cur_frames;
+	osst_buffer_stats[i]++;
+}
 
+static void osst_report_stats()
+{
+	unsigned int i;
+
+	for (i=0; i<64; i+=8) {
+		printk(OSST_DEB_MSG "osst buffer stats %2d: %5d %5d %5d %5d %5d %5d %5d %5d\n", i,
+			osst_buffer_stats[i  ], osst_buffer_stats[i+1],
+		       	osst_buffer_stats[i+2], osst_buffer_stats[i+3], 
+			osst_buffer_stats[i+4], osst_buffer_stats[i+5],
+		       	osst_buffer_stats[i+6], osst_buffer_stats[i+7]);
+	}
+
+}
+*/
 #define OSST_POLL_PER_SEC 10
 static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Cmnd ** aSCpnt, int curr, int minlast, int to)
 {
@@ -632,7 +666,7 @@
 #if DEBUG
 	char    notyetprinted = 1;
 #endif
-	if (STp->ps[STp->partition].rw != ST_READING)
+	if (minlast >= 0 && STp->ps[STp->partition].rw != ST_READING)
 		printk(KERN_ERR "osst%i: waiting for frame without having initialized read!\n", dev);
 
 	while (time_before (jiffies, startwait + to*HZ))
@@ -640,7 +674,8 @@
 		int result;
 		result = osst_get_frame_position (STp, aSCpnt);
 		if (result == -EIO)
-			result = osst_write_error_recovery(STp, aSCpnt, 0);
+			if ((result = osst_write_error_recovery(STp, aSCpnt, 0)) == 0)
+				return 0;	/* successfull recovery leaves drive ready for frame */
 		if (result < 0) break;
 		if (STp->first_frame_position == curr &&
 		    ((minlast < 0 &&
@@ -715,6 +750,10 @@
 
 	if ((STp->buffer)->last_result_fatal) {
 	    retval = 1;
+	    if (STp->read_error_frame == 0) {
+		STp->read_error_frame = STp->first_frame_position;
+		printk(OSST_DEB_MSG "osst: recording read error at %d\n", STp->read_error_frame);/*FIXME*/
+	    }
 #if DEBUG
 	    if (debugging)
 	        printk(OSST_DEB_MSG "osst%d: Sense: %2x %2x %2x %2x %2x %2x %2x %2x\n",
@@ -786,6 +825,8 @@
 	ST_partstat * STps  = &(STp->ps[STp->partition]);
 	int           dev   = TAPE_NR(STp->devt);
         int           cnt   = 0,
+		      bad   = 0,
+		      past  = 0,
 		      x,
 		      position;
 
@@ -793,9 +834,17 @@
          * Search and wait for the next logical tape block
          */
         while (1) {
-                if (cnt++ > 200) {
+                if (cnt++ > 400) {
                         printk(KERN_WARNING "osst%d: Couldn't find logical block %d, aborting\n",
 					    dev, logical_blk_num);
+			if (STp->read_error_frame) {
+				osst_set_frame_position(STp, aSCpnt, STp->read_error_frame, 0);
+#if 1 //DEBUG
+                        	printk(OSST_DEB_MSG "osst%d: Repositioning tape to bad block %d\n",
+						 dev, STp->read_error_frame);
+#endif
+				STp->read_error_frame = 0;
+			}
                         return (-EIO);
                 }
 #if DEBUG
@@ -808,12 +857,16 @@
                         position = osst_get_frame_position(STp, aSCpnt);
 			if (position >= 0xbae && position < 0xbb8)
 				position = 0xbb8;
+			else if (position > STp->eod_frame_ppos || ++bad == 10) {
+printk(OSST_DEB_MSG "osst%d: start again from pos %d, eod %d, bad %d\n", dev, position, STp->eod_frame_ppos, bad); /*FIXME*/
+				position = STp->read_error_frame - 1;
+			}
 			else {
 				position += 39;
-                        	cnt += 30;
+                        	cnt += 20;
 			}
-#if DEBUG
-                        printk(OSST_DEB_MSG "osst%d: Blank block detected, positioning tape to block %d\n",
+#if 1 //DEBUG
+                        printk(OSST_DEB_MSG "osst%d: Bad block detected, positioning tape to block %d\n",
 					 dev, position);
 #endif
                         osst_set_frame_position(STp, aSCpnt, position, 0);
@@ -829,18 +882,28 @@
 					  dev, x, logical_blk_num);
 #endif
 				STp->header_ok = 0;
+				STp->read_error_frame = 0;
 				return (-EIO);
 			}
                         if (x > logical_blk_num) {
-#if DEBUG
+				if (++past > 3) {
+					/* positioning backwards did not bring us to the desired block */
+					position = STp->read_error_frame - 1;
+				}
+				else
+			        	position = osst_get_frame_position(STp, aSCpnt)
+					         + logical_blk_num - x - 1;
+#if 1 //DEBUG
                                 printk(OSST_DEB_MSG
 				       "osst%d: Found logical block %d while looking for %d: back up %d\n",
-						dev, x, logical_blk_num, x - logical_blk_num + 1);
+						dev, x, logical_blk_num,
+					       	STp->first_frame_position - position);
 #endif
-			        position = osst_get_frame_position(STp, aSCpnt);
-                        	osst_set_frame_position(STp, aSCpnt, position + logical_blk_num - x - 1, 0);
+                        	osst_set_frame_position(STp, aSCpnt, position, 0);
                         	cnt += 10;
                         }
+			else
+				past = 0;
                 }
                 if (osst_get_frame_position(STp, aSCpnt) == 0xbaf) {
 #if DEBUG
@@ -862,6 +925,7 @@
 		printk(OSST_DEB_MSG "osst%i: Exit get logical block (%d=>%d) from OnStream tape with code %d\n",							 dev, logical_blk_num, STp->logical_blk_num, STps->eof);
 #endif
 	STp->fast_open = FALSE;
+	STp->read_error_frame = 0;
         return (STps->eof);
 }
 
@@ -920,7 +984,7 @@
 	STp->logical_blk_in_buffer = 0;
 	STps->drv_file  = htonl(STp->buffer->aux->filemark_cnt);
 	STps->drv_block = -1;
-	STps->eof       = ST_NOEOF;
+	STps->eof       = ST_NOEOF; /* FIXME test for eod */
 	return 0;
 }
 
@@ -1097,7 +1161,7 @@
 			     (SCpnt->sense_buffer[5] <<  8) |
 			      SCpnt->sense_buffer[6]        ) - new_block;
 			p = &buffer[i * OS_DATA_SIZE];
-#if 1 //DEBUG
+#if DEBUG
 			printk(OSST_DEB_MSG "osst%d: Additional write error at %d\n", dev, new_block+i);
 #endif
 			osst_get_frame_position(STp, aSCpnt);
@@ -1132,7 +1196,7 @@
 #endif
 			if (block < 2990 && block+skip+STp->cur_frames+pending >= 2990)
 				block = 3000-skip;
-#if 1 //DEBUG
+#if DEBUG
 			printk(OSST_DEB_MSG "osst%d: Position to frame %d, re-write from lblk %d\n",
 					  dev, block+skip, STp->logical_blk_num-STp->cur_frames-pending);
 #endif
@@ -1141,7 +1205,7 @@
 			attempts--;
 		}
 		if (osst_get_frame_position(STp, aSCpnt) < 0) {		/* additional write error */
-#if 1 //DEBUG
+#if DEBUG
 			printk(OSST_DEB_MSG "osst%d: Addl error, host %d, tape %d, buffer %d\n",
 					  dev, STp->first_frame_position,
 					  STp->last_frame_position, STp->cur_frames);
@@ -1156,7 +1220,7 @@
 			cmd[0] = WRITE_6;
 			cmd[1] = 1;
 			cmd[4] = 1;
-#if 1 //DEBUG
+#if DEBUG
 			printk(OSST_DEB_MSG "osst%d: About to write pending lblk %d at frame %d\n",
 					  dev, STp->logical_blk_num-1, STp->first_frame_position);
 #endif
@@ -1221,7 +1285,7 @@
 	if ((SCpnt->sense_buffer[ 2] & 0x0f) != 3
 	  || SCpnt->sense_buffer[12]         != 12
 	  || SCpnt->sense_buffer[13]         != 0) {
-#if 1 //DEBUG
+#if DEBUG
 		printk(OSST_DEB_MSG "osst%d: Write error recovery cannot handle %02x:%02x:%02x\n",
 			dev, SCpnt->sense_buffer[ 2], SCpnt->sense_buffer[12], SCpnt->sense_buffer[13]);
 #endif
@@ -1233,11 +1297,11 @@
 		 SCpnt->sense_buffer[6];
 	skip  =  SCpnt->sense_buffer[9];
  
-#if 1 //DEBUG
+#if DEBUG
 	printk(OSST_DEB_MSG "osst%d: Detected physical bad block at %u, advised to skip %d\n", dev, block, skip);
 #endif
 	osst_get_frame_position(STp, aSCpnt);
-#if 1 //DEBUG
+#if DEBUG
 	printk(OSST_DEB_MSG "osst%d: reported frame positions: host = %d, tape = %d\n",
 			dev, STp->first_frame_position, STp->last_frame_position);
 #endif
@@ -1266,7 +1330,7 @@
 		osst_set_frame_position(STp, aSCpnt, block + STp->cur_frames + pending, 0);
 	}
 	osst_get_frame_position(STp, aSCpnt);
-#if 1 //DEBUG
+#if DEBUG
 	printk(KERN_ERR "osst%d: Positioning complete, cur_frames %d, pos %d, tape pos %d\n", 
 			dev, STp->cur_frames, STp->first_frame_position, STp->last_frame_position);
 	printk(OSST_DEB_MSG "osst%d: next logical block to write: %d\n", dev, STp->logical_blk_num);
@@ -1389,6 +1453,13 @@
 #if DEBUG
 			printk(OSST_DEB_MSG "osst%i: space_fwd: EOD reached\n", dev);
 #endif
+			if (STp->first_frame_position > STp->eod_frame_ppos+1) {
+#if DEBUG
+				printk(OSST_DEB_MSG "osst%i: EOD position corrected (%d=>%d)\n",
+					       	dev, STp->eod_frame_ppos, STp->first_frame_position-1);
+#endif
+				STp->eod_frame_ppos = STp->first_frame_position-1;
+			}
 			return (-EIO);
 		}
 		if (cnt == mt_count)
@@ -1457,6 +1528,12 @@
 						 dev, next_mark_ppos);
 				return (-EIO);
 			}
+			if (ntohl(STp->buffer->aux->filemark_cnt) != cnt + mt_count) {
+				printk(KERN_INFO "osst%i: Expected to find marker %d at block %d, not %d\n",
+						 dev, cnt+mt_count, next_mark_ppos,
+						 ntohl(STp->buffer->aux->filemark_cnt));
+				return (-EIO);
+			}
 		}
 	} else {
 		/*
@@ -1634,6 +1711,7 @@
 	STp->dirty = 1;
 	result  = osst_flush_write_buffer(STp, aSCpnt, 0);
 	result |= osst_flush_drive_buffer(STp, aSCpnt);
+//printk(OSST_DEB_MSG "osst%d: Finished writing file\n",TAPE_NR(STp->devt));
 	STp->last_mark_ppos = this_mark_ppos;
 	if (STp->header_cache != NULL && STp->filemark_cnt < OS_FM_TAB_MAX) 
 		STp->header_cache->dat_fm_tab.fm_tab_ent[STp->filemark_cnt] = htonl(this_mark_ppos);
@@ -2032,7 +2110,7 @@
 #endif
 	osst_set_frame_position(STp, aSCpnt, frame_position - 1, 0);
 	if (osst_get_logical_blk(STp, aSCpnt, -1, 0) < 0) {
-#if 1 //DEBUG
+#if DEBUG
 		printk(OSST_DEB_MSG "osst%i: Couldn't get logical blk num in verify_position\n", dev);
 #endif
 		return (-EIO);
@@ -2327,10 +2405,14 @@
     else {
 
       if (result == -EIO) {	/* re-read position */
+	unsigned char mysense[16];
+	memcpy (mysense, SCpnt->sense_buffer, 16);
 	memset (scmd, 0, MAX_COMMAND_SIZE);
 	scmd[0] = READ_POSITION;
 	STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
 	SCpnt = osst_do_scsi(SCpnt, STp, scmd, 20, STp->timeout, MAX_READY_RETRIES, TRUE);
+	if (!STp->buffer->last_result_fatal)
+	   memcpy (SCpnt->sense_buffer, mysense, 16);
       }
       STp->first_frame_position = ((STp->buffer)->b_data[4] << 24)
 				+ ((STp->buffer)->b_data[5] << 16)
@@ -2478,7 +2560,7 @@
     /* TODO: Error handling! */
     if (STp->poll)
 	result = osst_wait_frame (STp, aSCpnt, STp->first_frame_position, -50, 120);
-
+//osst_build_stats(STp, aSCpnt);
     memset(cmd, 0, MAX_COMMAND_SIZE);
     cmd[0] = WRITE_6;
     cmd[1] = 1;
@@ -2682,7 +2764,9 @@
       STps->rw = ST_IDLE;
     }
     else if (STps->rw != ST_WRITING) {
-      if (!STp->header_ok || (STps->drv_file == 0 && STps->drv_block == 0)) {
+      /* Are we totally rewriting this tape? */
+      if (!STp->header_ok || STp->first_frame_position == STp->first_data_ppos ||
+		            (STps->drv_file == 0 && STps->drv_block == 0)) {
 	STp->wrt_pass_cntr++;
 #if DEBUG
 	printk(OSST_DEB_MSG "osst%d: Allocating next write pass counter: %d\n",
@@ -2690,11 +2774,39 @@
 #endif
 	osst_reset_header(STp, &SCpnt);
 	STps->drv_file = STps->drv_block = STp->logical_blk_num = 0;
-      } else if (STp->fast_open && osst_verify_position(STp, &SCpnt)) {
-	if (SCpnt) scsi_release_command(SCpnt);
-	return (-EIO);
+      }
+      /* Do we know where we'll be writing on the tape? */
+      else {
+	if ((STp->fast_open && osst_verify_position(STp, &SCpnt)) ||
+		STps->drv_file < 0 || STps->drv_block < 0) {
+	  if (STp->first_frame_position == STp->eod_frame_ppos) {
+	    STps->drv_file = STp->filemark_cnt;
+	    STps->drv_block = 0;
+	  }
+	  else {
+	    /* We have no idea where the tape is positioned - give up */
+#if DEBUG
+	    printk(OSST_DEB_MSG "osst%d: Cannot write at indeterminate position.\n", dev);
+#endif
+	    if (SCpnt) scsi_release_command(SCpnt);
+	    return (-EIO);
+	  }
+	}	  
+	if (STps->drv_file > 0 && STps->drv_file < STp->filemark_cnt) {
+	  STp->filemark_cnt = STps->drv_file;
+	  STp->last_mark_ppos = ntohl(STp->header_cache->dat_fm_tab.fm_tab_ent[STp->filemark_cnt-1]);
+	  printk(KERN_WARNING "osst%d: Overwriting file %d with old write pass counter %d\n",
+		      dev, STps->drv_file, STp->wrt_pass_cntr);
+	  printk(KERN_WARNING "osst%d: may lead to stale data being accepted on reading back!\n",
+		      dev);
+#if DEBUG
+	  printk(OSST_DEB_MSG "osst%d: resetting filemark count to %d and last mark ppos to %d\n",
+		dev, STp->filemark_cnt, STp->last_mark_ppos);
+#endif
+	}
       }
       STp->fast_open = FALSE;
+//printk(OSST_DEB_MSG "osst%d: Starting write next file\n",dev);
     }
     if (!STp->header_ok) {
 #if DEBUG
@@ -2761,7 +2873,7 @@
     if (STp->poll)
 	retval = osst_wait_frame (STp, &SCpnt, STp->first_frame_position, -50, 60);
     /* TODO: Check for an error ! */
-	
+//osst_build_stats(STp, &SCpnt);	
     memset(cmd, 0, MAX_COMMAND_SIZE);
     cmd[0] = WRITE_6;
     cmd[1] = 1;
@@ -3063,16 +3175,16 @@
     /* Change the eof state if no data from tape or buffer */
     if (total == 0) {
 	if (STps->eof == ST_FM_HIT) {
-	    STps->eof = ST_FM;
+	    STps->eof = (STp->first_frame_position >= STp->eod_frame_ppos)?ST_EOD:ST_FM;
 	    STps->drv_block = 0;
 	    if (STps->drv_file >= 0)
 		STps->drv_file++;
 	}
 	else if (STps->eof == ST_EOD_1) {
 	    STps->eof = ST_EOD_2;
-	    STps->drv_block = 0;
-	    if (STps->drv_file >= 0)
+	    if (STps->drv_block > 0 && STps->drv_file >= 0)
 		STps->drv_file++;
+	    STps->drv_block = 0;
 	}
 	else if (STps->eof == ST_EOD_2)
 	    STps->eof = ST_EOD;
@@ -3269,7 +3381,7 @@
    unsigned char cmd[MAX_COMMAND_SIZE];
    Scsi_Cmnd * SCpnt = *aSCpnt;
    ST_partstat * STps;
-   int fileno, blkno, at_sm, undone, datalen;
+   int fileno, blkno, at_sm, datalen;
    int logical_blk_num;
    int dev = TAPE_NR(STp->devt);
 
@@ -3460,10 +3572,17 @@
 	   printk(OSST_DEB_MSG "osst%d: Spacing to end of recorded medium.\n", dev);
 #endif
 	osst_set_frame_position(STp, &SCpnt, STp->eod_frame_ppos, 0);
-	if (osst_get_logical_blk(STp, &SCpnt, -1, 0) < 0)
-	   return (-EIO);
-	if (STp->buffer->aux->frame_type != OS_FRAME_TYPE_EOD)
-	   return (-EIO);
+	if (osst_get_logical_blk(STp, &SCpnt, -1, 0) < 0) {
+	   ioctl_result = -EIO;
+	   goto os_bypass;
+	}
+	if (STp->buffer->aux->frame_type != OS_FRAME_TYPE_EOD) {
+#if DEBUG
+	   printk(OSST_DEB_MSG "osst%d: No EOD frame found where expected.\n", dev);
+#endif
+     	   ioctl_result = -EIO;
+	   goto os_bypass;
+	}
 	ioctl_result = osst_set_frame_position(STp, &SCpnt, STp->eod_frame_ppos, 0);
 	logical_blk_num = STp->logical_blk_num;
 	fileno          = STp->filemark_cnt;
@@ -3571,7 +3690,7 @@
       if (cmd_in == MTEOM)
          STps->eof = ST_EOD;
       else if (cmd_in == MTFSF)
-         STps->eof = ST_FM;
+	 STps->eof = (STp->first_frame_position >= STp->eod_frame_ppos)?ST_EOD:ST_FM;
       else if (chg_eof)
          STps->eof = ST_NOEOF;
 
@@ -3592,80 +3711,33 @@
             ioctl_result = 0;
       }
 
+   } else if (cmd_in == MTBSF || cmd_in == MTBSFM ) {
+      if (osst_position_tape_and_confirm(STp, &SCpnt, STp->first_data_ppos) < 0)
+	  STps->drv_file = STps->drv_block = -1;
+      else
+	  STps->drv_file = STps->drv_block = 0;
+      STps->eof = ST_NOEOF;
+   } else if (cmd_in == MTFSF || cmd_in == MTFSFM) {
+      if (osst_position_tape_and_confirm(STp, &SCpnt, STp->eod_frame_ppos) < 0)
+	  STps->drv_file = STps->drv_block = -1;
+      else {
+	  STps->drv_file  = STp->filemark_cnt;
+	  STps->drv_block = 0;
+      }
+      STps->eof = ST_EOD;
+   } else if (cmd_in == MTBSR || cmd_in == MTFSR || cmd_in == MTWEOF || cmd_in == MTEOM) {
+      STps->drv_file = STps->drv_block = (-1);
+      STps->eof = ST_NOEOF;
+      STp->header_ok = 0;
+   } else if (cmd_in == MTERASE) {
+      STp->header_ok = 0;
    } else if (SCpnt) {  /* SCSI command was not completely successful. */
       if (SCpnt->sense_buffer[2] & 0x40) {
-         if (cmd_in != MTBSF && cmd_in != MTBSFM &&
-	    cmd_in != MTBSR && cmd_in != MTBSS)
-	    STps->eof = ST_EOM_OK;
+	 STps->eof = ST_EOM_OK;
 	 STps->drv_block = 0;
       }
-
-      undone = (
-	  (SCpnt->sense_buffer[3] << 24) +
-	  (SCpnt->sense_buffer[4] << 16) +
-	  (SCpnt->sense_buffer[5] << 8) +
-	  SCpnt->sense_buffer[6] );
-      if (cmd_in == MTWEOF &&
-	 (SCpnt->sense_buffer[0] & 0x70) == 0x70 &&
-	 (SCpnt->sense_buffer[2] & 0x4f) == 0x40 &&
-	 ((SCpnt->sense_buffer[0] & 0x80) == 0 || undone == 0)) {
-	    ioctl_result = 0;  /* EOF written succesfully at EOM */
-	    if (fileno >= 0)
-		fileno++;
-	    STps->drv_file = fileno;
-	    STps->eof = ST_NOEOF;
-      }
-      else if ( (cmd_in == MTFSF) || (cmd_in == MTFSFM) ) {
-         if (fileno >= 0)
-	    STps->drv_file = fileno - undone ;
-	 else
-	    STps->drv_file = fileno;
-       STps->drv_block = 0;
-       STps->eof = ST_NOEOF;
-     }
-     else if ( (cmd_in == MTBSF) || (cmd_in == MTBSFM) ) {
-       if (fileno >= 0)
-         STps->drv_file = fileno + undone ;
-       else
-	 STps->drv_file = fileno;
-       STps->drv_block = 0;
-       STps->eof = ST_NOEOF;
-     }
-     else if (cmd_in == MTFSR) {
-       if (SCpnt->sense_buffer[2] & 0x80) { /* Hit filemark */
-	 if (STps->drv_file >= 0)
-	   STps->drv_file++;
-	 STps->drv_block = 0;
-	 STps->eof = ST_FM;
-       }
-       else {
-	 if (blkno >= undone)
-	   STps->drv_block = blkno - undone;
-	 else
-	   STps->drv_block = (-1);
-	 STps->eof = ST_NOEOF;
-       }
-     }
-     else if (cmd_in == MTBSR) {
-       if (SCpnt->sense_buffer[2] & 0x80) { /* Hit filemark */
-	 STps->drv_file--;
-	 STps->drv_block = (-1);
-       }
-       else {
-	 if (blkno >= 0)
-	   STps->drv_block = blkno + undone;
-	 else
-	   STps->drv_block = (-1);
-       }
-       STps->eof = ST_NOEOF;
-     }
-     else if (cmd_in == MTEOM) {
-       STps->drv_file = (-1);
-       STps->drv_block = (-1);
-       STps->eof = ST_EOD;
-     }
-     else if (chg_eof)
-       STps->eof = ST_NOEOF;
+      if (chg_eof)
+         STps->eof = ST_NOEOF;
 
       if ((SCpnt->sense_buffer[2] & 0x0f) == BLANK_CHECK)
 	 STps->eof = ST_EOD;
@@ -4104,7 +4176,7 @@
       if (STps->drv_file >= 0)
 	STps->drv_file++ ;
       STps->drv_block = 0;
-
+//osst_report_stats();
       result = osst_write_eod(STp, &SCpnt);
       osst_write_header(STp, &SCpnt, !(STp->rew_at_close));
 
diff -urN linux-2.2.19-pre3/drivers/scsi/osst.h linux/drivers/scsi/osst.h
--- linux-2.2.19-pre3/drivers/scsi/osst.h	Mon Dec  3 20:54:18 2001
+++ linux/drivers/scsi/osst.h	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /*
- *	$Header: /home/cvsroot/Driver/osst.h,v 1.5.2.1 2000/09/24 14:26:02 riede Exp $
+ *	$Header: /home/cvsroot/Driver/osst.h,v 1.5.2.2 2000/10/08 03:07:33 riede Exp $
  */
 
 #include <linux/config.h>
@@ -489,6 +489,7 @@
   int      eod_frame_ppos;
   int      eod_frame_lfa;
   int      write_type;				/* used in write error recovery */
+  int      read_error_frame;			/* used in read error recovery */
   unsigned long cmd_start_time;
   unsigned long max_cmd_time;
 
diff -urN linux-2.2.19-pre3/drivers/scsi/scsiiom.c linux/drivers/scsi/scsiiom.c
--- linux-2.2.19-pre3/drivers/scsi/scsiiom.c	Fri Dec 25 16:41:39 1998
+++ linux/drivers/scsi/scsiiom.c	Mon Dec  3 20:54:39 2001
@@ -4,16 +4,40 @@
  *	Description: Device Driver for Tekram DC-390 (T) PCI SCSI      *
  *		     Bus Master Host Adapter			       *
  ***********************************************************************/
-/* $Id: scsiiom.c,v 2.15 1998/12/25 17:33:27 garloff Exp $ */
+/* $Id: scsiiom.c,v 2.55.2.17 2000/12/20 00:39:37 garloff Exp $ */
+
+static void __inline__
+dc390_freetag (PDCB pDCB, PSRB pSRB)
+{
+	if (pSRB->TagNumber < 255) {
+		pDCB->TagMask &= ~(1 << pSRB->TagNumber);   /* free tag mask */
+		pSRB->TagNumber = 255;
+	}
+};
+
 
 UCHAR
 dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB )
 {
-    USHORT wlval;
-    UCHAR  bval, bval1;
+    UCHAR cmd; UCHAR  disc_allowed, try_sync_nego;
+
+    pSRB->ScsiPhase = SCSI_NOP0;
 
-    pSRB->TagNumber = 31;
-    DC390_write8 (Scsi_Dest_ID, pDCB->UnitSCSIID);
+    if (pACB->Connected)
+    {
+	// Should not happen normally
+	printk (KERN_WARNING "DC390: Can't select when connected! (%08x,%02x)\n",
+		pSRB->SRBState, pSRB->SRBFlag);
+	pSRB->SRBState = SRB_READY;
+	pACB->SelConn++;
+	return 1;
+    }
+    if (time_before (jiffies, pACB->pScsiHost->last_reset))
+    {
+	DEBUG0(printk ("DC390: We were just reset and don't accept commands yet!\n");)
+	return 1;
+    }
+    DC390_write8 (Scsi_Dest_ID, pDCB->TargetID);
     DC390_write8 (Sync_Period, pDCB->SyncPeriod);
     DC390_write8 (Sync_Offset, pDCB->SyncOffset);
     DC390_write8 (CtrlReg1, pDCB->CtrlR1);
@@ -21,151 +45,105 @@
     DC390_write8 (CtrlReg4, pDCB->CtrlR4);
     DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);		/* Flush FIFO */
     DEBUG1(printk (KERN_INFO "DC390: Start SCSI command: %02x (Sync:%02x)\n",\
-	    pSRB->CmdBlock[0], pDCB->SyncMode);)
-    pSRB->ScsiPhase = SCSI_NOP0;
-    //pSRB->MsgOutBuf[0] = MSG_NOP;
-    //pSRB->MsgCnt = 0;
-    bval = pDCB->IdentifyMsg;
-    if( !(pDCB->SyncMode & EN_ATN_STOP) )	/* Don't always try send Extended messages on arbitration */
-    {
-	if( (pSRB->CmdBlock[0] == INQUIRY) ||
-	    (pSRB->CmdBlock[0] == REQUEST_SENSE) ||
-	    (pSRB->SRBFlag & AUTO_REQSENSE) )
-	{
-	    bval &= 0xBF;	/* No DisConn */
-	    DC390_write8 (ScsiFifo, bval);
-	    bval1 = SEL_W_ATN;
-	    pSRB->SRBState = SRB_START_;
-	    DEBUG1(printk (KERN_DEBUG "DC390: No DisCn, No TagQ (%02x, %02x)\n", bval, bval1);)
-	    if( pDCB->SyncMode & SYNC_ENABLE )
-		{
-		if( !(pDCB->IdentifyMsg & 7) ||		/* LUN == 0 || Cmd != INQUIRY */
-		    (pSRB->CmdBlock[0] != INQUIRY) )
-		{
-		    bval1 = SEL_W_ATN_STOP;	/* Try to establish SYNC nego */
-		    pSRB->SRBState = SRB_MSGOUT;
-		}
-	    }
-	}
-	else	/* TagQ ? */
-	{
-	    DC390_write8 (ScsiFifo, bval);
-	    if(pDCB->SyncMode & EN_TAG_QUEUEING)
-	    {
-	        DC390_write8 (ScsiFifo, MSG_SIMPLE_QTAG);
-		DEBUG1(printk (KERN_DEBUG "DC390: %sDisCn, TagQ (%02x, %02x, %08lx)\n", (bval&0x40?"":"No "), bval, SEL_W_ATN3, pDCB->TagMask);)
-	        bval = 0; wlval = 1;
-	        while (wlval & pDCB->TagMask)
-		  { bval++; wlval <<= 1; };
-		pDCB->TagMask |= wlval;
-	        DC390_write8 (ScsiFifo, bval);
-		pSRB->TagNumber = bval;
-		DEBUG1(printk (KERN_DEBUG "DC390: SRB %p (Cmd %li), Tag %02x queued\n", pSRB, pSRB->pcmd->pid, bval);)
-		bval1 = SEL_W_ATN3;
-		pSRB->SRBState = SRB_START_;
-	    }
-	    else	/* No TagQ */
-	    {
-		bval1 = SEL_W_ATN;
-		DEBUG1(printk (KERN_DEBUG "DC390: %sDisCn, No TagQ (%02x, %02x, %08lx)\n", (bval&0x40?"":"No "), bval, bval1, pDCB->TagMask);)
-		pSRB->SRBState = SRB_START_;
-	    }
-	}
+	    pSRB->pcmd->cmnd[0], pDCB->SyncMode);)
+    disc_allowed = pDCB->DevMode & EN_DISCONNECT_; try_sync_nego = 0;
+    /* Don't disconnect on AUTO_REQSENSE, cause it might be an
+     * Contingent Allegiance Condition (6.6), where no tags should be used.
+     * All other have to be allowed to disconnect to prevent Incorrect 
+     * Initiator Connection (6.8.2/6.5.2) */
+    /* Changed KG, 99/06/06 */
+    if( /*(((pSRB->pcmd->cmnd[0] == INQUIRY) || (pSRB->pcmd->cmnd[0] == REQUEST_SENSE) ||
+	 * (pSRB->pcmd->cmnd[0] == TEST_UNIT_READY)) && pACB->scan_devices)
+		||*/ (pSRB->SRBFlag & AUTO_REQSENSE) ) 
+      disc_allowed = 0;
+    if ( (pDCB->SyncMode & SYNC_ENABLE) && (pDCB->TargetLUN == 0) && (pDCB->Inquiry7 & 0x10) &&
+	( ( ( (pSRB->pcmd->cmnd[0] == REQUEST_SENSE) || (pSRB->SRBFlag & AUTO_REQSENSE) )
+	  && !(pDCB->SyncMode & SYNC_NEGO_DONE) ) || (pSRB->pcmd->cmnd[0] == INQUIRY) ) )
+      try_sync_nego = 1;
+
+    pSRB->MsgCnt = 0; cmd = SEL_W_ATN;
+    DC390_write8 (ScsiFifo, IDENTIFY(disc_allowed, pDCB->TargetLUN));
+    /* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */
+    if ((pDCB->SyncMode & EN_TAG_QUEUEING) && disc_allowed)
+      {
+	UCHAR tag_no = 0;
+	while ((1 << tag_no) & pDCB->TagMask) tag_no++;
+	if (tag_no >= sizeof (pDCB->TagMask)*8 || tag_no >= pDCB->MaxCommand) { 
+		printk (KERN_WARNING "DC390: Out of tags for Dev. %02x %02x\n", pDCB->TargetID, pDCB->TargetLUN); 
+		return 1;
+		//goto no_tag;
+	};
+	DC390_write8 (ScsiFifo, SIMPLE_QUEUE_TAG);
+	pDCB->TagMask |= (1 << tag_no); pSRB->TagNumber = tag_no;
+	DC390_write8 (ScsiFifo, tag_no);
+	DEBUG1(printk (KERN_DEBUG "DC390: Select w/DisCn for Cmd %li (SRB %p), Using Tag %02x\n", pSRB->pcmd->pid, pSRB, tag_no);)
+	cmd = SEL_W_ATN3;
+      }
+    else	/* No TagQ */
+      {
+//      no_tag:
+	DEBUG1(printk (KERN_DEBUG "DC390: Select w%s/DisCn for Cmd %li (SRB %p), No TagQ\n", (disc_allowed?"":"o"), pSRB->pcmd->pid, pSRB);) 
+      };
 
-    }
-    else	/* ATN_STOP: Always try to establish Sync nego */
-    {
-	if( (pSRB->CmdBlock[0] == INQUIRY) ||
-	    (pSRB->CmdBlock[0] == REQUEST_SENSE) ||
-	    (pSRB->SRBFlag & AUTO_REQSENSE) )
-	{
-	    bval &= 0xBF;	/* No DisConn */
-	    DC390_write8 (ScsiFifo, bval);
-	    bval1 = SEL_W_ATN;
-	    DEBUG1(printk (KERN_DEBUG "DC390: No DisCn, No TagQ (%02x, %02x)\n", bval, bval1);)
-	    pSRB->SRBState = SRB_START_;
-	      /* ??? */
-	    if( pDCB->SyncMode & SYNC_ENABLE )
-	    {
-		if( !(pDCB->IdentifyMsg & 7) ||		/* LUN == 0 || Cmd != INQUIRY */
-		    (pSRB->CmdBlock[0] != INQUIRY) )
-		{
-		    bval1 = SEL_W_ATN_STOP;	/* Try to establish Sync nego */
-		    pSRB->SRBState = SRB_MSGOUT;
-		}
-	    }
-	}
-	else	/* TagQ ? */
-	{
-	    DC390_write8 (ScsiFifo, bval);
-	    if(pDCB->SyncMode & EN_TAG_QUEUEING)
-	    {
-		pSRB->MsgOutBuf[0] = MSG_SIMPLE_QTAG;
-		DEBUG1(printk (KERN_DEBUG "DC390: %sDisCn, TagQ (%02x, %02x, %08lx)\n", (bval&0x40?"":"No "), bval, SEL_W_ATN_STOP, pDCB->TagMask);)
-		bval = 0; wlval = 1;
-	        while (wlval & pDCB->TagMask)
-		  { bval++; wlval <<= 1; };
-		pDCB->TagMask |= wlval;
-		pSRB->TagNumber = bval;
-		DEBUG1(printk (KERN_DEBUG "DC390: SRB %p (Cmd %li), Tag %02x queued\n", pSRB, pSRB->pcmd->pid, bval);)
-		pSRB->MsgOutBuf[1] = bval;
-		pSRB->MsgCnt = 2;
-		bval1 = SEL_W_ATN_STOP;
-		pSRB->SRBState = SRB_START_;	/* ?? */
-	    }
-	    else	/* No TagQ */
-	    {
-		pSRB->MsgOutBuf[0] = MSG_NOP;
-		pSRB->MsgCnt = 1;
-		pSRB->SRBState = SRB_START_;
-		bval1 = SEL_W_ATN_STOP;
-		DEBUG1(printk (KERN_DEBUG "DC390: %sDisCn, No TagQ (%02x, %02x, %08lx)\n", (bval&0x40?"":"No "), bval, bval1, pDCB->TagMask);)
-	    };
-	}
-    }
-    if (bval1 != SEL_W_ATN_STOP)
-      {	/* Command is written in CommandPhase, if SEL_W_ATN_STOP ... */
+    pSRB->SRBState = SRB_START_;
+
+    if (try_sync_nego)
+      { 
+	UCHAR Sync_Off = pDCB->SyncOffset;
+        DEBUG0(printk (KERN_INFO "DC390: NEW Sync Nego code triggered (%i %i)\n", pDCB->TargetID, pDCB->TargetLUN);)
+	pSRB->MsgOutBuf[0] = EXTENDED_MESSAGE;
+	pSRB->MsgOutBuf[1] = 3;
+	pSRB->MsgOutBuf[2] = EXTENDED_SDTR;
+	pSRB->MsgOutBuf[3] = pDCB->NegoPeriod;
+	if (!(Sync_Off & 0x0f)) Sync_Off = SYNC_NEGO_OFFSET;
+	pSRB->MsgOutBuf[4] = Sync_Off;
+	pSRB->MsgCnt = 5;
+	//pSRB->SRBState = SRB_MSGOUT_;
+	pSRB->SRBState |= DO_SYNC_NEGO;
+	cmd = SEL_W_ATN_STOP;
+      };
+
+    /* Command is written in CommandPhase, if SEL_W_ATN_STOP ... */
+    if (cmd != SEL_W_ATN_STOP)
+      {
 	if( pSRB->SRBFlag & AUTO_REQSENSE )
 	  {
-	    bval = 0;
 	    DC390_write8 (ScsiFifo, REQUEST_SENSE);
-	    DC390_write8 (ScsiFifo, pDCB->IdentifyMsg << 5);
-	    DC390_write8 (ScsiFifo, bval);
-	    DC390_write8 (ScsiFifo, bval);
+	    DC390_write8 (ScsiFifo, pDCB->TargetLUN << 5);
+	    DC390_write8 (ScsiFifo, 0);
+	    DC390_write8 (ScsiFifo, 0);
 	    DC390_write8 (ScsiFifo, sizeof(pSRB->pcmd->sense_buffer));
-	    DC390_write8 (ScsiFifo, bval);
+	    DC390_write8 (ScsiFifo, 0);
 	    DEBUG1(printk (KERN_DEBUG "DC390: AutoReqSense !\n");)
 	  }
 	else	/* write cmnd to bus */ 
 	  {
 	    PUCHAR ptr; UCHAR i;
-	    ptr = (PUCHAR) pSRB->CmdBlock;
-	    for (i=0; i<pSRB->ScsiCmdLen; i++)
+	    ptr = (PUCHAR) pSRB->pcmd->cmnd;
+	    for (i=0; i<pSRB->pcmd->cmd_len; i++)
 	      DC390_write8 (ScsiFifo, *(ptr++));
 	  };
       }
-
-    /* Check if we can't win arbitration */
+    DEBUG0(if (pACB->pActiveDCB)	\
+	   printk (KERN_WARNING "DC390: ActiveDCB != 0\n");)
+    DEBUG0(if (pDCB->pActiveSRB)	\
+	   printk (KERN_WARNING "DC390: ActiveSRB != 0\n");)
+    //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
     if (DC390_read8 (Scsi_Status) & INTERRUPT)
     {
+	dc390_freetag (pDCB, pSRB);
+	DEBUG0(printk ("DC390: Interrupt during Start SCSI (pid %li, target %02i-%02i)\n",
+		pSRB->pcmd->pid, pSRB->pcmd->target, pSRB->pcmd->lun);)
 	pSRB->SRBState = SRB_READY;
-	pDCB->TagMask &= ~( 1 << pSRB->TagNumber );
-	DEBUG0(printk (KERN_WARNING "DC390: Interrupt during StartSCSI!\n");)
+	//DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
+	pACB->SelLost++;
 	return 1;
-    }
-    else
-    {
-	pSRB->ScsiPhase = SCSI_NOP1;
-	DEBUG0(if (pACB->pActiveDCB)	\
-		    printk (KERN_WARNING "DC390: ActiveDCB != 0\n");)
-	DEBUG0(if (pDCB->pActiveSRB)	\
-		    printk (KERN_WARNING "DC390: ActiveSRB != 0\n");)
-	pACB->pActiveDCB = pDCB;
-	pDCB->pActiveSRB = pSRB;
-	//DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
-	DC390_write8 (ScsiCmd, bval1);
-	return 0;
-    }
+    };
+    DC390_write8 (ScsiCmd, cmd);
+    pACB->pActiveDCB = pDCB; pDCB->pActiveSRB = pSRB;
+    pACB->Connected = 1;
+    pSRB->ScsiPhase = SCSI_NOP1;
+    return 0;
 }
 
 //#define DMA_INT EN_DMA_INT /*| EN_PAGE_INT*/
@@ -198,7 +176,7 @@
     };
   if (dstate & DMA_XFER_DONE)
     {
-	ULONG residual, xferCnt; int ctr = 5000000;
+	UINT residual, xferCnt; int ctr = 6000000;
 	if (! (DC390_read8 (DMA_Cmd) & READ_DIRECTION))
 	  {
 	    do
@@ -236,47 +214,34 @@
 void __inline__
 DC390_Interrupt( int irq, void *dev_id, struct pt_regs *regs)
 {
-    PACB   pACB;
+    PACB   pACB, pACB2;
     PDCB   pDCB;
     PSRB   pSRB;
     UCHAR  sstatus=0;
-    UCHAR  phase, i;
+    UCHAR  phase;
     void   (*stateV)( PACB, PSRB, PUCHAR );
     UCHAR  istate, istatus;
 #if DMA_INT
     UCHAR  dstatus;
 #endif
-    DC390_AFLAGS DC390_IFLAGS DC390_DFLAGS
-
-    pACB = dc390_pACB_start;
+    DC390_AFLAGS DC390_IFLAGS //DC390_DFLAGS
 
-    if (pACB == 0)
+    pACB = (PACB)dev_id;
+    for (pACB2 = dc390_pACB_start; (pACB2 && pACB2 != pACB); pACB2 = pACB2->pNextACB);
+    if (!pACB2)
     {
-	printk(KERN_WARNING "DC390: Interrupt on uninitialized adapter!\n");
+	printk ("DC390: IRQ called with foreign dev_id %p!\n", pACB);
 	return;
     }
-    DC390_LOCK_DRV;
+    
+    //DC390_LOCK_DRV;
 
-    for( i=0; i < dc390_adapterCnt; i++ )
-    {
-	if( pACB->IRQLevel == (UCHAR) irq )
-	{
-	     sstatus = DC390_read8 (Scsi_Status);
-	     if( sstatus & INTERRUPT )
-		 break;
-	     else
-		pACB = pACB->pNextACB;
-	}
-	else
-	{
-	    pACB = pACB->pNextACB;
-	}
-    }
+    sstatus = DC390_read8 (Scsi_Status);
+    if( !(sstatus & INTERRUPT) )
+	{ /*DC390_UNLOCK_DRV;*/ return; };
 
     DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus);)
 
-    if( !pACB ) { DC390_UNLOCK_DRV; return; };
-
 #if DMA_INT
     DC390_LOCK_IO;
     DC390_LOCK_ACB;
@@ -288,7 +253,7 @@
     if (! (dstatus & SCSI_INTERRUPT))
       {
 	DEBUG0(printk (KERN_WARNING "DC390 Int w/o SCSI actions (only DMA?)\n");)
-	DC390_UNLOCK_DRV;
+	//DC390_UNLOCK_DRV;
 	return;
       };
 #else
@@ -299,7 +264,7 @@
 
     DC390_LOCK_IO;
     DC390_LOCK_ACB;
-    DC390_UNLOCK_DRV_NI; /* Allow _other_ CPUs to process IRQ (useful for shared IRQs) */
+    //DC390_UNLOCK_DRV_NI; /* Allow _other_ CPUs to process IRQ (useful for shared IRQs) */
 
     istate = DC390_read8 (Intern_State);
     istatus = DC390_read8 (INT_Status); /* This clears Scsi_Status, Intern_State and INT_Status ! */
@@ -310,23 +275,42 @@
 
     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);
-    };
+    }
 	
-    if(istatus &  DISCONNECTED)
+    else if (istatus &  INVALID_CMD)
+    {
+	printk ("DC390: Invalid Command detected (%08x)!\n", dc390_laststatus);
+	dc390_InvalidCmd( pACB );
+	goto unlock;
+    }
+
+    if (istatus &  SCSI_RESET)
+    {
+	dc390_ScsiRstDetect( pACB );
+	goto unlock;
+    }
+
+    if (istatus &  DISCONNECTED)
     {
 	dc390_Disconnect( pACB );
 	goto unlock;
     }
 
-    if(istatus &  RESELECTED)
+    if (istatus &  RESELECTED)
     {
 	dc390_Reselect( pACB );
 	goto unlock;
     }
 
-    if( istatus & (SUCCESSFUL_OP|SERVICE_REQUEST) )
+    else if (istatus & (SELECTED | SEL_ATTENTION))
+    {
+	printk (KERN_ERR "DC390: Target mode not supported!\n");
+	goto unlock;
+    }
+
+    if (istatus & (SUCCESSFUL_OP|SERVICE_REQUEST) )
     {
 	pDCB = pACB->pActiveDCB;
 	if (!pDCB)
@@ -351,23 +335,11 @@
 	goto unlock;
     }
 
-    if(istatus &  INVALID_CMD)
-    {
-	dc390_InvalidCmd( pACB );
-	goto unlock;
-    }
-
-    if(istatus &  SCSI_RESET)
-    {
-	dc390_ScsiRstDetect( pACB );
-	goto unlock;
-    }
-
  unlock:
-    DC390_LOCK_DRV_NI;
+    //DC390_LOCK_DRV_NI;
     DC390_UNLOCK_ACB;
     DC390_UNLOCK_IO;
-    DC390_UNLOCK_DRV; /* Restore initial flags */
+    //DC390_UNLOCK_DRV; /* Restore initial flags */
 }
 
 void
@@ -384,7 +356,7 @@
 {
     UCHAR   sstatus;
     PSGL    psgl;
-    ULONG   ResidCnt, xferCnt;
+    UINT    ResidCnt, xferCnt;
     UCHAR   dstate = 0;
 
     sstatus = *psstatus;
@@ -396,7 +368,7 @@
 
 	if( sstatus & COUNT_2_ZERO )
 	{
-	    int ctr = 5000000; /* only try for about a tenth of a second */
+	    int ctr = 6000000; /* only try for about a second */
 	    while( --ctr && !((dstate = DC390_read8 (DMA_Status)) & DMA_XFER_DONE) && pSRB->SGToBeXferLen );
 	    if (!ctr) printk (KERN_CRIT "DC390: Deadlock in DataOut_0: DMA aborted unfinished: %06x bytes remain!!\n", DC390_read32 (DMA_Wk_ByteCntr));
 	    dc390_laststatus &= ~0xff000000; dc390_laststatus |= dstate << 24;
@@ -415,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;
@@ -426,7 +398,11 @@
 	    pSRB->SGToBeXferLen = ResidCnt;
 	}
     }
-    DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */
+    if ((*psstatus & 7) != SCSI_DATA_OUT)
+    {
+	    DC390_write8 (DMA_Cmd, WRITE_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */
+	    DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
+    }	    
 }
 
 void
@@ -434,7 +410,8 @@
 {
     UCHAR   sstatus, residual, bval;
     PSGL    psgl;
-    ULONG   ResidCnt, xferCnt, i;
+    UINT    ResidCnt, i;
+    ULONG   xferCnt;
     PUCHAR  ptr;
 
     sstatus = *psstatus;
@@ -446,7 +423,7 @@
 
 	if( sstatus & COUNT_2_ZERO )
 	{
-	    int ctr = 5000000; /* only try for about a tenth of a second */
+	    int ctr = 6000000; /* only try for about a second */
 	    int dstate = 0;
 	    while( --ctr && !((dstate = DC390_read8 (DMA_Status)) & DMA_XFER_DONE) && pSRB->SGToBeXferLen );
 	    if (!ctr) printk (KERN_CRIT "DC390: Deadlock in DataIn_0: DMA aborted unfinished: %06x bytes remain!!\n", DC390_read32 (DMA_Wk_ByteCntr));
@@ -455,7 +432,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 */
 
@@ -509,12 +486,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;
@@ -535,6 +512,11 @@
 
 	}
     }
+    if ((*psstatus & 7) != SCSI_DATA_IN)
+    {
+	    DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
+	    DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */
+    }	    
 }
 
 static void
@@ -593,7 +575,7 @@
 static void __inline__
 dc390_MsgIn_reject (PACB pACB, PSRB pSRB)
 {
-  pSRB->MsgOutBuf[0] = MSG_REJECT_;
+  pSRB->MsgOutBuf[0] = MESSAGE_REJECT;
   pSRB->MsgCnt = 1; DC390_ENABLE_MSGOUT;
   DEBUG0 (printk (KERN_INFO "DC390: Reject message\n");)
 }
@@ -602,7 +584,7 @@
 static void __inline__
 dc390_EnableMsgOut_Abort ( PACB pACB, PSRB pSRB )
 {
-    pSRB->MsgOutBuf[0] = MSG_ABORT; 
+    pSRB->MsgOutBuf[0] = ABORT; 
     pSRB->MsgCnt = 1; DC390_ENABLE_MSGOUT;
     pSRB->pSRBDCB->DCBFlag &= ~ABORT_DEV_;
 }
@@ -640,7 +622,7 @@
       pSRB = pACB->pTmpSRB;
       pSRB->SRBState = SRB_UNEXPECT_RESEL;
       pDCB->pActiveSRB = pSRB;
-      pSRB->MsgOutBuf[0] = MSG_ABORT_TAG;
+      pSRB->MsgOutBuf[0] = ABORT_TAG;
       pSRB->MsgCnt = 1; DC390_ENABLE_MSGOUT;
     }
   return pSRB;
@@ -653,7 +635,7 @@
 {
   PDCB pDCB = pSRB->pSRBDCB;
   if (!(pSRB->SRBState & DO_SYNC_NEGO)) 
-    printk ("DC390: Target %i initiates Non-Sync?\n", pDCB->UnitSCSIID);
+    printk (KERN_INFO "DC390: Target %i initiates Non-Sync?\n", pDCB->TargetID);
   pSRB->SRBState &= ~DO_SYNC_NEGO;
   pDCB->SyncMode &= ~(SYNC_ENABLE+SYNC_NEGO_DONE);
   pDCB->SyncPeriod = 0;
@@ -677,8 +659,8 @@
   
   if (!(pSRB->SRBState & DO_SYNC_NEGO))
     {
-      printk ("DC390: Target %i initiates Sync: %ins %i ... answer ...\n", 
-	      pDCB->UnitSCSIID, pSRB->MsgInBuf[3]<<2, pSRB->MsgInBuf[4]);
+      printk (KERN_INFO "DC390: Target %i initiates Sync: %ins %i ... answer ...\n", 
+	      pDCB->TargetID, pSRB->MsgInBuf[3]<<2, pSRB->MsgInBuf[4]);
 
       /* reject */
       //dc390_MsgIn_reject (pACB, pSRB);
@@ -687,12 +669,12 @@
       /* Reply with corrected SDTR Message */
       if (pSRB->MsgInBuf[4] > 15)
 	{ 
-	  printk ("DC390: Lower Sync Offset to 15\n");
+	  printk (KERN_INFO "DC390: Lower Sync Offset to 15\n");
 	  pSRB->MsgInBuf[4] = 15;
 	}
       if (pSRB->MsgInBuf[3] < pDCB->NegoPeriod)
 	{
-	  printk ("DC390: Set sync nego period to %ins\n", pDCB->NegoPeriod << 2);
+	  printk (KERN_INFO "DC390: Set sync nego period to %ins\n", pDCB->NegoPeriod << 2);
 	  pSRB->MsgInBuf[3] = pDCB->NegoPeriod;
 	};
       memcpy (pSRB->MsgOutBuf, pSRB->MsgInBuf, 5);
@@ -728,10 +710,10 @@
   pDCB->CtrlR3 = bval;
   pDCB->SyncPeriod = (UCHAR)wval1;
   
-  if ((oldsyncperiod != wval1 || oldsyncoffset != pDCB->SyncOffset) && pDCB->UnitSCSILUN == 0)
+  if ((oldsyncperiod != wval1 || oldsyncoffset != pDCB->SyncOffset) && pDCB->TargetLUN == 0)
     {
       if (! (bval & FAST_SCSI)) wval1++;
-      printk ("DC390: Target %i: Sync transfer %i.%1i MHz, Offset %i\n", pDCB->UnitSCSIID, 
+      printk (KERN_INFO "DC390: Target %i: Sync transfer %i.%1i MHz, Offset %i\n", pDCB->TargetID, 
 	      40/wval1, ((40%wval1)*10+wval1/2)/wval1, pDCB->SyncOffset & 0x0f);
     }
   
@@ -739,6 +721,56 @@
 };
 
 
+/* handle RESTORE_PTR */
+static void 
+dc390_restore_ptr (PACB pACB, PSRB pSRB)
+{
+  PSGL psgl;
+  pSRB->TotalXferredLen = 0;
+  pSRB->SGIndex = 0;
+  if( pSRB->pcmd->use_sg )
+    {
+      pSRB->SGcount = (UCHAR) pSRB->pcmd->use_sg;
+      pSRB->pSegmentList = (PSGL) pSRB->pcmd->request_buffer;
+      psgl = pSRB->pSegmentList;
+      while (pSRB->TotalXferredLen + (ULONG) psgl->length < pSRB->Saved_Ptr)
+	{
+	  pSRB->TotalXferredLen += (ULONG) psgl->length;
+	  pSRB->SGIndex++;
+	  if( pSRB->SGIndex < pSRB->SGcount )
+	    {
+	      pSRB->pSegmentList++;
+	      psgl = pSRB->pSegmentList;
+	      
+	      pSRB->SGBusAddr = virt_to_bus( psgl->address );
+	      pSRB->SGToBeXferLen = (ULONG) psgl->length;
+	    }
+	  else
+	    pSRB->SGToBeXferLen = 0;
+	}
+      pSRB->SGToBeXferLen -= (pSRB->Saved_Ptr - pSRB->TotalXferredLen);
+      pSRB->SGBusAddr += (pSRB->Saved_Ptr - pSRB->TotalXferredLen);
+      printk (KERN_INFO "DC390: Pointer restored. Segment %i, Total %li, Bus %08lx\n", pSRB->SGIndex, pSRB->Saved_Ptr, pSRB->SGBusAddr);
+    }
+    else if( pSRB->pcmd->request_buffer )
+    {
+	pSRB->SGcount = 1;
+	pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
+	pSRB->Segmentx.address = (PUCHAR) pSRB->pcmd->request_buffer + pSRB->Saved_Ptr;
+	pSRB->Segmentx.length = pSRB->pcmd->request_bufflen - pSRB->Saved_Ptr;
+	printk (KERN_INFO "DC390: Pointer restored. Total %li, Bus %p\n",
+		pSRB->Saved_Ptr, pSRB->Segmentx.address);
+    }
+     else
+       {
+	 pSRB->SGcount = 0;
+	 printk (KERN_INFO "DC390: RESTORE_PTR message for Transfer without Scatter-Gather ??\n");
+       };
+
+  pSRB->TotalXferredLen = pSRB->Saved_Ptr;
+};
+
+
 /* According to the docs, the AM53C974 reads the message and 
  * generates a Succesful Operation IRQ before asserting ACK for
  * the last byte (how does it know whether it's the last ?) */
@@ -749,15 +781,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 == MSG_EXTENDED)
-    {
-      if (len < 2) return 0;
-      if (len < msgbuf[1] + 2) return 0;
-    }
+  if (*msgbuf == EXTENDED_MESSAGE)
+  {
+	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;
 }
 
@@ -781,23 +813,23 @@
 	/* Now eval the msg */
 	switch (pSRB->MsgInBuf[0]) 
 	  {
-	  case MSG_DISCONNECT: 
+	  case DISCONNECT: 
 	    pSRB->SRBState = SRB_DISCONNECT; break;
 	    
-	  case MSG_SIMPLE_QTAG:
-	  case MSG_HEAD_QTAG:
-	  case MSG_ORDER_QTAG:
+	  case SIMPLE_QUEUE_TAG:
+	  case HEAD_OF_QUEUE_TAG:
+	  case ORDERED_QUEUE_TAG:
 	    pSRB = dc390_MsgIn_QTag (pACB, pDCB, pSRB->MsgInBuf[1]);
 	    break;
 	    
-	  case MSG_REJECT_: 
+	  case MESSAGE_REJECT: 
 	    DC390_write8 (ScsiCmd, RESET_ATN_CMD);
 	    pDCB->NegoPeriod = 50; /* 200ns <=> 5 MHz */
 	    if( pSRB->SRBState & DO_SYNC_NEGO)
 	      dc390_MsgIn_set_async (pACB, pSRB);
 	    break;
 	    
-	  case MSG_EXTENDED:
+	  case EXTENDED_MESSAGE:
 	    /* reject every extended msg but SDTR */
 	    if (pSRB->MsgInBuf[1] != 3 || pSRB->MsgInBuf[2] != EXTENDED_SDTR)
 	      dc390_MsgIn_reject (pACB, pSRB);
@@ -810,15 +842,18 @@
 	      };
 	    
 	    // nothing has to be done
-	  case MSG_COMPLETE: break;
+	  case COMMAND_COMPLETE: break;
 	    
-	    // SAVE POINTER my be ignored as we have the PSRB associated with the
+	    // SAVE POINTER may be ignored as we have the PSRB associated with the
 	    // scsi command. Thanks, Gerard, for pointing it out.
-	  case MSG_SAVE_PTR: break;
+	  case SAVE_POINTERS: 
+	    pSRB->Saved_Ptr = pSRB->TotalXferredLen;
+	    break;
 	    // The device might want to restart transfer with a RESTORE
-	  case MSG_RESTORE_PTR: 
-	    printk ("DC390: RESTORE POINTER message received ... reject\n");
-	    // fall through
+	  case RESTORE_POINTERS:
+	    DEBUG0(printk ("DC390: RESTORE POINTER message received ... try to handle\n");)
+	    dc390_restore_ptr (pACB, pSRB);
+	    break;
 
 	    // reject unknown messages
 	  default: dc390_MsgIn_reject (pACB, pSRB);
@@ -840,6 +875,17 @@
 {
     PSGL   psgl;
     ULONG  lval;
+    PDCB   pDCB = pACB->pActiveDCB;
+
+    if (pSRB == pACB->pTmpSRB)
+    {
+	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 (pDCB) pDCB->DCBFlag |= ABORT_DEV;
+	return;
+    }
 
     if( pSRB->SGIndex < pSRB->SGcount )
     {
@@ -852,7 +898,7 @@
 	    DEBUG1(printk (KERN_DEBUG " DC390: Next SG segment.");)
 	}
 	lval = pSRB->SGToBeXferLen;
-	DEBUG1(printk (KERN_DEBUG " DC390: Transfer %li bytes (address %08lx)\n", lval, pSRB->SGBusAddr);)
+	DEBUG1(printk (KERN_DEBUG " DC390: Start transfer: %li bytes (address %08lx)\n", lval, pSRB->SGBusAddr);)
 	DC390_write8 (CtcReg_Low, (UCHAR) lval);
 	lval >>= 8;
 	DC390_write8 (CtcReg_Mid, (UCHAR) lval);
@@ -918,8 +964,8 @@
     DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
     if( !(pSRB->SRBFlag & AUTO_REQSENSE) )
     {
-	cnt = (UCHAR) pSRB->ScsiCmdLen;
-	ptr = (PUCHAR) pSRB->CmdBlock;
+	cnt = (UCHAR) pSRB->pcmd->cmd_len;
+	ptr = (PUCHAR) pSRB->pcmd->cmnd;
 	for(i=0; i < cnt; i++)
 	    DC390_write8 (ScsiFifo, *(ptr++));
     }
@@ -928,11 +974,12 @@
 	UCHAR bval = 0;
 	DC390_write8 (ScsiFifo, REQUEST_SENSE);
 	pDCB = pACB->pActiveDCB;
-	DC390_write8 (ScsiFifo, pDCB->IdentifyMsg << 5);
+	DC390_write8 (ScsiFifo, pDCB->TargetLUN << 5);
 	DC390_write8 (ScsiFifo, bval);
 	DC390_write8 (ScsiFifo, bval);
 	DC390_write8 (ScsiFifo, sizeof(pSRB->pcmd->sense_buffer));
 	DC390_write8 (ScsiFifo, bval);
+	DEBUG0(printk(KERN_DEBUG "DC390: AutoReqSense (CmndPhase)!\n");)
     }
     pSRB->SRBState = SRB_COMMAND;
     DC390_write8 (ScsiCmd, INFO_XFER_CMD);
@@ -966,14 +1013,14 @@
 		DC390_write8 (ScsiFifo, *(ptr++));
 	    pSRB->MsgCnt = 0;
 	    if( (pDCB->DCBFlag & ABORT_DEV_) &&
-		(pSRB->MsgOutBuf[0] == MSG_ABORT) )
+		(pSRB->MsgOutBuf[0] == ABORT) )
 		pSRB->SRBState = SRB_ABORT_SENT;
 	}
 	else
 	{
-	    bval = MSG_ABORT;	/* ??? MSG_NOP */
-	    if( (pSRB->CmdBlock[0] == INQUIRY ) ||
-		(pSRB->CmdBlock[0] == REQUEST_SENSE) ||
+	    bval = ABORT;	/* ??? MSG_NOP */
+	    if( (pSRB->pcmd->cmnd[0] == INQUIRY ) ||
+		(pSRB->pcmd->cmnd[0] == REQUEST_SENSE) ||
 		(pSRB->SRBFlag & AUTO_REQSENSE) )
 	    {
 		if( pDCB->SyncMode & SYNC_ENABLE )
@@ -986,8 +1033,8 @@
     else
     {
 mop1:
-	//printk ("DC390: Send SDTR message to %i %i ... \n", pDCB->UnitSCSIID, pDCB->UnitSCSILUN);
-	DC390_write8 (ScsiFifo, MSG_EXTENDED);
+        printk (KERN_ERR "DC390: OLD Sync Nego code triggered! (%i %i)\n", pDCB->TargetID, pDCB->TargetLUN);
+	DC390_write8 (ScsiFifo, EXTENDED_MESSAGE);
 	DC390_write8 (ScsiFifo, 3);	/*    ;length of extended msg */
 	DC390_write8 (ScsiFifo, EXTENDED_SDTR);	/*    ; sync nego */
 	DC390_write8 (ScsiFifo, pDCB->NegoPeriod);
@@ -1030,20 +1077,16 @@
     UCHAR  bval, i, cnt;
     PDCB   ptr;
 
-    if( !(pDCB->IdentifyMsg & 0x07) )
+    if( !(pDCB->TargetLUN) )
     {
-	if( pACB->scan_devices )
-	{
-	    dc390_CurrSyncOffset = pDCB->SyncOffset;
-	}
-	else
+	if( !pACB->scan_devices )
 	{
 	    ptr = pACB->pLinkDCB;
 	    cnt = pACB->DCBCnt;
-	    bval = pDCB->UnitSCSIID;
+	    bval = pDCB->TargetID;
 	    for(i=0; i<cnt; i++)
 	    {
-		if( ptr->UnitSCSIID == bval )
+		if( ptr->TargetID == bval )
 		{
 		    ptr->SyncPeriod = pDCB->SyncPeriod;
 		    ptr->SyncOffset = pDCB->SyncOffset;
@@ -1068,25 +1111,27 @@
 
     DEBUG0(printk(KERN_INFO "DISC,");)
 
+    if (!pACB->Connected) printk(KERN_ERR "DC390: Disconnect not-connected bus?\n");
+    pACB->Connected = 0;
     pDCB = pACB->pActiveDCB;
     if (!pDCB)
      {
 	int j = 400;
-	DEBUG0(printk(KERN_WARNING "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);
 	return;
      }
+    DC390_write8 (ScsiCmd, EN_SEL_RESEL);
     pSRB = pDCB->pActiveSRB;
     pACB->pActiveDCB = 0;
     pSRB->ScsiPhase = SCSI_NOP0;
-    DC390_write8 (ScsiCmd, EN_SEL_RESEL);
     if( pSRB->SRBState & SRB_UNEXPECT_RESEL )
     {
 	pSRB->SRBState = 0;
-	dc390_DoWaitingSRB( pACB );
+	dc390_Waiting_process ( pACB );
     }
     else if( pSRB->SRBState & SRB_ABORT_SENT )
     {
@@ -1098,22 +1143,24 @@
 	for( i=0; i < cnt; i++)
 	{
 	    psrb = pSRB->pNextSRB;
-	    pSRB->pNextSRB = pACB->pFreeSRB;
-	    pACB->pFreeSRB = pSRB;
+	    dc390_Free_insert (pACB, pSRB);
 	    pSRB = psrb;
 	}
 	pDCB->pGoingSRB = 0;
-	dc390_DoWaitingSRB( pACB );
+	dc390_Query_to_Waiting (pACB);
+	dc390_Waiting_process (pACB);
     }
     else
     {
 	if( (pSRB->SRBState & (SRB_START_+SRB_MSGOUT)) ||
 	   !(pSRB->SRBState & (SRB_DISCONNECT+SRB_COMPLETED)) )
 	{	/* Selection time out */
-	    if( !(pACB->scan_devices) )
+	    if( !(1/*pACB->scan_devices*/) )
 	    {
 		pSRB->SRBState = SRB_READY;
-		dc390_RewaitSRB( pDCB, pSRB);
+		dc390_freetag (pDCB, pSRB);
+		dc390_Going_to_Waiting (pDCB, pSRB);
+		dc390_waiting_timer (pACB, HZ/5);
 	    }
 	    else
 	    {
@@ -1123,15 +1170,12 @@
 	}
 	else if( pSRB->SRBState & SRB_DISCONNECT )
 	{
-	    dc390_DoWaitingSRB( pACB );
+	    dc390_Waiting_process ( pACB );
 	}
 	else if( pSRB->SRBState & SRB_COMPLETED )
 	{
 disc1:
-	    if(pDCB->MaxCommand > 1)
-	    {
-	       pDCB->TagMask &= (~(1 << pSRB->TagNumber));   /* free tag mask */
-	    }
+	    dc390_freetag (pDCB, pSRB);
 	    pDCB->pActiveSRB = 0;
 	    pSRB->SRBState = SRB_FREE;
 	    dc390_SRBdone( pACB, pDCB, pSRB);
@@ -1146,43 +1190,48 @@
 {
     PDCB   pDCB;
     PSRB   pSRB;
-    USHORT wval;
-    UCHAR  bval;
+    UCHAR  id, lun;
 
     DEBUG0(printk(KERN_INFO "RSEL,");)
+    pACB->Connected = 1;
     pDCB = pACB->pActiveDCB;
     if( pDCB )
     {	/* Arbitration lost but Reselection won */
-	DEBUG0(printk ("(ActiveDCB != 0)");)
+	DEBUG0(printk ("DC390: (ActiveDCB != 0: Arb. lost but resel. won)!\n");)
 	pSRB = pDCB->pActiveSRB;
 	if( !( pACB->scan_devices ) )
 	{
 	    pSRB->SRBState = SRB_READY;
-	    dc390_RewaitSRB( pDCB, pSRB);
+	    dc390_freetag (pDCB, pSRB);
+	    dc390_Going_to_Waiting ( pDCB, pSRB);
+	    dc390_waiting_timer (pACB, HZ/5);
 	}
     }
-    bval = DC390_read8 (ScsiFifo);	/* get ID */
-    DEBUG0(printk ("Dev %02x,", bval);)
-    bval ^= 1 << pACB->pScsiHost->this_id; /* Mask AdapterID */
-    wval = 0;
-    while (bval >>= 1) wval++;
-    wval |=  ( (USHORT) DC390_read8 (ScsiFifo) & 7) << 8;  /* get LUN */
-    DEBUG0(printk ("(ID %02x, LUN %02x),", wval & 0xff, (wval & 0xff00) >> 8);)
-    pDCB = pACB->pLinkDCB;
-    while( wval != *((PUSHORT) &pDCB->UnitSCSIID) )
+    /* Get ID */
+    lun = DC390_read8 (ScsiFifo);
+    DEBUG0(printk ("Dev %02x,", lun);)
+    if (!(lun & (1 << pACB->pScsiHost->this_id)))
+      printk (KERN_ERR "DC390: Reselection must select host adapter: %02x!\n", lun);
+    else
+      lun ^= 1 << pACB->pScsiHost->this_id; /* Mask AdapterID */
+    id = 0; while (lun >>= 1) id++;
+    /* Get LUN */
+    lun = DC390_read8 (ScsiFifo);
+    if (!(lun & IDENTIFY_BASE)) printk (KERN_ERR "DC390: Resel: Expect identify message!\n");
+    lun &= 7;
+    DEBUG0(printk ("(%02i-%i),", id, lun);)
+    pDCB = dc390_findDCB (pACB, id, lun);
+    if (!pDCB)
     {
-	pDCB = pDCB->pNextDCB;
-	if( pDCB == pACB->pLinkDCB )
-	 {
-	    printk (KERN_ERR "DC390: Reselect from non existing device (ID %02x, LUN %02x)\n",
-		    wval & 0xff, (wval & 0xff00) >> 8);
-	    return;
-	 }
+	printk (KERN_ERR "DC390: Reselect from non existing device (%02i-%i)\n",
+		    id, lun);
+	return;
     }
     pACB->pActiveDCB = pDCB;
+    /* TagQ: We expect a message soon, so never mind the exact SRB */
     if( pDCB->SyncMode & EN_TAG_QUEUEING )
     {
-	pSRB = pACB->pTmpSRB; /* ?? */
+	pSRB = pACB->pTmpSRB;
 	pDCB->pActiveSRB = pSRB;
     }
     else
@@ -1192,8 +1241,8 @@
 	{
 	    pSRB= pACB->pTmpSRB;
 	    pSRB->SRBState = SRB_UNEXPECT_RESEL;
-	    printk (KERN_ERR "DC390: Reselect without outstanding cmnd (ID %02x, LUN %02x)\n",
-		    wval & 0xff, (wval & 0xff00) >> 8);
+	    printk (KERN_ERR "DC390: Reselect without outstanding cmnd (%02i-%i)\n",
+		    id, lun);
 	    pDCB->pActiveSRB = pSRB;
 	    dc390_EnableMsgOut_Abort ( pACB, pSRB );
 	}
@@ -1202,8 +1251,8 @@
 	    if( pDCB->DCBFlag & ABORT_DEV_ )
 	    {
 		pSRB->SRBState = SRB_ABORT_SENT;
-		printk (KERN_INFO "DC390: Reselect: Abort (ID %02x, LUN %02x)\n",
-			wval & 0xff, (wval & 0xff00) >> 8);
+		printk (KERN_INFO "DC390: Reselect: Abort (%02i-%i)\n",
+			id, lun);
 		dc390_EnableMsgOut_Abort( pACB, pSRB );
 	    }
 	    else
@@ -1213,7 +1262,7 @@
 
     DEBUG1(printk (KERN_DEBUG "Resel SRB(%p): TagNum (%02x)\n", pSRB, pSRB->TagNumber);)
     pSRB->ScsiPhase = SCSI_NOP0;
-    DC390_write8 (Scsi_Dest_ID, pDCB->UnitSCSIID);
+    DC390_write8 (Scsi_Dest_ID, pDCB->TargetID);
     DC390_write8 (Sync_Period, pDCB->SyncPeriod);
     DC390_write8 (Sync_Offset, pDCB->SyncOffset);
     DC390_write8 (CtrlReg1, pDCB->CtrlR1);
@@ -1228,30 +1277,36 @@
 {
    PDCB pPrevDCB = pACB->pLinkDCB;
 
-   pACB->DCBmap[pDCB->UnitSCSIID] &= ~(1 << pDCB->UnitSCSILUN);
    if (pDCB->GoingSRBCnt > 1)
      {
 	DCBDEBUG(printk (KERN_INFO "DC390: Driver won't free DCB (ID %i, LUN %i): 0x%08x because of SRBCnt %i\n",\
-		pDCB->UnitSCSIID, pDCB->UnitSCSILUN, (int)pDCB, pDCB->GoingSRBCnt);)
+		pDCB->TargetID, pDCB->TargetLUN, (int)pDCB, pDCB->GoingSRBCnt);)
 	return;
      };
+   pACB->DCBmap[pDCB->TargetID] &= ~(1 << pDCB->TargetLUN);
    
+   // The first one
    if (pDCB == pACB->pLinkDCB) 
-     {
-	if (pDCB->pNextDCB == pDCB) pDCB->pNextDCB = 0;
+   {
+	// The last one
+	if (pACB->pLastDCB == pDCB) {
+		pDCB->pNextDCB = 0; pACB->pLastDCB = 0;
+	}
 	pACB->pLinkDCB = pDCB->pNextDCB;
-	pACB->pLastDCB->pNextDCB = pDCB->pNextDCB;
-     }
+   }
    else
-     {
+   {
 	while (pPrevDCB->pNextDCB != pDCB) pPrevDCB = pPrevDCB->pNextDCB;
 	pPrevDCB->pNextDCB = pDCB->pNextDCB;
 	if (pDCB == pACB->pLastDCB) pACB->pLastDCB = pPrevDCB;
-     }
+   }
 
-   DCBDEBUG(printk (KERN_INFO "DC390: Driver about to free DCB (ID %i, LUN %i): 0x%08x\n",\
-	   pDCB->UnitSCSIID, pDCB->UnitSCSILUN, (int)pDCB);)
-   kfree (pDCB); if (pDCB == pACB->pActiveDCB) pACB->pActiveDCB = 0;
+   DCBDEBUG(printk (KERN_INFO "DC390: Driver about to free DCB (ID %i, LUN %i): %p\n",\
+	   pDCB->TargetID, pDCB->TargetLUN, pDCB);)
+   if (pDCB == pACB->pActiveDCB) pACB->pActiveDCB = 0;
+   if (pDCB == pACB->pLinkDCB) pACB->pLinkDCB = pDCB->pNextDCB;
+   if (pDCB == pACB->pDCBRunRobin) pACB->pDCBRunRobin = pDCB->pNextDCB;
+   kfree (pDCB); 
    pACB->DCBCnt--;
    /* pACB->DeviceCnt--; */
 };
@@ -1280,21 +1335,12 @@
 		|| (pDCB->DevType == TYPE_MOD)) &&*/
 	    !dc390_tagq_blacklist (((char*)ptr)+8) )
 	  {
-	     pDCB->MaxCommand = pDCB->pDCBACB->TagMaxNum;
+	     if (pDCB->MaxCommand ==1) pDCB->MaxCommand = pDCB->pDCBACB->TagMaxNum;
 	     pDCB->SyncMode |= EN_TAG_QUEUEING /* | EN_ATN_STOP */;
-	     pDCB->TagMask = 0;
+	     //pDCB->TagMask = 0;
 	  }
 	else
-	  {
-	     /* Do we really need to check for DevType here ? */
-	     if ( 0 /*(pDCB->DevMode & EN_DISCONNECT_)*/
-		 /* && ((pDCB->DevType == TYPE_DISK) 
-		     || (pDCB->DevType == TYPE_MOD))*/ )
-		pDCB->SyncMode |= EN_ATN_STOP;
-	     else
-	       //pDCB->SyncMode &= ~EN_ATN_STOP;
-	       pDCB->SyncMode &= ~0;
-	  }
+	     pDCB->MaxCommand = 1;
      }
 };
 
@@ -1312,60 +1358,62 @@
 void
 dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB )
 {
-    PSRB   psrb;
-    UCHAR  bval, status, i;
+    UCHAR  bval, status, i, DCB_removed;
     PSCSICMD pcmd;
     PSCSI_INQDATA  ptr;
     PSGL   ptr2;
     ULONG  swlval;
 
-    pcmd = pSRB->pcmd;
+    pcmd = pSRB->pcmd; DCB_removed = 0;
     status = pSRB->TargetStatus;
+    ptr = (PSCSI_INQDATA) (pcmd->request_buffer);
+    if( pcmd->use_sg )
+	ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address);
+	
     DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\
 		pSRB, pcmd->pid);)
     if(pSRB->SRBFlag & AUTO_REQSENSE)
     {	/* Last command was a Request Sense */
 	pSRB->SRBFlag &= ~AUTO_REQSENSE;
 	pSRB->AdaptStatus = 0;
-	pSRB->TargetStatus = SCSI_STAT_CHECKCOND;
+	pSRB->TargetStatus = CHECK_CONDITION << 1;
 #ifdef DC390_REMOVABLEDEBUG
 	switch (pcmd->sense_buffer[2] & 0x0f)
 	{	    
 	 case NOT_READY: printk (KERN_INFO "DC390: ReqSense: NOT_READY (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n",
-				 pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN,
+				 pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN,
 				 status, pACB->scan_devices); break;
 	 case UNIT_ATTENTION: printk (KERN_INFO "DC390: ReqSense: UNIT_ATTENTION (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n",
-				      pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN,
+				      pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN,
 				      status, pACB->scan_devices); break;
 	 case ILLEGAL_REQUEST: printk (KERN_INFO "DC390: ReqSense: ILLEGAL_REQUEST (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n",
-				       pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN,
+				       pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN,
 				       status, pACB->scan_devices); break;
 	 case MEDIUM_ERROR: printk (KERN_INFO "DC390: ReqSense: MEDIUM_ERROR (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n",
-				    pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN,
+				    pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN,
 				    status, pACB->scan_devices); break;
 	 case HARDWARE_ERROR: printk (KERN_INFO "DC390: ReqSense: HARDWARE_ERROR (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n",
-				      pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN,
+				      pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN,
 				      status, pACB->scan_devices); break;
 	}
 #endif
-	//pcmd->result = DRIVER_SENSE << 24 | DID_OK << 16 | status;
-	if(status == SCSI_STAT_CHECKCOND)
+	//pcmd->result = MK_RES(DRIVER_SENSE,DID_OK,0,status);
+	if (status == (CHECK_CONDITION << 1))
 	{
-	    pcmd->result = DID_BAD_TARGET << 16;
+	    pcmd->result = MK_RES_LNX(0,DID_BAD_TARGET,0,/*CHECK_CONDITION*/0);
 	    goto ckc_e;
 	}
 	if(pSRB->RetryCnt == 0)
 	{
-	    (ULONG)(pSRB->CmdBlock[0]) = pSRB->Segment0[0];
-	    pSRB->TotalXferredLen = pSRB->Segment1[1];
+	    //(UINT)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0];
+	    pSRB->TotalXferredLen = pSRB->SavedTotXLen;
 	    if( (pSRB->TotalXferredLen) &&
 		(pSRB->TotalXferredLen >= pcmd->underflow) )
-		pcmd->result |= (DID_OK << 16);
+		  SET_RES_DID(pcmd->result,DID_OK)
 	    else
-		pcmd->result = (DRIVER_SENSE << 24) | (DRIVER_OK << 16) |
-				SCSI_STAT_CHECKCOND;
-	    REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x,Result=%08x,XferL=%08x\n",pSRB->CmdBlock[0],\
-		(UINT) pcmd->result, (UINT) pSRB->TotalXferredLen);)
+		  pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION);
+		  REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x,Result=%08x,XferL=%08x\n",pSRB->pcmd->cmnd[0],\
+			(UINT) pcmd->result, (UINT) pSRB->TotalXferredLen);)
 	    goto ckc_e;
 	}
 	else /* Retry */
@@ -1373,20 +1421,20 @@
 	    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->CmdBlock[0] == TEST_UNIT_READY /* || pSRB->CmdBlock[0] == START_STOP */)
+	    if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */)
 	    {
-		pcmd->result = (DRIVER_SENSE << 24) | (DRIVER_OK << 16) 
-			    | SCSI_STAT_CHECKCOND;
-		REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n",pSRB->CmdBlock[0],\
+		pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION);
+		REMOVABLEDEBUG(printk(KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n",pSRB->pcmd->cmnd[0],\
 		       (UINT) pcmd->result, (UINT) pSRB->TotalXferredLen);)
 		goto ckc_e;
 	    }
-	    pcmd->result |= (DRIVER_SENSE << 24);
-	    pSRB->SGcount	 = (UCHAR) pSRB->Segment1[0];
-	    pSRB->ScsiCmdLen	 = (UCHAR) (pSRB->Segment1[0] >> 8);
+	    SET_RES_DRV(pcmd->result,DRIVER_SENSE);
+	    pSRB->SGcount	 = (UCHAR) pSRB->SavedSGCount;
+	    //pSRB->ScsiCmdLen	 = (UCHAR) (pSRB->Segment1[0] >> 8);
+	    DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->target, pcmd->lun);)
 	    pSRB->SGIndex = 0;
 	    pSRB->TotalXferredLen = 0;
 	    pSRB->SGToBeXferLen = 0;
@@ -1398,17 +1446,19 @@
 		pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer;
 		pSRB->Segmentx.length = pcmd->request_bufflen;
 	    }
-	    if( dc390_StartSCSI( pACB, pDCB, pSRB ) )
-		dc390_RewaitSRB( pDCB, pSRB );
+	    if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) {
+		dc390_Going_to_Waiting ( pDCB, pSRB );
+		dc390_waiting_timer (pACB, HZ/5);
+	    }
 	    return;
 	}
     }
     if( status )
     {
-	if( status == SCSI_STAT_CHECKCOND)
+	if( status_byte(status) == CHECK_CONDITION )
 	{
-	    REMOVABLEDEBUG(printk (KERN_INFO "DC390: Scsi_Stat_CheckCond (Cmd %02x, Id %02x, LUN %02x)\n",\
-		    pcmd->cmnd[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN);)
+	    REMOVABLEDEBUG(printk (KERN_INFO "DC390: Check_Condition (Cmd %02x, Id %02x, LUN %02x)\n",\
+		    pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN);)
 	    if( (pSRB->SGIndex < pSRB->SGcount) && (pSRB->SGcount) && (pSRB->SGToBeXferLen) )
 	    {
 		bval = pSRB->SGcount;
@@ -1425,12 +1475,14 @@
 	    dc390_RequestSense( pACB, pDCB, pSRB );
 	    return;
 	}
-	else if( status == SCSI_STAT_QUEUEFULL )
+	else if( status_byte(status) == QUEUE_FULL )
 	{
 	    bval = (UCHAR) pDCB->GoingSRBCnt;
 	    bval--;
 	    pDCB->MaxCommand = bval;
-	    dc390_RewaitSRB( pDCB, pSRB );
+	    dc390_freetag (pDCB, pSRB);
+	    dc390_Going_to_Waiting ( pDCB, pSRB );
+	    dc390_waiting_timer (pACB, HZ/5);
 	    pSRB->AdaptStatus = 0;
 	    pSRB->TargetStatus = 0;
 	    return;
@@ -1439,23 +1491,23 @@
 	{
 	    pSRB->AdaptStatus = H_SEL_TIMEOUT;
 	    pSRB->TargetStatus = 0;
-	    pcmd->result = DID_BAD_TARGET << 16;
+	    pcmd->result = MK_RES(0,DID_NO_CONNECT,0,0);
 	    /* Devices are removed below ... */
 	}
-	else if (status == SCSI_STAT_BUSY && 
-		 (pSRB->CmdBlock[0] == TEST_UNIT_READY || pSRB->CmdBlock[0] == INQUIRY) &&
+	else if (status_byte(status) == BUSY && 
+		 (pcmd->cmnd[0] == TEST_UNIT_READY || pcmd->cmnd[0] == INQUIRY) &&
 		 pACB->scan_devices)
 	{
 	    pSRB->AdaptStatus = 0;
 	    pSRB->TargetStatus = status;
-	    pcmd->result = (ULONG) (pSRB->EndMessage << 8)
-				/* | (ULONG) status */;
+	    pcmd->result = MK_RES(0,0,pSRB->EndMessage,/*status*/0);
 	}
 	else
 	{   /* Another error */
 	    pSRB->AdaptStatus = 0;
 	    if( pSRB->RetryCnt )
 	    {	/* Retry */
+		//printk ("DC390: retry\n");
 		pSRB->RetryCnt--;
 		pSRB->TargetStatus = 0;
 		pSRB->SGIndex = 0;
@@ -1469,14 +1521,18 @@
 		    pSRB->Segmentx.address = (PUCHAR) pcmd->request_buffer;
 		    pSRB->Segmentx.length = pcmd->request_bufflen;
 		}
-		if( dc390_StartSCSI( pACB, pDCB, pSRB ) )
-		    dc390_RewaitSRB( pDCB, pSRB );
-		return;
+		if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) {
+		    dc390_Going_to_Waiting ( pDCB, pSRB );
+		    dc390_waiting_timer (pACB, HZ/5);
+		}
+      		return;
 	    }
 	    else
 	    {	/* Report error */
-		pcmd->result |= (DID_ERROR << 16) | (ULONG) (pSRB->EndMessage << 8) |
-			       (ULONG) status;
+	      //pcmd->result = MK_RES(0, DID_ERROR, pSRB->EndMessage, status);
+	      SET_RES_DID(pcmd->result,DID_ERROR);
+	      SET_RES_MSG(pcmd->result,pSRB->EndMessage);
+	      SET_RES_TARGET(pcmd->result,status);
 	    }
 	}
     }
@@ -1486,38 +1542,52 @@
 	if(status & H_OVER_UNDER_RUN)
 	{
 	    pSRB->TargetStatus = 0;
-	    pcmd->result |= (DID_OK << 16) | (pSRB->EndMessage << 8);
+	    SET_RES_DID(pcmd->result,DID_OK);
+	    SET_RES_MSG(pcmd->result,pSRB->EndMessage);
 	}
 	else if( pSRB->SRBStatus & PARITY_ERROR)
 	{
-	    pcmd->result |= (DID_PARITY << 16) | (pSRB->EndMessage << 8);
+	    //pcmd->result = MK_RES(0,DID_PARITY,pSRB->EndMessage,0);
+	    SET_RES_DID(pcmd->result,DID_PARITY);
+	    SET_RES_MSG(pcmd->result,pSRB->EndMessage);
 	}
 	else		       /* No error */
 	{
 	    pSRB->AdaptStatus = 0;
 	    pSRB->TargetStatus = 0;
-	    pcmd->result |= (DID_OK << 16);
+	    SET_RES_DID(pcmd->result,DID_OK);
 	}
     }
+    if ((pcmd->result & RES_DID) == 0 &&
+	pcmd->cmnd[0] == INQUIRY && 
+	pcmd->cmnd[2] == 0 &&
+	pcmd->request_bufflen >= 8 &&
+	ptr &&
+	(ptr->Vers & 0x07) >= 2)
+	    pDCB->Inquiry7 = ptr->Flags;
 
 ckc_e:
     if( pACB->scan_devices )
     {
-	if( pSRB->CmdBlock[0] == TEST_UNIT_READY )
+	if( pcmd->cmnd[0] == TEST_UNIT_READY ||
+	    pcmd->cmnd[0] == INQUIRY)
 	{
 #ifdef DC390_DEBUG0
-	    printk (KERN_INFO "DC390: Test_Unit_Ready: result: %08x", pcmd->result);
-	    if (pcmd->result & DRIVER_SENSE << 24) printk (" (sense: %02x %02x %02x %02x)\n",
+	    printk (KERN_INFO "DC390: %s: result: %08x", 
+		    (pcmd->cmnd[0] == INQUIRY? "INQUIRY": "TEST_UNIT_READY"),
+		    pcmd->result);
+	    if (pcmd->result & (DRIVER_SENSE << 24)) printk (" (sense: %02x %02x %02x %02x)\n",
 				   pcmd->sense_buffer[0], pcmd->sense_buffer[1],
 				   pcmd->sense_buffer[2], pcmd->sense_buffer[3]);
 	    else printk ("\n");
 #endif
-	    if((pcmd->result != (DID_OK << 16) && !(pcmd->result & SCSI_STAT_CHECKCOND) && !(pcmd->result & SCSI_STAT_BUSY)) ||
-	       ((pcmd->result & DRIVER_SENSE << 24) && (pcmd->sense_buffer[0] & 0x70) == 0x70 &&
-		(pcmd->sense_buffer[2] & 0xf) == ILLEGAL_REQUEST) || pcmd->result & DID_ERROR << 16)
+	    if( (host_byte(pcmd->result) != DID_OK && !(status_byte(pcmd->result) & CHECK_CONDITION) && !(status_byte(pcmd->result) & BUSY)) ||
+	       ((driver_byte(pcmd->result) & DRIVER_SENSE) && (pcmd->sense_buffer[0] & 0x70) == 0x70 &&
+		(pcmd->sense_buffer[2] & 0xf) == ILLEGAL_REQUEST) || host_byte(pcmd->result) & DID_ERROR )
 	    {
 	       /* device not present: remove */ 
-	       dc390_remove_dev (pACB, pDCB);
+	       //dc390_Going_remove (pDCB, pSRB);
+	       dc390_remove_dev (pACB, pDCB); DCB_removed = 1;
 	       
 	       if( (pcmd->target == pACB->pScsiHost->max_id - 1) &&
 		  ((pcmd->lun == 0) || (pcmd->lun == pACB->pScsiHost->max_lun - 1)) )
@@ -1534,16 +1604,17 @@
 	}
     }
    
-   if( pSRB->CmdBlock[0] == INQUIRY && 
-      (pcmd->result == DID_OK << 16 || pcmd->result & SCSI_STAT_CHECKCOND) )
+    //if( pSRB->pcmd->cmnd[0] == INQUIRY && 
+    //  (host_byte(pcmd->result) == DID_OK || status_byte(pcmd->result) & CHECK_CONDITION) )
+    if( pcmd->cmnd[0] == INQUIRY && 
+	(pcmd->result == (DID_OK << 16) || status_byte(pcmd->result) & CHECK_CONDITION) )
      {
-	ptr = (PSCSI_INQDATA) (pcmd->request_buffer);
-	if( pcmd->use_sg )
-	  ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address);
-	if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV)
+	if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV && !DCB_removed)
 	  {
+	     //printk ("DC390: Type = nodev! (%02i-%i)\n", pcmd->target, pcmd->lun);
 	     /* device not present: remove */
-	     dc390_remove_dev (pACB, pDCB);
+	     //dc390_Going_remove (pDCB, pSRB);
+	     dc390_remove_dev (pACB, pDCB); DCB_removed = 1;
 	  }
 	else
 	  {
@@ -1555,40 +1626,29 @@
 	    (pcmd->lun == pACB->pScsiHost->max_lun - 1) )
 	  pACB->scan_devices = 0;
      };
-/*  dc390_ReleaseSRB( pDCB, pSRB ); */
 
-    if(pSRB == pDCB->pGoingSRB )
-    {
-	pDCB->pGoingSRB = pSRB->pNextSRB;
-    }
-    else
-    {
-	psrb = pDCB->pGoingSRB;
-	while( psrb->pNextSRB != pSRB )
-	    psrb = psrb->pNextSRB;
-	psrb->pNextSRB = pSRB->pNextSRB;
-	if( pSRB == pDCB->pGoingLast )
-	    pDCB->pGoingLast = psrb;
-    }
-    pSRB->pNextSRB = pACB->pFreeSRB;
-    pACB->pFreeSRB = pSRB;
-    pDCB->GoingSRBCnt--;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30)
+    pcmd->resid = pcmd->request_bufflen - pSRB->TotalXferredLen;
+#endif
 
-    dc390_DoWaitingSRB( pACB );
+    if (!DCB_removed) dc390_Going_remove (pDCB, pSRB);
+    /* Add to free list */
+    dc390_Free_insert (pACB, pSRB);
 
+    DEBUG0(printk (KERN_DEBUG "DC390: SRBdone: done pid %li\n", pcmd->pid);)
     DC390_UNLOCK_ACB_NI;
-    pcmd->scsi_done( pcmd );
+    pcmd->scsi_done (pcmd);
     DC390_LOCK_ACB_NI;
 
-    if( pDCB->QIORBCnt )
-	dc390_DoNextCmd( pACB, pDCB );
+    dc390_Query_to_Waiting (pACB);
+    dc390_Waiting_process (pACB);
     return;
 }
 
 
-/* Remove all SRBs and tell midlevel code DID_RESET */
+/* Remove all SRBs from Going list and inform midlevel */
 void
-dc390_DoingSRB_Done( PACB pACB )
+dc390_DoingSRB_Done( PACB pACB, PSCSICMD cmd )
 {
     PDCB   pDCB, pdcb;
     PSRB   psrb, psrb2;
@@ -1605,16 +1665,21 @@
 	{
 	    psrb2 = psrb->pNextSRB;
 	    pcmd = psrb->pcmd;
-	    pcmd->result = DID_RESET << 16;
+	    dc390_Free_insert (pACB, psrb);
+#ifndef USE_NEW_EH
+	    /* New EH will crash on being given timed out cmnds */
+	    if (pcmd == cmd)
+		pcmd->result = MK_RES(0,DID_ABORT,0,0);
+	    else
+		pcmd->result = MK_RES(0,DID_RESET,0,0);
 
 /*	    ReleaseSRB( pDCB, pSRB ); */
 
-	    psrb->pNextSRB = pACB->pFreeSRB;
-	    pACB->pFreeSRB = psrb;
-
+	    DEBUG0(printk (KERN_DEBUG "DC390: DoingSRB_Done: done pid %li\n", pcmd->pid);)
 	    DC390_UNLOCK_ACB_NI;
 	    pcmd->scsi_done( pcmd );
 	    DC390_LOCK_ACB_NI;
+#endif	
 	    psrb  = psrb2;
 	}
 	pdcb->GoingSRBCnt = 0;;
@@ -1622,21 +1687,21 @@
 	pdcb->TagMask = 0;
 	pdcb = pdcb->pNextDCB;
     } while( pdcb != pDCB );
+    dc390_Query_to_Waiting (pACB);
 }
 
 
 static void
 dc390_ResetSCSIBus( PACB pACB )
 {
-    pACB->ACBFlag |= RESET_DEV;
-
-    DC390_write8 (ScsiCmd, RST_DEVICE_CMD);
-    udelay (250);
-    DC390_write8 (ScsiCmd, NOP_CMD);
+    //DC390_write8 (ScsiCmd, RST_DEVICE_CMD);
+    //udelay (250);
+    //DC390_write8 (ScsiCmd, NOP_CMD);
 
     DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
     DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
     DC390_write8 (ScsiCmd, RST_SCSI_BUS_CMD);
+    pACB->Connected = 0;
 
     return;
 }
@@ -1644,27 +1709,31 @@
 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,");)
 
+    if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
     DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
     /* Unlock before ? */
-    /* delay a second */
-    { unsigned int msec = 1*1000; while (--msec) udelay(1000); }
+    /* delay half a second */
+    udelay (1000);
     DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
+    pACB->pScsiHost->last_reset = jiffies + 5*HZ/2
+		    + HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY];
+    pACB->Connected = 0;
 
     if( pACB->ACBFlag & RESET_DEV )
 	pACB->ACBFlag |= RESET_DONE;
     else
-    {
+    {   /* Reset was issued by sb else */
 	pACB->ACBFlag |= RESET_DETECT;
 
 	dc390_ResetDevParam( pACB );
-/*	dc390_DoingSRB_Done( pACB ); ???? */
-	dc390_RecoverSRB( pACB );
+	dc390_DoingSRB_Done( pACB, 0 );
+	//dc390_RecoverSRB( pACB );
 	pACB->pActiveDCB = NULL;
 	pACB->ACBFlag = 0;
-	dc390_DoWaitingSRB( pACB );
+	dc390_Waiting_process( pACB );
     }
     return;
 }
@@ -1676,15 +1745,17 @@
     PSCSICMD  pcmd;
 
     REMOVABLEDEBUG(printk (KERN_INFO "DC390: RequestSense (Cmd %02x, Id %02x, LUN %02x)\n",\
-	    pSRB->CmdBlock[0], pDCB->UnitSCSIID, pDCB->UnitSCSILUN);)
+	    pSRB->pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN);)
 
     pSRB->SRBFlag |= AUTO_REQSENSE;
-    pSRB->Segment0[0] = (ULONG) pSRB->CmdBlock[0];
-    pSRB->Segment0[1] = (ULONG) pSRB->CmdBlock[4];
-    pSRB->Segment1[0] = (ULONG) ((pSRB->ScsiCmdLen << 8) + pSRB->SGcount);
-    pSRB->Segment1[1] = pSRB->TotalXferredLen;
+    //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;
     pSRB->AdaptStatus = 0;
-    pSRB->TargetStatus = 0; /* SCSI_STAT_CHECKCOND; */
+    pSRB->TargetStatus = 0; /* CHECK_CONDITION<<1; */
 
     pcmd = pSRB->pcmd;
 
@@ -1694,16 +1765,18 @@
     pSRB->SGcount = 1;
     pSRB->SGIndex = 0;
 
-    pSRB->CmdBlock[0] = REQUEST_SENSE;
-    pSRB->CmdBlock[1] = pDCB->IdentifyMsg << 5;
-    (USHORT) pSRB->CmdBlock[2] = 0;
-    (USHORT) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer);
-    pSRB->ScsiCmdLen = 6;
+    //pSRB->CmdBlock[0] = REQUEST_SENSE;
+    //pSRB->CmdBlock[1] = pDCB->TargetLUN << 5;
+    //(USHORT) pSRB->CmdBlock[2] = 0;
+    //(USHORT) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer);
+    //pSRB->ScsiCmdLen = 6;
 
     pSRB->TotalXferredLen = 0;
     pSRB->SGToBeXferLen = 0;
-    if( dc390_StartSCSI( pACB, pDCB, pSRB ) )
-	dc390_RewaitSRB( pDCB, pSRB );
+    if( dc390_StartSCSI( pACB, pDCB, pSRB ) ) {
+	dc390_Going_to_Waiting ( pDCB, pSRB );
+	dc390_waiting_timer (pACB, HZ/5);
+    }
 }
 
 
diff -urN linux-2.2.19-pre3/drivers/scsi/tmscsim.c linux/drivers/scsi/tmscsim.c
--- linux-2.2.19-pre3/drivers/scsi/tmscsim.c	Mon Sep  4 10:39:21 2000
+++ linux/drivers/scsi/tmscsim.c	Mon Dec  3 20:54:39 2001
@@ -5,11 +5,11 @@
  *		     Bus Master Host Adapter			       *
  * (C)Copyright 1995-1996 Tekram Technology Co., Ltd.		       *
  ***********************************************************************/
-/* (C) Copyright: put under GNU GPL in 10/96				*
+/* (C) Copyright: put under GNU GPL in 10/96  (see README.tmscsim)	*
 *************************************************************************/
-/* $Id: tmscsim.c,v 2.16 1998/12/25 17:54:44 garloff Exp $		*/
+/* $Id: tmscsim.c,v 2.60.2.30 2000/12/20 01:07:12 garloff Exp $		*/
 /*	Enhancements and bugfixes by					*
- *	Kurt Garloff <kurt@garloff.de>					*
+ *	Kurt Garloff <kurt@garloff.de>	<garloff@suse.de>		*
  ***********************************************************************/
 /*	HISTORY:							*
  *									*
@@ -95,8 +95,75 @@
  *	2.0c  98/11/19	KG	Cleaned up detect/init for SMP boxes, 	*
  *				Write Erase DMA (1.20t) caused problems	*
  *	2.0d  98/12/25	KG	Christmas release ;-) Message handling  *
- *				competely reworked. Handle target ini-	*
+ *				completely reworked. Handle target ini-	*
  *				tiated SDTR correctly.			*
+ *	2.0d1 99/01/25	KG	Try to handle RESTORE_PTR		*
+ *	2.0d2 99/02/08	KG	Check for failure of kmalloc, correct 	*
+ *				inclusion of scsicam.h, DelayReset	*
+ *	2.0d3 99/05/31	KG	DRIVER_OK -> DID_OK, DID_NO_CONNECT,	*
+ *				detect Target mode and warn.		*
+ *				pcmd->result handling cleaned up.	*
+ *	2.0d4 99/06/01	KG	Cleaned selection process. Found bug	*
+ *				which prevented more than 16 tags. Now:	*
+ *				24. SDTR cleanup. Cleaner multi-LUN	*
+ *				handling. Don't modify ControlRegs/FIFO	*
+ *				when connected.				*
+ *	2.0d5 99/06/01	KG	Clear DevID, Fix INQUIRY after cfg chg.	*
+ *	2.0d6 99/06/02	KG	Added ADD special command to allow cfg.	*
+ *				before detection. Reset SYNC_NEGO_DONE	*
+ *				after a bus reset.			*
+ *	2.0d7 99/06/03	KG	Fixed bugs wrt add,remove commands	*
+ *	2.0d8 99/06/04	KG	Removed copying of cmnd into CmdBlock.	*
+ *				Fixed Oops in _release().		*
+ *	2.0d9 99/06/06	KG	Also tag queue INQUIRY, T_U_R, ...	*
+ *				Allow arb. no. of Tagged Cmnds. Max 32	*
+ *	2.0d1099/06/20	KG	TagMaxNo changes now honoured! Queueing *
+ *				clearified (renamed ..) TagMask handling*
+ *				cleaned.				*
+ *	2.0d1199/06/28	KG	cmd->result now identical to 2.0d2	*
+ *	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				*
+ *	2.0d1699/07/13	KG	Reenable StartSCSI interrupt, Retry msg	*
+ *	2.0d1799/07/15	KG	Remove debug msg. Disable recfg. when	*
+ *				there are queued cmnds			*
+ *	2.0d1899/07/18	KG	Selection timeout: Don't requeue	*
+ *	2.0d1999/07/18	KG	Abort: Only call scsi_done if dequeued	*
+ *	2.0d2099/07/19	KG	Rst_Detect: DoingSRB_Done		*
+ *	2.0d2199/08/15	KG	dev_id for request/free_irq, cmnd[0] for*
+ *				RETRY, SRBdone does DID_ABORT for the 	*
+ *				cmd passed by DC390_reset()		*
+ *	2.0d2299/08/25	KG	dev_id fixed. can_queue: 42		*
+ *	2.0d2399/08/25	KG	Removed some debugging code. dev_id 	*
+ *				now is set to pACB. Use u8,u16,u32. 	*
+ *	2.0d2499/11/14	KG	Unreg. I/O if failed IRQ alloc. Call	*
+ * 				done () w/ DID_BAD_TARGET in case of	*
+ *				missing DCB. We	are old EH!!		*
+ *	2.0d2500/01/15	KG	2.3.3x compat from Andreas Schultz	*
+ *				set unique_id. Disable RETRY message.	*
+ *	2.0d2600/01/29	KG	Go to new EH.				*
+ *	2.0d2700/01/31	KG	... but maintain 2.0 compat.		*
+ *				and fix DCB freeing			*
+ *	2.0d2800/02/14	KG	Queue statistics fixed, dump special cmd*
+ *				Waiting_Timer for failed StartSCSI	*
+ *				New EH: Don't return cmnds to ML on RST *
+ *				Use old EH (don't have new EH fns yet)	*
+ * 				Reset: Unlock, but refuse to queue	*
+ * 				2.3 __setup function			*
+ *	2.0e  00/05/22	KG	Return residual for 2.3			*
+ *	2.0e1 00/05/25	KG	Compile fixes for 2.3.99		*
+ *	2.0e2 00/05/27	KG	Jeff Garzik's pci_enable_device()	*
+ *	2.0e3 00/09/29	KG	Some 2.4 changes. Don't try Sync Nego	*
+ *				before INQUIRY has reported ability. 	*
+ *				Recognise INQUIRY as scanning command.	*
+ *	2.0e4 00/10/13	KG	Allow compilation into 2.4 kernel	*
+ *	2.0e5 00/11/17	KG	Store Inq.flags in DCB			*
+ *	2.0e6 00/11/22  KG	2.4 init function (Thx to O.Schumann)	*
+ * 				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	*
  ***********************************************************************/
 
 /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */
@@ -108,6 +175,7 @@
 //#define DC390_DCBDEBUG
 //#define DC390_PARSEDEBUG
 //#define DC390_REMOVABLEDEBUG
+//#define DC390_LOCKDEBUG
 
 /* Debug definitions */
 #ifdef DC390_DEBUG0
@@ -159,6 +227,7 @@
 #include <linux/config.h>
 #include <linux/version.h>
 #include <linux/blk.h>
+#include <linux/timer.h>
 
 #include "scsi.h"
 #include "hosts.h"
@@ -175,8 +244,7 @@
 
 /* Note: Starting from 2.1.9x, the mid-level scsi code issues a 
  * spinlock_irqsave (&io_request_lock) before calling the driver's 
- * routines, so we don't need to lock.
- * TODO: Verify, if we are locked in every case!
+ * routines, so we don't need to lock, except in the IRQ handler.
  * The policy 3, let the midlevel scsi code do the io_request_locks
  * and us locking on a driver specific lock, shouldn't hurt anybody; it
  * just causes a minor performance degradation for setting the locks.
@@ -189,31 +257,46 @@
  * undef  : traditional save_flags; cli; restore_flags;
  */
 
-//#define DEBUG_SPINLOCKS 2	/* Set to 0, 1 or 2 in include/asm/spinlock.h */
+//#define DEBUG_SPINLOCKS 2	/* Set to 0, 1 or 2 in include/linux/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 <linux/init.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
+# include <linux/spinlock.h>
+#else
 # include <asm/spinlock.h>
 #endif
+#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
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,99)
+static struct pci_device_id tmscsim_pci_tbl[] __initdata = {
+	{
+		vendor: PCI_VENDOR_ID_AMD,
+		device: PCI_DEVICE_ID_AMD53C974,
+		subvendor: PCI_ANY_ID,
+		subdevice: PCI_ANY_ID,
+	},
+	{ }		/* Terminating entry */
+};
+MODULE_DEVICE_TABLE(pci, tmscsim_pci_tbl);
+#endif
+	
 #ifdef USE_SPINLOCKS
 
 # if USE_SPINLOCKS == 3 /* both */
 
-#  if defined (__SMP__) || DEBUG_SPINLOCKS > 0
+#  if defined (CONFIG_SMP) || DEBUG_SPINLOCKS > 0
 #   define DC390_LOCKA_INIT { spinlock_t __unlocked = SPIN_LOCK_UNLOCKED; pACB->lock = __unlocked; };
 #  else
 #   define DC390_LOCKA_INIT
@@ -320,7 +403,11 @@
 # define PCI_PRESENT pci_present ()
 # define PCI_SET_MASTER pci_set_master (pdev)
 # define PCI_FIND_DEVICE(vend, id) (pdev = pci_find_device (vend, id, pdev))
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,10)
+# define PCI_GET_IO_AND_IRQ io_port = pci_resource_start (pdev, 0); irq = pdev->irq
+#else
 # define PCI_GET_IO_AND_IRQ io_port = pdev->base_address[0] & PCI_BASE_ADDRESS_IO_MASK; irq = pdev->irq
+#endif
 #else
 # include <linux/bios32.h>
 # define PDEV pbus, pdevfn
@@ -369,7 +456,7 @@
 void dc390_Disconnect( PACB pACB );
 void dc390_Reselect( PACB pACB );
 void dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB );
-void dc390_DoingSRB_Done( PACB pACB );
+void dc390_DoingSRB_Done( PACB pACB, PSCSICMD cmd );
 static void dc390_ScsiRstDetect( PACB pACB );
 static void dc390_ResetSCSIBus( PACB pACB );
 static void __inline__ dc390_RequestSense( PACB pACB, PDCB pDCB, PSRB pSRB );
@@ -379,7 +466,7 @@
 void do_DC390_Interrupt( int, void *, struct pt_regs *);
 
 int    dc390_initAdapter( PSH psh, ULONG io_port, UCHAR Irq, UCHAR index );
-void   dc390_initDCB( PACB pACB, PDCB *ppDCB, PSCSICMD cmd );
+void   dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun);
 void   dc390_updateDCB (PACB pACB, PDCB pDCB);
 
 #ifdef MODULE
@@ -393,31 +480,19 @@
 //static PSH	dc390_pSH_current = NULL;
 static PACB	dc390_pACB_start= NULL;
 static PACB	dc390_pACB_current = NULL;
-static UCHAR	dc390_adapterCnt = 0;
-static UCHAR	dc390_CurrSyncOffset = 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 */
-int tmscsim[] = {7, 1 /* 8MHz */, 
-		PARITY_CHK_ | SEND_START_ | EN_DISCONNECT_
-		| SYNC_NEGO_ | TAG_QUEUEING_,
-		MORE2_DRV | GREATER_1G | RST_SCSI_BUS | ACTIVE_NEGATION
-		/* | NO_SEEK */
-# ifdef CONFIG_SCSI_MULTI_LUN
-		| LUN_CHECK
-# endif
-		, 3 /* 16 Tags per LUN */};
+int tmscsim[] = {-2, -2, -2, -2, -2, -2};
 
-# if defined(MODULE) && LINUX_VERSION_CODE >= LinuxVersionCode(2,1,30)
-MODULE_PARM(tmscsim, "1-5i");
-MODULE_PARM_DESC(tmscsim, "Host SCSI ID, Speed (0=10MHz), Device Flags, Adapter Flags, Max Tags (log2(tags)-1)");
+# 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");
@@ -482,12 +557,14 @@
 static char*  dc390_adapname = "DC390";
 UCHAR  dc390_eepromBuf[MAX_ADAPTER_NUM][EE_LEN];
 UCHAR  dc390_clock_period1[] = {4, 5, 6, 7, 8, 10, 13, 20};
+UCHAR  dc390_clock_speed[] = {100,80,67,57,50, 40, 31, 20};
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30)
 struct proc_dir_entry	DC390_proc_scsi_tmscsim ={
        PROC_SCSI_DC390T, 7 ,"tmscsim",
        S_IFDIR | S_IRUGO | S_IXUGO, 2
        };
-
+#endif
 
 /***********************************************************************
  * Functions for access to DC390 EEPROM
@@ -511,59 +588,107 @@
     udelay(160);
 }
 
-#ifndef CONFIG_SCSI_DC390T_NOGENSUPP
-static void __init dc390_EEpromDefaults (UCHAR index)
+
+/* Override EEprom values with explicitly set values */
+static void __init dc390_EEprom_Override (UCHAR index)
 {
     PUCHAR ptr;
     UCHAR  id;
     ptr = (PUCHAR) dc390_eepromBuf[index];
     
     /* Adapter Settings */
-    ptr[EE_ADAPT_SCSI_ID] = (UCHAR)tmscsim[0]; /* Adapter ID */
-    ptr[EE_MODE2] = (UCHAR)tmscsim[3];
-    ptr[EE_DELAY] = 0; /* ?? */
-    ptr[EE_TAG_CMD_NUM] = (UCHAR)tmscsim[4]; /* Tagged Comds */
+    if (tmscsim[0] != -2)
+	ptr[EE_ADAPT_SCSI_ID] = (UCHAR)tmscsim[0];	/* Adapter ID */
+    if (tmscsim[3] != -2)
+	ptr[EE_MODE2] = (UCHAR)tmscsim[3];
+    if (tmscsim[5] != -2)
+	ptr[EE_DELAY] = tmscsim[5];			/* Reset delay */
+    if (tmscsim[4] != -2)
+	ptr[EE_TAG_CMD_NUM] = (UCHAR)tmscsim[4];	/* Tagged Cmds */
     
     /* Device Settings */
     for (id = 0; id < MAX_SCSI_ID; id++)
     {
-      ptr[id<<2] = (UCHAR)tmscsim[2]; /* EE_MODE1 */
-      ptr[(id<<2) + 1] = (UCHAR)tmscsim[1]; /* EE_Speed */
+	if (tmscsim[2] != -2)
+		ptr[id<<2] = (UCHAR)tmscsim[2];		/* EE_MODE1 */
+	if (tmscsim[1] != -2)
+		ptr[(id<<2) + 1] = (UCHAR)tmscsim[1];	/* EE_Speed */
     };
-    dc390_adapname = "AM53C974";
 }
 
-static void __init dc390_checkparams (void)
+/* Handle "-1" case */
+static void __init dc390_check_for_safe_settings (void)
 {
-	PARSEDEBUG(printk(KERN_INFO "DC390: setup %08x %08x %08x %08x %08x\n", tmscsim[0],\
-		      tmscsim[1], tmscsim[2], tmscsim[3], tmscsim[4]);)
-	if (tmscsim[0] < 0 || tmscsim[0] > 7) /* modules-2.0.0 passes -1 as string */
+	if (tmscsim[0] == -1 || tmscsim[0] > 15) /* modules-2.0.0 passes -1 as string */
 	{
-		tmscsim[0] = 7; tmscsim[1] = 4; 
-		tmscsim[2] = 9; tmscsim[3] = 15;
-		tmscsim[4] = 2;
+		tmscsim[0] = 7; tmscsim[1] = 4;
+		tmscsim[2] = 0x09; tmscsim[3] = 0x0f;
+		tmscsim[4] = 2; tmscsim[5] = 10;
 		printk (KERN_INFO "DC390: Using safe settings.\n");
 	}
-	else
+}
+
+
+#ifndef CONFIG_SCSI_DC390T_NOGENSUPP
+int __initdata tmscsim_def[] = {7, 0 /* 10MHz */,
+		PARITY_CHK_ | SEND_START_ | EN_DISCONNECT_
+		| SYNC_NEGO_ | TAG_QUEUEING_,
+		MORE2_DRV | GREATER_1G | RST_SCSI_BUS | ACTIVE_NEGATION
+		/* | NO_SEEK */
+# ifdef CONFIG_SCSI_MULTI_LUN
+		| LUN_CHECK
+# endif
+		, 3 /* 16 Tags per LUN */, 1 /* s delay after Reset */ };
+
+/* Copy defaults over set values where missing */
+static void __init dc390_fill_with_defaults (void)
+{
+	int i;
+	PARSEDEBUG(printk(KERN_INFO "DC390: setup %08x %08x %08x %08x %08x %08x\n", tmscsim[0],\
+		      tmscsim[1], tmscsim[2], tmscsim[3], tmscsim[4], tmscsim[5]);)
+	for (i = 0; i < 6; i++)
 	{
-		/* if (tmscsim[0] < 0 || tmscsim[0] > 7) tmscsim[0] = 7; */
-		if (tmscsim[1] < 0 || tmscsim[1] > 7) tmscsim[1] = 4;
-		if (tmscsim[4] < 0 || tmscsim[4] > 5) tmscsim[4] = 4;
-	};
+		if (tmscsim[i] < 0 || tmscsim[i] > 255)
+			tmscsim[i] = tmscsim_def[i];
+	}
+	/* Sanity checks */
+	if (tmscsim[0] >   7) tmscsim[0] =   7;
+	if (tmscsim[1] >   7) tmscsim[1] =   4;
+	if (tmscsim[4] >   5) tmscsim[4] =   4;
+	if (tmscsim[5] > 180) tmscsim[5] = 180;
 };
+#endif
+
 /* Override defaults on cmdline:
  * tmscsim: AdaptID, MaxSpeed (Index), DevMode (Bitmapped), AdaptMode (Bitmapped)
  */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
+void __init dc390_setup (char *str)
+{	
+	int ints[8];
+	int i, im;
+	(void)get_options (str, ARRAY_SIZE(ints), ints);
+#else
 void __init dc390_setup (char *str, int *ints)
 {
-	int i;
-	for (i = 0; i < ints[0]; i++)
-		tmscsim[i] = ints[i+1];
-	if (ints[0] > 5)
+	int i, im;
+#endif
+	im = ints[0];
+	if (im > 6)
+	{
 		printk (KERN_NOTICE "DC390: ignore extra params!\n");
+		im = 6;
+	};
+	for (i = 0; i < im; i++)
+		tmscsim[i] = ints[i+1];
 	/* dc390_checkparams (); */
 };
-#endif /* CONFIG_SCSI_DC390T_NOGENSUPP */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
+#ifndef MODULE
+__setup("tmscsim=", dc390_setup);
+#endif
+#endif
 
 
 static void __init dc390_EEpromOutDI( PDEVDECL, PUCHAR regval, UCHAR Carry )
@@ -652,6 +777,12 @@
 }
 
 
+static void __init dc390_interpret_delay (UCHAR index)
+{
+    char interpd [] = {1,3,5,10,16,30,60,120};
+    dc390_eepromBuf[index][EE_DELAY] = interpd [dc390_eepromBuf[index][EE_DELAY]];
+};
+
 static UCHAR __init dc390_CheckEEpromCheckSum( PDEVDECL, UCHAR index )
 {
     UCHAR  i;
@@ -662,6 +793,8 @@
     memcpy (dc390_eepromBuf[index], EEbuf, EE_ADAPT_SCSI_ID);
     memcpy (&dc390_eepromBuf[index][EE_ADAPT_SCSI_ID], 
 	    &EEbuf[REAL_EE_ADAPT_SCSI_ID], EE_LEN - EE_ADAPT_SCSI_ID);
+    dc390_interpret_delay (index);
+    
     wval = 0;
     for(i=0; i<0x40; i++, ptr++)
 	wval += *ptr;
@@ -674,65 +807,94 @@
  * (DCBs, SRBs, Queueing)
  *
  **********************************************************************/
-static PDCB __inline__ dc390_findDCB ( PACB pACB, Scsi_Cmnd *cmd)
+static PDCB __inline__ dc390_findDCB ( PACB pACB, UCHAR id, UCHAR lun)
 {
    PDCB pDCB = pACB->pLinkDCB; if (!pDCB) return 0;
-   while (pDCB->UnitSCSIID != cmd->target || pDCB->UnitSCSILUN != cmd->lun)
+   while (pDCB->TargetID != id || pDCB->TargetLUN != lun)
      {
 	pDCB = pDCB->pNextDCB;
 	if (pDCB == pACB->pLinkDCB)
 	  {
-	     printk (KERN_WARNING "DC390: DCB not found (DCB=%08x, DCBmap[%2x]=%2x)\n",
-		     (int)pDCB, cmd->target, pACB->DCBmap[cmd->target]);
+	     DCBDEBUG(printk (KERN_WARNING "DC390: DCB not found (DCB=%p, DCBmap[%2x]=%2x)\n",
+		     pDCB, id, pACB->DCBmap[id]);)
 	     return 0;
 	  }
      };
-   DCBDEBUG1( printk (KERN_DEBUG "DCB %08x (%02x,%02x) found.\n",	\
-	   (int)pDCB, pDCB->UnitSCSIID, pDCB->UnitSCSILUN);)
+   DCBDEBUG1( printk (KERN_DEBUG "DCB %p (%02x,%02x) found.\n",	\
+		      pDCB, pDCB->TargetID, pDCB->TargetLUN);)
    return pDCB;
 };
 
-static void dc390_QLinkcmd( PSCSICMD cmd, PDCB pDCB )
-{
-    PSCSICMD  pcmd;
+/* Queueing philosphy:
+ * There are a couple of lists:
+ * - Query: Contains the Scsi Commands not yet turned into SRBs (per ACB)
+ *   (Note: For new EH, it is unecessary!)
+ * - Waiting: Contains a list of SRBs not yet sent (per DCB)
+ * - Free: List of free SRB slots
+ * 
+ * If there are no waiting commands for the DCB, the new one is sent to the bus
+ * otherwise the oldest one is taken from the Waiting list and the new one is 
+ * queued to the Waiting List
+ * 
+ * Lists are managed using two pointers and eventually a counter
+ */
+
 
-    if( !pDCB->QIORBCnt )
+#if 0
+/* Look for a SCSI cmd in a SRB queue */
+static PSRB dc390_find_cmd_in_SRBq (PSCSICMD cmd, PSRB queue)
+{
+    PSRB q = queue;
+    while (q)
     {
-	pDCB->pQIORBhead = cmd;
-	pDCB->pQIORBtail = cmd;
-	pDCB->QIORBCnt++;
-	cmd->next = NULL;
+	if (q->pcmd == cmd) return q;
+	q = q->pNextSRB;
+	if (q == queue) return 0;
     }
+    return q;
+};
+#endif
+    
+
+/* Append to Query List */
+static void dc390_Query_append( PSCSICMD cmd, PACB pACB )
+{
+    DEBUG0(printk ("DC390: Append cmd %li to Query\n", cmd->pid);)
+    if( !pACB->QueryCnt )
+	pACB->pQueryHead = cmd;
     else
-    {
-	pcmd = pDCB->pQIORBtail;
-	pcmd->next = cmd;
-	pDCB->pQIORBtail = cmd;
-	pDCB->QIORBCnt++;
-	cmd->next = NULL;
-    }
+	pACB->pQueryTail->next = cmd;
 
+    pACB->pQueryTail = cmd;
+    pACB->QueryCnt++;
+    pACB->CmdOutOfSRB++;
+    cmd->next = NULL;
 }
 
 
-static __inline__ PSCSICMD dc390_Getcmd( PDCB pDCB )
+/* Return next cmd from Query list */
+static PSCSICMD dc390_Query_get ( PACB pACB )
 {
     PSCSICMD  pcmd;
 
-    pcmd = pDCB->pQIORBhead;
-    pDCB->pQIORBhead = pcmd->next;
+    pcmd = pACB->pQueryHead;
+    if (!pcmd) return pcmd;
+    DEBUG0(printk ("DC390: Get cmd %li from Query\n", pcmd->pid);)
+    pACB->pQueryHead = pcmd->next;
     pcmd->next = NULL;
-    pDCB->QIORBCnt--;
-
+    if (!pACB->pQueryHead) pACB->pQueryTail = NULL;
+    pACB->QueryCnt--;
     return( pcmd );
 }
 
 
-static __inline__ PSRB dc390_GetSRB( PACB pACB )
+/* Return next free SRB */
+static __inline__ PSRB dc390_Free_get ( PACB pACB )
 {
     PSRB   pSRB;
 
     pSRB = pACB->pFreeSRB;
+    DEBUG0(printk ("DC390: Get Free SRB %p\n", pSRB);)
     if( pSRB )
     {
 	pACB->pFreeSRB = pSRB->pNextSRB;
@@ -742,130 +904,174 @@
     return( pSRB );
 }
 
-
-static __inline__ void dc390_RewaitSRB0( PDCB pDCB, PSRB pSRB )
+/* Insert SRB oin top of free list */
+static __inline__ void dc390_Free_insert (PACB pACB, PSRB pSRB)
 {
-    PSRB   psrb1;
+    DEBUG0(printk ("DC390: Free SRB %p\n", pSRB);)
+    pSRB->pNextSRB = pACB->pFreeSRB;
+    pACB->pFreeSRB = pSRB;
+}
 
-    if( (psrb1 = pDCB->pWaitingSRB) )
-    {
-	pSRB->pNextSRB = psrb1;
-    }
-    else
-    {
-	pSRB->pNextSRB = NULL;
+
+/* Inserts a SRB to the top of the Waiting list */
+static __inline__ void dc390_Waiting_insert ( PDCB pDCB, PSRB pSRB )
+{
+    DEBUG0(printk ("DC390: Insert pSRB %p cmd %li to Waiting\n", pSRB, pSRB->pcmd->pid);)
+    pSRB->pNextSRB = pDCB->pWaitingSRB;
+    if (!pDCB->pWaitingSRB)
 	pDCB->pWaitLast = pSRB;
-    }
     pDCB->pWaitingSRB = pSRB;
+    pDCB->WaitSRBCnt++;
 }
 
 
-static void dc390_RewaitSRB( PDCB pDCB, PSRB pSRB )
+/* Queue SRB to waiting list */
+static __inline__ void dc390_Waiting_append ( PDCB pDCB, PSRB pSRB)
 {
-    PSRB   psrb1;
-    UCHAR  bval;
-
-    pDCB->GoingSRBCnt--; pDCB->pDCBACB->SelLost++;
-    DEBUG0(printk(KERN_INFO "DC390: RewaitSRB (%p, %p) pid = %li\n", pDCB, pSRB, pSRB->pcmd->pid);)
-    psrb1 = pDCB->pGoingSRB;
-    if( pSRB == psrb1 )
-    {
-	pDCB->pGoingSRB = psrb1->pNextSRB;
-    }
+    DEBUG0(printk ("DC390: Append pSRB %p cmd %li to Waiting\n", pSRB, pSRB->pcmd->pid);)
+    if( pDCB->pWaitingSRB )
+	pDCB->pWaitLast->pNextSRB = pSRB;
     else
-    {
-	while( pSRB != psrb1->pNextSRB )
-	    psrb1 = psrb1->pNextSRB;
-	psrb1->pNextSRB = pSRB->pNextSRB;
-	if( pSRB == pDCB->pGoingLast )
-	    pDCB->pGoingLast = psrb1;
-    }
-    if( (psrb1 = pDCB->pWaitingSRB) )
-    {
-	pSRB->pNextSRB = psrb1;
 	pDCB->pWaitingSRB = pSRB;
-    }
+
+    pDCB->pWaitLast = pSRB;
+    pSRB->pNextSRB = NULL;
+    pDCB->WaitSRBCnt++;
+    pDCB->pDCBACB->CmdInQ++;
+}
+
+static __inline__ void dc390_Going_append (PDCB pDCB, PSRB pSRB)
+{
+    pDCB->GoingSRBCnt++;
+    DEBUG0(printk("DC390: Append SRB %p to Going\n", pSRB);)
+    /* Append to the list of Going commands */
+    if( pDCB->pGoingSRB )
+	pDCB->pGoingLast->pNextSRB = pSRB;
     else
-    {
-	pSRB->pNextSRB = NULL;
-	pDCB->pWaitingSRB = pSRB;
-	pDCB->pWaitLast = pSRB;
-    }
+	pDCB->pGoingSRB = pSRB;
+
+    pDCB->pGoingLast = pSRB;
+    /* No next one in sent list */
+    pSRB->pNextSRB = NULL;
+};
+
+static __inline__ void dc390_Going_remove (PDCB pDCB, PSRB pSRB)
+{
+   DEBUG0(printk("DC390: Remove SRB %p from Going\n", pSRB);)
+   if (pSRB == pDCB->pGoingSRB)
+	pDCB->pGoingSRB = pSRB->pNextSRB;
+   else
+     {
+	PSRB psrb = pDCB->pGoingSRB;
+	while (psrb && psrb->pNextSRB != pSRB)
+	  psrb = psrb->pNextSRB;
+	if (!psrb) 
+	  { printk (KERN_ERR "DC390: Remove non-ex. SRB %p from Going!\n", pSRB); return; }
+	psrb->pNextSRB = pSRB->pNextSRB;
+	if (pSRB == pDCB->pGoingLast)
+	  pDCB->pGoingLast = psrb;
+     }
+   pDCB->GoingSRBCnt--;
+};
+
+/* Moves SRB from Going list to the top of Waiting list */
+static void dc390_Going_to_Waiting ( PDCB pDCB, PSRB pSRB )
+{
+    DEBUG0(printk(KERN_INFO "DC390: Going_to_Waiting (SRB %p) pid = %li\n", pSRB, pSRB->pcmd->pid);)
+    /* Remove SRB from Going */
+    dc390_Going_remove (pDCB, pSRB);
+    /* Insert on top of Waiting */
+    dc390_Waiting_insert (pDCB, pSRB);
+    /* Tag Mask must be freed elsewhere ! (KG, 99/06/18) */
+}
+
+/* Moves first SRB from Waiting list to Going list */
+static __inline__ void dc390_Waiting_to_Going ( PDCB pDCB, PSRB pSRB )
+{	
+	/* Remove from waiting list */
+	DEBUG0(printk("DC390: Remove SRB %p from head of Waiting\n", pSRB);)
+	pDCB->pWaitingSRB = pSRB->pNextSRB;
+	if( !pDCB->pWaitingSRB ) pDCB->pWaitLast = NULL;
+	pDCB->WaitSRBCnt--;
+	dc390_Going_append (pDCB, pSRB);
+}
+
+/* 2.0 timer compatibility */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,30)
+ static inline int timer_pending(struct timer_list * timer)
+ {
+	return timer->prev != NULL;
+ }
+ #define time_after(a,b)         ((long)(b) - (long)(a) < 0)
+ #define time_before(a,b)        time_after(b,a)
+#endif
 
-    bval = pSRB->TagNumber;
-    pDCB->TagMask &= (~(1 << bval));	  /* Free TAG number */
+void DC390_waiting_timed_out (unsigned long ptr);
+/* Sets the timer to wake us up */
+static void dc390_waiting_timer (PACB pACB, unsigned long to)
+{
+	if (timer_pending (&pACB->Waiting_Timer)) return;
+	init_timer (&pACB->Waiting_Timer);
+	pACB->Waiting_Timer.function = DC390_waiting_timed_out;
+	pACB->Waiting_Timer.data = (unsigned long)pACB;
+	if (time_before (jiffies + to, pACB->pScsiHost->last_reset))
+		pACB->Waiting_Timer.expires = pACB->pScsiHost->last_reset + 1;
+	else
+		pACB->Waiting_Timer.expires = jiffies + to + 1;
+	add_timer (&pACB->Waiting_Timer);
 }
 
 
-static void dc390_DoWaitingSRB( PACB pACB )
+/* Send the next command from the waiting list to the bus */
+static void dc390_Waiting_process ( PACB pACB )
 {
     PDCB   ptr, ptr1;
     PSRB   pSRB;
 
-    if( !(pACB->pActiveDCB) && !(pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV) ) )
-    {
-	ptr = pACB->pDCBRunRobin;
-	if( !ptr )
-	{
-	    ptr = pACB->pLinkDCB;
-	    pACB->pDCBRunRobin = ptr;
-	}
-	ptr1 = ptr;
-	for( ;ptr1; )
-	{
-	    pACB->pDCBRunRobin = ptr1->pNextDCB;
-	    if( !( ptr1->MaxCommand > ptr1->GoingSRBCnt ) ||
-		!( pSRB = ptr1->pWaitingSRB ) )
-	    {
-		if(pACB->pDCBRunRobin == ptr)
-		    break;
-		ptr1 = ptr1->pNextDCB;
-	    }
+    if( (pACB->pActiveDCB) || (pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV) ) )
+	return;
+    if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
+    ptr = pACB->pDCBRunRobin;
+    if( !ptr )
+      {
+	ptr = pACB->pLinkDCB;
+	pACB->pDCBRunRobin = ptr;
+      }
+    ptr1 = ptr;
+    if (!ptr1) return;
+    do 
+      {
+	pACB->pDCBRunRobin = ptr1->pNextDCB;
+	if( !( pSRB = ptr1->pWaitingSRB ) ||
+	    ( ptr1->MaxCommand <= ptr1->GoingSRBCnt ))
+	  ptr1 = ptr1->pNextDCB;
+	else
+	  {
+	    /* Try to send to the bus */
+	    if( !dc390_StartSCSI(pACB, ptr1, pSRB) )
+	      dc390_Waiting_to_Going (ptr1, pSRB);
 	    else
-	    {
-		if( !dc390_StartSCSI(pACB, ptr1, pSRB) )
-		{
-		    ptr1->GoingSRBCnt++;
-		    if( ptr1->pWaitLast == pSRB )
-		    {
-			ptr1->pWaitingSRB = NULL;
-			ptr1->pWaitLast = NULL;
-		    }
-		    else
-		    {
-			ptr1->pWaitingSRB = pSRB->pNextSRB;
-		    }
-		    pSRB->pNextSRB = NULL;
-
-		    if( ptr1->pGoingSRB )
-			ptr1->pGoingLast->pNextSRB = pSRB;
-		    else
-			ptr1->pGoingSRB = pSRB;
-		    ptr1->pGoingLast = pSRB;
-		}
-		break;
-	    }
-	}
-    }
+	      dc390_waiting_timer (pACB, HZ/5);
+	    break;
+	  }
+      } while (ptr1 != ptr);
     return;
 }
 
-
-static __inline__ void dc390_SRBwaiting( PDCB pDCB, PSRB pSRB)
+/* Wake up waiting queue */
+void DC390_waiting_timed_out (unsigned long ptr)
 {
-    if( pDCB->pWaitingSRB )
-    {
-	pDCB->pWaitLast->pNextSRB = pSRB;
-	pSRB->pNextSRB = NULL;
-    }
-    else
-    {
-	pDCB->pWaitingSRB = pSRB;
-    }
-    pDCB->pWaitLast = pSRB;
+	PACB pACB = (PACB)ptr;
+	DC390_IFLAGS
+	DC390_AFLAGS
+	DEBUG0(printk ("DC390: Debug: Waiting queue woken up by timer!\n");)
+	DC390_LOCK_IO;
+	DC390_LOCK_ACB;
+	dc390_Waiting_process (pACB);
+	DC390_UNLOCK_ACB;
+	DC390_UNLOCK_IO;
 }
 
-
 /***********************************************************************
  * Function: static void dc390_SendSRB (PACB pACB, PSRB pSRB)
  *
@@ -878,41 +1084,33 @@
     PDCB   pDCB;
 
     pDCB = pSRB->pSRBDCB;
-    if( !(pDCB->MaxCommand > pDCB->GoingSRBCnt) || (pACB->pActiveDCB) ||
+    if( (pDCB->MaxCommand <= pDCB->GoingSRBCnt) || (pACB->pActiveDCB) ||
 	(pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV)) )
     {
-	dc390_SRBwaiting(pDCB, pSRB);
-	goto SND_EXIT;
+	dc390_Waiting_append (pDCB, pSRB);
+	dc390_Waiting_process (pACB);
+	return;
     }
 
+#if 0
     if( pDCB->pWaitingSRB )
     {
-	dc390_SRBwaiting(pDCB, pSRB);
+	dc390_Waiting_append (pDCB, pSRB);
 /*	pSRB = GetWaitingSRB(pDCB); */	/* non-existent */
 	pSRB = pDCB->pWaitingSRB;
+	/* Remove from waiting list */
 	pDCB->pWaitingSRB = pSRB->pNextSRB;
 	pSRB->pNextSRB = NULL;
+	if (!pDCB->pWaitingSRB) pDCB->pWaitLast = NULL;
     }
-
-    if( !dc390_StartSCSI(pACB, pDCB, pSRB) )
-    {
-	pDCB->GoingSRBCnt++;
-	if( pDCB->pGoingSRB )
-	{
-	    pDCB->pGoingLast->pNextSRB = pSRB;
-	    pDCB->pGoingLast = pSRB;
-	}
-	else
-	{
-	    pDCB->pGoingSRB = pSRB;
-	    pDCB->pGoingLast = pSRB;
-	}
-    }
-    else
-	dc390_RewaitSRB0( pDCB, pSRB );
-
-SND_EXIT:
-    return;
+#endif
+	
+    if (!dc390_StartSCSI(pACB, pDCB, pSRB))
+	dc390_Going_append (pDCB, pSRB);
+    else {
+	dc390_Waiting_insert (pDCB, pSRB);
+	dc390_waiting_timer (pACB, HZ/5);
+    };
 }
 
 /***********************************************************************
@@ -927,8 +1125,8 @@
 {
     pSRB->pSRBDCB = pDCB;
     pSRB->pcmd = pcmd;
-    pSRB->ScsiCmdLen = pcmd->cmd_len;
-    memcpy (pSRB->CmdBlock, pcmd->cmnd, pcmd->cmd_len);
+    //pSRB->ScsiCmdLen = pcmd->cmd_len;
+    //memcpy (pSRB->CmdBlock, pcmd->cmnd, pcmd->cmd_len);
     
     if( pcmd->use_sg )
     {
@@ -961,8 +1159,39 @@
     pSRB->SGToBeXferLen = 0;
     pSRB->ScsiPhase = 0;
     pSRB->EndMessage = 0;
+    pSRB->TagNumber = 255;
 };
 
+/* Put cmnd from Query to Waiting list and send next Waiting cmnd */
+static void dc390_Query_to_Waiting (PACB pACB)
+{
+    Scsi_Cmnd *pcmd;
+    PSRB   pSRB;
+    PDCB   pDCB;
+
+    if( pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV) )
+	return;
+
+    while (pACB->QueryCnt)
+    {
+	pSRB = dc390_Free_get ( pACB );
+	if (!pSRB) return;
+	pcmd = dc390_Query_get ( pACB );
+	if (!pcmd) { dc390_Free_insert (pACB, pSRB); return; }; /* should not happen */
+	pDCB = dc390_findDCB (pACB, pcmd->target, pcmd->lun);
+	if (!pDCB) 
+	{ 
+		dc390_Free_insert (pACB, pSRB);
+		printk (KERN_ERR "DC390: Command in queue to non-existing device!\n");
+		pcmd->result = MK_RES(DRIVER_ERROR,DID_ERROR,0,0);
+		DC390_UNLOCK_ACB_NI;
+		pcmd->done (pcmd);
+		DC390_LOCK_ACB_NI;
+	};
+	dc390_BuildSRB (pcmd, pDCB, pSRB);
+	dc390_Waiting_append ( pDCB, pSRB );
+    }
+}
 
 /***********************************************************************
  * Function : static int DC390_queue_command (Scsi_Cmnd *cmd,
@@ -985,7 +1214,6 @@
 
 int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
 {
-    Scsi_Cmnd *pcmd;
     PDCB   pDCB;
     PSRB   pSRB;
     DC390_AFLAGS
@@ -993,7 +1221,7 @@
 
 
     DEBUG0(/*  if(pACB->scan_devices) */	\
-	printk(KERN_INFO "DC390: Queue Cmd=%02x,ID=%d,LUN=%d (pid=%li)\n",\
+	printk(KERN_INFO "DC390: Queue Cmd=%02x,Tgt=%d,LUN=%d (pid=%li)\n",\
 		cmd->cmnd[0],cmd->target,cmd->lun,cmd->pid);)
 
     DC390_LOCK_ACB;
@@ -1014,25 +1242,32 @@
     if ( ( cmd->target >= pACB->pScsiHost->max_id ) || 
 	 (cmd->lun >= pACB->pScsiHost->max_lun) )
     {
-/*	printk("DC390: Ignore target %d lun %d\n",
+/*	printk ("DC390: Ignore target %d lun %d\n",
 		cmd->target, cmd->lun); */
 	DC390_UNLOCK_ACB;
-	done(cmd);
-	return( 0 );
+	//return (1);
+	done (cmd);
+	return (0);
     }
 
-    if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY) && !(pACB->DCBmap[cmd->target] & (1 << cmd->lun)) )
+    if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY || cmd->cmnd[0] == INQUIRY) && 
+       !(pACB->DCBmap[cmd->target] & (1 << cmd->lun)) )
     {
-	pACB->DCBmap[cmd->target] |= (1 << cmd->lun);
         pACB->scan_devices = 1;
 
-	dc390_initDCB( pACB, &pDCB, cmd );
+	dc390_initDCB( pACB, &pDCB, cmd->target, cmd->lun );
 	if (!pDCB)
 	  {
-	    printk (KERN_ERR "DC390: kmalloc for DCB failed, ID=%2x\n", cmd->target);
+	    printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n", 
+		    cmd->target, cmd->lun);
 	    DC390_UNLOCK_ACB;
-	    done(cmd);
-	    return(0);
+	    printk ("DC390: No DCB in queue_command!\n");
+#ifdef USE_NEW_EH
+	    return (1);
+#else
+	    done (cmd);
+	    return (0);
+#endif
 	  };
             
     }
@@ -1041,71 +1276,73 @@
 	printk(KERN_INFO "DC390: Ignore target %02x lun %02x\n",
 		cmd->target, cmd->lun); 
 	DC390_UNLOCK_ACB;
-	done(cmd);
-	return(0);
+	//return (1);
+	done (cmd);
+	return (0);
     }
     else
     {
-	pDCB = dc390_findDCB (pACB, cmd);
+	pDCB = dc390_findDCB (pACB, cmd->target, cmd->lun);
 	if (!pDCB)
 	 {  /* should never happen */
+	    printk (KERN_ERR "DC390: no DCB failed, target %02x lun %02x\n", 
+		    cmd->target, cmd->lun);
 	    DC390_UNLOCK_ACB;
-	    done(cmd);
-	    return(0);
+	    printk ("DC390: No DCB in queuecommand (2)!\n");
+#ifdef USE_NEW_EH
+	    return (1);
+#else
+	    done (cmd);
+	    return (0);
+#endif
 	 };
     }
 
     pACB->Cmds++;
     cmd->scsi_done = done;
     cmd->result = 0;
+	
+    dc390_Query_to_Waiting (pACB);
 
-    if( pDCB->QIORBCnt ) /* Unsent commands ? */
+    if( pACB->QueryCnt ) /* Unsent commands ? */
     {
-	dc390_QLinkcmd( cmd, pDCB );
-	pcmd = dc390_Getcmd( pDCB ); /* Get first command */
-        pACB->CmdInQ++;
+	DEBUG0(printk ("DC390: QueryCnt != 0\n");)
+	dc390_Query_append ( cmd, pACB );
+	dc390_Waiting_process (pACB);
     }
-    else
-	pcmd = cmd;
-
-    pSRB = dc390_GetSRB( pACB );
-
-    if( !pSRB )
+    else if (pDCB->pWaitingSRB)
     {
-        dc390_QLinkcmd( pcmd, pDCB ); /* Queue command at the end */
-	pACB->CmdOutOfSRB++;
-	DC390_UNLOCK_ACB;
-	return(0);
+ 	pSRB = dc390_Free_get ( pACB );
+	DEBUG0(if (!pSRB) printk ("DC390: No free SRB but Waiting\n"); else printk ("DC390: Free SRB w/ Waiting\n");)
+	if (!pSRB) dc390_Query_append (cmd, pACB);
+	else 
+	  {
+	    dc390_BuildSRB (cmd, pDCB, pSRB);
+	    dc390_Waiting_append (pDCB, pSRB);
+	  }
+	dc390_Waiting_process (pACB);
     }
-
-    dc390_BuildSRB (pcmd, pDCB, pSRB);
-    dc390_SendSRB( pACB, pSRB );
+    else
+    {
+ 	pSRB = dc390_Free_get ( pACB );
+	DEBUG0(if (!pSRB) printk ("DC390: No free SRB w/o Waiting\n"); else printk ("DC390: Free SRB w/o Waiting\n");)
+	if (!pSRB)
+	{
+	    dc390_Query_append (cmd, pACB);
+	    dc390_Waiting_process (pACB);
+	}
+	else 
+	{
+	    dc390_BuildSRB (cmd, pDCB, pSRB);
+	    dc390_SendSRB (pACB, pSRB);
+	};
+    };
 
     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);
 }
 
-
-static void dc390_DoNextCmd( PACB pACB, PDCB pDCB )
-{
-    Scsi_Cmnd *pcmd;
-    PSRB   pSRB;
-
-    if( pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV) )
-	return;
-
-    pcmd = dc390_Getcmd( pDCB );
-    pSRB = dc390_GetSRB( pACB );
-    if( !pSRB )
-	dc390_QLinkcmd( pcmd, pDCB );
-    else
-      {
-	dc390_BuildSRB (pcmd, pDCB, pSRB);
-	dc390_SendSRB( pACB, pSRB );
-      };
-}
-
 /* We ignore mapping problems, as we expect everybody to respect 
  * valid partition tables. Waiting for complaints ;-) */
 
@@ -1242,15 +1479,17 @@
 void dc390_dumpinfo (PACB pACB, PDCB pDCB, PSRB pSRB)
 {
     USHORT pstat; PDEVDECL1;
+    if (!pDCB) pDCB = pACB->pActiveDCB;
+    if (!pSRB && pDCB) pSRB = pDCB->pActiveSRB;
 
     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",
@@ -1260,6 +1499,12 @@
 	    DC390_read8(INT_Status), DC390_read8(Current_Fifo), DC390_read8(CtrlReg1),
 	    DC390_read8(CtrlReg2), DC390_read8(CtrlReg3), DC390_read8(CtrlReg4));
     DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT);
+    if (DC390_read8(Current_Fifo) & 0x1f)
+      {
+	printk ("DC390: FIFO:");
+	while (DC390_read8(Current_Fifo) & 0x1f) printk (" %02x", DC390_read8(ScsiFifo));
+	printk ("\n");
+      };
     printk ("DC390: Register dump: DMA engine:\n");
     printk ("DC390: Cmd   STrCnt    SBusA    WrkBC    WrkAC Stat SBusCtrl\n");
     printk ("DC390:  %02x %08x %08x %08x %08x   %02x %08x\n",
@@ -1289,44 +1534,40 @@
 {
     PDCB  pDCB;
     PSRB  pSRB, psrb;
-    ULONG count, i;
-    PSCSICMD  pcmd, pcmd1;
+    UINT  count, i;
+    PSCSICMD  pcmd;
     int   status;
-    ULONG sbac;
+    //ULONG sbac;
     DC390_AFLAGS
     PACB  pACB = (PACB) cmd->host->hostdata;
 
     DC390_LOCK_ACB;
 
-    pDCB = dc390_findDCB (pACB, cmd);
-    /* abort() is too buggy at the moment. If it's called we are in trouble anyway.
-     * so let's dump some info into the syslog at least. (KG, 98/08/20) */
-    if (pDCB) pSRB = pDCB->pActiveSRB; else pSRB = 0;
-    printk ("DC390: Abort command (pid %li, DCB %p, SRB %p)\n",
-	    cmd->pid, pDCB, pSRB);
-    dc390_dumpinfo (pACB, pDCB, pSRB);
-
-    if( !pDCB ) goto  NOT_RUN;
+    printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n",
+	    cmd->pid, cmd->target, cmd->lun);
 
-    if( pDCB->QIORBCnt )
+    /* First scan Query list */
+    if( pACB->QueryCnt )
     {
-	pcmd = pDCB->pQIORBhead;
+	pcmd = pACB->pQueryHead;
 	if( pcmd == cmd )
 	{
-	    pDCB->pQIORBhead = pcmd->next;
+	    /* Found: Dequeue */
+	    pACB->pQueryHead = pcmd->next;
 	    pcmd->next = NULL;
-	    pDCB->QIORBCnt--;
+	    if (cmd == pACB->pQueryTail) pACB->pQueryTail = NULL;
+	    pACB->QueryCnt--;
 	    status = SCSI_ABORT_SUCCESS;
 	    goto  ABO_X;
 	}
-	for( count = pDCB->QIORBCnt, i=0; i<count-1; i++)
+	for( count = pACB->QueryCnt, i=0; i<count-1; i++)
 	{
 	    if( pcmd->next == cmd )
 	    {
-		pcmd1 = pcmd->next;
-		pcmd->next = pcmd1->next;
-		pcmd1->next = NULL;
-		pDCB->QIORBCnt--;
+		pcmd->next = cmd->next;
+		cmd->next = NULL;
+		if (cmd == pACB->pQueryTail) pACB->pQueryTail = NULL;
+		pACB->QueryCnt--;
 		status = SCSI_ABORT_SUCCESS;
 		goto  ABO_X;
 	    }
@@ -1337,14 +1578,21 @@
 	}
     }
 	
+    pDCB = dc390_findDCB (pACB, cmd->target, cmd->lun);
+    if( !pDCB ) goto  NOT_RUN;
+
     /* Added 98/07/02 KG */
+    /*
     pSRB = pDCB->pActiveSRB;
     if (pSRB && pSRB->pcmd == cmd )
 	goto ON_GOING;
-	
+     */
+    
     pSRB = pDCB->pWaitingSRB;
     if( !pSRB )
 	goto  ON_GOING;
+
+    /* Now scan Waiting queue */
     if( pSRB->pcmd == cmd )
     {
 	pDCB->pWaitingSRB = pSRB->pNextSRB;
@@ -1364,16 +1612,21 @@
 	pSRB = psrb->pNextSRB;
 	psrb->pNextSRB = pSRB->pNextSRB;
 	if( pSRB == pDCB->pWaitLast )
-	    pDCB->pWaitLast = psrb; /* No check for psrb == NULL ? */
+	    pDCB->pWaitLast = psrb;
 IN_WAIT:
-	pSRB->pNextSRB = pACB->pFreeSRB;
-	pACB->pFreeSRB = pSRB;
+	dc390_Free_insert (pACB, pSRB);
+	pDCB->WaitSRBCnt--;
 	cmd->next = NULL;
 	status = SCSI_ABORT_SUCCESS;
 	goto  ABO_X;
     }
 
+    /* SRB has already been sent ! */
 ON_GOING:
+    /* abort() is too stupid for already sent commands at the moment. 
+     * If it's called we are in trouble anyway, so let's dump some info 
+     * into the syslog at least. (KG, 98/08/20,99/06/20) */
+    dc390_dumpinfo (pACB, pDCB, pSRB);
     pSRB = pDCB->pGoingSRB;
     pDCB->DCBFlag |= ABORT_DEV_;
     /* Now for the hard part: The command is currently processed */
@@ -1404,12 +1657,13 @@
 ABO_X:
     cmd->result = DID_ABORT << 16;
     printk(KERN_INFO "DC390: Aborted pid %li with status %i\n", cmd->pid, status);
+#if 0
     if (cmd->pid == dc390_lastabortedpid) /* repeated failure ? */
 	{
 		/* Let's do something to help the bus getting clean again */
 		DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
 		DC390_write8 (ScsiCmd, DMA_COMMAND);
-			//DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
+		//DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
 		//DC390_write8 (ScsiCmd, RESET_ATN_CMD);
 		DC390_write8 (ScsiCmd, NOP_CMD);
 		//udelay (10000);
@@ -1434,10 +1688,13 @@
 	sbac = DC390_read32 (DMA_ScsiBusCtrl);
 	printk ("%08lx\n", sbac);
     };
+#endif
     dc390_lastabortedpid = cmd->pid;
     DC390_UNLOCK_ACB;
     //do_DC390_Interrupt (pACB->IRQLevel, 0, 0);
-    cmd->scsi_done(cmd);
+#ifndef USE_NEW_EH	
+    if (status == SCSI_ABORT_SUCCESS) cmd->scsi_done(cmd);
+#endif	
     return( status );
 }
 
@@ -1454,20 +1711,24 @@
 	pDCB->SyncMode &= ~SYNC_NEGO_DONE;
 	pDCB->SyncPeriod = 0;
 	pDCB->SyncOffset = 0;
+	pDCB->TagMask = 0;
 	pDCB->CtrlR3 = FAST_CLK;
 	pDCB->CtrlR4 &= NEGATE_REQACKDATA | CTRL4_RESERVED | NEGATE_REQACK;
 	pDCB->CtrlR4 |= pACB->glitch_cfg;
 	pDCB = pDCB->pNextDCB;
     }
     while( pdcb != pDCB );
-}
+    pACB->ACBFlag &= ~(RESET_DEV | RESET_DONE | RESET_DETECT);
 
+}
 
+#if 0
+/* Moves all SRBs from Going to Waiting for all DCBs */
 static void dc390_RecoverSRB( PACB pACB )
 {
     PDCB   pDCB, pdcb;
     PSRB   psrb, psrb2;
-    ULONG  cnt, i;
+    UINT   cnt, i;
 
     pDCB = pACB->pLinkDCB;
     if( !pDCB ) return;
@@ -1499,7 +1760,7 @@
 	pdcb = pdcb->pNextDCB;
     } while( pdcb != pDCB );
 }
-
+#endif
 
 /***********************************************************************
  * Function : int DC390_reset (Scsi_Cmnd *cmd, ...)
@@ -1507,34 +1768,37 @@
  * Purpose : perform a hard reset on the SCSI bus
  *
  * Inputs : cmd - command which caused the SCSI RESET
+ *	    resetFlags - how hard to try
  *
  * Returns : 0 on success.
  ***********************************************************************/
 
-int DC390_reset(Scsi_Cmnd *cmd, unsigned int resetFlags)
+int DC390_reset (Scsi_Cmnd *cmd, unsigned int resetFlags)
 {
     UCHAR   bval;
-    ULONG   i;
     DC390_AFLAGS
     PACB    pACB = (PACB) cmd->host->hostdata;
 
     printk(KERN_INFO "DC390: RESET ... ");
 
     DC390_LOCK_ACB;
+    if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
     bval = DC390_read8 (CtrlReg1);
     bval |= DIS_INT_ON_SCSI_RST;
-    DC390_write8 (CtrlReg1, bval);	/* disable interrupt */
+    DC390_write8 (CtrlReg1, bval);	/* disable IRQ on bus reset */
 
+    pACB->ACBFlag |= RESET_DEV;
     dc390_ResetSCSIBus( pACB );
-    /* Unlock ? */
-    for( i=0; i<600; i++ )
-	udelay(1000);
 
+    dc390_ResetDevParam( pACB );
+    udelay (1000);
+    pACB->pScsiHost->last_reset = jiffies + 3*HZ/2 
+		+ HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY];
+    
     DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
     DC390_read8 (INT_Status);		/* Reset Pending INT */
 
-    dc390_ResetDevParam( pACB );
-    dc390_DoingSRB_Done( pACB );
+    dc390_DoingSRB_Done( pACB, cmd );
     /* dc390_RecoverSRB (pACB); */
     pACB->pActiveDCB = NULL;
 
@@ -1543,10 +1807,10 @@
     bval &= ~DIS_INT_ON_SCSI_RST;
     DC390_write8 (CtrlReg1, bval);	/* re-enable interrupt */
 
-    dc390_DoWaitingSRB( pACB );
+    dc390_Waiting_process( pACB );
 
-    DC390_UNLOCK_ACB;
     printk("done\n");
+    DC390_UNLOCK_ACB;
     return( SCSI_RESET_SUCCESS );
 }
 
@@ -1556,22 +1820,22 @@
 /***********************************************************************
  * Function : static void dc390_initDCB()
  *
- * Purpose :  initialize the internal structures for a given DCB
+ * Purpose :  initialize the internal structures for a DCB (to be malloced)
  *
- * Inputs : cmd - pointer to this scsi cmd request block structure
+ * Inputs : SCSI id and lun
  ***********************************************************************/
 
-void dc390_initDCB( PACB pACB, PDCB *ppDCB, PSCSICMD cmd )
+void dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun )
 {
     PEEprom	prom;
     UCHAR	index;
-    PDCB pDCB;
+    PDCB pDCB, pDCB2;
 
     pDCB = kmalloc (sizeof(DC390_DCB), GFP_ATOMIC);
-    DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): 0x%08x\n",	\
-	    cmd->target, cmd->lun, (int)pDCB);)
+    DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n"	\
+	    id, lun, pDCB);)
  
-    *ppDCB = pDCB;
+    *ppDCB = pDCB; pDCB2 = 0;
     if (!pDCB) return;
     if( pACB->DCBCnt == 0 )
     {
@@ -1585,37 +1849,58 @@
    
     pACB->DCBCnt++;
    
-    pACB->pLastDCB = pDCB;
     pDCB->pNextDCB = pACB->pLinkDCB;
+    pACB->pLastDCB = pDCB;
 
     pDCB->pDCBACB = pACB;
-    pDCB->QIORBCnt = 0;
-    pDCB->UnitSCSIID = cmd->target;
-    pDCB->UnitSCSILUN = cmd->lun;
+    pDCB->TargetID = id;
+    pDCB->TargetLUN = lun;
     pDCB->pWaitingSRB = NULL;
     pDCB->pGoingSRB = NULL;
     pDCB->GoingSRBCnt = 0;
+    pDCB->WaitSRBCnt = 0;
     pDCB->pActiveSRB = NULL;
     pDCB->TagMask = 0;
     pDCB->MaxCommand = 1;
     index = pACB->AdapterIndex;
     pDCB->DCBFlag = 0;
 
-    prom = (PEEprom) &dc390_eepromBuf[index][cmd->target << 2];
-    pDCB->DevMode = prom->EE_MODE1;
+    /* Is there a corresp. LUN==0 device ? */
+    if (lun != 0)
+	pDCB2 = dc390_findDCB (pACB, id, 0);
+    prom = (PEEprom) &dc390_eepromBuf[index][id << 2];
+    /* Some values are for all LUNs: Copy them */
+    /* In a clean way: We would have an own structure for a SCSI-ID */
+    if (pDCB2)
+    {
+      pDCB->DevMode = pDCB2->DevMode;
+      pDCB->SyncMode = pDCB2->SyncMode;
+      pDCB->SyncPeriod = pDCB2->SyncPeriod;
+      pDCB->SyncOffset = pDCB2->SyncOffset;
+      pDCB->NegoPeriod = pDCB2->NegoPeriod;
+      
+      pDCB->CtrlR3 = pDCB2->CtrlR3;
+      pDCB->CtrlR4 = pDCB2->CtrlR4;
+      pDCB->Inquiry7 = pDCB2->Inquiry7;
+    }
+    else
+    {		
+      pDCB->DevMode = prom->EE_MODE1;
+      pDCB->SyncMode = 0;
+      pDCB->SyncPeriod = 0;
+      pDCB->SyncOffset = 0;
+      pDCB->NegoPeriod = (dc390_clock_period1[prom->EE_SPEED] * 25) >> 2;
+            
+      pDCB->CtrlR3 = FAST_CLK;
+      
+      pDCB->CtrlR4 = pACB->glitch_cfg | CTRL4_RESERVED;
+      if( dc390_eepromBuf[index][EE_MODE2] & ACTIVE_NEGATION)
+	pDCB->CtrlR4 |= NEGATE_REQACKDATA | NEGATE_REQACK;
+      pDCB->Inquiry7 = 0;
+    }
 
-    pDCB->SyncMode = 0;
+    pACB->DCBmap[id] |= (1 << lun);
     dc390_updateDCB(pACB, pDCB);
-
-    pDCB->SyncPeriod = 0;
-    pDCB->SyncOffset = 0;
-    pDCB->NegoPeriod = (dc390_clock_period1[prom->EE_SPEED] * 25) >> 2;
-
-    pDCB->CtrlR3 = FAST_CLK;
-
-    pDCB->CtrlR4 = pACB->glitch_cfg | CTRL4_RESERVED;
-    if( dc390_eepromBuf[index][EE_MODE2] & ACTIVE_NEGATION)
-	pDCB->CtrlR4 |= NEGATE_REQACKDATA | NEGATE_REQACK;
 }
 
 /***********************************************************************
@@ -1626,24 +1911,26 @@
 
 void dc390_updateDCB (PACB pACB, PDCB pDCB)
 {
-  pDCB->IdentifyMsg = IDENTIFY (pDCB->DevMode & EN_DISCONNECT_, pDCB->UnitSCSILUN);
-  
-  if (pDCB->DevMode & TAG_QUEUEING_) pDCB->SyncMode &= EN_TAG_QUEUEING | SYNC_NEGO_DONE | EN_ATN_STOP;
-  else pDCB->SyncMode &= SYNC_NEGO_DONE | EN_ATN_STOP;
-  
-  if( pDCB->DevMode & SYNC_NEGO_ && (!(pDCB->UnitSCSILUN) || dc390_CurrSyncOffset) )
-     pDCB->SyncMode |= SYNC_ENABLE;
-  else
-     {
+  pDCB->SyncMode &= EN_TAG_QUEUEING | SYNC_NEGO_DONE /*| EN_ATN_STOP*/;
+  if (pDCB->DevMode & TAG_QUEUEING_) {
+	//if (pDCB->SyncMode & EN_TAG_QUEUEING) pDCB->MaxCommand = pACB->TagMaxNum;
+  } else {
+	pDCB->SyncMode &= ~EN_TAG_QUEUEING;
+	pDCB->MaxCommand = 1;
+  };
+
+  if( pDCB->DevMode & SYNC_NEGO_ )
+	pDCB->SyncMode |= SYNC_ENABLE;
+  else {
 	pDCB->SyncMode &= ~(SYNC_NEGO_DONE | SYNC_ENABLE);
 	pDCB->SyncOffset &= ~0x0f;
-     };
-   
-  if (! (pDCB->DevMode & EN_DISCONNECT_)) pDCB->SyncMode &= ~EN_ATN_STOP; 
-  
+  };
+
+  //if (! (pDCB->DevMode & EN_DISCONNECT_)) pDCB->SyncMode &= ~EN_ATN_STOP; 
+
   pDCB->CtrlR1 = pACB->pScsiHost->this_id;
   if( pDCB->DevMode & PARITY_CHK_ )
-    pDCB->CtrlR1 |= PARITY_ERR_REPO;
+	pDCB->CtrlR1 |= PARITY_ERR_REPO;
 };  
 
 
@@ -1657,7 +1944,7 @@
 {
   int i;
   PDCB pDCB = pACB->pLinkDCB;
-  for (i = 0; i < pACB->DeviceCnt; i++)
+  for (i = 0; i < pACB->DCBCnt; i++)
     {
       dc390_updateDCB (pACB, pDCB);
       pDCB = pDCB->pNextDCB;
@@ -1681,12 +1968,12 @@
 
 void dc390_linkSRB( PACB pACB )
 {
-    ULONG   count, i;
+    UINT   count, i;
 
     count = pACB->SRBCount;
-    for( i=0; i< count; i++)
+    for( i=0; i<count; i++)
     {
-	if( i != count - 1)
+	if( i != count-1 )
 	    pACB->SRB_array[i].pNextSRB = &pACB->SRB_array[i+1];
 	else
 	    pACB->SRB_array[i].pNextSRB = NULL;
@@ -1716,7 +2003,15 @@
     psh->io_port = io_port;
     psh->n_io_port = 0x80;
     psh->irq = Irq;
-
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,50)
+    psh->base = io_port;
+#else
+    psh->base = (char*)io_port;
+#endif	
+    psh->unique_id = io_port;
+    psh->dma_channel = -1;
+    psh->last_reset = jiffies;
+	
     pACB = (PACB) psh->hostdata;
     DC390_LOCKA_INIT;
     DC390_LOCK_ACB;
@@ -1741,6 +2036,8 @@
     pACB->pActiveDCB = NULL;
     pACB->pFreeSRB = pACB->SRB_array;
     pACB->SRBCount = MAX_SRB_CNT;
+    pACB->QueryCnt = 0;
+    pACB->pQueryHead = NULL;
     pACB->AdapterIndex = index;
     pACB->status = 0;
     psh->this_id = dc390_eepromBuf[index][EE_ADAPT_SCSI_ID];
@@ -1759,7 +2056,9 @@
 	pACB->DCBmap[i] = 0;
     pACB->sel_timeout = SEL_TIMEOUT;
     pACB->glitch_cfg = EATER_25NS;
-    pACB->Cmds = pACB->CmdInQ = pACB->CmdOutOfSRB = pACB->SelLost = 0;
+    pACB->Cmds = pACB->CmdInQ = pACB->CmdOutOfSRB = 0;
+    pACB->SelLost = pACB->SelConn = 0;
+    init_timer (&pACB->Waiting_Timer);
 }
 
 
@@ -1777,22 +2076,11 @@
 int __init dc390_initAdapter (PSH psh, ULONG io_port, UCHAR Irq, UCHAR index)
 {
     PACB   pACB, pACB2;
-    UCHAR  used_irq = 0, dstate;
+    UCHAR  dstate;
     int    i;
     
     pACB = (PACB) psh->hostdata;
     
-    for ( pACB2 = dc390_pACB_start; pACB2 ; )
-      {
-	if( pACB2->IRQLevel == Irq )
-	  {
-	    used_irq = 1;
-	    break;
-	  }
-	else
-	  pACB2 = pACB2->pNextACB;
-      }
-
     if (check_region (io_port, psh->n_io_port))
 	{
 	    printk(KERN_ERR "DC390: register IO ports error!\n");
@@ -1803,14 +2091,12 @@
 
     DC390_read8_ (INT_Status, io_port);		/* Reset Pending INT */
 
-    if( !used_irq )
-    {
-	if( (i = request_irq(Irq, do_DC390_Interrupt, DC390_IRQ, "tmscsim", NULL) ))
-	    {
-		    printk(KERN_ERR "DC390: register IRQ error!\n");
-		    return( -1 );
-	    }
-    }
+    if( (i = request_irq(Irq, do_DC390_Interrupt, DC390_IRQ, "tmscsim", pACB) ))
+      {
+	printk(KERN_ERR "DC390: register IRQ error!\n");
+	release_region (io_port, psh->n_io_port);
+	return( -1 );
+      }
 
     if( !dc390_pACB_start )
       {
@@ -1832,9 +2118,13 @@
     if (pACB->Gmode2 & RST_SCSI_BUS)
     {
 	dc390_ResetSCSIBus( pACB );
-	/* Unlock before ? */
-	for( i=0; i<600; i++ )
+	udelay (1000);
+	pACB->pScsiHost->last_reset = jiffies + HZ/2
+		    + HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY];
+	/*
+	for( i=0; i<(500 + 1000*dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY]); i++ )
 		udelay(1000);
+	 */
     };
     pACB->ACBFlag = 0;
     DC390_read8 (INT_Status);				/* Reset Pending INT */
@@ -1846,6 +2136,7 @@
     DC390_write8 (CtrlReg3, FAST_CLK);			/* fast clock */
     DC390_write8 (CtrlReg4, pACB->glitch_cfg |			/* glitch eater */
 		(dc390_eepromBuf[index][EE_MODE2] & ACTIVE_NEGATION) ? NEGATE_REQACKDATA : 0);	/* Negation */
+    DC390_write8 (CtcReg_High, 0);			/* Clear Transfer Count High: ID */
     DC390_write8 (DMA_Cmd, DMA_IDLE_CMD);
     DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
     DC390_write32 (DMA_ScsiBusCtrl, EN_INT_ON_PCI_ABORT);
@@ -1885,18 +2176,24 @@
 	printk (KERN_ERR "DC390_init: No EEPROM found!\n");
 	return( -1 );
 #else
-	int period;
-	printk (KERN_INFO "DC390_init: No EEPROM found!\n");
-	printk (KERN_INFO "DC390_init: Trying default EEPROM settings:\n");
-	dc390_checkparams ();
-	period = dc390_clock_period1[tmscsim[1]];
+	int speed;
+	dc390_adapname = "AM53C974";
+	printk (KERN_INFO "DC390_init: No EEPROM found! Trying default settings ...\n");
+	dc390_check_for_safe_settings ();
+	dc390_fill_with_defaults ();
+	dc390_EEprom_Override (index);
+	speed = dc390_clock_speed[tmscsim[1]];
 	printk (KERN_INFO "DC390: Used defaults: AdaptID=%i, SpeedIdx=%i (%i.%i MHz),"
-		" DevMode=0x%02x, AdaptMode=0x%02x, TaggedCmnds=%i (%i)\n", tmscsim[0], tmscsim[1],
-		40 / period, ((40%period)*10 + period/2) / period,
-		(UCHAR)tmscsim[2], (UCHAR)tmscsim[3], tmscsim[4], 2 << (tmscsim[4]));
-	dc390_EEpromDefaults (index);
+		" DevMode=0x%02x, AdaptMode=0x%02x, TaggedCmnds=%i (%i), DelayReset=%is\n", 
+		tmscsim[0], tmscsim[1], speed/10, speed%10,
+		(UCHAR)tmscsim[2], (UCHAR)tmscsim[3], tmscsim[4], 2 << (tmscsim[4]), tmscsim[5]);
 #endif
-    };
+    }
+    else
+    {
+	dc390_check_for_safe_settings ();
+	dc390_EEprom_Override (index);
+    }
    
     psh = scsi_register( psht, sizeof(DC390_ACB) );
     if( !psh ) return( -1 );
@@ -2000,7 +2297,8 @@
     PDEVDECL0;
     UCHAR   irq;
     UINT    io_port;
-    DC390_IFLAGS DC390_DFLAGS
+    //DC390_IFLAGS
+    DC390_DFLAGS
 
     DC390_LOCK_DRV;
     //dc390_pSHT_start = psht;
@@ -2009,7 +2307,11 @@
     if ( PCI_PRESENT )
 	while (PCI_FIND_DEVICE (PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD53C974))
 	{
-	    DC390_LOCK_IO;		/* Remove this when going to new eh */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30)
+	    if (pci_enable_device (pdev))
+		continue;
+#endif
+	    //DC390_LOCK_IO;		/* Remove this when going to new eh */
 	    PCI_GET_IO_AND_IRQ;
 	    DEBUG0(printk(KERN_INFO "DC390(%i): IO_PORT=%04x,IRQ=%x\n", dc390_adapterCnt, (UINT) io_port, irq);)
 
@@ -2019,14 +2321,17 @@
 		dc390_set_pci_cfg (PDEV);
 		dc390_adapterCnt++;
 	    };
-	    DC390_UNLOCK_IO;		/* Remove when going to new eh */
+	    //DC390_UNLOCK_IO;		/* Remove when going to new eh */
 	}
     else
 	printk (KERN_ERR "DC390: No PCI BIOS found!\n");
    
     if (dc390_adapterCnt)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
+	psht->proc_name = "tmscsim";
+#else
 	psht->proc_dir = &DC390_proc_scsi_tmscsim;
-
+#endif
     printk(KERN_INFO "DC390: %i adapters found\n", dc390_adapterCnt);
     DC390_UNLOCK_DRV;
     return( dc390_adapterCnt );
@@ -2048,7 +2353,7 @@
    if (cmd->result)
    {
 	PACB pACB = (PACB)cmd->host->hostdata;
-	PDCB pDCB = dc390_findDCB (pACB, cmd);
+	PDCB pDCB = dc390_findDCB (pACB, cmd->target, cmd->lun);
 	printk ("DC390: Unsetting DsCn, Sync and TagQ!\n");
 	if (pDCB)
 	{
@@ -2056,7 +2361,6 @@
 		dc390_updateDCB (pACB, pDCB);
 	};
    };
-   kfree (cmd->buffer);
    kfree (cmd);
 };
 
@@ -2064,20 +2368,21 @@
 {
    char* buffer;
    Scsi_Cmnd* cmd;
-   buffer = kmalloc (256, GFP_ATOMIC);
-   cmd = kmalloc (sizeof (Scsi_Cmnd), GFP_ATOMIC);
+   cmd = kmalloc (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC);
+   if (!cmd) { printk ("DC390: kmalloc failed in inquiry!\n"); return; };
+   buffer = (char*)cmd + sizeof(Scsi_Cmnd);
 
-   memset (buffer, 0, 256);
-   memset (cmd, 0, sizeof(Scsi_Cmnd));
+   memset (cmd, 0, sizeof(Scsi_Cmnd) + 256);
    cmd->cmnd[0] = INQUIRY;
-   cmd->cmnd[1] = (pDCB->UnitSCSILUN << 5) & 0xe0;
+   cmd->cmnd[1] = (pDCB->TargetLUN << 5) & 0xe0;
    cmd->cmnd[4] = 0xff;
    
    cmd->cmd_len = 6; cmd->old_cmd_len = 6;
    cmd->host = pACB->pScsiHost;
-   cmd->target = pDCB->UnitSCSIID;
-   cmd->lun = pDCB->UnitSCSILUN; 
+   cmd->target = pDCB->TargetID;
+   cmd->lun = pDCB->TargetLUN; 
    cmd->serial_number = 1;
+   cmd->pid = 390;
    cmd->bufflen = 128;
    cmd->buffer = buffer;
    cmd->request_bufflen = 128;
@@ -2088,11 +2393,62 @@
 
    cmd->request.rq_status = RQ_SCSI_BUSY;
 
+   pDCB->SyncMode &= ~SYNC_NEGO_DONE;
    printk (KERN_INFO "DC390: Queue INQUIRY command to dev ID %02x LUN %02x\n",
-	   pDCB->UnitSCSIID, pDCB->UnitSCSILUN);
+	   pDCB->TargetID, pDCB->TargetLUN);
    DC390_queue_command (cmd, dc390_inquiry_done);
 };
 
+/***********************************************************************
+ * Functions: dc390_sendstart(), dc390_sendstart_done()
+ *
+ * Purpose: When changing speed etc., we have to issue an INQUIRY
+ *	    command to make sure, we agree upon the nego parameters
+ *	    with the device
+ ***********************************************************************/
+
+static void dc390_sendstart_done (Scsi_Cmnd* cmd)
+{
+   printk (KERN_INFO "DC390: SENDSTART (ID %02x LUN %02x) returned %08x\n",
+	   cmd->target, cmd->lun, cmd->result);
+   kfree (cmd);
+};
+
+void dc390_sendstart (PACB pACB, PDCB pDCB)
+{
+   char* buffer;
+   Scsi_Cmnd* cmd;
+   cmd = kmalloc (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC);
+   if (!cmd) { printk ("DC390: kmalloc failed in sendstart!\n"); return; };
+   buffer = (char*)cmd + sizeof(Scsi_Cmnd);
+
+   memset (cmd, 0, sizeof(Scsi_Cmnd) + 256);
+   cmd->cmnd[0] = 0x1b; /* START_STOP_UNIT */
+   cmd->cmnd[1] = (pDCB->TargetLUN << 5) & 0xe0;
+   cmd->cmnd[4] = 0x01; /* START */
+   
+   cmd->cmd_len = 6; cmd->old_cmd_len = 6;
+   cmd->host = pACB->pScsiHost;
+   cmd->target = pDCB->TargetID;
+   cmd->lun = pDCB->TargetLUN; 
+   cmd->serial_number = 1;
+   cmd->pid = 310;
+   cmd->bufflen = 128;
+   cmd->buffer = buffer;
+   cmd->request_bufflen = 128;
+   cmd->request_buffer = &buffer[128];
+   cmd->done = dc390_sendstart_done;
+   cmd->scsi_done = dc390_sendstart_done;
+   cmd->timeout_per_command = 5*HZ;
+
+   cmd->request.rq_status = RQ_SCSI_BUSY;
+
+   pDCB->SyncMode &= ~SYNC_NEGO_DONE;
+   printk (KERN_INFO "DC390: Queue SEND_START command to dev ID %02x LUN %02x\n",
+	   pDCB->TargetID, pDCB->TargetLUN);
+   DC390_queue_command (cmd, dc390_sendstart_done);
+};
+
 /********************************************************************
  * Function: dc390_set_info()
  *
@@ -2210,6 +2566,9 @@
   if (!memcmp (pos, "RESET", 5)) goto reset;
   else if (!memcmp (pos, "INQUIRY", 7)) goto inquiry;
   else if (!memcmp (pos, "REMOVE", 6)) goto remove;
+  else if (!memcmp (pos, "ADD", 3)) goto add;
+  else if (!memcmp (pos, "START", 5)) goto start;
+  else if (!memcmp (pos, "DUMP", 4)) goto dump;
   
   if (isdigit (*pos))
     {
@@ -2226,13 +2585,20 @@
       pDCB = pACB->pLinkDCB;
       for (dum = 0; dum < dev; dum++) pDCB = pDCB->pNextDCB;
       /* Sanity Check */
-      if (pDCB->UnitSCSIID != id || pDCB->UnitSCSILUN != lun) 
+      if (pDCB->TargetID != id || pDCB->TargetLUN != lun) 
 	 {
 	    printk (KERN_ERR "DC390: no such device: Idx=%02i ID=%02i LUN=%02i\n",
 		    dev, id, lun);
 	    goto einv2;
 	 };
 
+      if (pDCB->pWaitingSRB || pDCB->pGoingSRB)
+      {
+	  printk ("DC390: Cannot change dev (%i-%i) cfg: Pending requests\n",
+		  pDCB->TargetID, pDCB->TargetLUN);
+	  goto einv;
+      };
+	  
       olddevmode = pDCB->DevMode;
       YESNO (pos, pDCB->DevMode, PARITY_CHK_);
       needs_inquiry++;
@@ -2245,8 +2611,7 @@
       needs_inquiry++;
       YESNO (pos, pDCB->DevMode, TAG_QUEUEING_);
       if ((olddevmode & TAG_QUEUEING_) == (pDCB->DevMode & TAG_QUEUEING_)) needs_inquiry--;
-      YESNO (pos, pDCB->SyncMode, EN_ATN_STOP);
-      
+
       dc390_updateDCB (pACB, pDCB);
       if (!pos) goto ok;
        
@@ -2266,7 +2631,7 @@
       else pos = strtok (0, " \t\n:=,;.");
       if (!pos) goto ok;
       
-      /* Speed: NegoPeriod */
+      /* Sync Speed in MHz */
       if (*pos != '-')
 	{
 	  SCANF (pos, p0, dum, 1, 13); 
@@ -2281,11 +2646,11 @@
 		for (; p0-pos > 1; p0--) dum /= 10;
 		pDCB->NegoPeriod = (100000/(100*dumold + dum)) >> 2;
 		if (pDCB->NegoPeriod < 19) pDCB->NegoPeriod = 19;
-		if (pDCB->NegoPeriod != olddevmode) needs_inquiry++;
 		pos = strtok (0, " \t\n:=,;");
 		if (!pos) goto ok;
 	     };
 	  if (*pos == 'M') pos = strtok (0, " \t\n:=,;");
+	  if (pDCB->NegoPeriod != olddevmode) needs_inquiry++;
 	}
       else pos = strtok (0, " \t\n:=,;");
       /* dc390_updateDCB (pACB, pDCB); */
@@ -2300,28 +2665,49 @@
 	  if (pDCB->SyncOffset > olddevmode) needs_inquiry++;
 	}
       else pos = strtok (0, " \t\n:=,;");
+      if (!pos) goto ok;
       dc390_updateDCB (pACB, pDCB);
+
+      //olddevmode = pDCB->MaxCommand;
+      /* MaxCommand (Tags) */
+      if (*pos != '-')
+	{
+	  SCANF (pos, p0, dum, 1, 32 /*pACB->TagMaxNum*/);
+	  if (pDCB->SyncMode & EN_TAG_QUEUEING)
+		pDCB->MaxCommand = dum;
+	  else printk (KERN_INFO "DC390: Can't set MaxCmd larger than one without Tag Queueing!\n");
+	}
+      else pos = strtok (0, " \t\n:=,;");
+
     }
   else
     {
-      char* p1 = pos; UCHAR dum;
+      char* p1 = pos; UCHAR dum, newadaptid;
       PARSEDEBUG(printk (KERN_INFO "DC390: chg adapt cfg \"%s\"\n", prstr (pos, &buffer[length]));)
       dum = GLITCH_TO_NS (pACB->glitch_cfg);
       /* Adapter setting */
       SEARCH (pos, p0, pACB->pScsiHost->max_id, "MAXID", 8); 
       SEARCH (pos, p0, pACB->pScsiHost->max_lun, "MAXLUN", 8); 
-      SEARCH (pos, p0, pACB->pScsiHost->this_id, "ADAPTERID", 7); 
+      SEARCH (pos, p0, newadaptid, "ADAPTERID", 7);
       SEARCH (pos, p0, pACB->TagMaxNum, "TAGMAXNUM", 32);
       SEARCH (pos, p0, pACB->ACBFlag, "ACBFLAG", 255);
       SEARCH3 (pos, p0, dum, "GLITCHEATER", 40, 1000, "NS");
       SEARCH3 (pos, p0, pACB->sel_timeout, "SELTIMEOUT", 400, 163, "MS");
+      SEARCH3 (pos, p0, dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY], "DELAYRESET", 180, 100, "S");
     ok2:
       pACB->glitch_cfg = NS_TO_GLITCH (dum);
       if (pACB->sel_timeout < 60) pACB->sel_timeout = 60;
-      dum = 0; while (1 << dum <= pACB->TagMaxNum) dum ++;
-      pACB->TagMaxNum &= (1 << --dum);
-      if (pos == p1) goto einv;
+      DC390_write8 (Scsi_TimeOut, pACB->sel_timeout);
+      if (newadaptid != pACB->pScsiHost->this_id)
+      {
+	pACB->pScsiHost->this_id = newadaptid;
+	dc390_ResetDevParam (pACB);
+      }	    
+      //dum = 0; while (1 << dum <= pACB->TagMaxNum) dum ++;
+      //pACB->TagMaxNum &= (1 << --dum);
       dc390_updateDCBs (pACB);
+      // All devs should be INQUIRED now
+      if (pos == p1) goto einv;
     }
   if (pos) goto next;
       
@@ -2351,7 +2737,15 @@
 	DC390_UNLOCK_IO;
      };
   return (length);
-  
+
+ dump:
+     {
+	dc390_dumpinfo (pACB, 0, 0);
+	DC390_UNLOCK_ACB;
+	DC390_UNLOCK_IO;       
+     }
+  return (length);
+	
  inquiry:
      {
 	pos = strtok (0, " \t\n.:;="); if (!pos) goto einv;
@@ -2359,7 +2753,7 @@
 	if (dev >= pACB->DCBCnt) goto einv_dev;
 	for (dum = 0; dum < dev; dum++) pDCB = pDCB->pNextDCB;
 	printk (KERN_NOTICE " DC390: Issue INQUIRY command to Dev(Idx) %i SCSI ID %i LUN %i\n",
-		dev, pDCB->UnitSCSIID, pDCB->UnitSCSILUN);
+		dev, pDCB->TargetID, pDCB->TargetLUN);
 	DC390_UNLOCK_ACB;
 	dc390_inquiry (pACB, pDCB);
 	DC390_UNLOCK_IO;
@@ -2373,13 +2767,45 @@
 	if (dev >= pACB->DCBCnt) goto einv_dev;
 	for (dum = 0; dum < dev; dum++) pDCB = pDCB->pNextDCB;
 	printk (KERN_NOTICE " DC390: Remove DCB for Dev(Idx) %i SCSI ID %i LUN %i\n",
-		dev, pDCB->UnitSCSIID, pDCB->UnitSCSILUN);
+		dev, pDCB->TargetID, pDCB->TargetLUN);
+	/* TO DO: We should make sure no pending commands are left */
 	dc390_remove_dev (pACB, pDCB);
 	DC390_UNLOCK_ACB;
 	DC390_UNLOCK_IO;
      };
    return (length);
 
+ add:
+     {
+	int id, lun;
+	pos = strtok (0, " \t\n.:;=");
+	if (pos) { SCANF (pos, p0, id, 0, 7); } else goto einv;
+	if (pos) { SCANF (pos, p0, lun, 0, 7); } else goto einv;
+	pDCB = dc390_findDCB (pACB, id, lun);
+	if (pDCB) { printk ("DC390: ADD: Device already existing\n"); goto einv; };
+	dc390_initDCB (pACB, &pDCB, id, lun);
+	DC390_UNLOCK_ACB;
+	dc390_inquiry (pACB, pDCB);
+	DC390_UNLOCK_IO;
+     };
+   return (length);
+
+ start:
+     {
+	int id, lun;
+	pos = strtok (0, " \t\n.:;=");
+	if (pos) { SCANF (pos, p0, id, 0, 7); } else goto einv;
+	if (pos) { SCANF (pos, p0, lun, 0, 7); } else goto einv;
+	pDCB = dc390_findDCB (pACB, id, lun);
+	if (pDCB) printk ("DC390: SendStart: Device already existing ...\n");
+	else dc390_initDCB (pACB, &pDCB, id, lun);
+	DC390_UNLOCK_ACB;
+	dc390_sendstart (pACB, pDCB);
+	dc390_inquiry (pACB, pDCB);
+	DC390_UNLOCK_IO;
+     };
+   return (length);
+
  einv_dev:
    printk (KERN_WARNING "DC390: Ignore cmnd to illegal Dev(Idx) %i. Valid range: 0 - %i.\n", 
 	   dev, pACB->DCBCnt - 1);
@@ -2429,6 +2855,7 @@
   PSH shpnt;
   PACB pACB;
   PDCB pDCB;
+  PSCSICMD pcmd;
   DC390_AFLAGS
 
   pACB = dc390_pACB_start;
@@ -2454,46 +2881,87 @@
   SPRINTF("SCSI Host Nr %i, ", shpnt->host_no);
   SPRINTF("%s Adapter Nr %i\n", dc390_adapname, pACB->AdapterIndex);
   SPRINTF("IOPortBase 0x%04x, ", pACB->IOPortBase);
-  SPRINTF("IRQLevel 0x%02x\n", pACB->IRQLevel);
+  SPRINTF("IRQ %02i\n", pACB->IRQLevel);
 
   SPRINTF("MaxID %i, MaxLUN %i, ", shpnt->max_id, shpnt->max_lun);
-  SPRINTF("AdapterID %i, SelTimeout %i ms\n", 
-	  shpnt->this_id, (pACB->sel_timeout*164)/100);
+  SPRINTF("AdapterID %i, SelTimeout %i ms, DelayReset %i s\n", 
+	  shpnt->this_id, (pACB->sel_timeout*164)/100,
+	  dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY]);
 
-  SPRINTF("TagMaxNum %i, Status %i, ACBFlag %i, GlitchEater %i ns\n",
+  SPRINTF("TagMaxNum %i, Status 0x%02x, ACBFlag 0x%02x, GlitchEater %i ns\n",
 	  pACB->TagMaxNum, 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\n", pACB->SelLost);
+  SPRINTF("            Lost arbitrations %i, Sel. connected %i, Connected: %s\n", 
+	  pACB->SelLost, pACB->SelConn, pACB->Connected? "Yes": "No");
    
   SPRINTF("Nr of attached devices: %i, Nr of DCBs: %i\n", pACB->DeviceCnt, pACB->DCBCnt);
+  SPRINTF("Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+	  pACB->DCBmap[0], pACB->DCBmap[1], pACB->DCBmap[2], pACB->DCBmap[3], 
+	  pACB->DCBmap[4], pACB->DCBmap[5], pACB->DCBmap[6], pACB->DCBmap[7]);
 
-  SPRINTF("Idx ID LUN Prty Sync DsCn SndS TagQ STOP NegoPeriod SyncSpeed SyncOffs\n");
+  SPRINTF("Idx ID LUN Prty Sync DsCn SndS TagQ NegoPeriod SyncSpeed SyncOffs MaxCmd\n");
 
   pDCB = pACB->pLinkDCB;
   for (dev = 0; dev < pACB->DCBCnt; dev++)
      {
-      SPRINTF("%02i  %02i  %02i ", dev, pDCB->UnitSCSIID, pDCB->UnitSCSILUN);
+      SPRINTF("%02i  %02i  %02i ", dev, pDCB->TargetID, pDCB->TargetLUN);
       YESNO(pDCB->DevMode & PARITY_CHK_);
       YESNO(pDCB->SyncMode & SYNC_NEGO_DONE);
       YESNO(pDCB->DevMode & EN_DISCONNECT_);
-      //YESNO(pDCB->SyncMode & EN_ATN_STOP);
       YESNO(pDCB->DevMode & SEND_START_);
       YESNO(pDCB->SyncMode & EN_TAG_QUEUEING);
-      YESNO(pDCB->SyncMode & EN_ATN_STOP);
       if (pDCB->SyncOffset & 0x0f)
       {
 	 int sp = pDCB->SyncPeriod; if (! (pDCB->CtrlR3 & FAST_SCSI)) sp++;
 	 SPRINTF("  %03i ns ", (pDCB->NegoPeriod) << 2);
 	 spd = 40/(sp); spd1 = 40%(sp);
 	 spd1 = (spd1 * 10 + sp/2) / (sp);
-	 SPRINTF("   %2i.%1i M      %02i\n", spd, spd1, (pDCB->SyncOffset & 0x0f));
+	 SPRINTF("   %2i.%1i M      %02i", spd, spd1, (pDCB->SyncOffset & 0x0f));
       }
-      else SPRINTF(" (%03i ns)\n", (pDCB->NegoPeriod) << 2);
+      else SPRINTF(" (%03i ns)                 ", (pDCB->NegoPeriod) << 2);
       /* Add more info ...*/
+      SPRINTF ("      %02i\n", pDCB->MaxCommand);
       pDCB = pDCB->pNextDCB;
      }
+    SPRINTF ("Commands in Queues: Query: %li:", pACB->QueryCnt);
+    for (pcmd = pACB->pQueryHead; pcmd; pcmd = pcmd->next)
+	SPRINTF (" %li", pcmd->pid);
+    if (timer_pending(&pACB->Waiting_Timer)) SPRINTF ("Waiting queue timer running\n");
+    else SPRINTF ("\n");
+    pDCB = pACB->pLinkDCB;
+	
+    for (dev = 0; dev < pACB->DCBCnt; dev++)
+    {
+	PSRB pSRB;
+	if (pDCB->WaitSRBCnt) 
+		    SPRINTF ("DCB (%02i-%i): Waiting: %i:", pDCB->TargetID, pDCB->TargetLUN,
+			     pDCB->WaitSRBCnt);
+	for (pSRB = pDCB->pWaitingSRB; pSRB; pSRB = pSRB->pNextSRB)
+		SPRINTF(" %li", pSRB->pcmd->pid);
+	if (pDCB->GoingSRBCnt) 
+		    SPRINTF ("\nDCB (%02i-%i): Going  : %i:", pDCB->TargetID, pDCB->TargetLUN,
+			     pDCB->GoingSRBCnt);
+	for (pSRB = pDCB->pGoingSRB; pSRB; pSRB = pSRB->pNextSRB)
+#if 0 //def DC390_DEBUGTRACE
+		SPRINTF(" %s\n  ", pSRB->debugtrace);
+#else
+		SPRINTF(" %li", pSRB->pcmd->pid);
+#endif
+	if (pDCB->WaitSRBCnt || pDCB->GoingSRBCnt) SPRINTF ("\n");
+	pDCB = pDCB->pNextDCB;
+    }
+	
+#ifdef DC390_DEBUGDCB
+    SPRINTF ("DCB list for ACB %p:\n", pACB);
+    pDCB = pACB->pLinkDCB;
+    SPRINTF ("%p", pDCB);
+    for (dev = 0; dev < pACB->DCBCnt; dev++, pDCB=pDCB->pNextDCB)
+	SPRINTF ("->%p", pDCB->pNextDCB);
+    SPRINTF("\n");
+#endif
+  
 
   DC390_UNLOCK_ACB;
   *start = buffer + offset;
@@ -2528,13 +2996,14 @@
 
     printk(KERN_INFO "DC390: shutdown\n");
 
-    pACB->ACBFlag = RESET_DONE;
+    pACB->ACBFlag = RESET_DEV;
     bval = DC390_read8 (CtrlReg1);
     bval |= DIS_INT_ON_SCSI_RST;
     DC390_write8 (CtrlReg1, bval);	/* disable interrupt */
     if (pACB->Gmode2 & RST_SCSI_BUS)
 		dc390_ResetSCSIBus (pACB);
 
+    if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
     return( 0 );
 }
 
@@ -2548,41 +3017,30 @@
     do
     {
 	nDCB = pDCB->pNextDCB;
-	DCBDEBUG(printk (KERN_INFO "DC390: Free DCB (ID %i, LUN %i): 0x%08x\n",\
-		pDCB->UnitSCSIID, pDCB->UnitSCSILUN, (int)pDCB);)
-	kfree (pDCB);
+	DCBDEBUG(printk (KERN_INFO "DC390: Free DCB (ID %i, LUN %i): %p\n",\
+		pDCB->TargetID, pDCB->TargetLUN, pDCB);)
+	//kfree (pDCB);
+	dc390_remove_dev (pACB, pDCB);
 	pDCB = nDCB;
-    } while (pDCB && pDCB != pACB->pLinkDCB);
+    } while (pDCB && pACB->pLinkDCB);
 
 };
 
-int DC390_release(struct Scsi_Host *host)
+int DC390_release (struct Scsi_Host *host)
 {
-    int irq_count; 
-    PACB pACB;
     DC390_AFLAGS DC390_IFLAGS
-#if USE_SPINLOCKS > 1
     PACB pACB = (PACB)(host->hostdata);
-#endif
 
     DC390_LOCK_IO;
     DC390_LOCK_ACB;
 
+    /* TO DO: We should check for outstanding commands first. */
     dc390_shutdown (host);
 
     if (host->irq != IRQ_NONE)
     {
-	for (irq_count = 0, pACB = dc390_pACB_start; 
-	     pACB; pACB = pACB->pNextACB)
-	{
-	    if ( pACB->IRQLevel == host->irq )
-		++irq_count;
-	}
-	if (irq_count == 1)
-	 {
-	    DEBUG0(printk(KERN_INFO "DC390: Free IRQ %i\n",host->irq);)
-	    free_irq(host->irq,NULL);
-	 }
+	DEBUG0(printk(KERN_INFO "DC390: Free IRQ %i\n",host->irq);)
+	free_irq (host->irq, pACB);
     }
 
     release_region(host->io_port,host->n_io_port);
@@ -2591,7 +3049,12 @@
     DC390_UNLOCK_IO;
     return( 1 );
 }
+#endif /* def MODULE */
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,99)
+static Scsi_Host_Template driver_template = DC390_T;
+#include "scsi_module.c"
+#elif defined(MODULE)
 Scsi_Host_Template driver_template = DC390_T;
 #include "scsi_module.c"
-#endif /* def MODULE */
+#endif
diff -urN linux-2.2.19-pre3/drivers/scsi/tmscsim.h linux/drivers/scsi/tmscsim.h
--- linux-2.2.19-pre3/drivers/scsi/tmscsim.h	Fri Dec 25 16:41:39 1998
+++ linux/drivers/scsi/tmscsim.h	Mon Dec  3 20:54:39 2001
@@ -3,33 +3,47 @@
 ;*		    TEKRAM DC-390(T) PCI SCSI Bus Master Host Adapter  *
 ;*		    Device Driver				       *
 ;***********************************************************************/
-/* $Id: tmscsim.h,v 2.4 1998/12/25 17:33:27 garloff Exp $ */
+/* $Id: tmscsim.h,v 2.15.2.3 2000/11/17 20:52:27 garloff Exp $ */
 
 #ifndef _TMSCSIM_H
 #define _TMSCSIM_H
 
+#include <linux/types.h>
+#include <linux/config.h>
+/* 2.0 compat */
+#if defined(__SMP__) && !defined(CONFIG_SMP)
+# if LINUX_VERSION_CODE < KERNEL_VERSION (2,2,0)
+#  define CONFIG_SMP
+# else
+#  error __SMP__ defined but not CONFIG_SMP
+# endif
+#endif
+
+
 #define IRQ_NONE 255
 
 #define MAX_ADAPTER_NUM 	4
-#define MAX_SG_LIST_BUF 	16
-#define MAX_CMD_PER_LUN 	8
-#define MAX_CMD_QUEUE		2*MAX_CMD_PER_LUN+1	
+#define MAX_SG_LIST_BUF 	16	/* Not used */
+#define MAX_CMD_PER_LUN 	32
+#define MAX_CMD_QUEUE		MAX_CMD_PER_LUN+MAX_CMD_PER_LUN/2+1	
 #define MAX_SCSI_ID		8
 #define MAX_SRB_CNT		MAX_CMD_QUEUE+1	/* Max number of started commands */
-#define END_SCAN		2
 
 #define SEL_TIMEOUT		153	/* 250 ms selection timeout (@ 40 MHz) */
 
-typedef unsigned char	UCHAR;
-typedef unsigned short	USHORT;
-typedef unsigned long	ULONG;
-typedef unsigned int	UINT;
+#define END_SCAN		2
+
+typedef u8		UCHAR;	/*  8 bits */
+typedef u16		USHORT;	/* 16 bits */
+typedef u32		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;
@@ -72,48 +86,49 @@
 */
 struct	_SRB
 {
-UCHAR		CmdBlock[12];
+//UCHAR		CmdBlock[12];
 
 struct _SRB	*pNextSRB;
 struct _DCB	*pSRBDCB;
 PSCSICMD	pcmd;
 PSGL		pSegmentList;
 
-ULONG		Segment0[2];
-ULONG		Segment1[2];
+/* 0x10: */
+SGL		Segmentx;	/* make a one entry of S/G list table */
 
-/* 0x2c:*/
-ULONG		TotalXferredLen;
+/* 0x1c: */
 ULONG		SGBusAddr;	/*;a segment starting address as seen by AM53C974A*/
 ULONG		SGToBeXferLen;	/*; to be xfer length */
-ULONG		SRBState;
-
-/* 0x3c: */
-UCHAR		MsgInBuf[6];
-UCHAR		MsgOutBuf[6];
-
-/* 0x48: */
-SGL		Segmentx;	/* make a one entry of S/G list table */
-
-UCHAR		ScsiCmdLen;
-UCHAR		ScsiPhase;
+ULONG		TotalXferredLen;
+ULONG		SavedTotXLen;
+UINT		SRBState;
 
+/* 0x30: */
+UCHAR		SRBStatus;
+UCHAR		SRBFlag;	/*; b0-AutoReqSense,b6-Read,b7-write */
+				/*; b4-settimeout,b5-Residual valid */
 UCHAR		AdaptStatus;
 UCHAR		TargetStatus;
 
-/* 0x58: */
+UCHAR		ScsiPhase;
+UCHAR		TagNumber;
+UCHAR		SGIndex;
+UCHAR		SGcount;
+
+/* 0x38: */
 UCHAR		MsgCnt;
 UCHAR		EndMessage;
 UCHAR		RetryCnt;
-UCHAR		SRBFlag;	/*; b0-AutoReqSense,b6-Read,b7-write */
-				/*; b4-settimeout,b5-Residual valid */
-UCHAR		TagNumber;
-UCHAR		SGcount;
-UCHAR		SGIndex;
-UCHAR		SRBStatus;
-  //UCHAR		IORBFlag;	/*;81h-Reset, 2-retry */
+UCHAR		SavedSGCount;			
+
+ULONG		Saved_Ptr;
+
+/* 0x40: */
+UCHAR		MsgInBuf[6];
+UCHAR		MsgOutBuf[6];
 
-/* 0x60: */
+//UCHAR		IORBFlag;	/*;81h-Reset, 2-retry */
+/* 0x4c: */
 };
 
 
@@ -129,48 +144,47 @@
 struct _DCB	*pNextDCB;
 struct _ACB	*pDCBACB;
 
-PSCSICMD	pQIORBhead;
-PSCSICMD	pQIORBtail;
-PSCSICMD	AboIORBhead;
-PSCSICMD	AboIORBtail;
-ULONG		QIORBCnt;
-ULONG		AboIORBcnt;
+/* Aborted Commands */
+//PSCSICMD	AboIORBhead;
+//PSCSICMD	AboIORBtail;
+//ULONG		AboIORBcnt;
 
-/* 0x20: */
+/* 0x08: */
+/* Queued SRBs */
 PSRB		pWaitingSRB;
 PSRB		pWaitLast;
 PSRB		pGoingSRB;
 PSRB		pGoingLast;
 PSRB		pActiveSRB;
+UCHAR		WaitSRBCnt;	/* Not used */
 UCHAR		GoingSRBCnt;
-UCHAR		WaitSRBCnt;	/* ??? */
+
 UCHAR		DevType;
 UCHAR		MaxCommand;
 
-/* 0x38: */
-ULONG		TagMask;
+/* 0x20: */
+UINT		TagMask;
 
-UCHAR		UnitSCSIID;	/*; SCSI Target ID  (SCSI Only) */
-UCHAR		UnitSCSILUN;	/*; SCSI Log.  Unit (SCSI Only) */
+UCHAR		TargetID;	/*; SCSI Target ID  (SCSI Only) */
+UCHAR		TargetLUN;	/*; SCSI Log.  Unit (SCSI Only) */
 UCHAR		DevMode;
-UCHAR		IdentifyMsg;
+UCHAR		DCBFlag;
 
 UCHAR		CtrlR1;
 UCHAR		CtrlR3;
 UCHAR		CtrlR4;
+UCHAR		Inquiry7;
 
-UCHAR		DCBFlag;
-
-/* 0x44: */
+/* 0x2c: */
 UCHAR		SyncMode;	/*; 0:async mode */
 UCHAR		NegoPeriod;	/*;for nego. */
 UCHAR		SyncPeriod;	/*;for reg. */
 UCHAR		SyncOffset;	/*;for reg. and nego.(low nibble) */
 
-/* 0x48:*/
+/* 0x30:*/
 //UCHAR		InqDataBuf[8];
 //UCHAR		CapacityBuf[8];
-/* 0x58: */
+///* 0x40: */
 };
 
 typedef  struct  _DCB	 DC390_DCB, *PDCB;
@@ -201,16 +215,24 @@
 PDCB		pLinkDCB;
 PDCB		pLastDCB;
 PDCB		pDCBRunRobin;
+
 PDCB		pActiveDCB;
 PSRB		pFreeSRB;
 PSRB		pTmpSRB;
 
 /* 0x2c: */
+ULONG		QueryCnt;
+PSCSICMD	pQueryHead;
+PSCSICMD	pQueryTail;
 
+/* 0x38: */
 UCHAR		msgin123[4];
 UCHAR		DCBmap[MAX_SCSI_ID];
+UCHAR		Connected;
+UCHAR		pad;
 
-#if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(__SMP__) || DEBUG_SPINLOCKS > 0)
+/* 0x3c: */
+#if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(CONFIG_SMP) || DEBUG_SPINLOCKS > 0)
 spinlock_t	lock;
 #endif
 UCHAR		sel_timeout;
@@ -220,18 +242,20 @@
 UCHAR		Ignore_IRQ;	/* Not used */
 
 PDEVDECL1;			/* Pointer to PCI cfg. space */
-/* 0x40/0x3c: */
+/* 0x4c/0x48: */
 ULONG		Cmds;
-ULONG		CmdInQ;
-ULONG		CmdOutOfSRB;
-ULONG		SelLost;
-
+UINT		SelLost;
+UINT		SelConn;
+UINT		CmdInQ;
+UINT		CmdOutOfSRB;
 	
-/* 0x50/0x4c: */	
+/* 0x60/0x5c: */
+struct timer_list	Waiting_Timer;
+/* 0x74/0x70: */
 DC390_SRB	TmpSRB;
-/* 0xb4/0xb0: */
-DC390_SRB	SRB_array[MAX_SRB_CNT]; 	/* 18 SRBs */
-/* 0x7bc/0x7b8: */
+/* 0xd8/0xd4: */
+DC390_SRB	SRB_array[MAX_SRB_CNT]; 	/* 50 SRBs */
+/* 0xfb0/0xfac: */
 };
 
 typedef  struct  _ACB	 DC390_ACB, *PACB;
@@ -339,21 +363,29 @@
 #define H_BAD_CCB_OR_SG  0x1A
 #define H_ABORT 	 0x0FF
 
-/*; SCSI Status byte codes*/ /* Twice the values defined in scsi/scsi.h */
-#define SCSI_STAT_GOOD		0x0	/*;  Good status */
-#define SCSI_STAT_CHECKCOND	0x02	/*;  SCSI Check Condition */
-#define SCSI_STAT_CONDMET	0x04	/*;  Condition Met */
-#define SCSI_STAT_BUSY		0x08	/*;  Target busy status */
-#define SCSI_STAT_INTER 	0x10	/*;  Intermediate status */
-#define SCSI_STAT_INTERCONDMET	0x14	/*;  Intermediate condition met */
-#define SCSI_STAT_RESCONFLICT	0x18	/*;  Reservation conflict */
-#define SCSI_STAT_CMDTERM	0x22	/*;  Command Terminated */
-#define SCSI_STAT_QUEUEFULL	0x28	/*;  Queue Full */
+/*; SCSI Status byte codes*/ 
+/* The values defined in include/scsi/scsi.h, to be shifted << 1 */
 
 #define SCSI_STAT_UNEXP_BUS_F	0xFD	/*;  Unexpect Bus Free */
 #define SCSI_STAT_BUS_RST_DETECT 0xFE	/*;  Scsi Bus Reset detected */
 #define SCSI_STAT_SEL_TIMEOUT	0xFF	/*;  Selection Time out */
 
+/* cmd->result */
+#define RES_TARGET		0x000000FF	/* Target State */
+#define RES_TARGET_LNX		STATUS_MASK	/* Only official ... */
+#define RES_ENDMSG		0x0000FF00	/* End Message */
+#define RES_DID			0x00FF0000	/* DID_ codes */
+#define RES_DRV			0xFF000000	/* DRIVER_ codes */
+
+#define MK_RES(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt))
+#define MK_RES_LNX(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1)
+
+#define SET_RES_TARGET(who,tgt) { who &= ~RES_TARGET; who |= (int)(tgt); }
+#define SET_RES_TARGET_LNX(who,tgt) { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; }
+#define SET_RES_MSG(who,msg) { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; }
+#define SET_RES_DID(who,did) { who &= ~RES_DID; who |= (int)(did) << 16; }
+#define SET_RES_DRV(who,drv) { who &= ~RES_DRV; who |= (int)(drv) << 24; }
+
 /*;---Sync_Mode */
 #define SYNC_DISABLE	0
 #define SYNC_ENABLE	BIT0
@@ -375,31 +407,8 @@
 #define SCSI_MSG_OUT	6
 #define SCSI_MSG_IN	7
 
-/*;----SCSI MSG BYTE*/ /* see scsi/scsi.h */
-#define MSG_COMPLETE		0x00
-#define MSG_EXTENDED		0x01
-#define MSG_SAVE_PTR		0x02
-#define MSG_RESTORE_PTR 	0x03
-#define MSG_DISCONNECT		0x04
-#define MSG_INITIATOR_ERROR	0x05
-#define MSG_ABORT		0x06
-#define MSG_REJECT_		0x07
-#define MSG_NOP 		0x08
-#define MSG_PARITY_ERROR	0x09
-#define MSG_LINK_CMD_COMPL	0x0A
-#define MSG_LINK_CMD_COMPL_FLG	0x0B
-#define MSG_BUS_RESET		0x0C
-#define MSG_ABORT_TAG		0x0D
-#define MSG_SIMPLE_QTAG 	0x20
-#define MSG_HEAD_QTAG		0x21
-#define MSG_ORDER_QTAG		0x22
-#define MSG_IDENTIFY		0x80
-#define MSG_HOST_ID		0x0C0
-
-/* cmd->result */
-#define STATUS_MASK_		0xFF
-#define MSG_MASK		0xFF00
-#define RETURN_MASK		0xFF0000
+/*;----SCSI MSG BYTE*/ /* see scsi/scsi.h */ /* One is missing ! */
+#define ABORT_TAG	0x0d
 
 /*
 **  Inquiry Data format
@@ -439,8 +448,12 @@
 /*  Peripheral Device Type definitions */
 /*  see include/scsi/scsi.h for the rest */
 
-#define TYPE_PRINTER		 0x02	   /* Printer device		   */
-#define TYPE_COMM		 0x09	   /* Communications device	   */
+#ifndef TYPE_PRINTER
+# define TYPE_PRINTER		 0x02	   /* Printer device		   */
+#endif
+#ifndef TYPE_COMM
+# define TYPE_COMM		 0x09	   /* Communications device	   */
+#endif
 
 /*
 ** Inquiry flag definitions (Inq data byte 7)
diff -urN linux-2.2.19-pre3/drivers/sound/sound_core.c linux/drivers/sound/sound_core.c
--- linux-2.2.19-pre3/drivers/sound/sound_core.c	Mon Dec  3 20:54:18 2001
+++ linux/drivers/sound/sound_core.c	Mon Dec  3 20:54:39 2001
@@ -52,6 +52,7 @@
 	struct sound_unit *next;
 };
 
+extern int init_cmpci(void);
 extern int init_sonicvibes(void);
 extern int init_maestro(void);
 extern int init_trident(void);
@@ -395,6 +396,9 @@
 	/*
 	 *	Now init non OSS drivers
 	 */
+#ifdef CONFIG_SOUND_CMPCI
+        init_cmpci();
+#endif
 #ifdef CONFIG_SOUND_VWSND
 	init_vwsnd();
 #endif
diff -urN linux-2.2.19-pre3/drivers/usb/devio.c linux/drivers/usb/devio.c
--- linux-2.2.19-pre3/drivers/usb/devio.c	Sun Dec 10 16:49:43 2000
+++ linux/drivers/usb/devio.c	Mon Dec  3 20:54:39 2001
@@ -55,113 +55,6 @@
         urb_t urb;
 };
 
-/*
- * my own sync control and bulk methods. Here to experiment
- * and because the kernel ones set the process to TASK_UNINTERRUPTIBLE.
- */
-
-struct sync {
-	wait_queue_head_t wait;
-};
-
-static void sync_completed(purb_t urb)
-{
-        struct sync *s = (struct sync *)urb->context;
- 
-        wake_up(&s->wait);	
-}
-
-static int do_sync(purb_t urb, int timeout)
-{
-        DECLARE_WAITQUEUE(wait, current);
-	unsigned long tm;
-	signed long tmdiff;
-	struct sync s;
-	int ret;
-
-	tm = jiffies+timeout;
-	init_waitqueue_head(&s.wait);
-	add_wait_queue(&s.wait, &wait);
-	urb->context = &s;
-	urb->complete = sync_completed;
-	set_current_state(TASK_INTERRUPTIBLE);
-	if ((ret = usb_submit_urb(urb)))
-		goto out;
-	while (urb->status == -EINPROGRESS) {
-		tmdiff = tm - jiffies;
-		if (tmdiff <= 0) {
-			ret = -ETIMEDOUT;
-			goto out;
-		}
-		if (signal_pending(current)) {
-			ret = -EINTR;
-			goto out;
-		}
-		schedule_timeout(tmdiff);
-	}
-	ret = urb->status;
- out:
-	set_current_state(TASK_RUNNING);
-	usb_unlink_urb(urb);
-	remove_wait_queue(&s.wait, &wait);
-	return ret;
-}
-
-static int my_usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype,
-			      __u16 value, __u16 index, void *data, __u16 size, int timeout)
-{
-	urb_t *urb;
-	int ret;
-
-	if (!(urb = usb_alloc_urb(0)))
-		return -ENOMEM;
-	if (!(urb->setup_packet = kmalloc(8, GFP_KERNEL))) {
-		usb_free_urb(urb);
-		return -ENOMEM;
-	}
-	urb->setup_packet[0] = requesttype;
-	urb->setup_packet[1] = request;
-	urb->setup_packet[2] = value;
-	urb->setup_packet[3] = value >> 8;
-	urb->setup_packet[4] = index;
-	urb->setup_packet[5] = index >> 8;
-	urb->setup_packet[6] = size;
-	urb->setup_packet[7] = size >> 8;
-	urb->dev = dev;
-        urb->pipe = pipe;
-        urb->transfer_buffer = data;
-        urb->transfer_buffer_length = size;
-	ret = do_sync(urb, timeout);
-	//if (ret >= 0)
-	//	ret = urb->status;
-	if (ret >= 0)
-		ret = urb->actual_length;
-	kfree(urb->setup_packet);
-	usb_free_urb(urb);
-	return ret;
-}
-
-static int my_usb_bulk_msg(struct usb_device *dev, unsigned int pipe, 
-			   void *data, int len, int *actual_length, int timeout)
-{
-	urb_t *urb;
-	int ret;
-
-	if (!(urb = usb_alloc_urb(0)))
-		return -ENOMEM;
-        urb->dev = dev;
-        urb->pipe = pipe;
-        urb->transfer_buffer = data;
-        urb->transfer_buffer_length = len;
-	ret = do_sync(urb, timeout);
-	//if (ret >= 0)
-	//	ret = urb->status;
-	if (ret >= 0 && actual_length != NULL)
-		*actual_length = urb->actual_length;
-	usb_free_urb(urb);
-	return ret;
-}
-
 static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
 {
 	switch (orig) {
@@ -289,6 +182,8 @@
 {
         if (as->urb.transfer_buffer)
                 kfree(as->urb.transfer_buffer);
+        if (as->urb.setup_packet)
+                kfree(as->urb.setup_packet);
         kfree(as);
 }
 
@@ -536,6 +431,28 @@
 }
 #endif
 
+static int check_ctrlrecip(struct dev_state *ps, unsigned int recip, unsigned int index)
+{
+	int ret;
+
+	switch (recip & USB_RECIP_MASK) {
+	case USB_RECIP_ENDPOINT:
+		if ((ret = findintfep(ps->dev, index & 0xff)) < 0)
+			return ret;
+		if ((ret = checkintf(ps, ret)))
+			return ret;
+		break;
+
+	case USB_RECIP_INTERFACE:
+		if ((ret = findintfif(ps->dev, index & 0xff)) < 0)
+			return ret;
+		if ((ret = checkintf(ps, ret)))
+			return ret;
+		break;
+	}
+	return 0;
+}
+
 /*
  * file operations
  */
@@ -609,21 +526,8 @@
 
 	if (copy_from_user(&ctrl, (void *)arg, sizeof(ctrl)))
 		return -EFAULT;
-	switch (ctrl.requesttype & 0x1f) {
-	case USB_RECIP_ENDPOINT:
-		if ((ret = findintfep(ps->dev, ctrl.index & 0xff)) < 0)
-			return ret;
-		if ((ret = checkintf(ps, ret)))
-			return ret;
-		break;
-
-	case USB_RECIP_INTERFACE:
-		if ((ret = findintfif(ps->dev, ctrl.index & 0xff)) < 0)
-			return ret;
-		if ((ret = checkintf(ps, ret)))
-			return ret;
-		break;
-	}
+	if ((ret = check_ctrlrecip(ps, ctrl.requesttype, ctrl.index)))
+		return ret;
 	if (ctrl.length > PAGE_SIZE)
 		return -EINVAL;
 	if (!(tbuf = (unsigned char *)__get_free_page(GFP_KERNEL)))
@@ -634,7 +538,7 @@
 			free_page((unsigned long)tbuf);
 			return -EINVAL;
 		}
-		i = my_usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.request, ctrl.requesttype,
+		i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.request, ctrl.requesttype,
 				       ctrl.value, ctrl.index, tbuf, ctrl.length, tmo);
 		if ((i > 0) && ctrl.length) {
 			if (copy_to_user(ctrl.data, tbuf, ctrl.length)) {
@@ -649,7 +553,7 @@
 				return -EFAULT;
 			}
 		}
-		i = my_usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.request, ctrl.requesttype,
+		i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.request, ctrl.requesttype,
 				       ctrl.value, ctrl.index, tbuf, ctrl.length, tmo);
 	}
 	free_page((unsigned long)tbuf);
@@ -683,7 +587,7 @@
 		return -EINVAL;
 	len1 = bulk.len;
 	if (len1 > PAGE_SIZE)
-		len1 = PAGE_SIZE;
+		return -EINVAL;
 	if (!(tbuf = (unsigned char *)__get_free_page(GFP_KERNEL)))
 		return -ENOMEM;
 	tmo = (bulk.timeout * HZ + 999) / 1000;
@@ -692,7 +596,7 @@
 			free_page((unsigned long)tbuf);
 			return -EINVAL;
 		}
-		i = my_usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
+		i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
 		if (!i && len2) {
 			if (copy_to_user(bulk.data, tbuf, len2)) {
 				free_page((unsigned long)tbuf);
@@ -706,7 +610,7 @@
 				return -EFAULT;
 			}
 		}
-		i = my_usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
+		i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
 	}
 	free_page((unsigned long)tbuf);
 	if (i < 0) {
@@ -847,23 +751,61 @@
 {
 	struct usbdevfs_urb uurb;
 	struct usbdevfs_iso_packet_desc *isopkt = NULL;
+	struct usb_endpoint_descriptor *ep_desc;
 	struct async *as;
+	devrequest *dr = NULL;
 	unsigned int u, totlen, isofrmlen;
 	int ret;
 
 	if (copy_from_user(&uurb, arg, sizeof(uurb)))
 		return -EFAULT;
-	if (uurb.flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_DISABLE_SPD))
+	if (uurb.flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_DISABLE_SPD|USBDEVFS_URB_QUEUE_BULK))
 		return -EINVAL;
 	if (!uurb.buffer)
 		return -EINVAL;
 	if (uurb.signr != 0 && (uurb.signr < SIGRTMIN || uurb.signr > SIGRTMAX))
 		return -EINVAL;
-	if ((ret = findintfep(ps->dev, uurb.endpoint)) < 0)
-		return ret;
-	if ((ret = checkintf(ps, ret)))
-		return ret;
+	if (!(uurb.type == USBDEVFS_URB_TYPE_CONTROL && (uurb.endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {
+		if ((ret = findintfep(ps->dev, uurb.endpoint)) < 0)
+			return ret;
+		if ((ret = checkintf(ps, ret)))
+			return ret;
+	}
 	switch(uurb.type) {
+	case USBDEVFS_URB_TYPE_CONTROL:
+		if ((uurb.endpoint & ~USB_ENDPOINT_DIR_MASK) != 0) {
+			if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
+				return -ENOENT;
+			if ((ep_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_CONTROL)
+				return -EINVAL;
+		}
+		/* min 8 byte setup packet, max arbitrary */
+		if (uurb.buffer_length < 8 || uurb.buffer_length > PAGE_SIZE)
+			return -EINVAL;
+		if (!(dr = kmalloc(sizeof(devrequest), GFP_KERNEL)))
+			return -ENOMEM;
+		if (copy_from_user(dr, (unsigned char*)uurb.buffer, 8)) {
+			kfree(dr);
+			return -EFAULT;
+		}
+		if (uurb.buffer_length < (le16_to_cpup(&dr->length) + 8)) {
+			kfree(dr);
+			return -EINVAL;
+		}
+		if ((ret = check_ctrlrecip(ps, dr->requesttype, le16_to_cpup(&dr->index)))) {
+			kfree(dr);
+			return ret;
+		}
+		uurb.endpoint = (uurb.endpoint & ~USB_ENDPOINT_DIR_MASK) | (dr->requesttype & USB_ENDPOINT_DIR_MASK);
+		uurb.number_of_packets = 0;
+		uurb.buffer_length = le16_to_cpup(&dr->length);
+		uurb.buffer += 8;
+		if (!access_ok((uurb.endpoint & USB_DIR_IN) ?  VERIFY_WRITE : VERIFY_READ, uurb.buffer, uurb.buffer_length)) {
+			kfree(dr);
+			return -EFAULT;
+		}
+		break;
+
 	case USBDEVFS_URB_TYPE_BULK:
 		uurb.number_of_packets = 0;
 		if (uurb.buffer_length > 16384)
@@ -903,11 +845,15 @@
 	if (!(as = alloc_async(uurb.number_of_packets))) {
 		if (isopkt)
 			kfree(isopkt);
+		if (dr)
+			kfree(dr);
 		return -ENOMEM;
 	}
 	if (!(as->urb.transfer_buffer = kmalloc(uurb.buffer_length, GFP_KERNEL))) {
 		if (isopkt)
 			kfree(isopkt);
+		if (dr)
+			kfree(dr);
 		free_async(as);
 		return -ENOMEM;
 	}
@@ -916,6 +862,7 @@
         as->urb.pipe = (uurb.type << 30) | __create_pipe(ps->dev, uurb.endpoint & 0xf) | (uurb.endpoint & USB_DIR_IN);
         as->urb.transfer_flags = uurb.flags;
 	as->urb.transfer_buffer_length = uurb.buffer_length;
+	as->urb.setup_packet = (unsigned char*)dr;
 	as->urb.start_frame = uurb.start_frame;
 	as->urb.number_of_packets = uurb.number_of_packets;
         as->urb.context = as;
@@ -1089,17 +1036,19 @@
 	int			retval = 0;
 
 	/* get input parameters and alloc buffer */
-	if (copy_from_user (&ctrl, (void *) arg, sizeof (ctrl)))
+	if (copy_from_user(&ctrl, (void *) arg, sizeof (ctrl)))
 		return -EFAULT;
 	if ((size = _IOC_SIZE (ctrl.ioctl_code)) > 0) {
 		if ((buf = kmalloc (size, GFP_KERNEL)) == 0)
 			return -ENOMEM;
-		if ((_IOC_DIR (ctrl.ioctl_code) & _IOC_WRITE) != 0
-				&& copy_from_user (buf, ctrl.data, size) != 0) {
-			kfree (buf);
-			return -EFAULT;
-		} else
-			memset (arg, 0, size);
+		if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) {
+			if (copy_from_user (buf, ctrl.data, size)) {
+				kfree (buf);
+				return -EFAULT;
+			}
+		} else {
+			memset (buf, 0, size);
+		}
 	}
 
 	/* ioctl to device */
diff -urN linux-2.2.19-pre3/drivers/usb/usb.c linux/drivers/usb/usb.c
--- linux-2.2.19-pre3/drivers/usb/usb.c	Sun Dec 10 16:49:44 2000
+++ linux/drivers/usb/usb.c	Mon Dec  3 20:54:39 2001
@@ -187,6 +187,19 @@
 	return NULL;
 }
 
+struct usb_endpoint_descriptor *usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum)
+{
+	int i, j, k;
+
+	for (i = 0; i < dev->actconfig->bNumInterfaces; i++)
+		for (j = 0; j < dev->actconfig->interface[i].num_altsetting; j++)
+			for (k = 0; k < dev->actconfig->interface[i].altsetting[j].bNumEndpoints; k++)
+				if (epnum == dev->actconfig->interface[i].altsetting[j].endpoint[k].bEndpointAddress)
+					return &dev->actconfig->interface[i].altsetting[j].endpoint[k];
+
+	return NULL;
+}
+
 /*
  * usb_calc_bus_time:
  *
@@ -2037,6 +2050,7 @@
  * then these symbols need to be exported for the modules to use.
  */
 EXPORT_SYMBOL(usb_ifnum_to_if);
+EXPORT_SYMBOL(usb_epnum_to_ep_desc);
 
 EXPORT_SYMBOL(usb_register);
 EXPORT_SYMBOL(usb_deregister);
diff -urN linux-2.2.19-pre3/drivers/video/Config.in linux/drivers/video/Config.in
--- linux-2.2.19-pre3/drivers/video/Config.in	Sun Dec 10 16:49:44 2000
+++ linux/drivers/video/Config.in	Mon Dec  3 20:54:39 2001
@@ -188,7 +188,8 @@
 	 "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \
          "$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \
 	 "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
-	 "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" ]; then
+	 "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \
+	 "$CONFIG_FB_ATY128" = "y" ]; then
       define_bool CONFIG_FBCON_CFB8 y
     else
       if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \
@@ -202,14 +203,15 @@
 	   "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \
            "$CONFIG_FB_IGA" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \
 	   "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \
-	   "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" ]; then
+	   "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \
+	   "$CONFIG_FB_ATY128" = "m" ]; then
 	define_bool CONFIG_FBCON_CFB8 m
       fi
     fi
     if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \
 	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VESA" = "y" -o \
 	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_TBOX" = "y" -o \
-	 "$CONFIG_FB_Q40" = "y" -o \
+	 "$CONFIG_FB_Q40" = "y" -o "$CONFIG_FB_ATY128" = "y" -o \
 	 "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
 	 "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \
 	 "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \
@@ -221,7 +223,7 @@
       if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \
 	   "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VESA" = "m" -o \
 	   "$CONFIG_FB_VIRTUAL" = "m" -o "$CONFIG_FB_TBOX" = "m" -o \
-	 "$CONFIG_FB_Q40" = "m" -o \
+	   "$CONFIG_FB_Q40" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \
 	   "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
 	   "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \
  	   "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \
@@ -234,13 +236,13 @@
     if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
 	 "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" -o \
 	  "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
-	 "$CONFIG_FB_CYBER2000" = "y" ]; then
+	 "$CONFIG_FB_CYBER2000" = "y" -o "$CONFIG_FB_ATY128" = "y" ]; then
       define_bool CONFIG_FBCON_CFB24 y
     else
       if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
 	   "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" -o \
 	   "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \
-	   "$CONFIG_FB_CYBER2000" = "m" ]; then
+	   "$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_ATY128" = "m" ]; then
 	define_bool CONFIG_FBCON_CFB24 m
       fi
     fi
@@ -249,7 +251,8 @@
 	 "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
 	 "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \
 	 "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
-	 "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" ]; then
+	 "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \
+	 "$CONFIG_FB_ATY128" = "y" ]; then
       define_bool CONFIG_FBCON_CFB32 y
     else
       if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \
@@ -257,7 +260,7 @@
 	   "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
 	   "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \
 	   "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \
-           "$CONFIG_FB_SGIVW" = "m" ]; then
+           "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_ATY128" = "m" ]; then
 	define_bool CONFIG_FBCON_CFB32 m
       fi
     fi
diff -urN linux-2.2.19-pre3/drivers/video/Makefile linux/drivers/video/Makefile
--- linux-2.2.19-pre3/drivers/video/Makefile	Sun Dec 10 16:49:44 2000
+++ linux/drivers/video/Makefile	Mon Dec  3 20:54:39 2001
@@ -106,6 +106,10 @@
 
 ifeq ($(CONFIG_FB_ATY128),y)
   L_OBJS += aty128fb.o
+else
+  ifeq ($(CONFIG_FB_ATY128),m)
+  M_OBJS += aty128fb.o
+  endif
 endif
 
 ifeq ($(CONFIG_FB_IGA),y)
diff -urN linux-2.2.19-pre3/fs/binfmt_aout.c linux/fs/binfmt_aout.c
--- linux-2.2.19-pre3/fs/binfmt_aout.c	Mon Dec  3 20:54:18 2001
+++ linux/fs/binfmt_aout.c	Mon Dec  3 20:54:39 2001
@@ -112,7 +112,7 @@
 #       define START_STACK(u)   (u.start_stack)
 #endif
 
-	if (!current->dumpable || atomic_read(&current->mm->count) != 1)
+	if (current->dumpable != 1 || atomic_read(&current->mm->count) != 1)
 		return 0;
 	current->dumpable = 0;
 
diff -urN linux-2.2.19-pre3/fs/binfmt_elf.c linux/fs/binfmt_elf.c
--- linux-2.2.19-pre3/fs/binfmt_elf.c	Mon Dec  3 20:54:18 2001
+++ linux/fs/binfmt_elf.c	Mon Dec  3 20:54:39 2001
@@ -1089,7 +1089,7 @@
 	elf_fpregset_t fpu;		/* NT_PRFPREG */
 	struct elf_prpsinfo psinfo;	/* NT_PRPSINFO */
 
-	if (!current->dumpable ||
+	if (current->dumpable != 1 ||
 	    limit < ELF_EXEC_PAGESIZE ||
 	    atomic_read(&current->mm->count) != 1)
 		return 0;
diff -urN linux-2.2.19-pre3/fs/exec.c linux/fs/exec.c
--- linux-2.2.19-pre3/fs/exec.c	Sun Dec 10 16:49:44 2000
+++ linux/fs/exec.c	Mon Dec  3 20:54:39 2001
@@ -518,7 +518,7 @@
 	current->sas_ss_sp = current->sas_ss_size = 0;
 
 	if (current->euid == current->uid && current->egid == current->gid)
-		current->dumpable = 1;
+		current->dumpable = 2;
 	name = bprm->filename;
 	for (i=0; (ch = *(name++)) != '\0';) {
 		if (ch == '/')
@@ -864,6 +864,10 @@
 
 	if (retval >= 0)
 		retval = search_binary_handler(&bprm,regs);
+
+	if(current->dumpable == 2)
+		current->dumapble = 0;
+		
 	if (retval >= 0)
 		/* execve success */
 		return retval;
@@ -875,5 +879,6 @@
 	for (i=0 ; i<MAX_ARG_PAGES ; i++)
 		free_page(bprm.page[i]);
 
+		
 	return retval;
 }
diff -urN linux-2.2.19-pre3/include/linux/isdn.h linux/include/linux/isdn.h
--- linux-2.2.19-pre3/include/linux/isdn.h	Mon Dec  3 20:54:18 2001
+++ linux/include/linux/isdn.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn.h,v 1.110 2000/11/01 17:54:01 detabc Exp $
+/* $Id: isdn.h,v 1.111 2000/11/25 17:01:02 kai Exp $
 
  * Main header for the Linux ISDN subsystem (linklevel).
  *
diff -urN linux-2.2.19-pre3/include/linux/isdnif.h linux/include/linux/isdnif.h
--- linux-2.2.19-pre3/include/linux/isdnif.h	Mon Dec  3 20:54:18 2001
+++ linux/include/linux/isdnif.h	Mon Dec  3 20:54:39 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnif.h,v 1.35 2000/06/16 13:19:38 keil Exp $
+/* $Id: isdnif.h,v 1.37 2000/11/19 17:01:54 kai Exp $
 
  * Linux ISDN subsystem
  *
diff -urN linux-2.2.19-pre3/include/linux/kernelcapi.h linux/include/linux/kernelcapi.h
--- linux-2.2.19-pre3/include/linux/kernelcapi.h	Mon Dec  3 20:54:18 2001
+++ linux/include/linux/kernelcapi.h	Mon Dec  3 20:54:39 2001
@@ -1,5 +1,5 @@
 /*
- * $Id: kernelcapi.h,v 1.7 2000/06/12 09:20:20 kai Exp $
+ * $Id: kernelcapi.h,v 1.8.6.1 2000/11/28 09:36:56 kai Exp $
  * 
  * Kernel CAPI 2.0 Interface for Linux
  * 
diff -urN linux-2.2.19-pre3/include/linux/pci.h linux/include/linux/pci.h
--- linux-2.2.19-pre3/include/linux/pci.h	Mon Dec  3 20:54:18 2001
+++ linux/include/linux/pci.h	Mon Dec  3 20:54:39 2001
@@ -528,6 +528,9 @@
 #define PCI_DEVICE_ID_PCTECH_SAMURAI_1	0x3010
 #define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020
 
+#define PCI_VENDOR_ID_ASUSTEK		0x1043
+#define PCI_DEVICE_ID_ASUSTEK_0675	0x0675
+
 #define PCI_VENDOR_ID_DPT               0x1044   
 #define PCI_DEVICE_ID_DPT               0xa400  
 
diff -urN linux-2.2.19-pre3/include/linux/sched.h linux/include/linux/sched.h
--- linux-2.2.19-pre3/include/linux/sched.h	Mon Dec  3 20:54:18 2001
+++ linux/include/linux/sched.h	Mon Dec  3 20:54:39 2001
@@ -259,7 +259,7 @@
 	int pdeath_signal;  /*  The signal sent when the parent dies  */
 	/* ??? */
 	unsigned long personality;
-	int dumpable:1;
+	int dumpable:2;
 	int did_exec:1;
 	pid_t pid;
 	pid_t pgrp;
@@ -319,7 +319,8 @@
 	struct files_struct *files;
 /* memory management info */
 	struct mm_struct *mm;
-	struct list_head local_pages; int allocation_order, nr_local_pages;
+	struct list_head local_pages;
+	int allocation_order, nr_local_pages;
 	int fs_locks;
 
 /* signal handlers */
diff -urN linux-2.2.19-pre3/include/linux/usb.h linux/include/linux/usb.h
--- linux-2.2.19-pre3/include/linux/usb.h	Sun Dec 10 16:49:44 2000
+++ linux/include/linux/usb.h	Mon Dec  3 20:54:39 2001
@@ -29,6 +29,7 @@
 /*
  * USB recipients
  */
+#define USB_RECIP_MASK			0x1f
 #define USB_RECIP_DEVICE		0x00
 #define USB_RECIP_INTERFACE		0x01
 #define USB_RECIP_ENDPOINT		0x02
@@ -554,6 +555,7 @@
 };
 
 extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum);
+extern struct usb_endpoint_descriptor *usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum);
 
 extern int usb_register(struct usb_driver *);
 extern void usb_deregister(struct usb_driver *);
diff -urN linux-2.2.19-pre3/include/linux/usbdevice_fs.h linux/include/linux/usbdevice_fs.h
--- linux-2.2.19-pre3/include/linux/usbdevice_fs.h	Sun Dec 10 16:49:44 2000
+++ linux/include/linux/usbdevice_fs.h	Mon Dec  3 20:54:39 2001
@@ -80,6 +80,7 @@
 
 #define USBDEVFS_URB_DISABLE_SPD           1
 #define USBDEVFS_URB_ISO_ASAP              2
+#define USBDEVFS_URB_QUEUE_BULK            0x10
 
 #define USBDEVFS_URB_TYPE_ISO		   0
 #define USBDEVFS_URB_TYPE_INTERRUPT	   1
diff -urN linux-2.2.19-pre3/include/linux/watchdog.h linux/include/linux/watchdog.h
--- linux-2.2.19-pre3/include/linux/watchdog.h	Sun Jan 19 05:47:26 1997
+++ linux/include/linux/watchdog.h	Mon Dec  3 20:54:39 2001
@@ -6,14 +6,17 @@
  *
  */
 
+#ifndef _LINUX_WATCHDOG_H
+#define _LINUX_WATCHDOG_H
+
 #include <linux/ioctl.h>
 
 #define	WATCHDOG_IOCTL_BASE	'W'
 
 struct watchdog_info {
-	u32 options;		/* Options the card/driver supports */
-	u32 firmware_version;	/* Firmware version of the card */
-	u8  identity[32];	/* Identity of the board */
+	__u32 options;		/* Options the card/driver supports */
+	__u32 firmware_version;	/* Firmware version of the card */
+	__u8  identity[32];	/* Identity of the board */
 };
 
 #define	WDIOC_GETSUPPORT	_IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info)
@@ -38,3 +41,5 @@
 #define	WDIOS_DISABLECARD	0x0001	/* Turn off the watchdog timer */
 #define	WDIOS_ENABLECARD	0x0002	/* Turn on the watchdog timer */
 #define	WDIOS_TEMPPANIC		0x0004	/* Kernel panic on temperature trip */
+
+#endif  /* ifndef _LINUX_WATCHDOG_H */
