Commit Graph

3408 Commits (835cc24aff0fd4b9da9d0a45d9bd043adcb2cf89)

Author SHA1 Message Date
Bernhard Walle 8c8fdc5910 [SCSI] ips: Update version information
This patch just makes the version number in ips.c and ips.h consistent. It
seems that this has been forgotten in a60768e2d4.

It also removes code duplication, each number is now only once in the code to
avoid similar errors in the future.

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Acked-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:44 -04:00
Matthew Wilcox a50ee7a728 [SCSI] ips: Close narrow race in release
We were releasing the IRQ before removing the host, so commands could
still be coming in which would never be seen by the interrupt handler.
Just remove the host before releasing the IRQ to close this race.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:40 -04:00
Matthew Wilcox f01abb362f [SCSI] aic94xx: Free scsi host on error
If an error occurred during initialisation, we would sometimes fail to
call scsi_host_put() and thus end up with a leaked scsi_host.  It was
also possible to miss calling scsi_remove_host().

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:33 -04:00
Matthew Wilcox c131993b4c [SCSI] qlogicfas: Close narrow race in release
We were releasing the IRQ before removing the host, so commands could
still be coming in which would never be seen by the interrupt handler.
Just remove the host before releasing the IRQ to close this race.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:26 -04:00
Matthew Wilcox 1bd4057346 [SCSI] aha152x: Close narrow race in release
We were releasing the IRQ before removing the host, so commands could
still be coming in which would never be seen by the interrupt handler.
Just remove the host before releasing the IRQ to close this race.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:22 -04:00
Matthew Wilcox dffe807cdb [SCSI] ncr53c8xx: Call scsi_host_put in release
Since ncr53c8xx_attach() calls scsi_host_put(), make ncr53c8xx_release()
call scsi_host_put() too, for symmetry.  Both callers already expect
it to put the host for them, so that works out nicely.  While the zalon
driver does 'use' the host pointer afterwards, it only compares it for
equality and doesn't dereference it, so that's safe.

While I'm at it, get rid of pointless checks for NULL, use shost_priv()
and change ncr53c8xx_release to return void.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:18 -04:00
Matthew Wilcox 6fdea8dbbe [SCSI] ide-scsi: Close narrow race in release
We were releasing the block devices before removing the host, so commands
could still be coming in which would cause a panic.  Just remove the
host before releasing the block devices to close this race.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:14 -04:00
Matthew Wilcox 34f8f0d294 [SCSI] ibmmca: Stop leaking scsi_hosts on exit
There was a missing call to scsi_host_put() causing us to leak a scsi
host every time this module was unloaded.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:10 -04:00
Matthew Wilcox a57b1fccdf [SCSI] scsi_scan: Cope with kthread_run failing
If kthread_run failed, we would fail to scan the host, and leak the
allocated async_scan_data.  Since using a separate thread is just an
optimisation, do the scan synchronously if we fail to spawn a thread.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:06 -04:00
Matthew Wilcox 31765d7d3d [SCSI] Improve error message when offlining a device
The current code prints:

scsi 13:0:4:0: scsi: Device offlined - not ready after error recovery

which is repetitively redundant.  This patch changes that message to:

scsi 6:0:6:0: Device offlined - not ready after error recovery

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:51:03 -04:00
James Bottomley 7c07d613d2 [SCSI] sg: use idr to replace static arrays
sg uses a scheme to reallocate a single contiguous array of all its
pointers for lookup and management.  This didn't matter too much when sg
could only attach 256 nodes, but now the maximum has been bumped up to
32k we're starting to push the limits of the maximum allocatable
contiguous memory.  The solution to this is to eliminate the static
array and do everything via idr, which this patch does.

Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:59 -04:00
Matthias Kaehlcke 4390e60163 [SCSI] osst: Use mutex instead of semaphore
The OnStream SCSI Tape driver uses a semaphore as mutex.  Use the mutex API
instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Reviewed-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Willem Riede <wrlk@riede.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:55 -04:00
Jeff Garzik 488a5c8a9a [SCSI] arcmsr: irq handler fixes, cleanups, micro-opts
* Remove IRQF_DISABLED, it is clearly wrong for this driver.

* Remove wasteful spin_lock_irqsave() in interrupt handler.
  The lighter-weight spin_lock() is all that's needed.

* Annotate with FIXME where arcmsr_interrupt() is called
  without any spinlock being acquired.

* Eliminate pointless cast from void pointer in arcmsr_do_interrupt()

[jejb: conflict resolution]

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Nick Cheng <nick.cheng@areca.com.tw>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:51 -04:00
Jeff Garzik 24430458bb [SCSI] arcmsr: Fix hardware wait loops
Remove _interruptible, since receiving a signal while waiting on a
hardware condition will simply cause the driver to busy-wait.

Using msleep_interruptible() is rarely the right thing to do, when
waiting on a hardware condition to change.

Also, replace msleep with ssleep while doing this, where appropriate.

[jejb: fix up merge conflict]

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Nick Cheng <nick.cheng@areca.com.tw>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:48 -04:00
Andrew Vasquez 095862ab98 [SCSI] qla2xxx: Update version number to 8.02.00-k4.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:44 -04:00
Andrew Vasquez 39bd962269 [SCSI] qla2xxx: Limit iIDMA speed adjustments.
Do not adjust the iIDMA speed on ports which have a faster
link-speed than the HBA itself.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:40 -04:00
Andrew Vasquez 87f27015b8 [SCSI] qla2xxx: Rework MSI-X handlers.
Since MSI-X vectors do not require a clearing "handshake" from
the system perspective, and the registered handler will not be
called more than once for one occurrence of receipt of a vector,
there is no requirement to flush the risc register write clearing
the interrupt condition in the risc. Also, since the msi-x
registered handlers are optimised for a particular vector, it is
preferable to handle the one vector received per invocation of
the handler.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:37 -04:00
Andrew Vasquez 8b3253d10f [SCSI] qla2xxx: Clear options-flags while staging firmware-execution.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:33 -04:00
Andrew Vasquez 26ff776d1d [SCSI] qla2xxx: Sparse cleanups in qla_mid.c
Make several needlessly global functions static:
- qla2x00_mark_vp_devices_dead()
- qla24xx_configure_vp()

Remove unused function qla24xx_modify_vport().

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:29 -04:00
Andrew Vasquez 700ca0e701 [SCSI] qla2xxx: Cleanup several 'sparse' warnings.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:26 -04:00
Andrew Vasquez f363b9434a [SCSI] qla2xxx: Use shost_priv().
Drop usage of legacy to_qla_host() macro.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:22 -04:00
Andrew Vasquez e745759a0f [SCSI] qla2xxx: Remove unused member (list) from srb_t structure.
This change reduces by as much as 16% the memory footprint for
each allocated sbr_t structure requested from the mempool.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:17 -04:00
Seokmann Ju 4d0ea24769 [SCSI] qla2xxx: Retrieve max-NPIV support capabilities from FW.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:14 -04:00
Andrew Vasquez c45bcc8e77 [SCSI] qla2xxx: Use the correct pointer-address during NVRAM writes.
Original code, incorrectly passed the address-of a pointer rather
than the pointer value itself.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:10 -04:00
Andrew Vasquez 8a85e17152 [SCSI] qla2xxx: Set correct attribute count during FDMI RPA.
Also remove legacy '/proc' name during OS_DEVICE_NAME
registration.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:06 -04:00
Ravi Anand 63a8651f25 [SCSI] qla2xxx: Correct infinite-login-retry issue.
Where the DPC logic would get jammed into continuously
reloging-into a port.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:50:02 -04:00
Andrew Vasquez b583692739 [SCSI] qla2xxx: Query additional RISC registers during ISP25XX firmware dump.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:58 -04:00
Andrew Vasquez c3b058afae [SCSI] qla2xxx: Correct staging of RISC while attempting to pause.
There's no need to reset the RISC prior to pausing.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:54 -04:00
Andrew Vasquez 05236a050f [SCSI] qla2xxx: Query additional RISC information during a pause.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:51 -04:00
Seokmann Ju 14e660e677 [SCSI] qla2xxx: Add PCI error recovery support.
Additional cleanups and
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:47 -04:00
Joe Carnuccio b7cc176c9e [SCSI] qla2xxx: Allow region-based flash-part accesses.
Additional cleanups and
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:42 -04:00
Andrew Vasquez 338c9161e4 [SCSI] qla2xxx: Add flash burst-read/write support.
Newer ISPs support a mechanism to read and write flash-memory via
the firmware LOAD/DUMP memory mailbox command routines.  When
supported, utilizing these mechanisms significantly reduces
overall access times.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:38 -04:00
Andrew Vasquez c81d04c9e2 [SCSI] qla2xxx: Collapse and simplify ISP2XXX firmware dump routines.
Add IO-base-window accessor functions.  Merge duplicate
RISC-pause and soft-reset code segments.  Drop 'eye-watering'
__iomem casting.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:34 -04:00
James Bottomley 7f9a6bc4e9 [SCSI] move ULD attachment into the prep function
One of the intents of the block prep function was to allow ULDs to use
it for preprocessing.  The original SCSI model was to have a single prep
function and add a pointer indirect filter to build the necessary
commands.  This patch reverses that, does away with the init_command
field of the scsi_driver structure and makes ULDs attach directly to the
prep function instead.  The value is really that it allows us to begin
to separate the ULDs from the SCSI mid layer (as long as they don't use
any core functions---which is hard at the moment---a ULD doesn't even
need SCSI to bind).

Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:30 -04:00
David Woodhouse d3849d512f [SCSI] Fix ibmvscsi client for multiplatform iSeries+pSeries kernel
If you build a multiplatform kernel for iSeries and pSeries, with
ibmvscsic support, the resulting client doesn't work on iSeries.

This fixes that, using the appropriate low-level operations
for the machine detected at runtime.

[jejb: fixed up rejections around the srp transport patch]

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Acked by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:26 -04:00
Alan Cox 5307b1e8b0 [SCSI] dtc: Fix typo
(and pointed out by several people)

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:22 -04:00
Alan Cox 1a1d641490 [SCSI] eata_pio: Clean up proc handling, bracketing and use cpu_relax()
So its ancient, its crap, but it kept showing up in my scans for stuff
that wanted fixing...

- Redo the proc code to be far cleaner
- Clean various return (0) type constructs
- Use cpu_relax()

The various waits ought to time out but thats another issue and probably
not worth solving.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:19 -04:00
Masatake YAMATO 10f4b89a0f [SCSI] Fix signness of parameters in scsi module
In scsi module I've found some inconsistency between variable type
used in module_param_named and type passed to module_param_named as an
argument. Especially the inconsistency of `max_scsi_luns' parameter is
a bit serious because the description text says "last scsi LUN (should
be between 1 and 2^32-1)".

Signed-off-by: Masatake YAMATO <jet@gyve.org>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:11 -04:00
Boaz Harrosh 427d0bd4fd [SCSI] ide-scsi.: convert to data accessors and !use_sg cleanup
- Convert ide-scsi to the new data accessors and cleanup
   the !use_sg code paths.

  In old code the driver was trying to translate narrow commands,
  if received, to wide commands. This code  path still assumed
  scsi_cmnd->request_buffer is a linear char pointer.
  This means that this driver was broken since 2.6.17.

  As suggested by Christoph Hellwig I set
  use_10_for_rw = 1; and use_10_for_ms = 1;
  for this device and completely killed the translation.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:08 -04:00
Michael Reed 52aeeca900 [SCSI] stale residual returned on write following BUSY retry
A BUSY status returned on a write request results in a stale residual
being returned when the write ultimately successfully completes.

This can be reproduced as follows:

1) issue immediate mode rewind to scsi tape drive
2) issue write request

The tape drive returns busy.  The low level driver detects underrun and
sets the residual into the scsi command.  The low level driver responds
with (DID_OK << 16) | scsi_status.  scsi_status is 8, hence
status_byte(result) == 4, i.e., BUSY.

scsi_softirq_done() calls scsi_decide_disposition() which returns
ADD_TO_MLQUEUE.  scsi_softirq_done() then calls scsi_queue_insert()
which, on the way to resubmitting the request to the driver, calls
scsi_init_cmd_errh().

The attached patch modifies scsi_init_cmd_errh() to clear the resid
field.  This prevents a "stale" residual from being returned when the
scsi command finally completes without a BUSY status.

Signed-off-by: Michael Reed <mdr@sgi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:49:04 -04:00
James Bottomley 685b9e02fb [SCSI] arcmsr: fix compile problems
CC [M]  drivers/scsi/arcmsr/arcmsr_hba.o
drivers/scsi/arcmsr/arcmsr_attr.c:186: warning: initialization from
incompatible pointer type
drivers/scsi/arcmsr/arcmsr_attr.c:196: warning: initialization from
incompatible pointer type
drivers/scsi/arcmsr/arcmsr_attr.c:206: warning: initialization from
incompatible pointer type
drivers/scsi/arcmsr/arcmsr_hba.c: In function 'arcmsr_alloc_ccb_pool':
drivers/scsi/arcmsr/arcmsr_hba.c:329: warning: assignment from
incompatible pointer type
drivers/scsi/arcmsr/arcmsr_hba.c: At top level:
drivers/scsi/arcmsr/arcmsr_hba.c:101: warning:
'arcmsr_pci_error_detected' declared 'static' but never defined
drivers/scsi/arcmsr/arcmsr_hba.c:102: warning: 'arcmsr_pci_slot_reset'
declared 'static' but never defined

The majority being incorrect casting or the fact that binary attributes
now take an additional argument.

Cc: Nick Cheng <nick.cheng@areca.com.tw>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:30 -04:00
Nick Cheng 1a4f550a09 [SCSI] arcmsr: 1.20.00.15: add SATA RAID plus other fixes
Description:
** support ARC1200/1201/1202 SATA RAID adapter, which is named
ACB_ADAPTER_TYPE_B
** modify the arcmsr_pci_slot_reset function
** modify the arcmsr_pci_ers_disconnect_forepart function
** modify the arcmsr_pci_ers_need_reset_forepart function 

Signed-off-by: Nick Cheng <nick.cheng@areca.com.tw>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:27 -04:00
Kay Sievers bfd129445f [SCSI] switch sdev sysfs attributes to default attributes
This removes the unused sysfs attribute overwriting logic for most of
the attributes, and plugs them into the driver core default attribute
creation.

Without this patch, at the time of the events for the SCSI LUN's, there
will be no sysfs files, because their creation is delayed until the sd
driver has spun up the disks, which might take several seconds. It is the
last WAIT_FOR_SYSFS rule in the default udev setup which can be removed
with this change.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:22 -04:00
Matthew Wilcox 01fbfe0b83 [SCSI] advansys: Use DRV_NAME
Follow the example of some other drivers by defining DRV_NAME to be
"advansys".  Prevents spelling mistakes.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:19 -04:00
Matthew Wilcox 95c9f16284 [SCSI] advansys: Comment/indentation/macro cleanup
- Delete comments relating to the previous structure of the driver.
   I have no intention of honouring them ;-)
 - Reformat comments > 80 columns
 - Remove now-obsolete comments from advansys_interrupt
 - Change adv_get_sglist() from do {} while (1) to for (;;)
 - Return void from AscInitQLinkVar()
 - Take out a level of indentation in adv_get_sglist()
 - Reduce indentation level of AscAsyncFix()
 - Remove unused macros
 - Refactor AscSendScsiQueue slightly

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:15 -04:00
Matthew Wilcox b009bef6cd [SCSI] advansys: Remove some custom wrappers
- Replace ASC_ASSERT() with BUG_ON().
   In a few places, get rid of the assertion altogether -- the ensuing
   crash will tell us all we need to know.  Use BUG() where it fits better
   than BUG_ON().  Also fix a fencepost error in advansys_proc_info().
 - Replace DvcSleepMilliSecond with mdelay.
   Despite its name using 'sleep', the implementation was a delay.
   I've marked some places with XXX where we should probably be using
   msleep instead.  They need to be audited to be sure we can sleep in
   that context.
 - Replace DvcDelayMicroSecond with udelay.
 - Replace DvcDelayNanoSecond with udelay too.
   All callers were multiples of 1000.
 - Remove DvcEnterCritical and DvcLeaveCritical.
   These functions are no-ops, and as the comments said, the spinlock
   protects the critical sections.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:11 -04:00
Matthew Wilcox faac48ecf4 [SCSI] advansys: Remove a check for an impossible condition
AscExeScsiQueue() has one caller, and it passes the address of a
variable; this cannot ever be NULL.  This is the only place that ever
sets ASCQ_ERR_SCSIQ_NULL_PTR, so delete that error code too, as well as
several other unused ASCQ_ERR codes.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:07 -04:00
Matthew Wilcox f05ec594fe [SCSI] advansys: Support 16-byte commands properly
The SCSI midlayer won't send commands greater than ->max_cmd_len.
So the checks on length in asc_build_req and adv_build_req are obsolete
and can be deleted, but also we have to set the max_cmd_len in
advansys_board_found().  Also move the length definitions together, and
write a helpful comment.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:48:03 -04:00
Matthew Wilcox b2a7a4ba04 [SCSI] advansys: Enable interrupts earlier in queuecommand
Move as much as possible outside the critical section in queuecommand, eg:
 - Set the scsi_done field before acquiring the lock
 - Call asc_scsi_done after dropping the lock

Also remove a comment suggesting we should enable interrupts (now we do)
and do some minor reformatting for readability.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:59 -04:00
Matthew Wilcox 349d2c4429 [SCSI] advansys: Remove `active' queue and all remaining internal queueing code
The `active' list was used in the reset handler -- but the midlayer
guarantees that list is empty by the time the reset handler is invoked.
It was also checked in the interrupt routines to be sure that this command
belonged to this board, but we don't need to check that either.  We can
then delete the asc_prt_target_stats() function as it will never print
anything, along with asc_enqueue(), asc_dequeue_list(), asc_rmqueue(),
asc_scsi_done_list(), struct asc_queue, ASC_QUEUE_EMPTY, ASC_TID_ALL,
ASC_FRONT, ASC_BACK, and all the REQ* macros.  Also remove this item from
the todo list.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:56 -04:00
Matthew Wilcox 6ed1ef0786 [SCSI] advansys: Remove `done' queue
- Move the guts of asc_scsi_done_list() into a new function, asc_scsi_done.
 - Call asc_scsi_done() in asc_isr_callback() and adv_isr_callback().  The
   comment was wrong; scsi_done cannot enable interrupts.
 - All other places which queued an scp on the done list are error paths
   for queuecommand, and so we can just call asc_scsi_done() in queuecommand
   if we receive an error.
 - We no longer need to keep a list of done requests in advansys_interrupt

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:52 -04:00
Matthew Wilcox 7686f02aa8 [SCSI] advansys: Remove a check for an impossible condition
The midlayer guarantees it won't call ->queuecommand for a host which
is handling a reset condition.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:48 -04:00
Matthew Wilcox b66229258f [SCSI] advansys: Remove `waiting' queue
If the adapter is busy, return the request to the midlayer rather than
queueing it in the driver.  asc_execute_queue() and asc_dequeue() become
unused, and we don't need to print out stats on the waiting queue any more.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:44 -04:00
Matthew Wilcox c2dce2fabc [SCSI] advansys: Shrink advansys_board_found a little more
Move the error reporting into AscInitGetConfig, AdvInitGetConfig and
AscInitSetConfig.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:41 -04:00
Matthew Wilcox 629d688d5c [SCSI] advansys: Reformat microcode
It's just data, so format it to something that looks more visually
appealing (and saves some lines)

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:37 -04:00
Matthew Wilcox b9d9661400 [SCSI] advansys: Create AdvLoadMicrocode
Split AdvLoadMicrocode out of AdvInitAsc3550Driver, AdvInitAsc38C0800Driver
and AdvInitAsc38C1600Driver.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:33 -04:00
Matthew Wilcox a9f4a59a94 [SCSI] advansys: Create AdvBuildCarrierFreelist
Split AdvBuildCarrierFreelist out of AdvInitAsc3550Driver,
AdvInitAsc38C0800Driver and AdvInitAsc38C1600Driver.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:29 -04:00
Matthew Wilcox b8e5152bf1 [SCSI] advansys: Fix VLB driver name
You can't have two drivers for the same bus type with the same name.
Since ISA and VLB are both isa_drivers, rename the VLB one to advansys_vlb.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:25 -04:00
FUJITA Tomonori 72e39ea7e0 [SCSI] srp_transport: convert to use supported_mode attribute
srp transport works for target drivers without supported_mode
attribute but it would be better to use it explicitly.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:47:02 -04:00
FUJITA Tomonori 7525236d0b [SCSI] fc_transport: add target driver support
This adds minimum target driver support like the srp transport does:

- fc_remote_port_{rolechg,delete} calls
scsi_tgt_it_nexus_{create,destroy} for target drivers.

- add callbacks to notify target drivers of the nexus and tmf
operation results to fc_function_template.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:46:58 -04:00
FUJITA Tomonori 5dc2b89e12 [SCSI] add supported_mode and active_mode attributes to the host
This adds supported_mode and active_mode attributes to
/sys/class/sys_host/hostX/ for specifying the mode that a lld supports
and the currently activated mode. The output format is similar to fc
rport roles:

luce:/sys/class/scsi_host/host0$ cat supported_mode
Initiator
luce:/sys/class/scsi_host/host0$ cat active_mode
Initiator

The mode values uses bitmap since we would support dual-mode llds in
the future like this:

luce:/sys/class/scsi_host/host0$ cat supported_mode
Initiator, Target

The supported_mode attribute looks at a scsi_host_template and the
active_mode attribute looks at a scsi_host. We would add a hook to a
scsi_host_template to change the active_mode attribute
dynamically. But now there is no hook since no lld supports that
feature.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:46:55 -04:00
FUJITA Tomonori 8184fe9b6e [SCSI] tgt: fix can_queue bug
should use host->can_queue instead of host->hostt->can_queue.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:46:51 -04:00
Gilbert Wu f9755bea9c [SCSI] aic94xx: Add new PCI ID for ASC58300
Add new HBA PCI ID (0x416) for ASC58300 which has eight port SAS and
SATA PCI-X 133MHz low profile host bus adapter with two mini SAS 4x
external connectors.

Signed-off-by: Gilbert Wu <gilbert_wu@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:46:47 -04:00
HighPoint Linux Team db9b6e89ea [SCSI] hptiop: adding new firmware interface and more PCI device IDs
updated patch based on Jeff Garzik's comments.

- check adapter firmware version and use appropriate interface accordingly
- add new PCI device IDs and use PCI_VDEVICE macro
- update driver version string
- remove unused data structures
- remove unnecessary typecasts

Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:46:40 -04:00
Christof Schmitt 03f002f778 [SCSI] scsi_transport_fc: Introduce disable_target_scan flag
This change has already been discussed on linux-scsi:
http://marc.info/?t=118771096400003
http://marc.info/?t=118760913100005

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:46:29 -04:00
Mariusz Kozlowski bbfbbbc118 [SCSI] kmalloc + memset conversion to kzalloc
In NCR_D700, a4000t, aic7xxx_old, bvme6000, dpt_i2o, gdth, lpfc,
megaraid, mvme16x osst, pluto, qla2xxx, zorro7xx

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:41:00 -04:00
Alan Cox 1fbe85292f [SCSI] dtc: clean up indent damage and add printk levels
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:29 -04:00
Adrian Bunk 8f8bf7e64e [SCSI] make scsi_decode_sense_buffer and scsi_decode_sense_extras static
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:25 -04:00
Gabriel C 8d9e0f46b4 [SCSI] NCR5380: fix NCR53C400_PSEUDO_DMA is not defined
In file included from drivers/scsi/g_NCR5380_mmio.c:9:
drivers/scsi/g_NCR5380.c:559:5: warning: "NCR53C400_PSEUDO_DMA" is not defined

Signed-off-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:22 -04:00
Adrian Bunk 79ee830442 [SCSI] scsi_error.c should #include "scsi_transport_api.h"
Every file should #include the headers containing the prototypes for its
global functions (in this case for scsi_schedule_eh()).

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:18 -04:00
Andrew Morton 305aad0bf5 [SCSI] ips: warning fix
drivers/scsi/ips.c: In function 'ips_insert_device':
drivers/scsi/ips.c:6957: warning: 'index' may be used uninitialized in this function

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:14 -04:00
Jesper Juhl ffcde188a8 [SCSI] NCR_D700, lpfc: Clean up duplicate includes
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: James Smart <james.smart@emulex.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:11 -04:00
Andrew Morton 87f3bda35e [SCSI] aacraid: rename check_reset
Too generic, clashes with ISDN.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:07 -04:00
Jesper Juhl a0a74e4505 [SCSI] lpfc: fix potential overflow of hbqs array
The Coverity checker noticed that we may overrun a statically allocated
array in drivers/scsi/lpfc/lpfc_sli.c::lpfc_sli_hbqbuf_find().

The case is this; In 'struct lpfc_hba' we have

	#define LPFC_MAX_HBQS  4
	...
	struct lpfc_hba {
		...
		struct hbq_s hbqs[LPFC_MAX_HBQS];
		...
	};

But then in lpfc_sli_hbqbuf_find() we have this code

	hbqno = tag >> 16;
	if (hbqno > LPFC_MAX_HBQS)
		return NULL;

if 'hbqno' ends up as exactely 4, then we won't return, and then this

	list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) {

will cause an overflow of the statically allocated array at index 4,
since the valid indices are only 0-3.

I propose this patch, that simply changes the 'hbqno > LPFC_MAX_HBQS'
into 'hbqno >= LPFC_MAX_HBQS' as a possible fix.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:40:03 -04:00
Matthew Wilcox 4bd6d7f356 [SCSI] advansys: Move documentation to Documentation/scsi
The 700+-line comment at the top of the advansys driver fits more comfortably
in Documentation/scsi.

Delete the sections on:
 - kernels supported
 - other files modified (obsolete)
 - source comments (obsolete)
 - tests to run
 - release history (that's what a VCS is for)
 - contacting connectcom (the domain has expired and the phone number is
   now in use by another organisation)

Known problems/fix list is moved down to the section where jejb put his FIXME.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:56 -04:00
Matthew Wilcox d68f432135 [SCSI] advansys: use memcpy instead of open-coded loop
Use memcpy to initialise eep_config instead of a loop.  For
AdvInitFrom38C1600EEP where we need to modify the default EEPROM
configuration, do it after the loop, and do it using the structure
definition, not by finding the right byte.  I think it was wrong for
big-endian machines.

Also delete some non-useful comments and prototypes.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:52 -04:00
Matthew Wilcox 13ac2d9c79 [SCSI] advansys: Remove pci_slot_info
The driver kept a copy of the PCI config address; refer to the pci_dev
associated with the card instead.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:49 -04:00
Matthew Wilcox 895d6b4ca8 [SCSI] advansys: Remove library-style callback routines
Convert adv_isr_callback, adv_async_callback and asc_isr_callback into
direct calls.  Remove the unused asc_exe_callback.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:45 -04:00
Matthew Wilcox 394dbf3f40 [SCSI] advansys: Move struct device out of the cfg structures
The cfg structures are supposed to be disposable after initialisation;
with the 'dev' used for DMA mapping in there, that's not possible.  Move
the dev to the board.

Also inline AscInitFromAscDvcVar into its only caller, remove some
unnecessary prototypes and sort out a few minor formatting issues.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:41 -04:00
Matthew Wilcox 4a2d31c811 [SCSI] advansys: Stop using n_io_port in Scsi_Host structure
n_io_port isn't suitable for advansys because some of the boards have
more than 255 bytes of io port space.  There's already a driver-private
replacement, asc_n_io_port, but for some reason the driver was still
setting and occasionally reporting n_io_port.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:37 -04:00
Matthew Wilcox 57ba5fe988 [SCSI] advansys: ioremap no longer needs page-aligned addresses
At some point during Linux 2.1 development, ioremap() gained the ability
to handle addresses which weren't page-aligned.  Also expand the CONFIG_PCI
range to encompass that entire section of wide board initialisation, since
all wide boards are PCI.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:33 -04:00
Matthew Wilcox 59fcf84409 [SCSI] advansys: delete AscGetChipBusType
By moving a test from AscGetChipBusType into its only caller, we can delete
the whole function

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:30 -04:00
Matthew Wilcox ecec194747 [SCSI] advansys: misc reformatting
Remove some useless forward declarations
Reformat some comments, debug messages, and the occasional piece of real code
Removal of unnecessary braces
Remove duplicate setting of shost->irq

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:26 -04:00
Matthew Wilcox 47d853ccbe [SCSI] advansys: remove INQUIRY sniffing
Use slave_configure() to do all the work that used to be done in
AscInquiryHandling and AdvInquiryHandling.  Split slave_configure into
two functions, one for wide and one for narrow controllers.

Remove some unused definitions, duplicate definitions, unnecessary
declarations, and scsireqq, cap_info and inquiry from struct asc_board.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:22 -04:00
Matthew Wilcox 2ffb45c672 [SCSI] Add QUANTUM XP34301 to the blacklist
According to the AdvanSys driver, this device has a problem with tagged
queueing.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:19 -04:00
Matthew Wilcox ce3a7f1202 [SCSI] advansys: remove AscCompareString()
AscCompareString() is just another name for strncmp

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:15 -04:00
Matthew Wilcox 9649af39e3 [SCSI] advansys: More PCI cleanups
- Remove wrappers around the PCI configuration space accessors
 - Call pci_set_master() instead of poking at config space directly
 - Move the latency setting into one function called for both narrow and
   wide boards.
 - Tidy up AdvInitGetConfig() a little.
 - Delete a few unused prototypes and definitions.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:12 -04:00
Matthew Wilcox 71f36115d2 [SCSI] advansys: Update resource management
Make sure the resources are reserved and released by all the callers of
advansys_board_found().  This eliminates the check_region-style race.
It also allows us to use the pci_request_regions() API.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:08 -04:00
Matthew Wilcox c304ec9473 [SCSI] advansys: Convert to ISA driver model
Register two isa_drivers, one for ISA and one for VLB, in order to
preserve detection order.  When deleting advansys_detect, we lose the
last vestiges of the code that limited IO port scanning.  This code
has been effectively disabled for many years anyway; I'll restore it
in a module_param later.  We also lose the code that placed all ISA PnP
cards into WaitForKey state -- drivers shouldn't be doing this anyway.
The asc_host array goes away too.  Also remove some IOADR and other
definitions, such as ASC_NUM_BOARD_SUPPORTED.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:04 -04:00
Matthew Wilcox b09e05a73e [SCSI] advansys: Convert to EISA driver model
- Switch EISA probing to the driver model
 - Remove some now-unused macros and functions
 - Update the FIXME now that we use the correct driver model probing API

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:39:01 -04:00
Matthew Wilcox 78e77d8b50 [SCSI] advansys: Convert to PCI driver model
- Add a pci_driver interface for the PCI advansys devices (for
   ISA/EISA/VLB devices, we still call advansys_detect).
 - Many functions are converted from __init to __devinit to allow hotplug
   PCI to work.
 - Only keep devices found by advansys_detect in the asc_host list.
 - Rename asc_board_count to asc_legacy_count.  New asc_board_count is only
   used to generate a unique name for each device.
 - Remove some now-unused macros and struct definitions

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:56 -04:00
Matthew Wilcox 8dfb537933 [SCSI] advansys: Move to scsi hotplug initialisation model
- Switch from scsi_register/scsi_unregister to scsi_host_alloc,
   scsi_add_host, scsi_scan_host and scsi_host_put.
 - Rename the scsi_host_template to advansys_template
 - Use module_init and module_exit instead of scsi_module.c
 - Remove protection against advansys_detect being called twice

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:53 -04:00
Matthew Wilcox b2c16f586e [SCSI] advansys: Make advansys_board_found a little more readable
- Put all the error cleanup at the end of the function and goto the
   appropriate label
 - Split advansys_wide_init_chip out of advansys_board_found
 - Split advansys_wide_free_mem out of advansys_board_found.  Use it
   from advansys_release
 - Use GFP_KERNEL, not GFP_ATOMIC, when allocating memory during
   initialisation
 - Eliminate lots of PROC_FS ifdefs by removing the ifdefs around the prtbuf
   struct member

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:49 -04:00
Matthew Wilcox 605fe5987f [SCSI] advansys: Stop checking the scsi_cmnd belongs to our Scsi_Host
The interrupt routines used to walk the list of Scsi_Hosts belonging to
this driver to make sure that the scsi_cmnd belonged to one of them.
This is a waste of time and gets in the way of later cleanups, so
delete it.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:44 -04:00
Matthew Wilcox 074c8fe4c0 [SCSI] advansys: Improve interrupt handler
Pass the Scsi_Host to the interrupt handler, rather than polling all
hosts for each interrupt.
Return IRQ_NONE if we didn't handle this interrupt
Don't set the IRQF_DISABLED flag; this is not a fast-executing interrupt
handler.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:40 -04:00
Matthew Wilcox 2a437959e9 [SCSI] advansys: Clean up proc_info implementation
Just use the Scsi_Host passed in, rather than looking through the driver's
own array of boards for one that matches it.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:37 -04:00
Matthew Wilcox 8c6af9e174 [SCSI] advansys: undate version, copyright, etc
Update the version to 3.4
Add my copyright
Add myself to MAINTAINERS
Exercise my right to change the license from dual BSD/GPL to GPL
Don't force the definition of CONFIG_ISA on x86
Always include pci.h
Stop including stat.h

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:33 -04:00
FUJITA Tomonori ea312552e9 [SCSI] sg: increase sglist_len of the sg_scatter_hold structure
unsigned short is too small for sizeof(struct scatterlist) *
min(q->max_hw_segments, q->max_phys_segments).

This fixes memory leak with 4096 segments since 16 (likely sg size
with x86) * 4096 sets sglist_len to zero.

This might not happen without sg chaining support.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:28 -04:00
Matthew Wilcox 6b7f123f37 [SCSI] Fix async scanning double-add problems
Stress-testing and some thought has revealed some places where
asynchronous scanning needs some more attention to locking.

 - Since async_scan is a bit, we need to hold the host_lock while
   modifying it to prevent races against other CPUs modifying the word
   that bit is in.  This is probably a theoretical race for the moment,
   but other patches may change that.
 - The async_scan bit means not only that this host is being scanned
   asynchronously, but that all the devices attached to this host are not
   yet added to sysfs.  So we must ensure that this bit is always in sync.
   I've chosen to do this with the scan_mutex since it's already acquired
   in most of the right places.
 - If the host changes state to deleted while we're in the middle of
   a scan, we'll end up with some devices on the host's list which must
   be deleted.  Add a check to scsi_sysfs_add_devices() to ensure the
   host is still running.
 - To avoid the async_scan bit being protected by three locks, the
   async_scan_lock now only protects the scanning_list.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:24 -04:00
Mike Christie bd441deaf3 [SCSI] fix write buffer length in scsi_req_map_sg()
sg's may have setup a the buffer with a different length than
the transfer length so we should be using the bufflen passed
in as the request's data len.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:17 -04:00