Commit | Line | Data |
---|---|---|
6f231dda DW |
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. | |
4 | * | |
5 | * GPL LICENSE SUMMARY | |
6 | * | |
7 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. | |
8 | * | |
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. | |
12 | * | |
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. | |
17 | * | |
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. | |
23 | * | |
24 | * BSD LICENSE | |
25 | * | |
26 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. | |
27 | * All rights reserved. | |
28 | * | |
29 | * Redistribution and use in source and binary forms, with or without | |
30 | * modification, are permitted provided that the following conditions | |
31 | * are met: | |
32 | * | |
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. | |
42 | * | |
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. | |
54 | */ | |
55 | ||
56 | #ifndef _SCIC_IO_REQUEST_H_ | |
57 | #define _SCIC_IO_REQUEST_H_ | |
58 | ||
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. | |
62 | * | |
63 | * Determine the failure situations and return values. | |
64 | */ | |
65 | ||
8694e792 | 66 | #include <linux/kernel.h> |
6f231dda | 67 | #include "sci_status.h" |
6f231dda DW |
68 | |
69 | struct scic_sds_request; | |
70 | struct scic_sds_remote_device; | |
71 | struct scic_sds_controller; | |
72 | ||
6f231dda DW |
73 | /** |
74 | * This enumeration specifies the transport protocol utilized for the request. | |
75 | * | |
76 | * | |
77 | */ | |
78 | typedef enum { | |
79 | /** | |
80 | * This enumeration constant indicates that no protocol has yet been | |
81 | * set. | |
82 | */ | |
83 | SCIC_NO_PROTOCOL, | |
84 | ||
85 | /** | |
86 | * This enumeration constant indicates that the protocol utilized | |
87 | * is the Serial Management Protocol. | |
88 | */ | |
89 | SCIC_SMP_PROTOCOL, | |
90 | ||
91 | /** | |
92 | * This enumeration constant indicates that the protocol utilized | |
93 | * is the Serial SCSI Protocol. | |
94 | */ | |
95 | SCIC_SSP_PROTOCOL, | |
96 | ||
97 | /** | |
98 | * This enumeration constant indicates that the protocol utilized | |
99 | * is the Serial-ATA Tunneling Protocol. | |
100 | */ | |
101 | SCIC_STP_PROTOCOL | |
102 | ||
103 | } SCIC_TRANSPORT_PROTOCOL; | |
104 | ||
6f231dda DW |
105 | enum sci_status scic_io_request_construct( |
106 | struct scic_sds_controller *scic_controller, | |
107 | struct scic_sds_remote_device *scic_remote_device, | |
67ea838d | 108 | u16 io_tag, struct scic_sds_request *sci_req); |
6f231dda DW |
109 | |
110 | /** | |
111 | * scic_io_request_construct_basic_ssp() - This method is called by the SCI | |
112 | * user to build an SSP IO request. | |
113 | * @scic_io_request: This parameter specifies the handle to the io request | |
114 | * object to be built. | |
115 | * | |
116 | * - The user must have previously called scic_io_request_construct() on the | |
117 | * supplied IO request. Indicate if the controller successfully built the IO | |
118 | * request. SCI_SUCCESS This value is returned if the IO request was | |
119 | * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned | |
120 | * if the remote_device does not support the SSP protocol. | |
121 | * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not | |
122 | * properly set the association between the SCIC IO request and the user's IO | |
be2f41c6 | 123 | * request. |
6f231dda DW |
124 | */ |
125 | enum sci_status scic_io_request_construct_basic_ssp( | |
126 | struct scic_sds_request *scic_io_request); | |
127 | ||
128 | ||
129 | ||
130 | ||
131 | ||
132 | /** | |
133 | * scic_io_request_construct_basic_sata() - This method is called by the SCI | |
134 | * Core user to build an STP IO request. | |
135 | * @scic_io_request: This parameter specifies the handle to the io request | |
136 | * object to be built. | |
137 | * | |
138 | * - The user must have previously called scic_io_request_construct() on the | |
139 | * supplied IO request. Indicate if the controller successfully built the IO | |
140 | * request. SCI_SUCCESS This value is returned if the IO request was | |
141 | * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned | |
142 | * if the remote_device does not support the STP protocol. | |
143 | * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not | |
144 | * properly set the association between the SCIC IO request and the user's IO | |
be2f41c6 | 145 | * request. |
6f231dda DW |
146 | */ |
147 | enum sci_status scic_io_request_construct_basic_sata( | |
148 | struct scic_sds_request *scic_io_request); | |
149 | ||
150 | ||
151 | ||
152 | ||
153 | /** | |
154 | * scic_io_request_construct_smp() - This method is called by the SCI user to | |
155 | * build an SMP IO request. | |
156 | * @scic_io_request: This parameter specifies the handle to the io request | |
157 | * object to be built. | |
158 | * | |
159 | * - The user must have previously called scic_io_request_construct() on the | |
160 | * supplied IO request. Indicate if the controller successfully built the IO | |
161 | * request. SCI_SUCCESS This value is returned if the IO request was | |
162 | * successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned | |
163 | * if the remote_device does not support the SMP protocol. | |
164 | * SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not | |
165 | * properly set the association between the SCIC IO request and the user's IO | |
be2f41c6 | 166 | * request. |
6f231dda DW |
167 | */ |
168 | enum sci_status scic_io_request_construct_smp( | |
169 | struct scic_sds_request *scic_io_request); | |
170 | ||
171 | ||
172 | ||
173 | /** | |
174 | * scic_request_get_controller_status() - This method returns the controller | |
175 | * specific IO/Task request status. These status values are unique to the | |
176 | * specific controller being managed by the SCIC. | |
177 | * @io_request: the handle to the IO or task management request object for | |
178 | * which to retrieve the status. | |
179 | * | |
180 | * This method returns a value indicating the controller specific request | |
181 | * status. | |
182 | */ | |
183 | u32 scic_request_get_controller_status( | |
184 | struct scic_sds_request *io_request); | |
185 | ||
6f231dda DW |
186 | /** |
187 | * scic_io_request_get_io_tag() - This method will return the IO tag utilized | |
188 | * by the IO request. | |
189 | * @scic_io_request: This parameter specifies the handle to the io request | |
190 | * object for which to return the IO tag. | |
191 | * | |
192 | * An unsigned integer representing the IO tag being utilized. | |
193 | * SCI_CONTROLLER_INVALID_IO_TAG This value is returned if the IO does not | |
194 | * currently have an IO tag allocated to it. All return other values indicate a | |
195 | * legitimate tag. | |
196 | */ | |
197 | u16 scic_io_request_get_io_tag( | |
198 | struct scic_sds_request *scic_io_request); | |
199 | ||
200 | ||
201 | /** | |
202 | * scic_stp_io_request_set_ncq_tag() - This method will assign an NCQ tag to | |
203 | * the io request object. The caller of this function must make sure that | |
204 | * only valid NCQ tags are assigned to the io request object. | |
205 | * @scic_io_request: This parameter specifies the handle to the io request | |
206 | * object to which to assign the ncq tag. | |
207 | * @ncq_tag: This parameter specifies the NCQ tag to be utilized for the | |
208 | * supplied core IO request. It is up to the user to make sure that this is | |
209 | * a valid NCQ tag. | |
210 | * | |
211 | * none This function is only valid for SATA NCQ requests. | |
212 | */ | |
213 | void scic_stp_io_request_set_ncq_tag( | |
214 | struct scic_sds_request *scic_io_request, | |
215 | u16 ncq_tag); | |
216 | ||
6f231dda DW |
217 | /** |
218 | * scic_io_request_get_number_of_bytes_transferred() - This method will return | |
219 | * the number of bytes transferred from the SCU | |
220 | * @scic_io_request: This parameter specifies the handle to the io request | |
221 | * whose data length was not eqaul to the data length specified in the | |
222 | * request. When the driver gets an early io completion status from the | |
223 | * hardware, this routine should be called to get the actual number of bytes | |
224 | * transferred | |
225 | * | |
226 | * The return is the number of bytes transferred when the data legth is not | |
227 | * equal to the specified length in the io request | |
228 | */ | |
229 | u32 scic_io_request_get_number_of_bytes_transferred( | |
230 | struct scic_sds_request *scic_io_request); | |
231 | ||
232 | ||
233 | #endif /* _SCIC_IO_REQUEST_H_ */ | |
234 |