2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 #include <sys/cdefs.h>
54 __FBSDID("$FreeBSD$");
59 * @brief This file contains all of the SCIF_SAS_TASK_REQUEST object
60 * state entrance and exit method implementations.
63 #include <dev/isci/scil/scif_sas_task_request.h>
65 //******************************************************************************
66 //* P R O T E C T E D M E T H O D S
67 //******************************************************************************
70 * @brief This method implements the actions taken when entering the
73 * @param[in] object This parameter specifies the base object for which
74 * the state transition is occurring. This is cast into a
75 * SCIF_SAS_TASK_REQUEST object in the method implementation.
80 void scif_sas_task_request_initial_state_enter(
81 SCI_BASE_OBJECT_T *object
84 SCIF_SAS_TASK_REQUEST_T * fw_task = (SCIF_SAS_TASK_REQUEST_T *)object;
88 scif_sas_task_request_state_handler_table,
89 SCI_BASE_REQUEST_STATE_INITIAL
92 // Initial state is a transitional state to the constructed state
93 sci_base_state_machine_change_state(
94 &fw_task->parent.parent.state_machine, SCI_BASE_REQUEST_STATE_CONSTRUCTED
99 * @brief This method implements the actions taken when entering the
102 * @param[in] object This parameter specifies the base object for which
103 * the state transition is occurring. This is cast into a
104 * SCIF_SAS_TASK_REQUEST object in the method implementation.
109 void scif_sas_task_request_constructed_state_enter(
110 SCI_BASE_OBJECT_T *object
113 SCIF_SAS_TASK_REQUEST_T * fw_task = (SCIF_SAS_TASK_REQUEST_T *)object;
117 scif_sas_task_request_state_handler_table,
118 SCI_BASE_REQUEST_STATE_CONSTRUCTED
123 * @brief This method implements the actions taken when entering the
126 * @param[in] object This parameter specifies the base object for which
127 * the state transition is occurring. This is cast into a
128 * SCIF_SAS_TASK_REQUEST object in the method implementation.
133 void scif_sas_task_request_started_state_enter(
134 SCI_BASE_OBJECT_T *object
137 SCIF_SAS_TASK_REQUEST_T * fw_task = (SCIF_SAS_TASK_REQUEST_T *)object;
141 scif_sas_task_request_state_handler_table,
142 SCI_BASE_REQUEST_STATE_STARTED
145 // Increment the affected request count to include the task performing
146 // the task management to ensure we don't complete the task request until
147 // all terminations and the task itself have completed.
148 fw_task->affected_request_count++;
152 * @brief This method implements the actions taken when entering the
155 * @param[in] object This parameter specifies the base object for which
156 * the state transition is occurring. This is cast into a
157 * SCIF_SAS_TASK_REQUEST object in the method implementation.
162 void scif_sas_task_request_completed_state_enter(
163 SCI_BASE_OBJECT_T *object
166 SCIF_SAS_TASK_REQUEST_T * fw_task = (SCIF_SAS_TASK_REQUEST_T *)object;
170 scif_sas_task_request_state_handler_table,
171 SCI_BASE_REQUEST_STATE_COMPLETED
174 // Check to see if the task management operation is now finished (i.e.
175 // all of the task terminations and the task management request are
177 scif_sas_task_request_operation_complete(fw_task);
181 * @brief This method implements the actions taken when entering the
184 * @param[in] object This parameter specifies the base object for which
185 * the state transition is occurring. This is cast into a
186 * SCIF_SAS_TASK_REQUEST object in the method implementation.
191 void scif_sas_task_request_aborting_state_enter(
192 SCI_BASE_OBJECT_T *object
195 SCIF_SAS_TASK_REQUEST_T * fw_task = (SCIF_SAS_TASK_REQUEST_T *)object;
199 scif_sas_task_request_state_handler_table,
200 SCI_BASE_REQUEST_STATE_ABORTING
203 /// @todo Is terminating a previously outstanding task request right?
204 fw_task->parent.status = scif_sas_request_terminate_start(
205 &fw_task->parent, fw_task->parent.core_object
210 * @brief This method implements the actions taken when exiting the
213 * @param[in] object This parameter specifies the base object for which
214 * the state transition is occurring. This is cast into a
215 * SCIF_SAS_TASK_REQUEST object in the method implementation.
220 void scif_sas_task_request_aborting_state_exit(
221 SCI_BASE_OBJECT_T *object
224 SCIF_SAS_REQUEST_T * fw_request = (SCIF_SAS_REQUEST_T *)object;
225 scif_sas_request_terminate_complete(fw_request);
229 * @brief This method implements the actions taken when entering the
232 * @param[in] object This parameter specifies the base object for which
233 * the state transition is occurring. This is cast into a
234 * SCIF_SAS_TASK_REQUEST object in the method implementation.
239 void scif_sas_task_request_final_state_enter(
240 SCI_BASE_OBJECT_T *object
243 SCIF_SAS_TASK_REQUEST_T * fw_task = (SCIF_SAS_TASK_REQUEST_T *)object;
247 scif_sas_task_request_state_handler_table,
248 SCI_BASE_REQUEST_STATE_FINAL
254 scif_sas_task_request_state_table[SCI_BASE_REQUEST_MAX_STATES] =
257 SCI_BASE_REQUEST_STATE_INITIAL,
258 scif_sas_task_request_initial_state_enter,
262 SCI_BASE_REQUEST_STATE_CONSTRUCTED,
263 scif_sas_task_request_constructed_state_enter,
267 SCI_BASE_REQUEST_STATE_STARTED,
268 scif_sas_task_request_started_state_enter,
272 SCI_BASE_REQUEST_STATE_COMPLETED,
273 scif_sas_task_request_completed_state_enter,
277 SCI_BASE_REQUEST_STATE_ABORTING,
278 scif_sas_task_request_aborting_state_enter,
279 scif_sas_task_request_aborting_state_exit
282 SCI_BASE_REQUEST_STATE_FINAL,
283 scif_sas_task_request_final_state_enter,