]> git.karo-electronics.de Git - mv-sheeva.git/log
mv-sheeva.git
13 years agoisci: Removed struct sci_base_object from state machine.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:01 +0000 (22:06 +0000)]
isci: Removed struct sci_base_object from state machine.

Changed any occurrence of struct sci_base_object into void.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Implement SCU AFE recipe 10.
Maciej Patelczyk [Wed, 27 Apr 2011 17:50:50 +0000 (17:50 +0000)]
isci: Implement SCU AFE recipe 10.

Updated SCU AFE initialization values accordingly to the recipe 10.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Remove excessive log noise with expander hot-unplug
Dave Jiang [Thu, 21 Apr 2011 05:36:23 +0000 (05:36 +0000)]
isci: Remove excessive log noise with expander hot-unplug

We are logging excessive output when hot unplug from expander. Moving
that to debug.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: allow fallback to option-rom if efi variable retrieval fails
Dan Williams [Tue, 26 Apr 2011 20:19:53 +0000 (13:19 -0700)]
isci: allow fallback to option-rom if efi variable retrieval fails

If the scu efi driver is disabled but the option-rom is enabled (during an efi
boot) allow the code to fallback to scanning legacy option-rom space for the
parameters.

Reported-by: Yinghai Lu <yinghai.lu@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: removing non-working ATAPI code
Dave Jiang [Tue, 26 Apr 2011 19:31:37 +0000 (12:31 -0700)]
isci: removing non-working ATAPI code

Removing not used / bit-rotten ATAPI code. This needs to go back
and debugged at a later date.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[reflow against devel, delete dead sati headers]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove scic_sds_remote_device_get_port_index
Dan Williams [Tue, 26 Apr 2011 18:44:06 +0000 (11:44 -0700)]
isci: remove scic_sds_remote_device_get_port_index

Longer to type than the open-coded equivalent.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove usage of sci_sas_address in scic_sds_remote_device
Dan Williams [Tue, 26 Apr 2011 16:41:52 +0000 (09:41 -0700)]
isci: remove usage of sci_sas_address in scic_sds_remote_device

The sas address can be retrieved from the domain device and then
converted to the always little-endian format in the remote node context.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill smp_discover_response
Dan Williams [Mon, 25 Apr 2011 21:29:29 +0000 (14:29 -0700)]
isci: kill smp_discover_response

An lldd need never look at the contents of an smp_discover_response frame.
Kill the remaining locations where isci is looking at it:

1/ covering for expanders that do not set the stp_attached bit (already
   handled by sas_ex_discover_end_dev)
2/ an overkill method to notifiy the rest of the driver about remote_device
   sas addresses

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill smp_discover_response_protocols in favor of domain_device.dev_type
Dan Williams [Fri, 22 Apr 2011 01:44:45 +0000 (18:44 -0700)]
isci: kill smp_discover_response_protocols in favor of domain_device.dev_type

This is step 1 of removing the contortions to:
1/ unparse expander phy data into a smp discover frame
2/ open-code-parse the smp discover fram into a domain_device.dev_type equivalent

libsas has already spent cycles determining the dev_type, so now that
scic_sds_remote_device is unified with isci_remote_device we can
directly reference dev_type.

This might also change multi-level expander detection as we previously only
looked at dev_type == EDGE_DEV and we did not consider the FANOUT_DEV case.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: cleanup remote device construction and comments
Dan Williams [Mon, 25 Apr 2011 18:48:29 +0000 (11:48 -0700)]
isci: cleanup remote device construction and comments

The construction routines scic_remote_device_[de]a_construct both reference
the need to call scic_remote_device_construct first.  Delete that comment and
just have them call it explicitly, also:
* move the comments from header to source
* delete dead references to scic_[de]a_remote_device_add_phy

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: move remote_device handling out of the core
Dan Williams [Sat, 23 Apr 2011 02:18:03 +0000 (19:18 -0700)]
isci: move remote_device handling out of the core

Now that the core/lldd remote_device data structures are nominally unified
merge the corresponding sources into the top-level directory.  Also move the
remote_node_context infrastructure which has no analog at the lldd level.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device data structures
Dan Williams [Fri, 22 Apr 2011 01:14:45 +0000 (18:14 -0700)]
isci: unify remote_device data structures

Make it explicit that isci_remote_device and scic_sds_remote_device are
one in the same object.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove rnc->device back pointer
Dan Williams [Wed, 20 Apr 2011 01:35:58 +0000 (18:35 -0700)]
isci: remove rnc->device back pointer

Now that they are one in the same object remove the back pointer reference
in favor of container_of.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: make a remote_node_context a proper member of a remote_device
Dan Williams [Tue, 19 Apr 2011 20:48:49 +0000 (13:48 -0700)]
isci: make a remote_node_context a proper member of a remote_device

A rnc object has the same lifetime as its associated remote_device.  It might
get re-initialized, but a remote device always has an rnc member.  Preparation
for unifying scic_sds_remote_device and isci_remote_device

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: rely on irq core for intx multiplexing, and silence screaming intx
Dan Williams [Tue, 19 Apr 2011 19:32:51 +0000 (12:32 -0700)]
isci: rely on irq core for intx multiplexing, and silence screaming intx

Remove the extra logic to poll each controller for interrupts, that's
the core's job for shared interrupts.

While testing noticed that a number of interrupts fire while waiting for
the completion tasklet to run, so added an irq-ack.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: replace this_* and the_* variables with more meaningful names
Dave Jiang [Thu, 21 Apr 2011 05:34:49 +0000 (05:34 +0000)]
isci: replace this_* and the_* variables with more meaningful names

Removed any instances of the_* and this_* to variable names that are more
meaningful and tell us what they actually are.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: validate oem parameters early, and fallback
Dan Williams [Wed, 20 Apr 2011 19:57:08 +0000 (12:57 -0700)]
isci: validate oem parameters early, and fallback

If the platform specifies invalid parameters warn the user and fallback to
internal defaults rather than fail the driver load altogether.

Reported-by: Yinghai Lu <yinghai.lu@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix oem parameter header definition
Dan Williams [Tue, 19 Apr 2011 22:29:25 +0000 (15:29 -0700)]
isci: fix oem parameter header definition

The element_length is 2 bytes.

Reported-by: Yinghai Lu <yinghai.lu@oracle.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: audit usage of BUG_ON macro in isci driver
Bartosz Barcinski [Wed, 13 Apr 2011 00:28:43 +0000 (17:28 -0700)]
isci: audit usage of BUG_ON macro in isci driver

Removes unnecessary usage of BUG_ON macro, excluding core directory.
In some cases macro is unnecesary, check is done in caller function.
In other cases macro is replaced by if construction with
appropriate warning.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
[changed some survivable bug conditions to WARN_ONCE]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: sparse warnings cleanup
Bartosz Barcinski [Wed, 13 Apr 2011 00:28:41 +0000 (17:28 -0700)]
isci: sparse warnings cleanup

Clean warnings and errors reported by sparse tool.

request.c:430:50: warning: mixing different enum types
remote_device.c:534:39: warning: symbol 'flags' shadows an earlier one
task.c:495:44: warning: mixing different enum types
scic_sds_controller.c:2155:24: warning: mixing different enum types
scic_sds_controller.c:2272:36: warning: mixing different enum types
scic_sds_controller.c:2911:38: warning: incorrect type in initializer (different address spaces)
scic_sds_controller.c:2913:25: warning: incorrect type in argument 2 (different address spaces)
scic_sds_request.c:875:34: warning: cast removes address space of expression
scic_sds_request.c:876:123: warning: incorrect type in argument 2 (different address spaces)
scic_sds_port.c:585:51: warning: incorrect type in assignment (different address spaces)
scic_sds_port.c:712:9: warning: incorrect type in argument 2 (different address spaces)
scic_sds_port.c:1770:25: warning: incorrect type in argument 2 (different address spaces)

Signed-off-by: Bartosz Barcinski <Bartosz.Barcinski@intel.com>
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
[fixed up some false positives and misconversions]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: replace sci_sas_link_rate with sas_linkrate
Dan Williams [Fri, 15 Apr 2011 01:27:49 +0000 (18:27 -0700)]
isci: replace sci_sas_link_rate with sas_linkrate

Drop duplicated enum definition.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove base_phy abstraction
Maciej Trela [Wed, 13 Apr 2011 00:28:39 +0000 (17:28 -0700)]
isci: remove base_phy abstraction

Merge struct sci_base_phy into scic_sds_phy.  Until now sci_base_phy was
referenced using scic_sds_phy->parent field.

'sci_base_phy' state machine handlers were also merged into scic_sds_phy
state handlers.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove base_port abstraction
Maciej Trela [Wed, 13 Apr 2011 00:28:37 +0000 (17:28 -0700)]
isci: remove base_port abstraction

Merge struct sci_base_port into scic_sds_port.  Until now sci_base_port
was referenced indirectly with scic_sds_port->parent field.

'sci_base_port' state machine handlers were also incorporated into
scic_sds_port handlers.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove base_remote_device abstraction
Maciej Trela [Wed, 13 Apr 2011 00:28:35 +0000 (17:28 -0700)]
isci: remove base_remote_device abstraction

Merge struct sci_base_remote_device into scic_sds_remote_device.  As for
now sci_base_remote_device was accessed indirectly using
scic_sds_remote_device->parent field.  Both machine state handlers are
also merged together.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove scic_controller state handlers
Christoph Hellwig [Sat, 2 Apr 2011 12:15:20 +0000 (08:15 -0400)]
isci: remove scic_controller state handlers

Remove the state handler indirections for the scic_controller, and replace
them with procedural calls that check for the correct state first.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: simplify dma coherent allocation
Christoph Hellwig [Sat, 2 Apr 2011 12:15:04 +0000 (08:15 -0400)]
isci: simplify dma coherent allocation

Remove the insane infrastructure for preallocating coheren DMA regions,
and just allocate the memory where needed.  This also gets rid of the
aligment adjustments given that Documentation/DMA-API-HOWTO.txt sais:

  "The cpu return address and the DMA bus master address are both
   guaranteed to be aligned to the smallest PAGE_SIZE order which
   is greater than or equal to the requested size.  This invariant
   exists (for example) to guarantee that if you allocate a chunk
   which is smaller than or equal to 64 kilobytes, the extent of the
   buffer you receive will not cross a 64K boundary."

Signed-off-by: Christoph Hellwig <hch@lst.de>
[djbw: moved allocation from start to init, re-add memset]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: simplify request state handlers
Christoph Hellwig [Thu, 31 Mar 2011 15:06:16 +0000 (11:06 -0400)]
isci: simplify request state handlers

Instead of filling up tables with default handlers call the default
handler in the only caller.

IMHO the whole state handlers concept is not very suitable for the
isci request.  For example there is a single real instance of the
start handler, and we'd be much better off just having a check for
the right state in the only caller, than all this mess.  It's
quite similar for the abort handler as well.

Even the actual state machine has a lot of states that are rather
pointless.  The initial and constructed states are not needed at all
as the request is not reachable for calls before it's fully set up and
started.  And the abort state should be replaced with an abort actions
and a state transition to the completed state.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill dead data structurs in scic_io_request.h
Christoph Hellwig [Thu, 31 Mar 2011 15:01:39 +0000 (11:01 -0400)]
isci: kill dead data structurs in scic_io_request.h

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove base_request abstraction
Christoph Hellwig [Mon, 28 Mar 2011 13:21:14 +0000 (09:21 -0400)]
isci: remove base_request abstraction

Merge struct sci_base_request into scic_sds_request, and also factor the two
types of state machine handlers into one function.  While we're at it also
remove lots of duplicate incorrect kerneldoc comments for the state machine
handlers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove base_controller abstraction
Christoph Hellwig [Mon, 28 Mar 2011 13:21:04 +0000 (09:21 -0400)]
isci: remove base_controller abstraction

Merge struct sci_base_controller into scic_sds_controller, and also factor
the two types of state machine handlers into one function.  While we're at
it also remove lots of duplicate incorrect kerneldoc comments for the state
machine handlers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove mmio wrappers
Christoph Hellwig [Mon, 28 Mar 2011 00:07:54 +0000 (20:07 -0400)]
isci: remove mmio wrappers

Remove a couple of layers around read/writel to make the driver readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix fragile/conditional isci_host lookups
Dan Williams [Thu, 31 Mar 2011 20:10:44 +0000 (13:10 -0700)]
isci: fix fragile/conditional isci_host lookups

A domain_device can always reference back to ->lldd_ha unlike local lldd
structures.  Fix up cases where the driver uses local objects to look up the
isci_host.  This also changes the calling conventions of some routines to
expect a valid isci_host parameter rather than re-lookup the pointer on entry.

Incidentally cleans up some macros that are longer to type than the open-coded
equivalent:
  isci_host_from_sas_ha
  isci_dev_from_domain_dev

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: cleanup isci_remote_device[_not]_ready interface
Dan Williams [Thu, 31 Mar 2011 20:10:42 +0000 (13:10 -0700)]
isci: cleanup isci_remote_device[_not]_ready interface

Require a valid isci_host in support of the general cleanup to not
re-lookup the host via potentially fragile methods when more robust
methods are available.  Also cleans up some more casting that should be
using container_of() to up-cast a base structure in a more type-safe
manner.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Qualify when the host lock is managed for STP/SATA callbacks.
Jeff Skirvin [Thu, 31 Mar 2011 20:10:40 +0000 (13:10 -0700)]
isci: Qualify when the host lock is managed for STP/SATA callbacks.

In the case of internal discovery related STP/SATA I/O started
through sas_execute_task the host lock is not taken by libsas before
calling lldd_execute_task, so the lock should not be managed before
calling back to libsas through task->task_done or sas_task_abort.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Fix use of SATA soft reset state machine.
Jeff Skirvin [Thu, 31 Mar 2011 20:10:38 +0000 (13:10 -0700)]
isci: Fix use of SATA soft reset state machine.

The driver SATA LUN reset function incorrectly sent an SRST deassert
FIS, which is unnecessary because the core initiates the entire SATA
soft reset state machine from the assert request.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Free host lock for SATA/STP abort escalation at submission time.
Jeff Skirvin [Thu, 31 Mar 2011 20:10:36 +0000 (13:10 -0700)]
isci: Free host lock for SATA/STP abort escalation at submission time.

In the case of I/O requests that fail at submit time because of a
pending reset condition, the host lock for SATA/STP devices must be
managed for any SCSI-initiated I/O before sas_task_abort is called.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Properly handle requests in the "aborting" state.
Jeff Skirvin [Thu, 31 Mar 2011 20:10:34 +0000 (13:10 -0700)]
isci: Properly handle requests in the "aborting" state.

When a TMF times-out, the request is set back to "aborting".
Requests in the "aborting" state must be terminated when
LUN and device resets occur.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Remove "screaming" data types
Dave Jiang [Sun, 27 Mar 2011 00:14:07 +0000 (17:14 -0700)]
isci: Remove "screaming" data types

Converting the all CAPS data types to lower case.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove unused "remote_device_started"
Dan Williams [Sat, 26 Mar 2011 23:56:55 +0000 (16:56 -0700)]
isci: remove unused "remote_device_started"

These routines are just stubs, re-add them when / if they are needed.  Also
cleanup remote_device_stopped.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: namespacecheck cleanups
Dan Williams [Sat, 26 Mar 2011 23:43:01 +0000 (16:43 -0700)]
isci: namespacecheck cleanups

* mark needlessly global routines static
* delete unused functions
* move kernel-doc blocks from header files to source
* reorder some functions to delete declarations
* more default handler cleanups phy

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill some long macros
Dan Williams [Sat, 26 Mar 2011 23:30:35 +0000 (16:30 -0700)]
isci: kill some long macros

Delete some macros that are longer to type than the open coded operation
that they perform.

scic_sds_phy_get_base_state_machine
scic_sds_phy_get_starting_substate_machine
scic_sds_port_get_base_state_machine
scic_sds_port_get_ready_substate_machine
scic_sds_remote_device_get_base_state_machine
scic_sds_remote_device_get_ready_substate_machine
scic_sds_remote_node_context_set_remote_node_index
scic_sds_controller_get_base_state_machine

Also performs some collateral cleanups like killing casts that assume
structure member ordering, and consolidating a lot of duplicated default
handler code (the primary callers of the *_get_base_state_machine macros) via
a helper.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: reorder init to cleanup unneeded declarations
Dan Williams [Sat, 26 Mar 2011 23:30:06 +0000 (16:30 -0700)]
isci: reorder init to cleanup unneeded declarations

Just move isci_pci_driver below the function definitions and delete the
declarations.  A couple other whitespace fixups, and unused symbol
deletions.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Remove event_* calls as they are just wrappers
Dave Jiang [Sat, 26 Mar 2011 23:11:51 +0000 (16:11 -0700)]
isci: Remove event_* calls as they are just wrappers

Removed isci_event_* calls and call those functions directly.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix a build warning
Dan Williams [Fri, 25 Mar 2011 17:05:58 +0000 (10:05 -0700)]
isci: fix a build warning

Use min_t to address:
drivers/scsi/isci/probe_roms.c: In function ‘isci_get_efi_var’:
drivers/scsi/isci/probe_roms.c:241: warning: comparison of distinct pointer types lacks a cast

Reported-by: David Milburn <dmilburn@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix apc mode definition
Dan Williams [Fri, 25 Mar 2011 16:58:15 +0000 (09:58 -0700)]
isci: fix apc mode definition

The original apc mode definition is the correct one, the fix from commit
4711ba10 "isci: fix oem parameter initialization and mode detection" was based
on a typo from a specification update.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: exposing user parameters via module params
Dave Jiang [Wed, 16 Mar 2011 21:57:23 +0000 (14:57 -0700)]
isci: exposing user parameters via module params

Exposing the user config parameters through the kernel module parameters.
The kernel module params will have the default values set and we will no
longer pulling the default values for user params from the core.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix oem parameter initialization and mode detection
Dan Williams [Fri, 11 Mar 2011 18:43:57 +0000 (10:43 -0800)]
isci: fix oem parameter initialization and mode detection

1/ Since commit 858d4aa7 "isci: Move firmware loading to per PCI device" we have
   been silently falling back to built-in defaults for the parameter settings by
   skipping the call to scic_oem_parameters_set().

2/ The afe parameters from the firmware were not being honored

3/ The latest oem parameter definition flips the mode_type values which are
   now 0: for APC 1: for MPC.  For APC we need to make sure all the phys
   default to the same address otherwise strict_wide_ports will cause duplicate
   domains.

4/ Fix up the driver announcement to indicate the source of the
   parameters.

5/ Fix up the sas addresses to be unique per controller (in the fallback case)

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Fixup for OEM parameter EFI variable retrieval
Dave Jiang [Fri, 11 Mar 2011 22:04:43 +0000 (14:04 -0800)]
isci: Fixup for OEM parameter EFI variable retrieval

Updating the EFI variable OEM parameter retrieval after examining the EFI
variable exported via sysfs.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fixup with testing from isci OROM in BIOS
Dan Williams [Tue, 8 Mar 2011 17:53:51 +0000 (09:53 -0800)]
isci: fixup with testing from isci OROM in BIOS

Added fixups for the OROM parsing code after testing with BIOS OROM

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: copy the oem parameters instead of assign
Dave Jiang [Fri, 25 Feb 2011 01:45:57 +0000 (17:45 -0800)]
isci: copy the oem parameters instead of assign

Since the data structure for oem from orom/efi/firmware is the same as what
the core uses, we can just do a direct copy instead of assignment.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: update efi variable name and guid
Dave Jiang [Thu, 24 Feb 2011 20:09:39 +0000 (13:09 -0700)]
isci: update efi variable name and guid

These are the finalized values that the driver can expect to see in
production.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: add support for 2 more oem parmeters
Henryk Dembkowski [Thu, 24 Feb 2011 00:55:11 +0000 (16:55 -0800)]
isci: add support for 2 more oem parmeters

1/ add OEM paramater support for mode_type (MPC vs APC)
2/ add OEM parameter support for max_number_concurrent_device_spin_up
3/ cleanup scic_sds_controller_start_next_phy

todo: hook up the amp control afe parameters into the afe init code

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[cleaned up scic_sds_controller_start_next_phy]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Adding EFI variable skeletal support
Dave Jiang [Wed, 23 Feb 2011 08:02:24 +0000 (00:02 -0800)]
isci: Adding EFI variable skeletal support

Adding EFI variable retrieving for OEM parameters. Still need GUID and
variable name.

Also updated the data struct for oem parameters and hex file for firmware

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[fix CONFIG_EFI=n compile error]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Add support for probing OROM for OEM params
Dan Williams [Tue, 8 Mar 2011 17:52:49 +0000 (09:52 -0800)]
isci: Add support for probing OROM for OEM params

We need to scan the OROM for signature and grab the OEM parameters. We
also need to do the same for EFI. If all fails then we resort to user
binary blob, and if that fails then we go to the defaults.

Share the format with the create_fw utility so that all possible sources
of the parameters are in-sync.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: reset hardware at init
Dan Williams [Thu, 24 Mar 2011 00:31:27 +0000 (17:31 -0700)]
isci: reset hardware at init

Don't assume the hardware is in a known state at init.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: task.h compile and checkpatch fixes
Dan Williams [Thu, 17 Mar 2011 15:04:43 +0000 (08:04 -0700)]
isci: task.h compile and checkpatch fixes

A usage of "FALSE" leaked in as well as some checkpatch escapes.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: don't hold scic_lock over calls to sas_task_abort()
Jeff Skirvin [Wed, 16 Mar 2011 16:41:59 +0000 (09:41 -0700)]
isci: don't hold scic_lock over calls to sas_task_abort()

In the case where submitted I/Os fail with the status code
SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED, the execute function now waits
until scic_lock is cleared before calling the helper function
"isci_request_signal_device_reset" which sets the flag for the pending
reset condition on the I/O.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix incorrect assumptions about task->dev and task->dev->port being NULL
Dan Williams [Fri, 11 Mar 2011 18:13:51 +0000 (10:13 -0800)]
isci: fix incorrect assumptions about task->dev and task->dev->port being NULL

A domain_device has the same lifetime as its related scsi_target.  The
scsi_target is reference counted based on outstanding commands,
therefore it is safe to assume that if we have a valid sas_task that the
->dev pointer is also valid.

The asd_sas_port of a domain_device has the same lifetime as the driver
so it can also never be NULL as long as the sas_task is valid and the
driver is loaded.

This also cleans up isci_task_complete_for_upper_layer(), renames it to
isci_task_refuse() and notices that the isci_completion_selection
parameter was set to isci_perform_normal_io_completion by all callers.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: add "isci_id" attribute
Dan Williams [Thu, 10 Mar 2011 08:01:43 +0000 (00:01 -0800)]
isci: add "isci_id" attribute

Allow each controller to be identified via sysfs.

# cat /sys/class/scsi_host/host13/isci_id
1

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: All pending requests are terminated before stopping the device.
Jeff Skirvin [Wed, 9 Mar 2011 03:32:16 +0000 (20:32 -0700)]
isci: All pending requests are terminated before stopping the device.

Make sure all pending I/O including any in the libsas error handler
process is cleaned-up.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Always set response/status for requests going into the error path.
Jeff Skirvin [Mon, 7 Mar 2011 23:40:47 +0000 (16:40 -0700)]
isci: Always set response/status for requests going into the error path.

In the case of I/O requests being failed because of a required device
reset condition, set the response and status to indicate an I/O failure.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Errors in the submit path for SATA devices manage the ap lock.
Dan Williams [Thu, 10 Mar 2011 05:27:46 +0000 (21:27 -0800)]
isci: Errors in the submit path for SATA devices manage the ap lock.

Since libsas takes the domain device sata_dev.ap->lock before submitting
a task, error completions in the submit path for SATA devices must
unlock/relock when completing the sas_task back to libsas.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Fixed BUG_ON in isci_abort_task_process_cb callback.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:58 +0000 (14:06 -0800)]
isci: Fixed BUG_ON in isci_abort_task_process_cb callback.

The request may be in the "aborted" or the "completed" state when
performing a task management operation on it.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Fix TMF build for SAS/SATA LUN reset cases.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:56 +0000 (14:06 -0800)]
isci: Fix TMF build for SAS/SATA LUN reset cases.

In the case where a SAS or SATA LUN reset TMF is built a NULL pointer
dereference occurred because of the (unused) callback data pointer.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
13 years agoisci: Termination handling cleanup, added termination timeouts.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:52 +0000 (14:06 -0800)]
isci: Termination handling cleanup, added termination timeouts.

Added a request "dead" state for use when a termination wait times-out.

isci_terminate_pending_requests now detaches the device's pending list
and terminates each entry on the detached list.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Code review change for completion pointer cleanup.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:50 +0000 (14:06 -0800)]
isci: Code review change for completion pointer cleanup.

Since the request structure contains a pointer to the completion to be
used if the request is being aborted or terminated, there is no reason
to pass the completion as a pointer to isci_terminate_request_core().

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Cleaning up task execute path.
Jeff Skirvin [Wed, 9 Mar 2011 02:22:07 +0000 (19:22 -0700)]
isci: Cleaning up task execute path.

Made sure the device ready check accounts for all states.
Moved the aborted task check into the loop of pulling task requests
off of the submitted list.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[remove host and device starting state checks]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: save the i/o tag outside the scic request structure.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:46 +0000 (14:06 -0800)]
isci: save the i/o tag outside the scic request structure.

The pointer to the core representation of a request is marked NULL at
completion, but we need to save the i/o tag for task management.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[revise changelog]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Any reset indicated on an I/O completion escalates it to the error path.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:44 +0000 (14:06 -0800)]
isci: Any reset indicated on an I/O completion escalates it to the error path.

If there is a pending device reset, the I/O is used to accomplish the reset by setting the
RESET bit in the task status, and then putting the task into the error handler
path using sas abort task.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix completion / abort path.
Jeff Skirvin [Fri, 4 Mar 2011 22:06:42 +0000 (14:06 -0800)]
isci: fix completion / abort path.

Corrected use of the request state_lock in the completion callback.

In the case where an abort (or reset) thread is trying to terminate an
I/O request, it sets the request state to "aborting" (or "terminating")
if the state is still "starting".  One of the bugs was to never set the
state to "completed".  Another was to not correctly recognize the
situation where the I/O had completed but the sas_task was still pending
callback to task_done - this was typically a problem in the LUN and
device reset cases.

It is now possible that we leave isci_task_abort_task() with
request->io_request_completion pointing to localy allocated
aborted_io_completion struct. It may result in a system crash.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Changes in isci_host_completion_routine
Jeff Skirvin [Fri, 4 Mar 2011 22:06:40 +0000 (14:06 -0800)]
isci: Changes in isci_host_completion_routine

Changes to move management of the reqs_in_process entry for the request here.
Made changes to note when the task is already in the abort path and
cannot be completed through callbacks.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: isci_request_cleanup_completed_loiterer checks task before task_done
Jeff Skirvin [Fri, 4 Mar 2011 22:06:38 +0000 (14:06 -0800)]
isci: isci_request_cleanup_completed_loiterer checks task before task_done

In the condition where outstanding I/Os are being cleaned from the device
requests in process list, the cleanup function needs to check that the
request is actually a sas-task and not a task management function.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: cleanup debug leftovers in isci.h
Dan Williams [Wed, 9 Mar 2011 05:30:28 +0000 (21:30 -0800)]
isci: cleanup debug leftovers in isci.h

Reported-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: replace remote_device_lock with scic_lock
Dan Williams [Fri, 4 Mar 2011 02:01:43 +0000 (18:01 -0800)]
isci: replace remote_device_lock  with scic_lock

The remote_device_lock is currently used to protect a controller global
resource (RNCs), but the remote_device_lock is per-port.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: preallocate remote devices
Dan Williams [Fri, 4 Mar 2011 01:59:32 +0000 (17:59 -0800)]
isci: preallocate remote devices

Until we synchronize against device removal this limits the damage of
use after free bugs to the driver's own objects.  Unless we implement
reference counting we need to ensure at least a subset of a remote
device is valid at all times.  We follow the lead of other libsas
drivers that also preallocate devices.

This also enforces maximum remote device accounting at the lldd layer,
but the core may still run out of RNC's before we hit this limit.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: replace isci_remote_device completion with event queue
Dan Williams [Fri, 4 Mar 2011 20:10:29 +0000 (12:10 -0800)]
isci: replace isci_remote_device completion with event queue

Replace the device completion infrastructure with the controller wide
event queue.  There was a potential for the stop and ready notifications
to corrupt each other, now that cannot happen.

The stop pending flag cannot be used until devices are statically
allocated.  We temporarily need to maintain a completion to handle
waiting for an object that has disappeared, but we can at least stop
scribbling on freed memory.

A future change will also get rid of the "stopping" state as it should
not be exposed to the rest of the driver.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill "host quiesce" mechanism
Dan Williams [Mon, 7 Mar 2011 22:47:35 +0000 (14:47 -0800)]
isci: kill "host quiesce" mechanism

The midlayer is already throttling i/o in the places where host_quiesce
was trying to prevent further i/o to the device.  It's also problematic
in that it holds a lock over GFP_KERNEL allocations.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove sci_device_handle
Dan Williams [Fri, 4 Mar 2011 19:51:43 +0000 (11:51 -0800)]
isci: remove sci_device_handle

It belies the fact that isci_remote_device and scic_sds_remote_device
are one in same object with the same lifetime rules.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill isci_host list in favor of an array
Dan Williams [Tue, 8 Mar 2011 00:02:25 +0000 (16:02 -0800)]
isci: kill isci_host list in favor of an array

isci_host_by_id() should have been a clue that an array would have been
a simpler approach.

Reported-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: enable isci for dmar builds
Dan Williams [Fri, 4 Mar 2011 01:59:25 +0000 (17:59 -0800)]
isci: enable isci for dmar builds

Now that phys_to_virt() and virt_to_phys() have been removed we are no
longer violating the dma mapping (or kmap apis).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: pad stp and smp request sizes
Dan Williams [Thu, 3 Mar 2011 22:58:11 +0000 (14:58 -0800)]
isci: pad stp and smp request sizes

Ross says:
 "The memory allocation for these requests doesn’t take into account the
  additional memory needed when the code in
  scic_sds_s[mst]p_request_assign_buffers() shifts the struct
  scu_task_context so that it is cache line aligned:

  In an example from my machine, total buffer that I’ve given to SCIC goes
  from 0x410024566f84 to 0x410024567308.  From this same example, this
  call shifts my task_context_buffer from 0x410024567208 to
  0x410024567240.

  This means that the task_context_buffer that used to range from
  0x410024567208 to 0x410024567308 instead now goes from 0x410024567240 to
  0x410024567340.

  When the memset() call at the end of scic_task_request_construct()
  clears out this task_context_buffer, it does so from 0x410024567240 to
  0x410024567340, effectively killing whatever buffer follows this
  allocation in memory."

djbw:
Use the kernel's PTR_ALIGN instead of
scic_sds_request_align_task_context_buffer() and SMP_CACHE_BYTES instead of
the local CACHE_LINE_SIZE definition.

TODO: These allocations really want to be better defined in a union rather
than opaque buffers carved up by macros.

Reported-by: Ross Zwisler <ross.zwisler@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix hang after target reset
Dan Williams [Thu, 3 Mar 2011 00:45:18 +0000 (16:45 -0800)]
isci: fix hang after target reset

When aborting a task context we need to be sure that the hardware has acted on
this request (retrieved the task context) before invalidating the remote node
context.  In the case of the "dummy" task context and remote node we do not
have the full state machine that goes through the complete tc abort and rnc
invalidate states.  Instead we ensure the hardware has seen and acted on

Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Cleanup warning messages for phy resets
Dave Jiang [Wed, 2 Mar 2011 21:10:45 +0000 (13:10 -0800)]
isci: Cleanup warning messages for phy resets

Moving some of the chattiness of warning messages to debug so only the Linux
system messages are shown.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Adding support for phy enable and disable
Dave Jiang [Wed, 2 Mar 2011 20:31:24 +0000 (12:31 -0800)]
isci: Adding support for phy enable and disable

Adding support for PHY_FUNC_LINK_RESET and PHY_FUNC_DISABLE. This allow the
sysfs knob enable (both 0 and 1) and link_reset to work properly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: controller stop/start fixes
Pawel Marek [Tue, 1 Mar 2011 20:31:06 +0000 (12:31 -0800)]
isci: controller stop/start fixes

Core reworks to support stopping and re-starting the controller, lays the
groundwork for phy disable / re-enable and fixes other bugs around port/phy
setup/teardown.

Signed-off-by: Pawel Marek <pawel.marek@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: handle cases where a d2h fis is used report an ncq error
Piotr Sawicki [Fri, 25 Feb 2011 21:07:38 +0000 (13:07 -0800)]
isci: handle cases where a d2h fis is used report an ncq error

Observed that some devices return a d2h fis, treat like an sdb error fis.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: workaround port task scheduler starvation issue
Tomasz Chudy [Fri, 25 Feb 2011 10:25:09 +0000 (02:25 -0800)]
isci: workaround port task scheduler starvation issue

There is a condition whereby TCs (task contexts) can jump to the head of
the round robin queue causing indefinite starvation of pending tasks.
Posting a TC to a suspended RNC (remote node context) causes the
hardware to select that task first, but since the RNC is suspended the
scheduler proceeds to the next task in the expected round robin fashion,
restoring TC arbitration fairness.

Signed-off-by: Tomasz Chudy <tomasz.chudy@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: rework timer api
Dan Williams [Wed, 2 Mar 2011 19:49:26 +0000 (11:49 -0800)]
isci: rework timer api

Prepare the timer api for the arrival of dynamic creation and
destruction events from the core.  It pretended to do this previously
but the core to date only used it in a static init-time only fashion.
This is an interim fix until a cleaner event queue can be developed.

1/ make all locking external to the api (add WARN_ONCE to verify)
2/ add a timer_destroy interface (to be used by the core)
3/ use del_timer_sync() prior to deallocating timer data
4/ delete the "timer_list" indirection, we only have timers allocated
   for the isci_host
5/ fix detection of timer list allocation errors

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix sas address reporting
Dan Williams [Fri, 25 Feb 2011 18:25:21 +0000 (10:25 -0800)]
isci: fix sas address reporting

Undo the open coded and incorrect translation of the oem parameter sas
address to its libsas expected format.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removing deprecated functions
Dave Jiang [Wed, 23 Feb 2011 23:57:33 +0000 (15:57 -0800)]
isci: Removing deprecated functions

Removed all callbacks in the deprecated.c. Core will call the appropriate
functions directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Change event notify calls from scic_cb_* to isci_event_*
Dave Jiang [Wed, 23 Feb 2011 23:57:30 +0000 (15:57 -0800)]
isci: Change event notify calls from scic_cb_* to isci_event_*

Renaming the callbacks to apparopriate event notify calls for the LLDD.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: have the driver use native SG calls and DMA-API
Dave Jiang [Wed, 23 Feb 2011 23:57:27 +0000 (15:57 -0800)]
isci: have the driver use native SG calls and DMA-API

Remove abstraction for SG building and get rid of callbacks for getting
DMA memory mapping.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Make the driver copy data directly from and to sg for PIO
Dave Jiang [Wed, 23 Feb 2011 23:57:24 +0000 (15:57 -0800)]
isci: Make the driver copy data directly from and to sg for PIO

We can copy the data directly to and from sg for SATA PIO read operations.
There is no reason to involve the hardware SGL. In the process we also need
to kmap the sg because we don't know where that can come from.

We also do to not call phys_to_virt(). The driver already has the information.
We can just calculcate the appropriate offets.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed special macros that does 64bit address math
Dave Jiang [Tue, 22 Feb 2011 23:39:32 +0000 (16:39 -0700)]
isci: Removed special macros that does 64bit address math

These macros are not necessary. We can do 64bit math directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix for asserts during aborts/resets to SAS/SATA in APC mode
Piotr Sawicki [Wed, 23 Feb 2011 08:09:14 +0000 (00:09 -0800)]
isci: fix for asserts during aborts/resets to SAS/SATA in APC mode

Sending aborts/resets to SAS/SATA targets in APC mode eventually causes
an assert in scic_sds_apc_agent_link_up().  We need to handle the hard reset
case for apc mode ports.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Add Support for new TC completion codes
Tomasz Chudy [Wed, 23 Feb 2011 08:09:04 +0000 (00:09 -0800)]
isci: Add Support for new TC completion codes

Update the SCI Core to comprehend the changes in the TC completion
codes from A0 to B0.  Specifically, there isnew R_ER code
differences for command and data FISes.

Changes are as follows:

1) 0x16 now additionally indicates an R_ERR received for a COMMAND
FIS being sent to a SATA target.  0x16 for SSP still indicates a
NAK received for a COMMAND frame.  Fix is to retry TC to be compliant
with SATA spec or ensure proper error handling of return value
(not spec compliant I don't believe).
2) 0x1B was previously called DONE_BREAK_RCVD for STP and
DONE_LL_ABORT_ERR for SSP.  Now it is universally called
DONE_LL_ABORT_ERR.  This is purely a superficial change.
3) 0x32 is no longer a reserved code.  Now it indicates
DONE_CMD_SDMA_ERR for STP/SSP.  There was a fatal error on the
SDMA for a command IU (includes Raw frames).  Consider retry,
but at a minimum gracefully fail the request.
4) 0x33 is no longer a reserved code.  Now it indicates
DONE_CMD_LL_ABORT_ERR for SSP.  There was a break receivd
during transmission of a command IU.  Consider retry, but
at a minimum gracefully fail the request.

Signed-off-by: Tomasz Chudy <Tomasz.Chudy@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: clean up remaining silicon revision ifdefs in phy init
Dan Williams [Wed, 23 Feb 2011 08:09:01 +0000 (00:09 -0800)]
isci: clean up remaining silicon revision ifdefs in phy init

Use the dynamic revision detection code in
scic_sds_phy_link_layer_initialization() and apply some coding style
fixups (long deref chains).  The compile time max link rate setting is
removed in favor of honoring the user-parameter max.

Reported-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Add support for user parameters in SCIC layer
Jacek Danecki [Wed, 23 Feb 2011 08:08:58 +0000 (00:08 -0800)]
isci: Add support for user parameters in SCIC layer

Add support for the following parameters in SCIC:

     /**
       * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
       * insertion frequency for this phy index.
       */
      u32  notify_enable_spin_up_insertion_frequency;

      /**
       * This method specifies the number of transmitted DWORDs within which
       * to transmit a single ALIGN primitive.  This value applies regardless
       * of what type of device is attached or connection state.  A value of
       * 0 indicates that no ALIGN primitives will be inserted.
       */
      u16  align_insertion_frequency;

      /**
       * This method specifies the number of transmitted DWORDs within which
       * to transmit 2 ALIGN primitives.  This applies for SAS connections
       * only.  A minimum value of 3 is required for this field.
       */
      u16  in_connection_align_insertion_frequency;

Signed-off-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Move transport layer registers from port to phy
Henryk Dembkowski [Wed, 23 Feb 2011 08:08:52 +0000 (00:08 -0800)]
isci: Move transport layer registers from port to phy

At init and RNC resume we need to touch every phy in a port to be sure
we have initialized STP properties in the case where port_index !=
phy_index.  Also add some missing __iomem annotations.

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix "no outbound task timeout" default value
Tomasz Chudy [Wed, 23 Feb 2011 08:08:49 +0000 (00:08 -0800)]
isci: fix "no outbound task timeout" default value

The default should be 5us.  The hardware encodes it in 256ns increments,
so the value should be 20 to approximate a 5us timeout.

Signed-off-by: Tomasz Chudy <Tomasz.Chudy@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>