History log of /drivers/message/fusion/mptsas.c
Revision Date Author Comments
85d37226fb5faaf7bec55df50c2cd029bd6bb3cd 18-Nov-2011 Chandrakala Chavva <cchavva@caviumnetworks.com> [SCSI] mptsas: Add device ID for SAS1068_820XELP.

Signed-off-by: Chandrakala Chavva <cchavva@caviumnetworks.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: "Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
98cbe371fd373f13806595835b79da07f3a2f934 05-Aug-2011 kashyap.desai@lsi.com <kashyap.desai@lsi.com> [SCSI] mptfusion: Fix for device offline while doing aggressive HBA reset

[Resend patch as per Bernd Schubert comment ]

Issue:

Device goes offline while doing aggressive HBA reset
along with IO using some utility.

Root cause:

FW goes into bad state due to aggressive reset. Softreset does not
help to recover FW. And also aggressive reset open up the window for
Error handling thread to kicked off at the same time HBA will be in
constant RESET loop as part of aggressive reset test case can lead
Device to goes offline.

Changes:

1. Added extra check as below inside eh_timed_out call back as below.
if(ioc->ioc_reset_in_progress) Rc = EH_TIMER_RESET

2. Removed " DOORBELL_ACTIVE" check for SAS controller from task
management context. Since SAS controller uses high priority queue
for task management. This check is not required for SAS controller.

3. Moved SoftReset call to HardReset from Task Mgmt context.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
a38ae37fdcd77657fb6624b0a0ec57f3d21e2f40 04-Aug-2011 kashyap.desai@lsi.com <kashyap.desai@lsi.com> [SCSI] mptfusion: Avoid out of order Event processing due to cpu migration

Driver will now schedule MPI event using "delay_work_queue_on" to
specify same CPU to be used to schedule work. Earlier it used
"delay_work_queue" which can cause migration of work due to kernel'
timer migration feature.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
e62cca19a9bbfc72c62632d95a7c01cd6476708c 04-Aug-2011 kashyap.desai@lsi.com <kashyap.desai@lsi.com> [SCSI] mptfusion: Better handling of DEAD IOC PCI-E Link down error condition

Find Non-Operation IOC and remove it from OS: Detecting
dead(non-functional) ioc will be done reading doorbell register value
from fault reset thread, which has been called from work thread
context after each specific interval. If doorbell value is 0xFFFFFFFF,
it will be considered as IOC is non-operational and marked as dead
ioc.

Once Dead IOC has been detected, it will be removed at pci layer using
"pci_remove_bus_device" API.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
3850b14e51d32fc0d4297ceb30f3f7bb2c2b4779 04-Aug-2011 kashyap.desai@lsi.com <kashyap.desai@lsi.com> [SCSI] mptfusion: Set max sector count module parameter

The max_sector setting is currently hard-coded in the driver to 8192
sectors (4MB transfers). Using new module parameter, if max_sectors is
specified at load time, the default of 8192 will be overridden.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
72ef0e5757c160fc627d2c89b6379bc102ccab5c 02-May-2011 Borislav Petkov <borislav.petkov@amd.com> [SCSI] mptsas: Fix annoying warning

Shut up

drivers/message/fusion/mptsas.c: In function 'mptsas_event_process':
drivers/message/fusion/mptsas.c:5015: warning: unused variable 'log_info'

for configs with CONFIG_SCSI_MPT2SAS_LOGGING unset.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
3487735aa54407565278a5a1288119c45210b86c 10-Feb-2011 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Remove bus reset for mptsas module

Bus reset is not required for SAS Controller. It is valid for mptspi
and mptfc, but for mptsas it is not required. It is an extra work for
Error handling escallation for mptsas. Removing bus reset from error
handling will eventually speedup Error handling for SAS controller.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d75733d51fdab5c99a0d9491b25f22e13b39cdc1 10-Feb-2011 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Support SAS2.0 Devices with SAS1.0 Controllers

SAS1.0 Controller was not able to detect SAS2.0 Expanders due to Link
RATE detection was limited to 1.5 Gbps and 3.0 Gbps for SAS1
controllers. Added detection for 6.0 Gbps link. Now, user can mix-up
6.0 Gpbs links with SAS1.0 controller.

e.g SAS1.0 HBA <----> SAS2.0 Expander <------> SAS2.0 Expander <--------> SAS1.0 Drive.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
f281233d3eba15fb225d21ae2e228fd4553d824a 16-Nov-2010 Jeff Garzik <jeff@garzik.org> SCSI host lock push-down

Move the mid-layer's ->queuecommand() invocation from being locked
with the host lock to being unlocked to facilitate speeding up the
critical path for drivers who don't need this lock taken anyway.

The patch below presents a simple SCSI host lock push-down as an
equivalent transformation. No locking or other behavior should change
with this patch. All existing bugs and locking orders are preserved.

Additionally, add one parameter to queuecommand,
struct Scsi_Host *
and remove one parameter from queuecommand,
void (*done)(struct scsi_cmnd *)

Scsi_Host* is a convenient pointer that most host drivers need anyway,
and 'done' is redundant to struct scsi_cmnd->scsi_done.

Minimal code disturbance was attempted with this change. Most drivers
needed only two one-line modifications for their host lock push-down.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b595076a180a56d1bb170e6eceda6eb9d76f4cd3 01-Nov-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de> tree-wide: fix comment/printk typos

"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
213aaca3e5727f3eb56002b04a1405db34a54ed8 26-Jul-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Extra debug prints added relavent to Device missing delay error handling

Adding function name in original debug prints and few more debug prints are
added.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
c9de7dc48307395fb71780b567ae8833b080d1c8 26-Jul-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Block Error handling for deleting devices or Device in DMD

Issue description:
In multipath topology, when device deletion is in transient state,
multipath driver can call blk_flush_queue() as part of path failure.
Before device get deleted from OS, Device may go OFFLINE as part of error
handling kicked off triggered from multipathing driver. Above condition hits
more frequently if device missing delay timer (which is LSI specific firmware
parameter) is non zero value.

root cause of this issue is Error handling thread is getting kicked off for
device which is not really present(in transient state of deleting).

This patch has solution for this issue. driver is now using eh_timed_out
callback. See below.

mptsas_transport_template->eh_timed_out = mptsas_eh_timed_out

Using mptsas_eh_timed_out function, driver can decide weather vdevice is
under Device missing delay or deleting state.

for either of those cases, there is BLK_EH_RESET_TIMER return to scsi mid
and error handling thread will not be kicked off for that particular scsi
command.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
97009a29e8c999def2d1e9ef253c226daf9541af 22-Jun-2010 Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com> [SCSI] mptfusion: print Doorbell register in a case of hard reset and timeout

Printing Doorbell register in a case of hard reset and timeout
should be useful for figuring out the state of the system.

Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
3e84beba608dee5a7c7711a3503eb2f335c78fca 07-Apr-2010 Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com> [SCSI] mptsas: fixed hot-removal processing

This patch fixes mptsas disk hot-removal processing. The
hot-removal processing doesn't complete because of this condition.

drivers/message/fusion/mptsas.c:
mptsas_taskmgmt_complete()

if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
mptsas_queue_device_delete(...);

mptsas_queue_device_delete(), which must be called for
hot-removal, never gets called because mptsas_find_vtarget()
always returns 0 here. At that time, the vtarget has already
been freed in mptsas_target_destroy(), and also the scsi_device
has been marked as SDEV_DEL.

As a result of the issue, port deletion functions won't get
called and the device ends up being in an incomplete state.
(Some data structures and sysfs entries, which should be
removed in hot-removal, remain.) One side effect of this is
that a hot-addition of the device (bringing the device back
on) fails.

This patch just removes mptsas_find_vtarget() from the if-state
condition.

Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
cc7e9f5f9999d9c015686ab4a622e1fb529391eb 17-Jun-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Added code for occationally SATA hotplug failure.

Issue: SATA hotplug does not work sometimes.
At the time of ADD device/ADD phys disk, drive may fail to add SATA device
due to temporary SAS Address for SATA device generated by firmware. Final
SAS address for SATA driver will be generated only after disk spinup is
done. This may take some times for slow spining SATA drives.

At phy link up driver gets attached device sas address and stores into
phyinfo. At the time of ADD event driver will read sas device page0 using
channel and FW ID provided in ADD Device event. Here in case of SATA drives,
driver will see miss match in phyinfo->sas_address and latest sas address
read from SAS DEVICE PAGE0 and eventually device won't be added to OS.

Fix:
When Driver read SAS DEVICE PAGE0, it can identify Device type looking at
device_info. If device is SATA drive and sas address mismatch happens,
Driver will do same stuffs which happened at the time of LINK UP to get
correct piece of information from Pages. ( Find parent device and refresh
parent device phys either HBA refresh/Exp refresh)

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
b68bf096d4211bb6490955f86842d8291e8ae218 17-Jun-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: schedule_target_reset from all Reset context

Issue:
target reset will be queued to driver's internal queue to get schedule
later. When driver add target into internal target_reset queue we will block IOs
on those target using scsi midlayer API. Now due to some cause driver is not
executing those target_reset list and it is always in block state.

Changes:
now we are clearing target_reset queue from all other Callback context
instead of only DeviceReset context.Now wherever driver is clearing
taskmgmt_in_progress flag it is considering target_reset queue cleanup
also.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
51106ab5306b752cd53d40626f78774276bb1368 17-Jun-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Added sanity to check B_T mapping for device before adding to OS

Added sanity check before treating any device is a valid device.
It is possible that firmware can have device page0 in its table, but that
devicemay not be available in topology. Device will be available in topology
only if there is Bus Target mapping is done in firmware. Driver will always
check B_T mapping of firmware before reporting device to upper layer.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
aca794ddd688f1bbb7551f569b0620255c052d80 17-Jun-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Corrected declaration of device_missing_delay

device missing delay is 8 bit value in io unit pg1. Making correct variable
declaration for device_missing_delay.

The driver is storing the calculated device missing delay in IOC structure
as a u8 instead of a u16. It needs to be a u16 if the delay is > 255.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
0cf0f23c286459625eb5cbf9934135ff3156ce95 18-Mar-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Proper error handling is added after mpt_config timeout

Added proper error handling after mpt_config.
Now check of MPI_IOCSTATUS_CONFIG_INVALID_PAGE is added.
If error is MPI_IOCSTATUS_CONFIG_INVALID_PAGE, driver will return -ENODEV.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
568da76929392c9feb60a25383250dd6cfa68e05 18-Mar-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Check for command status is added after completion.

1) Corrected name string as "MPT SAS HOST"
2) Added proper check conditions for MPT_MGMT_STATUS_COMMAND_GOOD.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
ffb7fef32b98fff773a5a6882ae4f8aee65a7708 18-Mar-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Proper bus_type check is added

Added proper bus_type check before processing event/ reset handler.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
48959f1eae3068fefb3de05cdc0c2bd8f0f96c37 18-Mar-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: mpt_detach is called properly at the time of rmmod

Current design of mptsas is as follow.
MPTSAS will do probe() if pci id matches for available card in
system, irrespective of mode of controller. If controller is I/T mode
or I mode, things are fine. If controller is only in T mode, mptsas is
not doing complete process of mptsas_probe(). It will only make
sure IOC structure is created and IOC reference is available for
mptstm driver. Now While removing module we should take care
case of Target mode only mptsas. If we are removing IOC which is
only in Target mode, We should only detach IOC instead of
following rest of the cleanup process which is only required for T
mode controller. Now For T mode controller, only part clean up is
done instead of complete cleanup. mpt_detach will call early in case
of Target mode only controller.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d0f698c46141e1d179fb3a86a0ae668d2fd12916 18-Mar-2010 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Added new less expensive RESET (Message Unit Reset)

Message Unit Reset - instructs the IOC to reset the Reply Post and
Free FIFO's. All the Message Frames on Reply Free FIFO are
discarded. All posted buffers are freed, and event notification is
turned off. IOC doesnt reply to any outstanding request. This will
transfer IOC to READY state. Message unit ready is less expensive
operations than Hard Reset. soft reset will not force Firmware to
reload again, it only do clean up of Message units.

mpt_Soft_Hard_ResetHandler will first try for Soft Reset,if
it fails then go for big hammer reset which is Hard Reset.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
64e155adc250ab68255b761c1faa77799aa1e41a 16-Dec-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: block device when target is being removed by FW

Add support to set the sdev state to SDEV_BLOCK during device removal
to stop IOs comming to the deleting driver immediately.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
e0f553ab58f478321717100e44b28f765bd2a045 16-Dec-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptfusion: Added sysfs expander manufacture information at the time of expander add.

Added new function mptsas_exp_manufacture_info, which will
obtain the REPORT_MANUFACTURING, and fill the details into the
sas_expander_device object when the expander port is created.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
9766096d331c82e71d3c9df61f1c88eff6ad916b 02-Sep-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : FW event thread and scsi mid layer deadlock in SYNCHRONIZE CACHE command

Normally In HBA reset path MPT driver will flush existing work in current work
queue (mpt/0) . This is just a dummy activity for MPT driver point of
view, since HBA reset will turn off Work queue events.

It means we will simply returns from work queue without doing anything.
But for the case where Work is already done (half the way), we have to have
that work to be done.

Considering above condition we stuck forever since Deadlock in scsi midlayer
and MPT driver. sd_sync_cache() will wait forever since HBA is not in
Running state, and it will never come into Running state since
sd_sync_cache() is called from HBA reset context.
Now new code will not wait for half cooked work to be finished
before returning from HBA reset.

Once we are out of HBA reset, EH thread will change host state to running from
recovery and work waiting for running state of HBA will be finished.
New code is turning ON firmware event from another special work called
Rescan toplogy.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
f44fd18198eb26b62ba86b17016e9441ce95fc71 02-Sep-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : NULL pointer on big endian systems causing Expander not to tear off

On Big endian system kernel will crash due to address translation
is not handle properly.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
9e39089b958818c8f3d772414cd27f84fb2622f2 02-Sep-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : Sanity check for phyinfo is added

Check for phyinfo->phy before calling sas_port_delete_phy.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
79a3ec1ace2329d115ecd2445379b46aed3286b0 04-Aug-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : set max_id to infinite value.

Do not set max_id value received from FW. Once SAS transport layer is
introduced max_id value is missleading to SCSI mid layer. Use max_id to
infinite value.

logic of can queue of scsi host is changed.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
4b97650b555b1cd09b547104d98da0ff700187d9 04-Aug-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : Change config request timeout value to 30 seconds.

Change config request timeout value to 30 seconds.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
a247fa4521ccec7cb82a9f2d4e8544fce27ea109 04-Aug-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : Removed mptscsih_timer_expired.

Removed mptscsih_timer_expired. This timer is no more use.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
9d2e9d66a3f032667934144cd61c396ba49f090d 04-Aug-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mptsas : Change DEFINED value of can queue for FC and SAS devices.

Change DEFINED value of can queue for FC and SAS devices.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
129dd98194747a3b8ac1ff876d8d1f2440660d01 21-Jun-2009 Jiri Slaby <jirislaby@gmail.com> fusion: mptsas, fix lock imbalance

Fix two typos in mptsas_not_responding_devices. It was mutex_lock instead
of unlock.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
fc847ab4318cd6ab6c231739ad51d2502d19a87a 10-Jun-2009 James Bottomley <James.Bottomley@HansenPartnership.com> [SCSI] mpt fusion: fix up doc book comments

Several of the doc book in the previous patches had incorrect multi-line short
function descriptors. Fixed it all to be the correct single line descriptor.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
db7051b2984d2c7d44b6178ad4c523500dff7f7c 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Added support for Broadcast primitives Event handling

Firmware is able to handle Broadcast primitives, but upstream driver does not
have support for broadcast primitive handling. Now this patch is mainly to
support broadcast primitives.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
57e985136bfafdfcd72c4c7d91115955d225677e 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Queue full event handling

FW will report Queue full event to Driver and driver will handle this queue
full event to SCSI Mid layer.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a7938b0bb3b458fe0723608be3db6c4ed8d79a8c 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: RAID device handling and Dual port Raid support is added

1. Handle integrated Raid device(Add/Delete) and error condition and check
related to Raid device. is_logical_volume will represent logical volume
device.
2. Raid device dual port support is added. Main functions to support this
feature are mpt_raid_phys_disk_get_num_paths and mpt_raid_phys_disk_pg1.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2f187862e579f1f5e883188cab6bd867cb60387f 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Code Cleanup patch

Resending patch considering Grants G's code review.

Main goal to submit this patch is code cleaup.
1. Better driver debug prints and code indentation.
2. fault_reset_work_lock is not used anywhere. driver is using taskmgmt_lock
instead of fault_reset_work_lock.
3. setting pci_set_drvdata properly.
4. Ingore config request when IOC is in reset state.( ioc_reset_in_progress
is set).
5. Init/clear managment frame proprely.(INITIALIZE_MGMT_STATUS and
CLEAR_MGMT_STATUS)

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
eedf92b99806aeff18dc21c9dfb28999ce374413 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Rescan SAS topology added

1.) SAS topology Rescan is added. If Firmware is doing Reset and we get
Device add interrupt from Firmware, we will not receive it as part of Reset
is going ON. After Reset we will do special Rescan of SAS topology.
2.) Driver version changed from 3.04.08 to 3.04.09.

Added proper lock/unlock in mptsas_not_responding_devices() as per James'
comment.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
f9c34022eae9c76465dc2ec8805b9905e171ef40 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: SAS topology scan changes, expander events

SAS topology scan is restructured. HBA firmware is generating more
events. Expander Events are added, Link status events are also added with
respect to SAS topology scan optimization.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
3eb0822c6740c5564c37a2fe56449cdb4f3d800c 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Firmware event implementation using seperate WorkQueue

Now Firmware events are handled by firmware event queue.
Previously it was handled in interrupt context/WorkQueue of Linux.
Firmware Event handling is restructured and optimized.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
ea2a788de4ce5ebab09276e25443f55592af2335 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: rewrite of ioctl_cmds internal generated function

1) rewrite of ioctl_cmds internal generated function that issue commands to
firmware, porting them to be single threaded using the generic MPT_MGMT
struct. All wait Queues are replace by completion Queue.
2) added seperate callback handler for ioctl task managment
(mptctl_taskmgmt_reply), to handle command that timeout
3) rewrite mptctl_bus_reset

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
e7deff3374cc5951f914dcb3c66bc1b8de8a084e 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Adding DeviceResetCtx for internal Device reset frame

1.) Added taskmgmt_quiesce_io flag in IOC and removed resetPending from
_MPT_SCSI_HOST struct.
2.) Reset from Scsi mid layer and internal Reset are seperate context.
Adding DeviceResetCtx for internal Device reset frame.
mptsas_taskmgmt_complete is optimized as part of implementation.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
37c60f374a855974c27bd30d5662a8fa5e933792 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: rewrite of all internal generated functions

Rewrite of all internal generated functions that issue commands to firmware,
porting them to be single threaded using the generic MPT_MGMT
struct. Implemented using completion Queue.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
f0f09d3b3f06900d64971625d6753dea0623ed45 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: config path optimized, completion queue is used

1) Previously we had mutliple #defines to use same values.
Now those #defines are optimized.
MPT_IOCTL_STATUS_* is removed and MPT_MGMT_STATUS_* are new
#defines.
2.) config path is optimized.
Instead of wait Queue and timer, using completion Q.
3.) mpt_timer_expired is not used.

[jejb: elide patch to eliminate mpt_timer_expired]
Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
7b5a65b9e649dad9cf9c6d282df4162843070351 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Added support for MPT discovery completion check

sas_discovery_quiesce_io flag is used to control IO start/resume functionality.
IO will be stoped while doing discovery of topology. Once discovery is completed
It will resume IO. Resending patch including James review.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
14d0f0b063f5363984dd305a792854f9c23e9e97 29-May-2009 Kashyap, Desai <kashyap.desai@lsi.com> [SCSI] mpt fusion: Fixing 1078 data corruption issue for 36GB memory region

The reason for this change is there is a data corruption when four different
physical memory regions in the 36GB to 37GB region are
accessed. This is only affecting 1078.

The solution is we need to use different addressing when filling in
the scatter gather table for the effected memory regions. So instead
of snooping on all four different memory holes, we treat any physical
addresses in the 36GB address with the same algorithm.

The fix is explained below
1) Ensure that the message frames are NOT located in the trouble
region. There is no remapping available for message frames, they must
be allocated outside the problem region.
2) Ensure that Sense buffers are NOT in the trouble region. There is
no remapping available.
3) Walk through the SGE entries and if any are inside the trouble region
then they need to be remapped as discussed below.
1) Set the Local Address bit in the SGE Flags field.
MPI_SGE_FLAGS_LOCAL_ADDRESS
2) Ensure we are using 64-bit SGEs
3) Set MSb (Bit 63) of the 64-bit address, this will indicate buffer
location is Host Memory.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
5f49f63178360b07a095bd33b0d850d60edf7590 19-May-2009 Tejun Heo <tj@kernel.org> block: set rq->resid_len to blk_rq_bytes() on issue

In commit c3a4d78c580de4edc9ef0f7c59812fb02ceb037f, while introducing
rq->resid_len, the default value of residue count was changed from
full count to zero. The conversion was done under the assumption that
when a request fails residue count wasn't defined. However, Boaz and
James pointed out that this wasn't true and the residue count should
be preserved for failed requests too.

This patchset restores the original behavior by setting rq->resid_len
to blk_rq_bytes(rq) on request start and restoring explicit clearing
in affected drivers. While at it, take advantage of the fact that
rq->resid_len is set to full count where applicable.

* ide-cd: rq->resid_len cleared on pc success

* mptsas: req->resid_len cleared on success

* sas_expander: rsp/req->resid_len cleared on success

* mpt2sas_transport: req->resid_len cleared on success

* ide-cd, ide-tape, mptsas, sas_host_smp, mpt2sas_transport, ub: take
advantage of initial full count to simplify code

Boaz Harrosh spotted bug in resid_len initialization. Fixed as
suggested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Borislav Petkov <petkovbb@googlemail.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b0790410300abaaf4f25f702803beff701baebf1 07-May-2009 Tejun Heo <tj@kernel.org> block: cleanup rq->data_len usages

With recent unification of fields, it's now guaranteed that
rq->data_len always equals blk_rq_bytes(). Convert all non-IDE direct
users to accessors. IDE will be converted in a separate patch.

Boaz: spotted incorrect data_len/resid_len conversion in osd.

[ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
c3a4d78c580de4edc9ef0f7c59812fb02ceb037f 07-May-2009 Tejun Heo <tj@kernel.org> block: add rq->resid_len

rq->data_len served two purposes - the length of data buffer on issue
and the residual count on completion. This duality creates some
headaches.

First of all, block layer and low level drivers can't really determine
what rq->data_len contains while a request is executing. It could be
the total request length or it coulde be anything else one of the
lower layers is using to keep track of residual count. This
complicates things because blk_rq_bytes() and thus
[__]blk_end_request_all() relies on rq->data_len for PC commands.
Drivers which want to report residual count should first cache the
total request length, update rq->data_len and then complete the
request with the cached data length.

Secondly, it makes requests default to reporting full residual count,
ie. reporting that no data transfer occurred. The residual count is
an exception not the norm; however, the driver should clear
rq->data_len to zero to signify the normal cases while leaving it
alone means no data transfer occurred at all. This reverse default
behavior complicates code unnecessarily and renders block PC on some
drivers (ide-tape/floppy) unuseable.

This patch adds rq->resid_len which is used only for residual count.

While at it, remove now unnecessasry blk_rq_bytes() caching in
ide_pc_intr() as rq->data_len is not changed anymore.

Boaz : spotted missing conversion in osd
Sergei : spotted too early conversion to blk_rq_bytes() in ide-tape

[ Impact: cleanup residual count handling, report 0 resid by default ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
d58069adc6f59f48bf96a72e6df68a670ff1b3bc 01-Apr-2009 Alan Cox <alan@redhat.com> [SCSI] mptsas: remove unneeded check

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
cadbd4a5e36dde7e6c49b587b2c419103c0b7218 04-Jul-2008 Harvey Harrison <harvey.harrison@gmail.com> [SCSI] replace __FUNCTION__ with __func__

[jejb: fixed up a ton of missed conversions.

All of you are on notice this has happened, driver trees will now
need to be rebased]

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: SCSI List <linux-scsi@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
cddc0ab71194a09c0ac359be10a0f1ef976ddc95 20-May-2008 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion : Updated copyright statment with 2008 included

Updating copyright statement to include the year 2008

Signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
7ba2db5f38955907e46a65c9334d287cd3da32c2 13-Mar-2008 Michael Reed <mdr@sgi.com> [SCSI] fusion mpt: fix target missing after resetting external raid

Following a hard reset of a SAS raid, one of the raid targets is occasionally
missing. I tracked this down to a pretty obscure little bug.

The LSI fusion drivers for SAS and Fibre Channel both use their respective
transport layers. Those transport layers increment the target number
assigned to new targets.

The routine __scsi_scan_target uses the "this_id" element of the Scsi_Host
structure to avoid scanning the scsi host adapter. Both fusion drivers set
"this_id" from a value returned in a firmware PortFacts response. For my
particular test case (SAS) the firmware id assigned to the initiator was
173. After enough raid resets to cause the raid targets to go and come a
sufficient number of times, the id assigned by the transport to a raid
target would match the id assigned by the host adapter to the "this_id"
field, resulting in that target not being scanned.

Fix by not assigning this_id and not checking it in slave_configure.

Signed-off-by: Michael Reed <mdr@sgi.com>
Acked-by: "Moore, Eric" <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
7748369f49d428e558c519ed344d3005d38347b7 20-Mar-2008 Michael Reed <mdr@sgi.com> [SCSI] mptsas: do not use ioc->handle to locate hba portinfo structure

While performing hardware raid reset testing via the raid's client, I
noticed that sometimes, following the reset, that there would be more
raid targets in the lsscsi output than there actually were raid
targets. I tracked this down to the following issue.

Fusion cannot always find the mptsas_portinfo structure for the hba
because it uses the handle stored in ioc->handle to locate it. The
problem is that the firmware can change the handle associated with the
hba when h/w raid is reset (via the raid client). When this happens,
the driver will allocate another mptsas_portinfo structure and link it
into the chain of said structures. This ultimately causes confusion
within the driver resulting in targets not being removed when they
should be.

Eric Moore pointed out that the hba's portinfo structure is always the
first structure on the sas_topology list. This patch modifies
mptsas.c to access the hba's portinfo structure by taking the first
structure on said list.

Signed-off-by: Michael Reed <mdr@sgi.com>
Acked-by: "Moore, Eric" <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
51f39eae14b4874618e73281c236e3a1c1572d4d 04-Mar-2008 Krzysztof Oledzki <olel@ans.pl> [SCSI] mpt fusion: don't oops if NumPhys==0

Don't oops if NumPhys==0, instead return -ENODEV.
This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=9909

Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Acked-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
38b3167f75c9508156b974d19692c19b78292e2e 30-Dec-2007 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] mpt fusion: make mptsas_smp_handler update resid

This patch fixes mptsas_smp_handler to update both din_resid or
dout_resid on success. bsg can report back the residual.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
c51d0beaaed902ef48ed1f3b1834d37b7ffd55e8 29-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: fix up fusion prints using the sdev_printk, dev_printk, and shost_printk API

Cleaning up prints that use the xxx_printk API, in that the fusion
preamble "mptbase: iocX" follows the info provided by the print API.
The way its currently coded, the [H:C:T] print in sdev_printk will be
inbetween "mptbase" and "iocX", instead of before.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e8206381f5842269691f3164ec0d79b7059bd710 29-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: lock down ScsiLookup

ScsiLookup is an array of pending scmd pointers that the scsi lld
maintains. This array is touched from queuecommand, eh threads, and
interrupt context. This array should put under locks, hence this patch
to synchronize its access. I've added some nice little function
wrappers for this, and moved the ScsiLookup array over to MPT_ADAPTER
struct.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
bc6e089a13a5c0ac36247616baecd6fc77405e7f 29-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: Fix sparse warnings

List below is output from C=2 sparse compilation, which are fixed with
this patch.

1) mptspi: pg0 is defined in x86 version of include/asm/pgtable.h

2) mptsas: context imbalance in 'mptsas_probe' different lock contexts
for basic block

3) mptbase: from mpt_attach - cast adds address space to expression

4) mptbase: from mpt_do_upload - request[] is bad constant expression

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e7eae9f6e94cd49261c2997b0b4f768c1351bc02 29-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: add use of shost_priv and remove all the typecasting

The driver is currently typecasting to obtain the shost hostdata. The
driver is updated to use the shost_priv macro.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
50847ed8bc3d108d923bb8b6793f453a15af3c3f 15-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: removing Dell copyright

Some other vender has concerns over this copyright, and Dell has
approved removing it.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e80b002bfd38263117da93feb4f67f5cf7d9221b 15-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: removing references to hd->ioc

Cleaning up code by accesing the ioc pointer directly instead of via hd->ioc. In the future, most data members of struct MPT_SCSI_HOST will be either deleted or moved to struct MPT_ADAPTER.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
a69de507aae293e32d22e873f34f25f49b2db3b2 15-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: rename vdev to vdevice

common naming of vdevice through out driver

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
29dd3609f2fc70e02ce48123485b14d9417b834f 15-Sep-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: standardize printks and debug info

Standardize all prints using common MYIOC_s_XXX_FMT macro defined in mptbase.h. Currently the driver uses several different methods to display info, where in some cases the "controller name" generating the printk is not provided.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f36789e22ac32a6554b8e4d05ab6125fc1161745 14-Aug-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: Change company name from LSI Logic to LSI

Recently LSI Logic Corp was renamed as LSI Corp, so whereever there is
a reference of LSI Logic, it is changed to LSI in mpt fusion driver
code.

signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Acked-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
56af97ae477cf8c2983edf86db2559d6394ca860 14-Aug-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: Creation of mptsas.h header file

The data structure definitions from mptsas.c are moved to a new header
file mptsas.h

signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Acked-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f606f5718fa5a36e400000f91c44a5725b0f005d 14-Aug-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: Change call back indices to u8 from int

The call back index requires only u8 but in lot of places it is
referred as int, now everywhere the call back index variables are
declared as u8 with uniform name cb_idx

signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Acked-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7a195f464e0692607aca8150c8489a838fab684b 14-Aug-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: Usage of high priority request FIFO to send task management commands

Added support for sending the task management requests through High priority
request FIFO instead of Doorbell writes when firmware support High priority
FIFO.

signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Acked-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
159e36fe996411a4a05added6b7b20b1c4490ebb 30-Jul-2007 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] mptsas: add SMP passthrough support via bsg

This patch adds support for SAS Management Protocol (SMP) passthrough
support via bsg.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
d6ecdd638aa840604b87195f2097cabbd095092c 24-Jul-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: Changes in mptfc.c mptlan.c mptsas.c and mptspi.c for logging support

This patch contains changes in mptfc.c, mptlan.c, mptsas.c and mptspi.c to
support logging in MPT fusion drivers.

The changes are majorly in debug printks, the existing debugprintk are
modified accroding to new debug macros defined in the file mptbdebug.h

signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
57ce21bfccaf3b24296f1e097682177e49017a57 02-Jul-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: deregister from transport layer if PCI registration failed

The mptspi and mptsas drivers are modified to deregister from transport layer
if registration with PCI driver failed

Signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
edb9068d0d7a3ba92f66b8c86cba625f3a439f64 17-Jul-2007 Prakash, Sathya <sathya.prakash@lsi.com> [SCSI] mpt fusion: add sysfs attributes to display IOC parameters

New sysfs scsi_host attributes are added to provide information about Firmware
version, BIOS version, MPI version and other product related information

signed-off-by: Sathya Praksh <sathya.prakash@lsi.com>
Acked-by: "Moore, Eric" <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
16d201016a9f29e0557849907352769c63cef259 14-Jun-2007 Eric Moore <eric.moore@lsi.com> [SCSI] mpt fusion: update MAINTAINERS (fusion part)

Update assocated fusion sources with new support email address.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
ba76ef246090601b783c1e6190e22b8b149a105f 09-Mar-2007 Judith Lebzelter <judith@linux-foundation.org> [SCSI] mptsas: Fix oops for insmod during kexec

This fix's an oops during driver load time. mptsas_probe calls
mpt_attach(over in mptbase.c). Inside that call, we read some
manufacturing config pages to setup some defaults. While reading the
config pages, the firmware doesn't complete the reply in time, and we
have a timeout. The timeout results in hardreset handler being called.
The hardreset handler calls all the fusion upper layer driver reset
callback handlers. The mptsas_ioc_reset function is the callback
handler in mptsas.c. So where I'm getting to, is mptsas_ioc_reset is
getting called before scsi_host_alloc is called, and the pointer ioc->sh
is NULL as well as the hostdata.

Signed-off-by: Judith Lebzelter <judith@osdl.org>
Acked-by: "Moore, Eric" <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
cd354f1ae75e6466a7e31b727faede57a1f89ca5 14-Feb-2007 Tim Schmielau <tim@physik3.uni-rostock.de> [PATCH] remove many unneeded #includes of sched.h

After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there. Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm. I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
07c861d6d9ca3dc58e225bcfe2da0f378af6fa6c 29-Jan-2007 Eric Moore <eric.moore@lsi.com> [SCSI] fusion - bump version - 3.04.04

bump version, and fix email addr for lsi support

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2ecce492290bf0d5eedc76cf0f4bf45f8c3f42bc 29-Jan-2007 Eric Moore <eric.moore@lsi.com> [SCSI] fusion - report wide port sas address's for hba phys

Return proper sas address to sas transport layer for parent phys that
form a wide port. Current implementation returns a different address
for each phy, incremented by one from the base address.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
df9e062ad994c4db683377b108c0dbed4690e4b0 29-Jan-2007 Eric Moore <eric.moore@lsi.com> [SCSI] fusion - serialize target resets in mptsas.c

Fusion firmware requires target reset following hotplug removal event,
with purpose to flush target outstanding request in fw. Current implementation
does the target resets from delayed work tasks, that in heavy load
conditions, take too long to be invoked, resulting in command time outs
This patch will issue target reset immediately from ISR context, and will
queue remaining target resets to be issued after the previous one completes.
The delayed work tasks are spawned during the target reset completion.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
b506ade9f3c309ac2ce3ffc4039f731097506038 29-Jan-2007 Eric Moore <eric.moore@lsi.com> [SCSI] fusion - inactive raid support, and raid event bug fix's

inactive raid support, e.g. exposing hidden raid components
belonging to a volume that are inactive. Also misc bug fix's for
various raid asyn events.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
793955f549c710a1b0c18f823d5d710840747b15 29-Jan-2007 Eric Moore <eric.moore@lsi.com> [SCSI] fusion - Greater than 255 target and lun support

Add support for greater than 255 target and luns.
Kill the hd->Target[] field, and change all references
of bus_id/target_id, to channel/id.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
9f4203b357d46a66c042df3dedf277ccaa5e2b1d 05-Jan-2007 Eric Moore <eric.moore@lsil.com> [SCSI] fusion: MODULE_VERSION support

* Add modinfo driver version support.
* Change copyright year to 2007.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f99be43b3024f2dd054f2addd54a318eabee2018 05-Jan-2007 Eric Moore <eric.moore@lsil.com> [SCSI] fusion: power pc and miscellaneous bug fixs

* Endian fix's for warnings found in ppc environment.
* Fix compile time warning when calling scsi_device_reprobe, where
in newer kernels this API expects its return value to be examined.
* Fix compile errors when debug messages are enabled.

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c4028958b6ecad064b1a6303a6a5906d4fe48d73 22-Nov-2006 David Howells <dhowells@redhat.com> WorkStruct: make allyesconfig

Fix up for make allyesconfig.

Signed-Off-By: David Howells <dhowells@redhat.com>
f4ad7b5807385ad1fed0347d966e51a797cd1013 25-Aug-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: remove local_attached flag

This flag denotes local attachment of the phy. There are two problems
with it:

1) It's actually redundant ... you can get the same information simply
by seeing whether a host is the phys parent
2) we condition a lot of phy parameters on it on the false assumption
that we can only control local phys. I'm wiring up phy resets in the
aic94xx now, and it will be able to reset non-local phys as well.

I fixed 2) by moving the local check into the reset and stats function
of the mptsas, since that seems to be the only HBA that can't
(currently) control non-local phys.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
0c269e6d3c615403a6e0acbe6e88f1c0da9c2396 12-Jul-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] mptsas: add parent port backlink

This takes advantage of the sas class backlink function to show which
port on an expander is used to communicate with the parent.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
ba856d32f2cede67fd2a59a53bc662360f17c7b5 12-Jul-2006 Eric Moore <eric.moore@lsil.com> [SCSI] mptfusion: misc fix's

* removing obsolete 1066, 1066E from Kconfig
* initializing aen_event_read_flag after host reset
* remove oem references
* remove obsolete mpt_pq_filter command line option

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e8bf39417b578a11e2ee2cd16e794a5b2d40757b 11-Jul-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] scsi_transport_sas: kill the use of channel

Using the port_id for the channel is completely unnecessary since the
host_id/target_id are constructed to be globally unique. Also move
the mptsas driver on to virtual channel 1 for its raid devices.

Acked-by: "Moore, Eric" <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
dc22f16d4e46cee699c3835cc6e2a8005023517f 06-Jul-2006 Eric Moore <eric.moore@lsil.com> [SCSI] mptsas: use unnumbered port API and remove driver porttracking

This allows us to be rid of the machinery in mptsas for creating and
tracking port numbers. Since mptsas is merely inventing the numbers,
the SAS transport class may as well do it instead.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2686de27a356914e098329463d5a8cd7aa6f29a4 30-Jun-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] mptsas: eliminate ghost devices

One of the current problems the mptsas driver has is that of "ghost"
devices (these are devices the firmware reports as existing, but what
they actually represent are the parents of a lower device), so for
example in my dual expander configuration, three expanders actually show
up, two for the real expanders but a third is created because the
firmware reports that the lower expander also has another expander
connected (which is simply the port going back to the upper expander).

The attached patch eliminates all these ghosts by not allocating any
devices for them if the SAS address is the SAS address of the parent.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
376ac8307868f93a0b9aa277f43dee0f63c41c1b 30-Jun-2006 Eric Moore <eric.moore@lsil.com> [SCSI] mptsas: make two functions static

Make two needlessly global functions static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.com>
Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
87cf89866790a373edcf88c12b64d6d38560acdd 28-Jun-2006 Eric Moore <eric.moore@lsil.com> [SCSI] mptsas: Adding 1078 ROC support

* Adding 1078 ROC (Raid On Chip) Support - New host adapter

* Moving all PCI Vendor/Device ids to using internal defines; a request
from Christoph/James B. some time ago for when the next chip was added.

* Removing SAS 1066/1066E Vendor/Device IDs, as there are no plans to
manufacture that controller.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
547f9a218436ea35baf9a52e981753e44d9cff1f 27-Jun-2006 Eric Moore <eric.moore@lsil.com> [SCSI] mptsas: wide port support

* Wide port support added - using James Bottomley's new SAS wide port API.
(There is a known problem in sas transport layer reported yesterday to
James. The Kobject dev.bus_ids for end devices are not unique across
expanders. I have added a work around in this patch, where I asigning
an unique port identifier for every port within the host - this solves
the problem, but I expect a fix from James in the sas transport).

* Adding target_alloc and target_destroy entry points, and moving code over
from the slave entry points.

* The renaming of some mptscsih_xxx functions declared in mptsas.c,
to mptsas_xxx.

* Target Reset moved from slave_destroy to hotplug work thread
handling (with regard to device removal). Also inhibit IO to end device
while device is being broken down . Talked to James Smart about this
at Linux Expo (with questions of how the fc transport handles this).

* Cleaning up the kzalloc's, and kfree's

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
8f7607803717e9d045965b210cd16a25d80cd04b 27-Jun-2006 Jesper Juhl <jesper.juhl@gmail.com> [PATCH] Remove redundant NULL checks before [kv]free - in drivers/

Remove redundant NULL chck before kfree + tiny CodingStyle cleanup for
drivers/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
bd23e94cd70f18700fc366451a8f1427e56ed137 17-Apr-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] mptfusion: bug fix's for raid components adding/deleting

This patch handles case where raid hidden components
are not being removed when power turned off to device
attached to expander, as well as the case of
exposing raid components when power is turned back on
to devices attached to an expander. (This is a repost
of this patch, with mptsas_is_end_device declared
further up in the code.)

This patch contains some other miscellaneous bug fix's.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
3c0c25b97c7d020ef07f6366cf1d668a8e980c7c 14-Apr-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] mptfusion - fix panic in mptsas_slave_configure

Driver panic when RAID logical volume was present when driver
loaded, or when a RAID logical volume was created on the fly.

This issue was created in due to recent scsi_transport_sas change,
when sas_read_port_mode_page was added into the mptsas drivers
slave_config entry point.

This new API expects that all sdev's to be assocated to an rphy, however
that is not the case for logical volumes, as they are created using
scsi_add_device, instead of sas_rphy_add().

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f013db3284376070fc4c196e58d204180b8ed62a 18-Mar-2006 James Bottomley <James.Bottomley@steeleye.com> [SCSI] convert mptsas over to end_device/expander allocations

The conversion of mptsas should allow the elimination of the contained
flag in the sas transport class.

Acked-by: "Moore, Eric" <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e6b2d76a49f0ee48527691867d8af2b8f9c10452 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - expander hotplug suport in mptsas module

This adds support for hot adding and removing
expanders, and its associated attached devices.
When there is a change in topology,
the fusion firmware sends the
MPI_EVENT_SAS_DISCOVERY event to the driver.
The driver will read firmware config pages
to determine what changes took place, and refresh
drivers view of the world stored in ioc->sas_topology.

Here is the details of the action the driver does:

(1) Expander Added : The mptsas_discovery_work
workqueue is called. Config pages read, and
ioc->sas_topology is refreshed. The sas_phy_add()
is called for each phy of the expander. The
expanders attached devices are added via
sas_rphy_add(). Added end devices are handled within
the MPT_ADD_DEVICE logic in mptsas_hotplug_work
workqueue.

(2) Expander Delete : The sas_rphy_delete() will be
called for the top most compenent of the parent that the
expander is attached to. The sas_rphy_delete call
will delete all the children phys, rphys, and end devices.
This is handled from mptsas_discovery_work workqueue.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f44e5461d919a344d44f7ca4f06cf8d169da8454 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - exposing raid components in mptsas

Suppport for exposing hidden raid components
for sg interface. The sdev->no_uld_attach flag
will set set accordingly.

The sas module supports adding/removing raid
volumes using online storage management application
interface.

This patch rely's on patch's provided to me
by Christoph Hellwig, that exports device_reprobe.
I will post those patch's on behalf of Christoph.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
db9c9174e42bdc8d52bc18df7c55823cf4546eda 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - memory leak, and initializing fields

Changelog:
(1) fix memory leak: p->phy_info
(2) initialize device_info and port_info data fields
(3) initialize the hba firmware handle
(4) initialize phy_id for attached phy_info data fields
(5) initialize attached phy_info data fields

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
52435430fc8724f09ad0e917eddf677583cdd45c 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - exclosure misspelled

exclosure should be enclosure

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
4b766471e388352f35a6171563dfc0d272f12b59 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - cleanup mptsas event handling functions

Cleanup of mptsas firmware event handlers.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
914c2d8e597798d62c2e0a3cba737bf6f611eecf 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - removing target_id/bus_id from the VirtDevice structure

It makes no sense in keeping the target_id and bus_id
in the VirtDevice structure, when it can be obtained
from the VirtTarget structure.

In addition, this patch fix's couple compilation bugs
in mptfc.c when MPT_DEBUG_FC is enabled. This
provided by Micheal Reed.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
3a892bef3f7e94c4d6c2c20b9a1b546f43679fd3 14-Mar-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - move some debug firmware event debug msgs to verbose level

Created a debug level MPT_DEBUG_VERBOSE_EVENTS.
Moving some of the more vebose debug messages
for firwmare events into new debug level. Also
added some more firmware events descriptions.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e3094447e013a59ccedcf60f6055f18225bd8465 16-Feb-2006 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: add support for enclosure and bay identifier attributes

Adds support to retrieve the enclosure and bay identifiers. This patch
is from Eric with minor modifications from me, rewritten from a buggy
patch of mine, based on the earlier CSMI implementation from Eric..

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
23f236ed2748fca0bcba304f4f9e3eacda51e91c 30-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: don't complain on bogus slave_alloc calls

When people use the userspace scanning facilities on SAS hardware the
LLDD gets bogus slave_alloc calls. Just fail those gracefully instead
of printing a warning in mptsas and another one in the midlayer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
79de278e86121cd4473c276409f834aee87f3195 26-Jan-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion: move sas persistent event handling over to the mptsas module

This moves code intented for SAS from
the generic mptscsih module over to the
mptsas module.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7d3eecf7b2195c64d26f7e7d105d00e5a6dd702e 26-Jan-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion: target reset when drive is being removed

The issuing of the target reset
used in device hot removal case so the
firmware queue is flushed out off outstanding
commands.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c73787eecdbe4691d4e3f989052db8b552e1ac34 27-Jan-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion: add support for raid hot add/del support

RAID event support.

This will hot add and remove raid volumes
when managment application creates and
deletes the volumes. The driver is basically
responding to firmware asyn events, and reporting
the changes to the above layers.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
816aa907b909177bdf6e6e6b0d00c5e5a6e2be8c 14-Jan-2006 Moore, Eric <Eric.Moore@lsil.com> [SCSI] fusion - adding raid support in mptsas

The SAS RAID volumes are reported beyond the expected number of phys.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1ca00bb7916cb40b8140173c23481e11d92d6f6a 13-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] fusion: kzalloc / kcalloc conversion

Convert kmalloc + memset to kzalloc or kcalloc in fusion.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
eeb846cefdd842af479393a7d0fd399a29e42532 13-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] fusion: convert semaphores to mutexes

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
9a28f49adbe4955af8a1306fd36ddae15136dde7 13-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: support basic hotplug

Adds hotplug support for SAS end devices. Unfortunately the fusion
firmware doesn't generate similar events for expanders addition/removal
so we can't support them yet. Eric has an idea about a clever scheme to
find out about expander changes so that'll be added later on.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c7c82987b4844f555d309ccbd42abe95d46822ff 17-Nov-2005 Moore, Eric Dean <Eric.Moore@lsil.com> [SCSI] mptfusion - mapping fixs required support for transport layers.

This utilizes the hostdata area that is hung off of scsi_target and
scsi_device for saving unique firmware mapping. This will be required
for supporting new Fibre and SPI transport support.

This also fixs problems in error handling error code for SAS
controllers, in which the incorrect mapping was passed to the
firmware.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7acec1e7556a861416bb6b10f3e3cbb6e82fc01d 17-Nov-2005 Moore, Eric Dean <Eric.Moore@lsil.com> [SCSI] mptfusion - cleaning up xxx_probe error handling

This cleans the returning failure conditions of the
mptsas/mptfc/mptspi probe routines.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f78496da6a85f4b5f4532d7bf85b05fa655146a8 17-Nov-2005 Moore, Eric Dean <Eric.Moore@lsil.com> [SCSI] mptfusion - adding = THIS_MODULE

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
f9a2d2e0c89f73f0203fa796101089c2bce31974 19-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: white space fixes and version bump

Various whitespace and comment fixes from Eric, aswell as a version
bump.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
da4fa65596733914b3c21fdffa02593959c67f56 19-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: add support for PHY resets

Support PHY resets in mptsas. Thanks to Eric for various bug fixes
and improvements.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
ac01bbbd3b7ebfca64357aed12cf476b16abe3ce 19-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] sas: add flag for locally attached PHYs

Add a flag to mark a PHY as attached to the HBA as opposed to beeing on
an expander. This is needed because various features are only supported
on those. This is a crude hack, the proper fix would be to use
different classes for host-attached vs expander phys. I'm looking into
that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
b5141128027c53b8ca40736d969f75c9a1cdb64b 28-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: support link error attributes

.. and the fusion part. I had to move around the debug functions around
a little bit so they are below the transport class methods.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
024358eeafd44ecffd0e7a1002ef3ccc1d0acd4d 21-Oct-2005 Eric Moore <Eric.Moore@lsil.com> [PATCH] mptsas: fix phy identifiers

This fixes handling of the phy identifiers in mptsas.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
[ split it a pre-2.6.14 portion from Eric's bigger patch ]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
16192896ea8e03d18d4228023500607b00df49e6 17-Oct-2005 Christoph Hellwig <hch@lst.de> [SCSI] mptsas: fix phy identifiers

This patch from Eric fixes handling of the phy identifiers in mptsas.
I've split it up from his bigger patch as it should go into 2.6.14
still.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
466544d8898fc87ed6e2e62ac14af7c50ab7a1a4 15-Sep-2005 Moore, Eric Dean <Eric.Moore@lsil.com> [SCSI] fusion SAS support (mptsas driver) updates

Summary of Changes:
* splitting mpt_interrupt per Christophs suggestion
about a month ago
* rename ScsiCfgData to SpiCfgData structure,
then move all the raid related info into
new structure called RaidCfgData. This is
done because SAS supports RAID, as well as SPI,
so the raid stuff should be seperate.
* incorrect timeout calculation for cntdn
inside WaitForDoorbellAck and WaitForDoortbellInt
* add support for interpreting SAS Log Info
* Increase Event Log Size from 0xA to 0x32
* Fix bug in mptsas/mptfc/mptspi - when controller
has Initiator Mode Disabled, and only running in
TargetMode, the mptctl would panic when loading.
The fix is to return 0, instead of -ENODEV, in
SCSI LLD respective probe routines
* Fix bug in mptlan.c - driver will panic if
there is host reset, due to dev being set to
zero in mpt_lan_ioc_reset
* Fix's for SPI - Echo Buffer
* Several fix's in mptscsih_io_done - FCP Response
info, RESIDUAL_MISMATCH, Data Underrun, etc.
* Cleanup Error Handling - EH handlers,
mptscsih_flush_cmds, and zeroing out ScsiLookup
from mptscsih_qcmd
* Cleanup asyn event handling from
mptscsih -> mptscsih_event_process. Also
added support for SAS Persistent Table Full,
an asyn event

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
0c33b27deb93178f10778b3d2669af1674793cef 09-Sep-2005 Christoph Hellwig <hch@lst.de> [SCSI] fusion SAS support (mptsas driver)

Adds the actual mptsas driver, based upon the LSI driver with new work
for SAS transport class integration from Eric Moore and me.

This obviously depends on the SAS transport class.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>