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