1230557Sjimharris/*-
2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license.  When using or
3230557Sjimharris * redistributing this file, you may do so under either license.
4230557Sjimharris *
5230557Sjimharris * GPL LICENSE SUMMARY
6230557Sjimharris *
7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8230557Sjimharris *
9230557Sjimharris * This program is free software; you can redistribute it and/or modify
10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as
11230557Sjimharris * published by the Free Software Foundation.
12230557Sjimharris *
13230557Sjimharris * This program is distributed in the hope that it will be useful, but
14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of
15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16230557Sjimharris * General Public License for more details.
17230557Sjimharris *
18230557Sjimharris * You should have received a copy of the GNU General Public License
19230557Sjimharris * along with this program; if not, write to the Free Software
20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21230557Sjimharris * The full GNU General Public License is included in this distribution
22230557Sjimharris * in the file called LICENSE.GPL.
23230557Sjimharris *
24230557Sjimharris * BSD LICENSE
25230557Sjimharris *
26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27230557Sjimharris * All rights reserved.
28230557Sjimharris *
29230557Sjimharris * Redistribution and use in source and binary forms, with or without
30230557Sjimharris * modification, are permitted provided that the following conditions
31230557Sjimharris * are met:
32230557Sjimharris *
33230557Sjimharris *   * Redistributions of source code must retain the above copyright
34230557Sjimharris *     notice, this list of conditions and the following disclaimer.
35230557Sjimharris *   * Redistributions in binary form must reproduce the above copyright
36230557Sjimharris *     notice, this list of conditions and the following disclaimer in
37230557Sjimharris *     the documentation and/or other materials provided with the
38230557Sjimharris *     distribution.
39230557Sjimharris *
40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51230557Sjimharris *
52230557Sjimharris * $FreeBSD$
53230557Sjimharris */
54230557Sjimharris#ifndef _SCI_TYPES_H_
55230557Sjimharris#define _SCI_TYPES_H_
56230557Sjimharris
57230557Sjimharris/**
58230557Sjimharris * @file
59230557Sjimharris *
60230557Sjimharris * @brief This file contains all of the basic data types utilized by an
61230557Sjimharris *        SCI user or implementor.
62230557Sjimharris */
63230557Sjimharris
64230557Sjimharris#ifdef __cplusplus
65230557Sjimharrisextern "C" {
66230557Sjimharris#endif // __cplusplus
67230557Sjimharris
68230557Sjimharris#include <dev/isci/types.h>
69230557Sjimharris
70230557Sjimharris#ifndef sci_cb_physical_address_upper
71230557Sjimharris#error "sci_cb_physical_address_upper needs to be defined in appropriate environment.h"
72230557Sjimharris#endif
73230557Sjimharris
74230557Sjimharris#ifndef sci_cb_physical_address_lower
75230557Sjimharris#error "sci_cb_physical_address_lower needs to be defined in appropriate environment.h"
76230557Sjimharris#endif
77230557Sjimharris
78230557Sjimharris#ifndef sci_cb_make_physical_address
79230557Sjimharris#error "sci_cb_make_physical_address needs to be defined in appropriate environment.h"
80230557Sjimharris#endif
81230557Sjimharris
82230557Sjimharris#ifndef ASSERT
83230557Sjimharris#error "ASSERT needs to be defined in appropriate environment.h or system"
84230557Sjimharris#endif
85230557Sjimharris
86230557Sjimharris
87230557Sjimharris/**
88230557Sjimharris * This constant defines the value utilized by SCI Components to indicate
89230557Sjimharris * an invalid handle.
90230557Sjimharris */
91230557Sjimharris#define SCI_INVALID_HANDLE 0x0
92230557Sjimharris
93230557Sjimharris/**
94230557Sjimharris * @typedef SCI_OBJECT_HANDLE_T
95230557Sjimharris * @brief   This typedef just provides an opaque handle for all SCI
96230557Sjimharris *          objects.
97230557Sjimharris */
98230557Sjimharristypedef void* SCI_OBJECT_HANDLE_T;
99230557Sjimharris
100230557Sjimharris/**
101230557Sjimharris * @typedef SCI_LOGGER_HANDLE_T
102230557Sjimharris * @brief   This typedef just provides an opaque handle for all SCI
103230557Sjimharris *          Logger objects.
104230557Sjimharris */
105230557Sjimharristypedef void* SCI_LOGGER_HANDLE_T;
106230557Sjimharris
107230557Sjimharris/**
108230557Sjimharris * @typedef SCI_IO_REQUEST_HANDLE_T
109230557Sjimharris * @brief   The SCI_IO_REQUEST_HANDLE_T will be utilized by SCI users as an
110230557Sjimharris *          opaque handle for the various SCI IO Request objects.
111230557Sjimharris */
112230557Sjimharristypedef void * SCI_IO_REQUEST_HANDLE_T;
113230557Sjimharris
114230557Sjimharris/**
115230557Sjimharris * @typedef SCI_TASK_REQUEST_HANDLE_T
116230557Sjimharris * @brief   The SCI_TASK_REQUEST_HANDLE_T will be utilized by SCI users as an
117230557Sjimharris *          opaque handle for the various SCI Task Management Request objects.
118230557Sjimharris */
119230557Sjimharristypedef void * SCI_TASK_REQUEST_HANDLE_T;
120230557Sjimharris
121230557Sjimharris/**
122230557Sjimharris * @typedef SCI_PHY_HANDLE_T
123230557Sjimharris * @brief   This typedef just provides an opaque handle for all SCI
124230557Sjimharris *          Phy objects.
125230557Sjimharris */
126230557Sjimharristypedef void * SCI_PHY_HANDLE_T;
127230557Sjimharris
128230557Sjimharris/**
129230557Sjimharris * @typedef SCI_REMOTE_DEVICE_HANDLE_T
130230557Sjimharris * @brief   The SCI_REMOTE_DEVICE_HANDLE_T will be utilized by SCI users as
131230557Sjimharris *          an opaque handle for the SCI remote device object.
132230557Sjimharris */
133230557Sjimharristypedef void * SCI_REMOTE_DEVICE_HANDLE_T;
134230557Sjimharris
135230557Sjimharris/**
136230557Sjimharris * @typedef SCI_DOMAIN_HANDLE_T
137230557Sjimharris * @brief   This typedef just provides an opaque handle for all SCI
138230557Sjimharris *          Domain objects.
139230557Sjimharris */
140230557Sjimharristypedef void* SCI_DOMAIN_HANDLE_T;
141230557Sjimharris
142230557Sjimharris/**
143230557Sjimharris * @typedef SCI_PORT_HANDLE_T
144230557Sjimharris * @brief   This typedef just provides an opaque handle for all SCI
145230557Sjimharris *          SAS or SATA Port objects.
146230557Sjimharris */
147230557Sjimharristypedef void * SCI_PORT_HANDLE_T;
148230557Sjimharris
149230557Sjimharris/**
150230557Sjimharris * @typedef SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T
151230557Sjimharris * @brief   The SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T will be utilized by SCI
152230557Sjimharris *          users as an opaque handle for the SCI MEMORY DESCRIPTOR LIST object.
153230557Sjimharris */
154230557Sjimharristypedef void * SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T;
155230557Sjimharris
156230557Sjimharris/**
157230557Sjimharris * @typedef SCI_LOCK_HANDLE_T
158230557Sjimharris * @brief   The SCI_LOCK_HANDLE_T will be utilized by SCI users as an
159230557Sjimharris *          opaque handle for the SCI LOCK object.  A lock denotes a
160230557Sjimharris *          critical code section of some form.
161230557Sjimharris */
162230557Sjimharristypedef void * SCI_LOCK_HANDLE_T;
163230557Sjimharris
164230557Sjimharris/**
165230557Sjimharris * @typedef SCI_CONTROLLER_HANDLE_T
166230557Sjimharris * @brief   The SCI_CONTROLLER_HANDLE_T will be utilized by SCI users as an
167230557Sjimharris *          opaque handle for all SCI Controller objects.
168230557Sjimharris */
169230557Sjimharristypedef void * SCI_CONTROLLER_HANDLE_T;
170230557Sjimharris
171230557Sjimharris/**
172230557Sjimharris * @typedef SCI_LIBRARY_HANDLE_T
173230557Sjimharris * @brief   The SCI_LIBRARY_HANDLE_T will be utilized by SCI users as an
174230557Sjimharris *          opaque handle for the SCI Library object.
175230557Sjimharris */
176230557Sjimharristypedef void * SCI_LIBRARY_HANDLE_T;
177230557Sjimharris
178230557Sjimharris/**
179230557Sjimharris * @typedef SCI_ITERATOR_HANDLE_T
180230557Sjimharris * @brief   The SCI_ITERATOR_T will be utilized by SCI users as an
181230557Sjimharris *          opaque handle for the SCI Iterator object.
182230557Sjimharris */
183230557Sjimharristypedef void * SCI_ITERATOR_HANDLE_T;
184230557Sjimharris
185230557Sjimharris/**
186230557Sjimharris * @typedef SCI_TIMER_CALLBACK_T
187230557Sjimharris * @brief   This callback defines the format of all other timer callback
188230557Sjimharris *          methods that are to be implemented by an SCI user, including
189230557Sjimharris *          the method that will be invoked as a result of timer expiration.
190230557Sjimharris *
191230557Sjimharris *          Parameters:
192230557Sjimharris *          - The void* value passed into the callback represents the cookie
193230557Sjimharris *            supplied by the SCI component when the timer was created.
194230557Sjimharris *
195230557Sjimharris *          Return:
196230557Sjimharris *          - None
197230557Sjimharris */
198230557Sjimharristypedef void (*SCI_TIMER_CALLBACK_T)(void*);
199230557Sjimharris
200230557Sjimharris/**
201230557Sjimharris * @brief This enumeration is provided so the SCI User can communicate the
202230557Sjimharris *        data direction for an IO request.
203230557Sjimharris */
204230557Sjimharristypedef enum
205230557Sjimharris{
206230557Sjimharris   /**
207230557Sjimharris    * The data direction for the request is in (a read operation)
208230557Sjimharris    * This is also the value to use for an io request that has no specific
209230557Sjimharris    * data direction.
210230557Sjimharris    */
211230557Sjimharris   SCI_IO_REQUEST_DATA_IN = 0,
212230557Sjimharris
213230557Sjimharris   /**
214230557Sjimharris    * The data direction for the request is out (a write operation)
215230557Sjimharris    */
216230557Sjimharris   SCI_IO_REQUEST_DATA_OUT,
217230557Sjimharris
218230557Sjimharris   /**
219230557Sjimharris    * There is no data transfer for the associated request.
220230557Sjimharris    */
221230557Sjimharris   SCI_IO_REQUEST_NO_DATA
222230557Sjimharris
223230557Sjimharris} SCI_IO_REQUEST_DATA_DIRECTION;
224230557Sjimharris
225230557Sjimharris/**
226230557Sjimharris * @enum  SCI_LOCK_LEVEL
227230557Sjimharris * @brief This enumeration defines the various lock levels utilized by
228230557Sjimharris *        the SCI component.  These lock levels help inform users, of the
229230557Sjimharris *        library, about what APIs must be protected from other APIs.
230230557Sjimharris *        The higher the lock level the more restricted the access.  For
231230557Sjimharris *        example, APIs specifying lock level 5 are allowed to be executed
232230557Sjimharris *        while an API of lock level 4 is on-going, but the converse is
233230557Sjimharris *        not true.
234230557Sjimharris */
235230557Sjimharristypedef enum
236230557Sjimharris{
237230557Sjimharris   /**
238230557Sjimharris    * This value indicates there is no lock level required.  This is
239230557Sjimharris    * primarily utilized for situations in which there is a true critical
240230557Sjimharris    * code section that merely needs to protect against access to a
241230557Sjimharris    * region of memory.
242230557Sjimharris    */
243230557Sjimharris   SCI_LOCK_LEVEL_NONE,
244230557Sjimharris
245230557Sjimharris   SCI_LOCK_LEVEL_1,
246230557Sjimharris   SCI_LOCK_LEVEL_2,
247230557Sjimharris   SCI_LOCK_LEVEL_3,
248230557Sjimharris   SCI_LOCK_LEVEL_4,
249230557Sjimharris   SCI_LOCK_LEVEL_5
250230557Sjimharris
251230557Sjimharris} SCI_LOCK_LEVEL;
252230557Sjimharris
253230557Sjimharris/**
254230557Sjimharris * @enum _SCI_CONTROLLER_MODE
255230557Sjimharris * @brief This enumeration is utilized to indicate the operating mode
256230557Sjimharris *        in which the SCI component should function.
257230557Sjimharris */
258230557Sjimharristypedef enum _SCI_CONTROLLER_MODE
259230557Sjimharris{
260230557Sjimharris   /**
261230557Sjimharris    * This enumerant specifies that the SCI component be optimized to
262230557Sjimharris    * perform as fast as possible without concern for the amount of
263230557Sjimharris    * memory being utilized.
264230557Sjimharris    */
265230557Sjimharris   SCI_MODE_SPEED,
266230557Sjimharris
267230557Sjimharris   /**
268230557Sjimharris    * This enumerant specifies that the SCI component be optimized to
269230557Sjimharris    * save memory space without concern for performance of the system.
270230557Sjimharris    */
271230557Sjimharris   SCI_MODE_SIZE
272230557Sjimharris
273230557Sjimharris} SCI_CONTROLLER_MODE;
274230557Sjimharris
275230557Sjimharris#ifdef __cplusplus
276230557Sjimharris}
277230557Sjimharris#endif // __cplusplus
278230557Sjimharris
279230557Sjimharris#endif // _SCI_TYPES_H_
280230557Sjimharris
281