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_IO_REQUEST_H_
55 #define _SCIF_IO_REQUEST_H_
60 * @brief This file contains the structures and interface methods that
61 * can be referenced and used by the SCI user for the SCI IO request
69 #include <dev/isci/scil/sci_types.h>
70 #include <dev/isci/scil/sci_status.h>
74 * @brief This method simply returns the size required to construct an SCI
75 * based IO request object (includes core & framework object size).
77 * @return Return the size of the SCI IO request object.
79 U32 scif_io_request_get_object_size(
84 * @brief This method simply the number of data bytes transferred for a
85 * STP or SSP io request.
87 * @param[in] scif_io_request This parameter specifies the framework IO
88 * handle to retrieve the number of data bytes transferred.
90 * @return Return the number of data bytes transferred by the io request
92 U32 scif_io_request_get_number_of_bytes_transferred(
93 void * scif_io_request
97 * @brief This method is called by the SCIF user to construct an IO request.
98 * This method will construct a SCIC IO request internally. The memory
99 * for the core IO request is passed as a parameter to this method.
101 * @note The SCI framework implementation will create an association between
102 * the user IO request object and the framework IO request object.
104 * @param[in] scif_controller the handle to the framework controller object
105 * for which to build an IO request.
106 * @param[in] scif_remote_device This parameter specifies the framework
107 * remote device with which this IO request is to be associated.
108 * @param[in] io_tag This parameter specifies the IO tag to be associated
109 * with this request. If SCI_CONTROLLER_INVALID_IO_TAG is
110 * passed, then a copy of the request is built internally. The
111 * request will be copied into the actual controller request
112 * memory when the IO tag is allocated internally during the
113 * scif_controller_start_io() method.
114 * @param[in] user_io_request_object This parameter specifies the user
115 * IO request to be utilized during IO construction. This IO
116 * pointer will become the associated object for the framework
118 * @param[in] io_request_memory This parameter specifies the memory
119 * to be utilized in the construction of the framework IO request.
120 * @param[in] scif_io_request This parameter specifies the handle to be
121 * utilized for all further interactions with this IO request
124 * @return Indicate if the controller successfully built the IO request.
125 * @retval SCI_SUCCESS This value is returned if the IO request was
126 * successfully built.
128 SCI_STATUS scif_io_request_construct(
129 SCI_CONTROLLER_HANDLE_T scif_controller,
130 SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device,
132 void * user_io_request_object,
133 void * io_request_memory,
134 SCI_IO_REQUEST_HANDLE_T * scif_io_request
138 * @brief This method simply returns the SCI Core object handle that is
139 * associated with the supplied SCI Framework object.
141 * @param[in] scif_io_request This parameter specifies the framework IO
142 * for which to return the associated core IO request object.
144 * @return This method returns a handle to the core IO request object
145 * associated with the framework IO request object.
146 * @retval SCI_INVALID_HANDLE This return value indicates that the SCI Core
147 * IO request handle for the supplied framework IO is invalid.
149 SCI_IO_REQUEST_HANDLE_T scif_io_request_get_scic_handle(
150 SCI_IO_REQUEST_HANDLE_T scif_io_request
154 * @brief This method returns the address of the response information unit.
155 * This call is only valid if the completion status for the io request
156 * is SCI_FAILURE_IO_RESPONSE_VALID.
158 * @param[in] scif_io_request This parameter specifies the framework IO
159 * for which to return the associated core IO request object.
161 * @return The address for the response information unit.
163 void * scif_io_request_get_response_iu_address(
164 SCI_IO_REQUEST_HANDLE_T scif_io_request
168 * @brief This method will build an Framework SSP Passthrough IO request based
169 * on the user information supplied in the pass-through IO request object.
170 * In case of pass through request construction, the driver creates the
171 * sci core request object and pass that to the framework
175 * @param[in] scif_controller. Not used in the function but kept to maintain uniformity
176 * with other io construct functions
177 * @param[in] scif_remote_device. This parameter is the device.
178 * @param[in] scic_io_request. This parameter is the scic request already constructed
179 * @param[in] user_io_request_object, the user io request
180 * @param[in] io_request_memory, the scif offset in the user_io_request_object.
182 * @param[out] the contructed scif request. This points to the same location as io_request_memory
184 * @return Indicate if framework IO request is successfully built.
185 * @retval SCI_SUCCESS This value is returned if the IO request was
186 * successfully built.
188 SCI_STATUS scif_io_request_construct_with_core (
189 SCI_CONTROLLER_HANDLE_T scif_controller,
190 SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device,
191 void * scic_io_request,
192 void * user_io_request_object,
193 void * io_request_memory,
194 SCI_IO_REQUEST_HANDLE_T * scif_io_request
198 * @brief This method will build the basic scif and scic io request object based
199 * on the user information supplied in the pass-through IO request object.
200 * This function will not build the protocol specific part of the request
201 * but set up the memory areas of scif and scic set the association.
205 * @param[in] scif_controller the handle to the framework controller object
206 * for which to build an IO request.
207 * @param[in] scif_remote_device This parameter specifies the framework
208 * remote device with which this IO request is to be associated.
209 * @param[in] io_tag This parameter specifies the IO tag to be associated
210 * with this request. If SCI_CONTROLLER_INVALID_IO_TAG is
211 * passed, then a copy of the request is built internally. The
212 * request will be copied into the actual controller request
213 * memory when the IO tag is allocated internally during the
214 * scif_controller_start_io() method.
215 * @param[in] user_io_request_object This parameter specifies the user
216 * IO request to be utilized during IO construction. This IO
217 * pointer will become the associated object for the framework
219 * @param[in] io_request_memory This parameter specifies the memory
220 * to be utilized in the construction of the framework IO request.
221 * @param[in] scif_io_request This parameter specifies the handle to be
222 * utilized for all further interactions with this IO request
225 * @return Indicate if the controller successfully built the IO request.
226 * @retval SCI_SUCCESS This value is returned if the IO request was
227 * successfully built.
229 SCI_STATUS scif_request_construct(
230 SCI_CONTROLLER_HANDLE_T scif_controller,
231 SCI_REMOTE_DEVICE_HANDLE_T scif_remote_device,
233 void * user_io_request_object,
234 void * io_request_memory,
235 SCI_IO_REQUEST_HANDLE_T * scif_io_request
240 #endif // __cplusplus
242 #endif // _SCIF_IO_REQUEST_H_