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.
54 #ifndef _SCIF_SAS_REQUEST_H_
55 #define _SCIF_SAS_REQUEST_H_
60 * @brief This file contains the protected interface structures, constants,
61 * and methods for the SCIF_SAS_REQUEST object. This object provides
62 * the common data and behavior to SAS IO and task management
70 #include <dev/isci/scil/sati_translator_sequence.h>
71 #include <dev/isci/scil/sci_types.h>
72 #include <dev/isci/scil/sci_status.h>
73 #include <dev/isci/scil/sci_fast_list.h>
74 #include <dev/isci/scil/sci_base_request.h>
76 #define SCIF_SAS_RESPONSE_DATA_LENGTH 120
78 struct SCIF_SAS_CONTROLLER;
79 struct SCIF_SAS_REMOTE_DEVICE;
80 struct SCIF_SAS_TASK_REQUEST;
81 struct SCIF_SAS_REQUEST;
83 typedef SCI_STATUS (*SCIF_SAS_REQUEST_COMPLETION_HANDLER_T)(
84 struct SCIF_SAS_CONTROLLER *,
85 struct SCIF_SAS_REMOTE_DEVICE *,
86 struct SCIF_SAS_REQUEST *,
91 * @struct SCIF_SAS_STP_REQUEST
93 * @brief This structure contains all of the data specific to performing
94 * SATA/STP IO and TASK requests.
96 typedef struct SCIF_SAS_STP_REQUEST
99 * This field contains the translation information utilized by SATI.
100 * For more information on this field please refer to
101 * SATI_TRANSLATOR_SEQUENCE.
103 SATI_TRANSLATOR_SEQUENCE_T sequence;
106 * This field contains the ncq tag being utilized by this IO request.
107 * The NCQ tag value must be less than or equal to 31 (0 <= tag <= 31).
111 } SCIF_SAS_STP_REQUEST_T;
114 * @struct SCIF_SAS_REQUEST
116 * @brief The SCIF_SAS_REQUEST object abstracts the common SAS
117 * IO & task management data and behavior for the framework component.
119 typedef struct SCIF_SAS_REQUEST
122 * All SAS request types (IO or Task management) have the SCI base
123 * request as their parent object.
125 SCI_BASE_REQUEST_T parent;
128 * This field references the list of state specific handler methods to
129 * be utilized for this request instance.
131 SCI_BASE_REQUEST_STATE_HANDLER_T * state_handlers;
133 SCIF_SAS_REQUEST_COMPLETION_HANDLER_T protocol_complete_handler;
136 * This field is utilized to communicate state information relating
137 * to this IO request and it's state transitions.
142 * This field represents the remote device object to which this IO
143 * request is destined.
145 struct SCIF_SAS_REMOTE_DEVICE * device;
148 * This field references the request object that has asked that this
149 * request be terminated.
151 struct SCIF_SAS_TASK_REQUEST * terminate_requestor;
154 * This field provides list specific information that enables a request
155 * to be placed in a list.
157 SCI_FAST_LIST_ELEMENT_T list_element;
160 * This field indicates if the current request is one internally
161 * generated by the framework or if it is a user IO/task request.
166 * This field indicates the current request is a high priority one.
167 * An internal request is always high priority. But an external request
168 * could be high priority.
170 BOOL is_high_priority;
173 * This field indicates the current request should not be completed
174 * until a pending abort task set request is completed. For NCQ errors,
175 * it will allow waiting until the read log ext data is returned to
176 * to determine how to fail/abort the pending ios.
178 BOOL is_waiting_for_abort_task_set;
181 * This field indicates the logical unit (LUN) for the request.
182 * This field is utilized during internal IO requests.
187 * This field specifies sata specific data for the reqeust object.
188 * This data is only valid for SATA requests.
190 SCIF_SAS_STP_REQUEST_T stp;
193 * This field contains the handle for the SCI Core request object that is
194 * managed by this framework request.
196 SCI_IO_REQUEST_HANDLE_T core_object;
198 } SCIF_SAS_REQUEST_T;
200 void scif_sas_request_construct(
201 SCIF_SAS_REQUEST_T * fw_request,
202 struct SCIF_SAS_REMOTE_DEVICE * fw_device,
203 SCI_BASE_LOGGER_T * logger,
204 SCI_BASE_STATE_T * state_table
207 SCI_STATUS scif_sas_request_terminate_start(
208 SCIF_SAS_REQUEST_T * fw_request,
209 SCI_IO_REQUEST_HANDLE_T core_request
212 void scif_sas_request_terminate_complete(
213 SCIF_SAS_REQUEST_T * fw_request
218 #endif // __cplusplus
220 #endif // _SCIF_SAS_REQUEST_H_