| 1 | /* $NetBSD: aic7xxx_cam.h,v 1.5 2016/10/30 23:35:10 mlelstv Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Data structures and definitions for the CAM system. |
| 5 | * |
| 6 | * Copyright (c) 1997 Justin T. Gibbs. |
| 7 | * Copyright (c) 2000 Adaptec Inc. |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions |
| 12 | * are met: |
| 13 | * 1. Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions, and the following disclaimer, |
| 15 | * without modification. |
| 16 | * 2. The name of the author may not be used to endorse or promote products |
| 17 | * derived from this software without specific prior written permission. |
| 18 | * |
| 19 | * Alternatively, this software may be distributed under the terms of the |
| 20 | * GNU General Public License ("GPL"). |
| 21 | * |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR |
| 26 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | * SUCH DAMAGE. |
| 33 | * |
| 34 | */ |
| 35 | /* |
| 36 | * Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003 |
| 37 | */ |
| 38 | |
| 39 | #ifndef _AIC7XXX_CAM_H |
| 40 | #define _AIC7XXX_CAM_H |
| 41 | |
| 42 | #define SCSI_REV_2 2 |
| 43 | |
| 44 | |
| 45 | #define CAM_BUS_WILDCARD ((u_int)~0) |
| 46 | #define CAM_TARGET_WILDCARD ((u_int)~0) |
| 47 | #define CAM_LUN_WILDCARD -1 |
| 48 | |
| 49 | /* |
| 50 | * XXX translate FreeBSD SCSI status byte values to NetBSD, and define |
| 51 | * a few more. |
| 52 | */ |
| 53 | #define SCSI_STATUS_OK SCSI_OK |
| 54 | #define SCSI_STATUS_CHECK_COND SCSI_CHECK |
| 55 | #define SCSI_STATUS_COND_MET 0x04 |
| 56 | #define SCSI_STATUS_BUSY SCSI_BUSY |
| 57 | #define SCSI_STATUS_INTERMED SCSI_INTERM |
| 58 | #define SCSI_STATUS_INTERMED_COND_MET 0x14 |
| 59 | #define SCSI_STATUS_RESERV_CONFLICT 0x18 |
| 60 | #define SCSI_STATUS_CMD_TERMINATED SCSI_TERMINATED |
| 61 | #define SCSI_STATUS_QUEUE_FULL SCSI_QUEUE_FULL |
| 62 | |
| 63 | /* CAM Status field values */ |
| 64 | typedef enum { |
| 65 | CAM_REQ_INPROG = XS_STS_DONE, /* CCB request is in progress */ |
| 66 | CAM_REQ_CMP = XS_NOERROR, /* CCB request completed without error */ |
| 67 | CAM_REQ_ABORTED = XS_DRIVER_STUFFUP, /* CCB request aborted by the host */ |
| 68 | CAM_UA_ABORT, /* Unable to abort CCB request */ |
| 69 | CAM_REQ_CMP_ERR = XS_DRIVER_STUFFUP, /* CCB request completed with an error */ |
| 70 | CAM_BUSY = XS_BUSY, /* CAM subsytem is busy */ |
| 71 | CAM_REQ_INVALID = XS_DRIVER_STUFFUP, /* CCB request was invalid */ |
| 72 | CAM_PATH_INVALID, /* Supplied Path ID is invalid */ |
| 73 | CAM_SEL_TIMEOUT = XS_SELTIMEOUT, /* Target Selection Timeout */ |
| 74 | CAM_CMD_TIMEOUT = XS_TIMEOUT, /* Command timeout */ |
| 75 | CAM_SCSI_STATUS_ERROR, /* SCSI error, look at error code in CCB */ |
| 76 | CAM_SCSI_BUS_RESET = XS_RESET, /* SCSI Bus Reset Sent/Received */ |
| 77 | CAM_UNCOR_PARITY = XS_DRIVER_STUFFUP, /* Uncorrectable parity error occurred */ |
| 78 | CAM_AUTOSENSE_FAIL = XS_DRIVER_STUFFUP, /* Autosense: request sense cmd fail */ |
| 79 | CAM_NO_HBA = XS_DRIVER_STUFFUP, /* No HBA Detected Error */ |
| 80 | CAM_DATA_RUN_ERR = XS_DRIVER_STUFFUP, /* Data Overrun error */ |
| 81 | CAM_UNEXP_BUSFREE = XS_DRIVER_STUFFUP, /* Unexpected Bus Free */ |
| 82 | CAM_SEQUENCE_FAIL = XS_DRIVER_STUFFUP, /* Protocol Violation */ |
| 83 | CAM_CCB_LEN_ERR, /* CCB length supplied is inadequate */ |
| 84 | CAM_PROVIDE_FAIL, /* Unable to provide requested capability */ |
| 85 | CAM_BDR_SENT = XS_RESET, /* A SCSI BDR msg was sent to target */ |
| 86 | CAM_REQ_TERMIO, /* CCB request terminated by the host */ |
| 87 | CAM_UNREC_HBA_ERROR, /* Unrecoverable Host Bus Adapter Error */ |
| 88 | CAM_REQ_TOO_BIG, /* The request was too large for this host */ |
| 89 | CAM_UA_TERMIO, /* Unable to terminate I/O CCB request */ |
| 90 | CAM_MSG_REJECT_REC, /* Message Reject Received */ |
| 91 | CAM_DEV_NOT_THERE, /* SCSI Device Not Installed/there */ |
| 92 | CAM_RESRC_UNAVAIL, /* Resource Unavailable */ |
| 93 | /* |
| 94 | * This request should be requeued to preserve |
| 95 | * transaction ordering. This typically occurs |
| 96 | * when the SIM recognizes an error that should |
| 97 | * freeze the queue and must place additional |
| 98 | * requests for the target at the sim level |
| 99 | * back into the XPT queue. |
| 100 | */ |
| 101 | CAM_REQUEUE_REQ = XS_REQUEUE, |
| 102 | CAM_DEV_QFRZN = 0x40, |
| 103 | |
| 104 | CAM_STATUS_MASK = 0x3F |
| 105 | } cam_status; |
| 106 | |
| 107 | typedef enum { |
| 108 | CAM_DIR_IN = XS_CTL_DATA_IN, |
| 109 | CAM_DIR_OUT = XS_CTL_DATA_OUT, |
| 110 | } ccb_flags; |
| 111 | |
| 112 | typedef enum { |
| 113 | AC_BUS_RESET = 0x001, |
| 114 | AC_UNSOL_RESEL = 0x002, |
| 115 | AC_SCSI_AEN = 0x008, |
| 116 | AC_SENT_BDR = 0x010, |
| 117 | AC_PATH_REGISTERED = 0x020, |
| 118 | AC_PATH_DEREGISTERED = 0x040, |
| 119 | AC_FOUND_DEVICE = 0x080, |
| 120 | AC_LOST_DEVICE = 0x100, |
| 121 | AC_TRANSFER_NEG = 0x200, |
| 122 | AC_INQ_CHANGED = 0x400, |
| 123 | AC_GETDEV_CHANGED = 0x800, |
| 124 | } ac_code; |
| 125 | |
| 126 | #endif /* _AIC7XXX_CAM_H */ |
| 127 | |