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