Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 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 | * * Neither the name of Intel Corporation nor the names of its |
| 40 | * contributors may be used to endorse or promote products derived |
| 41 | * from this software without specific prior written permission. |
| 42 | * |
| 43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 44 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 45 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 46 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 47 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 48 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 49 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 50 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 51 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 52 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | */ |
| 55 | |
Dan Williams | 5409bc3 | 2011-03-08 21:30:28 -0800 | [diff] [blame] | 56 | #ifndef __ISCI_H__ |
| 57 | #define __ISCI_H__ |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 58 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 59 | #include <linux/interrupt.h> |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 60 | |
Dan Williams | ce2b326 | 2011-05-08 15:49:15 -0700 | [diff] [blame] | 61 | #define DRV_NAME "isci" |
| 62 | #define SCI_PCI_BAR_COUNT 2 |
| 63 | #define SCI_NUM_MSI_X_INT 2 |
| 64 | #define SCI_SMU_BAR 0 |
| 65 | #define SCI_SMU_BAR_SIZE (16*1024) |
| 66 | #define SCI_SCU_BAR 1 |
| 67 | #define SCI_SCU_BAR_SIZE (4*1024*1024) |
| 68 | #define SCI_IO_SPACE_BAR0 2 |
| 69 | #define SCI_IO_SPACE_BAR1 3 |
| 70 | #define ISCI_CAN_QUEUE_VAL 250 /* < SCI_MAX_IO_REQUESTS ? */ |
| 71 | #define SCIC_CONTROLLER_STOP_TIMEOUT 5000 |
| 72 | |
| 73 | #define SCI_CONTROLLER_INVALID_IO_TAG 0xFFFF |
| 74 | |
| 75 | enum sci_controller_mode { |
| 76 | SCI_MODE_SPEED, |
| 77 | SCI_MODE_SIZE /* deprecated */ |
| 78 | }; |
| 79 | |
| 80 | #define SCI_MAX_PHYS (4) |
| 81 | #define SCI_MAX_PORTS SCI_MAX_PHYS |
| 82 | #define SCI_MIN_SMP_PHYS (38) |
| 83 | #define SCI_MAX_SMP_PHYS (384) /* not silicon constrained */ |
| 84 | #define SCI_MAX_REMOTE_DEVICES (256) |
| 85 | #define SCI_MIN_REMOTE_DEVICES (16) |
| 86 | #define SCI_MAX_IO_REQUESTS (256) |
| 87 | #define SCI_MIN_IO_REQUESTS (1) |
| 88 | #define SCI_MAX_MSIX_MESSAGES (2) |
| 89 | #define SCI_MAX_SCATTER_GATHER_ELEMENTS 130 /* not silicon constrained */ |
| 90 | #define SCI_MIN_SCATTER_GATHER_ELEMENTS 1 |
| 91 | #define SCI_MAX_CONTROLLERS 2 |
| 92 | #define SCI_MAX_DOMAINS SCI_MAX_PORTS |
| 93 | |
| 94 | /* 2 indicates the maximum number of UFs that can occur for a given IO request. |
| 95 | * The hardware handles reception of additional unsolicited frames while all |
| 96 | * UFs are in use, by holding off the transmitting device. This number could |
| 97 | * be theoretically reduced to 1, but 2 provides for more reliable operation. |
| 98 | * During SATA PIO operation, it is possible under some conditions for there to |
| 99 | * be 3 separate FISes received, back to back to back (PIO Setup, Data, D2H |
| 100 | * Register). It is unlikely to have all 3 pending all at once without some of |
| 101 | * them already being processed. |
| 102 | */ |
| 103 | #define SCU_MIN_UNSOLICITED_FRAMES (1) |
| 104 | #define SCU_MIN_CRITICAL_NOTIFICATIONS (24) |
| 105 | #define SCU_MIN_EVENTS (4) |
| 106 | #define SCU_MIN_COMPLETION_QUEUE_SCRATCH (2) |
| 107 | #define SCU_MIN_COMPLETION_QUEUE_ENTRIES (SCU_MIN_CRITICAL_NOTIFICATIONS \ |
| 108 | + SCU_MIN_EVENTS \ |
| 109 | + SCU_MIN_UNSOLICITED_FRAMES \ |
| 110 | + SCI_MIN_IO_REQUESTS \ |
| 111 | + SCU_MIN_COMPLETION_QUEUE_SCRATCH) |
| 112 | |
| 113 | #define SCU_MAX_CRITICAL_NOTIFICATIONS (384) |
| 114 | #define SCU_MAX_EVENTS (128) |
| 115 | #define SCU_MAX_UNSOLICITED_FRAMES (128) |
| 116 | #define SCU_MAX_COMPLETION_QUEUE_SCRATCH (128) |
| 117 | #define SCU_MAX_COMPLETION_QUEUE_ENTRIES (SCU_MAX_CRITICAL_NOTIFICATIONS \ |
| 118 | + SCU_MAX_EVENTS \ |
| 119 | + SCU_MAX_UNSOLICITED_FRAMES \ |
| 120 | + SCI_MAX_IO_REQUESTS \ |
| 121 | + SCU_MAX_COMPLETION_QUEUE_SCRATCH) |
| 122 | |
| 123 | #if !defined(ENABLE_MINIMUM_MEMORY_MODE) |
| 124 | #define SCU_UNSOLICITED_FRAME_COUNT SCU_MAX_UNSOLICITED_FRAMES |
| 125 | #define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MAX_CRITICAL_NOTIFICATIONS |
| 126 | #define SCU_EVENT_COUNT SCU_MAX_EVENTS |
| 127 | #define SCU_COMPLETION_QUEUE_SCRATCH SCU_MAX_COMPLETION_QUEUE_SCRATCH |
| 128 | #define SCU_IO_REQUEST_COUNT SCI_MAX_IO_REQUESTS |
| 129 | #define SCU_IO_REQUEST_SGE_COUNT SCI_MAX_SCATTER_GATHER_ELEMENTS |
| 130 | #define SCU_COMPLETION_QUEUE_COUNT SCU_MAX_COMPLETION_QUEUE_ENTRIES |
| 131 | #else |
| 132 | #define SCU_UNSOLICITED_FRAME_COUNT SCU_MIN_UNSOLICITED_FRAMES |
| 133 | #define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MIN_CRITICAL_NOTIFICATIONS |
| 134 | #define SCU_EVENT_COUNT SCU_MIN_EVENTS |
| 135 | #define SCU_COMPLETION_QUEUE_SCRATCH SCU_MIN_COMPLETION_QUEUE_SCRATCH |
| 136 | #define SCU_IO_REQUEST_COUNT SCI_MIN_IO_REQUESTS |
| 137 | #define SCU_IO_REQUEST_SGE_COUNT SCI_MIN_SCATTER_GATHER_ELEMENTS |
| 138 | #define SCU_COMPLETION_QUEUE_COUNT SCU_MIN_COMPLETION_QUEUE_ENTRIES |
| 139 | #endif /* !defined(ENABLE_MINIMUM_MEMORY_OPERATION) */ |
| 140 | |
| 141 | /** |
| 142 | * |
| 143 | * |
| 144 | * The SCU_COMPLETION_QUEUE_COUNT constant indicates the size of the completion |
| 145 | * queue into which the hardware DMAs 32-bit quantas (completion entries). |
| 146 | */ |
| 147 | |
| 148 | /** |
| 149 | * |
| 150 | * |
| 151 | * This queue must be programmed to a power of 2 size (e.g. 32, 64, 1024, etc.). |
| 152 | */ |
| 153 | #if (SCU_COMPLETION_QUEUE_COUNT != 16) && \ |
| 154 | (SCU_COMPLETION_QUEUE_COUNT != 32) && \ |
| 155 | (SCU_COMPLETION_QUEUE_COUNT != 64) && \ |
| 156 | (SCU_COMPLETION_QUEUE_COUNT != 128) && \ |
| 157 | (SCU_COMPLETION_QUEUE_COUNT != 256) && \ |
| 158 | (SCU_COMPLETION_QUEUE_COUNT != 512) && \ |
| 159 | (SCU_COMPLETION_QUEUE_COUNT != 1024) |
| 160 | #error "SCU_COMPLETION_QUEUE_COUNT must be set to a power of 2." |
| 161 | #endif |
| 162 | |
| 163 | #if SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES |
| 164 | #error "Invalid configuration of unsolicited frame constants" |
| 165 | #endif /* SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES */ |
| 166 | |
| 167 | #define SCU_MIN_UF_TABLE_ENTRIES (8) |
| 168 | #define SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES (4096) |
| 169 | #define SCU_UNSOLICITED_FRAME_BUFFER_SIZE (1024) |
| 170 | #define SCU_INVALID_FRAME_INDEX (0xFFFF) |
| 171 | |
| 172 | #define SCU_IO_REQUEST_MAX_SGE_SIZE (0x00FFFFFF) |
| 173 | #define SCU_IO_REQUEST_MAX_TRANSFER_LENGTH (0x00FFFFFF) |
| 174 | |
| 175 | /* |
| 176 | * Determine the size of the unsolicited frame array including |
| 177 | * unused buffers. */ |
| 178 | #if SCU_UNSOLICITED_FRAME_COUNT <= SCU_MIN_UF_TABLE_ENTRIES |
| 179 | #define SCU_UNSOLICITED_FRAME_CONTROL_ARRAY_SIZE SCU_MIN_UF_TABLE_ENTRIES |
| 180 | #else |
| 181 | #define SCU_UNSOLICITED_FRAME_CONTROL_ARRAY_SIZE SCU_MAX_UNSOLICITED_FRAMES |
| 182 | #endif /* SCU_UNSOLICITED_FRAME_COUNT <= SCU_MIN_UF_TABLE_ENTRIES */ |
| 183 | |
| 184 | /** |
| 185 | * enum sci_status - This is the general return status enumeration for non-IO, |
| 186 | * non-task management related SCI interface methods. |
| 187 | * |
| 188 | * |
| 189 | */ |
| 190 | enum sci_status { |
| 191 | /** |
| 192 | * This member indicates successful completion. |
| 193 | */ |
| 194 | SCI_SUCCESS = 0, |
| 195 | |
| 196 | /** |
| 197 | * This value indicates that the calling method completed successfully, |
| 198 | * but that the IO may have completed before having it's start method |
| 199 | * invoked. This occurs during SAT translation for requests that do |
| 200 | * not require an IO to the target or for any other requests that may |
| 201 | * be completed without having to submit IO. |
| 202 | */ |
| 203 | SCI_SUCCESS_IO_COMPLETE_BEFORE_START, |
| 204 | |
| 205 | /** |
| 206 | * This Value indicates that the SCU hardware returned an early response |
| 207 | * because the io request specified more data than is returned by the |
| 208 | * target device (mode pages, inquiry data, etc.). The completion routine |
| 209 | * will handle this case to get the actual number of bytes transferred. |
| 210 | */ |
| 211 | SCI_SUCCESS_IO_DONE_EARLY, |
| 212 | |
| 213 | /** |
| 214 | * This member indicates that the object for which a state change is |
| 215 | * being requested is already in said state. |
| 216 | */ |
| 217 | SCI_WARNING_ALREADY_IN_STATE, |
| 218 | |
| 219 | /** |
| 220 | * This member indicates interrupt coalescence timer may cause SAS |
| 221 | * specification compliance issues (i.e. SMP target mode response |
| 222 | * frames must be returned within 1.9 milliseconds). |
| 223 | */ |
| 224 | SCI_WARNING_TIMER_CONFLICT, |
| 225 | |
| 226 | /** |
| 227 | * This field indicates a sequence of action is not completed yet. Mostly, |
| 228 | * this status is used when multiple ATA commands are needed in a SATI translation. |
| 229 | */ |
| 230 | SCI_WARNING_SEQUENCE_INCOMPLETE, |
| 231 | |
| 232 | /** |
| 233 | * This member indicates that there was a general failure. |
| 234 | */ |
| 235 | SCI_FAILURE, |
| 236 | |
| 237 | /** |
| 238 | * This member indicates that the SCI implementation is unable to complete |
| 239 | * an operation due to a critical flaw the prevents any further operation |
| 240 | * (i.e. an invalid pointer). |
| 241 | */ |
| 242 | SCI_FATAL_ERROR, |
| 243 | |
| 244 | /** |
| 245 | * This member indicates the calling function failed, because the state |
| 246 | * of the controller is in a state that prevents successful completion. |
| 247 | */ |
| 248 | SCI_FAILURE_INVALID_STATE, |
| 249 | |
| 250 | /** |
| 251 | * This member indicates the calling function failed, because there is |
| 252 | * insufficient resources/memory to complete the request. |
| 253 | */ |
| 254 | SCI_FAILURE_INSUFFICIENT_RESOURCES, |
| 255 | |
| 256 | /** |
| 257 | * This member indicates the calling function failed, because the |
| 258 | * controller object required for the operation can't be located. |
| 259 | */ |
| 260 | SCI_FAILURE_CONTROLLER_NOT_FOUND, |
| 261 | |
| 262 | /** |
| 263 | * This member indicates the calling function failed, because the |
| 264 | * discovered controller type is not supported by the library. |
| 265 | */ |
| 266 | SCI_FAILURE_UNSUPPORTED_CONTROLLER_TYPE, |
| 267 | |
| 268 | /** |
| 269 | * This member indicates the calling function failed, because the |
| 270 | * requested initialization data version isn't supported. |
| 271 | */ |
| 272 | SCI_FAILURE_UNSUPPORTED_INIT_DATA_VERSION, |
| 273 | |
| 274 | /** |
| 275 | * This member indicates the calling function failed, because the |
| 276 | * requested configuration of SAS Phys into SAS Ports is not supported. |
| 277 | */ |
| 278 | SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION, |
| 279 | |
| 280 | /** |
| 281 | * This member indicates the calling function failed, because the |
| 282 | * requested protocol is not supported by the remote device, port, |
| 283 | * or controller. |
| 284 | */ |
| 285 | SCI_FAILURE_UNSUPPORTED_PROTOCOL, |
| 286 | |
| 287 | /** |
| 288 | * This member indicates the calling function failed, because the |
| 289 | * requested information type is not supported by the SCI implementation. |
| 290 | */ |
| 291 | SCI_FAILURE_UNSUPPORTED_INFORMATION_TYPE, |
| 292 | |
| 293 | /** |
| 294 | * This member indicates the calling function failed, because the |
| 295 | * device already exists. |
| 296 | */ |
| 297 | SCI_FAILURE_DEVICE_EXISTS, |
| 298 | |
| 299 | /** |
| 300 | * This member indicates the calling function failed, because adding |
| 301 | * a phy to the object is not possible. |
| 302 | */ |
| 303 | SCI_FAILURE_ADDING_PHY_UNSUPPORTED, |
| 304 | |
| 305 | /** |
| 306 | * This member indicates the calling function failed, because the |
| 307 | * requested information type is not supported by the SCI implementation. |
| 308 | */ |
| 309 | SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD, |
| 310 | |
| 311 | /** |
| 312 | * This member indicates the calling function failed, because the SCI |
| 313 | * implementation does not support the supplied time limit. |
| 314 | */ |
| 315 | SCI_FAILURE_UNSUPPORTED_TIME_LIMIT, |
| 316 | |
| 317 | /** |
| 318 | * This member indicates the calling method failed, because the SCI |
| 319 | * implementation does not contain the specified Phy. |
| 320 | */ |
| 321 | SCI_FAILURE_INVALID_PHY, |
| 322 | |
| 323 | /** |
| 324 | * This member indicates the calling method failed, because the SCI |
| 325 | * implementation does not contain the specified Port. |
| 326 | */ |
| 327 | SCI_FAILURE_INVALID_PORT, |
| 328 | |
| 329 | /** |
| 330 | * This member indicates the calling method was partly successful |
| 331 | * The port was reset but not all phys in port are operational |
| 332 | */ |
| 333 | SCI_FAILURE_RESET_PORT_PARTIAL_SUCCESS, |
| 334 | |
| 335 | /** |
| 336 | * This member indicates that calling method failed |
| 337 | * The port reset did not complete because none of the phys are operational |
| 338 | */ |
| 339 | SCI_FAILURE_RESET_PORT_FAILURE, |
| 340 | |
| 341 | /** |
| 342 | * This member indicates the calling method failed, because the SCI |
| 343 | * implementation does not contain the specified remote device. |
| 344 | */ |
| 345 | SCI_FAILURE_INVALID_REMOTE_DEVICE, |
| 346 | |
| 347 | /** |
| 348 | * This member indicates the calling method failed, because the remote |
| 349 | * device is in a bad state and requires a reset. |
| 350 | */ |
| 351 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED, |
| 352 | |
| 353 | /** |
| 354 | * This member indicates the calling method failed, because the SCI |
| 355 | * implementation does not contain or support the specified IO tag. |
| 356 | */ |
| 357 | SCI_FAILURE_INVALID_IO_TAG, |
| 358 | |
| 359 | /** |
| 360 | * This member indicates that the operation failed and the user should |
| 361 | * check the response data associated with the IO. |
| 362 | */ |
| 363 | SCI_FAILURE_IO_RESPONSE_VALID, |
| 364 | |
| 365 | /** |
| 366 | * This member indicates that the operation failed, the failure is |
| 367 | * controller implementation specific, and the response data associated |
| 368 | * with the request is not valid. You can query for the controller |
| 369 | * specific error information via scic_controller_get_request_status() |
| 370 | */ |
| 371 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR, |
| 372 | |
| 373 | /** |
| 374 | * This member indicated that the operation failed because the |
| 375 | * user requested this IO to be terminated. |
| 376 | */ |
| 377 | SCI_FAILURE_IO_TERMINATED, |
| 378 | |
| 379 | /** |
| 380 | * This member indicates that the operation failed and the associated |
| 381 | * request requires a SCSI abort task to be sent to the target. |
| 382 | */ |
| 383 | SCI_FAILURE_IO_REQUIRES_SCSI_ABORT, |
| 384 | |
| 385 | /** |
| 386 | * This member indicates that the operation failed because the supplied |
| 387 | * device could not be located. |
| 388 | */ |
| 389 | SCI_FAILURE_DEVICE_NOT_FOUND, |
| 390 | |
| 391 | /** |
| 392 | * This member indicates that the operation failed because the |
| 393 | * objects association is required and is not correctly set. |
| 394 | */ |
| 395 | SCI_FAILURE_INVALID_ASSOCIATION, |
| 396 | |
| 397 | /** |
| 398 | * This member indicates that the operation failed, because a timeout |
| 399 | * occurred. |
| 400 | */ |
| 401 | SCI_FAILURE_TIMEOUT, |
| 402 | |
| 403 | /** |
| 404 | * This member indicates that the operation failed, because the user |
| 405 | * specified a value that is either invalid or not supported. |
| 406 | */ |
| 407 | SCI_FAILURE_INVALID_PARAMETER_VALUE, |
| 408 | |
| 409 | /** |
| 410 | * This value indicates that the operation failed, because the number |
| 411 | * of messages (MSI-X) is not supported. |
| 412 | */ |
| 413 | SCI_FAILURE_UNSUPPORTED_MESSAGE_COUNT, |
| 414 | |
| 415 | /** |
| 416 | * This value indicates that the method failed due to a lack of |
| 417 | * available NCQ tags. |
| 418 | */ |
| 419 | SCI_FAILURE_NO_NCQ_TAG_AVAILABLE, |
| 420 | |
| 421 | /** |
| 422 | * This value indicates that a protocol violation has occurred on the |
| 423 | * link. |
| 424 | */ |
| 425 | SCI_FAILURE_PROTOCOL_VIOLATION, |
| 426 | |
| 427 | /** |
| 428 | * This value indicates a failure condition that retry may help to clear. |
| 429 | */ |
| 430 | SCI_FAILURE_RETRY_REQUIRED, |
| 431 | |
| 432 | /** |
| 433 | * This field indicates the retry limit was reached when a retry is attempted |
| 434 | */ |
| 435 | SCI_FAILURE_RETRY_LIMIT_REACHED, |
| 436 | |
| 437 | /** |
| 438 | * This member indicates the calling method was partly successful. |
| 439 | * Mostly, this status is used when a LUN_RESET issued to an expander attached |
| 440 | * STP device in READY NCQ substate needs to have RNC suspended/resumed |
| 441 | * before posting TC. |
| 442 | */ |
| 443 | SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS, |
| 444 | |
| 445 | /** |
| 446 | * This field indicates an illegal phy connection based on the routing attribute |
| 447 | * of both expander phy attached to each other. |
| 448 | */ |
| 449 | SCI_FAILURE_ILLEGAL_ROUTING_ATTRIBUTE_CONFIGURATION, |
| 450 | |
| 451 | /** |
| 452 | * This field indicates a CONFIG ROUTE INFO command has a response with function result |
| 453 | * INDEX DOES NOT EXIST, usually means exceeding max route index. |
| 454 | */ |
| 455 | SCI_FAILURE_EXCEED_MAX_ROUTE_INDEX, |
| 456 | |
| 457 | /** |
| 458 | * This value indicates that an unsupported PCI device ID has been |
| 459 | * specified. This indicates that attempts to invoke |
| 460 | * scic_library_allocate_controller() will fail. |
| 461 | */ |
| 462 | SCI_FAILURE_UNSUPPORTED_PCI_DEVICE_ID |
| 463 | |
| 464 | }; |
| 465 | |
| 466 | /** |
| 467 | * enum sci_io_status - This enumeration depicts all of the possible IO |
| 468 | * completion status values. Each value in this enumeration maps directly |
| 469 | * to a value in the enum sci_status enumeration. Please refer to that |
| 470 | * enumeration for detailed comments concerning what the status represents. |
| 471 | * |
| 472 | * Add the API to retrieve the SCU status from the core. Check to see that the |
| 473 | * following status are properly handled: - SCI_IO_FAILURE_UNSUPPORTED_PROTOCOL |
| 474 | * - SCI_IO_FAILURE_INVALID_IO_TAG |
| 475 | */ |
| 476 | enum sci_io_status { |
| 477 | SCI_IO_SUCCESS = SCI_SUCCESS, |
| 478 | SCI_IO_FAILURE = SCI_FAILURE, |
| 479 | SCI_IO_SUCCESS_COMPLETE_BEFORE_START = SCI_SUCCESS_IO_COMPLETE_BEFORE_START, |
| 480 | SCI_IO_SUCCESS_IO_DONE_EARLY = SCI_SUCCESS_IO_DONE_EARLY, |
| 481 | SCI_IO_FAILURE_INVALID_STATE = SCI_FAILURE_INVALID_STATE, |
| 482 | SCI_IO_FAILURE_INSUFFICIENT_RESOURCES = SCI_FAILURE_INSUFFICIENT_RESOURCES, |
| 483 | SCI_IO_FAILURE_UNSUPPORTED_PROTOCOL = SCI_FAILURE_UNSUPPORTED_PROTOCOL, |
| 484 | SCI_IO_FAILURE_RESPONSE_VALID = SCI_FAILURE_IO_RESPONSE_VALID, |
| 485 | SCI_IO_FAILURE_CONTROLLER_SPECIFIC_ERR = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR, |
| 486 | SCI_IO_FAILURE_TERMINATED = SCI_FAILURE_IO_TERMINATED, |
| 487 | SCI_IO_FAILURE_REQUIRES_SCSI_ABORT = SCI_FAILURE_IO_REQUIRES_SCSI_ABORT, |
| 488 | SCI_IO_FAILURE_INVALID_PARAMETER_VALUE = SCI_FAILURE_INVALID_PARAMETER_VALUE, |
| 489 | SCI_IO_FAILURE_NO_NCQ_TAG_AVAILABLE = SCI_FAILURE_NO_NCQ_TAG_AVAILABLE, |
| 490 | SCI_IO_FAILURE_PROTOCOL_VIOLATION = SCI_FAILURE_PROTOCOL_VIOLATION, |
| 491 | |
| 492 | SCI_IO_FAILURE_REMOTE_DEVICE_RESET_REQUIRED = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED, |
| 493 | |
| 494 | SCI_IO_FAILURE_RETRY_REQUIRED = SCI_FAILURE_RETRY_REQUIRED, |
| 495 | SCI_IO_FAILURE_RETRY_LIMIT_REACHED = SCI_FAILURE_RETRY_LIMIT_REACHED, |
| 496 | SCI_IO_FAILURE_INVALID_REMOTE_DEVICE = SCI_FAILURE_INVALID_REMOTE_DEVICE |
| 497 | }; |
| 498 | |
| 499 | /** |
| 500 | * enum sci_task_status - This enumeration depicts all of the possible task |
| 501 | * completion status values. Each value in this enumeration maps directly |
| 502 | * to a value in the enum sci_status enumeration. Please refer to that |
| 503 | * enumeration for detailed comments concerning what the status represents. |
| 504 | * |
| 505 | * Check to see that the following status are properly handled: |
| 506 | */ |
| 507 | enum sci_task_status { |
| 508 | SCI_TASK_SUCCESS = SCI_SUCCESS, |
| 509 | SCI_TASK_FAILURE = SCI_FAILURE, |
| 510 | SCI_TASK_FAILURE_INVALID_STATE = SCI_FAILURE_INVALID_STATE, |
| 511 | SCI_TASK_FAILURE_INSUFFICIENT_RESOURCES = SCI_FAILURE_INSUFFICIENT_RESOURCES, |
| 512 | SCI_TASK_FAILURE_UNSUPPORTED_PROTOCOL = SCI_FAILURE_UNSUPPORTED_PROTOCOL, |
| 513 | SCI_TASK_FAILURE_INVALID_TAG = SCI_FAILURE_INVALID_IO_TAG, |
| 514 | SCI_TASK_FAILURE_RESPONSE_VALID = SCI_FAILURE_IO_RESPONSE_VALID, |
| 515 | SCI_TASK_FAILURE_CONTROLLER_SPECIFIC_ERR = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR, |
| 516 | SCI_TASK_FAILURE_TERMINATED = SCI_FAILURE_IO_TERMINATED, |
| 517 | SCI_TASK_FAILURE_INVALID_PARAMETER_VALUE = SCI_FAILURE_INVALID_PARAMETER_VALUE, |
| 518 | |
| 519 | SCI_TASK_FAILURE_REMOTE_DEVICE_RESET_REQUIRED = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED, |
| 520 | SCI_TASK_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS = SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS |
| 521 | |
| 522 | }; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 523 | |
Dan Williams | f1f52e7 | 2011-05-10 02:28:45 -0700 | [diff] [blame^] | 524 | /** |
| 525 | * sci_swab32_cpy - convert between scsi and scu-hardware byte format |
| 526 | * @dest: receive the 4-byte endian swapped version of src |
| 527 | * @src: word aligned source buffer |
| 528 | * |
| 529 | * scu hardware handles SSP/SMP control, response, and unidentified |
| 530 | * frames in "big endian dword" order. Regardless of host endian this |
| 531 | * is always a swab32()-per-dword conversion of the standard definition, |
| 532 | * i.e. single byte fields swapped and multi-byte fields in little- |
| 533 | * endian |
| 534 | */ |
| 535 | static inline void sci_swab32_cpy(void *_dest, void *_src, ssize_t word_cnt) |
| 536 | { |
| 537 | u32 *dest = _dest, *src = _src; |
| 538 | |
| 539 | while (--word_cnt >= 0) |
| 540 | dest[word_cnt] = swab32(src[word_cnt]); |
| 541 | } |
| 542 | |
Dave Jiang | b5f18a2 | 2011-03-16 14:57:23 -0700 | [diff] [blame] | 543 | extern unsigned char no_outbound_task_to; |
| 544 | extern u16 ssp_max_occ_to; |
| 545 | extern u16 stp_max_occ_to; |
| 546 | extern u16 ssp_inactive_to; |
| 547 | extern u16 stp_inactive_to; |
| 548 | extern unsigned char phy_gen; |
| 549 | extern unsigned char max_concurr_spinup; |
| 550 | |
Dan Williams | c7ef403 | 2011-02-18 09:25:05 -0800 | [diff] [blame] | 551 | irqreturn_t isci_msix_isr(int vec, void *data); |
| 552 | irqreturn_t isci_intx_isr(int vec, void *data); |
Dan Williams | 92f4f0f | 2011-02-18 09:25:11 -0800 | [diff] [blame] | 553 | irqreturn_t isci_error_isr(int vec, void *data); |
Dan Williams | 5409bc3 | 2011-03-08 21:30:28 -0800 | [diff] [blame] | 554 | #endif /* __ISCI_H__ */ |