GitHub/LineageOS/android_kernel_motorola_exynos9610.git
13 years agoisci: unify isci_host data structures
Artur Wojcik [Wed, 4 May 2011 07:58:16 +0000 (07:58 +0000)]
isci: unify isci_host data structures

Make it explicit that isci_host and scic_sds_controller are one in the same
object.

Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
[removed ->ihost back pointer]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: implement I_T_nexus_reset
Dan Williams [Mon, 2 May 2011 20:59:25 +0000 (13:59 -0700)]
isci: implement I_T_nexus_reset

This is a requirement for 2.6.39's new libata eh.

Still some questions about lldd_dev_gone racing against dev->lldd_dev
lookups, but we are at least no more broken than mvsas in this regard.

We also short-circuit I_T_nexus_reset invocations from the device
discovery path (IDEV_EH similar to MVS_DEV_EH) to filter out the
resulting domain rediscoveries triggered by the reset.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix ata locking
Dan Williams [Fri, 6 May 2011 00:47:44 +0000 (17:47 -0700)]
isci: fix ata locking

Upstream commit a29b5dad "libata: fix locking for sas paths" switched
libsas ata locking to the ata_host lock.  We need to do the same when
returning ata tasks from the execute path.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: removing intel_*.h headers
Dave Jiang [Thu, 5 May 2011 02:01:01 +0000 (19:01 -0700)]
isci: removing intel_*.h headers

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Using Linux SSP frame header
Dave Jiang [Thu, 5 May 2011 01:45:05 +0000 (18:45 -0700)]
isci: Using Linux SSP frame header

Removing of struct sci_ssp_frame_header and migrate to struct ssp_frame_hdr.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Remove SCIC_SWAP_DWORD()
Dave Jiang [Thu, 5 May 2011 01:28:32 +0000 (18:28 -0700)]
isci: Remove SCIC_SWAP_DWORD()

Use Linux native swab32() call instead of SCIC_SWAP_DWORD().

We need to swab() because the hardware munges the data into a
"big-endian dword" stream which is byte-swapped from the sas definition
regardless of host endian.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fixup SAS iaf protocols data structure
Dave Jiang [Thu, 5 May 2011 01:22:33 +0000 (18:22 -0700)]
isci: fixup SAS iaf protocols data structure

Moved the actual data structure that's read from the phy register to phy
header.  Removed the parsing of identify address frame protocol bits as
that seemed not necessary and we can use existing information.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove redundant copies of IAF
Dave Jiang [Thu, 5 May 2011 01:08:35 +0000 (18:08 -0700)]
isci: remove redundant copies of IAF

We need to remove the extra copies of identify address frame that's
being kept around. We only need the one copy that libsas is using.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[further cleanups]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Converting smp_response to Linux native smp_resp
Dave Jiang [Thu, 5 May 2011 01:07:09 +0000 (18:07 -0700)]
isci: Converting smp_response to Linux native smp_resp

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Fixup of smp request
Dave Jiang [Thu, 5 May 2011 01:01:22 +0000 (18:01 -0700)]
isci: Fixup of smp request

The struct smp_request data structure has be fixed up for Linux consumption.
This probably should go to scsi/sas.h eventually.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Convert of sci_ssp_response_iu to ssp_response_iu
Dave Jiang [Thu, 5 May 2011 00:53:24 +0000 (17:53 -0700)]
isci: Convert of sci_ssp_response_iu to ssp_response_iu

Converting to Linux native format. However the isci driver does a lot of
the calculation based on the max size of this data structure and the
Linux data structure only has a pointer to the response data. Thus the
sizeof(struct ssp_response_iu) will be incorrect and we need to define
the max size.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Fixup SSP command IU and task IU
Dave Jiang [Thu, 5 May 2011 00:44:54 +0000 (17:44 -0700)]
isci: Fixup SSP command IU and task IU

Fixup of SSP command IU and SSP task IU to something that looks like Linux

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: renaming sas_capabilities to scic_phy_cap
Dave Jiang [Wed, 4 May 2011 23:16:44 +0000 (16:16 -0700)]
isci: renaming sas_capabilities to scic_phy_cap

This seems to be a data structure that represents the phy capabilities
register from the hardware and has nothing to do with SAS data structs.
Moving and fixup

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Collapsing of phy_type data structure
Dave Jiang [Wed, 4 May 2011 23:13:17 +0000 (16:13 -0700)]
isci: Collapsing of phy_type data structure

Collapsing of struct scic_sds_phy phy_type data structure

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Convert SAS identify address frame to Linux Native format
Dave Jiang [Wed, 4 May 2011 22:37:52 +0000 (15:37 -0700)]
isci: Convert SAS identify address frame to Linux Native format

Convert struct sci_sas_identify_address_frame to struct sas_identify_frame

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Convert ATA defines to Linux native defines
Dave Jiang [Wed, 4 May 2011 22:02:03 +0000 (15:02 -0700)]
isci: Convert ATA defines to Linux native defines

* Removing all intel_sata and intel_ata defines
* Removing the usage of SAT_PROTOCOL_*. We can get everything from sas_task
* Moved SATA FIS types to local sas.h. These defines will have to go
  into include/scsi/sas.h eventually.
* Added offsets for SATA FIS header in order to grab the values

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Convert SATA fis data structures to Linux native
Dave Jiang [Wed, 4 May 2011 22:02:02 +0000 (15:02 -0700)]
isci: Convert SATA fis data structures to Linux native

Converting of sata_fis_reg_d2h to dev_to_host_fis
Converting of sata_fis_reg_h2d to host_to_dev_fis

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: remove compile-time (Kconfig) silicon configuration
Dan Williams [Wed, 4 May 2011 20:49:32 +0000 (13:49 -0700)]
isci: remove compile-time (Kconfig) silicon configuration

Pre-production silicon support is deprecated, and will be removed
completely in the future.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removing unused define SCIC_SDS_4_ENABLED
Dave Jiang [Fri, 22 Apr 2011 06:39:48 +0000 (06:39 +0000)]
isci: Removing unused define SCIC_SDS_4_ENABLED

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill scic_sds_remote_device.state_handlers
Dan Williams [Sun, 1 May 2011 23:58:46 +0000 (16:58 -0700)]
isci: kill scic_sds_remote_device.state_handlers

Remove the now unused state_handler infrastructure for remote_devices.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device frame_handlers
Dan Williams [Sun, 1 May 2011 23:51:11 +0000 (16:51 -0700)]
isci: unify remote_device frame_handlers

Implement all states in scic_sds_remote_device_frame() and delete
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device event_handlers
Dan Williams [Sun, 1 May 2011 23:26:09 +0000 (16:26 -0700)]
isci: unify remote_device event_handlers

Implement all states in scic_sds_remote_device_event() and delete
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill remote_device resume_handler
Dan Williams [Sun, 1 May 2011 23:20:54 +0000 (16:20 -0700)]
isci: kill remote_device resume_handler

This is unused infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device suspend_handlers
Dan Williams [Sun, 1 May 2011 23:15:47 +0000 (16:15 -0700)]
isci: unify remote_device suspend_handlers

Implement all states in scic_sds_remote_device_suspend() and delete
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill remote_device complete_task_handler
Dan Williams [Sun, 1 May 2011 23:01:05 +0000 (16:01 -0700)]
isci: kill remote_device complete_task_handler

This is unused infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device start_task_handlers
Dan Williams [Sun, 1 May 2011 22:53:25 +0000 (15:53 -0700)]
isci: unify remote_device start_task_handlers

Implement all states in scic_sds_remote_device_start_task() and delete
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill remote_device continue_io_handler
Dan Williams [Sun, 1 May 2011 22:46:18 +0000 (15:46 -0700)]
isci: kill remote_device continue_io_handler

This is unused infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device complete_io_handlers
Dan Williams [Sun, 1 May 2011 22:33:43 +0000 (15:33 -0700)]
isci: unify remote_device complete_io_handlers

Implement all states in scic_sds_remote_device_complete_io() and delete
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device start_io_handlers
Dan Williams [Sun, 1 May 2011 21:57:11 +0000 (14:57 -0700)]
isci: unify remote_device start_io_handlers

Implement all states in scic_sds_remote_device_start_io() and delete the
state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device reset_complete_handlers
Dan Williams [Sun, 1 May 2011 21:53:00 +0000 (14:53 -0700)]
isci: unify remote_device reset_complete_handlers

Implement all states in scic_remote_device_reset_complete() and delete the
state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device reset_handlers
Dan Williams [Sun, 1 May 2011 21:48:54 +0000 (14:48 -0700)]
isci: unify remote_device reset_handlers

Implement all states in scic_remote_device_reset() and delete the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device destruct_handlers
Dan Williams [Sun, 1 May 2011 21:38:26 +0000 (14:38 -0700)]
isci: unify remote_device destruct_handlers

Implement all states in scic_remote_device_destruct() and delete the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill remote_device fail_handler
Dan Williams [Sun, 1 May 2011 21:35:43 +0000 (14:35 -0700)]
isci: kill remote_device fail_handler

This is just unused infrastructure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device stop_handlers
Dan Williams [Sun, 1 May 2011 21:19:25 +0000 (14:19 -0700)]
isci: unify remote_device stop_handlers

Implement all states in scic_remote_device_stop() and delete the state
handlers.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: unify remote_device start_handlers
Dan Williams [Sun, 1 May 2011 21:05:57 +0000 (14:05 -0700)]
isci: unify remote_device start_handlers

Implement all states in scic_remote_device_start() and delete the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: fix remote_device start_io regressions
Dan Williams [Sun, 1 May 2011 17:13:04 +0000 (10:13 -0700)]
isci: fix remote_device start_io regressions

While reducing indentation commits 7ab92c9e "isci: make a
remote_node_context a proper member of a remote_device", 0879e6a6 "isci:
merge remote_device substates into a single state machine" broke
handling of situations where i/o's successfully started at the port
level need to terminated when the remote_node declines to start the i/o.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: kill scic_remote_device_get_connection_rate
Dan Williams [Fri, 29 Apr 2011 20:20:30 +0000 (13:20 -0700)]
isci: kill scic_remote_device_get_connection_rate

A function call to dereference a pointer is a tad much.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: merge remote_device substates into a single state machine
Dan Williams [Wed, 27 Apr 2011 23:32:45 +0000 (16:32 -0700)]
isci: merge remote_device substates into a single state machine

A substate is just a state, so uplevel the smp and stp device substates.
Three tricks at work here:

1/ scic_sds_remote_device_ready_state_enter: needs to know the the device type
   so it can immediately transition to a stp or smp ready substate.

2/ scic_sds_remote_device_ready_state_exit: needs to know the device type. In
   the ssp case the device is no longer ready, in the stp, and smp case we have
   simply exited to a ready "substate".

3/ scic_sds_remote_device_resume_complete_handler: The one location
   where we directly check the current state against
   SCI_BASE_REMOTE_DEVICE_STATE_READY needed to comprehend the possible ready
   substates.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_object.h from project.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:36 +0000 (22:06 +0000)]
isci: Removed sci_object.h from project.

The sci_object.h file was removed. No sci_base_object
is now in the code.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_base_object from scic_sds_request.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:31 +0000 (22:06 +0000)]
isci: Removed sci_base_object from scic_sds_request.

The 'struct sci_base_object' was removed from the struct
scic_sds_request and was replaced by a pointer to
struct isci_request.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_base_object from scic_sds_remote_node_context.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:26 +0000 (22:06 +0000)]
isci: Removed sci_base_object from scic_sds_remote_node_context.

The 'struct sci_base_object' was removed from the struct
scic_sds_remote_node_context.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_base_object from scic_sds_remote_device.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:21 +0000 (22:06 +0000)]
isci: Removed sci_base_object from scic_sds_remote_device.

The 'struct sci_base_object' was removed from the struct
scic_sds_remote_device.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
[cleaned up sci_dev_to_idev]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_base_object from scic_sds_port.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:16 +0000 (22:06 +0000)]
isci: Removed sci_base_object from scic_sds_port.

The 'struct sci_base_object' was removed from the struct
scic_sds_port and was replaced by a pointer to
struct isci_port.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_base_object from scic_sds_phy.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:11 +0000 (22:06 +0000)]
isci: Removed sci_base_object from scic_sds_phy.

The 'struct sci_base_object' was removed from the struct
scic_sds_phy and was replaced by a pointer to
struct isci_phy.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
13 years agoisci: Removed sci_base_object from scic_sds_controller.
Maciej Patelczyk [Thu, 28 Apr 2011 22:06:06 +0000 (22:06 +0000)]
isci: Removed sci_base_object from scic_sds_controller.

The 'struct sci_base_object' was removed from the struct
scic_sds_controller and was replaced by a pointer to
struct isci_host.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
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>