aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/port.c
Commit message (Collapse)AuthorAgeFilesLines
* isci: kill 'get/set' macrosDan Williams2011-07-031-2/+2
| | | | | | | | | 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-344/+207
| | | | | | | | | | | | | | 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-49/+40
| | | | | | | | | 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-2/+2
| | | | | | | | 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-317/+305
| | | | | | | | | | 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_phy and scic_sds_phyDan Williams2011-07-031-180/+119
| | | | | | | | | They are one in the same object so remove the distinction. The near duplicate fields (owning_port, and isci_port) will be cleaned up after the scic_sds_port isci_port 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-2/+2
| | | | | | | | | 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: unify can_queue tracking on the tci_pool, uplevel tag assignmentDan Williams2011-07-031-38/+23
| | | | | | | | | | | | | | | | | | | | | | The tci_pool tracks our outstanding command slots which are also the 'index' portion of our tags. Grabbing the tag early in ->lldd_execute_task let's us drop the isci_host_can_queue() and ->was_tag_assigned_by_user infrastructure. ->was_tag_assigned_by_user required the task context to be duplicated in request-local buffer. With the tci established early we can build the task_context directly into its final location and skip a memcpy. With the task context buffer at a known address at request construction we have the opportunity/obligation to also fix sgl handling. This rework feels like it belongs in another patch but the sgl handling and task_context are too intertwined. 1/ fix the 'ab' pair embedded in the task context to point to the 'cd' pair in the task context (previously we were prematurely linking to the staging buffer). 2/ fix the broken iteration of pio sgls that assumes all sgls are relative to the request, and does a dangerous looking reverse lookup of physical address to virtual address. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: atomic device lookup and reference countingDan Williams2011-07-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: cleanup tag macrosDan Williams2011-07-031-12/+5
| | | | | | | | | | | | | | A tag is a 16 bit number where the upper four bits is a sequence number and the remainder is the task context index (tci). Sanitize the macro names and shave 256-bytes out of scic_sds_controller by reducing the size of io_request_sequence. scic_sds_io_tag_construct --> ISCI_TAG scic_sds_io_tag_get_sequence --> ISCI_TAG_SEQ scic_sds_io_tag_get_index() --> ISCI_TAG_TCI scic_sds_io_sequence_increment() [delete / open code] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Hard reset failure will link reset all phys in the portJeff Skirvin2011-07-031-5/+17
| | | | | | | | In the case where the hard reset process fails, each link in the port is put through a link reset sequence. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: filter broadcast change notifications during SMP phy resetsJeff Skirvin2011-07-031-40/+75
| | | | | | | | | | | | | | | | | | | When resetting a sata device in the domain we have seen occasions where libsas prematurely marks a device gone in the time it takes for the device to re-establish the link. This plays badly with software raid arrays. Other libsas drivers have non-uniform delays in their reset handlers to try to cover this condition, but not sufficient to close the hole. Given that a sata device can take many seconds to recover we filter bcns and poll for the device reattach state before notifying libsas that the port needs the domain to be rediscovered. Once this has been proven out at the lldd level we can think about uplevelling this feature to a common implementation in libsas. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> [ use kzalloc instead of kmem_cache ] Signed-off-by: Dave Jiang <dave.jiang@intel.com> [ use eventq and time macros ] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: additional state machine cleanupEdmund Nadolski2011-07-031-5/+1
| | | | | | | | | | | | | | | | Additional state machine cleanups: o Remove static functions sci_state_machine_exit_state() and sci_state_machine_enter_state() o Combines sci_base_state_machine_construct() and sci_base_state_machine_start() into a single function, sci_init_sm() o Remove sci_base_state_machine_stop() which is unused. o Kill state_machine.[ch] Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> [fixed too large to inline functions] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: state machine cleanupEdmund Nadolski2011-07-031-93/+93
| | | | | | | | | | | | | | | | | | | | | | | 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: remove isci_timer interfaceEdmund Nadolski2011-07-031-1/+0
| | | | | | | Delete code which is no longer used. Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: replace isci_timer list with proper embedded timersEdmund Nadolski2011-07-031-21/+18
| | | | | | | | | | | | | | | Rather than preallocating a list of timers and doling them out at runtime, embed a struct timerlist in each object that needs one. A struct sci_timer interface is introduced to manage the timer cancellation semantics which currently need to guarantee the timer is cancelled while holding spin_lock(ihost->scic_lock). Since the timeout functions also need to acquire the lock it currently prevents the driver from using del_timer_sync() for runtime cancellations. del_timer_sync() is used however before the objects go out of scope. Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: add some type safety to the state machine interfaceDan Williams2011-07-031-23/+22
| | | | | | | | Now that any given object type only has one state_machine we can use container_of() to get back to the given state machine owner. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify port start_io and complete_io handlersDan Williams2011-07-031-375/+57
| | | | | | | Unify the handlers and kill the state handler infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify port link_up and link_down handlersPiotr Sawicki2011-07-031-169/+72
| | | | | | | | Unify the handlers and kill the state handler implementations. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: remove port frame and event handlersPiotr Sawicki2011-07-031-40/+0
| | | | | | | | Unused infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify port reset, add_phy, and remove_phy handlersPiotr Sawicki2011-07-031-308/+163
| | | | | | | | Unify the implementations and remove the state handlers. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: remove port destruct handlerPiotr Sawicki2011-07-031-34/+0
| | | | | | | The handler was never used. Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify port stop handlersPiotr Sawicki2011-07-031-53/+22
| | | | | | | | Implement the stop handlers directly in scic_sds_port_stop() Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: remove port start handlerPiotr Sawicki2011-07-031-103/+77
| | | | | | | | | remove the handler from the port state handler table and implement the logic directly in scic_sds_port_start(). Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> [remove a level of indirection] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: merge port ready substates into primary state machinePiotr Sawicki2011-07-031-220/+189
| | | | | | | | | | | | | This conversion was complicated by the fact that the ready state exit routine took unconditional action beyond just stopping the substate machine (like in previous conversions). In order to ensure identical behaviour every state transition needs to be instrumented to catch ready-->!ready transitions and execute scic_sds_port_invalidate_dummy_remote_node() Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> [fix ready state exit handling] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: c99 port state handlersPiotr Sawicki2011-07-031-121/+106
| | | | | | | Name the table fields for consistancy and clarity. Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: clarify phy to port lookupsDan Williams2011-07-031-2/+2
| | | | | | | | | While cleaning up the driver it is very tempting to convert scic_sds_get_* macros to their open coded equivalent. They are all just pointer dereferences *except* scic_sds_phy_get_port() which returns NULL if the phy is assigned to the dummy port. Clarify this by renaming it to phy_get_non_dummy_port(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: uplevel port infrastructureDan Williams2011-07-031-60/+2391
| | | | | | | | * Move port configuration agent implementation * Merge core/scic_sds_port.[ch] into port.[ch] Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: uplevel phy infrastructureDan Williams2011-07-031-2/+0
| | | | | | | Merge core/scic_sds_phy.[ch] into phy.[ch] Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: uplevel request infrastructureDan Williams2011-07-031-1/+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-8/+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 port data structuresDan Williams2011-07-031-28/+13
| | | | | | | | | Make scic_sds_port a member of isci_port and merge their lifetimes which means removing the port table from scic_sds_controller in favor of the one at the isci_host level. Merge ihost->sas_ports into ihost->ports. _ Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify phy data structuresDan Williams2011-07-031-30/+12
| | | | | | | | | Make scic_sds_phy a member of isci_phy and merge their lifetimes which means removing the phy table from scic_sds_controller in favor of the one at that isci_host level. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: kill scic_controller_get_port_handle functionEdmund Nadolski2011-07-031-24/+13
| | | | | | | | This function is just overkill and its usage is inconsistent. Replace with inlined code. Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: unify isci_host data structuresArtur Wojcik2011-07-031-27/+2
| | | | | | | | | 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: fixup SAS iaf protocols data structureDave Jiang2011-07-031-4/+2
| | | | | | | | | 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>
* isci: remove redundant copies of IAFDave Jiang2011-07-031-27/+0
| | | | | | | | | 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>
* isci: Convert SAS identify address frame to Linux Native formatDave Jiang2011-07-031-9/+3
| | | | | | | 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>
* isci: Convert SATA fis data structures to Linux nativeDave Jiang2011-07-031-5/+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_port.Maciej Patelczyk2011-07-031-3/+2
| | | | | | | | | 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>
* isci: Removed sci_base_object from scic_sds_phy.Maciej Patelczyk2011-07-031-4/+2
| | | | | | | | | 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>
* isci: Removed sci_base_object from scic_sds_controller.Maciej Patelczyk2011-07-031-2/+3
| | | | | | | | | 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>
* isci: move remote_device handling out of the coreDan Williams2011-07-031-1/+0
| | | | | | | | 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: audit usage of BUG_ON macro in isci driverBartosz Barcinski2011-07-031-0/+1
| | | | | | | | | | | 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: fix fragile/conditional isci_host lookupsDan Williams2011-07-031-44/+24
| | | | | | | | | | | | | | 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: namespacecheck cleanupsDan Williams2011-07-031-1/+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: Remove event_* calls as they are just wrappersDave Jiang2011-07-031-13/+38
| | | | | | | | 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>
* isci: replace remote_device_lock with scic_lockDan Williams2011-07-031-1/+0
| | | | | | | 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>
* isci: fix sas address reportingDan Williams2011-07-031-10/+7
| | | | | | | Undo the open coded and incorrect translation of the oem parameter sas address to its libsas expected format. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: advertise linkrateDan Williams2011-07-031-0/+2
| | | | | | | Inform libsas of the linkrate of direct attached links. Reported-by: Haavard Skinnemoen <hskinnemoen@gmail.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>