xref: /OK3568_Linux_fs/kernel/drivers/scsi/aic7xxx/cam.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Data structures and definitions for the CAM system.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (c) 1997 Justin T. Gibbs.
5*4882a593Smuzhiyun  * Copyright (c) 2000 Adaptec Inc.
6*4882a593Smuzhiyun  * All rights reserved.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
9*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions
10*4882a593Smuzhiyun  * are met:
11*4882a593Smuzhiyun  * 1. Redistributions of source code must retain the above copyright
12*4882a593Smuzhiyun  *    notice, this list of conditions, and the following disclaimer,
13*4882a593Smuzhiyun  *    without modification.
14*4882a593Smuzhiyun  * 2. The name of the author may not be used to endorse or promote products
15*4882a593Smuzhiyun  *    derived from this software without specific prior written permission.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * Alternatively, this software may be distributed under the terms of the
18*4882a593Smuzhiyun  * GNU General Public License ("GPL").
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21*4882a593Smuzhiyun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*4882a593Smuzhiyun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*4882a593Smuzhiyun  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
24*4882a593Smuzhiyun  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*4882a593Smuzhiyun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*4882a593Smuzhiyun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*4882a593Smuzhiyun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*4882a593Smuzhiyun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*4882a593Smuzhiyun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*4882a593Smuzhiyun  * SUCH DAMAGE.
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/cam.h#15 $
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #ifndef _AIC7XXX_CAM_H
36*4882a593Smuzhiyun #define _AIC7XXX_CAM_H 1
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #include <linux/types.h>
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun #define	CAM_BUS_WILDCARD ((u_int)~0)
41*4882a593Smuzhiyun #define	CAM_TARGET_WILDCARD ((u_int)~0)
42*4882a593Smuzhiyun #define	CAM_LUN_WILDCARD ((u_int)~0)
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun /* CAM Status field values */
45*4882a593Smuzhiyun typedef enum {
46*4882a593Smuzhiyun 	CAM_REQ_INPROG,		/* CCB request is in progress */
47*4882a593Smuzhiyun 	CAM_REQ_CMP,		/* CCB request completed without error */
48*4882a593Smuzhiyun 	CAM_REQ_ABORTED,	/* CCB request aborted by the host */
49*4882a593Smuzhiyun 	CAM_UA_ABORT,		/* Unable to abort CCB request */
50*4882a593Smuzhiyun 	CAM_REQ_CMP_ERR,	/* CCB request completed with an error */
51*4882a593Smuzhiyun 	CAM_BUSY,		/* CAM subsystem is busy */
52*4882a593Smuzhiyun 	CAM_REQ_INVALID,	/* CCB request was invalid */
53*4882a593Smuzhiyun 	CAM_PATH_INVALID,	/* Supplied Path ID is invalid */
54*4882a593Smuzhiyun 	CAM_SEL_TIMEOUT,	/* Target Selection Timeout */
55*4882a593Smuzhiyun 	CAM_CMD_TIMEOUT,	/* Command timeout */
56*4882a593Smuzhiyun 	CAM_SCSI_STATUS_ERROR,	/* SCSI error, look at error code in CCB */
57*4882a593Smuzhiyun 	CAM_SCSI_BUS_RESET,	/* SCSI Bus Reset Sent/Received */
58*4882a593Smuzhiyun 	CAM_UNCOR_PARITY,	/* Uncorrectable parity error occurred */
59*4882a593Smuzhiyun 	CAM_AUTOSENSE_FAIL,	/* Autosense: request sense cmd fail */
60*4882a593Smuzhiyun 	CAM_NO_HBA,		/* No HBA Detected Error */
61*4882a593Smuzhiyun 	CAM_DATA_RUN_ERR,	/* Data Overrun error */
62*4882a593Smuzhiyun 	CAM_UNEXP_BUSFREE,	/* Unexpected Bus Free */
63*4882a593Smuzhiyun 	CAM_SEQUENCE_FAIL,	/* Protocol Violation */
64*4882a593Smuzhiyun 	CAM_CCB_LEN_ERR,	/* CCB length supplied is inadequate */
65*4882a593Smuzhiyun 	CAM_PROVIDE_FAIL,	/* Unable to provide requested capability */
66*4882a593Smuzhiyun 	CAM_BDR_SENT,		/* A SCSI BDR msg was sent to target */
67*4882a593Smuzhiyun 	CAM_REQ_TERMIO,		/* CCB request terminated by the host */
68*4882a593Smuzhiyun 	CAM_UNREC_HBA_ERROR,	/* Unrecoverable Host Bus Adapter Error */
69*4882a593Smuzhiyun 	CAM_REQ_TOO_BIG,	/* The request was too large for this host */
70*4882a593Smuzhiyun 	CAM_UA_TERMIO,		/* Unable to terminate I/O CCB request */
71*4882a593Smuzhiyun 	CAM_MSG_REJECT_REC,	/* Message Reject Received */
72*4882a593Smuzhiyun 	CAM_DEV_NOT_THERE,	/* SCSI Device Not Installed/there */
73*4882a593Smuzhiyun 	CAM_RESRC_UNAVAIL,	/* Resource Unavailable */
74*4882a593Smuzhiyun 	/*
75*4882a593Smuzhiyun 	 * This request should be requeued to preserve
76*4882a593Smuzhiyun 	 * transaction ordering.  This typically occurs
77*4882a593Smuzhiyun 	 * when the SIM recognizes an error that should
78*4882a593Smuzhiyun 	 * freeze the queue and must place additional
79*4882a593Smuzhiyun 	 * requests for the target at the sim level
80*4882a593Smuzhiyun 	 * back into the XPT queue.
81*4882a593Smuzhiyun 	 */
82*4882a593Smuzhiyun 	CAM_REQUEUE_REQ,
83*4882a593Smuzhiyun 	CAM_DEV_QFRZN		= 0x40,
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun 	CAM_STATUS_MASK		= 0x3F
86*4882a593Smuzhiyun } cam_status;
87*4882a593Smuzhiyun 
88*4882a593Smuzhiyun /*
89*4882a593Smuzhiyun  * Definitions for the asynchronous callback CCB fields.
90*4882a593Smuzhiyun  */
91*4882a593Smuzhiyun typedef enum {
92*4882a593Smuzhiyun 	AC_GETDEV_CHANGED	= 0x800,/* Getdev info might have changed */
93*4882a593Smuzhiyun 	AC_INQ_CHANGED		= 0x400,/* Inquiry info might have changed */
94*4882a593Smuzhiyun 	AC_TRANSFER_NEG		= 0x200,/* New transfer settings in effect */
95*4882a593Smuzhiyun 	AC_LOST_DEVICE		= 0x100,/* A device went away */
96*4882a593Smuzhiyun 	AC_FOUND_DEVICE		= 0x080,/* A new device was found */
97*4882a593Smuzhiyun 	AC_PATH_DEREGISTERED	= 0x040,/* A path has de-registered */
98*4882a593Smuzhiyun 	AC_PATH_REGISTERED	= 0x020,/* A new path has been registered */
99*4882a593Smuzhiyun 	AC_SENT_BDR		= 0x010,/* A BDR message was sent to target */
100*4882a593Smuzhiyun 	AC_SCSI_AEN		= 0x008,/* A SCSI AEN has been received */
101*4882a593Smuzhiyun 	AC_UNSOL_RESEL		= 0x002,/* Unsolicited reselection occurred */
102*4882a593Smuzhiyun 	AC_BUS_RESET		= 0x001 /* A SCSI bus reset occurred */
103*4882a593Smuzhiyun } ac_code;
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun typedef enum {
106*4882a593Smuzhiyun 	CAM_DIR_IN		= DMA_FROM_DEVICE,
107*4882a593Smuzhiyun 	CAM_DIR_OUT		= DMA_TO_DEVICE,
108*4882a593Smuzhiyun 	CAM_DIR_NONE		= DMA_NONE,
109*4882a593Smuzhiyun } ccb_flags;
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun #endif /* _AIC7XXX_CAM_H */
112