summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/task.c
Commit message (Collapse)AuthorAgeFilesLines
* isci: uplevel request infrastructureDan Williams2011-07-031-3/+0
| | | | | | | | | | | * Consolidate tiny header files * Move files out of core/ (drop core/scic_sds_ prefix) * Merge core/scic_sds_request.[ch] into request.[ch] * Cleanup request.c namespace (clean forward declarations and global namespace pollution) Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: move core/controller to hostDan Williams2011-07-031-1/+0
| | | | | | | | Now that the data structures are unified unify the implementation in host.[ch] and cleanup namespace pollution. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify constantsDan Williams2011-07-031-0/+2
| | | | | | | | | | | cross driver constants are spread out over multiple header files, consolidate them into isci.h, and push some includes out to the source files that need them. TODO: remove SCI_MODE_SIZE infrastructure. TODO: task.h is full of inlines that are too large Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify request data structuresDan Williams2011-07-031-19/+11
| | | | | | | | | | Make scic_sds_request a proper member of isci_request. Also let's us get rid of the dma pool object size tracking since we now know that all requests are sizeof(isci_request). While cleaning up the construct routine incidentally replaced SCI_FIELD_OFFSET with offsetof. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: make command/response iu explicit request object membersDan Williams2011-07-031-3/+2
| | | | | | | Final elimination of the anonymous data at the end of the request structure. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: make sgl explicit/aligned request object memberDan Williams2011-07-031-8/+4
| | | | | | | Towards unifying request objects we need all members to be defined in the object and not carved out of anonymous buffer space. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: move stp request info to scic_sds_requestDan Williams2011-07-031-3/+2
| | | | | | | In preparation for unifying allocation of all request information make stp data available in all requests. Incidentally collapse indentation. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify isci_host data structuresArtur Wojcik2011-07-031-9/+6
| | | | | | | | | 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>
* isci: implement I_T_nexus_resetDan Williams2011-07-031-64/+74
| | | | | | | | | | | | | 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>
* isci: Convert of sci_ssp_response_iu to ssp_response_iuDave Jiang2011-07-031-66/+34
| | | | | | | | | | | 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>
* isci: Fixup SSP command IU and task IUDave Jiang2011-07-031-49/+0
| | | | | | | 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>
* isci: Convert SATA fis data structures to Linux nativeDave Jiang2011-07-031-4/+2
| | | | | | | | 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>
* isci: Removed sci_base_object from scic_sds_request.Maciej Patelczyk2011-07-031-5/+2
| | | | | | | | | 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>
* isci: Remove excessive log noise with expander hot-unplugDave Jiang2011-07-031-7/+8
| | | | | | | | 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>
* isci: kill smp_discover_response_protocols in favor of domain_device.dev_typeDan Williams2011-07-031-15/+5
| | | | | | | | | | | | | | | 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>
* isci: move remote_device handling out of the coreDan Williams2011-07-031-3/+2
| | | | | | | | 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>
* isci: unify remote_device data structuresDan Williams2011-07-031-11/+9
| | | | | | | 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>
* isci: audit usage of BUG_ON macro in isci driverBartosz Barcinski2011-07-031-5/+6
| | | | | | | | | | | 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>
* isci: sparse warnings cleanupBartosz Barcinski2011-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* isci: remove scic_controller state handlersChristoph Hellwig2011-07-031-1/+1
| | | | | | | | 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>
* isci: fix fragile/conditional isci_host lookupsDan Williams2011-07-031-60/+27
| | | | | | | | | | | | | | 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>
* isci: Qualify when the host lock is managed for STP/SATA callbacks.Jeff Skirvin2011-07-031-20/+9
| | | | | | | | | | 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>
* isci: Properly handle requests in the "aborting" state.Jeff Skirvin2011-07-031-3/+11
| | | | | | | | | 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>
* isci: namespacecheck cleanupsDan Williams2011-07-031-10/+1
| | | | | | | | | | * 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>
* isci: fix incorrect assumptions about task->dev and task->dev->port being NULLDan Williams2011-07-031-113/+55
| | | | | | | | | | | | | | | | | 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>
* isci: Errors in the submit path for SATA devices manage the ap lock.Dan Williams2011-07-031-0/+87
| | | | | | | | | 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>
* isci: Fixed BUG_ON in isci_abort_task_process_cb callback.Jeff Skirvin2011-07-031-1/+2
| | | | | | | | 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>
* isci: Fix TMF build for SAS/SATA LUN reset cases.Jeff Skirvin2011-07-031-5/+19
| | | | | | | | | 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>
* isci: Termination handling cleanup, added termination timeouts.Jeff Skirvin2011-07-031-92/+141
| | | | | | | | | | 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>
* isci: Code review change for completion pointer cleanup.Jeff Skirvin2011-07-031-9/+11
| | | | | | | | | | 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>
* isci: Cleaning up task execute path.Jeff Skirvin2011-07-031-70/+71
| | | | | | | | | | | 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>
* isci: save the i/o tag outside the scic request structure.Jeff Skirvin2011-07-031-6/+4
| | | | | | | | | | 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>
* isci: fix completion / abort path.Jeff Skirvin2011-07-031-130/+100
| | | | | | | | | | | | | | | | | | | | | 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>
* isci: isci_request_cleanup_completed_loiterer checks task before task_doneJeff Skirvin2011-07-031-4/+7
| | | | | | | | | 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>
* isci: kill "host quiesce" mechanismDan Williams2011-07-031-43/+6
| | | | | | | | 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>
* isci: remove sci_device_handleDan Williams2011-07-031-8/+7
| | | | | | | 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>
* isci: rework timer apiDan Williams2011-07-031-14/+3
| | | | | | | | | | | | | | | | 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>
* isci: cleanup "starting" state handlingDan Williams2011-07-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | The lldd actively disallows requests in the "starting" state. Retrying or holding off commands in this state is sub-optimal: 1/ it adds another state check to the fast path 2/ retrying can cause libsas to give up However, isci's ->lldd_dev_found() routine already waits for controller start to complete before allowing further progress. Checking the "starting" state in isci_task_execute_task and the isr is redundant and misleading. Clean this up and introduce a controller-wide event queue to start reeling in "completion" proliferation in the driver. The "stopping" state cleanups are in a similar vein, rely on the the isr and other paths being precluded from occurring rather than implementing state checking logic. Reported-by: Christoph Hellwig <hch@infradead.org> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Intel(R) C600 Series Chipset Storage Control Unit DriverDan Williams2011-07-021-0/+1691
Support for the up to 2x4-port 6Gb/s SAS controllers embedded in the chipset. This is a snapshot of the first publicly available version of the driver, commit 4c1db2d0 in the 'historical' branch. git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git historical Signed-off-by: Maciej Trela <maciej.trela@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>