summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-07-03isci: simplify request state handlersChristoph Hellwig
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>
2011-07-03isci: kill dead data structurs in scic_io_request.hChristoph Hellwig
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: remove base_request abstractionChristoph Hellwig
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>
2011-07-03isci: remove base_controller abstractionChristoph Hellwig
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>
2011-07-03isci: remove mmio wrappersChristoph Hellwig
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>
2011-07-03isci: fix fragile/conditional isci_host lookupsDan Williams
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>
2011-07-03isci: cleanup isci_remote_device[_not]_ready interfaceDan Williams
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>
2011-07-03isci: Qualify when the host lock is managed for STP/SATA callbacks.Jeff Skirvin
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>
2011-07-03isci: Fix use of SATA soft reset state machine.Jeff Skirvin
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>
2011-07-03isci: Free host lock for SATA/STP abort escalation at submission time.Jeff Skirvin
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>
2011-07-03isci: Properly handle requests in the "aborting" state.Jeff Skirvin
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>
2011-07-03isci: Remove "screaming" data typesDave Jiang
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>
2011-07-03isci: remove unused "remote_device_started"Dan Williams
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>
2011-07-03isci: namespacecheck cleanupsDan Williams
* 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>
2011-07-03isci: kill some long macrosDan Williams
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>
2011-07-03isci: reorder init to cleanup unneeded declarationsDan Williams
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>
2011-07-03isci: Remove event_* calls as they are just wrappersDave Jiang
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>
2011-07-03isci: fix a build warningDan Williams
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>
2011-07-03isci: fix apc mode definitionDan Williams
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>
2011-07-03isci: exposing user parameters via module paramsDave Jiang
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>
2011-07-03isci: fix oem parameter initialization and mode detectionDan Williams
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>
2011-07-03isci: Fixup for OEM parameter EFI variable retrievalDave Jiang
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>
2011-07-03isci: fixup with testing from isci OROM in BIOSDan Williams
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>
2011-07-03isci: copy the oem parameters instead of assignDave Jiang
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>
2011-07-03isci: update efi variable name and guidDave Jiang
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>
2011-07-03isci: add support for 2 more oem parmetersHenryk Dembkowski
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>
2011-07-03isci: Adding EFI variable skeletal supportDave Jiang
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>
2011-07-03isci: Add support for probing OROM for OEM paramsDan Williams
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>
2011-07-03isci: reset hardware at initDan Williams
Don't assume the hardware is in a known state at init. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: task.h compile and checkpatch fixesDan Williams
A usage of "FALSE" leaked in as well as some checkpatch escapes. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: don't hold scic_lock over calls to sas_task_abort()Jeff Skirvin
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>
2011-07-03isci: fix incorrect assumptions about task->dev and task->dev->port being NULLDan Williams
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>
2011-07-03isci: add "isci_id" attributeDan Williams
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>
2011-07-03isci: All pending requests are terminated before stopping the device.Jeff Skirvin
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>
2011-07-03isci: Always set response/status for requests going into the error path.Jeff Skirvin
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>
2011-07-03isci: Errors in the submit path for SATA devices manage the ap lock.Dan Williams
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>
2011-07-03isci: Fixed BUG_ON in isci_abort_task_process_cb callback.Jeff Skirvin
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>
2011-07-03isci: Fix TMF build for SAS/SATA LUN reset cases.Jeff Skirvin
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>
2011-07-03isci: Termination handling cleanup, added termination timeouts.Jeff Skirvin
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>
2011-07-03isci: Code review change for completion pointer cleanup.Jeff Skirvin
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>
2011-07-03isci: Cleaning up task execute path.Jeff Skirvin
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>
2011-07-03isci: save the i/o tag outside the scic request structure.Jeff Skirvin
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>
2011-07-03isci: Any reset indicated on an I/O completion escalates it to the error path.Jeff Skirvin
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>
2011-07-03isci: fix completion / abort path.Jeff Skirvin
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>
2011-07-03isci: Changes in isci_host_completion_routineJeff Skirvin
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>
2011-07-03isci: isci_request_cleanup_completed_loiterer checks task before task_doneJeff Skirvin
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>
2011-07-03isci: cleanup debug leftovers in isci.hDan Williams
Reported-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: replace remote_device_lock with scic_lockDan Williams
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>
2011-07-03isci: preallocate remote devicesDan Williams
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>
2011-07-03isci: replace isci_remote_device completion with event queueDan Williams
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>