162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Data structures and definitions for the CAM system.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 1997 Justin T. Gibbs.
562306a36Sopenharmony_ci * Copyright (c) 2000 Adaptec Inc.
662306a36Sopenharmony_ci * All rights reserved.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
962306a36Sopenharmony_ci * modification, are permitted provided that the following conditions
1062306a36Sopenharmony_ci * are met:
1162306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
1262306a36Sopenharmony_ci *    notice, this list of conditions, and the following disclaimer,
1362306a36Sopenharmony_ci *    without modification.
1462306a36Sopenharmony_ci * 2. The name of the author may not be used to endorse or promote products
1562306a36Sopenharmony_ci *    derived from this software without specific prior written permission.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
1862306a36Sopenharmony_ci * GNU General Public License ("GPL").
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2162306a36Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2262306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2362306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
2462306a36Sopenharmony_ci * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2562306a36Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2662306a36Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2762306a36Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2862306a36Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2962306a36Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3062306a36Sopenharmony_ci * SUCH DAMAGE.
3162306a36Sopenharmony_ci *
3262306a36Sopenharmony_ci * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/cam.h#15 $
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef _AIC7XXX_CAM_H
3662306a36Sopenharmony_ci#define _AIC7XXX_CAM_H 1
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#include <linux/types.h>
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define	CAM_BUS_WILDCARD ((u_int)~0)
4162306a36Sopenharmony_ci#define	CAM_TARGET_WILDCARD ((u_int)~0)
4262306a36Sopenharmony_ci#define	CAM_LUN_WILDCARD ((u_int)~0)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* CAM Status field values */
4562306a36Sopenharmony_citypedef enum {
4662306a36Sopenharmony_ci	CAM_REQ_INPROG,		/* CCB request is in progress */
4762306a36Sopenharmony_ci	CAM_REQ_CMP,		/* CCB request completed without error */
4862306a36Sopenharmony_ci	CAM_REQ_ABORTED,	/* CCB request aborted by the host */
4962306a36Sopenharmony_ci	CAM_UA_ABORT,		/* Unable to abort CCB request */
5062306a36Sopenharmony_ci	CAM_REQ_CMP_ERR,	/* CCB request completed with an error */
5162306a36Sopenharmony_ci	CAM_BUSY,		/* CAM subsystem is busy */
5262306a36Sopenharmony_ci	CAM_REQ_INVALID,	/* CCB request was invalid */
5362306a36Sopenharmony_ci	CAM_PATH_INVALID,	/* Supplied Path ID is invalid */
5462306a36Sopenharmony_ci	CAM_SEL_TIMEOUT,	/* Target Selection Timeout */
5562306a36Sopenharmony_ci	CAM_CMD_TIMEOUT,	/* Command timeout */
5662306a36Sopenharmony_ci	CAM_SCSI_STATUS_ERROR,	/* SCSI error, look at error code in CCB */
5762306a36Sopenharmony_ci	CAM_SCSI_BUS_RESET,	/* SCSI Bus Reset Sent/Received */
5862306a36Sopenharmony_ci	CAM_UNCOR_PARITY,	/* Uncorrectable parity error occurred */
5962306a36Sopenharmony_ci	CAM_AUTOSENSE_FAIL,	/* Autosense: request sense cmd fail */
6062306a36Sopenharmony_ci	CAM_NO_HBA,		/* No HBA Detected Error */
6162306a36Sopenharmony_ci	CAM_DATA_RUN_ERR,	/* Data Overrun error */
6262306a36Sopenharmony_ci	CAM_UNEXP_BUSFREE,	/* Unexpected Bus Free */
6362306a36Sopenharmony_ci	CAM_SEQUENCE_FAIL,	/* Protocol Violation */
6462306a36Sopenharmony_ci	CAM_CCB_LEN_ERR,	/* CCB length supplied is inadequate */
6562306a36Sopenharmony_ci	CAM_PROVIDE_FAIL,	/* Unable to provide requested capability */
6662306a36Sopenharmony_ci	CAM_BDR_SENT,		/* A SCSI BDR msg was sent to target */
6762306a36Sopenharmony_ci	CAM_REQ_TERMIO,		/* CCB request terminated by the host */
6862306a36Sopenharmony_ci	CAM_UNREC_HBA_ERROR,	/* Unrecoverable Host Bus Adapter Error */
6962306a36Sopenharmony_ci	CAM_REQ_TOO_BIG,	/* The request was too large for this host */
7062306a36Sopenharmony_ci	CAM_UA_TERMIO,		/* Unable to terminate I/O CCB request */
7162306a36Sopenharmony_ci	CAM_MSG_REJECT_REC,	/* Message Reject Received */
7262306a36Sopenharmony_ci	CAM_DEV_NOT_THERE,	/* SCSI Device Not Installed/there */
7362306a36Sopenharmony_ci	CAM_RESRC_UNAVAIL,	/* Resource Unavailable */
7462306a36Sopenharmony_ci	/*
7562306a36Sopenharmony_ci	 * This request should be requeued to preserve
7662306a36Sopenharmony_ci	 * transaction ordering.  This typically occurs
7762306a36Sopenharmony_ci	 * when the SIM recognizes an error that should
7862306a36Sopenharmony_ci	 * freeze the queue and must place additional
7962306a36Sopenharmony_ci	 * requests for the target at the sim level
8062306a36Sopenharmony_ci	 * back into the XPT queue.
8162306a36Sopenharmony_ci	 */
8262306a36Sopenharmony_ci	CAM_REQUEUE_REQ,
8362306a36Sopenharmony_ci	CAM_DEV_QFRZN		= 0x40,
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci	CAM_STATUS_MASK		= 0x3F
8662306a36Sopenharmony_ci} cam_status;
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci/*
8962306a36Sopenharmony_ci * Definitions for the asynchronous callback CCB fields.
9062306a36Sopenharmony_ci */
9162306a36Sopenharmony_citypedef enum {
9262306a36Sopenharmony_ci	AC_GETDEV_CHANGED	= 0x800,/* Getdev info might have changed */
9362306a36Sopenharmony_ci	AC_INQ_CHANGED		= 0x400,/* Inquiry info might have changed */
9462306a36Sopenharmony_ci	AC_TRANSFER_NEG		= 0x200,/* New transfer settings in effect */
9562306a36Sopenharmony_ci	AC_LOST_DEVICE		= 0x100,/* A device went away */
9662306a36Sopenharmony_ci	AC_FOUND_DEVICE		= 0x080,/* A new device was found */
9762306a36Sopenharmony_ci	AC_PATH_DEREGISTERED	= 0x040,/* A path has de-registered */
9862306a36Sopenharmony_ci	AC_PATH_REGISTERED	= 0x020,/* A new path has been registered */
9962306a36Sopenharmony_ci	AC_SENT_BDR		= 0x010,/* A BDR message was sent to target */
10062306a36Sopenharmony_ci	AC_SCSI_AEN		= 0x008,/* A SCSI AEN has been received */
10162306a36Sopenharmony_ci	AC_UNSOL_RESEL		= 0x002,/* Unsolicited reselection occurred */
10262306a36Sopenharmony_ci	AC_BUS_RESET		= 0x001 /* A SCSI bus reset occurred */
10362306a36Sopenharmony_ci} ac_code;
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_citypedef enum {
10662306a36Sopenharmony_ci	CAM_DIR_IN		= DMA_FROM_DEVICE,
10762306a36Sopenharmony_ci	CAM_DIR_OUT		= DMA_TO_DEVICE,
10862306a36Sopenharmony_ci	CAM_DIR_NONE		= DMA_NONE,
10962306a36Sopenharmony_ci} ccb_flags;
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#endif /* _AIC7XXX_CAM_H */
112