bk://linux-scsi.bkbits.net/scsi-rc-fixes-2.6 jejb@mulgrave.(none)|ChangeSet|20050323223255|08756 jejb # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/03/23 16:32:55-06:00 jejb@mulgrave.(none) # 3ware driver update # # - Increase max ioctl buffer size to 512 sectors. # - Make tw_scsi_queue() return 0 for 'Unknown scsi opcode'. # - Fix tw_remove() to free irq handler/unregister_chrdev() before shutting down # the card. # - Change to new 'change_queue_depth' api (from James). # - Fix 'handled=1' ISR usage, remove bogus IRQ check (from Jeff). # # Signed-off-by: Adam Radford # Signed-off-by: James Bottomley # # drivers/scsi/3w-xxxx.h # 2005/03/23 16:31:26-06:00 jejb@mulgrave.(none) +2 -1 # 3ware driver update # # drivers/scsi/3w-xxxx.c # 2005/03/23 16:31:25-06:00 jejb@mulgrave.(none) +172 -194 # 3ware driver update # # ChangeSet # 2005/03/23 11:13:21-06:00 jejb@mulgrave.(none) # Make Fusion-MPT much faster as module # # From: Moore, Eric Dean # # Between the 3.01.16 and 3.01.18, we introduced new method # to passing command line options to the driver. Some of the # command line options are used for fine tuning dv(domain # validation) in the driver. By accident, these command line options were # wrapped around #ifdef MODULE in the 3.01.18 version of the driver. # What this meant is when the driver is compiled built-in the kernel, # the optimal settings for dv were ignored, thus poor performance. # # There was actually a fix for this when I submitted SAS drivers # to the mailing list back in November, however the SAS drivers was # rejected, and later on I overlooked submitting a single patch to # solve this. # # Signed-off-by: Eric Moore # Signed-off-by: James Bottomley # # drivers/message/fusion/mptscsih.h # 2005/03/23 11:10:59-06:00 jejb@mulgrave.(none) +0 -8 # Make Fusion-MPT much faster as module # # drivers/message/fusion/mptscsih.c # 2005/03/23 11:10:58-06:00 jejb@mulgrave.(none) +44 -48 # Make Fusion-MPT much faster as module # # drivers/message/fusion/mptbase.h # 2005/03/23 11:10:58-06:00 jejb@mulgrave.(none) +2 -2 # Make Fusion-MPT much faster as module # # ChangeSet # 2005/03/23 11:05:01-06:00 bunk@stusta.de # [PATCH] drivers/scsi/osst.c: remove unused code # # Thanks to both the Coverity checker and GNU gcc, it was found that this # variable is completely unused. # # Signed-off-by: Adrian Bunk # Signed-off-by: Willem Riede # Signed-off-by: James Bottomley # # drivers/scsi/osst.c # 2005/03/22 15:09:32-06:00 bunk@stusta.de +0 -3 # drivers/scsi/osst.c: remove unused code # # ChangeSet # 2005/03/23 10:59:06-06:00 bunk@stusta.de # [PATCH] drivers/scsi/osst.c: make code static # # This patch makes needlessly global code static. # # Signed-off-by: Adrian Bunk # Signed-off-by: Willem Riede # Signed-off-by: James Bottomley # # drivers/scsi/osst.c # 2005/02/28 12:36:25-06:00 bunk@stusta.de +2 -2 # drivers/scsi/osst.c: make code static # # ChangeSet # 2005/03/20 21:05:57-06:00 jejb@mulgrave.(none) # 53c700: Alter interrupt assignment # # This change makes interrupt assignment the job of the # glue driver. The upshot being that the glue driver can # now set the name of the interrupt and, in the case of # the NCR_D700 driver, make the interrupt routing more efficient. # # Signed-off-by: James Bottomley # # drivers/scsi/sim710.c # 2005/03/20 21:04:31-06:00 jejb@mulgrave.(none) +10 -2 # 53c700: Alter interrupt assignment # # drivers/scsi/lasi700.c # 2005/03/20 21:04:31-06:00 jejb@mulgrave.(none) +9 -2 # 53c700: Alter interrupt assignment # # drivers/scsi/NCR_D700.c # 2005/03/20 21:04:31-06:00 jejb@mulgrave.(none) +32 -9 # 53c700: Alter interrupt assignment # # drivers/scsi/53c700.h # 2005/03/20 21:04:31-06:00 jejb@mulgrave.(none) +1 -2 # 53c700: Alter interrupt assignment # # drivers/scsi/53c700.c # 2005/03/20 21:04:31-06:00 jejb@mulgrave.(none) +3 -18 # 53c700: Alter interrupt assignment # # ChangeSet # 2005/03/20 10:12:34-06:00 jejb@mulgrave.(none) # SCSI: Re-export code incorrectly made static # # The interrupt routine in 53c700 is designed to be exported # for a future code change # # Signed-off-by: James Bottomley # # drivers/scsi/53c700.h # 2005/03/20 10:11:44-06:00 jejb@mulgrave.(none) +1 -0 # SCSI: Re-export code incorrectly made static # # drivers/scsi/53c700.c # 2005/03/20 10:11:44-06:00 jejb@mulgrave.(none) +2 -2 # SCSI: Re-export code incorrectly made static # # ChangeSet # 2005/03/19 20:36:15-06:00 jejb@mulgrave.(none) # ncr53c8xx: Fix small problem with initial negotiation # # The driver produces messages list this: # # ncr53c720-1: ID 7, Fast-10, Parity Checking # scsi1 : ncr53c8xx-3.4.3g # target1:0:1: target did not report SYNC. # Vendor: TOSHIBA Model: CD-ROM XM-5401TA Rev: 3605 # Type: CD-ROM ANSI SCSI revision: 02 # target1:0:1: Beginning Domain Validation # target1:0:1: asynchronous. # target1:0:1: Domain Validation skipping write tests # target1:0:1: FAST-5 SCSI 4.2 MB/s ST (236 ns, offset 8) # target1:0:1: Ending Domain Validation # # Although everything is fine. The initial "target did not report SYNC" # is because the driver is trying to negotiate over the initial inquiry # (so, naturally we don't know if it supports sync yet). The solution is # to rip out the last remnants of the spontaneous attempts at negotiation # to force it to wait for the DV negotiation in slave_configure. # # Signed-off-by: James Bottomley # # drivers/scsi/ncr53c8xx.c # 2005/03/19 20:31:04-06:00 jejb@mulgrave.(none) +1 -6 # ncr53c8xx: Fix small problem with initial negotiation # # ChangeSet # 2005/03/19 15:43:33-06:00 jejb@titanic.il.steeleye.com # Q720: fix compile warning # # Signed-off-by: James Bottomley # # drivers/scsi/NCR_Q720.c # 2005/03/19 15:43:18-06:00 jejb@titanic.il.steeleye.com +1 -1 # Q720: fix compile warning # # ChangeSet # 2005/03/19 14:58:03-06:00 James.Bottomley@steeleye.com # [PATCH] fix breakage in the SCSI generic tag code # # When I redid the target allocation routines, I inadvertently broke the # generic tag code. The problem is that the device is added to the host # list after slave_configure in the new code. This is too late since if # any command disconnects during the initial inquiry phase, we now cannot # find the device for the reconnect. The fix is to add the device to the # lists earlier. # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_sysfs.c # 2005/03/19 12:56:31-06:00 James.Bottomley@steeleye.com +8 -8 # fix breakage in the SCSI generic tag code # # ChangeSet # 2005/03/19 14:55:41-06:00 willy@parisc-linux.org # [PATCH] Fix small bug in scsi_transport_spi # # Fix small bug in scsi_transport_spi # # "reserved" was being printed without a trailing \n. # # Signed-off-by: Matthew Wilcox # Signed-off-by: James Bottomley # # drivers/scsi/scsi_transport_spi.c # 2005/03/18 07:12:14-06:00 willy@parisc-linux.org +6 -3 # Fix small bug in scsi_transport_spi # # ChangeSet # 2005/03/19 14:54:23-06:00 willy@parisc-linux.org # [PATCH] ncr53c8xx update # # ncr53c8xx update # # ncr-3.4.3g: # # - set the starget in slave_alloc instead of slave_configure to avoid # problems with drives sending negotiation messages before we try to # configure them. # - Implement ->get_signalling. # - Pass the scsi_cmnd to ncr_get_ccb() instead of the target & lun numbers # - All ncr_show_msg() callers changed to use ncr_print_msg() # - Combine ncr_show_msg() into ncr_print_msg() # - Move ncr_print_msg() to near the top of the file and eliminate prototype # - Change PRINT_ADDR() to take a fmt string # - Make PRINT_ADDR use dev_info() # - Eliminate PRINT_LUN -- all callers can use PRINT_ADDR or dev_info # - Replace PRINT_TARGET() with a direct call to dev_info() # - Whitespace cleanups # - Get rid of superfluous ; after } of if/switch statements # - Use IDENTIFY() instead of M_IDENTIFY | ... # - Convert to use spi_display_xfer_agreement() # # Signed-off-by: Matthew Wilcox # Signed-off-by: James Bottomley # # drivers/scsi/sym53c8xx_defs.h # 2005/03/18 07:03:07-06:00 willy@parisc-linux.org +27 -27 # ncr53c8xx update # # drivers/scsi/ncr53c8xx.c # 2005/03/18 21:36:11-06:00 willy@parisc-linux.org +208 -297 # ncr53c8xx update # # ChangeSet # 2005/03/19 14:53:04-06:00 willy@parisc-linux.org # [PATCH] Zalon updates # # Zalon updates # # - Add KERN_INFO to printk # Signed-off-by: Andrew McGregor # Signed-off-by: Domen Puncer # Signed-off-by: Matthew Wilcox # # - Remove iomem-related warnings # - Improve printk message # - Use cpu_relax() # # Signed-off-by: Matthew Wilcox # Signed-off-by: James Bottomley # # drivers/scsi/zalon.c # 2005/03/18 07:03:07-06:00 willy@parisc-linux.org +11 -12 # Zalon updates # # ChangeSet # 2005/03/19 14:47:37-06:00 willy@parisc-linux.org # [PATCH] Misc Lasi 700 fixes # # Misc Lasi 700 fixes # # - Use the DMA_32BIT_MASK constants when calling dma_set_mask() # # Signed-off-by: Tobias Klauser # Signed-off-by: Matthew Wilcox # # - ioremap fixes # # Signed-off-by: Matthew Wilcox # Signed-off-by: James Bottomley # # drivers/scsi/lasi700.c # 2005/03/18 07:03:01-06:00 willy@parisc-linux.org +4 -2 # Misc Lasi 700 fixes # # ChangeSet # 2005/03/19 14:46:29-06:00 axboe@suse.de # [PATCH] queue <-> sdev reference counting problem # # There is a problem with the way sdev is freed currently. The reason is # really that there is a circular referencing problem: the sdev needs to # hold on to the queue, but the queue (through the request function) also # needs to hold on to the sdev. # # The easiest way to work-around this problem is to kill the sdev # reference in the queue when the sdev is freed. On invocation of # scsi_request_fn(), kill io to this device. # # Signed-off-by: Jens Axboe # Signed-off-by: James Bottomley # # drivers/scsi/scsi_sysfs.c # 2005/03/18 05:32:57-06:00 axboe@suse.de +3 -1 # queue <-> sdev reference counting problem # # drivers/scsi/scsi_lib.c # 2005/03/18 05:33:09-06:00 axboe@suse.de +24 -1 # queue <-> sdev reference counting problem # # ChangeSet # 2005/03/19 14:45:29-06:00 jejb@titanic.il.steeleye.com # atp870u DMA mask fix # # From: Alan Cox # Noted by James Bottomley # # Signed-off-by: Alan Cox # Signed-off-by: James Bottomley # # drivers/scsi/atp870u.c # 2005/03/19 14:45:13-06:00 jejb@titanic.il.steeleye.com +1 -1 # atp870u DMA mask fix # # ChangeSet # 2005/03/19 14:39:40-06:00 jejb@titanic.il.steeleye.com # atp870u: Re-merge cleanups # # From: Alan Cox # # This restores the Adrian Bunk and Al Viro cleanups that got trashed in # the driver update. It also fixes a few formatting glitches and adds # cpu_relax() calls to the polls spinning on the controller/bus. # # Signed-off-by: Alan Cox # Signed-off-by: James Bottomley # # drivers/scsi/atp870u.c # 2005/03/19 14:39:25-06:00 jejb@titanic.il.steeleye.com +224 -115 # atp870u: Re-merge cleanups # diff -Nru a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h --- a/drivers/message/fusion/mptbase.h 2005-03-24 18:17:53 -08:00 +++ b/drivers/message/fusion/mptbase.h 2005-03-24 18:17:53 -08:00 @@ -83,8 +83,8 @@ #define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR #endif -#define MPT_LINUX_VERSION_COMMON "3.01.19" -#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.19" +#define MPT_LINUX_VERSION_COMMON "3.01.20" +#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.20" #define WHAT_MAGIC_STRING "@" "(" "#" ")" #define show_mptmod_ver(s,ver) \ diff -Nru a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c --- a/drivers/message/fusion/mptscsih.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/message/fusion/mptscsih.c 2005-03-24 18:17:53 -08:00 @@ -96,23 +96,26 @@ MODULE_DESCRIPTION(my_NAME); MODULE_LICENSE("GPL"); -#ifdef MODULE -static int dv = MPTSCSIH_DOMAIN_VALIDATION; -module_param(dv, int, 0); -MODULE_PARM_DESC(dv, "DV Algorithm: enhanced = 1, basic = 0 (default=MPTSCSIH_DOMAIN_VALIDATION=1)"); - -static int width = MPTSCSIH_MAX_WIDTH; -module_param(width, int, 0); -MODULE_PARM_DESC(width, "Max Bus Width: wide = 1, narrow = 0 (default=MPTSCSIH_MAX_WIDTH=1)"); - -static ushort factor = MPTSCSIH_MIN_SYNC; -module_param(factor, ushort, 0); -MODULE_PARM_DESC(factor, "Min Sync Factor: (default=MPTSCSIH_MIN_SYNC=0x08)"); - -static int saf_te = MPTSCSIH_SAF_TE; -module_param(saf_te, int, 0); -MODULE_PARM_DESC(saf_te, "Force enabling SEP Processor: (default=MPTSCSIH_SAF_TE=0)"); -#endif +/* Command line args */ +static int mpt_dv = MPTSCSIH_DOMAIN_VALIDATION; +MODULE_PARM(mpt_dv, "i"); +MODULE_PARM_DESC(mpt_dv, " DV Algorithm: enhanced=1, basic=0 (default=MPTSCSIH_DOMAIN_VALIDATION=1)"); + +static int mpt_width = MPTSCSIH_MAX_WIDTH; +MODULE_PARM(mpt_width, "i"); +MODULE_PARM_DESC(mpt_width, " Max Bus Width: wide=1, narrow=0 (default=MPTSCSIH_MAX_WIDTH=1)"); + +static int mpt_factor = MPTSCSIH_MIN_SYNC; +MODULE_PARM(mpt_factor, "h"); +MODULE_PARM_DESC(mpt_factor, " Min Sync Factor (default=MPTSCSIH_MIN_SYNC=0x08)"); + +static int mpt_saf_te = MPTSCSIH_SAF_TE; +MODULE_PARM(mpt_saf_te, "i"); +MODULE_PARM_DESC(mpt_saf_te, " Force enabling SEP Processor: enable=1 (default=MPTSCSIH_SAF_TE=0)"); + +static int mpt_pq_filter = 0; +MODULE_PARM(mpt_pq_filter, "i"); +MODULE_PARM_DESC(mpt_pq_filter, " Enable peripheral qualifier filter: enable=1 (default=0)"); /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ @@ -253,7 +256,6 @@ /* Driver command line structure */ -static struct mptscsih_driver_setup driver_setup; static struct scsi_host_template driver_template; /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ @@ -1224,29 +1226,23 @@ /* Update with the driver setup * values. */ - if (ioc->spi_data.maxBusWidth > - driver_setup.max_width) { - ioc->spi_data.maxBusWidth = - driver_setup.max_width; - } - - if (ioc->spi_data.minSyncFactor < - driver_setup.min_sync_factor) { - ioc->spi_data.minSyncFactor = - driver_setup.min_sync_factor; - } + if (ioc->spi_data.maxBusWidth > mpt_width) + ioc->spi_data.maxBusWidth = mpt_width; + if (ioc->spi_data.minSyncFactor < mpt_factor) + ioc->spi_data.minSyncFactor = mpt_factor; if (ioc->spi_data.minSyncFactor == MPT_ASYNC) { ioc->spi_data.maxSyncOffset = 0; } - ioc->spi_data.Saf_Te = driver_setup.saf_te; + ioc->spi_data.Saf_Te = mpt_saf_te; hd->negoNvram = 0; #ifndef MPTSCSIH_ENABLE_DOMAIN_VALIDATION hd->negoNvram = MPT_SCSICFG_USE_NVRAM; #endif ioc->spi_data.forceDv = 0; + ioc->spi_data.noQas = 0; for (ii=0; ii < MPT_MAX_SCSI_DEVICES; ii++) { ioc->spi_data.dvStatus[ii] = MPT_SCSICFG_NEGOTIATE; @@ -1256,12 +1252,12 @@ ioc->spi_data.dvStatus[ii] |= MPT_SCSICFG_DV_NOT_DONE; - ddvprintk((MYIOC_s_INFO_FMT + dinitprintk((MYIOC_s_INFO_FMT "dv %x width %x factor %x saf_te %x\n", - ioc->name, driver_setup.dv, - driver_setup.max_width, - driver_setup.min_sync_factor, - driver_setup.saf_te)); + ioc->name, mpt_dv, + mpt_width, + mpt_factor, + mpt_saf_te)); } mpt_scsi_hosts++; @@ -1477,18 +1473,6 @@ ": Registered for IOC reset notifications\n")); } -#ifdef MODULE - dinitprintk((KERN_INFO MYNAM - ": Command Line Args: dv=%d max_width=%d " - "factor=0x%x saf_te=%d\n", - dv, width, factor, saf_te)); - - driver_setup.dv = (dv) ? 1 : 0; - driver_setup.max_width = (width) ? 1 : 0; - driver_setup.min_sync_factor = factor; - driver_setup.saf_te = (saf_te) ? 1 : 0;; -#endif - if(mpt_device_driver_register(&mptscsih_driver, MPTSCSIH_DRIVER) != 0 ) { dprintk((KERN_INFO MYNAM @@ -3165,6 +3149,18 @@ dinitprintk((MYIOC_s_INFO_FMT "initTarget bus=%d id=%d lun=%d hd=%p\n", hd->ioc->name, bus_id, target_id, lun, hd)); + /* + * If the peripheral qualifier filter is enabled then if the target reports a 0x1 + * (i.e. The targer is capable of supporting the specified peripheral device type + * on this logical unit; however, the physical device is not currently connected + * to this logical unit) it will be converted to a 0x3 (i.e. The target is not + * capable of supporting a physical device on this logical unit). This is to work + * around a bug in th emid-layer in some distributions in which the mid-layer will + * continue to try to communicate to the LUN and evntually create a dummy LUN. + */ + if (mpt_pq_filter && dlen && (data[0] & 0xE0)) + data[0] |= 0x40; + /* Is LUN supported? If so, upper 2 bits will be 0 * in first byte of inquiry data. */ @@ -5161,7 +5157,7 @@ } ddvprintk((MYIOC_s_NOTE_FMT "DV: Basic test on id=%d completed OK.\n", ioc->name, id)); - if (driver_setup.dv == 0) + if (mpt_dv == 0) goto target_done; inq0 = (*pbuf1) & 0x1F; diff -Nru a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h --- a/drivers/message/fusion/mptscsih.h 2005-03-24 18:17:53 -08:00 +++ b/drivers/message/fusion/mptscsih.h 2005-03-24 18:17:53 -08:00 @@ -91,12 +91,4 @@ #define MPTSCSIH_MIN_SYNC 0x08 #define MPTSCSIH_SAF_TE 0 -struct mptscsih_driver_setup -{ - u8 dv; - u8 max_width; - u8 min_sync_factor; - u8 saf_te; -}; - #endif diff -Nru a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c --- a/drivers/scsi/3w-xxxx.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/3w-xxxx.c 2005-03-24 18:17:53 -08:00 @@ -6,7 +6,7 @@ Arnaldo Carvalho de Melo Brad Strand - Copyright (C) 1999-2004 3ware Inc. + Copyright (C) 1999-2005 3ware Inc. Kernel compatiblity By: Andre Hedrick Non-Copyright (C) 2000 Andre Hedrick @@ -185,6 +185,12 @@ Fix data_buffer_length usage in tw_chrdev_ioctl(). Update contact information. 1.26.02.000 - Convert driver to pci_driver format. + 1.26.02.001 - Increase max ioctl buffer size to 512 sectors. + Make tw_scsi_queue() return 0 for 'Unknown scsi opcode'. + Fix tw_remove() to free irq handler/unregister_chrdev() + before shutting down card. + Change to new 'change_queue_depth' api. + Fix 'handled=1' ISR usage, remove bogus IRQ check. */ #include @@ -207,7 +213,7 @@ #include "3w-xxxx.h" /* Globals */ -#define TW_DRIVER_VERSION "1.26.02.000" +#define TW_DRIVER_VERSION "1.26.02.001" static TW_Device_Extension *tw_device_extension_list[TW_MAX_SLOT]; static int tw_device_extension_count = 0; static int twe_major = -1; @@ -509,33 +515,13 @@ } /* End tw_show_stats() */ /* This function will set a devices queue depth */ -static ssize_t tw_store_queue_depth(struct device *dev, const char *buf, size_t count) +static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth) { - int queue_depth; - struct scsi_device *sdev = to_scsi_device(dev); - - queue_depth = simple_strtoul(buf, NULL, 0); if (queue_depth > TW_Q_LENGTH-2) - return -EINVAL; + queue_depth = TW_Q_LENGTH-2; scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth); - - return count; -} /* End tw_store_queue_depth() */ - -/* Create sysfs 'queue_depth' entry */ -static struct device_attribute tw_queue_depth_attr = { - .attr = { - .name = "queue_depth", - .mode = S_IRUSR | S_IWUSR, - }, - .store = tw_store_queue_depth -}; - -/* Device attributes initializer */ -static struct device_attribute *tw_dev_attrs[] = { - &tw_queue_depth_attr, - NULL, -}; + return queue_depth; +} /* End tw_change_queue_depth() */ /* Create sysfs 'stats' entry */ static struct class_device_attribute tw_host_stats_attr = { @@ -910,7 +896,7 @@ goto out; /* Check size */ - if (data_buffer_length > TW_MAX_SECTORS * 512) { + if (data_buffer_length > TW_MAX_IOCTL_SECTORS * 512) { retval = -EINVAL; goto out; } @@ -995,7 +981,7 @@ timeout = TW_IOCTL_CHRDEV_TIMEOUT*HZ; /* Now wait for the command to complete */ - timeout = wait_event_interruptible_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); + timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); /* See if we reset while waiting for the ioctl to complete */ if (test_bit(TW_IN_RESET, &tw_dev->flags)) { @@ -1004,16 +990,11 @@ goto out2; } - /* Check if we timed out, got a signal, or didn't get - an interrupt */ - if ((timeout <= 0) && (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE)) { + /* We timed out, and didn't get an interrupt */ + if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { /* Now we need to reset the board */ - if (timeout == -ERESTARTSYS) { - retval = timeout; - } else { - printk(KERN_WARNING "3w-xxxx: scsi%d: Character ioctl (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, cmd); - retval = -EIO; - } + printk(KERN_WARNING "3w-xxxx: scsi%d: Character ioctl (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, cmd); + retval = -EIO; spin_lock_irqsave(tw_dev->host->host_lock, flags); tw_dev->state[request_id] = TW_S_COMPLETED; tw_state_request_finish(tw_dev, request_id); @@ -2060,7 +2041,7 @@ tw_state_request_finish(tw_dev, request_id); SCpnt->result = (DID_BAD_TARGET << 16); done(SCpnt); - goto out; + retval = 0; } if (retval) { tw_dev->state[request_id] = TW_S_COMPLETED; @@ -2069,7 +2050,6 @@ done(SCpnt); retval = 0; } -out: return retval; } /* End tw_scsi_queue() */ @@ -2088,183 +2068,180 @@ /* Get the host lock for io completions */ spin_lock(tw_dev->host->host_lock); - /* See if the interrupt matches this instance */ - if (tw_dev->tw_pci_dev->irq == (unsigned int)irq) { + /* Read the registers */ + status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); - handled = 1; + /* Check if this is our interrupt, otherwise bail */ + if (!(status_reg_value & TW_STATUS_VALID_INTERRUPT)) + goto tw_interrupt_bail; - /* Read the registers */ - status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); + handled = 1; - /* Check if this is our interrupt, otherwise bail */ - if (!(status_reg_value & TW_STATUS_VALID_INTERRUPT)) + /* Check controller for errors */ + if (tw_check_bits(status_reg_value)) { + dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Unexpected bits.\n"); + if (tw_decode_bits(tw_dev, status_reg_value, 1)) { + TW_CLEAR_ALL_INTERRUPTS(tw_dev); goto tw_interrupt_bail; - - /* Check controller for errors */ - if (tw_check_bits(status_reg_value)) { - dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Unexpected bits.\n"); - if (tw_decode_bits(tw_dev, status_reg_value, 1)) { - TW_CLEAR_ALL_INTERRUPTS(tw_dev); - goto tw_interrupt_bail; - } } + } - /* Handle host interrupt */ - if (status_reg_value & TW_STATUS_HOST_INTERRUPT) { - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Received host interrupt.\n"); - TW_CLEAR_HOST_INTERRUPT(tw_dev); + /* Handle host interrupt */ + if (status_reg_value & TW_STATUS_HOST_INTERRUPT) { + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Received host interrupt.\n"); + TW_CLEAR_HOST_INTERRUPT(tw_dev); + } + + /* Handle attention interrupt */ + if (status_reg_value & TW_STATUS_ATTENTION_INTERRUPT) { + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Received attention interrupt.\n"); + TW_CLEAR_ATTENTION_INTERRUPT(tw_dev); + tw_state_request_start(tw_dev, &request_id); + error = tw_aen_read_queue(tw_dev, request_id); + if (error) { + printk(KERN_WARNING "3w-xxxx: scsi%d: Error reading aen queue.\n", tw_dev->host->host_no); + tw_dev->state[request_id] = TW_S_COMPLETED; + tw_state_request_finish(tw_dev, request_id); } + } - /* Handle attention interrupt */ - if (status_reg_value & TW_STATUS_ATTENTION_INTERRUPT) { - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Received attention interrupt.\n"); - TW_CLEAR_ATTENTION_INTERRUPT(tw_dev); - tw_state_request_start(tw_dev, &request_id); - error = tw_aen_read_queue(tw_dev, request_id); - if (error) { - printk(KERN_WARNING "3w-xxxx: scsi%d: Error reading aen queue.\n", tw_dev->host->host_no); - tw_dev->state[request_id] = TW_S_COMPLETED; - tw_state_request_finish(tw_dev, request_id); + /* Handle command interrupt */ + if (status_reg_value & TW_STATUS_COMMAND_INTERRUPT) { + /* Drain as many pending commands as we can */ + while (tw_dev->pending_request_count > 0) { + request_id = tw_dev->pending_queue[tw_dev->pending_head]; + if (tw_dev->state[request_id] != TW_S_PENDING) { + printk(KERN_WARNING "3w-xxxx: scsi%d: Found request id that wasn't pending.\n", tw_dev->host->host_no); + break; + } + if (tw_post_command_packet(tw_dev, request_id)==0) { + if (tw_dev->pending_head == TW_Q_LENGTH-1) { + tw_dev->pending_head = TW_Q_START; + } else { + tw_dev->pending_head = tw_dev->pending_head + 1; + } + tw_dev->pending_request_count--; + } else { + /* If we get here, we will continue re-posting on the next command interrupt */ + break; } } + /* If there are no more pending requests, we mask command interrupt */ + if (tw_dev->pending_request_count == 0) + TW_MASK_COMMAND_INTERRUPT(tw_dev); + } + + /* Handle response interrupt */ + if (status_reg_value & TW_STATUS_RESPONSE_INTERRUPT) { + /* Drain the response queue from the board */ + while ((status_reg_value & TW_STATUS_RESPONSE_QUEUE_EMPTY) == 0) { + /* Read response queue register */ + response_que.value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); + request_id = TW_RESID_OUT(response_que.response_id); + command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; + error = 0; - /* Handle command interrupt */ - if (status_reg_value & TW_STATUS_COMMAND_INTERRUPT) { - /* Drain as many pending commands as we can */ - while (tw_dev->pending_request_count > 0) { - request_id = tw_dev->pending_queue[tw_dev->pending_head]; - if (tw_dev->state[request_id] != TW_S_PENDING) { - printk(KERN_WARNING "3w-xxxx: scsi%d: Found request id that wasn't pending.\n", tw_dev->host->host_no); - break; - } - if (tw_post_command_packet(tw_dev, request_id)==0) { - if (tw_dev->pending_head == TW_Q_LENGTH-1) { - tw_dev->pending_head = TW_Q_START; - } else { - tw_dev->pending_head = tw_dev->pending_head + 1; - } - tw_dev->pending_request_count--; + /* Check for bad response */ + if (command_packet->status != 0) { + /* If internal command, don't error, don't fill sense */ + if (tw_dev->srb[request_id] == NULL) { + tw_decode_sense(tw_dev, request_id, 0); } else { - /* If we get here, we will continue re-posting on the next command interrupt */ - break; + error = tw_decode_sense(tw_dev, request_id, 1); } } - /* If there are no more pending requests, we mask command interrupt */ - if (tw_dev->pending_request_count == 0) - TW_MASK_COMMAND_INTERRUPT(tw_dev); - } - - /* Handle response interrupt */ - if (status_reg_value & TW_STATUS_RESPONSE_INTERRUPT) { - /* Drain the response queue from the board */ - while ((status_reg_value & TW_STATUS_RESPONSE_QUEUE_EMPTY) == 0) { - /* Read response queue register */ - response_que.value = inl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev)); - request_id = TW_RESID_OUT(response_que.response_id); - command_packet = (TW_Command *)tw_dev->command_packet_virtual_address[request_id]; - error = 0; - - /* Check for bad response */ - if (command_packet->status != 0) { - /* If internal command, don't error, don't fill sense */ - if (tw_dev->srb[request_id] == NULL) { - tw_decode_sense(tw_dev, request_id, 0); - } else { - error = tw_decode_sense(tw_dev, request_id, 1); - } - } - /* Check for correct state */ - if (tw_dev->state[request_id] != TW_S_POSTED) { - if (tw_dev->srb[request_id] != NULL) { - printk(KERN_WARNING "3w-xxxx: scsi%d: Received a request id that wasn't posted.\n", tw_dev->host->host_no); - error = 1; - } + /* Check for correct state */ + if (tw_dev->state[request_id] != TW_S_POSTED) { + if (tw_dev->srb[request_id] != NULL) { + printk(KERN_WARNING "3w-xxxx: scsi%d: Received a request id that wasn't posted.\n", tw_dev->host->host_no); + error = 1; } + } - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Response queue request id: %d.\n", request_id); + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): Response queue request id: %d.\n", request_id); - /* Check for internal command completion */ - if (tw_dev->srb[request_id] == NULL) { - dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Found internally posted command.\n"); - /* Check for chrdev ioctl completion */ - if (request_id != tw_dev->chrdev_request_id) { - retval = tw_aen_complete(tw_dev, request_id); - if (retval) { - printk(KERN_WARNING "3w-xxxx: scsi%d: Error completing aen.\n", tw_dev->host->host_no); - } - } else { - tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; - wake_up(&tw_dev->ioctl_wqueue); + /* Check for internal command completion */ + if (tw_dev->srb[request_id] == NULL) { + dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Found internally posted command.\n"); + /* Check for chrdev ioctl completion */ + if (request_id != tw_dev->chrdev_request_id) { + retval = tw_aen_complete(tw_dev, request_id); + if (retval) { + printk(KERN_WARNING "3w-xxxx: scsi%d: Error completing aen.\n", tw_dev->host->host_no); } } else { + tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; + wake_up(&tw_dev->ioctl_wqueue); + } + } else { switch (tw_dev->srb[request_id]->cmnd[0]) { - case READ_10: - case READ_6: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught READ_10/READ_6\n"); - break; - case WRITE_10: - case WRITE_6: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught WRITE_10/WRITE_6\n"); - break; - case TEST_UNIT_READY: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught TEST_UNIT_READY\n"); - error = tw_scsiop_test_unit_ready_complete(tw_dev, request_id); - break; - case INQUIRY: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught INQUIRY\n"); - error = tw_scsiop_inquiry_complete(tw_dev, request_id); - break; - case READ_CAPACITY: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught READ_CAPACITY\n"); - error = tw_scsiop_read_capacity_complete(tw_dev, request_id); - break; - case MODE_SENSE: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught MODE_SENSE\n"); - error = tw_scsiop_mode_sense_complete(tw_dev, request_id); - break; - case SYNCHRONIZE_CACHE: - dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught SYNCHRONIZE_CACHE\n"); - break; - default: - printk(KERN_WARNING "3w-xxxx: case slip in tw_interrupt()\n"); - error = 1; - } - - /* If no error command was a success */ - if (error == 0) { - tw_dev->srb[request_id]->result = (DID_OK << 16); - } + case READ_10: + case READ_6: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught READ_10/READ_6\n"); + break; + case WRITE_10: + case WRITE_6: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught WRITE_10/WRITE_6\n"); + break; + case TEST_UNIT_READY: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught TEST_UNIT_READY\n"); + error = tw_scsiop_test_unit_ready_complete(tw_dev, request_id); + break; + case INQUIRY: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught INQUIRY\n"); + error = tw_scsiop_inquiry_complete(tw_dev, request_id); + break; + case READ_CAPACITY: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught READ_CAPACITY\n"); + error = tw_scsiop_read_capacity_complete(tw_dev, request_id); + break; + case MODE_SENSE: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught MODE_SENSE\n"); + error = tw_scsiop_mode_sense_complete(tw_dev, request_id); + break; + case SYNCHRONIZE_CACHE: + dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt(): caught SYNCHRONIZE_CACHE\n"); + break; + default: + printk(KERN_WARNING "3w-xxxx: case slip in tw_interrupt()\n"); + error = 1; + } - /* If error, command failed */ - if (error == 1) { - /* Ask for a host reset */ - tw_dev->srb[request_id]->result = (DID_OK << 16) | (CHECK_CONDITION << 1); - } + /* If no error command was a success */ + if (error == 0) { + tw_dev->srb[request_id]->result = (DID_OK << 16); + } - /* Now complete the io */ - if ((error != TW_ISR_DONT_COMPLETE)) { - tw_dev->state[request_id] = TW_S_COMPLETED; - tw_state_request_finish(tw_dev, request_id); - tw_dev->posted_request_count--; - tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); + /* If error, command failed */ + if (error == 1) { + /* Ask for a host reset */ + tw_dev->srb[request_id]->result = (DID_OK << 16) | (CHECK_CONDITION << 1); + } - tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]); - } + /* Now complete the io */ + if ((error != TW_ISR_DONT_COMPLETE)) { + tw_dev->state[request_id] = TW_S_COMPLETED; + tw_state_request_finish(tw_dev, request_id); + tw_dev->posted_request_count--; + tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); + + tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]); } + } - /* Check for valid status after each drain */ - status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); - if (tw_check_bits(status_reg_value)) { - dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Unexpected bits.\n"); - if (tw_decode_bits(tw_dev, status_reg_value, 1)) { - TW_CLEAR_ALL_INTERRUPTS(tw_dev); - goto tw_interrupt_bail; - } + /* Check for valid status after each drain */ + status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev)); + if (tw_check_bits(status_reg_value)) { + dprintk(KERN_WARNING "3w-xxxx: tw_interrupt(): Unexpected bits.\n"); + if (tw_decode_bits(tw_dev, status_reg_value, 1)) { + TW_CLEAR_ALL_INTERRUPTS(tw_dev); + goto tw_interrupt_bail; } } } } + tw_interrupt_bail: spin_unlock(tw_dev->host->host_lock); return IRQ_RETVAL(handled); @@ -2304,6 +2281,7 @@ .queuecommand = tw_scsi_queue, .eh_host_reset_handler = tw_scsi_eh_reset, .bios_param = tw_scsi_biosparam, + .change_queue_depth = tw_change_queue_depth, .can_queue = TW_Q_LENGTH-2, .this_id = -1, .sg_tablesize = TW_MAX_SGL_LENGTH, @@ -2311,7 +2289,6 @@ .cmd_per_lun = TW_MAX_CMDS_PER_LUN, .use_clustering = ENABLE_CLUSTERING, .shost_attrs = tw_host_attrs, - .sdev_attrs = tw_dev_attrs, .emulated = 1 }; @@ -2438,22 +2415,23 @@ scsi_remove_host(tw_dev->host); - __tw_shutdown(tw_dev); + /* Unregister character device */ + if (twe_major >= 0) { + unregister_chrdev(twe_major, "twe"); + twe_major = -1; + } /* Free up the IRQ */ free_irq(tw_dev->tw_pci_dev->irq, tw_dev); + /* Shutdown the card */ + __tw_shutdown(tw_dev); + /* Free up the mem region */ pci_release_regions(pdev); /* Free up device extension resources */ tw_free_device_extension(tw_dev); - - /* Unregister character device */ - if (twe_major >= 0) { - unregister_chrdev(twe_major, "twe"); - twe_major = -1; - } scsi_host_put(tw_dev->host); pci_disable_device(pdev); diff -Nru a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h --- a/drivers/scsi/3w-xxxx.h 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/3w-xxxx.h 2005-03-24 18:17:53 -08:00 @@ -6,7 +6,7 @@ Arnaldo Carvalho de Melo Brad Strand - Copyright (C) 1999-2004 3ware Inc. + Copyright (C) 1999-2005 3ware Inc. Kernel compatiblity By: Andre Hedrick Non-Copyright (C) 2000 Andre Hedrick @@ -227,6 +227,7 @@ #define TW_IN_RESET 2 #define TW_IN_CHRDEV_IOCTL 3 #define TW_MAX_SECTORS 256 +#define TW_MAX_IOCTL_SECTORS 512 #define TW_AEN_WAIT_TIME 1000 #define TW_IOCTL_WAIT_TIME (1 * HZ) /* 1 second */ #define TW_ISR_DONT_COMPLETE 2 diff -Nru a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c --- a/drivers/scsi/53c700.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/53c700.c 2005-03-24 18:17:53 -08:00 @@ -167,7 +167,6 @@ #include "53c700_d.h" -STATIC irqreturn_t NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs); STATIC int NCR_700_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt); STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt); @@ -297,8 +296,7 @@ struct Scsi_Host * NCR_700_detect(struct scsi_host_template *tpnt, - struct NCR_700_Host_Parameters *hostdata, struct device *dev, - unsigned long irq, u8 scsi_id) + struct NCR_700_Host_Parameters *hostdata, struct device *dev) { dma_addr_t pScript, pSlots; __u8 *memory; @@ -394,8 +392,6 @@ host->unique_id = hostdata->base; host->base = hostdata->base; hostdata->eh_complete = NULL; - host->irq = irq; - host->this_id = scsi_id; host->hostdata[0] = (unsigned long)hostdata; /* kick the chip */ NCR_700_writeb(0xff, host, CTEST9_REG); @@ -416,28 +412,16 @@ /* reset the chip */ NCR_700_chip_reset(host); - if (request_irq(irq, NCR_700_intr, SA_SHIRQ, dev->bus_id, host)) { - dev_printk(KERN_ERR, dev, "53c700: irq %lu request failed\n ", - irq); - goto out_put_host; - } - if (scsi_add_host(host, dev)) { dev_printk(KERN_ERR, dev, "53c700: scsi_add_host failed\n"); - goto out_release_irq; + scsi_host_put(host); + return NULL; } spi_signalling(host) = hostdata->differential ? SPI_SIGNAL_HVD : SPI_SIGNAL_SE; return host; - - out_release_irq: - free_irq(irq, host); - out_put_host: - scsi_host_put(host); - - return NULL; } int @@ -1489,7 +1473,7 @@ return 1; } -STATIC irqreturn_t +irqreturn_t NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) { struct Scsi_Host *host = (struct Scsi_Host *)dev_id; @@ -2164,6 +2148,7 @@ EXPORT_SYMBOL(NCR_700_detect); EXPORT_SYMBOL(NCR_700_release); +EXPORT_SYMBOL(NCR_700_intr); static struct spi_function_template NCR_700_transport_functions = { .set_period = NCR_700_set_period, diff -Nru a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h --- a/drivers/scsi/53c700.h 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/53c700.h 2005-03-24 18:17:53 -08:00 @@ -60,9 +60,9 @@ /* These are the externally used routines */ struct Scsi_Host *NCR_700_detect(struct scsi_host_template *, - struct NCR_700_Host_Parameters *, struct device *, - unsigned long, u8); + struct NCR_700_Host_Parameters *, struct device *); int NCR_700_release(struct Scsi_Host *host); +irqreturn_t NCR_700_intr(int, void *, struct pt_regs *); enum NCR_700_Host_State { diff -Nru a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c --- a/drivers/scsi/NCR_D700.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/NCR_D700.c 2005-03-24 18:17:53 -08:00 @@ -97,6 +97,7 @@ #include #include #include +#include #include #include #include @@ -168,11 +169,13 @@ struct NCR_D700_private { struct device *dev; struct Scsi_Host *hosts[2]; + char name[30]; + char pad; }; static int -NCR_D700_probe_one(struct NCR_D700_private *p, int siop, - int irq, int slot, u32 region, int differential) +NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, + int slot, u32 region, int differential) { struct NCR_700_Host_Parameters *hostdata; struct Scsi_Host *host; @@ -201,18 +204,18 @@ NCR_700_set_io_mapped(hostdata); /* and register the siop */ - host = NCR_700_detect(&NCR_D700_driver_template, hostdata, - p->dev, irq, - /* FIXME: read this from SUS */ - id_array[slot * 2 + siop]); + host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev); if (!host) { ret = -ENOMEM; goto detect_failed; } + p->hosts[siop] = host; + /* FIXME: read this from SUS */ + host->this_id = id_array[slot * 2 + siop]; + host->irq = irq; scsi_scan_host(host); - p->hosts[siop] = host; return 0; detect_failed: @@ -223,6 +226,20 @@ return ret; } +static int +NCR_D700_intr(int irq, void *data, struct pt_regs *regs) +{ + struct NCR_D700_private *p = (struct NCR_D700_private *)data; + int i, found = 0; + + for (i = 0; i < 2; i++) + if (p->hosts[i] && + NCR_700_intr(irq, p->hosts[i], regs) == IRQ_HANDLED) + found++; + + return found ? IRQ_HANDLED : IRQ_NONE; +} + /* Detect a D700 card. Note, because of the setup --- the chips are * essentially connectecd to the MCA bus independently, it is easier * to set them up as two separate host adapters, rather than one @@ -301,13 +318,19 @@ p = kmalloc(sizeof(*p), GFP_KERNEL); if (!p) return -ENOMEM; + memset(p, '\0', sizeof(*p)); p->dev = dev; - + snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id); + if (request_irq(irq, NCR_D700_intr, SA_SHIRQ, p->name, p)) { + printk(KERN_ERR "D700: request_irq failed\n"); + kfree(p); + return -EBUSY; + } /* plumb in both 700 chips */ for (i = 0; i < 2; i++) { int err; - if ((err = NCR_D700_probe_one(p, i, irq, slot, + if ((err = NCR_D700_probe_one(p, i, slot, irq, offset_addr + (0x80 * i), differential)) != 0) printk("D700: SIOP%d: probe failed, error = %d\n", diff -Nru a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c --- a/drivers/scsi/NCR_Q720.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/NCR_Q720.c 2005-03-24 18:17:53 -08:00 @@ -225,7 +225,7 @@ /* The first 1k of the memory buffer is a memory map of the registers */ - mem_base = (__u32)dma_mark_declared_memory_occupied(dev, base_addr, + mem_base = dma_mark_declared_memory_occupied(dev, base_addr, 1024); if (IS_ERR(mem_base)) { printk("NCR_Q720 failed to reserve memory mapped region\n"); diff -Nru a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c --- a/drivers/scsi/atp870u.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/atp870u.c 2005-03-24 18:17:53 -08:00 @@ -39,9 +39,9 @@ #include "atp870u.h" static struct scsi_host_template atp870u_template; -void send_s870(struct atp_unit *dev,unsigned char c); -void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c); -void tscam_885(void); +static void send_s870(struct atp_unit *dev,unsigned char c); +static void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c); +static void tscam_885(void); static irqreturn_t atp870u_intr_handle(int irq, void *dev_id, struct pt_regs *regs) { @@ -364,7 +364,7 @@ } outb(j, tmport); while ((inb(tmport) & 0x01) != j) { - outb(j,tmport); + outb(j,tmport); } if (dev->id[c][target_id].last_len == 0) { tmport = workport + 0x18; @@ -491,7 +491,7 @@ /* * Clear it off the queue */ - dev->id[c][target_id].curr_req = 0; + dev->id[c][target_id].curr_req = NULL; dev->working[c]--; spin_unlock_irqrestore(dev->host->host_lock, flags); /* @@ -614,7 +614,8 @@ * * Queue a command to the ATP queue. Called with the host lock held. */ -int atp870u_queuecommand(struct scsi_cmnd * req_p, void (*done) (struct scsi_cmnd *)) +static int atp870u_queuecommand(struct scsi_cmnd * req_p, + void (*done) (struct scsi_cmnd *)) { unsigned char c; unsigned int tmport,m; @@ -711,7 +712,7 @@ * * Caller holds the host lock. */ -void send_s870(struct atp_unit *dev,unsigned char c) +static void send_s870(struct atp_unit *dev,unsigned char c) { unsigned int tmport; struct scsi_cmnd *workreq; @@ -821,9 +822,9 @@ } outb(j, tmport); while ((inb(tmport) & 0x01) != j) { - outb(j,tmport); + outb(j,tmport); #ifdef ED_DBGP - printk("send_s870 while loop 1\n"); + printk("send_s870 while loop 1\n"); #endif } /* @@ -946,18 +947,18 @@ #ifdef ED_DBGP printk("1. bttl %x, l %x\n",bttl, l); #endif - while (l > 0x10000) { - (((u16 *) (prd))[i + 3]) = 0x0000; - (((u16 *) (prd))[i + 2]) = 0x0000; - (((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl); - l -= 0x10000; - bttl += 0x10000; - i += 0x04; - } + while (l > 0x10000) { + (((u16 *) (prd))[i + 3]) = 0x0000; + (((u16 *) (prd))[i + 2]) = 0x0000; (((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl); - (((u16 *) (prd))[i + 2]) = cpu_to_le16(l); - (((u16 *) (prd))[i + 3]) = 0; - i += 0x04; + l -= 0x10000; + bttl += 0x10000; + i += 0x04; + } + (((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl); + (((u16 *) (prd))[i + 2]) = cpu_to_le16(l); + (((u16 *) (prd))[i + 3]) = 0; + i += 0x04; } (((u16 *) (prd))[i - 1]) = cpu_to_le16(0x8000); #ifdef ED_DBGP @@ -1174,7 +1175,8 @@ outb(0x09, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; k = inb(tmport); if (k != 0x16) { @@ -1245,7 +1247,8 @@ tmport += 0x03; outb(0x09, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0); + while ((inb(tmport) & 0x80) == 0) + cpu_relax(); tmport -= 0x08; inb(tmport); return; @@ -1341,7 +1344,7 @@ } -void is870(struct atp_unit *dev, unsigned int wkport) +static void is870(struct atp_unit *dev, unsigned int wkport) { unsigned int tmport; unsigned char i, j, k, rmb, n; @@ -1401,12 +1404,16 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + dev->active_id[0] |= m; tmport = wkport + 0x10; @@ -1418,7 +1425,8 @@ tmport = wkport + 0x18; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -1444,16 +1452,21 @@ tmport += 0x03; outb(inqd[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + tmport = wkport + 0x1b; - if (dev->chip_ver == 4) { + if (dev->chip_ver == 4) outb(0x00, tmport); - } + tmport = wkport + 0x18; outb(0x08, tmport); tmport += 0x07; @@ -1483,7 +1496,10 @@ tmport += 0x03; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; if (inb(tmport) != 0x16) { goto sel_ok; @@ -1523,12 +1539,16 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + try_wide: j = 0; tmport = wkport + 0x14; @@ -1545,7 +1565,10 @@ } } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport) & 0x0f; if (j == 0x0f) { goto widep_in; @@ -1618,7 +1641,10 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -1672,12 +1698,16 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + try_sync: j = 0; tmport = wkport + 0x14; @@ -1702,7 +1732,10 @@ } } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport) & 0x0f; if (j == 0x0f) { goto phase_ins; @@ -1760,7 +1793,10 @@ goto phase_ins1; } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport); if (j == 0x85) { goto tar_dcons; @@ -1785,7 +1821,10 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -1885,12 +1924,16 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + dev->active_id[0] |= m; tmport = wkport + 0x50; @@ -1902,7 +1945,10 @@ tmport = wkport + 0x58; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -1928,12 +1974,17 @@ tmport += 0x03; outb(inqd[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + tmport = wkport + 0x5b; outb(0x00, tmport); tmport = wkport + 0x58; @@ -1965,11 +2016,13 @@ tmport += 0x03; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if (inb(tmport) != 0x16) { + if (inb(tmport) != 0x16) goto sel_ok; - } + inq_ok: mbuf[36] = 0; printk(KERN_INFO " ID: %2d %s\n", i, &mbuf[8]); @@ -2010,12 +2063,17 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + try_u3: j = 0; tmport = wkport + 0x54; @@ -2032,7 +2090,10 @@ } } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport) & 0x0f; if (j == 0x0f) { goto u3p_in; @@ -2105,7 +2166,10 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -2151,12 +2215,16 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; - if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { + if (inb(tmport) != 0x11 && inb(tmport) != 0x8e) continue; - } - while (inb(tmport) != 0x8e); + + while (inb(tmport) != 0x8e) + cpu_relax(); + try_wide: j = 0; tmport = wkport + 0x54; @@ -2173,7 +2241,9 @@ } } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport) & 0x0f; if (j == 0x0f) { goto widep_in; @@ -2246,7 +2316,10 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -2313,12 +2386,16 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { continue; } - while (inb(tmport) != 0x8e); + while (inb(tmport) != 0x8e) + cpu_relax(); + try_sync: j = 0; tmport = wkport + 0x54; @@ -2347,7 +2424,10 @@ } } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport) & 0x0f; if (j == 0x0f) { goto phase_ins; @@ -2405,7 +2485,10 @@ goto phase_ins1; } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + j = inb(tmport); if (j == 0x85) { goto tar_dcons; @@ -2430,7 +2513,10 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); + tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -2544,7 +2630,7 @@ if (pci_enable_device(pdev)) return -EIO; - if (!pci_set_dma_mask(pdev, 0xFFFFFFUL)) { + if (!pci_set_dma_mask(pdev, 0xFFFFFFFFUL)) { printk(KERN_INFO "atp870u: use 32bit DMA mask.\n"); } else { printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); @@ -2822,7 +2908,10 @@ tmport += 0x18; outb(0, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0); + + while ((inb(tmport) & 0x80) == 0) + cpu_relax(); + tmport -= 0x08; inb(tmport); tmport = base_io + 0x81; @@ -2840,7 +2929,10 @@ tmport += 0x18; outb(0, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0); + + while ((inb(tmport) & 0x80) == 0) + cpu_relax(); + tmport -= 0x08; inb(tmport); tmport = base_io + 0xc1; @@ -3005,7 +3097,7 @@ it is available to be used again. Until this gets worked out, we will leave it commented out. */ -int atp870u_abort(struct scsi_cmnd * SCpnt) +static int atp870u_abort(struct scsi_cmnd * SCpnt) { unsigned char j, k, c; struct scsi_cmnd *workrequ; @@ -3044,7 +3136,7 @@ return SUCCESS; } -const char *atp870u_info(struct Scsi_Host *notused) +static const char *atp870u_info(struct Scsi_Host *notused) { static char buffer[128]; @@ -3053,13 +3145,9 @@ return buffer; } -int atp870u_set_info(char *buffer, int length, struct Scsi_Host *HBAptr) -{ - return -ENOSYS; /* Currently this is a no-op */ -} - #define BLS buffer + len + size -int atp870u_proc_info(struct Scsi_Host *HBAptr, char *buffer, char **start, off_t offset, int length, int inout) +int atp870u_proc_info(struct Scsi_Host *HBAptr, char *buffer, + char **start, off_t offset, int length, int inout) { static u8 buff[512]; int size = 0; @@ -3068,10 +3156,9 @@ off_t pos = 0; if (inout) - return -ENOSYS; - if (offset == 0) { + return -EINVAL; + if (offset == 0) memset(buff, 0, sizeof(buff)); - } size += sprintf(BLS, "ACARD AEC-671X Driver Version: 2.6+ac\n"); len += size; pos = begin + len; @@ -3188,7 +3275,7 @@ pci_unregister_driver(&atp870u_driver); } -void tscam_885(void) +static void tscam_885(void) { unsigned char i; @@ -3200,7 +3287,7 @@ -void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c) +static void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c) { unsigned int tmport; unsigned char i, j, k, rmb, n, lvdmode; @@ -3255,12 +3342,14 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { continue; } - while (inb(tmport) != 0x8e); + while (inb(tmport) != 0x8e) + cpu_relax(); dev->active_id[c] |= m; tmport = wkport + 0x10; @@ -3272,7 +3361,8 @@ tmport = wkport + 0x18; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -3298,12 +3388,14 @@ tmport += 0x03; outb(inqd[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { continue; } - while (inb(tmport) != 0x8e); + while (inb(tmport) != 0x8e) + cpu_relax(); tmport = wkport + 0x1b; outb(0x00, tmport); tmport = wkport + 0x18; @@ -3335,7 +3427,8 @@ tmport += 0x03; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; if (inb(tmport) != 0x16) { goto sel_ok; @@ -3379,12 +3472,14 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { continue; } - while (inb(tmport) != 0x8e); + while (inb(tmport) != 0x8e) + cpu_relax(); try_u3: j = 0; tmport = wkport + 0x14; @@ -3399,9 +3494,11 @@ outb(u3[j++], tmport); tmport += 0x06; } + cpu_relax(); } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); j = inb(tmport) & 0x0f; if (j == 0x0f) { goto u3p_in; @@ -3423,6 +3520,7 @@ outb(0, tmport); tmport += 0x06; } + cpu_relax(); } tmport -= 0x08; j = inb(tmport) & 0x0f; @@ -3493,14 +3591,14 @@ goto chg_wide; } if (mbuf[3] == 0x09) { - m = 1; - m = m << i; - dev->wide_id[c] |= m; - dev->id[c][i].devsp = 0xce; + m = 1; + m = m << i; + dev->wide_id[c] |= m; + dev->id[c][i].devsp = 0xce; #ifdef ED_DBGP - printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp); + printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp); #endif - continue; + continue; } chg_wide: tmport = wkport + 0x1b; @@ -3523,12 +3621,14 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { continue; } - while (inb(tmport) != 0x8e); + while (inb(tmport) != 0x8e) + cpu_relax(); try_wide: j = 0; tmport = wkport + 0x14; @@ -3543,9 +3643,11 @@ outb(wide[j++], tmport); tmport += 0x06; } + cpu_relax(); } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); j = inb(tmport) & 0x0f; if (j == 0x0f) { goto widep_in; @@ -3567,6 +3669,7 @@ outb(0, tmport); tmport += 0x06; } + cpu_relax(); } tmport -= 0x08; j = inb(tmport) & 0x0f; @@ -3618,7 +3721,8 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; j = inb(tmport); if (j != 0x16) { @@ -3686,12 +3790,14 @@ outb(satn[8], tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) { continue; } - while (inb(tmport) != 0x8e); + while (inb(tmport) != 0x8e) + cpu_relax(); try_sync: j = 0; tmport = wkport + 0x14; @@ -3720,7 +3826,8 @@ } } tmport -= 0x08; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); j = inb(tmport) & 0x0f; if (j == 0x0f) { goto phase_ins; @@ -3742,6 +3849,7 @@ outb(0x00, tmport); tmport += 0x06; } + cpu_relax(); } tmport -= 0x08; j = inb(tmport); @@ -3803,7 +3911,8 @@ tmport += 0x04; outb(0x08, tmport); tmport += 0x07; - while ((inb(tmport) & 0x80) == 0x00); + while ((inb(tmport) & 0x80) == 0x00) + cpu_relax(); tmport -= 0x08; j = inb(tmport); if (j != 0x16) { diff -Nru a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c --- a/drivers/scsi/lasi700.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/lasi700.c 2005-03-24 18:17:53 -08:00 @@ -111,8 +111,8 @@ memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); hostdata->dev = &dev->dev; - dma_set_mask(&dev->dev, 0xffffffffUL); - hostdata->base = base; + dma_set_mask(&dev->dev, DMA_32BIT_MASK); + hostdata->base = ioremap(base, 0x100); hostdata->differential = 0; if (dev->id.sversion == LASI_700_SVERSION) { @@ -127,17 +127,25 @@ NCR_700_set_mem_mapped(hostdata); - host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev, - dev->irq, 7); + host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev); if (!host) goto out_kfree; + host->this_id = 7; + host->irq = dev->irq; + if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) { + printk(KERN_ERR "lasi700: request_irq failed!\n"); + goto out_put_host; + } dev_set_drvdata(&dev->dev, host); scsi_scan_host(host); return 0; + out_put_host: + scsi_host_put(host); out_kfree: + iounmap(hostdata->base); kfree(hostdata); return -ENODEV; } @@ -152,6 +160,7 @@ scsi_remove_host(host); NCR_700_release(host); free_irq(host->irq, host); + iounmap(hostdata->base); kfree(hostdata); return 0; diff -Nru a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c --- a/drivers/scsi/ncr53c8xx.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/ncr53c8xx.c 2005-03-24 18:17:53 -08:00 @@ -86,7 +86,7 @@ */ /* Name and version of the driver */ -#define SCSI_NCR_DRIVER_NAME "ncr53c8xx-3.4.3f" +#define SCSI_NCR_DRIVER_NAME "ncr53c8xx-3.4.3g" #define SCSI_NCR_DEBUG_FLAGS (0) @@ -1219,7 +1219,7 @@ static struct lcb * ncr_setup_lcb (struct ncb *np, struct scsi_device *sdev); static void ncr_getclock (struct ncb *np, int mult); static void ncr_selectclock (struct ncb *np, u_char scntl3); -static struct ccb *ncr_get_ccb (struct ncb *np, u_char tn, u_char ln); +static struct ccb *ncr_get_ccb (struct ncb *np, struct scsi_cmnd *cmd); static void ncr_chip_reset (struct ncb *np, int delay); static void ncr_init (struct ncb *np, int reset, char * msg, u_long code); static int ncr_int_sbmc (struct ncb *np); @@ -1238,8 +1238,6 @@ static void ncr_setsync (struct ncb *np, struct ccb *cp, u_char scntl3, u_char sxfer); static void ncr_setup_tags (struct ncb *np, struct scsi_device *sdev); static void ncr_setwide (struct ncb *np, struct ccb *cp, u_char wide, u_char ack); -static int ncr_show_msg (u_char * msg); -static void ncr_print_msg (struct ccb *cp, char *label, u_char *msg); static int ncr_snooptest (struct ncb *np); static void ncr_timeout (struct ncb *np); static void ncr_wakeup (struct ncb *np, u_long code); @@ -2746,7 +2744,7 @@ for (i=0; itryloop + sizeof (scrh->tryloop)); @@ -2771,7 +2769,7 @@ *p++ =PADDR (dispatch); *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN; *p++ =offsetof (struct dsb, data[i]); - }; + } BUG_ON((u_long)p != (u_long)&scrh->hdata_in + sizeof (scrh->hdata_in)); @@ -2781,7 +2779,7 @@ *p++ =PADDR (dispatch); *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN; *p++ =offsetof (struct dsb, data[i]); - }; + } BUG_ON((u_long)p != (u_long)&scr->data_in + sizeof (scr->data_in)); @@ -2791,7 +2789,7 @@ *p++ =PADDR (dispatch); *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT; *p++ =offsetof (struct dsb, data[i]); - }; + } BUG_ON((u_long)p != (u_long)&scrh->hdata_out + sizeof (scrh->hdata_out)); @@ -2801,7 +2799,7 @@ *p++ =PADDR (dispatch); *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT; *p++ =offsetof (struct dsb, data[i]); - }; + } BUG_ON((u_long) p != (u_long)&scr->data_out + sizeof (scr->data_out)); } @@ -2842,7 +2840,7 @@ printk (KERN_ERR "%s: ERROR0 IN SCRIPT at %d.\n", ncr_name(np), (int) (src-start-1)); mdelay(1000); - }; + } if (DEBUG_FLAGS & DEBUG_SCRIPT) printk (KERN_DEBUG "%p: <%x>\n", @@ -2911,7 +2909,7 @@ default: relocs = 0; break; - }; + } if (relocs) { while (relocs--) { @@ -2958,7 +2956,7 @@ } else *dst++ = cpu_to_scr(*src++); - }; + } } /* @@ -2969,25 +2967,25 @@ struct ncb *ncb; }; -/* -** Print something which allows to retrieve the controller type, unit, -** target, lun concerned by a kernel message. -*/ +#define PRINT_ADDR(cmd, arg...) dev_info(&cmd->device->sdev_gendev , ## arg) -static void PRINT_TARGET(struct ncb *np, int target) +static void ncr_print_msg(struct ccb *cp, char *label, u_char *msg) { - printk(KERN_INFO "%s-<%d,*>: ", ncr_name(np), target); -} + int i; + PRINT_ADDR(cp->cmd, "%s: ", label); -static void PRINT_LUN(struct ncb *np, int target, int lun) -{ - printk(KERN_INFO "%s-<%d,%d>: ", ncr_name(np), target, lun); -} + printk ("%x",*msg); + if (*msg == M_EXTENDED) { + for (i = 1; i < 8; i++) { + if (i - 1 > msg[1]) + break; + printk ("-%x",msg[i]); + } + } else if ((*msg & 0xf0) == 0x20) { + printk ("-%x",msg[1]); + } -static void PRINT_ADDR(struct scsi_cmnd *cmd) -{ - struct host_data *host_data = (struct host_data *) cmd->device->host->hostdata; - PRINT_LUN(host_data->ncb, cmd->device->id, cmd->device->lun); + printk(".\n"); } /*========================================================== @@ -3280,6 +3278,7 @@ tp->usrsync = driver_setup.default_sync; tp->usrwide = driver_setup.max_wide; tp->usrtags = MAX_TAGS; + tp->period = 0xffff; if (!driver_setup.disconnection) np->target[i].usrflag = UF_NODISC; } @@ -3369,34 +3368,23 @@ int nego = 0; struct scsi_target *starget = tp->starget; - if (likely(starget)) { - - /* - ** negotiate wide transfers ? - */ - - if (!tp->widedone) { - if (spi_support_wide(starget)) { - nego = NS_WIDE; - } else - tp->widedone=1; - - }; - - /* - ** negotiate synchronous transfers? - */ + /* negotiate wide transfers ? */ + if (!tp->widedone) { + if (spi_support_wide(starget)) { + nego = NS_WIDE; + } else + tp->widedone=1; + } - if (!nego && !tp->period) { - if (spi_support_sync(starget)) { - nego = NS_SYNC; - } else { - tp->period =0xffff; - PRINT_TARGET(np, cp->target); - printk ("target did not report SYNC.\n"); - }; - }; - }; + /* negotiate synchronous transfers? */ + if (!nego && !tp->period) { + if (spi_support_sync(starget)) { + nego = NS_SYNC; + } else { + tp->period =0xffff; + dev_info(&starget->dev, "target did not report SYNC.\n"); + } + } switch (nego) { case NS_SYNC: @@ -3412,7 +3400,7 @@ msgptr[msglen++] = M_X_WIDE_REQ; msgptr[msglen++] = tp->usrwide; break; - }; + } cp->nego_status = nego; @@ -3421,8 +3409,8 @@ if (DEBUG_FLAGS & DEBUG_NEGO) { ncr_print_msg(cp, nego == NS_WIDE ? "wide msgout":"sync_msgout", msgptr); - }; - }; + } + } return msglen; } @@ -3440,9 +3428,9 @@ */ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd) { -/* struct scsi_device *device = cmd->device; */ - struct tcb *tp = &np->target[cmd->device->id]; - struct lcb *lp = tp->lp[cmd->device->lun]; + struct scsi_device *sdev = cmd->device; + struct tcb *tp = &np->target[sdev->id]; + struct lcb *lp = tp->lp[sdev->lun]; struct ccb *cp; int segments; @@ -3457,9 +3445,9 @@ ** **--------------------------------------------- */ - if ((cmd->device->id == np->myaddr ) || - (cmd->device->id >= MAX_TARGET) || - (cmd->device->lun >= MAX_LUN )) { + if ((sdev->id == np->myaddr ) || + (sdev->id >= MAX_TARGET) || + (sdev->lun >= MAX_LUN )) { return(DID_BAD_TARGET); } @@ -3479,8 +3467,7 @@ } if (DEBUG_FLAGS & DEBUG_TINY) { - PRINT_ADDR(cmd); - printk ("CMD=%x ", cmd->cmnd[0]); + PRINT_ADDR(cmd, "CMD=%x ", cmd->cmnd[0]); } /*--------------------------------------------------- @@ -3499,7 +3486,7 @@ np->settle_time = tlimit; } - if (np->settle_time || !(cp=ncr_get_ccb (np, cmd->device->id, cmd->device->lun))) { + if (np->settle_time || !(cp=ncr_get_ccb (np, cmd))) { insert_into_waiting_list(np, cmd); return(DID_OK); } @@ -3512,7 +3499,7 @@ **---------------------------------------------------- */ - idmsg = M_IDENTIFY | cmd->device->lun; + idmsg = M_IDENTIFY | sdev->lun; if (cp ->tag != NO_TAG || (cp != np->ccb && np->disc && !(tp->usrflag & UF_NODISC))) @@ -3533,8 +3520,8 @@ if (lp->tags_smap) { order = M_ORDERED_TAG; if ((DEBUG_FLAGS & DEBUG_TAGS)||bootverbose>2){ - PRINT_ADDR(cmd); - printk("ordered tag forced.\n"); + PRINT_ADDR(cmd, + "ordered tag forced.\n"); } } lp->tags_stime = ktime_get(3*HZ); @@ -3682,7 +3669,7 @@ /* ** select */ - cp->phys.select.sel_id = cmd->device->id; + cp->phys.select.sel_id = sdev->id; cp->phys.select.sel_scntl3 = tp->wval; cp->phys.select.sel_sxfer = tp->sval; /* @@ -3719,9 +3706,7 @@ **---------------------------------------------------- */ - /* - ** activate this job. - */ + /* activate this job. */ cp->magic = CCB_MAGIC; /* @@ -3734,11 +3719,9 @@ else ncr_put_start_queue(np, cp); - /* - ** Command is successfully queued. - */ + /* Command is successfully queued. */ - return(DID_OK); + return DID_OK; } @@ -4203,8 +4186,7 @@ */ if (cp->parity_status > 1) { - PRINT_ADDR(cmd); - printk ("%d parity error(s).\n",cp->parity_status); + PRINT_ADDR(cmd, "%d parity error(s).\n",cp->parity_status); } /* @@ -4212,16 +4194,16 @@ */ if (cp->xerr_status != XE_OK) { - PRINT_ADDR(cmd); switch (cp->xerr_status) { case XE_EXTRA_DATA: - printk ("extraneous data discarded.\n"); + PRINT_ADDR(cmd, "extraneous data discarded.\n"); break; case XE_BAD_PHASE: - printk ("invalid scsi phase (4/5).\n"); + PRINT_ADDR(cmd, "invalid scsi phase (4/5).\n"); break; default: - printk ("extended error %d.\n", cp->xerr_status); + PRINT_ADDR(cmd, "extended error %d.\n", + cp->xerr_status); break; } if (cp->host_status==HS_COMPLETE) @@ -4233,9 +4215,9 @@ */ if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) { if (cp->host_status!=HS_COMPLETE || cp->scsi_status!=S_GOOD) { - PRINT_ADDR(cmd); - printk ("ERROR: cmd=%x host_status=%x scsi_status=%x\n", - cmd->cmnd[0], cp->host_status, cp->scsi_status); + PRINT_ADDR(cmd, "ERROR: cmd=%x host_status=%x " + "scsi_status=%x\n", cmd->cmnd[0], + cp->host_status, cp->scsi_status); } } @@ -4296,8 +4278,7 @@ if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) { u_char * p = (u_char*) & cmd->sense_buffer; int i; - PRINT_ADDR(cmd); - printk ("sense data:"); + PRINT_ADDR(cmd, "sense data:"); for (i=0; i<14; i++) printk (" %x", *p++); printk (".\n"); } @@ -4344,8 +4325,7 @@ /* ** Other protocol messes */ - PRINT_ADDR(cmd); - printk ("COMMAND FAILED (%x %x) @%p.\n", + PRINT_ADDR(cmd, "COMMAND FAILED (%x %x) @%p.\n", cp->host_status, cp->scsi_status, cp); cmd->result = ScsiResult(DID_ERROR, cp->scsi_status); @@ -4358,8 +4338,7 @@ if (tp->usrflag & UF_TRACE) { u_char * p; int i; - PRINT_ADDR(cmd); - printk (" CMD:"); + PRINT_ADDR(cmd, " CMD:"); p = (u_char*) &cmd->cmnd[0]; for (i=0; icmd_len; i++) printk (" %x", *p++); @@ -4667,12 +4646,11 @@ } else tp->usrsync = 255; - }; + } if (tp->usrwide > np->maxwide) tp->usrwide = np->maxwide; - ncr_negotiate (np, tp); } /* @@ -4849,7 +4827,7 @@ #endif cp->phys.select.sel_scntl3 = tp->wval; cp->phys.select.sel_sxfer = tp->sval; - }; + } } /*========================================================== @@ -4885,40 +4863,19 @@ else tp->period = 0xffff; - /* - ** Stop there if sync parameters are unchanged - */ - if (tp->sval == sxfer && tp->wval == scntl3) return; + /* Stop there if sync parameters are unchanged */ + if (tp->sval == sxfer && tp->wval == scntl3) + return; tp->sval = sxfer; tp->wval = scntl3; - /* - ** Bells and whistles ;-) - */ - PRINT_TARGET(np, target); if (sxfer & 0x01f) { - unsigned f10 = 100000 << (tp->widedone ? tp->widedone -1 : 0); - unsigned mb10 = (f10 + tp->period/2) / tp->period; - char *scsi; - - /* - ** Disable extended Sreq/Sack filtering - */ - if (tp->period <= 2000) OUTOFFB (nc_stest2, EXT); - - /* - ** Bells and whistles ;-) - */ - if (tp->period < 500) scsi = "FAST-40"; - else if (tp->period < 1000) scsi = "FAST-20"; - else if (tp->period < 2000) scsi = "FAST-10"; - else scsi = "FAST-5"; - - printk ("%s %sSCSI %d.%d MB/s (%d ns, offset %d)\n", scsi, - tp->widedone > 1 ? "WIDE " : "", - mb10 / 10, mb10 % 10, tp->period / 10, sxfer & 0x1f); - } else - printk ("%sasynchronous.\n", tp->widedone > 1 ? "wide " : ""); + /* Disable extended Sreq/Sack filtering */ + if (tp->period <= 2000) + OUTOFFB(nc_stest2, EXT); + } + + spi_display_xfer_agreement(tp->starget); /* ** set actual value and sync_status @@ -4964,11 +4921,8 @@ ** Bells and whistles ;-) */ if (bootverbose >= 2) { - PRINT_TARGET(np, target); - if (scntl3 & EWS) - printk ("WIDE SCSI (16 bit) enabled.\n"); - else - printk ("WIDE SCSI disabled.\n"); + dev_info(&cmd->device->sdev_target->dev, "WIDE SCSI %sabled.\n", + (scntl3 & EWS) ? "en" : "dis"); } /* @@ -5023,7 +4977,7 @@ reqtags = lp->numtags; } else { reqtags = 1; - }; + } /* ** Update max number of tags @@ -5063,12 +5017,13 @@ ** Announce change to user. */ if (bootverbose) { - PRINT_LUN(np, tn, ln); if (lp->usetags) { - printk("tagged command queue depth set to %d\n", reqtags); - } - else { - printk("tagged command queueing disabled\n"); + dev_info(&sdev->sdev_gendev, + "tagged command queue depth set to %d\n", + reqtags); + } else { + dev_info(&sdev->sdev_gendev, + "tagged command queueing disabled\n"); } } } @@ -5274,7 +5229,7 @@ istat = INB (nc_istat); if (DEBUG_FLAGS & DEBUG_TINY) printk ("F "); ncr_wakeup_done (np); - }; + } if (!(istat & (SIP|DIP))) return; @@ -5335,7 +5290,7 @@ } OUTONB_STD (); return; - }; + } /*======================================================== ** Now, interrupts that need some fixing up. @@ -5355,7 +5310,7 @@ if (sist & RST) { ncr_init (np, 1, bootverbose ? "scsi reset" : NULL, HS_RESET); return; - }; + } if ((sist & STO) && !(dstat & (MDPE|BF|ABRT))) { @@ -5366,7 +5321,7 @@ ncr_int_sto (np); return; - }; + } /*========================================================= ** Now, interrupts we are not able to recover cleanly. @@ -5387,7 +5342,7 @@ ((char*)&np->regdump)[i] = INB_OFF(i); np->regdump.nc_dstat = dstat; np->regdump.nc_sist = sist; - }; + } ncr_log_hard_error(np, sist, dstat); @@ -5399,20 +5354,20 @@ (dstat & (MDPE|BF|ABRT|IID))) { ncr_start_reset(np); return; - }; + } if (sist & HTH) { printk ("%s: handshake timeout\n", ncr_name(np)); ncr_start_reset(np); return; - }; + } if (sist & UDC) { printk ("%s: unexpected disconnect\n", ncr_name(np)); OUTB (HS_PRT, HS_UNEXPECTED); OUTL_DSP (NCB_SCRIPT_PHYS (np, cleanup)); return; - }; + } /*========================================================= ** We just miss the cause of the interrupt. :( @@ -5456,7 +5411,7 @@ if (cp) { cp-> host_status = HS_SEL_TIMEOUT; ncr_complete (np, cp); - }; + } /* ** repair start queue and jump to start point. @@ -5647,7 +5602,7 @@ ss2 = INB (nc_sstat2); if (ss2 & OLF1) rest++; if (ss2 & ORF1) rest++; - }; + } if (DEBUG_FLAGS & (DEBUG_TINY|DEBUG_PHASE)) printk ("P%x%x RL=%d D=%d SS0=%x ", cmd&7, sbcl&7, @@ -5716,7 +5671,7 @@ cp, np->header.cp, (unsigned)dsp, (unsigned)nxtdsp, vdsp, cmd); - }; + } /* ** cp=0 means that the DSA does not point to a valid control @@ -5744,7 +5699,7 @@ } else { tblp = (u32 *) 0; olen = scr_to_cpu(vdsp[0]) & 0xffffff; - }; + } if (DEBUG_FLAGS & DEBUG_PHASE) { printk ("OCMD=%x\nTBLP=%p OLEN=%x OADR=%x\n", @@ -5752,16 +5707,15 @@ tblp, (unsigned) olen, (unsigned) oadr); - }; + } /* ** check cmd against assumed interrupted script command. */ if (cmd != (scr_to_cpu(vdsp[0]) >> 24)) { - PRINT_ADDR(cp->cmd); - printk ("internal error: cmd=%02x != %02x=(vdsp[0] >> 24)\n", - (unsigned)cmd, (unsigned)scr_to_cpu(vdsp[0]) >> 24); + PRINT_ADDR(cp->cmd, "internal error: cmd=%02x != %02x=(vdsp[0] " + ">> 24)\n", cmd, scr_to_cpu(vdsp[0]) >> 24); goto reset_all; } @@ -5783,12 +5737,11 @@ */ if (cmd & 0x06) { - PRINT_ADDR(cp->cmd); - printk ("phase change %x-%x %d@%08x resid=%d.\n", + PRINT_ADDR(cp->cmd, "phase change %x-%x %d@%08x resid=%d.\n", cmd&7, sbcl&7, (unsigned)olen, (unsigned)oadr, (unsigned)rest); goto unexpected_phase; - }; + } /* ** choose the correct patch area. @@ -5812,8 +5765,7 @@ newcmd[3] = cpu_to_scr(nxtdsp); if (DEBUG_FLAGS & DEBUG_PHASE) { - PRINT_ADDR(cp->cmd); - printk ("newcmd[%d] %x %x %x %x.\n", + PRINT_ADDR(cp->cmd, "newcmd[%d] %x %x %x %x.\n", (int) (newcmd - cp->patch), (unsigned)scr_to_cpu(newcmd[0]), (unsigned)scr_to_cpu(newcmd[1]), @@ -5939,9 +5891,8 @@ if (!lp) goto out; if (bootverbose >= 1) { - PRINT_ADDR(cmd); - printk ("QUEUE FULL! %d busy, %d disconnected CCBs\n", - busy_cnt, disc_cnt); + PRINT_ADDR(cmd, "QUEUE FULL! %d busy, %d disconnected " + "CCBs\n", busy_cnt, disc_cnt); } if (disc_cnt < lp->numtags) { lp->numtags = disc_cnt > 2 ? disc_cnt : 2; @@ -5978,7 +5929,7 @@ ** ** identify message */ - cp->scsi_smsg2[0] = M_IDENTIFY | cmd->device->lun; + cp->scsi_smsg2[0] = IDENTIFY(0, cmd->device->lun); cp->phys.smsg.addr = cpu_to_scr(CCB_PHYS (cp, scsi_smsg2)); cp->phys.smsg.size = cpu_to_scr(1); @@ -6048,34 +5999,6 @@ **========================================================== */ -static int ncr_show_msg (u_char * msg) -{ - u_char i; - printk ("%x",*msg); - if (*msg==M_EXTENDED) { - for (i=1;i<8;i++) { - if (i-1>msg[1]) break; - printk ("-%x",msg[i]); - }; - return (i+1); - } else if ((*msg & 0xf0) == 0x20) { - printk ("-%x",msg[1]); - return (2); - }; - return (1); -} - -static void ncr_print_msg ( struct ccb *cp, char *label, u_char *msg) -{ - if (cp) - PRINT_ADDR(cp->cmd); - if (label) - printk("%s: ", label); - - (void) ncr_show_msg (msg); - printk(".\n"); -} - void ncr_int_sir (struct ncb *np) { u_char scntl3; @@ -6230,10 +6153,9 @@ */ if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("negotiation failed sir=%x status=%x.\n", - num, cp->nego_status); - }; + PRINT_ADDR(cp->cmd, "negotiation failed sir=%x " + "status=%x.\n", num, cp->nego_status); + } /* ** any error in negotiation: @@ -6242,37 +6164,26 @@ switch (cp->nego_status) { case NS_SYNC: - ncr_setsync (np, cp, 0, 0xe0); spi_period(starget) = 0; spi_offset(starget) = 0; + ncr_setsync (np, cp, 0, 0xe0); break; case NS_WIDE: - ncr_setwide (np, cp, 0, 0); spi_width(starget) = 0; + ncr_setwide (np, cp, 0, 0); break; - }; + } np->msgin [0] = M_NOOP; np->msgout[0] = M_NOOP; cp->nego_status = 0; break; case SIR_NEGO_SYNC: - /* - ** Synchronous request message received. - */ - if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("sync msgin: "); - (void) ncr_show_msg (np->msgin); - printk (".\n"); - }; - - /* - ** get requested values. - */ + ncr_print_msg(cp, "sync msgin", np->msgin); + } chg = 0; per = np->msgin[3]; @@ -6284,8 +6195,8 @@ ** it CAN transfer synch. */ - if (ofs && tp->starget) - spi_support_sync(tp->starget) = 1; + if (ofs && starget) + spi_support_sync(starget) = 1; /* ** check values against driver limits. @@ -6318,9 +6229,8 @@ } if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("sync: per=%d scntl3=0x%x ofs=%d fak=%d chg=%d.\n", - per, scntl3, ofs, fak, chg); + PRINT_ADDR(cp->cmd, "sync: per=%d scntl3=0x%x ofs=%d " + "fak=%d chg=%d.\n", per, scntl3, ofs, fak, chg); } if (INB (HS_PRT) == HS_NEGOTIATE) { @@ -6328,43 +6238,37 @@ switch (cp->nego_status) { case NS_SYNC: - /* - ** This was an answer message - */ + /* This was an answer message */ if (chg) { - /* - ** Answer wasn't acceptable. - */ - ncr_setsync (np, cp, 0, 0xe0); + /* Answer wasn't acceptable. */ spi_period(starget) = 0; spi_offset(starget) = 0; - OUTL_DSP (NCB_SCRIPT_PHYS (np, msg_bad)); + ncr_setsync(np, cp, 0, 0xe0); + OUTL_DSP(NCB_SCRIPT_PHYS (np, msg_bad)); } else { - /* - ** Answer is ok. - */ - ncr_setsync (np, cp, scntl3, (fak<<5)|ofs); + /* Answer is ok. */ spi_period(starget) = per; spi_offset(starget) = ofs; - OUTL_DSP (NCB_SCRIPT_PHYS (np, clrack)); - }; + ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); + OUTL_DSP(NCB_SCRIPT_PHYS (np, clrack)); + } return; case NS_WIDE: - ncr_setwide (np, cp, 0, 0); spi_width(starget) = 0; + ncr_setwide(np, cp, 0, 0); break; - }; - }; + } + } /* ** It was a request. Set value and ** prepare an answer message */ - ncr_setsync (np, cp, scntl3, (fak<<5)|ofs); spi_period(starget) = per; spi_offset(starget) = ofs; + ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); np->msgout[0] = M_EXTENDED; np->msgout[1] = 3; @@ -6375,10 +6279,7 @@ cp->nego_status = NS_SYNC; if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("sync msgout: "); - (void) ncr_show_msg (np->msgout); - printk (".\n"); + ncr_print_msg(cp, "sync msgout", np->msgout); } if (!ofs) { @@ -6394,11 +6295,8 @@ ** Wide request message received. */ if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("wide msgin: "); - (void) ncr_show_msg (np->msgin); - printk (".\n"); - }; + ncr_print_msg(cp, "wide msgin", np->msgin); + } /* ** get requested values. @@ -6412,8 +6310,8 @@ ** it CAN transfer wide. */ - if (wide && tp->starget) - spi_support_wide(tp->starget) = 1; + if (wide && starget) + spi_support_wide(starget) = 1; /* ** check values against driver limits. @@ -6423,8 +6321,8 @@ {chg = 1; wide = tp->usrwide;} if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("wide: wide=%d chg=%d.\n", wide, chg); + PRINT_ADDR(cp->cmd, "wide: wide=%d chg=%d.\n", wide, + chg); } if (INB (HS_PRT) == HS_NEGOTIATE) { @@ -6436,37 +6334,33 @@ ** This was an answer message */ if (chg) { - /* - ** Answer wasn't acceptable. - */ - ncr_setwide (np, cp, 0, 1); + /* Answer wasn't acceptable. */ spi_width(starget) = 0; + ncr_setwide(np, cp, 0, 1); OUTL_DSP (NCB_SCRIPT_PHYS (np, msg_bad)); } else { - /* - ** Answer is ok. - */ - ncr_setwide (np, cp, wide, 1); + /* Answer is ok. */ spi_width(starget) = wide; + ncr_setwide(np, cp, wide, 1); OUTL_DSP (NCB_SCRIPT_PHYS (np, clrack)); - }; + } return; case NS_SYNC: - ncr_setsync (np, cp, 0, 0xe0); spi_period(starget) = 0; spi_offset(starget) = 0; + ncr_setsync(np, cp, 0, 0xe0); break; - }; - }; + } + } /* ** It was a request, set value and ** prepare an answer message */ - ncr_setwide (np, cp, wide, 1); spi_width(starget) = wide; + ncr_setwide(np, cp, wide, 1); np->msgout[0] = M_EXTENDED; np->msgout[1] = 2; @@ -6478,10 +6372,7 @@ cp->nego_status = NS_WIDE; if (DEBUG_FLAGS & DEBUG_NEGO) { - PRINT_ADDR(cp->cmd); - printk ("wide msgout: "); - (void) ncr_show_msg (np->msgin); - printk (".\n"); + ncr_print_msg(cp, "wide msgout", np->msgin); } break; @@ -6500,8 +6391,7 @@ **----------------------------------------------- */ - PRINT_ADDR(cp->cmd); - printk ("M_REJECT received (%x:%x).\n", + PRINT_ADDR(cp->cmd, "M_REJECT received (%x:%x).\n", (unsigned)scr_to_cpu(np->lastmsg), np->msgout[0]); break; @@ -6513,10 +6403,7 @@ **----------------------------------------------- */ - PRINT_ADDR(cp->cmd); - printk ("M_REJECT sent for "); - (void) ncr_show_msg (np->msgin); - printk (".\n"); + ncr_print_msg(cp, "M_REJECT sent for", np->msgin); break; /*-------------------------------------------------------------------- @@ -6535,8 +6422,8 @@ **----------------------------------------------- */ - PRINT_ADDR(cp->cmd); - printk ("M_IGN_RESIDUE received, but not yet implemented.\n"); + PRINT_ADDR(cp->cmd, "M_IGN_RESIDUE received, but not yet " + "implemented.\n"); break; #if 0 case SIR_MISSING_SAVE: @@ -6548,15 +6435,14 @@ **----------------------------------------------- */ - PRINT_ADDR(cp->cmd); - printk ("M_DISCONNECT received, but datapointer not saved: " - "data=%x save=%x goal=%x.\n", + PRINT_ADDR(cp->cmd, "M_DISCONNECT received, but datapointer " + "not saved: data=%x save=%x goal=%x.\n", (unsigned) INL (nc_temp), (unsigned) scr_to_cpu(np->header.savep), (unsigned) scr_to_cpu(np->header.goalp)); break; #endif - }; + } out: OUTONB_STD (); @@ -6571,8 +6457,10 @@ **========================================================== */ -static struct ccb *ncr_get_ccb (struct ncb *np, u_char tn, u_char ln) +static struct ccb *ncr_get_ccb(struct ncb *np, struct scsi_cmnd *cmd) { + u_char tn = cmd->device->id; + u_char ln = cmd->device->lun; struct tcb *tp = &np->target[tn]; struct lcb *lp = tp->lp[ln]; u_char tag = NO_TAG; @@ -6602,8 +6490,8 @@ if (qp) { cp = list_entry(qp, struct ccb, link_ccbq); if (cp->magic) { - PRINT_LUN(np, tn, ln); - printk ("ccb free list corrupted (@%p)\n", cp); + PRINT_ADDR(cmd, "ccb free list corrupted " + "(@%p)\n", cp); cp = NULL; } else { list_add_tail(qp, &lp->wait_ccbq); @@ -6637,7 +6525,7 @@ if (flags & SCSI_NOSLEEP) break; if (tsleep ((caddr_t)cp, PRIBIO|PCATCH, "ncr", 0)) break; - }; + } #endif if (cp->magic) @@ -6665,8 +6553,7 @@ cp->lun = ln; if (DEBUG_FLAGS & DEBUG_TAGS) { - PRINT_LUN(np, tn, ln); - printk ("ccb @%p using tag %d.\n", cp, tag); + PRINT_ADDR(cmd, "ccb @%p using tag %d.\n", cp, tag); } return cp; @@ -6687,8 +6574,7 @@ struct lcb *lp = tp->lp[cp->lun]; if (DEBUG_FLAGS & DEBUG_TAGS) { - PRINT_LUN(np, cp->target, cp->lun); - printk ("ccb @%p freeing tag %d.\n", cp, cp->tag); + PRINT_ADDR(cp->cmd, "ccb @%p freeing tag %d.\n", cp, cp->tag); } /* @@ -7014,21 +6900,12 @@ unsigned char tn = sdev->id, ln = sdev->lun; struct tcb *tp = &np->target[tn]; struct lcb *lp = tp->lp[ln]; - struct scsi_target *starget = tp->starget; - /* - ** If no lcb, try to allocate it. - */ + /* If no lcb, try to allocate it. */ if (!lp && !(lp = ncr_alloc_lcb(np, tn, ln))) goto fail; /* - ** Prepare negotiation - */ - if (spi_support_wide(starget) || spi_support_sync(starget)) - ncr_negotiate(np, tp); - - /* ** If unit supports tagged commands, allocate the ** CCB JUMP table if not yet. */ @@ -7170,7 +7047,7 @@ printk ("CACHE TEST FAILED: reg dstat-sstat2 readback %x.\n", (unsigned) data); return (0x10); - }; + } return (0); } @@ -7223,7 +7100,7 @@ if (i>=NCR_SNOOP_TIMEOUT) { printk ("CACHE TEST FAILED: timeout.\n"); return (0x20); - }; + } /* ** Check termination position. */ @@ -7233,7 +7110,7 @@ (u_long) NCB_SCRIPTH_PHYS (np, snooptest), (u_long) pc, (u_long) NCB_SCRIPTH_PHYS (np, snoopend) +8); return (0x40); - }; + } /* ** Show results. */ @@ -7241,17 +7118,17 @@ printk ("CACHE TEST FAILED: host wrote %d, ncr read %d.\n", (int) host_wr, (int) ncr_rd); err |= 1; - }; + } if (host_rd != ncr_wr) { printk ("CACHE TEST FAILED: ncr wrote %d, host read %d.\n", (int) ncr_wr, (int) host_rd); err |= 2; - }; + } if (ncr_bk != ncr_wr) { printk ("CACHE TEST FAILED: ncr wrote %d, read back %d.\n", (int) ncr_wr, (int) ncr_bk); err |= 4; - }; + } return (err); } @@ -7424,6 +7301,16 @@ /*===================== LINUX ENTRY POINTS SECTION ==========================*/ +static int ncr53c8xx_slave_alloc(struct scsi_device *device) +{ + struct Scsi_Host *host = device->host; + struct ncb *np = ((struct host_data *) host->hostdata)->ncb; + struct tcb *tp = &np->target[device->id]; + tp->starget = device->sdev_target; + + return 0; +} + static int ncr53c8xx_slave_configure(struct scsi_device *device) { struct Scsi_Host *host = device->host; @@ -7432,8 +7319,6 @@ struct lcb *lp = tp->lp[device->lun]; int numtags, depth_to_use; - tp->starget = device->sdev_target; - ncr_setup_lcb(np, device); /* @@ -7778,6 +7663,7 @@ tpnt->queuecommand = ncr53c8xx_queue_command; tpnt->slave_configure = ncr53c8xx_slave_configure; + tpnt->slave_alloc = ncr53c8xx_slave_alloc; tpnt->eh_bus_reset_handler = ncr53c8xx_bus_reset; tpnt->can_queue = SCSI_NCR_CAN_QUEUE; tpnt->this_id = 7; @@ -7925,7 +7811,7 @@ if (ncr_snooptest(np)) { printk(KERN_ERR "CACHE INCORRECTLY CONFIGURED.\n"); goto attach_error; - }; + } /* Install the interrupt handler. */ np->irq = device->slot.irq; @@ -8057,6 +7943,25 @@ ncr_negotiate(np, tp); } +static void ncr53c8xx_get_signalling(struct Scsi_Host *shost) +{ + struct ncb *np = ((struct host_data *)shost->hostdata)->ncb; + enum spi_signal_type type; + + switch (np->scsi_mode) { + case SMODE_SE: + type = SPI_SIGNAL_SE; + break; + case SMODE_HVD: + type = SPI_SIGNAL_HVD; + break; + default: + type = SPI_SIGNAL_UNKNOWN; + break; + } + spi_signalling(shost) = type; +} + static struct spi_function_template ncr53c8xx_transport_functions = { .set_period = ncr53c8xx_set_period, .show_period = 1, @@ -8064,6 +7969,7 @@ .show_offset = 1, .set_width = ncr53c8xx_set_width, .show_width = 1, + .get_signalling = ncr53c8xx_get_signalling, }; int __init ncr53c8xx_init(void) diff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c --- a/drivers/scsi/osst.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/osst.c 2005-03-24 18:17:53 -08:00 @@ -24,7 +24,7 @@ */ static const char * cvsid = "$Id: osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $"; -const char * osst_version = "0.99.3"; +static const char * osst_version = "0.99.3"; /* The "failure to reconnect" firmware bug */ #define OSST_FW_NEED_POLL_MIN 10601 /*(107A)*/ @@ -170,7 +170,7 @@ static int osst_probe(struct device *); static int osst_remove(struct device *); -struct scsi_driver osst_template = { +static struct scsi_driver osst_template = { .owner = THIS_MODULE, .gendrv = { .name = "osst", @@ -4770,9 +4770,6 @@ { int result = 0; struct osst_tape * STp = filp->private_data; - struct scsi_request * SRpnt = NULL; - - if (SRpnt) scsi_release_request(SRpnt); if (STp->door_locked == ST_LOCKED_AUTO) do_door_lock(STp, 0); diff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c --- a/drivers/scsi/scsi_lib.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/scsi_lib.c 2005-03-24 18:17:53 -08:00 @@ -1233,6 +1233,22 @@ } /* + * Kill requests for a dead device + */ +static void scsi_kill_requests(request_queue_t *q) +{ + struct request *req; + + while ((req = elv_next_request(q)) != NULL) { + blkdev_dequeue_request(req); + req->flags |= REQ_QUIET; + while (end_that_request_first(req, 0, req->nr_sectors)) + ; + end_that_request_last(req); + } +} + +/* * Function: scsi_request_fn() * * Purpose: Main strategy routine for SCSI. @@ -1246,10 +1262,16 @@ static void scsi_request_fn(struct request_queue *q) { struct scsi_device *sdev = q->queuedata; - struct Scsi_Host *shost = sdev->host; + struct Scsi_Host *shost; struct scsi_cmnd *cmd; struct request *req; + if (!sdev) { + printk("scsi: killing requests for dead queue\n"); + scsi_kill_requests(q); + return; + } + if(!get_device(&sdev->sdev_gendev)) /* We must be tearing the block queue down already */ return; @@ -1258,6 +1280,7 @@ * To start with, we keep looping until the queue is empty, or until * the host is no longer able to accept any more requests. */ + shost = sdev->host; while (!blk_queue_plugged(q)) { int rtn; /* diff -Nru a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c --- a/drivers/scsi/scsi_sysfs.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/scsi_sysfs.c 2005-03-24 18:17:53 -08:00 @@ -168,8 +168,10 @@ list_del(&sdev->starved_entry); spin_unlock_irqrestore(sdev->host->host_lock, flags); - if (sdev->request_queue) + if (sdev->request_queue) { + sdev->request_queue->queuedata = NULL; scsi_free_queue(sdev->request_queue); + } scsi_target_reap(scsi_target(sdev)); @@ -561,15 +563,7 @@ **/ int scsi_sysfs_add_sdev(struct scsi_device *sdev) { - struct Scsi_Host *shost = sdev->host; - struct scsi_target *starget = scsi_target(sdev); int error, i; - unsigned long flags; - - spin_lock_irqsave(shost->host_lock, flags); - list_add_tail(&sdev->same_target_siblings, &starget->devices); - list_add_tail(&sdev->siblings, &shost->__devices); - spin_unlock_irqrestore(shost->host_lock, flags); if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0) return error; @@ -786,6 +780,10 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) { + unsigned long flags; + struct Scsi_Host *shost = sdev->host; + struct scsi_target *starget = sdev->sdev_target; + device_initialize(&sdev->sdev_gendev); sdev->sdev_gendev.bus = &scsi_bus_type; sdev->sdev_gendev.release = scsi_device_dev_release; @@ -801,6 +799,10 @@ sdev->channel, sdev->id, sdev->lun); sdev->scsi_level = SCSI_2; transport_setup_device(&sdev->sdev_gendev); + spin_lock_irqsave(shost->host_lock, flags); + list_add_tail(&sdev->same_target_siblings, &starget->devices); + list_add_tail(&sdev->siblings, &shost->__devices); + spin_unlock_irqrestore(shost->host_lock, flags); } int scsi_is_sdev_device(const struct device *dev) diff -Nru a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c --- a/drivers/scsi/scsi_transport_spi.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/scsi_transport_spi.c 2005-03-24 18:17:53 -08:00 @@ -293,9 +293,12 @@ picosec = tp->period * 4000; } - if (picosec == -1) - return sprintf(buf, "reserved"); - len = sprint_frac(buf, picosec, 1000); + if (picosec == -1) { + len = sprintf(buf, "reserved"); + } else { + len = sprint_frac(buf, picosec, 1000); + } + buf[len++] = '\n'; buf[len] = '\0'; return len; diff -Nru a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c --- a/drivers/scsi/sim710.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/sim710.c 2005-03-24 18:17:53 -08:00 @@ -127,16 +127,24 @@ NCR_700_set_io_mapped(hostdata); /* and register the chip */ - if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev, irq, - scsi_id)) == NULL) { + if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev)) + == NULL) { printk(KERN_ERR "sim710: No host detected; card configuration problem?\n"); goto out_release; } + host->this_id = scsi_id; + host->irq = irq; + if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) { + printk(KERN_ERR "sim710: request_irq failed\n"); + goto out_put_host; + } scsi_scan_host(host); return 0; + out_put_host: + scsi_host_put(host); out_release: release_region(host->base, 64); out_free: diff -Nru a/drivers/scsi/sym53c8xx_defs.h b/drivers/scsi/sym53c8xx_defs.h --- a/drivers/scsi/sym53c8xx_defs.h 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/sym53c8xx_defs.h 2005-03-24 18:17:53 -08:00 @@ -314,9 +314,9 @@ #define writew_b2l __raw_writew #define writel_b2l __raw_writel #define readw_raw __raw_readw -#define readl_raw(a) __raw_readl((unsigned long)(a)) +#define readl_raw __raw_readl #define writew_raw __raw_writew -#define writel_raw(v,a) __raw_writel(v,(unsigned long)(a)) +#define writel_raw __raw_writel #else /* Other big-endian */ #define readw_l2b readw #define readl_l2b readl @@ -1281,34 +1281,34 @@ ** Messages */ -#define M_COMPLETE (0x00) -#define M_EXTENDED (0x01) -#define M_SAVE_DP (0x02) -#define M_RESTORE_DP (0x03) -#define M_DISCONNECT (0x04) -#define M_ID_ERROR (0x05) -#define M_ABORT (0x06) -#define M_REJECT (0x07) -#define M_NOOP (0x08) -#define M_PARITY (0x09) -#define M_LCOMPLETE (0x0a) -#define M_FCOMPLETE (0x0b) -#define M_RESET (0x0c) -#define M_ABORT_TAG (0x0d) -#define M_CLEAR_QUEUE (0x0e) -#define M_INIT_REC (0x0f) -#define M_REL_REC (0x10) +#define M_COMPLETE COMMAND_COMPLETE +#define M_EXTENDED EXTENDED_MESSAGE +#define M_SAVE_DP SAVE_POINTERS +#define M_RESTORE_DP RESTORE_POINTERS +#define M_DISCONNECT DISCONNECT +#define M_ID_ERROR INITIATOR_ERROR +#define M_ABORT ABORT_TASK_SET +#define M_REJECT MESSAGE_REJECT +#define M_NOOP NOP +#define M_PARITY MSG_PARITY_ERROR +#define M_LCOMPLETE LINKED_CMD_COMPLETE +#define M_FCOMPLETE LINKED_FLG_CMD_COMPLETE +#define M_RESET TARGET_RESET +#define M_ABORT_TAG ABORT_TASK +#define M_CLEAR_QUEUE CLEAR_TASK_SET +#define M_INIT_REC INITIATE_RECOVERY +#define M_REL_REC RELEASE_RECOVERY #define M_TERMINATE (0x11) -#define M_SIMPLE_TAG (0x20) -#define M_HEAD_TAG (0x21) -#define M_ORDERED_TAG (0x22) -#define M_IGN_RESIDUE (0x23) +#define M_SIMPLE_TAG SIMPLE_QUEUE_TAG +#define M_HEAD_TAG HEAD_OF_QUEUE_TAG +#define M_ORDERED_TAG ORDERED_QUEUE_TAG +#define M_IGN_RESIDUE IGNORE_WIDE_RESIDUE #define M_IDENTIFY (0x80) -#define M_X_MODIFY_DP (0x00) -#define M_X_SYNC_REQ (0x01) -#define M_X_WIDE_REQ (0x03) -#define M_X_PPR_REQ (0x04) +#define M_X_MODIFY_DP EXTENDED_MODIFY_DATA_POINTER +#define M_X_SYNC_REQ EXTENDED_SDTR +#define M_X_WIDE_REQ EXTENDED_WDTR +#define M_X_PPR_REQ EXTENDED_PPR /* ** Status diff -Nru a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c --- a/drivers/scsi/zalon.c 2005-03-24 18:17:53 -08:00 +++ b/drivers/scsi/zalon.c 2005-03-24 18:17:53 -08:00 @@ -88,31 +88,30 @@ struct gsc_irq gsc_irq; u32 zalon_vers; int error = -ENODEV; - unsigned long zalon = dev->hpa; - unsigned long io_port = zalon + GSC_SCSI_ZALON_OFFSET; + void __iomem *zalon = ioremap(dev->hpa, 4096); + void __iomem *io_port = zalon + GSC_SCSI_ZALON_OFFSET; static int unit = 0; struct Scsi_Host *host; struct ncr_device device; __raw_writel(CMD_RESET, zalon + IO_MODULE_IO_COMMAND); while (!(__raw_readl(zalon + IO_MODULE_IO_STATUS) & IOSTATUS_RY)) - ; + cpu_relax(); __raw_writel(IOIIDATA_MINT5EN | IOIIDATA_PACKEN | IOIIDATA_PREFETCHEN, zalon + IO_MODULE_II_CDATA); /* XXX: Save the Zalon version for bug workarounds? */ - zalon_vers = __raw_readl(dev->hpa + IO_MODULE_II_CDATA) & 0x07000000; - zalon_vers >>= 24; + zalon_vers = (__raw_readl(zalon + IO_MODULE_II_CDATA) >> 24) & 0x07; /* Setup the interrupts first. ** Later on request_irq() will register the handler. */ dev->irq = gsc_alloc_irq(&gsc_irq); - printk("%s: Zalon vers field is 0x%x, IRQ %d\n", __FUNCTION__, + printk(KERN_INFO "%s: Zalon version %d, IRQ %d\n", __FUNCTION__, zalon_vers, dev->irq); - __raw_writel(gsc_irq.txn_addr | gsc_irq.txn_data, dev->hpa + IO_MODULE_EIM); + __raw_writel(gsc_irq.txn_addr | gsc_irq.txn_data, zalon + IO_MODULE_EIM); if (zalon_vers == 0) printk(KERN_WARNING "%s: Zalon 1.1 or earlier\n", __FUNCTION__); @@ -120,16 +119,16 @@ memset(&device, 0, sizeof(struct ncr_device)); /* The following three are needed before any other access. */ - writeb(0x20, io_port + 0x38); /* DCNTL_REG, EA */ - writeb(0x04, io_port + 0x1b); /* CTEST0_REG, EHP */ - writeb(0x80, io_port + 0x22); /* CTEST4_REG, MUX */ + __raw_writeb(0x20, io_port + 0x38); /* DCNTL_REG, EA */ + __raw_writeb(0x04, io_port + 0x1b); /* CTEST0_REG, EHP */ + __raw_writeb(0x80, io_port + 0x22); /* CTEST4_REG, MUX */ /* Initialise ncr_device structure with items required by ncr_attach. */ device.chip = zalon720_chip; device.host_id = 7; device.dev = &dev->dev; - device.slot.base = (u_long)io_port; - device.slot.base_c = (u_long)io_port; + device.slot.base = dev->hpa + GSC_SCSI_ZALON_OFFSET; + device.slot.base_v = io_port; device.slot.irq = dev->irq; device.differential = 2;