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.
56 #ifndef _SCIF_SAS_REQUEST_H_
57 #define _SCIF_SAS_REQUEST_H_
62 * @brief This file contains the protected interface structures, constants,
63 * and methods for the SCIF_SAS_REQUEST object. This object provides
64 * the common data and behavior to SAS IO and task management
72 #include <dev/isci/scil/sati_translator_sequence.h>
73 #include <dev/isci/scil/sci_types.h>
74 #include <dev/isci/scil/sci_status.h>
75 #include <dev/isci/scil/sci_fast_list.h>
76 #include <dev/isci/scil/sci_base_request.h>
78 #define SCIF_SAS_RESPONSE_DATA_LENGTH 120
80 struct SCIF_SAS_CONTROLLER;
81 struct SCIF_SAS_REMOTE_DEVICE;
82 struct SCIF_SAS_TASK_REQUEST;
83 struct SCIF_SAS_REQUEST;
85 typedef SCI_STATUS (*SCIF_SAS_REQUEST_COMPLETION_HANDLER_T)(
86 struct SCIF_SAS_CONTROLLER *,
87 struct SCIF_SAS_REMOTE_DEVICE *,
88 struct SCIF_SAS_REQUEST *,
93 * @struct SCIF_SAS_STP_REQUEST
95 * @brief This structure contains all of the data specific to performing
96 * SATA/STP IO and TASK requests.
98 typedef struct SCIF_SAS_STP_REQUEST
101 * This field contains the translation information utilized by SATI.
102 * For more information on this field please refer to
103 * SATI_TRANSLATOR_SEQUENCE.
105 SATI_TRANSLATOR_SEQUENCE_T sequence;
108 * This field contains the ncq tag being utilized by this IO request.
109 * The NCQ tag value must be less than or equal to 31 (0 <= tag <= 31).
113 } SCIF_SAS_STP_REQUEST_T;
116 * @struct SCIF_SAS_REQUEST
118 * @brief The SCIF_SAS_REQUEST object abstracts the common SAS
119 * IO & task management data and behavior for the framework component.
121 typedef struct SCIF_SAS_REQUEST
124 * All SAS request types (IO or Task management) have the SCI base
125 * request as their parent object.
127 SCI_BASE_REQUEST_T parent;
130 * This field references the list of state specific handler methods to
131 * be utilized for this request instance.
133 SCI_BASE_REQUEST_STATE_HANDLER_T * state_handlers;
135 SCIF_SAS_REQUEST_COMPLETION_HANDLER_T protocol_complete_handler;
138 * This field is utilized to communicate state information relating
139 * to this IO request and it's state transitions.
144 * This field represents the remote device object to which this IO
145 * request is destined.
147 struct SCIF_SAS_REMOTE_DEVICE * device;
150 * This field references the request object that has asked that this
151 * request be terminated.
153 struct SCIF_SAS_TASK_REQUEST * terminate_requestor;
156 * This field provides list specific information that enables a request
157 * to be placed in a list.
159 SCI_FAST_LIST_ELEMENT_T list_element;
162 * This field indicates if the current request is one internally
163 * generated by the framework or if it is a user IO/task request.
168 * This field indicates the current request is a high priority one.
169 * An internal request is always high priority. But an external request
170 * could be high priority.
172 BOOL is_high_priority;
175 * This field indicates the current request should not be completed
176 * until a pending abort task set request is completed. For NCQ errors,
177 * it will allow waiting until the read log ext data is returned to
178 * to determine how to fail/abort the pending ios.
180 BOOL is_waiting_for_abort_task_set;
183 * This field indicates the logical unit (LUN) for the request.
184 * This field is utilized during internal IO requests.
189 * This field specifies sata specific data for the reqeust object.
190 * This data is only valid for SATA requests.
192 SCIF_SAS_STP_REQUEST_T stp;
195 * This field contains the handle for the SCI Core request object that is
196 * managed by this framework request.
198 SCI_IO_REQUEST_HANDLE_T core_object;
200 } SCIF_SAS_REQUEST_T;
202 void scif_sas_request_construct(
203 SCIF_SAS_REQUEST_T * fw_request,
204 struct SCIF_SAS_REMOTE_DEVICE * fw_device,
205 SCI_BASE_LOGGER_T * logger,
206 SCI_BASE_STATE_T * state_table
209 SCI_STATUS scif_sas_request_terminate_start(
210 SCIF_SAS_REQUEST_T * fw_request,
211 SCI_IO_REQUEST_HANDLE_T core_request
214 void scif_sas_request_terminate_complete(
215 SCIF_SAS_REQUEST_T * fw_request
220 #endif // __cplusplus
222 #endif // _SCIF_SAS_REQUEST_H_