commit de2eb4d5c5c25e8fb75d1e19092f24b83cb7d8d5 Author: Jeff Skirvin Date: Tue Mar 13 17:15:11 2012 -0700 isci: End the RNC resumption wait when the RNC is destroyed. While the RNC is suspended for I/O cleanup, the remote device can be stopped and the RNC setup for destruction. These changes accomodate that case in the abort path. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 6c6aacbb7787dccc6fb662bae66e599bbf0f07b5 Author: Jeff Skirvin Date: Tue Mar 13 17:03:00 2012 -0700 isci: Fixed RNC bug that lost the suspension or resumption during destroy This fix corrects the saving of resume parameters when the destruction of the RNC has already been directed, and makes sure not to overwrite the RNC destruction callbacks. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 79cbab89ff31b6c6ab896d4ed5e3b2ae65193a96 Author: Jeff Skirvin Date: Tue Mar 13 16:36:35 2012 -0700 isci: Fix RNC AWAIT_SUSPENSION->INVALIDATING transition. The RNC state machine would incorrectly transition from SCI_RNC_AWAIT_SUSPENSION directly to SCI_RNC_INVALIDATING when a destruct request was made. This would skip the increment of the suspension count and the abort of pending TCs (although the invalidating state would at least cleanup outstanding TCs). Instead, the RNC will transition to SCI_RNC_SUSPENDED and then start the destruction process. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 3ef768c6c0caa83b9fe66f19a18898ed0315ac36 Author: Jeff Skirvin Date: Mon Mar 12 17:29:51 2012 -0700 isci: Manage the IREQ_NO_AUTO_FREE_TAG under scic_lock. Since there is a possibilty of a timeout waiting for the RNC suspension, handle the exit case from the task termination under scic_lock, and leave the tag allocated if the termination timed-out. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit f8381807ebdfffa34c2c5aa38eda33673d1a7adf Author: Jeff Skirvin Date: Sun Mar 4 12:44:53 2012 +0000 isci: Remove obviated host callback list. Since the callbacks to libsas now occur under scic_lock, there is no longer any reason to save the completed requests in a separate list for completion to libsas. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 397497dd61948b0d59d1d21812b93c97b0eeb2dd Author: Jeff Skirvin Date: Sat Mar 10 05:46:46 2012 +0000 isci: Check IDEV_GONE before performing abort path operations. In the link fail path, set IDEV_GONE for every device on the domain when the last link in the port fails. In the abort path functions like isci_reset_device, make sure that there has not already been a detected domain failure with the device by checking IDEV_GONE, before performing any kind of hard reset, SMP phy control, or TMF operation. The check for IDEV_GONE makes sure that the device in the abort path really has control of the port with which it is associated. This prevents starting hard resets at incorrect times and scheduling unnecessary LUN resets for SATA devices. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 87805162b6af20d2ad386a49aec13b753cca523a Author: Jeff Skirvin Date: Thu Mar 8 22:42:09 2012 -0800 isci: Restore the ATAPI device RNC management code. The ATAPI specific and STP general RNC suspension code had been incorrectly removed from the remote device code. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 1f05388933cb6e57ed9e51768c194ff145002f3b Author: Jeff Skirvin Date: Thu Mar 8 22:42:08 2012 -0800 isci: Don't wait for an RNC suspend if it's being destroyed. Make sure that the wait for suspend can handle the RNC destruction case. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit c5457a82a404db3c447df22e6425c5c140c4bee1 Author: Jeff Skirvin Date: Thu Mar 8 22:42:07 2012 -0800 isci: Change the phy control and link reset interface for HW reasons. There is an apparent HW lockup caused when the PE is disabled while there is an outstanding TC in progress. This change puts the link into OOB to force the TC to end before the PE is disabled. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 8c731888bf1be8d15d587ab1b4da80553302e653 Author: Jeff Skirvin Date: Thu Mar 8 22:42:06 2012 -0800 isci: Added timeouts to RNC suspensions in the abort path. This change adds timeouts to the RNC suspension wait. It makes the suspend and resume timeouts the same. The previous resume timeout of 5 ms was too short, and timeouts were seen in resumptions of devices in the abort task/LUN reset path - which would receive an RNC resumed message within a tenth of a second later. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 28de92bef0fb0c3953aa73d31a961422ef900e6a Author: Jeff Skirvin Date: Thu Mar 8 22:42:06 2012 -0800 isci: Add protocol indicator for TMF requests. Requests contructed as task management requests need to have the protocol indicator set so the completion decode can observe any RNC suspension conditions. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 1db79b3e784bffe7e00f9462a5c3441746e48632 Author: Jeff Skirvin Date: Thu Mar 8 22:42:05 2012 -0800 isci: Directly control IREQ_ABORT_PATH_ACTIVE when completing TMFs. TMF requests, unlike normal I/O requests, need to handle I/O management conditions in the completion function because TMFs are not handled in the completion tasklet. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 0cce165e2814bc8c08ab229db5e17013971dced7 Author: Jeff Skirvin Date: Thu Mar 8 22:42:04 2012 -0800 isci: Wait for RNC resumption before leaving the abort path. In the case of TMF execution, or device resets, wait for the RNC to fully resume before returning to the caller. This ensures that the remote device will not fail I/O requests while waiting for the RNC resumption to complete. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit d76689e46c8b2180c08575adc830cfda890ceb87 Author: Jeff Skirvin Date: Thu Mar 8 22:42:04 2012 -0800 isci: Fix RNC suspend call for SCI_RESUMING state. Instead of immediately transitioning to the SCI_RNC_AWAIT_SUSPENSION state, handle the SCI_RNC_RESUMING suspend transition from the SCI_RNC_READY state like the SCI_RNC_INVALIDATING --> SCI_RNC_POSTING transitions do now, by setting the destination state for the entry into the READY state. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 621120ca56850249554996c94efe75f8200a2cc0 Author: Jeff Skirvin Date: Thu Mar 8 22:42:03 2012 -0800 isci: Manage tag releases differently when aborting tasks. When an individual request is being terminated, the request's tag is managed in the terminate function. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 033d19d298b4245da2d3d6c795ea97e419f9ac61 Author: Jeff Skirvin Date: Thu Mar 8 22:42:03 2012 -0800 isci: Callbacks to libsas occur under scic_lock and are synchronized. This patch changes the callback mechanism to libsas to only occur while the scic_lock is held; the abort path cleanup of I/Os also checks to make sure IREQ_ABORT_PATH_ACTIVE is clear before proceding. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 0c3ce38f1bc8b6a6d8df0959e3c0dece31f9350c Author: Jeff Skirvin Date: Thu Mar 8 22:42:02 2012 -0800 isci: When in the abort path, defeat other resume calls until done. Completion of I/Os during the one of the abort path interface calls from libsas can drive remote device state changes and the resumption of the device RNC. This is a problem when the abort path is attempting to cleanup outstanding I/O at the same time - the resumption can prevent the termination from occuring correctly. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 31a38ef0a5ad12dbe262ca55d0a905657be55a8d Author: Jeff Skirvin Date: Thu Mar 8 22:42:01 2012 -0800 isci: Implement waiting for suspend in the abort path. In order to prevent a device from receiving an I/O request while still in an RNC suspending or resuming state (and therefore failing that I/O back to libsas with a reset required status) wait for the RNC state change before proceding in the abort path. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 08c031e4e3294a66a64074e12482abda846dd39c Author: Jeff Skirvin Date: Thu Mar 8 22:42:00 2012 -0800 isci: Make sure all TCs are terminated and cleaned in LUN reset. In the libsas error path, SATA disks require extra handling in libata to recover operation. However, libsas expects to be able to immediately recover all outstanding I/O once the error handler escalation stops. This patch fixes the condition where the libata error handler is scheduled for operation but libsas has already deleted the outstanding sas_tasks. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 9608b6408e637abeec101abb6aebd3343f0ebac4 Author: Jeff Skirvin Date: Thu Mar 8 22:42:00 2012 -0800 isci: Manage the LLHANG timer enable/disable per-device. The LLHANG timer should be enabled once per device. This patch corrects both the timer enable and the timer disable for the remote device. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 447bfbcee070a0b43dd6abc743063d7a02fe65ca Author: Jeff Skirvin Date: Thu Mar 8 22:41:59 2012 -0800 isci: Save the suspension hint for upcoming suspensions. In the case of a suspend call while in SCI_RNC_POSTING or INVALIDATING states, the LLHANG detect needed to be saved so the upcoming suspension would enable it correctly. The unused suspend callback parameters were removed. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit e3c84dfdb8f4c675b0ba5cf3fa252dc4056b7ddd Author: Jeff Skirvin Date: Thu Mar 8 22:41:58 2012 -0800 isci: Fix the terminated I/O to not call sas_task_abort(). This addresses a regression from the commit "isci: Redesign device suspension, abort, cleanup." in which the sas_task end condition for terminated I/Os was made to call back on sas_task_abort()". This commit will be rolled into the original. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit c94fc1ad25de885e1c59f714f19bc726e7a21caf Author: Jeff Skirvin Date: Thu Mar 8 22:41:58 2012 -0800 isci: Distinguish between remote device suspension cases For NCQ error conditions among others, there is no need to enable the link layer hang detect timer. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit d6b2a0e4a066ea51322e16e66b25028cb0b4ca7e Author: Jeff Skirvin Date: Thu Mar 8 22:41:57 2012 -0800 isci: Remove isci_device reqs_in_process and dev_node from isci_device. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 033751f6643adf616b85ac5eea7ce784bdde1b50 Author: Jeff Skirvin Date: Thu Mar 8 22:41:56 2012 -0800 isci: Only set IDEV_GONE in the device stop path. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit aa20d9343079b1f0bebd43dec82ecfd4af5e43da Author: Jeff Skirvin Date: Thu Mar 8 22:41:56 2012 -0800 isci: All pending TCs are terminated when the RNC is invalidated. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 637325028f3a9e9cf411ede96063997611f976e4 Author: Jeff Skirvin Date: Thu Mar 8 22:41:55 2012 -0800 isci: Device access in the error path does not depend on IDEV_GONE. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 59e35396436c564b5019e1a70073900bc3e19f4f Author: Jeff Skirvin Date: Thu Mar 8 22:41:54 2012 -0800 isci: Add suspension cases for RNC INVALIDATING, POSTING states. The RNC can be any of the states in the loop from suspended to ready when the API "suspend" or "resume" are called. This change adds destination states parameters that control the suspension / resumption action of the RNC statemachine for those transition states. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 14aaa9f0a318bd04cbb9d822524b817e95d8b343 Author: Jeff Skirvin Date: Thu Mar 8 22:41:54 2012 -0800 isci: Redesign device suspension, abort, cleanup. This commit changes the means by which outstanding I/Os are handled for cleanup. The likelihood is that this commit will be broken into smaller pieces, however that will be a later revision. Among the changes: - All completion structures have been removed from the tmf and abort paths. - Now using one completed I/O list, with the I/O completed in host bit being used to select error or normal callback paths. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit d80ecd5726ce49b5da457d562804b40f0183e8f7 Author: Jeff Skirvin Date: Thu Mar 8 22:41:53 2012 -0800 isci: Escalate to I_T_Nexus_Reset when the device is gone. If LUN reset sees that the device is gone, it returns TMF_RESP_FUNC_FAILED to cause libsas to escalate to an I_T_Nexus_Reset. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 83884014eaaa68834ced39d1c75f1bc20d618ec0 Author: Jeff Skirvin Date: Thu Mar 8 22:41:52 2012 -0800 isci: Remote device stop also suspends the RNC and terminates I/O. Fixing the remote device state machine to suspend and terminate all outstanding I/O before the device stopped state is reached. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 23ec2aa947e83d0a172220f361166b8224875221 Author: Jeff Skirvin Date: Thu Mar 8 22:41:52 2012 -0800 isci: Remote device must be suspended for NCQ cleanup. When the remote device enters the NCQ error state, the device must be suspended so that the I/O terminations can take place. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 5b6bf225e7fc249c703e19bf2c983d1a59178874 Author: Jeff Skirvin Date: Thu Mar 8 22:41:51 2012 -0800 isci: Manage device suspensions during TC terminations. TCs must be terminated only while the RNC is suspended. This commit adds remote device suspensions and resumptions in the abort, reset and termination paths. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 726980d56908f2e230624394f03743689db3110c Author: Jeff Skirvin Date: Thu Mar 8 22:41:50 2012 -0800 isci: Terminate outstanding TCs on TX/RX RNC suspensions. TCs must only be terminated when RNCs are suspended. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit ac78ed0f78eae5c3c918e132b5e2029cdc4fdedc Author: Jeff Skirvin Date: Thu Mar 8 22:41:50 2012 -0800 isci: Handle all suspending TC completions Add comprehensive decode for all TC completions that generate RNC suspensions. Note that this commit also removes unconditional resumptions of ATAPI devices when in the SCI_STP_DEV_ATAPI_ERROR state, and STP devices when in the SCI_STP_DEV_IDLE state. This is because the SCI_STP_DEV_IDLE and SCI_STP_DEV_ATAPI state entry functions manage the RNC resumption. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 56d7c013e714c6feab2ab5ac854808e29048b069 Author: Jeff Skirvin Date: Thu Mar 8 22:41:49 2012 -0800 isci: Fixed bug in resumption from RNC Tx/Rx suspend state. The resumption from the Tx/Rx suspended state should work the same as the Tx suspended state. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit 6f48844e3f16b7d8a1f9a1a11bd9a11089a5292f Author: Jeff Skirvin Date: Thu Mar 8 22:41:48 2012 -0800 isci: Manage the link layer hang detect timer for RNC suspensions. For STP devices under certain protocol conditions, an RNC will not suspend until the current transfer state is broken with a SYNC/ESC sequence from the SCU. The SYNC/ESC driven by expiration of the SCU link layer hang detect timer, which has too small a dynamic range to support slow SATA devices, so normally it is disabled. This change enables the timer with the minimum period at the point when the suspension is requested. Note that there is potential collateral damage to other open connections to slow SATA devices on the same port, since there is no alternative but to enable the LLHANG timer on every phy in the port for the current suspension request - there is no way to tell on which phy the RNC in question is currently active. Signed-off-by: Jeff Skirvin Signed-off-by: Dan Williams commit fc25f79af321c01a739150ba2c09435cf977a63d Author: Dan Williams Date: Mon Apr 30 11:57:44 2012 -0700 isci: fix oem parameter validation on single controller skus OEM parameters [1] are parsed from the platform option-rom / efi driver. By default the driver was validating the parameters for the dual-controller case, but in single-controller case only the first set of parameters may be valid. Limit the validation to the number of actual controllers detected otherwise the driver may fail to parse the valid parameters leading to driver-load or runtime failures. [1] the platform specific set of phy address, configuration,and analog tuning values [stable v3.0+] Cc: Reported-by: Dave Jiang Tested-by: Dave Jiang Signed-off-by: Dan Williams commit 08e73be56b6b2e5459638481a54b755ed562ada8 Author: Maciej Trela Date: Mon Mar 12 23:29:30 2012 +0000 isci: enable BCN in sci_port_add_phy() Ensure we enable receiving BCN's from the hardware when adding phy to isci_port. Otherwise if we get BCN before the port is created we won't see any BCN Signed-off-by: Maciej Trela Reported-by: Richard Boyd Signed-off-by: Dan Williams commit 6119908f0fe3737bba2f64eff70599c3e41d522e Author: Andrzej Jakowski Date: Thu Mar 8 19:38:50 2012 +0000 isci: Changes in COMSAS timings enabling ISCI to detect buggy disc drives. This patch extends timings in COMSAS signaling, so ISCI can detect disc drives having issues to send COMSAS in correct time frame. Signed-off-by: Andrzej Jakowski Signed-off-by: Dan Williams commit d1dc5e2d21a55538167d7ce82aa147c91c5e6788 Author: Dan Williams Date: Sat Feb 25 14:29:49 2012 -0800 isci: kill isci_host.shost We can retrieve the shost from the sas_ha like the rest of libsas and drop this out of our local data structure. Acked-by: Jacek Danecki Signed-off-by: Dan Williams commit 2396a2650a5a39634e3ad6b29e1104944e5ab88f Author: Dan Williams Date: Thu Mar 1 17:06:24 2012 -0800 isci: fix interrupt disable There is a (dubious?) lost irq workaround in sci_controller_isr() that effectively nullifies attempts to disable interrupts. Until the workaround can be re-evaluated add some infrastructure to prevent the interrupt handler from inadvertantly re-enabling interrupts. The failure mode was interrupts continuing to run after the driver had been removed and its iomappings torn down. Reported-by: Jacek Danecki Tested-by: Jacek Danecki [richard: clear remaining interrupts at the end of reset] Acked-by: Richard Boyd Signed-off-by: Dan Williams commit 50a92d93148ec073efd2456b007e04ecae452086 Author: Dan Williams Date: Wed Feb 29 01:07:56 2012 -0800 isci: fix 'link-up' events occur after 'start-complete' The call to wait_for_start() is meant to ensure that all links have been given a chance to come up before letting the kernel proceed with probing. However, the implementation is not correctly syncing with the port configuration agent. In the MPC case the ports are hard-coded, in the APC case we need to wait for the port-configuration to form ports from the started phys. Towards that end increase the timeout for the APC agent to form ports, and delay start complete until all phys are out of link-training. Cc: Cc: Richard Boyd Signed-off-by: Dan Williams commit eb608c3cb3f0a6b99252ea6a69fc0d2bbecf1f4f Author: Dan Williams Date: Thu Feb 23 01:12:10 2012 -0800 isci: fix controller stop 1/ notify waiters when controller stop completes (fixes 10 second stall unloading the driver) 2/ make sure phy stop is after port and device stop Cc: Richard Boyd Signed-off-by: Dan Williams commit abec912d71c44bbd642ce12ad98aab76f5a53163 Author: Dan Williams Date: Wed Feb 15 13:58:42 2012 -0800 isci: refactor initialization for S3/S4 Based on an original implementation by Ed Nadolski and Artur Wojcik In preparation for S3/S4 support refactor initialization so that driver-load and resume-from-suspend can share the common init path of isci_host_init(). Organize the initialization into objects that are self-contained to the driver (initialized by isci_host_init) versus those that have some upward registration (initialized at allocation time asd_sas_phy, asd_sas_port, dma allocations). The largest change is moving the the validation of the oem and module parameters from isci_host_init() to isci_host_alloc(). The S3/S4 approach being taken is that libsas will be tasked with remembering the state of the domain and the lldd is free to be forgetful. In the case of isci we'll just re-init using a subset of the normal driver load path. [clean up some unused / mis-indented function definitions in host.h] Signed-off-by: Ed Nadolski Signed-off-by: Artur Wojcik Signed-off-by: Dan Williams commit ae904d15cf344bcb426f63982016f6bacc45825b Author: Dan Williams Date: Fri Feb 17 16:30:47 2012 -0800 isci: kill isci_port.domain_dev_list Another unused field, and isci_port_init is overkill. Signed-off-by: Dan Williams commit 1844e4789fe5c97a9ff3bb82628111abbe7cc846 Author: Dan Williams Date: Wed Feb 15 13:20:31 2012 -0800 isci: kill ->status, and ->state_lock in isci_host They serve no incremental purpose over the existing sas_ha state. Signed-off-by: Dan Williams commit 944b787d0a469a376f4d6699eb01138823197513 Author: Tom Jackson Date: Fri Feb 24 09:38:49 2012 +0000 isci: Don't filter BROADCAST CHANGE primitives Per the SAS spec, several types of BROADCAST CHANGE primitives must cause re-discovery of the originating expander. Only the standard BROADCAST CHANGE primitive was being sent to the LIBSAS layer. The other BC primitives have been added to the sci_phy_event_handler() Signed-off-by: Tom Jackson Signed-off-by: Dan Williams commit c79dd80d73017a88a2c2ae46e7d5303cba6a32e0 Author: Dan Williams Date: Wed Feb 1 00:44:14 2012 -0800 isci: kill sci_phy_protocol and sci_request_protocol Holdovers from the initial driver cleanup, replace with enum sas_protocol. Signed-off-by: Dan Williams commit 11cc51835af0e6fbb2da9cb012bdaaa036497b7f Author: Dan Williams Date: Wed Feb 1 00:23:10 2012 -0800 isci: kill ->is_direct_attached domain_device ->parent conveys the same information. Occurrences of ->is_direct_attached appear next to incomplete open-coded versions of dev_is_sata(), clean those up as well. Signed-off-by: Dan Williams commit 14e99b4a3f5323bb961754de5024daff79e59b98 Author: Dan Williams Date: Fri Feb 10 01:05:43 2012 -0800 isci: improve 'invalid state' warnings Convert controller state machine warnings to emit the state number (it missed the number to string conversion, but since these error rarely happen not much motivation to go further). Fix up the rnc warnings to use the state name. Signed-off-by: Dan Williams