scsi/Kconfig         |    6 +++
 scsi/Makefile        |    2 +
 scsi/isp/Makefile    |    7 +++
 scsi/isp/isp_linux.c |   96 ++++++++++++++++++++++++++++-----------------------
 scsi/isp/isp_linux.h |   24 ++++++------
 scsi/isp/isp_pci.c   |    7 +++
 6 files changed, 87 insertions(+), 55 deletions(-)

diff -puN drivers/scsi/isp/isp_linux.c~linux-isp-update drivers/scsi/isp/isp_linux.c
--- 25/drivers/scsi/isp/isp_linux.c~linux-isp-update	2003-02-14 00:21:09.000000000 -0800
+++ 25-akpm/drivers/scsi/isp/isp_linux.c	2003-02-14 00:21:09.000000000 -0800
@@ -64,7 +64,7 @@ int isp_unit_seed = 0;
 int isp_disable = 0;
 int isp_nofwreload = 0;
 int isp_nonvram = 0;
-int isp_maxluns = 8;
+int isp_maxluns = 128;
 int isp_fcduplex = 0;
 int isp_nport_only = 0;
 int isp_loop_only = 0;
@@ -506,7 +506,7 @@ isplinux_append_to_waitq(struct ispsoftc
 	 * Add back a timer else scsi_done drops this on the floor.
 	 */
 	scsi_add_timer(Cmnd, Cmnd->timeout_per_command, Cmnd->done);
-	isp_prt(isp, ISP_LOGDEBUG0, "giving up on target %d", Cmnd->target);
+	isp_prt(isp, ISP_LOGDEBUG0, "giving up on target %d", Cmnd->device->id);
 	ISP_UNLK_SOFTC(isp);
 	ISP_LOCK_SCSI_DONE(isp);
 	(*Cmnd->scsi_done)(Cmnd);
@@ -553,7 +553,7 @@ isp_remove_from_waitq(Scsi_Cmnd *Cmnd)
     Scsi_Cmnd *f;
     if (Cmnd == NULL)
 	return (Cmnd);
-    isp = (struct ispsoftc *) Cmnd->host->hostdata;
+    isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
     if ((f = isp->isp_osinfo.wqnext) == Cmnd) {
 	isp->isp_osinfo.wqnext = (Scsi_Cmnd *) Cmnd->host_scribble;
     } else {
@@ -662,7 +662,7 @@ isplinux_remove_from_doneq(Scsi_Cmnd *Cm
 
     if (Cmnd == NULL)
 	return (NULL);
-    isp = (struct ispsoftc *) Cmnd->host->hostdata;
+    isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
     if (isp->isp_osinfo.dqnext == NULL)
 	return (NULL);
     if ((f = isp->isp_osinfo.dqnext) == Cmnd) {
@@ -689,7 +689,7 @@ isplinux_remove_from_doneq(Scsi_Cmnd *Cm
 int
 isplinux_queuecommand(Scsi_Cmnd *Cmnd, void (*donecmd)(Scsi_Cmnd *))
 {
-    struct Scsi_Host *host = Cmnd->host;
+    struct Scsi_Host *host = Cmnd->device->host;
     struct ispsoftc *isp = (struct ispsoftc *) (host->hostdata);
     int result;
 
@@ -803,7 +803,7 @@ static INLINE void isplinux_scsi_probe_d
 static INLINE void
 isplinux_scsi_probe_done(Scsi_Cmnd *Cmnd)
 {
-    struct ispsoftc *isp = (struct ispsoftc *) Cmnd->host->hostdata;
+    struct ispsoftc *isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
 
     /*
      * If we haven't seen this target yet, check the command result. If
@@ -816,33 +816,35 @@ isplinux_scsi_probe_done(Scsi_Cmnd *Cmnd
      * seeing whether we can enable sync mode or not.
      */
 
-    if (isp->isp_psco[Cmnd->channel][Cmnd->target] == 0) {
+    if (isp->isp_psco[Cmnd->device->channel][Cmnd->device->id] == 0) {
 	int i, b;
 	caddr_t iqd;
+	struct scatterlist *sg;
 	sdparam *sdp = (sdparam *) isp->isp_param;
 
-	sdp += Cmnd->channel;
+	sdp += Cmnd->device->channel;
 	if (Cmnd->cmnd[0] == 0x12 && host_byte(Cmnd->result) == DID_OK) {
 	    if (Cmnd->use_sg == 0) {
 		iqd = (caddr_t) Cmnd->buffer;
 	    } else {
-		iqd = ((struct scatterlist *) Cmnd->request_buffer)->address;
+		sg = ((struct scatterlist *)Cmnd->request_buffer);
+		iqd = page_address(sg->page) + sg->offset;
 	    }
-	    sdp->isp_devparam[Cmnd->target].goal_flags &=
+	    sdp->isp_devparam[Cmnd->device->id].goal_flags &=
 		~(DPARM_TQING|DPARM_SYNC|DPARM_WIDE);
 	    if (iqd[7] & 0x2) {
-		sdp->isp_devparam[Cmnd->target].goal_flags |= DPARM_TQING;
+		sdp->isp_devparam[Cmnd->device->id].goal_flags |= DPARM_TQING;
 	    }
 	    if (iqd[7] & 0x10) {
-		sdp->isp_devparam[Cmnd->target].goal_flags |= DPARM_SYNC;
+		sdp->isp_devparam[Cmnd->device->id].goal_flags |= DPARM_SYNC;
 	    }
 	    if (iqd[7] & 0x20) {
-		sdp->isp_devparam[Cmnd->target].goal_flags |= DPARM_WIDE;
+		sdp->isp_devparam[Cmnd->device->id].goal_flags |= DPARM_WIDE;
 	    }
-	    sdp->isp_devparam[Cmnd->target].dev_update = 1;
-	    isp->isp_psco[Cmnd->channel][Cmnd->target] = 1;
+	    sdp->isp_devparam[Cmnd->device->id].dev_update = 1;
+	    isp->isp_psco[Cmnd->device->channel][Cmnd->device->id] = 1;
 	} else if (host_byte(Cmnd->result) != DID_OK) {
-	    isp->isp_psco[Cmnd->channel][Cmnd->target] = 1;
+	    isp->isp_psco[Cmnd->device->channel][Cmnd->device->id] = 1;
 	}
 
 	isp->isp_dutydone = 1;
@@ -876,7 +878,7 @@ isplinux_scsi_probe_done(Scsi_Cmnd *Cmnd
 void
 isp_done(Scsi_Cmnd *Cmnd)
 {
-    struct ispsoftc *isp = (struct ispsoftc *) (Cmnd->host->hostdata);
+    struct ispsoftc *isp = (struct ispsoftc *) (Cmnd->device->host->hostdata);
 
     if (IS_SCSI(isp) && isp->isp_dutydone == 0)  {
 	isplinux_scsi_probe_done(Cmnd);
@@ -916,11 +918,11 @@ isplinux_abort(Scsi_Cmnd *Cmnd)
     struct ispsoftc *isp;
     u_int16_t handle;
 
-    if (Cmnd == NULL || Cmnd->host == NULL) {
+    if (Cmnd == NULL || Cmnd->device->host == NULL) {
 	return (FAILED);
     }
 
-    isp = (struct ispsoftc *) Cmnd->host->hostdata;
+    isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
     if (Cmnd->serial_number != Cmnd->serial_number_at_timeout) {
 	isp_prt(isp, ISP_LOGWARN, "isplinux_abort: serial number mismatch");
 	return (FAILED);
@@ -973,19 +975,19 @@ isplinux_bdr(Scsi_Cmnd *Cmnd)
     struct ispsoftc *isp;
     int arg;
 
-    if (Cmnd == NULL || Cmnd->host == NULL) {
+    if (Cmnd == NULL || Cmnd->device->host == NULL) {
 	return (FAILED);
     }
 
-    isp = (struct ispsoftc *) Cmnd->host->hostdata;
-    arg = Cmnd->channel << 16 | Cmnd->target;
+    isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
+    arg = Cmnd->device->channel << 16 | Cmnd->device->id;
     ISP_DRIVER_ENTRY_LOCK(isp);
     ISP_LOCKU_SOFTC(isp);
     arg = isp_control(isp, ISPCTL_RESET_DEV, &arg);
     ISP_UNLKU_SOFTC(isp);
     ISP_DRIVER_EXIT_LOCK(isp);
     isp_prt(isp, ISP_LOGINFO, "Bus Device Reset %succesfully sent to %d.%d.%d",
-	arg == 0? "s" : "uns", Cmnd->channel, Cmnd->target, Cmnd->lun);
+	arg == 0? "s" : "uns", Cmnd->device->channel, Cmnd->device->id, Cmnd->device->lun);
     return ((arg == 0)? SUCCESS : FAILED);
 }
 
@@ -998,18 +1000,18 @@ isplinux_sreset(Scsi_Cmnd *Cmnd)
     struct ispsoftc *isp;
     int arg;
 
-    if (Cmnd == NULL || Cmnd->host == NULL)
+    if (Cmnd == NULL || Cmnd->device->host == NULL)
 	return (FAILED);
 
-    isp = (struct ispsoftc *) Cmnd->host->hostdata;
-    arg = Cmnd->channel;
+    isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
+    arg = Cmnd->device->channel;
     ISP_DRIVER_ENTRY_LOCK(isp);
     ISP_LOCKU_SOFTC(isp);
     arg = isp_control(isp, ISPCTL_RESET_BUS, &arg);
     ISP_UNLKU_SOFTC(isp);
     ISP_DRIVER_EXIT_LOCK(isp);
     isp_prt(isp, ISP_LOGINFO, "SCSI Bus Reset on Channel %d %succesful",
-	Cmnd->channel, arg == 0? "s" : "uns");
+	Cmnd->device->channel, arg == 0? "s" : "uns");
     return ((arg == 0)? SUCCESS : FAILED);
 }
 
@@ -1024,10 +1026,10 @@ isplinux_hreset(Scsi_Cmnd *Cmnd)
     struct ispsoftc *isp;
     u_int16_t handle;
 
-    if (Cmnd == NULL || Cmnd->host == NULL)
+    if (Cmnd == NULL || Cmnd->device->host == NULL)
 	return (FAILED);
 
-    isp = (struct ispsoftc *) Cmnd->host->hostdata;
+    isp = (struct ispsoftc *) Cmnd->device->host->hostdata;
 
     isp_prt(isp, ISP_LOGINFO, "Resetting Host Adapter");
 
@@ -2329,9 +2331,10 @@ ISP_ASYNC(struct ispsoftc *isp, ispasync
 }
 
 int
-isplinux_biosparam(Disk *disk, kdev_t n, int ip[])
+isplinux_biosparam(struct scsi_device *sdev, struct block_device *n,
+		   sector_t capacity, int ip[])
 {
-    int size = disk->capacity;
+    int size = capacity;
     ip[0] = 64;
     ip[1] = 32;
     ip[2] = size >> 11;
@@ -2347,6 +2350,7 @@ isplinux_biosparam(Disk *disk, kdev_t n,
  * Set the queue depth for this device.
  */
 
+#if 0
 void
 isplinux_sqd(struct Scsi_Host *host, Scsi_Device *devs)
 {
@@ -2382,6 +2386,16 @@ isplinux_sqd(struct Scsi_Host *host, Scs
 	devs = devs->next;
     }
 }
+#endif
+
+static int
+isplinux_slave_configure(Scsi_Device * device)
+{
+	if (device->tagged_supported)
+                scsi_adjust_queue_depth(device, MSG_ORDERED_TAG, 63);
+
+        return 0;
+}
 
 /*
  * Periodic watchdog timer.. the main purpose here is to restart
@@ -2454,11 +2468,14 @@ isplinux_intr(int irq, void *arg, struct
     u_int16_t isr, sema, mbox;
     Scsi_Cmnd *Cmnd;
 
+    spin_lock(isp->isp_osinfo.host->host_lock);
+
     ISP_ILOCK_SOFTC(isp);
     isp->isp_intcnt++;
     if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) {
 	isp->isp_intbogus++;
 	ISP_IUNLK_SOFTC(isp);
+	spin_unlock(isp->isp_osinfo.host->host_lock);
 	return;
     }
     isp_intr(isp, isr, sema, mbox);
@@ -2499,6 +2516,7 @@ isplinux_intr(int irq, void *arg, struct
 	}
 	ISP_UNLK_SCSI_DONE(isp);
     }
+    spin_unlock(isp->isp_osinfo.host->host_lock);
 }
 
 static INLINE int
@@ -2889,14 +2907,8 @@ isp_task_thread(void *arg)
     int action, nactions, exit_thread = 0;
     isp_thread_action_t curactions[MAX_THREAD_ACTION];
 
-    if (isp->isp_host->loaded_as_module) {
-	siginitsetinv(&current->blocked, sigmask(SIGHUP));
-    } else {
-	siginitsetinv(&current->blocked, 0);
-    }
     lock_kernel();
-    daemonize();
-    sprintf(current->comm, "isp_thrd%d", isp->isp_unit);
+    daemonize("isp_thrd%d", isp->isp_unit);
     isp->isp_osinfo.task_thread = current;
     isp->isp_osinfo.task_request = &thread_sleep_semaphore;
     unlock_kernel();
@@ -2904,18 +2916,16 @@ isp_task_thread(void *arg)
     if (isp->isp_osinfo.task_ctl_sem) {
 	up(isp->isp_osinfo.task_ctl_sem);
     }
-    isp_prt(isp, ISP_LOGDEBUG1, "isp_task_thread starting (%d)",
-	in_interrupt());
+    isp_prt(isp, ISP_LOGDEBUG1, "isp_task_thread starting");
 
     while (exit_thread == 0) {
 	isp_prt(isp, ISP_LOGDEBUG1, "isp_task_thread sleeping");
 	down_interruptible(&thread_sleep_semaphore);
-	if (isp->isp_host->loaded_as_module) {
+	if (0) {
 	    if (signal_pending(current))
 		break;
 	}
 	isp_prt(isp, ISP_LOGDEBUG1, "isp_task_thread running");
-	if (in_interrupt()) panic("in interrupt");
 
 	spin_lock_irqsave(&isp->isp_osinfo.tlock, flags);
 	nactions = isp->isp_osinfo.nt_actions;
@@ -2986,7 +2996,7 @@ isp_task_thread(void *arg)
 		ISP_UNLKU_SOFTC(isp);
 		break;
 	    case ISP_THREAD_EXIT:
-		if (isp->isp_host->loaded_as_module) {
+		if (0) {
 		    exit_thread = 1;
 		}
 		break;
diff -puN drivers/scsi/isp/isp_linux.h~linux-isp-update drivers/scsi/isp/isp_linux.h
--- 25/drivers/scsi/isp/isp_linux.h~linux-isp-update	2003-02-14 00:21:09.000000000 -0800
+++ 25-akpm/drivers/scsi/isp/isp_linux.h	2003-02-14 00:21:09.000000000 -0800
@@ -95,7 +95,6 @@
 #include <linux/interrupt.h>
 #include "scsi.h"
 #include "hosts.h"
-#include "sd.h"
 
 /*
  * These bits and pieces of keeping track of Linux versions
@@ -397,8 +396,13 @@ if (isp->isp_osinfo.task_request) {					
 #define	ISP_LOCKU_SOFTC			ISP_ILOCK_SOFTC
 #define	ISP_UNLKU_SOFTC			ISP_IUNLK_SOFTC
 #define	ISP_TLOCK_INIT(isp)		spin_lock_init(&isp->isp_osinfo.tlock)
+#if 0
 #define	ISP_DRIVER_ENTRY_LOCK(isp)	spin_unlock_irq(&io_request_lock)
 #define	ISP_DRIVER_EXIT_LOCK(isp)	spin_lock_irq(&io_request_lock)
+#else
+#define	ISP_DRIVER_ENTRY_LOCK(isp)
+#define	ISP_DRIVER_EXIT_LOCK(isp)
+#endif
 
 #define	ISP_MUST_POLL(isp)	(in_interrupt() || isp->mbintsok == 0)
 /*
@@ -581,10 +585,10 @@ if (isp->isp_osinfo.task_request) {					
 #endif
 
 #define	XS_T			Scsi_Cmnd
-#define	XS_ISP(Cmnd)		((struct ispsoftc *) (Cmnd)->host->hostdata)
-#define	XS_CHANNEL(Cmnd)	(Cmnd)->channel
-#define	XS_TGT(Cmnd)		(Cmnd)->target
-#define	XS_LUN(Cmnd)		(Cmnd)->lun
+#define	XS_ISP(Cmnd)		((struct ispsoftc *) (Cmnd)->device->host->hostdata)
+#define	XS_CHANNEL(Cmnd)	(Cmnd)->device->channel
+#define	XS_TGT(Cmnd)		(Cmnd)->device->id
+#define	XS_LUN(Cmnd)		(Cmnd)->device->lun
 #define	XS_CDBP(Cmnd)		(Cmnd)->cmnd
 #define	XS_CDBLEN(Cmnd)		(Cmnd)->cmd_len
 #define	XS_XFRLEN(Cmnd)		(Cmnd)->request_bufflen
@@ -722,9 +726,8 @@ int isplinux_release(struct Scsi_Host *)
 #endif
 const char *isplinux_info(struct Scsi_Host *);
 int isplinux_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
-int isplinux_biosparam(Disk *, kdev_t, int[]);
-
-
+int isplinux_biosparam(struct scsi_device *, struct block_device *, sector_t,
+		      int[]);
 /*
  * Driver wide data...
  */
@@ -879,7 +882,6 @@ int isplinux_bdr(Scsi_Cmnd *);
 int isplinux_sreset(Scsi_Cmnd *);
 int isplinux_hreset(Scsi_Cmnd *);
 #define QLOGICISP {							\
-	next:				NULL,				\
 	module:				NULL,				\
 	proc_info:			isplinux_proc_info,		\
 	name:				"Qlogic ISP 10X0/2X00",		\
@@ -887,7 +889,6 @@ int isplinux_hreset(Scsi_Cmnd *);
 	release:			ISPLINUX_RELEASE,		\
 	info:				isplinux_info,			\
 	queuecommand:			isplinux_queuecommand,		\
-	use_new_eh_code:		1,				\
 	eh_abort_handler:		isplinux_abort,			\
 	eh_device_reset_handler:	isplinux_bdr,			\
 	eh_bus_reset_handler:		isplinux_sreset,		\
@@ -896,7 +897,8 @@ int isplinux_hreset(Scsi_Cmnd *);
 	can_queue:			1,	   			\
 	sg_tablesize:			SG_ALL,				\
 	use_clustering:			ENABLE_CLUSTERING,		\
-	cmd_per_lun:			1				\
+	cmd_per_lun:			1,				\
+	slave_configure:		isplinux_slave_configure,	\
 }
 /*
  * mode: c
diff -puN drivers/scsi/isp/isp_pci.c~linux-isp-update drivers/scsi/isp/isp_pci.c
--- 25/drivers/scsi/isp/isp_pci.c~linux-isp-update	2003-02-14 00:21:09.000000000 -0800
+++ 25-akpm/drivers/scsi/isp/isp_pci.c	2003-02-14 00:21:09.000000000 -0800
@@ -36,6 +36,11 @@
  * San Francisco, CA, 94131
  * mjacob@feral.com
  */
+/*#define	ISP_DISABLE_1020_SUPPORT 1 */
+#define	ISP_DISABLE_1080_SUPPORT 1
+//#define	ISP_DISABLE_12160_SUPPORT 1
+#define	ISP_DISABLE_2100_SUPPORT 1
+#define	ISP_DISABLE_2200_SUPPORT 1
 
 #include "isp_linux.h"
 #if	defined(__powerpc__) || defined(__sparc__)
@@ -832,7 +837,7 @@ isplinux_pci_init(struct Scsi_Host *host
 	goto bad;
     }
     host->irq = irq;
-    host->select_queue_depths = isplinux_sqd;
+    //host->select_queue_depths = isplinux_sqd;
     isp->isp_param = &isp_pci->params;
 #ifdef	LINUX_ISP_TARGET_MODE
     isp->isp_osinfo.pool = isp_pci->rpool;
diff -puN /dev/null drivers/scsi/isp/Makefile
--- /dev/null	2002-08-30 16:31:37.000000000 -0700
+++ 25-akpm/drivers/scsi/isp/Makefile	2003-02-14 00:21:09.000000000 -0800
@@ -0,0 +1,7 @@
+
+EXTRA_CFLAGS	+= -Idrivers/scsi/isp -Idrivers/scsi/isp/common \
+		-Idrivers/scsi/isp/firmware -Idrivers/scsi 
+
+isp-objs := isp_pci.o isp_linux.o common/isp.o common/isp_target.o
+
+obj-$(CONFIG_SCSI_QLOGIC_ISP_NEW) += isp.o
diff -puN drivers/scsi/Kconfig~linux-isp-update drivers/scsi/Kconfig
--- 25/drivers/scsi/Kconfig~linux-isp-update	2003-02-14 00:21:09.000000000 -0800
+++ 25-akpm/drivers/scsi/Kconfig	2003-02-14 00:21:09.000000000 -0800
@@ -1331,6 +1331,12 @@ config SCSI_QLOGIC_ISP
 	  The module will be called qlogicisp.  If you want to compile it as
 	  a module, say M here and read <file:Documentation/modules.txt>.
 
+config SCSI_QLOGIC_ISP_NEW
+	tristate "Qlogic ISP SCSI support - New driver"
+	depends on PCI && SCSI
+	help
+	  New driver for qlogic ISP SCSI cards
+
 config SCSI_QLOGIC_FC
 	tristate "Qlogic ISP FC SCSI support"
 	depends on PCI && SCSI
diff -puN drivers/scsi/Makefile~linux-isp-update drivers/scsi/Makefile
--- 25/drivers/scsi/Makefile~linux-isp-update	2003-02-14 00:21:09.000000000 -0800
+++ 25-akpm/drivers/scsi/Makefile	2003-02-14 00:21:09.000000000 -0800
@@ -113,6 +113,8 @@ obj-$(CONFIG_SCSI_CPQFCTS)	+= cpqfc.o
 obj-$(CONFIG_SCSI_LASI700)	+= lasi700.o 53c700.o
 obj-$(CONFIG_SCSI_NSP32)	+= nsp32.o
 
+obj-$(CONFIG_SCSI_QLOGIC_ISP_NEW)	+= isp/
+
 obj-$(CONFIG_ARCH_ACORN)	+= ../acorn/scsi/
 
 obj-$(CONFIG_CHR_DEV_ST)	+= st.o

_