1f11c7f63SJim Harris /*-
2718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3718cf2ccSPedro F. Giffuni  *
4f11c7f63SJim Harris  * This file is provided under a dual BSD/GPLv2 license.  When using or
5f11c7f63SJim Harris  * redistributing this file, you may do so under either license.
6f11c7f63SJim Harris  *
7f11c7f63SJim Harris  * GPL LICENSE SUMMARY
8f11c7f63SJim Harris  *
9f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10f11c7f63SJim Harris  *
11f11c7f63SJim Harris  * This program is free software; you can redistribute it and/or modify
12f11c7f63SJim Harris  * it under the terms of version 2 of the GNU General Public License as
13f11c7f63SJim Harris  * published by the Free Software Foundation.
14f11c7f63SJim Harris  *
15f11c7f63SJim Harris  * This program is distributed in the hope that it will be useful, but
16f11c7f63SJim Harris  * WITHOUT ANY WARRANTY; without even the implied warranty of
17f11c7f63SJim Harris  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18f11c7f63SJim Harris  * General Public License for more details.
19f11c7f63SJim Harris  *
20f11c7f63SJim Harris  * You should have received a copy of the GNU General Public License
21f11c7f63SJim Harris  * along with this program; if not, write to the Free Software
22f11c7f63SJim Harris  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23f11c7f63SJim Harris  * The full GNU General Public License is included in this distribution
24f11c7f63SJim Harris  * in the file called LICENSE.GPL.
25f11c7f63SJim Harris  *
26f11c7f63SJim Harris  * BSD LICENSE
27f11c7f63SJim Harris  *
28f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29f11c7f63SJim Harris  * All rights reserved.
30f11c7f63SJim Harris  *
31f11c7f63SJim Harris  * Redistribution and use in source and binary forms, with or without
32f11c7f63SJim Harris  * modification, are permitted provided that the following conditions
33f11c7f63SJim Harris  * are met:
34f11c7f63SJim Harris  *
35f11c7f63SJim Harris  *   * Redistributions of source code must retain the above copyright
36f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer.
37f11c7f63SJim Harris  *   * Redistributions in binary form must reproduce the above copyright
38f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer in
39f11c7f63SJim Harris  *     the documentation and/or other materials provided with the
40f11c7f63SJim Harris  *     distribution.
41f11c7f63SJim Harris  *
42f11c7f63SJim Harris  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43f11c7f63SJim Harris  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44f11c7f63SJim Harris  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45f11c7f63SJim Harris  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46f11c7f63SJim Harris  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47f11c7f63SJim Harris  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48f11c7f63SJim Harris  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49f11c7f63SJim Harris  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50f11c7f63SJim Harris  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51f11c7f63SJim Harris  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52f11c7f63SJim Harris  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53f11c7f63SJim Harris  */
54f11c7f63SJim Harris 
55f11c7f63SJim Harris #include <sys/cdefs.h>
56f11c7f63SJim Harris /**
57f11c7f63SJim Harris  * @file
58f11c7f63SJim Harris  *
59f11c7f63SJim Harris  * @brief This file contains all of the method implementations pertaining
60f11c7f63SJim Harris  *        to the framework remote device state handler methods.
61f11c7f63SJim Harris  */
62f11c7f63SJim Harris 
63f11c7f63SJim Harris #include <dev/isci/scil/scic_remote_device.h>
64f11c7f63SJim Harris 
65f11c7f63SJim Harris #include <dev/isci/scil/scif_sas_logger.h>
66f11c7f63SJim Harris #include <dev/isci/scil/scif_sas_remote_device.h>
67f11c7f63SJim Harris #include <dev/isci/scil/scif_sas_domain.h>
68f11c7f63SJim Harris #include <dev/isci/scil/scif_sas_task_request.h>
69f11c7f63SJim Harris #include <dev/isci/scil/scif_sas_internal_io_request.h>
70f11c7f63SJim Harris 
71f11c7f63SJim Harris //******************************************************************************
72f11c7f63SJim Harris //* S T O P P E D   H A N D L E R S
73f11c7f63SJim Harris //******************************************************************************
74f11c7f63SJim Harris 
75f11c7f63SJim Harris /**
76f11c7f63SJim Harris  * @brief This method provides STOPPED state specific handling for
77f11c7f63SJim Harris  *        when the framework attempts to start the remote device.  This
78f11c7f63SJim Harris  *        method attempts to transition the state machine into the
79f11c7f63SJim Harris  *        STARTING state.  If this is unsuccessful, then there is a direct
80f11c7f63SJim Harris  *        transition into the FAILED state.
81f11c7f63SJim Harris  *
82f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
83f11c7f63SJim Harris  *             object for which the framework is attempting to start.
84f11c7f63SJim Harris  *
85f11c7f63SJim Harris  * @return This method returns an indication as to whether the start
86f11c7f63SJim Harris  *         operating began successfully.
87f11c7f63SJim Harris  */
88f11c7f63SJim Harris static
scif_sas_remote_device_stopped_start_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)89f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_stopped_start_handler(
90f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
91f11c7f63SJim Harris )
92f11c7f63SJim Harris {
93f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T *)
94f11c7f63SJim Harris                                           remote_device;
95f11c7f63SJim Harris 
96f11c7f63SJim Harris    sci_base_state_machine_change_state(
97f11c7f63SJim Harris       &fw_device->parent.state_machine, SCI_BASE_REMOTE_DEVICE_STATE_STARTING
98f11c7f63SJim Harris    );
99f11c7f63SJim Harris 
100f11c7f63SJim Harris    // Check to see if the state transition occurred without issue.
101f11c7f63SJim Harris    if (sci_base_state_machine_get_state(&fw_device->parent.state_machine)
102f11c7f63SJim Harris        == SCI_BASE_REMOTE_DEVICE_STATE_FAILED)
103f11c7f63SJim Harris    {
104f11c7f63SJim Harris       SCIF_LOG_WARNING((
105f11c7f63SJim Harris          sci_base_object_get_logger(fw_device),
106f11c7f63SJim Harris          SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_DOMAIN_DISCOVERY,
107f11c7f63SJim Harris          "Domain:0x%x Device:0x%x Status:0x%x failed to start\n",
108f11c7f63SJim Harris          fw_device->domain, fw_device, fw_device->operation_status
109f11c7f63SJim Harris       ));
110f11c7f63SJim Harris    }
111f11c7f63SJim Harris 
112f11c7f63SJim Harris    return fw_device->operation_status;
113f11c7f63SJim Harris }
114f11c7f63SJim Harris 
115f11c7f63SJim Harris /**
116f11c7f63SJim Harris  * @brief This method provides STOPPED state specific handling for
117f11c7f63SJim Harris  *        when the user attempts to destruct the remote device.
118f11c7f63SJim Harris  *
119f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
120f11c7f63SJim Harris  *             object for which the framework is attempting to start.
121f11c7f63SJim Harris  *
122f11c7f63SJim Harris  * @return This method returns an indication as to whether the destruct
123f11c7f63SJim Harris  *         operation completed successfully.
124f11c7f63SJim Harris  */
125f11c7f63SJim Harris static
scif_sas_remote_device_stopped_destruct_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)126f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_stopped_destruct_handler(
127f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
128f11c7f63SJim Harris )
129f11c7f63SJim Harris {
130f11c7f63SJim Harris    SCI_STATUS                 status;
131f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T *)
132f11c7f63SJim Harris                                           remote_device;
133f11c7f63SJim Harris 
134f11c7f63SJim Harris    SMP_DISCOVER_RESPONSE_PROTOCOLS_T  dev_protocols;
135f11c7f63SJim Harris    scic_remote_device_get_protocols(fw_device->core_object, &dev_protocols);
136f11c7f63SJim Harris 
137f11c7f63SJim Harris    //For smp device, need to clear its smp phy list first.
138f11c7f63SJim Harris    if(dev_protocols.u.bits.attached_smp_target)
139f11c7f63SJim Harris       scif_sas_smp_remote_device_removed(fw_device);
140f11c7f63SJim Harris 
141f11c7f63SJim Harris    status = scic_remote_device_destruct(fw_device->core_object);
142f11c7f63SJim Harris    if (status == SCI_SUCCESS)
143f11c7f63SJim Harris    {
144f11c7f63SJim Harris       sci_base_state_machine_change_state(
145f11c7f63SJim Harris          &fw_device->parent.state_machine, SCI_BASE_REMOTE_DEVICE_STATE_FINAL
146f11c7f63SJim Harris       );
147f11c7f63SJim Harris 
148f11c7f63SJim Harris       scif_sas_remote_device_deinitialize_state_logging(fw_device);
149f11c7f63SJim Harris    }
150f11c7f63SJim Harris    else
151f11c7f63SJim Harris    {
152f11c7f63SJim Harris       SCIF_LOG_ERROR((
153f11c7f63SJim Harris          sci_base_object_get_logger(fw_device),
154f11c7f63SJim Harris          SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_REMOTE_DEVICE_CONFIG,
155f11c7f63SJim Harris          "Device:0x%x Status:0x%x failed to destruct core device\n",
156f11c7f63SJim Harris          fw_device
157f11c7f63SJim Harris       ));
158f11c7f63SJim Harris    }
159f11c7f63SJim Harris 
160f11c7f63SJim Harris    return status;
161f11c7f63SJim Harris }
162f11c7f63SJim Harris 
163f11c7f63SJim Harris //******************************************************************************
164f11c7f63SJim Harris //* S T O P P I N G   H A N D L E R S
165f11c7f63SJim Harris //******************************************************************************
166f11c7f63SJim Harris 
167f11c7f63SJim Harris /**
168f11c7f63SJim Harris  * @brief This method provides STOPPING state specific handling for
169f11c7f63SJim Harris  *        when the core remote device object issues a stop completion
170f11c7f63SJim Harris  *        notification.
171f11c7f63SJim Harris  *
172f11c7f63SJim Harris  * @note There is no need to ensure all IO/Task requests are complete
173f11c7f63SJim Harris  *       before transitioning to the STOPPED state.  The SCI Core will
174f11c7f63SJim Harris  *       ensure this is accomplished.
175f11c7f63SJim Harris  *
176f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
177f11c7f63SJim Harris  *             object for which the completion occurred.
178f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the status
179f11c7f63SJim Harris  *             of the completion operation.
180f11c7f63SJim Harris  *
181f11c7f63SJim Harris  * @return none.
182f11c7f63SJim Harris  */
183f11c7f63SJim Harris static
scif_sas_remote_device_stopping_stop_complete_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device,SCI_STATUS completion_status)184f11c7f63SJim Harris void scif_sas_remote_device_stopping_stop_complete_handler(
185f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device,
186f11c7f63SJim Harris    SCI_STATUS                 completion_status
187f11c7f63SJim Harris )
188f11c7f63SJim Harris {
189f11c7f63SJim Harris    // Transition directly to the STOPPED state since the core ensures
190f11c7f63SJim Harris    // all IO/Tasks are complete.
191f11c7f63SJim Harris    sci_base_state_machine_change_state(
192f11c7f63SJim Harris       &fw_device->parent.state_machine,
193f11c7f63SJim Harris       SCI_BASE_REMOTE_DEVICE_STATE_STOPPED
194f11c7f63SJim Harris    );
195f11c7f63SJim Harris 
196f11c7f63SJim Harris    if (completion_status != SCI_SUCCESS)
197f11c7f63SJim Harris    {
198f11c7f63SJim Harris       SCIF_LOG_ERROR((
199f11c7f63SJim Harris          sci_base_object_get_logger(fw_device),
200f11c7f63SJim Harris          SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_REMOTE_DEVICE_CONFIG,
201f11c7f63SJim Harris          "Device:0x%x Status:0x%x failed to stop core device\n",
202f11c7f63SJim Harris          fw_device, completion_status
203f11c7f63SJim Harris       ));
204f11c7f63SJim Harris 
205f11c7f63SJim Harris       // Something is seriously wrong.  Stopping the core remote device
206f11c7f63SJim Harris       // shouldn't fail in anyway.
207f11c7f63SJim Harris       scif_cb_controller_error(fw_device->domain->controller,
208f11c7f63SJim Harris               SCI_CONTROLLER_REMOTE_DEVICE_ERROR);
209f11c7f63SJim Harris    }
210f11c7f63SJim Harris }
211f11c7f63SJim Harris 
212f11c7f63SJim Harris /**
213f11c7f63SJim Harris  * @brief This method provides STOPPING state handling for high priority
214f11c7f63SJim Harris  *        IO requests, when the framework attempts to complete a high
215f11c7f63SJim Harris  *        priority request.
216f11c7f63SJim Harris  *
217f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
218f11c7f63SJim Harris  *             object for which to complete the high priority IO.
219f11c7f63SJim Harris  * @param[in]  io_request This parameter specifies the IO request to be
220f11c7f63SJim Harris  *             completed.
221f11c7f63SJim Harris  * @param[in]  response_data This parameter is ignored, since the device
222f11c7f63SJim Harris  *             is in the stopping state.
223f11c7f63SJim Harris  *
224f11c7f63SJim Harris  * @return This method always returns success.
225f11c7f63SJim Harris  */
226f11c7f63SJim Harris static
scif_sas_remote_device_stopping_complete_high_priority_io_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * io_request,void * response_data,SCI_IO_STATUS completion_status)227f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_stopping_complete_high_priority_io_handler(
228f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
229f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * io_request,
230f11c7f63SJim Harris    void                     * response_data,
231f11c7f63SJim Harris    SCI_IO_STATUS              completion_status
232f11c7f63SJim Harris )
233f11c7f63SJim Harris {
234f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T *)
235f11c7f63SJim Harris                                           remote_device;
236f11c7f63SJim Harris    SCIF_SAS_REQUEST_T       * fw_request = (SCIF_SAS_REQUEST_T *) io_request;
237f11c7f63SJim Harris 
238f11c7f63SJim Harris    SCIF_LOG_TRACE((
239f11c7f63SJim Harris       sci_base_object_get_logger(remote_device),
240f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_IO_REQUEST,
241f11c7f63SJim Harris       "scif_sas_remote_device_stopping_complete_high_priority_io_handler(0x%x,0x%x,0x%x) enter\n",
242f11c7f63SJim Harris       remote_device, io_request, response_data
243f11c7f63SJim Harris    ));
244f11c7f63SJim Harris 
245f11c7f63SJim Harris    fw_device->request_count--;
246f11c7f63SJim Harris 
247f11c7f63SJim Harris    if (fw_request->is_internal == TRUE)
248f11c7f63SJim Harris    {
249f11c7f63SJim Harris       scif_sas_internal_io_request_complete(
250f11c7f63SJim Harris          fw_device->domain->controller,
251f11c7f63SJim Harris          (SCIF_SAS_INTERNAL_IO_REQUEST_T *) io_request,
252f11c7f63SJim Harris          SCI_SUCCESS
253f11c7f63SJim Harris       );
254f11c7f63SJim Harris    }
255f11c7f63SJim Harris 
256f11c7f63SJim Harris    return SCI_SUCCESS;
257f11c7f63SJim Harris }
258f11c7f63SJim Harris 
259f11c7f63SJim Harris //******************************************************************************
260f11c7f63SJim Harris //* F A I L E D   H A N D L E R S
261f11c7f63SJim Harris //******************************************************************************
262f11c7f63SJim Harris 
263f11c7f63SJim Harris /**
264f11c7f63SJim Harris  * @brief This method provides FAILED state specific handling for
265f11c7f63SJim Harris  *        when the remote device is being stopped by the framework.
266f11c7f63SJim Harris  *
267f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
268f11c7f63SJim Harris  *             object for which the stop operation is being requested.
269f11c7f63SJim Harris  *
270f11c7f63SJim Harris  * @return This method returns an indication as to whether the failure
271f11c7f63SJim Harris  *         operation completed successfully.
272f11c7f63SJim Harris  */
273f11c7f63SJim Harris static
scif_sas_remote_device_failed_stop_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)274f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_failed_stop_handler(
275f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
276f11c7f63SJim Harris )
277f11c7f63SJim Harris {
278f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T *)
279f11c7f63SJim Harris                                           remote_device;
280f11c7f63SJim Harris 
281f11c7f63SJim Harris    SCIF_LOG_WARNING((
282f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
283f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
284f11c7f63SJim Harris       "RemoteDevice:0x%x stopping failed device\n",
285f11c7f63SJim Harris       fw_device
286f11c7f63SJim Harris    ));
287f11c7f63SJim Harris 
288f11c7f63SJim Harris    sci_base_state_machine_change_state(
289f11c7f63SJim Harris       &fw_device->parent.state_machine, SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
290f11c7f63SJim Harris    );
291f11c7f63SJim Harris 
292f11c7f63SJim Harris    /// @todo Fix the return code handling.
293f11c7f63SJim Harris    return SCI_FAILURE;
294f11c7f63SJim Harris }
295f11c7f63SJim Harris 
296f11c7f63SJim Harris //******************************************************************************
297f11c7f63SJim Harris //* D E F A U L T   H A N D L E R S
298f11c7f63SJim Harris //******************************************************************************
299f11c7f63SJim Harris 
300f11c7f63SJim Harris /**
301f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
302f11c7f63SJim Harris  *        when a user attempts to start a remote device and a start operation
303f11c7f63SJim Harris  *        is not allowed.
304f11c7f63SJim Harris  *
305f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
306f11c7f63SJim Harris  *             on which the user is attempting to perform a start operation.
307f11c7f63SJim Harris  *
308f11c7f63SJim Harris  * @return This method returns an indication that start operations are not
309f11c7f63SJim Harris  *         allowed.
310f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
311f11c7f63SJim Harris  */
scif_sas_remote_device_default_start_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)312f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_start_handler(
313f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
314f11c7f63SJim Harris )
315f11c7f63SJim Harris {
316f11c7f63SJim Harris    SCIF_LOG_WARNING((
317f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
318f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_REMOTE_DEVICE_CONFIG,
319f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to start\n",
320f11c7f63SJim Harris       remote_device,
321f11c7f63SJim Harris       sci_base_state_machine_get_state(
322f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
323f11c7f63SJim Harris    ));
324f11c7f63SJim Harris 
325f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
326f11c7f63SJim Harris }
327f11c7f63SJim Harris 
328f11c7f63SJim Harris /**
329f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
330f11c7f63SJim Harris  *        when a user attempts to stop a remote device and a stop operation
331f11c7f63SJim Harris  *        is not allowed.
332f11c7f63SJim Harris  *
333f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
334f11c7f63SJim Harris  *             on which the user is attempting to perform a stop operation.
335f11c7f63SJim Harris  *
336f11c7f63SJim Harris  * @return This method returns an indication that stop operations are not
337f11c7f63SJim Harris  *         allowed.
338f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
339f11c7f63SJim Harris  */
scif_sas_remote_device_default_stop_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)340f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_stop_handler(
341f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
342f11c7f63SJim Harris )
343f11c7f63SJim Harris {
344f11c7f63SJim Harris    SCIF_LOG_WARNING((
345f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
346f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
347f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to stop\n",
348f11c7f63SJim Harris       remote_device,
349f11c7f63SJim Harris       sci_base_state_machine_get_state(
350f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
351f11c7f63SJim Harris    ));
352f11c7f63SJim Harris 
353f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
354f11c7f63SJim Harris }
355f11c7f63SJim Harris 
356f11c7f63SJim Harris /**
357f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
358f11c7f63SJim Harris  *        when there is an attempt to fail a remote device from an invalid
359f11c7f63SJim Harris  *        state.
360f11c7f63SJim Harris  *
361f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
362f11c7f63SJim Harris  *             object on which there is an attempt to fail the device.
363f11c7f63SJim Harris  *
364f11c7f63SJim Harris  * @return This method returns an indication that the fail transition is not
365f11c7f63SJim Harris  *         allowed.
366f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
367f11c7f63SJim Harris  */
368f11c7f63SJim Harris static
scif_sas_remote_device_default_fail_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)369f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_fail_handler(
370f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
371f11c7f63SJim Harris )
372f11c7f63SJim Harris {
373f11c7f63SJim Harris    SCIF_LOG_WARNING((
374f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
375f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
376f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to fail device\n",
377f11c7f63SJim Harris       remote_device,
378f11c7f63SJim Harris       sci_base_state_machine_get_state(
379f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
380f11c7f63SJim Harris    ));
381f11c7f63SJim Harris 
382f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
383f11c7f63SJim Harris }
384f11c7f63SJim Harris 
385f11c7f63SJim Harris /**
386f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
387f11c7f63SJim Harris  *        when there is an attempt to destruct a remote device from an
388f11c7f63SJim Harris  *        invalid state.
389f11c7f63SJim Harris  *
390f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
391f11c7f63SJim Harris  *             object on which there is an attempt to fail the device.
392f11c7f63SJim Harris  *
393f11c7f63SJim Harris  * @return This method returns an indication that the fail transition is not
394f11c7f63SJim Harris  *         allowed.
395f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
396f11c7f63SJim Harris  */
scif_sas_remote_device_default_destruct_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)397f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_destruct_handler(
398f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
399f11c7f63SJim Harris )
400f11c7f63SJim Harris {
401f11c7f63SJim Harris    SCIF_LOG_WARNING((
402f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
403f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
404f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to destruct.\n",
405f11c7f63SJim Harris       remote_device,
406f11c7f63SJim Harris       sci_base_state_machine_get_state(
407f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
408f11c7f63SJim Harris    ));
409f11c7f63SJim Harris 
410f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
411f11c7f63SJim Harris }
412f11c7f63SJim Harris 
413f11c7f63SJim Harris /**
414f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
415f11c7f63SJim Harris  *        when there is an attempt to reset a remote device from an invalid
416f11c7f63SJim Harris  *        state.
417f11c7f63SJim Harris  *
418f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
419f11c7f63SJim Harris  *             object on which there is an attempt to fail the device.
420f11c7f63SJim Harris  *
421f11c7f63SJim Harris  * @return This method returns an indication that the fail transition is not
422f11c7f63SJim Harris  *         allowed.
423f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
424f11c7f63SJim Harris  */
scif_sas_remote_device_default_reset_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)425f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_reset_handler(
426f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
427f11c7f63SJim Harris )
428f11c7f63SJim Harris {
429f11c7f63SJim Harris    SCIF_LOG_WARNING((
430f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
431f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
432f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to reset.\n",
433f11c7f63SJim Harris       remote_device,
434f11c7f63SJim Harris       sci_base_state_machine_get_state(
435f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
436f11c7f63SJim Harris    ));
437f11c7f63SJim Harris 
438f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
439f11c7f63SJim Harris }
440f11c7f63SJim Harris 
441f11c7f63SJim Harris /**
442f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
443f11c7f63SJim Harris  *        when there is an attempt to complete a reset to the remote device
444f11c7f63SJim Harris  *        from an invalid state.
445f11c7f63SJim Harris  *
446f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
447f11c7f63SJim Harris  *             object on which there is an attempt to fail the device.
448f11c7f63SJim Harris  *
449f11c7f63SJim Harris  * @return This method returns an indication that the fail transition is not
450f11c7f63SJim Harris  *         allowed.
451f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
452f11c7f63SJim Harris  */
scif_sas_remote_device_default_reset_complete_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)453f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_reset_complete_handler(
454f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
455f11c7f63SJim Harris )
456f11c7f63SJim Harris {
457f11c7f63SJim Harris    SCIF_LOG_WARNING((
458f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
459f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
460f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to complete reset.\n",
461f11c7f63SJim Harris       remote_device,
462f11c7f63SJim Harris       sci_base_state_machine_get_state(
463f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
464f11c7f63SJim Harris    ));
465f11c7f63SJim Harris 
466f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
467f11c7f63SJim Harris }
468f11c7f63SJim Harris 
469f11c7f63SJim Harris /**
470f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
471f11c7f63SJim Harris  *        when a user attempts to start an IO on a remote device and a start
472f11c7f63SJim Harris  *        IO operation is not allowed.
473f11c7f63SJim Harris  *
474f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
475f11c7f63SJim Harris  *             object on which the user is attempting to perform a start IO
476f11c7f63SJim Harris  *             operation.
477f11c7f63SJim Harris  * @param[in]  io_request This parameter specifies the IO request to be
478f11c7f63SJim Harris  *             started.
479f11c7f63SJim Harris  *
480f11c7f63SJim Harris  * @return This method returns an indication that start IO operations
481f11c7f63SJim Harris  *         are not allowed.
482f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
483f11c7f63SJim Harris  */
scif_sas_remote_device_default_start_io_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * io_request)484f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_start_io_handler(
485f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
486f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * io_request
487f11c7f63SJim Harris )
488f11c7f63SJim Harris {
489f11c7f63SJim Harris    SCIF_LOG_WARNING((
490f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
491f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
492f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to start IO.\n",
493f11c7f63SJim Harris       remote_device,
494f11c7f63SJim Harris       sci_base_state_machine_get_state(
495f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
496f11c7f63SJim Harris    ));
497f11c7f63SJim Harris 
498f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
499f11c7f63SJim Harris }
500f11c7f63SJim Harris 
501f11c7f63SJim Harris /**
502f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
503f11c7f63SJim Harris  *        when a user attempts to complete an IO on a remote device and a
504f11c7f63SJim Harris  *        complete IO operation is not allowed.
505f11c7f63SJim Harris  *
506f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
507f11c7f63SJim Harris  *             object on which the user is attempting to perform a complete
508f11c7f63SJim Harris  *             IO operation.
509f11c7f63SJim Harris  * @param[in]  io_request This parameter specifies the IO request to be
510f11c7f63SJim Harris  *             completed.
511f11c7f63SJim Harris  *
512f11c7f63SJim Harris  * @return This method returns an indication that complete IO operations
513f11c7f63SJim Harris  *         are not allowed.
514f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
515f11c7f63SJim Harris  */
scif_sas_remote_device_default_complete_io_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * io_request)516f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_complete_io_handler(
517f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
518f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * io_request
519f11c7f63SJim Harris )
520f11c7f63SJim Harris {
521f11c7f63SJim Harris    SCIF_LOG_WARNING((
522f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
523f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
524f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to complete IO\n",
525f11c7f63SJim Harris       remote_device,
526f11c7f63SJim Harris       sci_base_state_machine_get_state(
527f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
528f11c7f63SJim Harris    ));
529f11c7f63SJim Harris 
530f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
531f11c7f63SJim Harris }
532f11c7f63SJim Harris 
533f11c7f63SJim Harris 
534f11c7f63SJim Harris /**
535f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
536f11c7f63SJim Harris  *        when a user attempts to complete an IO on a remote device and a
537f11c7f63SJim Harris  *        complete IO operation is not allowed.
538f11c7f63SJim Harris  *
539f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
540f11c7f63SJim Harris  *             object on which the user is attempting to perform a start IO
541f11c7f63SJim Harris  *             operation.
542f11c7f63SJim Harris  * @param[in]  io_request This parameter specifies the IO request to be
543f11c7f63SJim Harris  *             started.
544f11c7f63SJim Harris  *
545f11c7f63SJim Harris  * @return This method returns an indication that complete IO operations
546f11c7f63SJim Harris  *         are not allowed.
547f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
548f11c7f63SJim Harris  */
scif_sas_remote_device_default_complete_high_priority_io_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * io_request,void * response_data,SCI_IO_STATUS completion_status)549f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_complete_high_priority_io_handler(
550f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
551f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * io_request,
552f11c7f63SJim Harris    void                     * response_data,
553f11c7f63SJim Harris    SCI_IO_STATUS              completion_status
554f11c7f63SJim Harris )
555f11c7f63SJim Harris {
556f11c7f63SJim Harris    SCIF_LOG_WARNING((
557f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
558f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
559f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to complete high priority IO\n",
560f11c7f63SJim Harris       remote_device,
561f11c7f63SJim Harris       sci_base_state_machine_get_state(
562f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
563f11c7f63SJim Harris    ));
564f11c7f63SJim Harris 
565f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
566f11c7f63SJim Harris }
567f11c7f63SJim Harris 
568f11c7f63SJim Harris 
569f11c7f63SJim Harris /**
570f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
571f11c7f63SJim Harris  *        when a user attempts to continue an IO on a remote device and a
572f11c7f63SJim Harris  *        continue IO operation is not allowed.
573f11c7f63SJim Harris  *
574f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
575f11c7f63SJim Harris  *             object on which the user is attempting to perform a start IO
576f11c7f63SJim Harris  *             operation.
577f11c7f63SJim Harris  * @param[in]  io_request This parameter specifies the IO request to be
578f11c7f63SJim Harris  *             started.
579f11c7f63SJim Harris  *
580f11c7f63SJim Harris  * @return This method returns an indication that continue IO operations
581f11c7f63SJim Harris  *         are not allowed.
582f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
583f11c7f63SJim Harris  */
scif_sas_remote_device_default_continue_io_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * io_request)584f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_continue_io_handler(
585f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
586f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * io_request
587f11c7f63SJim Harris )
588f11c7f63SJim Harris {
589f11c7f63SJim Harris    SCIF_LOG_WARNING((
590f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
591f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
592f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to continue IO\n",
593f11c7f63SJim Harris       remote_device,
594f11c7f63SJim Harris       sci_base_state_machine_get_state(
595f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
596f11c7f63SJim Harris    ));
597f11c7f63SJim Harris 
598f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
599f11c7f63SJim Harris }
600f11c7f63SJim Harris 
601f11c7f63SJim Harris /**
602f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
603f11c7f63SJim Harris  *        when a user attempts to start a task on a remote device and a
604f11c7f63SJim Harris  *        start task operation is not allowed.
605f11c7f63SJim Harris  *
606f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device
607f11c7f63SJim Harris  *             object on which the user is attempting to perform a start
608f11c7f63SJim Harris  *             task operation.
609f11c7f63SJim Harris  * @param[in]  task_request This parameter specifies the task management
610f11c7f63SJim Harris  *             request to be started.
611f11c7f63SJim Harris  *
612f11c7f63SJim Harris  * @return This method returns an indication that start task operations
613f11c7f63SJim Harris  *         are not allowed.
614f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
615f11c7f63SJim Harris  */
scif_sas_remote_device_default_start_task_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * task_request)616f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_start_task_handler(
617f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
618f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * task_request
619f11c7f63SJim Harris )
620f11c7f63SJim Harris {
621f11c7f63SJim Harris    SCIF_LOG_WARNING((
622f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
623f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
624f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to start task\n",
625f11c7f63SJim Harris       remote_device,
626f11c7f63SJim Harris       sci_base_state_machine_get_state(
627f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
628f11c7f63SJim Harris    ));
629f11c7f63SJim Harris 
630f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
631f11c7f63SJim Harris }
632f11c7f63SJim Harris 
633f11c7f63SJim Harris /**
634f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
635f11c7f63SJim Harris  *        when a user attempts to complete a task on a remote device and a
636f11c7f63SJim Harris  *        complete task operation is not allowed.
637f11c7f63SJim Harris  *
638f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
639f11c7f63SJim Harris  *             on which the user is attempting to perform a complete task
640f11c7f63SJim Harris  *             operation.
641f11c7f63SJim Harris  * @param[in]  task_request This parameter specifies the task management
642f11c7f63SJim Harris  *             request to be completed.
643f11c7f63SJim Harris  *
644f11c7f63SJim Harris  * @return This method returns an indication that complete task operations
645f11c7f63SJim Harris  *         are not allowed.
646f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is always returned.
647f11c7f63SJim Harris  */
scif_sas_remote_device_default_complete_task_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * task_request)648f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_default_complete_task_handler(
649f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
650f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * task_request
651f11c7f63SJim Harris )
652f11c7f63SJim Harris {
653f11c7f63SJim Harris    SCIF_LOG_WARNING((
654f11c7f63SJim Harris       sci_base_object_get_logger((SCIF_SAS_REMOTE_DEVICE_T *)remote_device),
655f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
656f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to complete task\n",
657f11c7f63SJim Harris       remote_device,
658f11c7f63SJim Harris       sci_base_state_machine_get_state(
659f11c7f63SJim Harris          &((SCIF_SAS_REMOTE_DEVICE_T *)remote_device)->parent.state_machine)
660f11c7f63SJim Harris    ));
661f11c7f63SJim Harris 
662f11c7f63SJim Harris    return SCI_FAILURE_INVALID_STATE;
663f11c7f63SJim Harris }
664f11c7f63SJim Harris 
665f11c7f63SJim Harris /**
666f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
667f11c7f63SJim Harris  *        for when the core issues a start completion notification and
668f11c7f63SJim Harris  *        such a notification isn't supported.
669f11c7f63SJim Harris  *
670f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
671453130d9SPedro F. Giffuni  *             for which the completion notification has occurred.
672f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the status
673f11c7f63SJim Harris  *             of the completion operation.
674f11c7f63SJim Harris  *
675f11c7f63SJim Harris  * @return none.
676f11c7f63SJim Harris  */
scif_sas_remote_device_default_start_complete_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device,SCI_STATUS completion_status)677f11c7f63SJim Harris void scif_sas_remote_device_default_start_complete_handler(
678f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device,
679f11c7f63SJim Harris    SCI_STATUS                 completion_status
680f11c7f63SJim Harris )
681f11c7f63SJim Harris {
682f11c7f63SJim Harris    SCIF_LOG_WARNING((
683f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
684f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
685f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to start complete\n",
686f11c7f63SJim Harris       fw_device,
687f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
688f11c7f63SJim Harris    ));
689f11c7f63SJim Harris }
690f11c7f63SJim Harris 
691f11c7f63SJim Harris /**
692f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
693f11c7f63SJim Harris  *        for when the core issues a stop completion notification and
694f11c7f63SJim Harris  *        such a notification isn't supported.
695f11c7f63SJim Harris  *
696f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
697453130d9SPedro F. Giffuni  *             for which the completion notification has occurred.
698f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the status
699f11c7f63SJim Harris  *             of the completion operation.
700f11c7f63SJim Harris  *
701f11c7f63SJim Harris  * @return none.
702f11c7f63SJim Harris  */
scif_sas_remote_device_default_stop_complete_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device,SCI_STATUS completion_status)703f11c7f63SJim Harris void scif_sas_remote_device_default_stop_complete_handler(
704f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device,
705f11c7f63SJim Harris    SCI_STATUS                 completion_status
706f11c7f63SJim Harris )
707f11c7f63SJim Harris {
708f11c7f63SJim Harris    SCIF_LOG_WARNING((
709f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
710f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
711f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to stop complete\n",
712f11c7f63SJim Harris       fw_device,
713f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
714f11c7f63SJim Harris    ));
715f11c7f63SJim Harris }
716f11c7f63SJim Harris 
717f11c7f63SJim Harris /**
718f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
719f11c7f63SJim Harris  *        for when the core issues a ready notification and such a
720f11c7f63SJim Harris  *        notification isn't supported.
721f11c7f63SJim Harris  *
722f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
723453130d9SPedro F. Giffuni  *             for which the notification has occurred.
724f11c7f63SJim Harris  *
725f11c7f63SJim Harris  * @return none.
726f11c7f63SJim Harris  */
scif_sas_remote_device_default_ready_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device)727f11c7f63SJim Harris void scif_sas_remote_device_default_ready_handler(
728f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device
729f11c7f63SJim Harris )
730f11c7f63SJim Harris {
731f11c7f63SJim Harris    SCIF_LOG_WARNING((
732f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
733f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
734f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to handle ready\n",
735f11c7f63SJim Harris       fw_device,
736f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
737f11c7f63SJim Harris    ));
738f11c7f63SJim Harris }
739f11c7f63SJim Harris 
740f11c7f63SJim Harris /**
741f11c7f63SJim Harris  * @brief This method provides default handling (i.e. returns an error);
742f11c7f63SJim Harris  *        for when the core issues a not ready notification and such a
743f11c7f63SJim Harris  *        notification isn't supported.
744f11c7f63SJim Harris  *
745f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
746453130d9SPedro F. Giffuni  *             for which the notification has occurred.
747f11c7f63SJim Harris  *
748f11c7f63SJim Harris  * @return none.
749f11c7f63SJim Harris  */
scif_sas_remote_device_default_not_ready_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device,U32 reason_code)750f11c7f63SJim Harris void scif_sas_remote_device_default_not_ready_handler(
751f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device,
752f11c7f63SJim Harris    U32                        reason_code
753f11c7f63SJim Harris )
754f11c7f63SJim Harris {
755f11c7f63SJim Harris    SCIF_LOG_WARNING((
756f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
757f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
758f11c7f63SJim Harris       "RemoteDevice:0x%x State:0x%x invalid state to handle not ready\n",
759f11c7f63SJim Harris       fw_device,
760f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
761f11c7f63SJim Harris    ));
762f11c7f63SJim Harris }
763f11c7f63SJim Harris 
764f11c7f63SJim Harris #if !defined(DISABLE_WIDE_PORTED_TARGETS)
765f11c7f63SJim Harris /**
766f11c7f63SJim Harris  * @brief This method provides handling of device start complete duing
767f11c7f63SJim Harris  *        UPDATING_PORT_WIDTH state.
768f11c7f63SJim Harris  *
769f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
770f11c7f63SJim Harris  *             which is start complete.
771f11c7f63SJim Harris  *
772f11c7f63SJim Harris  * @return none.
773f11c7f63SJim Harris  */
774f11c7f63SJim Harris static
scif_sas_remote_device_updating_port_width_state_complete_io_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device,SCI_BASE_REQUEST_T * io_request)775f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_updating_port_width_state_complete_io_handler(
776f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device,
777f11c7f63SJim Harris    SCI_BASE_REQUEST_T       * io_request
778f11c7f63SJim Harris )
779f11c7f63SJim Harris {
780f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device = (SCIF_SAS_REMOTE_DEVICE_T*)
781f11c7f63SJim Harris                                           remote_device;
782f11c7f63SJim Harris    fw_device->request_count--;
783f11c7f63SJim Harris 
784f11c7f63SJim Harris    //If the request count is zero, go ahead to update the RNC.
785f11c7f63SJim Harris    if (fw_device->request_count == 0 )
786f11c7f63SJim Harris    {
787f11c7f63SJim Harris       if (fw_device->destination_state == SCIF_SAS_REMOTE_DEVICE_DESTINATION_STATE_STOPPING)
788f11c7f63SJim Harris       {
789f11c7f63SJim Harris          //if the destination state of this device change to STOPPING, no matter
790f11c7f63SJim Harris          //whether we need to update the port width, just make the device
791f11c7f63SJim Harris          //go to the STOPPING state, the device will be removed anyway.
792f11c7f63SJim Harris          sci_base_state_machine_change_state(
793f11c7f63SJim Harris             &fw_device->parent.state_machine,
794f11c7f63SJim Harris             SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
795f11c7f63SJim Harris          );
796f11c7f63SJim Harris       }
797f11c7f63SJim Harris       else
798f11c7f63SJim Harris       {
799f11c7f63SJim Harris          //stop the device, upon the stop complete callback, start the device again
800f11c7f63SJim Harris          //with the updated port width.
801f11c7f63SJim Harris          scic_remote_device_stop(
802f11c7f63SJim Harris             fw_device->core_object, SCIF_SAS_REMOTE_DEVICE_CORE_OP_TIMEOUT);
803f11c7f63SJim Harris       }
804f11c7f63SJim Harris    }
805f11c7f63SJim Harris 
806f11c7f63SJim Harris    return SCI_SUCCESS;
807f11c7f63SJim Harris }
808f11c7f63SJim Harris 
809f11c7f63SJim Harris 
810f11c7f63SJim Harris /**
811f11c7f63SJim Harris  * @brief This method provides handling of device start complete duing
812f11c7f63SJim Harris  *        UPDATING_PORT_WIDTH state.
813f11c7f63SJim Harris  *
814f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
815f11c7f63SJim Harris  *             which is start complete.
816f11c7f63SJim Harris  *
817f11c7f63SJim Harris  * @return none.
818f11c7f63SJim Harris  */
819f11c7f63SJim Harris static
scif_sas_remote_device_updating_port_width_state_start_complete_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device,SCI_STATUS completion_status)820f11c7f63SJim Harris void scif_sas_remote_device_updating_port_width_state_start_complete_handler(
821f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device,
822f11c7f63SJim Harris    SCI_STATUS                 completion_status
823f11c7f63SJim Harris )
824f11c7f63SJim Harris {
825f11c7f63SJim Harris    SCIF_LOG_INFO((
826f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
827f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
828f11c7f63SJim Harris       "RemoteDevice:0x%x updating port width state start complete handler\n",
829f11c7f63SJim Harris       fw_device,
830f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
831f11c7f63SJim Harris    ));
832f11c7f63SJim Harris 
833f11c7f63SJim Harris    if ( fw_device->destination_state
834f11c7f63SJim Harris            == SCIF_SAS_REMOTE_DEVICE_DESTINATION_STATE_STOPPING )
835f11c7f63SJim Harris    {
836f11c7f63SJim Harris       //if the destination state of this device change to STOPPING, no matter
837f11c7f63SJim Harris       //whether we need to update the port width again, just make the device
838f11c7f63SJim Harris       //go to the STOPPING state.
839f11c7f63SJim Harris       sci_base_state_machine_change_state(
840f11c7f63SJim Harris          &fw_device->parent.state_machine,
841f11c7f63SJim Harris          SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
842f11c7f63SJim Harris       );
843f11c7f63SJim Harris    }
844f11c7f63SJim Harris    else if ( scic_remote_device_get_port_width(fw_device->core_object)
845f11c7f63SJim Harris                 != fw_device->device_port_width
846f11c7f63SJim Harris             && fw_device->device_port_width != 0)
847f11c7f63SJim Harris    {
848f11c7f63SJim Harris       scic_remote_device_stop(
849f11c7f63SJim Harris          fw_device->core_object,
850f11c7f63SJim Harris          SCIF_SAS_REMOTE_DEVICE_CORE_OP_TIMEOUT
851f11c7f63SJim Harris       );
852f11c7f63SJim Harris    }
853f11c7f63SJim Harris    else
854f11c7f63SJim Harris    {
855f11c7f63SJim Harris       //Port width updating succeeds. Transfer to destination state.
856f11c7f63SJim Harris       sci_base_state_machine_change_state(
857f11c7f63SJim Harris          &fw_device->parent.state_machine,
858f11c7f63SJim Harris          SCI_BASE_REMOTE_DEVICE_STATE_READY
859f11c7f63SJim Harris       );
860f11c7f63SJim Harris    }
861f11c7f63SJim Harris }
862f11c7f63SJim Harris 
863f11c7f63SJim Harris /**
864f11c7f63SJim Harris  * @brief This method provides handling of device stop complete duing
865f11c7f63SJim Harris  *        UPDATING_PORT_WIDTH state.
866f11c7f63SJim Harris  *
867f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
868f11c7f63SJim Harris  *             which is stop complete.
869f11c7f63SJim Harris  *
870f11c7f63SJim Harris  * @return none.
871f11c7f63SJim Harris  */
872f11c7f63SJim Harris static
scif_sas_remote_device_updating_port_width_state_stop_complete_handler(SCIF_SAS_REMOTE_DEVICE_T * fw_device,SCI_STATUS completion_status)873f11c7f63SJim Harris void scif_sas_remote_device_updating_port_width_state_stop_complete_handler(
874f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device,
875f11c7f63SJim Harris    SCI_STATUS                 completion_status
876f11c7f63SJim Harris )
877f11c7f63SJim Harris {
878f11c7f63SJim Harris    SCIF_LOG_INFO((
879f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
880f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
881f11c7f63SJim Harris       "RemoteDevice:0x%x updating port width state stop complete handler\n",
882f11c7f63SJim Harris       fw_device,
883f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
884f11c7f63SJim Harris    ));
885f11c7f63SJim Harris 
886f11c7f63SJim Harris    if ( fw_device->destination_state
887f11c7f63SJim Harris            == SCIF_SAS_REMOTE_DEVICE_DESTINATION_STATE_STOPPING )
888f11c7f63SJim Harris    {
889f11c7f63SJim Harris       //Device directly transits to STOPPED STATE from UPDATING_PORT_WIDTH state,
890f11c7f63SJim Harris       fw_device->domain->device_start_count--;
891f11c7f63SJim Harris 
892f11c7f63SJim Harris       //if the destination state of this device change to STOPPING, no matter
893f11c7f63SJim Harris       //whether we need to update the port width again, just make the device
894f11c7f63SJim Harris       //go to the STOPPED state.
895f11c7f63SJim Harris       sci_base_state_machine_change_state(
896f11c7f63SJim Harris          &fw_device->parent.state_machine,
897f11c7f63SJim Harris          SCI_BASE_REMOTE_DEVICE_STATE_STOPPED
898f11c7f63SJim Harris       );
899f11c7f63SJim Harris    }
900f11c7f63SJim Harris    else
901f11c7f63SJim Harris    {
902f11c7f63SJim Harris       scic_remote_device_set_port_width(
903f11c7f63SJim Harris          fw_device->core_object,
904f11c7f63SJim Harris          fw_device->device_port_width
905f11c7f63SJim Harris       );
906f11c7f63SJim Harris 
907f11c7f63SJim Harris       //Device stop complete, means the RNC has been destructed. Now we need to
908f11c7f63SJim Harris       //start core device so the RNC with updated port width will be posted.
909f11c7f63SJim Harris       scic_remote_device_start(
910f11c7f63SJim Harris          fw_device->core_object, SCIF_SAS_REMOTE_DEVICE_CORE_OP_TIMEOUT);
911f11c7f63SJim Harris    }
912f11c7f63SJim Harris }
913f11c7f63SJim Harris 
914f11c7f63SJim Harris /**
915f11c7f63SJim Harris  * @brief This method provides handling (i.e. returns an error);
916f11c7f63SJim Harris  *        when a user attempts to stop a remote device during the updating
917f11c7f63SJim Harris  *        port width state, it will record the destination state for this
918f11c7f63SJim Harris  *        device to be STOPPING, instead of usually READY state.
919f11c7f63SJim Harris  *
920f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device object
921f11c7f63SJim Harris  *             on which the user is attempting to perform a stop operation.
922f11c7f63SJim Harris  *
923f11c7f63SJim Harris  * @return This method always return SCI_SUCCESS.
924f11c7f63SJim Harris  */
925f11c7f63SJim Harris static
scif_sas_remote_device_updating_port_width_state_stop_handler(SCI_BASE_REMOTE_DEVICE_T * remote_device)926f11c7f63SJim Harris SCI_STATUS scif_sas_remote_device_updating_port_width_state_stop_handler(
927f11c7f63SJim Harris    SCI_BASE_REMOTE_DEVICE_T * remote_device
928f11c7f63SJim Harris )
929f11c7f63SJim Harris {
930f11c7f63SJim Harris    SCIF_SAS_REMOTE_DEVICE_T * fw_device =
931f11c7f63SJim Harris       (SCIF_SAS_REMOTE_DEVICE_T *)remote_device;
932f11c7f63SJim Harris 
933f11c7f63SJim Harris    SCIF_LOG_INFO((
934f11c7f63SJim Harris       sci_base_object_get_logger(fw_device),
935f11c7f63SJim Harris       SCIF_LOG_OBJECT_REMOTE_DEVICE,
936f11c7f63SJim Harris       "RemoteDevice:0x%x updating port width state stop handler\n",
937f11c7f63SJim Harris       fw_device,
938f11c7f63SJim Harris       sci_base_state_machine_get_state(&fw_device->parent.state_machine)
939f11c7f63SJim Harris    ));
940f11c7f63SJim Harris 
941f11c7f63SJim Harris    //Can't stop the device right now. Remember the pending stopping request.
942f11c7f63SJim Harris    //When exit the UPDATING_PORT_WIDTH state, we will check this variable
943f11c7f63SJim Harris    //to decide which state to go.
944f11c7f63SJim Harris    fw_device->destination_state =
945f11c7f63SJim Harris       SCIF_SAS_REMOTE_DEVICE_DESTINATION_STATE_STOPPING;
946f11c7f63SJim Harris 
947f11c7f63SJim Harris    return SCI_SUCCESS;
948f11c7f63SJim Harris }
949f11c7f63SJim Harris 
950f11c7f63SJim Harris #endif //#if !defined(DISABLE_WIDE_PORTED_TARGETS)
951f11c7f63SJim Harris 
952f11c7f63SJim Harris #define scif_sas_remote_device_stopping_complete_io_handler   \
953f11c7f63SJim Harris         scif_sas_remote_device_ready_operational_complete_io_handler
954f11c7f63SJim Harris #define scif_sas_remote_device_stopping_complete_task_handler \
955f11c7f63SJim Harris         scif_sas_remote_device_ready_operational_complete_task_handler
956f11c7f63SJim Harris 
957f11c7f63SJim Harris SCIF_SAS_REMOTE_DEVICE_STATE_HANDLER_T
958f11c7f63SJim Harris scif_sas_remote_device_state_handler_table[SCI_BASE_REMOTE_DEVICE_MAX_STATES] =
959f11c7f63SJim Harris {
960f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
961f11c7f63SJim Harris    {
962f11c7f63SJim Harris       {
963f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
964f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
965f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
966f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
967f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
968f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
969f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
970f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
971f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
972f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
973f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
974f11c7f63SJim Harris       },
975f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
976f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
977f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
978f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
979f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
980f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
981f11c7f63SJim Harris    },
982f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_STOPPED
983f11c7f63SJim Harris    {
984f11c7f63SJim Harris       {
985f11c7f63SJim Harris          scif_sas_remote_device_stopped_start_handler,
986f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
987f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
988f11c7f63SJim Harris          scif_sas_remote_device_stopped_destruct_handler,
989f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
990f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
991f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
992f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
993f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
994f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
995f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
996f11c7f63SJim Harris       },
997f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
998f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
999f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1000f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1001f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1002f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1003f11c7f63SJim Harris    },
1004f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_STARTING
1005f11c7f63SJim Harris    {
1006f11c7f63SJim Harris       {
1007f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1008f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
1009f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1010f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1011f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1012f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1013f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1014f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
1015f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1016f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1017f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
1018f11c7f63SJim Harris       },
1019f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
1020f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
1021f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1022f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1023f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1024f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1025f11c7f63SJim Harris    },
1026f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_READY - see substate handlers
1027f11c7f63SJim Harris    {
1028f11c7f63SJim Harris       {
1029f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1030f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
1031f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1032f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1033f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1034f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1035f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1036f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
1037f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1038f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1039f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
1040f11c7f63SJim Harris       },
1041f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
1042f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
1043f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1044f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1045f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1046f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1047f11c7f63SJim Harris    },
1048f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
1049f11c7f63SJim Harris    {
1050f11c7f63SJim Harris       {
1051f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1052f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
1053f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1054f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1055f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1056f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1057f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1058f11c7f63SJim Harris          scif_sas_remote_device_stopping_complete_io_handler,
1059f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1060f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1061f11c7f63SJim Harris          scif_sas_remote_device_stopping_complete_task_handler
1062f11c7f63SJim Harris       },
1063f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
1064f11c7f63SJim Harris       scif_sas_remote_device_stopping_stop_complete_handler,
1065f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1066f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1067f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1068f11c7f63SJim Harris       scif_sas_remote_device_stopping_complete_high_priority_io_handler
1069f11c7f63SJim Harris    },
1070f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_FAILED
1071f11c7f63SJim Harris    {
1072f11c7f63SJim Harris       {
1073f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1074f11c7f63SJim Harris          scif_sas_remote_device_failed_stop_handler,
1075f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1076f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1077f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1078f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1079f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1080f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
1081f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1082f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1083f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
1084f11c7f63SJim Harris       },
1085f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
1086f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
1087f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1088f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1089f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1090f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1091f11c7f63SJim Harris    },
1092f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_RESETTING - is unused by framework
1093f11c7f63SJim Harris    {
1094f11c7f63SJim Harris       {
1095f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1096f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
1097f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1098f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1099f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1100f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1101f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1102f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
1103f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1104f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1105f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
1106f11c7f63SJim Harris       },
1107f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
1108f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
1109f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1110f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1111f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1112f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1113f11c7f63SJim Harris    },
1114f11c7f63SJim Harris #if !defined(DISABLE_WIDE_PORTED_TARGETS)
1115f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_UPDATING_PORT_WIDTH
1116f11c7f63SJim Harris    {
1117f11c7f63SJim Harris       {
1118f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1119f11c7f63SJim Harris          scif_sas_remote_device_updating_port_width_state_stop_handler,
1120f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1121f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1122f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1123f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1124f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1125f11c7f63SJim Harris          scif_sas_remote_device_updating_port_width_state_complete_io_handler,
1126f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1127f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1128f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
1129f11c7f63SJim Harris       },
1130f11c7f63SJim Harris       scif_sas_remote_device_updating_port_width_state_start_complete_handler,
1131f11c7f63SJim Harris       scif_sas_remote_device_updating_port_width_state_stop_complete_handler,
1132f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1133f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1134f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1135f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1136f11c7f63SJim Harris    },
1137f11c7f63SJim Harris #endif
1138f11c7f63SJim Harris    // SCI_BASE_REMOTE_DEVICE_STATE_FINAL
1139f11c7f63SJim Harris    {
1140f11c7f63SJim Harris       {
1141f11c7f63SJim Harris          scif_sas_remote_device_default_start_handler,
1142f11c7f63SJim Harris          scif_sas_remote_device_default_stop_handler,
1143f11c7f63SJim Harris          scif_sas_remote_device_default_fail_handler,
1144f11c7f63SJim Harris          scif_sas_remote_device_default_destruct_handler,
1145f11c7f63SJim Harris          scif_sas_remote_device_default_reset_handler,
1146f11c7f63SJim Harris          scif_sas_remote_device_default_reset_complete_handler,
1147f11c7f63SJim Harris          scif_sas_remote_device_default_start_io_handler,
1148f11c7f63SJim Harris          scif_sas_remote_device_default_complete_io_handler,
1149f11c7f63SJim Harris          scif_sas_remote_device_default_continue_io_handler,
1150f11c7f63SJim Harris          scif_sas_remote_device_default_start_task_handler,
1151f11c7f63SJim Harris          scif_sas_remote_device_default_complete_task_handler
1152f11c7f63SJim Harris       },
1153f11c7f63SJim Harris       scif_sas_remote_device_default_start_complete_handler,
1154f11c7f63SJim Harris       scif_sas_remote_device_default_stop_complete_handler,
1155f11c7f63SJim Harris       scif_sas_remote_device_default_ready_handler,
1156f11c7f63SJim Harris       scif_sas_remote_device_default_not_ready_handler,
1157f11c7f63SJim Harris       scif_sas_remote_device_default_start_io_handler,
1158f11c7f63SJim Harris       scif_sas_remote_device_default_complete_high_priority_io_handler
1159f11c7f63SJim Harris    }
1160f11c7f63SJim Harris };
1161f11c7f63SJim Harris 
1162