isci: removing intel_*.h headers
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / scsi / isci / core / scic_io_request.h
blob6ddf3801daf8798d96a55cf4f00c567fb53a1a5e
1 /*
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.
5 * GPL LICENSE SUMMARY
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.
24 * BSD LICENSE
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
31 * are met:
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
38 * distribution.
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SCIC_IO_REQUEST_H_
57 #define _SCIC_IO_REQUEST_H_
59 /**
60 * This file contains the structures and interface methods that can be
61 * referenced and used by the SCI user for the SCI IO request object.
63 * Determine the failure situations and return values.
66 #include <linux/kernel.h>
67 #include "sci_status.h"
69 struct scic_sds_request;
70 struct scic_sds_remote_device;
71 struct scic_sds_controller;
73 /**
74 * This enumeration specifies the transport protocol utilized for the request.
78 typedef enum {
79 /**
80 * This enumeration constant indicates that no protocol has yet been
81 * set.
83 SCIC_NO_PROTOCOL,
85 /**
86 * This enumeration constant indicates that the protocol utilized
87 * is the Serial Management Protocol.
89 SCIC_SMP_PROTOCOL,
91 /**
92 * This enumeration constant indicates that the protocol utilized
93 * is the Serial SCSI Protocol.
95 SCIC_SSP_PROTOCOL,
97 /**
98 * This enumeration constant indicates that the protocol utilized
99 * is the Serial-ATA Tunneling Protocol.
101 SCIC_STP_PROTOCOL
103 } SCIC_TRANSPORT_PROTOCOL;
107 * scic_io_request_get_object_size() - This method simply returns the size
108 * required to build an SCI based IO request object.
110 * Return the size of the SCI IO request object.
112 u32 scic_io_request_get_object_size(void);
115 * scic_io_request_construct() - This method is called by the SCI user to
116 * construct all SCI Core IO requests. Memory initialization and
117 * functionality common to all IO request types is performed in this method.
118 * @scic_controller: the handle to the core controller object for which to
119 * build an IO request.
120 * @scic_remote_device: the handle to the core remote device object for which
121 * to build an IO request.
122 * @io_tag: This parameter specifies the IO tag to be associated with this
123 * request. If SCI_CONTROLLER_INVALID_IO_TAG is passed, then a copy of the
124 * request is built internally. The request will be copied into the actual
125 * controller request memory when the IO tag is allocated internally during
126 * the scic_controller_start_io() method.
127 * @user_io_request_object: This parameter specifies the user IO request to be
128 * utilized during IO construction. This IO pointer will become the
129 * associated object for the core IO request object.
130 * @scic_io_request_memory: This parameter specifies the memory location to be
131 * utilized when building the core request.
132 * @new_scic_io_request_handle: This parameter specifies a pointer to the
133 * handle the core will expect in further interactions with the core IO
134 * request object.
136 * The SCI core implementation will create an association between the user IO
137 * request object and the core IO request object. Indicate if the controller
138 * successfully built the IO request. SCI_SUCCESS This value is returned if the
139 * IO request was successfully built.
141 enum sci_status scic_io_request_construct(
142 struct scic_sds_controller *scic_controller,
143 struct scic_sds_remote_device *scic_remote_device,
144 u16 io_tag,
145 void *user_io_request_object,
146 struct scic_sds_request *scic_io_request_memory,
147 struct scic_sds_request **new_scic_io_request_handle);
150 * scic_io_request_construct_basic_ssp() - This method is called by the SCI
151 * user to build an SSP IO request.
152 * @scic_io_request: This parameter specifies the handle to the io request
153 * object to be built.
155 * - The user must have previously called scic_io_request_construct() on the
156 * supplied IO request. Indicate if the controller successfully built the IO
157 * request. SCI_SUCCESS This value is returned if the IO request was
158 * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
159 * if the remote_device does not support the SSP protocol.
160 * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
161 * properly set the association between the SCIC IO request and the user's IO
162 * request.
164 enum sci_status scic_io_request_construct_basic_ssp(
165 struct scic_sds_request *scic_io_request);
172 * scic_io_request_construct_basic_sata() - This method is called by the SCI
173 * Core user to build an STP IO request.
174 * @scic_io_request: This parameter specifies the handle to the io request
175 * object to be built.
177 * - The user must have previously called scic_io_request_construct() on the
178 * supplied IO request. Indicate if the controller successfully built the IO
179 * request. SCI_SUCCESS This value is returned if the IO request was
180 * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
181 * if the remote_device does not support the STP protocol.
182 * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
183 * properly set the association between the SCIC IO request and the user's IO
184 * request.
186 enum sci_status scic_io_request_construct_basic_sata(
187 struct scic_sds_request *scic_io_request);
193 * scic_io_request_construct_smp() - This method is called by the SCI user to
194 * build an SMP IO request.
195 * @scic_io_request: This parameter specifies the handle to the io request
196 * object to be built.
198 * - The user must have previously called scic_io_request_construct() on the
199 * supplied IO request. Indicate if the controller successfully built the IO
200 * request. SCI_SUCCESS This value is returned if the IO request was
201 * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
202 * if the remote_device does not support the SMP protocol.
203 * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
204 * properly set the association between the SCIC IO request and the user's IO
205 * request.
207 enum sci_status scic_io_request_construct_smp(
208 struct scic_sds_request *scic_io_request);
213 * scic_request_get_controller_status() - This method returns the controller
214 * specific IO/Task request status. These status values are unique to the
215 * specific controller being managed by the SCIC.
216 * @io_request: the handle to the IO or task management request object for
217 * which to retrieve the status.
219 * This method returns a value indicating the controller specific request
220 * status.
222 u32 scic_request_get_controller_status(
223 struct scic_sds_request *io_request);
228 * scic_io_request_get_command_iu_address() - This method will return the
229 * address to the command information unit.
230 * @scic_io_request: This parameter specifies the handle to the io request
231 * object to be built.
233 * The address of the SSP/SMP command information unit.
235 void *scic_io_request_get_command_iu_address(
236 struct scic_sds_request *scic_io_request);
239 * scic_io_request_get_response_iu_address() - This method will return the
240 * address to the response information unit. For an SSP request this buffer
241 * is only valid if the IO request is completed with the status
242 * SCI_FAILURE_IO_RESPONSE_VALID.
243 * @scic_io_request: This parameter specifies the handle to the io request
244 * object to be built.
246 * The address of the SSP/SMP response information unit.
248 void *scic_io_request_get_response_iu_address(
249 struct scic_sds_request *scic_io_request);
252 * scic_io_request_get_io_tag() - This method will return the IO tag utilized
253 * by the IO request.
254 * @scic_io_request: This parameter specifies the handle to the io request
255 * object for which to return the IO tag.
257 * An unsigned integer representing the IO tag being utilized.
258 * SCI_CONTROLLER_INVALID_IO_TAG This value is returned if the IO does not
259 * currently have an IO tag allocated to it. All return other values indicate a
260 * legitimate tag.
262 u16 scic_io_request_get_io_tag(
263 struct scic_sds_request *scic_io_request);
267 * scic_stp_io_request_set_ncq_tag() - This method will assign an NCQ tag to
268 * the io request object. The caller of this function must make sure that
269 * only valid NCQ tags are assigned to the io request object.
270 * @scic_io_request: This parameter specifies the handle to the io request
271 * object to which to assign the ncq tag.
272 * @ncq_tag: This parameter specifies the NCQ tag to be utilized for the
273 * supplied core IO request. It is up to the user to make sure that this is
274 * a valid NCQ tag.
276 * none This function is only valid for SATA NCQ requests.
278 void scic_stp_io_request_set_ncq_tag(
279 struct scic_sds_request *scic_io_request,
280 u16 ncq_tag);
283 * scic_stp_io_request_get_h2d_reg_address() - This method will return the
284 * address of the host to device register fis region for the io request
285 * object.
286 * @scic_io_request: This parameter specifies the handle to the io request
287 * object from which to get the host to device register fis buffer.
289 * The address of the host to device register fis buffer in the io request
290 * object. This function is only valid for SATA requests.
292 void *scic_stp_io_request_get_h2d_reg_address(
293 struct scic_sds_request *scic_io_request);
296 * scic_stp_io_request_get_d2h_reg_address() - This method will return the
297 * address of the device to host register fis region for the io request
298 * object.
299 * @scic_io_request: This parameter specifies teh handle to the io request
300 * object from which to get the device to host register fis buffer.
302 * The address fo the device to host register fis ending the io request. This
303 * function is only valid for SATA requests.
305 void *scic_stp_io_request_get_d2h_reg_address(
306 struct scic_sds_request *scic_io_request);
310 * scic_io_request_get_number_of_bytes_transferred() - This method will return
311 * the number of bytes transferred from the SCU
312 * @scic_io_request: This parameter specifies the handle to the io request
313 * whose data length was not eqaul to the data length specified in the
314 * request. When the driver gets an early io completion status from the
315 * hardware, this routine should be called to get the actual number of bytes
316 * transferred
318 * The return is the number of bytes transferred when the data legth is not
319 * equal to the specified length in the io request
321 u32 scic_io_request_get_number_of_bytes_transferred(
322 struct scic_sds_request *scic_io_request);
325 #endif /* _SCIC_IO_REQUEST_H_ */