summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/remote_device.h
Commit message (Collapse)AuthorAgeFilesLines
* [SCSI] isci: Fix task management for SMP, SATA and on dev remove.Jeff Skirvin2011-10-311-2/+0
| | | | | | | | | | | libsas uses the LLDD abort task interface to handle I/O timeouts in the SATA/STP and SMP discovery paths, so this change will terminate STP/SMP requests. Also, if the device is gone, the lldd will prevent libsas from further escalations in the error handler. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: atapi supportDan Williams2011-10-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on original implementation from Jiangbi Liu and Maciej Trela. ATAPI transfers happen in two-to-three stages. The two stage atapi commands are those that include a dma data transfer. The data transfer portion of these operations is handled by the hardware packet-dma acceleration. The three-stage commands do not have a data transfer and are handled without hardware assistance in raw frame mode. stage1: transmit host-to-device fis to notify the device of an incoming atapi cdb. Upon reception of the pio-setup-fis repost the task_context to perform the dma transfer of the cdb+data (go to stage3), or repost the task_context to transmit the cdb as a raw frame (go to stage 2). stage2: wait for hardware notification of the cdb transmission and then go to stage 3. stage3: wait for the arrival of the terminating device-to-host fis and terminate the command. To keep the implementation simple we only support ATAPI packet-dma protocol (for commands with data) to avoid needing to handle the data transfer manually (like we do for SATA-PIO). This may affect compatibility for a small number of devices (see ATA_HORKAGE_ATAPI_MOD16_DMA). If the data-transfer underruns, or encounters an error the device-to-host fis is expected to arrive in the unsolicited frame queue to pass to libata for disposition. However, in the DONE_UNEXP_FIS (data underrun) case it appears we need to craft a response. In the DONE_REG_ERR case we do receive the UF and propagate it to libsas. Signed-off-by: Maciej Trela <maciej.trela@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* isci: kill 'get/set' macrosDan Williams2011-07-031-85/+12
| | | | | | | | | Most of these simple dereference macros are longer than their open coded equivalent. Deleting enum sci_controller_mode is thrown in for good measure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: retire scic_sds_ and scic_ prefixesDan Williams2011-07-031-47/+43
| | | | | | | | | | | | | | The distinction between scic_sds_ scic_ and sci_ are no longer relevant so just unify the prefixes on sci_. The distinction between isci_ and sci_ is historically significant, and useful for comparing the old 'core' to the current Linux driver. 'sci_' represents the former core as well as the routines that are closer to the hardware and protocol than their 'isci_' brethren. sci == sas controller interface. Also unwind the 'sds1' out of the parameter structs. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify isci_host and scic_sds_controllerDan Williams2011-07-031-3/+3
| | | | | | | | | Remove the distinction between these two implementations and unify on isci_host (local instances named ihost). Hmmm, we had two 'oem_parameters' instances, one was unused... nice. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify isci_remote_device and scic_sds_remote_deviceDan Williams2011-07-031-101/+47
| | | | | | | | Remove the distinction between these two implementations and unify on isci_remote_device (local instances named idev). Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify isci_port and scic_sds_portDan Williams2011-07-031-9/+1
| | | | | | | | | | Remove the distinction between these two implementations and unify on isci_port (local instances named iport). The duplicate '->owning_port' and '->isci_port' in both isci_phy and isci_remote_device will be fixed in a later patch... this is just the straightforward rename/unification. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify isci_request and scic_sds_requestDan Williams2011-07-031-4/+4
| | | | | | | | | They are one in the same object so remove the distinction. The near duplicate fields (owning_controller, and isci_host) will be cleaned up after the scic_sds_contoller isci_host unification. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Terminate dev requests on FIS err bit rx in NCQJeff Skirvin2011-07-031-0/+1
| | | | | | | | | | | When the remote device transitions to a not-ready state because of an NCQ error condition, all outstanding requests to that device are terminated and completed to libsas on the normal path. The device then waits for a READ LOG EXT command to issue on the task management path. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: kill device_sequenceDan Williams2011-07-031-11/+0
| | | | | | | | Now that we have upleveled device reassignment protection to the isci_remote_device reference count we no longer need this level of self-defense. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: kill isci_remote_device_change_state()Dan Williams2011-07-031-4/+1
| | | | | | | | | | | | | Now that "stopping/stopped" are one in the same and signalled by a NULL device pointer the rest of the device status infrastructure can be removed (->status and ->state_lock). The "not ready for i/o state" is replaced with a state flag, and is evaluated under scic_lock so that we don't see transients from taking the device reference to submitting the i/o. This also fixes a potential leakage of can_queue slots in the rare case that SAS_TASK_ABORTED is set at submission. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: atomic device lookup and reference countingDan Williams2011-07-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have unsafe references to remote devices that are notified to disappear at lldd_dev_gone. In order to clean this up we need a single canonical source for device lookups and stable references once a lookup succeeds. Towards that end guarantee that domain_device.lldd_dev is NULL as soon as we start the process of stopping a device. Any code path that wants to safely lookup a remote device must do so through task->dev->lldd_dev (isci_lookup_device()). For in-flight references outside of scic_lock we need reference counting to ensure that the device is not recycled before we are done with it. Simplify device back references to just scic_sds_request.target_device which is now the only permissible internal reference that is maintained relative to the reference count. There were two occasions where we wanted new i/o's to be treated as SAS_TASK_UNDELIVERED but where the domain_dev->lldd_dev link is still intact. Introduce a 'gone' flag to prevent i/o while waiting for libsas to take action on the port down event. One 'core' leftover is that we currently call scic_remote_device_destruct() from isci_remote_device_deconstruct() which is called when the 'core' says the device is stopped. It would be more natural for the final put to trigger isci_remote_device_deconstruct() but this implementation is deferred as it requires other changes. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: state machine cleanupEdmund Nadolski2011-07-031-17/+17
| | | | | | | | | | | | | | | | | | | | | | | This cleans up several areas of the state machine mechanism: o Rename sci_base_state_machine_change_state to sci_change_state o Remove sci_base_state_machine_get_state function o Rename 'state_machine' struct member to 'sm' in client structs o Shorten the name of request states o Shorten state machine state names as follows: SCI_BASE_CONTROLLER_STATE_xxx to SCIC_xxx SCI_BASE_PHY_STATE_xxx to SCI_PHY_xxx SCIC_SDS_PHY_STARTING_SUBSTATE_xxx to SCI_PHY_SUB_xxx SCI_BASE_PORT_STATE_xxx to SCI_PORT_xxx and SCIC_SDS_PORT_READY_SUBSTATE_xxx to SCI_PORT_SUB_xxx SCI_BASE_REMOTE_DEVICE_STATE_xxx to SCI_DEV_xxx SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_STP_DEV_xxx SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_SMP_DEV_xxx SCIC_SDS_REMOTE_NODE_CONTEXT_xxx_STATE to SCI_RNC_xxx Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify constantsDan Williams2011-07-031-1/+0
| | | | | | | | | | | 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: implement I_T_nexus_resetDan Williams2011-07-031-0/+1
| | | | | | | | | | | | | 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: removing intel_*.h headersDave Jiang2011-07-031-1/+0
| | | | | Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: kill scic_sds_remote_device.state_handlersDan Williams2011-07-031-56/+0
| | | | | | | 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>
* isci: unify remote_device frame_handlersDan Williams2011-07-031-1/+0
| | | | | | | | 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>
* isci: unify remote_device event_handlersDan Williams2011-07-031-1/+0
| | | | | | | | 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>
* isci: kill remote_device resume_handlerDan Williams2011-07-031-1/+0
| | | | | | | This is unused infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify remote_device suspend_handlersDan Williams2011-07-031-1/+0
| | | | | | | | 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>
* isci: kill remote_device complete_task_handlerDan Williams2011-07-031-7/+0
| | | | | | | This is unused infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify remote_device start_task_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: kill remote_device continue_io_handlerDan Williams2011-07-031-6/+0
| | | | | | | This is unused infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify remote_device complete_io_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: unify remote_device start_io_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: unify remote_device reset_complete_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: unify remote_device reset_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: unify remote_device destruct_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: kill remote_device fail_handlerDan Williams2011-07-031-7/+0
| | | | | | | This is just unused infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify remote_device stop_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: unify remote_device start_handlersDan Williams2011-07-031-6/+0
| | | | | | | | 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>
* isci: kill scic_remote_device_get_connection_rateDan Williams2011-07-031-13/+0
| | | | | | A function call to dereference a pointer is a tad much. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: merge remote_device substates into a single state machineDan Williams2011-07-031-174/+34
| | | | | | | | | | | | | | | | | | | | 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>
* isci: Removed sci_base_object from scic_sds_remote_device.Maciej Patelczyk2011-07-031-8/+7
| | | | | | | | | 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>
* isci: removing non-working ATAPI codeDave Jiang2011-07-031-38/+0
| | | | | | | | | 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>
* isci: remove scic_sds_remote_device_get_port_indexDan Williams2011-07-031-9/+1
| | | | | | Longer to type than the open-coded equivalent. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: remove usage of sci_sas_address in scic_sds_remote_deviceDan Williams2011-07-031-5/+0
| | | | | | | 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>
* isci: kill smp_discover_response_protocols in favor of domain_device.dev_typeDan Williams2011-07-031-22/+12
| | | | | | | | | | | | | | | 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-9/+733
| | | | | | | | 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-7/+2
| | | | | | | 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: fix fragile/conditional isci_host lookupsDan Williams2011-07-031-46/+16
| | | | | | | | | | | | | | 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: cleanup isci_remote_device[_not]_ready interfaceDan Williams2011-07-031-5/+4
| | | | | | | | | | 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>
* isci: preallocate remote devicesDan Williams2011-07-031-1/+1
| | | | | | | | | | | | | 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>
* isci: replace isci_remote_device completion with event queueDan Williams2011-07-031-5/+6
| | | | | | | | | | | | | | | | 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>
* isci: kill "host quiesce" mechanismDan Williams2011-07-031-22/+0
| | | | | | | | 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-1/+6
| | | | | | | 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: Removing deprecated functionsDave Jiang2011-07-031-1/+0
| | | | | | | | 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>
* isci: Intel(R) C600 Series Chipset Storage Control Unit DriverDan Williams2011-07-021-0/+154
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>
OpenPOWER on IntegriCloud