Commit Graph

136 Commits (121dfc4b3eba9e2f3c42d35205a3510cc65b9931)

Author SHA1 Message Date
Linus Torvalds 3cfc2c42c1 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (48 commits)
  Documentation: update broken web addresses.
  fix comment typo "choosed" -> "chosen"
  hostap:hostap_hw.c Fix typo in comment
  Fix spelling contorller -> controller in comments
  Kconfig.debug: FAIL_IO_TIMEOUT: typo Faul -> Fault
  fs/Kconfig: Fix typo Userpace -> Userspace
  Removing dead MACH_U300_BS26
  drivers/infiniband: Remove unnecessary casts of private_data
  fs/ocfs2: Remove unnecessary casts of private_data
  libfc: use ARRAY_SIZE
  scsi: bfa: use ARRAY_SIZE
  drm: i915: use ARRAY_SIZE
  drm: drm_edid: use ARRAY_SIZE
  synclink: use ARRAY_SIZE
  block: cciss: use ARRAY_SIZE
  comment typo fixes: charater => character
  fix comment typos concerning "challenge"
  arm: plat-spear: fix typo in kerneldoc
  reiserfs: typo comment fix
  update email address
  ...
2010-08-04 15:31:02 -07:00
Eric Moore 3cb5469a2a [SCSI] mpt2sas: driver fails to recover from injected PCIe bus errors
fixes surrounding PCIe enhanced error handling:

(1) We need to reject all request generated internaly inside the driver as well
as request arriving from the scsi mid layer when PCIe EEH is active. The fix is
to add a per adapter flag called pci_error_recovery which is checked thru out
the driver when request are generated.

(2) We don't need to call the pci_driver->remove directly from the PCIe
callbacks becuase its already called from the PCIe EEH code. In its place we are
shutting down the watchdog timer, and flushing back all pending IO.

(3) We need to save and restore the pci state across PCIe EEH handling.

Signed-off-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:03 -05:00
Kashyap, Desai d4572c3dbb [SCSI] mpt2sas: Bump version 06.100.00.00
Version upgrade patch

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:26 -05:00
Kashyap, Desai 1bbfa378af [SCSI] mpt2sas: Copy message frame before releasing to free pool to have a local reference.
Current driver is  not clearing the per device tm_busy flag
following the Task Mangement request completion from the IOCTL path.
When this flag is set, the IO queues are frozen.   The reason the flag
didn't get cleared is becuase the driver is referencing
memory associated to the mpi request following the completion, when
the memory had been reallocated for a new request.  When the memory
was reallocated, the driver didn't clear the flag becuase it was
expecting a task managment reqeust, and the reallocated request was
for SCSI_IO.  To fix the problem the driver needs to have a cached
backup copy of the original reqeust.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:25 -05:00
Kashyap, Desai 769578ff81 [SCSI] mpt2sas: Copy sense buffer instead of working on direct memory location
(1) driver was not setting the sense data size prior to sending SCSI_IO,
resulting in the 0x31190000 loginfo
(2) The driver needs to copy the sense data to local buffer prior
to releasing the request message frame.  If not, the sense buffer gets
overwritten by the next SCSI_IO request.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:24 -05:00
Kashyap, Desai 8e864a81e3 [SCSI] mpt2sas: Adding additional message to error escalation callback
Adding additional messages to the error escallation callbacks which
displays the wwid, sas address, handle, phy number, enclosure logical id,
and slot. In the same eh callbacks, routines, the printks were converted
to sdev_printks, which displays the bus target mapping.  These additional
modifications help better identify the device which is in recovery.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:23 -05:00
Kashyap, Desai d417d1c3a3 [SCSI] mpt2sas: Add additional check for responding volumes after Host Reset
ISSUE DESCRIPTION:
This test case involves creating two RAID1 volumes,  then
simultaneiously issue host reset and pull all the drives associated to
the 1st raid volume.  The observed behavour is the physical drives are
removed, however the volume remains.   The expected behavour is the
volume as well as physical drives should be removed from OS.

FIX:
Add support in the post host reset device scan logic for raid volumes
where the driver will have an additional check for responding raid
volume where the status should be either online, optimal, or degraded.
So for voluemes that have a status of missing or failed, the driver
will mark them for deletion.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:21 -05:00
Kashyap, Desai 3e2e833a54 [SCSI] mpt2sas: Added -ENOMEM return type when allocation fails
In the driver mpt2sas_base_attach subroutine, we need to add
support to return the proper error code when there are memory allocation
failures, e.g. returning -ENOMEM.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:20 -05:00
Kashyap, Desai f3eedd698e [SCSI] mpt2sas: Redesign Raid devices event handling using pd_handles per HBA
Actual problem :
Driver  may receiving the top level expander
removal event prior to all the individual PD removal events, hence the
driver is breaking down all the PDs in advanced to the actaul PD UNHIDE
event. Driver sends multiple
Target Resets to the same volume handle for each individual PD removal.

FIX DESCRIPTION:
To fix this issue, the entire PD device handshake protocal has to be
moved to interrupt context so the breakdown occurs immediately after the
actual UNHIDE event arrives.  The driver will only issue one Target Reset to
the volume handle, occurring after the FAILED or MISSING volume status
event arrives from interrupt context. For the PD UNHIDE event, the driver
will issue target resets to the PD handles, followed by OP_REMOVE.  The
driver will set the "deteleted" flag during interrupt context.  A "pd_handle"
bitmask was introduced so the driver has a list of known pds during entire
life of the PD; this replaces the "hidden_raid_component" flag handle in
the sas_device object.  Each bit in the bitmask represents a device handle.
The bit in the bitmask would be toggled ON/OFF when the HIDE/UNHIDE
events arrive; also this pd_handle bitmask would bould be refreshed
across host resets.

Here we kept older behavior of sending target reset to volume when there is
a single drive pull, wait for the reply, then send target resets
to the PDs.  We kept this behavior so the driver will
behave the same for older versions of firmware.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:19 -05:00
Kashyap, Desai 7fbae67a3f [SCSI] mpt2sas: Tie a log info message to a specific PHY.
Add support to display additional debug info for SCSI_IO and
RAID_SCSI_IO_PASSTHROUGH sent from the normal entry queued entry
point, as well as internal generated commands, and IOCTLS.  The
additional debug info included the phy number, as well as the
sas address, enclosure logical id, and slot number.  This debug info
has to be enabled thru the logging_level command line option, by
default this will not be displayed.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:17 -05:00
Kashyap, Desai eabb08ad2d [SCSI] mpt2sas: print level KERN_DEBUG is replaced by KERN_INFO
Converting print level from  MPT2SAS_DEBUG_FMT  to MPT2SAS_INFO_FMT.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:16 -05:00
Kashyap, Desai 570c67ac44 [SCSI] mpt2sas: Added sysfs support for trace buffer
Added support so the diag ring buffer can be pulled via sysfs
Added three new shost attributes: host_trace_buffer,
host_trace_buffer_enable, and host_trace_buffer_size.  The
host_trace_buffer_enable attribute is used to either post or release
the trace buffers.   The host_trace_buffer_size attribute contains
the size of the trace buffer. The host_trace_buffer atttribute contains
a maximum 4KB window of the buffer. In order to read the entire host buffer,
you will need to write the offset to  host_trace_buffer prior to reading
it. release the host buffer, then write the entire host buffer contents to
a file.
In addition to this enhancement, we moved the automatic posting of host buffers
at driver load time to be called prior to port_enable, instead of after.
That way discovery is available in the host buffer.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:14 -05:00
Kashyap, Desai 203d65b16c [SCSI] mpt2sas: MPI header version N is updated.
Updating MPI header version N.
Removed mpi_history.txt.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:13 -05:00
Kashyap, Desai d32a8c15e1 [SCSI] mpt2sas: Added sysfs counter for ioc reset
Added a new sysfs shost attribute called ioc_reset_count. This will
keep count of host resets (both diagnostic and message unit).

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:11 -05:00
Kashyap, Desai b8d7d7bb37 [SCSI] mpt2sas: Added expander phy control support
Added support to send link resets, hard resets, enable/disable phys, and
changing link rates for for expanders.  This will be exported to
attributes within the sas transport layer.  A new wrapper function was
added for sending SMP passthru to expanders for phy control.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:10 -05:00
Kashyap, Desai d5f491e658 [SCSI] mpt2sas: Added expander phy counter support
Added support to retrieve the invalid_dword_count,
running_disparity_error_count, loss_of_dword_sync_count, and
phy_reset_problem_count for expanders.  This will be exported to
attributes within the sas transport layer.  A new wrapper function was
added for sending SMP passthru to retrieve the expander phy error log.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:08 -05:00
Kashyap, Desai dd5fd3323a [SCSI] mpt2sas: staged device discovery. disable_discovery module parameter is added.
Added command line option called disable_discovery.  When enabled
on the command line, the driver will not send a port_enable when loaded
for the first time.   If port_enable is not called, then there is
no discovery of devices, as well as the sas topology.  Then later if one
desires to invoke discovery, then they will need to issue a diagnostic reset.
A diagnostic reset can be issued various ways. One of the way is throught
sysfs.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:07 -05:00
Kashyap, Desai d274213a1a [SCSI] mpt2sas: Hold Controller reset when another reset is in progress
Driver should not allow multiple host reset when already host reset is in
progress. It is possible that host reset was sent by scsi mid layer while there was already an host reset active,
either issued via IOCTL interface or internaly, like a config page timeout.
Since there was a host reset active, the driver would return a FAILED response
to the scsi mid layer. The solution is make sure pending host resets will
wait for the active host reset to complete before returning control
back up the call stack.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:06 -05:00
Kashyap, Desai ab6ce92541 [SCSI] mpt2sas: Fix to use sas device list instead of enclosure list for _transpor_get_enclosure_identifier.
Enclosure_identifier not being returned by mpt2sas
The driver exports callback function to the sas transport layer
for obtaining the enclosure logical id.  This function is called
_transport_get_enclosure_identifier.  The driver was searching
the wrong list for the enclosure_identifier.  The driver should be
searching the sas device list instead of enclosure list.  The
sas address that is passed to the driver is for the end device, not
enclosure.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:02:06 -05:00
Eric Moore d334aa7978 [SCSI] mpt2sas: DIF Type 2 Protection Support
Adding DIF Type 2 protection support, as well as turning on 32 byte cdb's,
and setting the cdb length for > 16 byte in the SCSI_IO->control parameter.

Signed-off-by: Martin Petersen <martin.petersen@oracle.com>
Signed-off-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:00:59 -05:00
Jiri Kosina f1bbbb6912 Merge branch 'master' into for-next 2010-06-16 18:08:13 +02:00
Uwe Kleine-König 65155b3708 fix typos concerning "management"
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-06-16 18:03:16 +02:00
Alexey Dobriyan 4be929be34 kernel-wide: replace USHORT_MAX, SHORT_MAX and SHORT_MIN with USHRT_MAX, SHRT_MAX and SHRT_MIN
- C99 knows about USHRT_MAX/SHRT_MAX/SHRT_MIN, not
  USHORT_MAX/SHORT_MAX/SHORT_MIN.

- Make SHRT_MIN of type s16, not int, for consistency.

[akpm@linux-foundation.org: fix drivers/dma/timb_dma.c]
[akpm@linux-foundation.org: fix security/keys/keyring.c]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-25 08:07:02 -07:00
Kashyap, Desai aea20f9540 [SCSI] mpt2sas: Bump version 05.100.00.02
Upgrade version to 05.100.00.02

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 14:00:33 -05:00
Kashyap, Desai 980ead3180 [SCSI] mpt2sas: Before removing sas_device search device in list for _scsih_sas_device_remove
Fix a oops in _scsih_sas_device_remove.  The driver was attempting to
delete a object from the sas_device link list when the object was not
present.

Added sanity check for sas_device NULL dereference.
before deleting sas_device now driver will search device in list then
only it will follow device removal.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 14:00:32 -05:00
Kashyap, Desai 130b958a5d [SCSI] mpt2sas: Reworked scmd->result priority for _scsih_qcmd.
we added support to set the deleted flag prior to device scan,
then clear the flag for responding devices, leaving the deleted flag only
set for missing devices.  The problem is for internal generated host resets,
IO queues are not blocked at scsi mid layer level.  IO will be continued
sent to driver, and driver  will return SCSI_MLQUEUE_HOST_BUSY.  The problem
is the driver checks for the deleted flag before it checks for the
controller being in reset, so there is a window where the driver would be
returning DID_NO_CONNECT for responding devices.  This occurs during  the
time between calling  _scsih_prep_device_scan, and
_scsih_mark_responding_sas_device & _scsih_mark_responding_raid_device.

Fix the queuecommand entry point so ioc->shost_recovery flag sanity check is
given higher presidence then the device "deleted flag" check.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 14:00:30 -05:00
Kashyap, Desai 40364a40b6 [SCSI] mpt2sas: Upgrade version 05.100.00.01
Upgraded version string.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 13:42:48 -05:00
Kashyap, Desai 66a6793657 [SCSI] mpt2sas: Check for NULL pointer before free_pages is added.
Added check before free_pages just to make sure ioc->scsi_lookup is not NULL.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 13:42:46 -05:00
Kashyap, Desai ef7c80c1f1 [SCSI] mpt2sas: Added support for PCIe Advanced Error Recovery.
Added support in the driver to support EEH and
PCIe Advanced Error Recovery. This involves adding new
pci_error_handler interface for recovering the controller from PCI Bus
errors, such as SERR and PERR. Some tools are available for simulating
PCI errors in order to validate this interface:
http://www.kernel.org/pub/linux/utils/pci/aer-inject

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 13:42:41 -05:00
Kashyap, Desai ebda4d38df [SCSI] mpt2sas: Send default descriptor for RAID pass through in mpt2ctl
RAID_SCSI_IO_PASSTHROUGH: Driver needs to be sending the default
descriptor for RAID Passthru, currently its sending SCSI_IO descriptor.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 13:41:51 -05:00
Kashyap, Desai 38c2911449 [SCSI] mpt2sas: sanity added to remove duplicate port from topology
There are few special cases which needs to be handled deleting old port.

CASE1: In topology you need cascaded expanders. Through sysfs just make sure
topology is up. Erase the manufacturing image of the cascaded expander and
reset the board. In some cases Adapter will receive Exapnder Add event
before expander delete. In such a case, driver needs to delete duplicate
port before adding new port.

CASE2: Enable Device Missing delay of HBA through lsiutils. If expander or
end device is hotswapped with different device before DMD timer expires,
driver will get device add for new device first and then device deletion
event for the original devices will arrive later at DMD timer expires. In
this case also driver need to delete duplicate port before adding port for
new device.

Added new function which will make sure when new port is
added, that its not claiming the same phy resources already in use by
another port. If it does, then it will delete the other port before adding
the new port.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 13:41:50 -05:00
Kashyap, Desai 1469585309 [SCSI] mpt2sas : IOs needs to be pause until handles are refreshed for all device after recovery
After Host Reset firmware will have new list of device handles for the target.
Device handle refresh in driver is part of Rescan topology logic.
(See functions like *_search_responding_*). This needs to be done from Host
Reset context before making shost_recovery to 0. Currently it is done in
Firwmare event context, which may leads IO to a wrong device.

Now handler refresh is moved to HBA reset context.
Apart from this, Now driver will stop IOs for all device setting deleted
flag to 1 at the time of HBA Reset through _scsih_prep_device_scan.
It will only unblock devices, if devices has been found as part of RESCAN.
This way it will make more safe IO blocking at the time of HBA reset at
mpt2sas driver layer.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 13:27:01 -05:00
Kashyap, Desai 1a7d7eac6f [SCSI] mpt2sas: Bump version 05.100.00.00
Upgraded version string.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:03 -05:00
Kashyap, Desai 31b7f2e25d [SCSI] mpt2sas: Copyright 2010.
Copyright changes for year 2010.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:02 -05:00
Kashyap, Desai 58287fd59c [SCSI] mpt2sas: Default descriptor for RAID Passthru command.
RAID_SCSI_IO_PASSTHROUGH: Driver needs to be send the default
descriptor for RAID Passthru, currently its sending SCSI_IO descriptor.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:01 -05:00
Kashyap, Desai f6aee7b9ae [SCSI] mpt2sas: return -ENOMEM if memory allocation failed.
Added proper return type values in case memory allocation failed.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:01 -05:00
Kashyap, Desai 8ed9a03ad4 [SCSI] mpt2sas: removed use of tm_cmds.mutex in IOCTL branch.
Removed all the mutex's for ioc->tm_cmds.mutex, then created one
single mutex inside the function mpt2sas_scsih_issue_tm. This is the
single function used when sending task management. Also the sanity
checks required for scsi mid layer escalation were moved to inside the
same function because these checks need to be done while the mutex is
held. The ioc->tm_cmds.mutex inside the IOCTL branch is really not
required since there is another mutex in this code called for ctl_cmds
handling this sync.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:00 -05:00
Kashyap, Desai e94f674721 [SCSI] mpt2sas: Fix for little endian
1. Fixes for little endian issues.
2. Now Debug info for Discovery event is more readable.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:59 -05:00
Kashyap, Desai b4344276f7 [SCSI] mpt2sas: Driver will not treat NEEDS_INIT as failure.
Now Driver will not treat NEEDS_INIT as failure. In addition to this,
the driver will now display message to describe the the access flags
when bits are set, so the end user can better understand failures.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:58 -05:00
Kashyap, Desai 6558bbb145 [SCSI] mpt2sas: Early return from function if shost is in recovery.
Aded checks for shost_recovery flag for early return from function.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:57 -05:00
Kashyap, Desai 89009fbb7d [SCSI] mpt2sas: Use of get_free_pages for huge memorary allocation.
use the get_free_pages API for larger contigious physical memory chunk.
Also, the ioc->chain_depth need to be changed from
a 16bit to 32bit variable because the number of chains will exceed 64k
when the queue depth is large.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:56 -05:00
Kashyap, Desai f891dcfdc1 [SCSI] mpt2sas: Corrected conditional checks for Internal device Reset
bug fix in the handling of the internal device reset event
The reason code check in scsih_sas_device_status_change_event never
evaluates as true for internal device reset, hence driver never quiesce s IO
when firmware is sending a device reset. The fix is to change the
evaluate to:
if (event_data->ReasonCode !=
    MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET &&
   event_data->ReasonCode !=
    MPI2_EVENT_SAS_DEV_STAT_RC_CMP_INTERNAL_DEV_RESET)
        return;

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:54 -05:00
Kashyap, Desai 7921b35c5f [SCSI] mpt2sas: Corrected time stamp
incorrect timestamp on 32 bit platforms: The upper 32 bit of
the timestamp was getting truncated when converting seconds to
milliseconds, which was due to the variable being long. To fix the problem,
the variable needs to be u64. Also the microseconds conversion to
milliseconds was incorrect; it should be divide by 1000 instead of divide by
8.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:54 -05:00
Kashyap, Desai 31cef6bcb8 [SCSI] mpt2sas : Do not reset handle before calling _scsih_remove_device in RESCAN task after HBA RESET
Setting handle to zero is not required before _scsih_remove_device.
Driver uses sas_device->handle reference in _scsih_remove_device.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:53 -05:00
Richard A Lary fc193172e6 [SCSI] mpt2sas: use correct pci_resource_flag for comparison
This patch replaces incorrect base address space flag with correct IO
resource flag.  Also, performs check of memory resource to validate
resource before using.

Signed-off-by: Richard A Lary <rlary@linux.vnet.ibm.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:33 -05:00
Kashyap, Desai 1278b11f46 [SCSI] mpt2sas : Device removal algorithm in interrupt context only
external host not connecting after controller reboot: The
problem is : devices are not coming back after having the cable
disconnected then reconnected. The problem is because the
driver/firmware device removal handshake is failing. Due to this failure,
the controller firmware is not sending out device add events when the target
is reconnected. This is root caused to a race in the driver/firmware device
removal algorithm. There is duplicate code in both interrupt and user
context; where target reset is being issue from user context path while
sas_iounit_control(OP_REMOVE) is being sent from interrupt context. An
active target_reset will fail the OP_REMOVE. To fix this problem, the
duplicate code has been removed from user context path.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:29 -05:00
Kashyap, Desai 40956059fb [SCSI] mpt2sas: Upgrading version to 04.100.01.02
Upgraded version string.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:29 -05:00
Kashyap, Desai cd9843f8af [SCSI] mpt2sas: modified _scsih_sas_device_find_by_handle/sas_address
modified _scsih_sas_device_find_by_handle
so to handle the search on both list(device list and device_init_list)
Also, we moved the priority of the
search so the ioc->sas_device_list is done first.  The
"sas_device_init_list" is only used during the 1st port enable, so its
unlikely there’s devices on it.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:28 -05:00
Kashyap, Desai f1c35e6aea [SCSI] mpt2sas: RESCAN Barrier work is added in case of HBA reset.
Add the cancel_pending_work flag from the fw_event_work structure, and then to
set the flag during host reset, check the flag later from work threads
context and if cancel_pending_work_flag is set ingore those events.

Now Rescan after host reset is changed.
Added special task MPT2SAS_RESCAN_AFTER_HOST_RESET. This task will be queued
at the time of HBA reset. this task is treated as barrier. All work after
MPT2SAS_RESCAN_AFTER_HOST_RESET will be treated as new work and will be
server by callback handle. If host_recovery is going on while running RESCAN
task, it will wait for shos_recovery_done completion which will be called
from HBA reset DONE context.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:27 -05:00
FUJITA Tomonori bb789d0162 [SCSI] mpt2sas: fix the incorrect scsi_dma_map error checking
scsi_dma_map() returns -1 if an error occurred (zero means that the
command has no data). So the following current code can't catch an
error:

sges_left = scsi_dma_map(scmd);
if (!sges_left) {
	sdev_printk(KERN_ERR, scmd->device, "pci_map_sg"
	" failed: request for %d bytes!\n", scsi_bufflen(scmd));
	return -ENOMEM;
}

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:26 -05:00