sci_types.h revision 230843
119370Spst/*-
2130803Smarcel * This file is provided under a dual BSD/GPLv2 license.  When using or
3130803Smarcel * redistributing this file, you may do so under either license.
4130803Smarcel *
5130803Smarcel * GPL LICENSE SUMMARY
619370Spst *
719370Spst * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
819370Spst *
998944Sobrien * This program is free software; you can redistribute it and/or modify
1019370Spst * it under the terms of version 2 of the GNU General Public License as
1198944Sobrien * published by the Free Software Foundation.
1298944Sobrien *
1398944Sobrien * This program is distributed in the hope that it will be useful, but
1498944Sobrien * WITHOUT ANY WARRANTY; without even the implied warranty of
1519370Spst * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1698944Sobrien * General Public License for more details.
1798944Sobrien *
1898944Sobrien * You should have received a copy of the GNU General Public License
1998944Sobrien * along with this program; if not, write to the Free Software
2019370Spst * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
2198944Sobrien * The full GNU General Public License is included in this distribution
2298944Sobrien * in the file called LICENSE.GPL.
2398944Sobrien *
2498944Sobrien * BSD LICENSE
2519370Spst *
2619370Spst * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
2719370Spst * All rights reserved.
2819370Spst *
2998944Sobrien * Redistribution and use in source and binary forms, with or without
3019370Spst * modification, are permitted provided that the following conditions
31130803Smarcel * are met:
3298944Sobrien *
3319370Spst *   * Redistributions of source code must retain the above copyright
3419370Spst *     notice, this list of conditions and the following disclaimer.
3519370Spst *   * Redistributions in binary form must reproduce the above copyright
3619370Spst *     notice, this list of conditions and the following disclaimer in
3719370Spst *     the documentation and/or other materials provided with the
3819370Spst *     distribution.
3919370Spst *
4019370Spst * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4119370Spst * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42130803Smarcel * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43130803Smarcel * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44130803Smarcel * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45130803Smarcel * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46130803Smarcel * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47130803Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4819370Spst * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4919370Spst * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5019370Spst * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5119370Spst *
5219370Spst * $FreeBSD$
5319370Spst */
5419370Spst#ifndef _SCI_TYPES_H_
5519370Spst#define _SCI_TYPES_H_
5619370Spst
5719370Spst/**
5819370Spst * @file
5919370Spst *
6019370Spst * @brief This file contains all of the basic data types utilized by an
6119370Spst *        SCI user or implementor.
6219370Spst */
6319370Spst
6419370Spst#ifdef __cplusplus
6519370Spstextern "C" {
6619370Spst#endif // __cplusplus
6719370Spst
6819370Spst#include <dev/isci/types.h>
6919370Spst
7019370Spst#ifndef sci_cb_physical_address_upper
7119370Spst#error "sci_cb_physical_address_upper needs to be defined in appropriate environment.h"
7219370Spst#endif
7319370Spst
7419370Spst#ifndef sci_cb_physical_address_lower
7519370Spst#error "sci_cb_physical_address_lower needs to be defined in appropriate environment.h"
7619370Spst#endif
7719370Spst
7819370Spst#ifndef sci_cb_make_physical_address
7919370Spst#error "sci_cb_make_physical_address needs to be defined in appropriate environment.h"
8019370Spst#endif
8119370Spst
8219370Spst#ifndef ASSERT
8319370Spst#error "ASSERT needs to be defined in appropriate environment.h or system"
84130803Smarcel#endif
85130803Smarcel
86130803Smarcel
87130803Smarcel/**
88130803Smarcel * This constant defines the value utilized by SCI Components to indicate
89130803Smarcel * an invalid handle.
90130803Smarcel */
91130803Smarcel#define SCI_INVALID_HANDLE 0x0
9219370Spst
9319370Spst/**
9419370Spst * @typedef SCI_OBJECT_HANDLE_T
9598944Sobrien * @brief   This typedef just provides an opaque handle for all SCI
9698944Sobrien *          objects.
9798944Sobrien */
9898944Sobrientypedef void* SCI_OBJECT_HANDLE_T;
9998944Sobrien
10098944Sobrien/**
10198944Sobrien * @typedef SCI_LOGGER_HANDLE_T
10298944Sobrien * @brief   This typedef just provides an opaque handle for all SCI
10398944Sobrien *          Logger objects.
10498944Sobrien */
10519370Spsttypedef void* SCI_LOGGER_HANDLE_T;
10698944Sobrien
10798944Sobrien/**
10898944Sobrien * @typedef SCI_IO_REQUEST_HANDLE_T
10998944Sobrien * @brief   The SCI_IO_REQUEST_HANDLE_T will be utilized by SCI users as an
11098944Sobrien *          opaque handle for the various SCI IO Request objects.
11119370Spst */
11219370Spsttypedef void * SCI_IO_REQUEST_HANDLE_T;
11319370Spst
11498944Sobrien/**
11519370Spst * @typedef SCI_TASK_REQUEST_HANDLE_T
11698944Sobrien * @brief   The SCI_TASK_REQUEST_HANDLE_T will be utilized by SCI users as an
11719370Spst *          opaque handle for the various SCI Task Management Request objects.
11898944Sobrien */
11919370Spsttypedef void * SCI_TASK_REQUEST_HANDLE_T;
12098944Sobrien
12119370Spst/**
12298944Sobrien * @typedef SCI_PHY_HANDLE_T
12319370Spst * @brief   This typedef just provides an opaque handle for all SCI
12498944Sobrien *          Phy objects.
12519370Spst */
12698944Sobrientypedef void * SCI_PHY_HANDLE_T;
12719370Spst
12898944Sobrien/**
12919370Spst * @typedef SCI_REMOTE_DEVICE_HANDLE_T
13098944Sobrien * @brief   The SCI_REMOTE_DEVICE_HANDLE_T will be utilized by SCI users as
13119370Spst *          an opaque handle for the SCI remote device object.
13298944Sobrien */
13319370Spsttypedef void * SCI_REMOTE_DEVICE_HANDLE_T;
13498944Sobrien
13598944Sobrien/**
13619370Spst * @typedef SCI_DOMAIN_HANDLE_T
13798944Sobrien * @brief   This typedef just provides an opaque handle for all SCI
13819370Spst *          Domain objects.
13998944Sobrien */
14098944Sobrientypedef void* SCI_DOMAIN_HANDLE_T;
14146283Sdfr
14298944Sobrien/**
14346283Sdfr * @typedef SCI_PORT_HANDLE_T
14498944Sobrien * @brief   This typedef just provides an opaque handle for all SCI
14519370Spst *          SAS or SATA Port objects.
14698944Sobrien */
14719370Spsttypedef void * SCI_PORT_HANDLE_T;
14898944Sobrien
14919370Spst/**
15098944Sobrien * @typedef SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T
15119370Spst * @brief   The SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T will be utilized by SCI
15298944Sobrien *          users as an opaque handle for the SCI MEMORY DESCRIPTOR LIST object.
15319370Spst */
15498944Sobrientypedef void * SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T;
15519370Spst
15698944Sobrien/**
15719370Spst * @typedef SCI_LOCK_HANDLE_T
15898944Sobrien * @brief   The SCI_LOCK_HANDLE_T will be utilized by SCI users as an
15946283Sdfr *          opaque handle for the SCI LOCK object.  A lock denotes a
16098944Sobrien *          critical code section of some form.
16119370Spst */
162130803Smarceltypedef void * SCI_LOCK_HANDLE_T;
163130803Smarcel
164130803Smarcel/**
165130803Smarcel * @typedef SCI_CONTROLLER_HANDLE_T
166130803Smarcel * @brief   The SCI_CONTROLLER_HANDLE_T will be utilized by SCI users as an
167130803Smarcel *          opaque handle for all SCI Controller objects.
168130803Smarcel */
169130803Smarceltypedef void * SCI_CONTROLLER_HANDLE_T;
170130803Smarcel
171130803Smarcel/**
172130803Smarcel * @typedef SCI_LIBRARY_HANDLE_T
17398944Sobrien * @brief   The SCI_LIBRARY_HANDLE_T will be utilized by SCI users as an
17498944Sobrien *          opaque handle for the SCI Library object.
17519370Spst */
17619370Spsttypedef void * SCI_LIBRARY_HANDLE_T;
17719370Spst
17819370Spst/**
17919370Spst * @typedef SCI_ITERATOR_HANDLE_T
180130803Smarcel * @brief   The SCI_ITERATOR_T will be utilized by SCI users as an
181130803Smarcel *          opaque handle for the SCI Iterator object.
182130803Smarcel */
183130803Smarceltypedef void * SCI_ITERATOR_HANDLE_T;
18419370Spst
18519370Spst/**
18619370Spst * @typedef SCI_TIMER_CALLBACK_T
18719370Spst * @brief   This callback defines the format of all other timer callback
18819370Spst *          methods that are to be implemented by an SCI user, including
18919370Spst *          the method that will be invoked as a result of timer expiration.
19019370Spst *
19119370Spst *          Parameters:
19219370Spst *          - The void* value passed into the callback represents the cookie
19319370Spst *            supplied by the SCI component when the timer was created.
19419370Spst *
19519370Spst *          Return:
19619370Spst *          - None
19719370Spst */
19819370Spsttypedef void (*SCI_TIMER_CALLBACK_T)(void*);
19919370Spst
20019370Spst/**
20119370Spst * @brief This enumeration is provided so the SCI User can communicate the
20219370Spst *        data direction for an IO request.
20319370Spst */
20419370Spsttypedef enum
20519370Spst{
20619370Spst   /**
20719370Spst    * The data direction for the request is in (a read operation)
20819370Spst    * This is also the value to use for an io request that has no specific
20919370Spst    * data direction.
21019370Spst    */
21119370Spst   SCI_IO_REQUEST_DATA_IN = 0,
21298944Sobrien
21398944Sobrien   /**
21498944Sobrien    * The data direction for the request is out (a write operation)
21598944Sobrien    */
21698944Sobrien   SCI_IO_REQUEST_DATA_OUT,
21798944Sobrien
21819370Spst   /**
21919370Spst    * There is no data transfer for the associated request.
22019370Spst    */
22119370Spst   SCI_IO_REQUEST_NO_DATA
22219370Spst
22398944Sobrien} SCI_IO_REQUEST_DATA_DIRECTION;
22498944Sobrien
22598944Sobrien/**
22698944Sobrien * @enum  SCI_LOCK_LEVEL
22798944Sobrien * @brief This enumeration defines the various lock levels utilized by
22819370Spst *        the SCI component.  These lock levels help inform users, of the
22998944Sobrien *        library, about what APIs must be protected from other APIs.
23098944Sobrien *        The higher the lock level the more restricted the access.  For
23198944Sobrien *        example, APIs specifying lock level 5 are allowed to be executed
23298944Sobrien *        while an API of lock level 4 is on-going, but the converse is
23319370Spst *        not true.
234130803Smarcel */
235130803Smarceltypedef enum
23698944Sobrien{
237130803Smarcel   /**
238130803Smarcel    * This value indicates there is no lock level required.  This is
239130803Smarcel    * primarily utilized for situations in which there is a true critical
240130803Smarcel    * code section that merely needs to protect against access to a
241130803Smarcel    * region of memory.
24298944Sobrien    */
243130803Smarcel   SCI_LOCK_LEVEL_NONE,
244130803Smarcel
245130803Smarcel   SCI_LOCK_LEVEL_1,
246130803Smarcel   SCI_LOCK_LEVEL_2,
247130803Smarcel   SCI_LOCK_LEVEL_3,
248130803Smarcel   SCI_LOCK_LEVEL_4,
249130803Smarcel   SCI_LOCK_LEVEL_5
250130803Smarcel
251130803Smarcel} SCI_LOCK_LEVEL;
252130803Smarcel
253130803Smarcel/**
254130803Smarcel * @enum _SCI_CONTROLLER_MODE
255130803Smarcel * @brief This enumeration is utilized to indicate the operating mode
256130803Smarcel *        in which the SCI component should function.
257130803Smarcel */
258130803Smarceltypedef enum _SCI_CONTROLLER_MODE
259130803Smarcel{
260130803Smarcel   /**
261130803Smarcel    * This enumerant specifies that the SCI component be optimized to
262130803Smarcel    * perform as fast as possible without concern for the amount of
263130803Smarcel    * memory being utilized.
264130803Smarcel    */
265130803Smarcel   SCI_MODE_SPEED,
266130803Smarcel
267130803Smarcel   /**
268130803Smarcel    * This enumerant specifies that the SCI component be optimized to
269130803Smarcel    * save memory space without concern for performance of the system.
270130803Smarcel    */
271130803Smarcel   SCI_MODE_SIZE
272130803Smarcel
273130803Smarcel} SCI_CONTROLLER_MODE;
274130803Smarcel
275130803Smarcel#ifdef __cplusplus
276130803Smarcel}
277130803Smarcel#endif // __cplusplus
278130803Smarcel
27998944Sobrien#endif // _SCI_TYPES_H_
280
281