2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
35 * * Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * * Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in
39 * the documentation and/or other materials provided with the
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 #include <sys/cdefs.h>
56 __FBSDID("$FreeBSD$");
61 * @brief This file contains all of the SCIF_SAS_IO_REQUEST object
62 * state entrance and exit method implementations.
65 #include <dev/isci/scil/scic_controller.h>
67 #include <dev/isci/scil/scif_sas_io_request.h>
68 #include <dev/isci/scil/scif_sas_domain.h>
69 #include <dev/isci/scil/scif_sas_controller.h>
70 #include <dev/isci/scil/scif_sas_logger.h>
72 //******************************************************************************
73 //* P R O T E C T E D M E T H O D S
74 //******************************************************************************
77 * @brief This method implements the actions taken when entering the
80 * @param[in] object This parameter specifies the base object for which
81 * the state transition is occurring. This is cast into a
82 * SCIF_SAS_IO_REQUEST object in the method implementation.
87 void scif_sas_io_request_initial_state_enter(
88 SCI_BASE_OBJECT_T *object
91 SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
95 scif_sas_io_request_state_handler_table,
96 SCI_BASE_REQUEST_STATE_INITIAL
99 // Initial state is a transitional state to the constructed state
100 sci_base_state_machine_change_state(
101 &fw_io->parent.parent.state_machine, SCI_BASE_REQUEST_STATE_CONSTRUCTED
106 * @brief This method implements the actions taken when entering the
109 * @param[in] object This parameter specifies the base object for which
110 * the state transition is occurring. This is cast into a
111 * SCIF_SAS_IO_REQUEST object in the method implementation.
116 void scif_sas_io_request_constructed_state_enter(
117 SCI_BASE_OBJECT_T *object
120 SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
124 scif_sas_io_request_state_handler_table,
125 SCI_BASE_REQUEST_STATE_CONSTRUCTED
130 * @brief This method implements the actions taken when entering the
133 * @param[in] object This parameter specifies the base object for which
134 * the state transition is occurring. This is cast into a
135 * SCIF_SAS_IO_REQUEST object in the method implementation.
140 void scif_sas_io_request_started_state_enter(
141 SCI_BASE_OBJECT_T *object
144 SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
148 scif_sas_io_request_state_handler_table,
149 SCI_BASE_REQUEST_STATE_STARTED
154 * @brief This method implements the actions taken when entering the
157 * @param[in] object This parameter specifies the base object for which
158 * the state transition is occurring. This is cast into a
159 * SCIF_SAS_IO_REQUEST object in the method implementation.
164 void scif_sas_io_request_completed_state_enter(
165 SCI_BASE_OBJECT_T *object
168 SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
172 scif_sas_io_request_state_handler_table,
173 SCI_BASE_REQUEST_STATE_COMPLETED
178 * @brief This method implements the actions taken when entering the
181 * @param[in] object This parameter specifies the base object for which
182 * the state transition is occurring. This is cast into a
183 * SCIF_SAS_IO_REQUEST object in the method implementation.
188 void scif_sas_io_request_aborting_state_enter(
189 SCI_BASE_OBJECT_T *object
192 SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
195 sci_base_object_get_logger(fw_io),
196 SCIF_LOG_OBJECT_IO_REQUEST | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
197 "Domain:0x%x Device:0x%x IORequest:0x%x terminating\n",
198 fw_io->parent.device->domain, fw_io->parent.device, fw_io
203 scif_sas_io_request_state_handler_table,
204 SCI_BASE_REQUEST_STATE_ABORTING
207 fw_io->parent.status = scif_sas_request_terminate_start(
208 &fw_io->parent, fw_io->parent.core_object
213 * @brief This method implements the actions taken when exiting the
216 * @param[in] object This parameter specifies the base object for which
217 * the state transition is occurring. This is cast into a
218 * SCIF_SAS_IO_REQUEST object in the method implementation.
223 void scif_sas_io_request_aborting_state_exit(
224 SCI_BASE_OBJECT_T *object
227 SCIF_SAS_REQUEST_T * fw_request = (SCIF_SAS_REQUEST_T *)object;
228 scif_sas_request_terminate_complete(fw_request);
232 * @brief This method implements the actions taken when entering the
235 * @param[in] object This parameter specifies the base object for which
236 * the state transition is occurring. This is cast into a
237 * SCIF_SAS_IO_REQUEST object in the method implementation.
242 void scif_sas_io_request_final_state_enter(
243 SCI_BASE_OBJECT_T *object
246 SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
250 scif_sas_io_request_state_handler_table,
251 SCI_BASE_REQUEST_STATE_FINAL
255 SCI_BASE_STATE_T scif_sas_io_request_state_table[SCI_BASE_REQUEST_MAX_STATES] =
258 SCI_BASE_REQUEST_STATE_INITIAL,
259 scif_sas_io_request_initial_state_enter,
263 SCI_BASE_REQUEST_STATE_CONSTRUCTED,
264 scif_sas_io_request_constructed_state_enter,
268 SCI_BASE_REQUEST_STATE_STARTED,
269 scif_sas_io_request_started_state_enter,
273 SCI_BASE_REQUEST_STATE_COMPLETED,
274 scif_sas_io_request_completed_state_enter,
278 SCI_BASE_REQUEST_STATE_ABORTING,
279 scif_sas_io_request_aborting_state_enter,
280 scif_sas_io_request_aborting_state_exit
283 SCI_BASE_REQUEST_STATE_FINAL,
284 scif_sas_io_request_final_state_enter,