]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/dev/isci/scil/sci_types.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / dev / isci / scil / sci_types.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  *
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_TYPES_H_
55 #define _SCI_TYPES_H_
56
57 /**
58  * @file
59  *
60  * @brief This file contains all of the basic data types utilized by an
61  *        SCI user or implementor.
62  */
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif // __cplusplus
67
68 #include <dev/isci/types.h>
69
70 #ifndef sci_cb_physical_address_upper
71 #error "sci_cb_physical_address_upper needs to be defined in appropriate environment.h"
72 #endif
73
74 #ifndef sci_cb_physical_address_lower
75 #error "sci_cb_physical_address_lower needs to be defined in appropriate environment.h"
76 #endif
77
78 #ifndef sci_cb_make_physical_address
79 #error "sci_cb_make_physical_address needs to be defined in appropriate environment.h"
80 #endif
81
82 #ifndef ASSERT
83 #error "ASSERT needs to be defined in appropriate environment.h or system"
84 #endif
85
86
87 /**
88  * This constant defines the value utilized by SCI Components to indicate
89  * an invalid handle.
90  */
91 #define SCI_INVALID_HANDLE 0x0
92
93 /**
94  * @typedef SCI_OBJECT_HANDLE_T
95  * @brief   This typedef just provides an opaque handle for all SCI
96  *          objects.
97  */
98 typedef void* SCI_OBJECT_HANDLE_T;
99
100 /**
101  * @typedef SCI_LOGGER_HANDLE_T
102  * @brief   This typedef just provides an opaque handle for all SCI
103  *          Logger objects.
104  */
105 typedef void* SCI_LOGGER_HANDLE_T;
106
107 /**
108  * @typedef SCI_IO_REQUEST_HANDLE_T
109  * @brief   The SCI_IO_REQUEST_HANDLE_T will be utilized by SCI users as an
110  *          opaque handle for the various SCI IO Request objects.
111  */
112 typedef void * SCI_IO_REQUEST_HANDLE_T;
113
114 /**
115  * @typedef SCI_TASK_REQUEST_HANDLE_T
116  * @brief   The SCI_TASK_REQUEST_HANDLE_T will be utilized by SCI users as an
117  *          opaque handle for the various SCI Task Management Request objects.
118  */
119 typedef void * SCI_TASK_REQUEST_HANDLE_T;
120
121 /**
122  * @typedef SCI_PHY_HANDLE_T
123  * @brief   This typedef just provides an opaque handle for all SCI
124  *          Phy objects.
125  */
126 typedef void * SCI_PHY_HANDLE_T;
127
128 /**
129  * @typedef SCI_REMOTE_DEVICE_HANDLE_T
130  * @brief   The SCI_REMOTE_DEVICE_HANDLE_T will be utilized by SCI users as
131  *          an opaque handle for the SCI remote device object.
132  */
133 typedef void * SCI_REMOTE_DEVICE_HANDLE_T;
134
135 /**
136  * @typedef SCI_DOMAIN_HANDLE_T
137  * @brief   This typedef just provides an opaque handle for all SCI
138  *          Domain objects.
139  */
140 typedef void* SCI_DOMAIN_HANDLE_T;
141
142 /**
143  * @typedef SCI_PORT_HANDLE_T
144  * @brief   This typedef just provides an opaque handle for all SCI
145  *          SAS or SATA Port objects.
146  */
147 typedef void * SCI_PORT_HANDLE_T;
148
149 /**
150  * @typedef SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T
151  * @brief   The SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T will be utilized by SCI
152  *          users as an opaque handle for the SCI MEMORY DESCRIPTOR LIST object.
153  */
154 typedef void * SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T;
155
156 /**
157  * @typedef SCI_LOCK_HANDLE_T
158  * @brief   The SCI_LOCK_HANDLE_T will be utilized by SCI users as an
159  *          opaque handle for the SCI LOCK object.  A lock denotes a
160  *          critical code section of some form.
161  */
162 typedef void * SCI_LOCK_HANDLE_T;
163
164 /**
165  * @typedef SCI_CONTROLLER_HANDLE_T
166  * @brief   The SCI_CONTROLLER_HANDLE_T will be utilized by SCI users as an
167  *          opaque handle for all SCI Controller objects.
168  */
169 typedef void * SCI_CONTROLLER_HANDLE_T;
170
171 /**
172  * @typedef SCI_LIBRARY_HANDLE_T
173  * @brief   The SCI_LIBRARY_HANDLE_T will be utilized by SCI users as an
174  *          opaque handle for the SCI Library object.
175  */
176 typedef void * SCI_LIBRARY_HANDLE_T;
177
178 /**
179  * @typedef SCI_ITERATOR_HANDLE_T
180  * @brief   The SCI_ITERATOR_T will be utilized by SCI users as an
181  *          opaque handle for the SCI Iterator object.
182  */
183 typedef void * SCI_ITERATOR_HANDLE_T;
184
185 /**
186  * @typedef SCI_TIMER_CALLBACK_T
187  * @brief   This callback defines the format of all other timer callback
188  *          methods that are to be implemented by an SCI user, including
189  *          the method that will be invoked as a result of timer expiration.
190  *
191  *          Parameters:
192  *          - The void* value passed into the callback represents the cookie
193  *            supplied by the SCI component when the timer was created.
194  *
195  *          Return:
196  *          - None
197  */
198 typedef void (*SCI_TIMER_CALLBACK_T)(void*);
199
200 /**
201  * @brief This enumeration is provided so the SCI User can communicate the
202  *        data direction for an IO request.
203  */
204 typedef enum
205 {
206    /**
207     * The data direction for the request is in (a read operation)
208     * This is also the value to use for an io request that has no specific
209     * data direction.
210     */
211    SCI_IO_REQUEST_DATA_IN = 0,
212
213    /**
214     * The data direction for the request is out (a write operation)
215     */
216    SCI_IO_REQUEST_DATA_OUT,
217
218    /**
219     * There is no data transfer for the associated request.
220     */
221    SCI_IO_REQUEST_NO_DATA
222
223 } SCI_IO_REQUEST_DATA_DIRECTION;
224
225 /**
226  * @enum  SCI_LOCK_LEVEL
227  * @brief This enumeration defines the various lock levels utilized by
228  *        the SCI component.  These lock levels help inform users, of the
229  *        library, about what APIs must be protected from other APIs.
230  *        The higher the lock level the more restricted the access.  For
231  *        example, APIs specifying lock level 5 are allowed to be executed
232  *        while an API of lock level 4 is on-going, but the converse is
233  *        not true.
234  */
235 typedef enum
236 {
237    /**
238     * This value indicates there is no lock level required.  This is
239     * primarily utilized for situations in which there is a true critical
240     * code section that merely needs to protect against access to a
241     * region of memory.
242     */
243    SCI_LOCK_LEVEL_NONE,
244
245    SCI_LOCK_LEVEL_1,
246    SCI_LOCK_LEVEL_2,
247    SCI_LOCK_LEVEL_3,
248    SCI_LOCK_LEVEL_4,
249    SCI_LOCK_LEVEL_5
250
251 } SCI_LOCK_LEVEL;
252
253 /**
254  * @enum _SCI_CONTROLLER_MODE
255  * @brief This enumeration is utilized to indicate the operating mode
256  *        in which the SCI component should function.
257  */
258 typedef enum _SCI_CONTROLLER_MODE
259 {
260    /**
261     * This enumerant specifies that the SCI component be optimized to
262     * perform as fast as possible without concern for the amount of
263     * memory being utilized.
264     */
265    SCI_MODE_SPEED,
266
267    /**
268     * This enumerant specifies that the SCI component be optimized to
269     * save memory space without concern for performance of the system.
270     */
271    SCI_MODE_SIZE
272
273 } SCI_CONTROLLER_MODE;
274
275 #ifdef __cplusplus
276 }
277 #endif // __cplusplus
278
279 #endif // _SCI_TYPES_H_
280