isci: Intel(R) C600 Series Chipset Storage Control Unit Driver
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / scsi / isci / core / sci_status.h
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 _SCI_STATUS_H_
57 #define _SCI_STATUS_H_
58
59 /**
60  * This file contains all of the return status codes utilized across the
61  *    various sub-components in SCI.
62  *
63  *
64  */
65
66
67 /**
68  * enum _SCI_STATUS - This is the general return status enumeration for non-IO,
69  *    non-task management related SCI interface methods.
70  *
71  *
72  */
73 enum sci_status {
74         /**
75          * This member indicates successful completion.
76          */
77         SCI_SUCCESS = 0,
78
79         /**
80          * This value indicates that the calling method completed successfully,
81          * but that the IO may have completed before having it's start method
82          * invoked.  This occurs during SAT translation for requests that do
83          * not require an IO to the target or for any other requests that may
84          * be completed without having to submit IO.
85          */
86         SCI_SUCCESS_IO_COMPLETE_BEFORE_START,
87
88         /**
89          *  This Value indicates that the SCU hardware returned an early response
90          *  because the io request specified more data than is returned by the
91          *  target device (mode pages, inquiry data, etc.). The completion routine
92          *  will handle this case to get the actual number of bytes transferred.
93          */
94         SCI_SUCCESS_IO_DONE_EARLY,
95
96         /**
97          * This member indicates that the object for which a state change is
98          * being requested is already in said state.
99          */
100         SCI_WARNING_ALREADY_IN_STATE,
101
102         /**
103          * This member indicates interrupt coalescence timer may cause SAS
104          * specification compliance issues (i.e. SMP target mode response
105          * frames must be returned within 1.9 milliseconds).
106          */
107         SCI_WARNING_TIMER_CONFLICT,
108
109         /**
110          * This field indicates a sequence of action is not completed yet. Mostly,
111          * this status is used when multiple ATA commands are needed in a SATI translation.
112          */
113         SCI_WARNING_SEQUENCE_INCOMPLETE,
114
115         /**
116          * This member indicates that there was a general failure.
117          */
118         SCI_FAILURE,
119
120         /**
121          * This member indicates that the SCI implementation is unable to complete
122          * an operation due to a critical flaw the prevents any further operation
123          * (i.e. an invalid pointer).
124          */
125         SCI_FATAL_ERROR,
126
127         /**
128          * This member indicates the calling function failed, because the state
129          * of the controller is in a state that prevents successful completion.
130          */
131         SCI_FAILURE_INVALID_STATE,
132
133         /**
134          * This member indicates the calling function failed, because there is
135          * insufficient resources/memory to complete the request.
136          */
137         SCI_FAILURE_INSUFFICIENT_RESOURCES,
138
139         /**
140          * This member indicates the calling function failed, because the
141          * controller object required for the operation can't be located.
142          */
143         SCI_FAILURE_CONTROLLER_NOT_FOUND,
144
145         /**
146          * This member indicates the calling function failed, because the
147          * discovered controller type is not supported by the library.
148          */
149         SCI_FAILURE_UNSUPPORTED_CONTROLLER_TYPE,
150
151         /**
152          * This member indicates the calling function failed, because the
153          * requested initialization data version isn't supported.
154          */
155         SCI_FAILURE_UNSUPPORTED_INIT_DATA_VERSION,
156
157         /**
158          * This member indicates the calling function failed, because the
159          * requested configuration of SAS Phys into SAS Ports is not supported.
160          */
161         SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION,
162
163         /**
164          * This member indicates the calling function failed, because the
165          * requested protocol is not supported by the remote device, port,
166          * or controller.
167          */
168         SCI_FAILURE_UNSUPPORTED_PROTOCOL,
169
170         /**
171          * This member indicates the calling function failed, because the
172          * requested information type is not supported by the SCI implementation.
173          */
174         SCI_FAILURE_UNSUPPORTED_INFORMATION_TYPE,
175
176         /**
177          * This member indicates the calling function failed, because the
178          * device already exists.
179          */
180         SCI_FAILURE_DEVICE_EXISTS,
181
182         /**
183          * This member indicates the calling function failed, because adding
184          * a phy to the object is not possible.
185          */
186         SCI_FAILURE_ADDING_PHY_UNSUPPORTED,
187
188         /**
189          * This member indicates the calling function failed, because the
190          * requested information type is not supported by the SCI implementation.
191          */
192         SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD,
193
194         /**
195          * This member indicates the calling function failed, because the SCI
196          * implementation does not support the supplied time limit.
197          */
198         SCI_FAILURE_UNSUPPORTED_TIME_LIMIT,
199
200         /**
201          * This member indicates the calling method failed, because the SCI
202          * implementation does not contain the specified Phy.
203          */
204         SCI_FAILURE_INVALID_PHY,
205
206         /**
207          * This member indicates the calling method failed, because the SCI
208          * implementation does not contain the specified Port.
209          */
210         SCI_FAILURE_INVALID_PORT,
211
212         /**
213          * This member indicates the calling method was partly successful
214          * The port was reset but not all phys in port are operational
215          */
216         SCI_FAILURE_RESET_PORT_PARTIAL_SUCCESS,
217
218         /**
219          * This member indicates that calling method failed
220          * The port reset did not complete because none of the phys are operational
221          */
222         SCI_FAILURE_RESET_PORT_FAILURE,
223
224         /**
225          * This member indicates the calling method failed, because the SCI
226          * implementation does not contain the specified remote device.
227          */
228         SCI_FAILURE_INVALID_REMOTE_DEVICE,
229
230         /**
231          * This member indicates the calling method failed, because the remote
232          * device is in a bad state and requires a reset.
233          */
234         SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED,
235
236         /**
237          * This member indicates the calling method failed, because the SCI
238          * implementation does not contain or support the specified IO tag.
239          */
240         SCI_FAILURE_INVALID_IO_TAG,
241
242         /**
243          * This member indicates that the operation failed and the user should
244          * check the response data associated with the IO.
245          */
246         SCI_FAILURE_IO_RESPONSE_VALID,
247
248         /**
249          * This member indicates that the operation failed, the failure is
250          * controller implementation specific, and the response data associated
251          * with the request is not valid.  You can query for the controller
252          * specific error information via scic_controller_get_request_status()
253          */
254         SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR,
255
256         /**
257          * This member indicated that the operation failed because the
258          * user requested this IO to be terminated.
259          */
260         SCI_FAILURE_IO_TERMINATED,
261
262         /**
263          * This member indicates that the operation failed and the associated
264          * request requires a SCSI abort task to be sent to the target.
265          */
266         SCI_FAILURE_IO_REQUIRES_SCSI_ABORT,
267
268         /**
269          * This member indicates that the operation failed because the supplied
270          * device could not be located.
271          */
272         SCI_FAILURE_DEVICE_NOT_FOUND,
273
274         /**
275          * This member indicates that the operation failed because the
276          * objects association is required and is not correctly set.
277          */
278         SCI_FAILURE_INVALID_ASSOCIATION,
279
280         /**
281          * This member indicates that the operation failed, because a timeout
282          * occurred.
283          */
284         SCI_FAILURE_TIMEOUT,
285
286         /**
287          * This member indicates that the operation failed, because the user
288          * specified a value that is either invalid or not supported.
289          */
290         SCI_FAILURE_INVALID_PARAMETER_VALUE,
291
292         /**
293          * This value indicates that the operation failed, because the number
294          * of messages (MSI-X) is not supported.
295          */
296         SCI_FAILURE_UNSUPPORTED_MESSAGE_COUNT,
297
298         /**
299          * This value indicates that the method failed due to a lack of
300          * available NCQ tags.
301          */
302         SCI_FAILURE_NO_NCQ_TAG_AVAILABLE,
303
304         /**
305          * This value indicates that a protocol violation has occurred on the
306          * link.
307          */
308         SCI_FAILURE_PROTOCOL_VIOLATION,
309
310         /**
311          * This value indicates a failure condition that retry may help to clear.
312          */
313         SCI_FAILURE_RETRY_REQUIRED,
314
315         /**
316          * This field indicates the retry limit was reached when a retry is attempted
317          */
318         SCI_FAILURE_RETRY_LIMIT_REACHED,
319
320         /**
321          * This member indicates the calling method was partly successful.
322          * Mostly, this status is used when a LUN_RESET issued to an expander attached
323          * STP device in READY NCQ substate needs to have RNC suspended/resumed
324          * before posting TC.
325          */
326         SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS,
327
328         /**
329          * This field indicates an illegal phy connection based on the routing attribute
330          * of both expander phy attached to each other.
331          */
332         SCI_FAILURE_ILLEGAL_ROUTING_ATTRIBUTE_CONFIGURATION,
333
334         /**
335          * This field indicates a CONFIG ROUTE INFO command has a response with function result
336          * INDEX DOES NOT EXIST, usually means exceeding max route index.
337          */
338         SCI_FAILURE_EXCEED_MAX_ROUTE_INDEX,
339
340         /**
341          * This value indicates that an unsupported PCI device ID has been
342          * specified.  This indicates that attempts to invoke
343          * scic_library_allocate_controller() will fail.
344          */
345         SCI_FAILURE_UNSUPPORTED_PCI_DEVICE_ID
346
347 };
348
349 /**
350  * enum _SCI_IO_STATUS - This enumeration depicts all of the possible IO
351  *    completion status values.  Each value in this enumeration maps directly
352  *    to a value in the enum sci_status enumeration.  Please refer to that
353  *    enumeration for detailed comments concerning what the status represents.
354  *
355  * Add the API to retrieve the SCU status from the core. Check to see that the
356  * following status are properly handled: - SCI_IO_FAILURE_UNSUPPORTED_PROTOCOL
357  * - SCI_IO_FAILURE_INVALID_IO_TAG
358  */
359 enum sci_io_status {
360         SCI_IO_SUCCESS                         = SCI_SUCCESS,
361         SCI_IO_FAILURE                         = SCI_FAILURE,
362         SCI_IO_SUCCESS_COMPLETE_BEFORE_START   = SCI_SUCCESS_IO_COMPLETE_BEFORE_START,
363         SCI_IO_SUCCESS_IO_DONE_EARLY           = SCI_SUCCESS_IO_DONE_EARLY,
364         SCI_IO_FAILURE_INVALID_STATE           = SCI_FAILURE_INVALID_STATE,
365         SCI_IO_FAILURE_INSUFFICIENT_RESOURCES  = SCI_FAILURE_INSUFFICIENT_RESOURCES,
366         SCI_IO_FAILURE_UNSUPPORTED_PROTOCOL    = SCI_FAILURE_UNSUPPORTED_PROTOCOL,
367         SCI_IO_FAILURE_RESPONSE_VALID          = SCI_FAILURE_IO_RESPONSE_VALID,
368         SCI_IO_FAILURE_CONTROLLER_SPECIFIC_ERR = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR,
369         SCI_IO_FAILURE_TERMINATED              = SCI_FAILURE_IO_TERMINATED,
370         SCI_IO_FAILURE_REQUIRES_SCSI_ABORT     = SCI_FAILURE_IO_REQUIRES_SCSI_ABORT,
371         SCI_IO_FAILURE_INVALID_PARAMETER_VALUE = SCI_FAILURE_INVALID_PARAMETER_VALUE,
372         SCI_IO_FAILURE_NO_NCQ_TAG_AVAILABLE    = SCI_FAILURE_NO_NCQ_TAG_AVAILABLE,
373         SCI_IO_FAILURE_PROTOCOL_VIOLATION      = SCI_FAILURE_PROTOCOL_VIOLATION,
374
375         SCI_IO_FAILURE_REMOTE_DEVICE_RESET_REQUIRED = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED,
376
377         SCI_IO_FAILURE_RETRY_REQUIRED      = SCI_FAILURE_RETRY_REQUIRED,
378         SCI_IO_FAILURE_RETRY_LIMIT_REACHED = SCI_FAILURE_RETRY_LIMIT_REACHED,
379         SCI_IO_FAILURE_INVALID_REMOTE_DEVICE = SCI_FAILURE_INVALID_REMOTE_DEVICE
380 };
381
382 /**
383  * enum _SCI_TASK_STATUS - This enumeration depicts all of the possible task
384  *    completion status values.  Each value in this enumeration maps directly
385  *    to a value in the enum sci_status enumeration.  Please refer to that
386  *    enumeration for detailed comments concerning what the status represents.
387  *
388  * Check to see that the following status are properly handled:
389  */
390 enum sci_task_status {
391         SCI_TASK_SUCCESS                         = SCI_SUCCESS,
392         SCI_TASK_FAILURE                         = SCI_FAILURE,
393         SCI_TASK_FAILURE_INVALID_STATE           = SCI_FAILURE_INVALID_STATE,
394         SCI_TASK_FAILURE_INSUFFICIENT_RESOURCES  = SCI_FAILURE_INSUFFICIENT_RESOURCES,
395         SCI_TASK_FAILURE_UNSUPPORTED_PROTOCOL    = SCI_FAILURE_UNSUPPORTED_PROTOCOL,
396         SCI_TASK_FAILURE_INVALID_TAG             = SCI_FAILURE_INVALID_IO_TAG,
397         SCI_TASK_FAILURE_RESPONSE_VALID          = SCI_FAILURE_IO_RESPONSE_VALID,
398         SCI_TASK_FAILURE_CONTROLLER_SPECIFIC_ERR = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR,
399         SCI_TASK_FAILURE_TERMINATED              = SCI_FAILURE_IO_TERMINATED,
400         SCI_TASK_FAILURE_INVALID_PARAMETER_VALUE = SCI_FAILURE_INVALID_PARAMETER_VALUE,
401
402         SCI_TASK_FAILURE_REMOTE_DEVICE_RESET_REQUIRED = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED,
403         SCI_TASK_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS = SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS
404
405 };
406
407
408 #endif  /* _SCI_STATUS_H_ */
409