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
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_
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.
67 #include "sci_types.h"
68 #include "sci_status.h"
69 #include "intel_sas.h"
71 struct scic_sds_request;
72 struct scic_sds_remote_device;
73 struct scic_sds_controller;
76 * struct scic_io_parameters - This structure contains additional optional
77 * parameters for SSP IO requests. These parameters are utilized with the
78 * scic_io_request_construct_advanced_ssp() method.
80 * Add Block-guard/DIF, TLR
82 struct scic_io_parameters {
84 * This sub-structure contains SCSI specific features (for use with SSP
89 * Data Integrity Format (DIF) is also known as protection information
90 * or block-guard. This sub-structure contains DIF specific feature
91 * information for SSP IO requests.
98 * Transport Layer Retries (TLR) is an SSP protocol specific feature.
99 * This sub-structure contains Transport Layer Retries (TLR) specific
100 * feature information for SSP IO requests.
111 * struct scic_passthru_request_callbacks - This structure contains the pointer
112 * to the callback functions for constructing the passthrough request common
113 * to SSP, SMP and STP. This structure must be set by the win sci layer
114 * before the passthrough build is called
118 struct scic_passthru_request_callbacks {
120 * Function pointer to get the phy identifier for passthrough request.
122 u32 (*scic_cb_passthru_get_phy_identifier)(void *, u8 *);
124 * Function pointer to get the port identifier for passthrough request.
126 u32 (*scic_cb_passthru_get_port_identifier)(void *, u8 *);
128 * Function pointer to get the connection rate for passthrough request.
130 u32 (*scic_cb_passthru_get_connection_rate)(void *, void *);
132 * Function pointer to get the destination sas address for passthrough request.
134 void (*scic_cb_passthru_get_destination_sas_address)(void *, u8 **);
136 * Function pointer to get the transfer length for passthrough request.
138 u32 (*scic_cb_passthru_get_transfer_length)(void *);
140 * Function pointer to get the data direction for passthrough request.
142 u32 (*scic_cb_passthru_get_data_direction)(void *);
147 * struct scic_ssp_passthru_request_callbacks - This structure contains the
148 * pointer to the callback functions for constructing the passthrough
149 * request specific to SSP. This structure must be set by the win sci layer
150 * before the passthrough build is called
154 struct scic_ssp_passthru_request_callbacks {
156 * Common callbacks for all Passthru requests
158 struct scic_passthru_request_callbacks common_callbacks;
160 * Function pointer to get the lun for passthrough request.
162 void (*scic_cb_ssp_passthru_get_lun)(void *, u8 **);
164 * Function pointer to get the cdb
166 void (*scic_cb_ssp_passthru_get_cdb)(void *, u32 *, u8 **, u32 *, u8 **);
168 * Function pointer to get the task attribute for passthrough request.
170 u32 (*scic_cb_ssp_passthru_get_task_attribute)(void *);
174 * struct scic_stp_passthru_request_callbacks - This structure contains the
175 * pointer to the callback functions for constructing the passthrough
176 * request specific to STP. This structure must be set by the win sci layer
177 * before the passthrough build is called
181 struct scic_stp_passthru_request_callbacks {
183 * Common callbacks for all Passthru requests
185 struct scic_passthru_request_callbacks common_callbacks;
187 * Function pointer to get the protocol for passthrough request.
189 u8 (*scic_cb_stp_passthru_get_protocol)(void *);
191 * Function pointer to get the resgister fis
193 void (*scic_cb_stp_passthru_get_register_fis)(void *, u8 **);
195 * Function pointer to get the MULTIPLE_COUNT (bits 5,6,7 in Byte 1 in the SAT-specific SCSI extenstion in ATA Pass-through (0x85))
197 u8 (*scic_cb_stp_passthru_get_multiplecount)(void *);
199 * Function pointer to get the EXTEND (bit 0 in Byte 1 the SAT-specific SCSI extenstion in ATA Pass-through (0x85))
201 u8 (*scic_cb_stp_passthru_get_extend)(void *);
203 * Function pointer to get the CK_COND (bit 5 in Byte 2 the SAT-specific SCSI extenstion in ATA Pass-through (0x85))
205 u8 (*scic_cb_stp_passthru_get_ckcond)(void *);
207 * Function pointer to get the T_DIR (bit 3 in Byte 2 the SAT-specific SCSI extenstion in ATA Pass-through (0x85))
209 u8 (*scic_cb_stp_passthru_get_tdir)(void *);
211 * Function pointer to get the BYTE_BLOCK (bit 2 in Byte 2 the SAT-specific SCSI extenstion in ATA Pass-through (0x85))
213 u8 (*scic_cb_stp_passthru_get_byteblock)(void *);
215 * Function pointer to get the T_LENGTH (bits 0,1 in Byte 2 the SAT-specific SCSI extenstion in ATA Pass-through (0x85))
217 u8 (*scic_cb_stp_passthru_get_tlength)(void *);
222 * struct scic_smp_passthru_request_callbacks - This structure contains the
223 * pointer to the callback functions for constructing the passthrough
224 * request specific to SMP. This structure must be set by the win sci layer
225 * before the passthrough build is called
229 struct scic_smp_passthru_request_callbacks {
231 * Common callbacks for all Passthru requests
233 struct scic_passthru_request_callbacks common_callbacks;
236 * Function pointer to get the length of the smp request and its length
238 u32 (*scic_cb_smp_passthru_get_request)(void *, u8 **);
240 * Function pointer to get the frame type of the smp request
242 u8 (*scic_cb_smp_passthru_get_frame_type)(void *);
244 * Function pointer to get the function in the the smp request
246 u8 (*scic_cb_smp_passthru_get_function)(void *);
249 * Function pointer to get the "allocated response length" in the the smp request
251 u8 (*scic_cb_smp_passthru_get_allocated_response_length)(void *);
256 * This enumeration specifies the transport protocol utilized for the request.
262 * This enumeration constant indicates that no protocol has yet been
268 * This enumeration constant indicates that the protocol utilized
269 * is the Serial Management Protocol.
274 * This enumeration constant indicates that the protocol utilized
275 * is the Serial SCSI Protocol.
280 * This enumeration constant indicates that the protocol utilized
281 * is the Serial-ATA Tunneling Protocol.
285 } SCIC_TRANSPORT_PROTOCOL;
289 * scic_io_request_get_object_size() - This method simply returns the size
290 * required to build an SCI based IO request object.
292 * Return the size of the SCI IO request object.
294 u32 scic_io_request_get_object_size(
298 * scic_io_request_construct() - This method is called by the SCI user to
299 * construct all SCI Core IO requests. Memory initialization and
300 * functionality common to all IO request types is performed in this method.
301 * @scic_controller: the handle to the core controller object for which to
302 * build an IO request.
303 * @scic_remote_device: the handle to the core remote device object for which
304 * to build an IO request.
305 * @io_tag: This parameter specifies the IO tag to be associated with this
306 * request. If SCI_CONTROLLER_INVALID_IO_TAG is passed, then a copy of the
307 * request is built internally. The request will be copied into the actual
308 * controller request memory when the IO tag is allocated internally during
309 * the scic_controller_start_io() method.
310 * @user_io_request_object: This parameter specifies the user IO request to be
311 * utilized during IO construction. This IO pointer will become the
312 * associated object for the core IO request object.
313 * @scic_io_request_memory: This parameter specifies the memory location to be
314 * utilized when building the core request.
315 * @new_scic_io_request_handle: This parameter specifies a pointer to the
316 * handle the core will expect in further interactions with the core IO
319 * The SCI core implementation will create an association between the user IO
320 * request object and the core IO request object. Indicate if the controller
321 * successfully built the IO request. SCI_SUCCESS This value is returned if the
322 * IO request was successfully built.
324 enum sci_status scic_io_request_construct(
325 struct scic_sds_controller *scic_controller,
326 struct scic_sds_remote_device *scic_remote_device,
328 void *user_io_request_object,
329 void *scic_io_request_memory,
330 struct scic_sds_request **new_scic_io_request_handle);
333 * scic_io_request_construct_basic_ssp() - This method is called by the SCI
334 * user to build an SSP IO request.
335 * @scic_io_request: This parameter specifies the handle to the io request
336 * object to be built.
338 * - The user must have previously called scic_io_request_construct() on the
339 * supplied IO request. Indicate if the controller successfully built the IO
340 * request. SCI_SUCCESS This value is returned if the IO request was
341 * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
342 * if the remote_device does not support the SSP protocol.
343 * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
344 * properly set the association between the SCIC IO request and the user's IO
345 * request. Please refer to the sci_object_set_association() routine for more
348 enum sci_status scic_io_request_construct_basic_ssp(
349 struct scic_sds_request *scic_io_request);
356 * scic_io_request_construct_basic_sata() - This method is called by the SCI
357 * Core user to build an STP IO request.
358 * @scic_io_request: This parameter specifies the handle to the io request
359 * object to be built.
361 * - The user must have previously called scic_io_request_construct() on the
362 * supplied IO request. Indicate if the controller successfully built the IO
363 * request. SCI_SUCCESS This value is returned if the IO request was
364 * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
365 * if the remote_device does not support the STP protocol.
366 * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
367 * properly set the association between the SCIC IO request and the user's IO
368 * request. Please refer to the sci_object_set_association() routine for more
371 enum sci_status scic_io_request_construct_basic_sata(
372 struct scic_sds_request *scic_io_request);
378 * scic_io_request_construct_smp() - This method is called by the SCI user to
379 * build an SMP IO request.
380 * @scic_io_request: This parameter specifies the handle to the io request
381 * object to be built.
383 * - The user must have previously called scic_io_request_construct() on the
384 * supplied IO request. Indicate if the controller successfully built the IO
385 * request. SCI_SUCCESS This value is returned if the IO request was
386 * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
387 * if the remote_device does not support the SMP protocol.
388 * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
389 * properly set the association between the SCIC IO request and the user's IO
390 * request. Please refer to the sci_object_set_association() routine for more
393 enum sci_status scic_io_request_construct_smp(
394 struct scic_sds_request *scic_io_request);
399 * scic_request_get_controller_status() - This method returns the controller
400 * specific IO/Task request status. These status values are unique to the
401 * specific controller being managed by the SCIC.
402 * @io_request: the handle to the IO or task management request object for
403 * which to retrieve the status.
405 * This method returns a value indicating the controller specific request
408 u32 scic_request_get_controller_status(
409 struct scic_sds_request *io_request);
414 * scic_io_request_get_command_iu_address() - This method will return the
415 * address to the command information unit.
416 * @scic_io_request: This parameter specifies the handle to the io request
417 * object to be built.
419 * The address of the SSP/SMP command information unit.
421 void *scic_io_request_get_command_iu_address(
422 struct scic_sds_request *scic_io_request);
425 * scic_io_request_get_response_iu_address() - This method will return the
426 * address to the response information unit. For an SSP request this buffer
427 * is only valid if the IO request is completed with the status
428 * SCI_FAILURE_IO_RESPONSE_VALID.
429 * @scic_io_request: This parameter specifies the handle to the io request
430 * object to be built.
432 * The address of the SSP/SMP response information unit.
434 void *scic_io_request_get_response_iu_address(
435 struct scic_sds_request *scic_io_request);
438 * scic_io_request_get_io_tag() - This method will return the IO tag utilized
440 * @scic_io_request: This parameter specifies the handle to the io request
441 * object for which to return the IO tag.
443 * An unsigned integer representing the IO tag being utilized.
444 * SCI_CONTROLLER_INVALID_IO_TAG This value is returned if the IO does not
445 * currently have an IO tag allocated to it. All return other values indicate a
448 u16 scic_io_request_get_io_tag(
449 struct scic_sds_request *scic_io_request);
453 * scic_stp_io_request_set_ncq_tag() - This method will assign an NCQ tag to
454 * the io request object. The caller of this function must make sure that
455 * only valid NCQ tags are assigned to the io request object.
456 * @scic_io_request: This parameter specifies the handle to the io request
457 * object to which to assign the ncq tag.
458 * @ncq_tag: This parameter specifies the NCQ tag to be utilized for the
459 * supplied core IO request. It is up to the user to make sure that this is
462 * none This function is only valid for SATA NCQ requests.
464 void scic_stp_io_request_set_ncq_tag(
465 struct scic_sds_request *scic_io_request,
469 * scic_stp_io_request_get_h2d_reg_address() - This method will return the
470 * address of the host to device register fis region for the io request
472 * @scic_io_request: This parameter specifies the handle to the io request
473 * object from which to get the host to device register fis buffer.
475 * The address of the host to device register fis buffer in the io request
476 * object. This function is only valid for SATA requests.
478 void *scic_stp_io_request_get_h2d_reg_address(
479 struct scic_sds_request *scic_io_request);
482 * scic_stp_io_request_get_d2h_reg_address() - This method will return the
483 * address of the device to host register fis region for the io request
485 * @scic_io_request: This parameter specifies teh handle to the io request
486 * object from which to get the device to host register fis buffer.
488 * The address fo the device to host register fis ending the io request. This
489 * function is only valid for SATA requests.
491 void *scic_stp_io_request_get_d2h_reg_address(
492 struct scic_sds_request *scic_io_request);
496 * scic_io_request_get_number_of_bytes_transferred() - This method will return
497 * the number of bytes transferred from the SCU
498 * @scic_io_request: This parameter specifies the handle to the io request
499 * whose data length was not eqaul to the data length specified in the
500 * request. When the driver gets an early io completion status from the
501 * hardware, this routine should be called to get the actual number of bytes
504 * The return is the number of bytes transferred when the data legth is not
505 * equal to the specified length in the io request
507 u32 scic_io_request_get_number_of_bytes_transferred(
508 struct scic_sds_request *scic_io_request);
511 #endif /* _SCIC_IO_REQUEST_H_ */