1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 3 * 4 * This file is provided under a dual BSD/GPLv2 license. When using or 5 * redistributing this file, you may do so under either license. 6 * 7 * GPL LICENSE SUMMARY 8 * 9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of version 2 of the GNU General Public License as 13 * published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 23 * The full GNU General Public License is included in this distribution 24 * in the file called LICENSE.GPL. 25 * 26 * BSD LICENSE 27 * 28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 29 * All rights reserved. 30 * 31 * Redistribution and use in source and binary forms, with or without 32 * modification, are permitted provided that the following conditions 33 * are met: 34 * 35 * * Redistributions of source code must retain the above copyright 36 * notice, this list of conditions and the following disclaimer. 37 * * Redistributions in binary form must reproduce the above copyright 38 * notice, this list of conditions and the following disclaimer in 39 * the documentation and/or other materials provided with the 40 * distribution. 41 * 42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 * 54 * $FreeBSD$ 55 */ 56 #ifndef _SCI_TYPES_H_ 57 #define _SCI_TYPES_H_ 58 59 /** 60 * @file 61 * 62 * @brief This file contains all of the basic data types utilized by an 63 * SCI user or implementor. 64 */ 65 66 #ifdef __cplusplus 67 extern "C" { 68 #endif // __cplusplus 69 70 #include <dev/isci/types.h> 71 72 #ifndef sci_cb_physical_address_upper 73 #error "sci_cb_physical_address_upper needs to be defined in appropriate environment.h" 74 #endif 75 76 #ifndef sci_cb_physical_address_lower 77 #error "sci_cb_physical_address_lower needs to be defined in appropriate environment.h" 78 #endif 79 80 #ifndef sci_cb_make_physical_address 81 #error "sci_cb_make_physical_address needs to be defined in appropriate environment.h" 82 #endif 83 84 #ifndef ASSERT 85 #error "ASSERT needs to be defined in appropriate environment.h or system" 86 #endif 87 88 89 /** 90 * This constant defines the value utilized by SCI Components to indicate 91 * an invalid handle. 92 */ 93 #define SCI_INVALID_HANDLE 0x0 94 95 /** 96 * @typedef SCI_OBJECT_HANDLE_T 97 * @brief This typedef just provides an opaque handle for all SCI 98 * objects. 99 */ 100 typedef void* SCI_OBJECT_HANDLE_T; 101 102 /** 103 * @typedef SCI_LOGGER_HANDLE_T 104 * @brief This typedef just provides an opaque handle for all SCI 105 * Logger objects. 106 */ 107 typedef void* SCI_LOGGER_HANDLE_T; 108 109 /** 110 * @typedef SCI_IO_REQUEST_HANDLE_T 111 * @brief The SCI_IO_REQUEST_HANDLE_T will be utilized by SCI users as an 112 * opaque handle for the various SCI IO Request objects. 113 */ 114 typedef void * SCI_IO_REQUEST_HANDLE_T; 115 116 /** 117 * @typedef SCI_TASK_REQUEST_HANDLE_T 118 * @brief The SCI_TASK_REQUEST_HANDLE_T will be utilized by SCI users as an 119 * opaque handle for the various SCI Task Management Request objects. 120 */ 121 typedef void * SCI_TASK_REQUEST_HANDLE_T; 122 123 /** 124 * @typedef SCI_PHY_HANDLE_T 125 * @brief This typedef just provides an opaque handle for all SCI 126 * Phy objects. 127 */ 128 typedef void * SCI_PHY_HANDLE_T; 129 130 /** 131 * @typedef SCI_REMOTE_DEVICE_HANDLE_T 132 * @brief The SCI_REMOTE_DEVICE_HANDLE_T will be utilized by SCI users as 133 * an opaque handle for the SCI remote device object. 134 */ 135 typedef void * SCI_REMOTE_DEVICE_HANDLE_T; 136 137 /** 138 * @typedef SCI_DOMAIN_HANDLE_T 139 * @brief This typedef just provides an opaque handle for all SCI 140 * Domain objects. 141 */ 142 typedef void* SCI_DOMAIN_HANDLE_T; 143 144 /** 145 * @typedef SCI_PORT_HANDLE_T 146 * @brief This typedef just provides an opaque handle for all SCI 147 * SAS or SATA Port objects. 148 */ 149 typedef void * SCI_PORT_HANDLE_T; 150 151 /** 152 * @typedef SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T 153 * @brief The SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T will be utilized by SCI 154 * users as an opaque handle for the SCI MEMORY DESCRIPTOR LIST object. 155 */ 156 typedef void * SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T; 157 158 /** 159 * @typedef SCI_LOCK_HANDLE_T 160 * @brief The SCI_LOCK_HANDLE_T will be utilized by SCI users as an 161 * opaque handle for the SCI LOCK object. A lock denotes a 162 * critical code section of some form. 163 */ 164 typedef void * SCI_LOCK_HANDLE_T; 165 166 /** 167 * @typedef SCI_CONTROLLER_HANDLE_T 168 * @brief The SCI_CONTROLLER_HANDLE_T will be utilized by SCI users as an 169 * opaque handle for all SCI Controller objects. 170 */ 171 typedef void * SCI_CONTROLLER_HANDLE_T; 172 173 /** 174 * @typedef SCI_LIBRARY_HANDLE_T 175 * @brief The SCI_LIBRARY_HANDLE_T will be utilized by SCI users as an 176 * opaque handle for the SCI Library object. 177 */ 178 typedef void * SCI_LIBRARY_HANDLE_T; 179 180 /** 181 * @typedef SCI_ITERATOR_HANDLE_T 182 * @brief The SCI_ITERATOR_T will be utilized by SCI users as an 183 * opaque handle for the SCI Iterator object. 184 */ 185 typedef void * SCI_ITERATOR_HANDLE_T; 186 187 /** 188 * @typedef SCI_TIMER_CALLBACK_T 189 * @brief This callback defines the format of all other timer callback 190 * methods that are to be implemented by an SCI user, including 191 * the method that will be invoked as a result of timer expiration. 192 * 193 * Parameters: 194 * - The void* value passed into the callback represents the cookie 195 * supplied by the SCI component when the timer was created. 196 * 197 * Return: 198 * - None 199 */ 200 typedef void (*SCI_TIMER_CALLBACK_T)(void*); 201 202 /** 203 * @brief This enumeration is provided so the SCI User can communicate the 204 * data direction for an IO request. 205 */ 206 typedef enum 207 { 208 /** 209 * The data direction for the request is in (a read operation) 210 * This is also the value to use for an io request that has no specific 211 * data direction. 212 */ 213 SCI_IO_REQUEST_DATA_IN = 0, 214 215 /** 216 * The data direction for the request is out (a write operation) 217 */ 218 SCI_IO_REQUEST_DATA_OUT, 219 220 /** 221 * There is no data transfer for the associated request. 222 */ 223 SCI_IO_REQUEST_NO_DATA 224 225 } SCI_IO_REQUEST_DATA_DIRECTION; 226 227 /** 228 * @enum SCI_LOCK_LEVEL 229 * @brief This enumeration defines the various lock levels utilized by 230 * the SCI component. These lock levels help inform users, of the 231 * library, about what APIs must be protected from other APIs. 232 * The higher the lock level the more restricted the access. For 233 * example, APIs specifying lock level 5 are allowed to be executed 234 * while an API of lock level 4 is on-going, but the converse is 235 * not true. 236 */ 237 typedef enum 238 { 239 /** 240 * This value indicates there is no lock level required. This is 241 * primarily utilized for situations in which there is a true critical 242 * code section that merely needs to protect against access to a 243 * region of memory. 244 */ 245 SCI_LOCK_LEVEL_NONE, 246 247 SCI_LOCK_LEVEL_1, 248 SCI_LOCK_LEVEL_2, 249 SCI_LOCK_LEVEL_3, 250 SCI_LOCK_LEVEL_4, 251 SCI_LOCK_LEVEL_5 252 253 } SCI_LOCK_LEVEL; 254 255 /** 256 * @enum _SCI_CONTROLLER_MODE 257 * @brief This enumeration is utilized to indicate the operating mode 258 * in which the SCI component should function. 259 */ 260 typedef enum _SCI_CONTROLLER_MODE 261 { 262 /** 263 * This enumerant specifies that the SCI component be optimized to 264 * perform as fast as possible without concern for the amount of 265 * memory being utilized. 266 */ 267 SCI_MODE_SPEED, 268 269 /** 270 * This enumerant specifies that the SCI component be optimized to 271 * save memory space without concern for performance of the system. 272 */ 273 SCI_MODE_SIZE 274 275 } SCI_CONTROLLER_MODE; 276 277 #ifdef __cplusplus 278 } 279 #endif // __cplusplus 280 281 #endif // _SCI_TYPES_H_ 282 283