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