18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Data structures and definitions for the CAM system.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (c) 1997 Justin T. Gibbs.
58c2ecf20Sopenharmony_ci * Copyright (c) 2000 Adaptec Inc.
68c2ecf20Sopenharmony_ci * All rights reserved.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
98c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
108c2ecf20Sopenharmony_ci * are met:
118c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
128c2ecf20Sopenharmony_ci *    notice, this list of conditions, and the following disclaimer,
138c2ecf20Sopenharmony_ci *    without modification.
148c2ecf20Sopenharmony_ci * 2. The name of the author may not be used to endorse or promote products
158c2ecf20Sopenharmony_ci *    derived from this software without specific prior written permission.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
188c2ecf20Sopenharmony_ci * GNU General Public License ("GPL").
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
218c2ecf20Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
228c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
238c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
248c2ecf20Sopenharmony_ci * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
258c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
268c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
278c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
288c2ecf20Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
298c2ecf20Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
308c2ecf20Sopenharmony_ci * SUCH DAMAGE.
318c2ecf20Sopenharmony_ci *
328c2ecf20Sopenharmony_ci * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/cam.h#15 $
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef _AIC7XXX_CAM_H
368c2ecf20Sopenharmony_ci#define _AIC7XXX_CAM_H 1
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#include <linux/types.h>
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define	CAM_BUS_WILDCARD ((u_int)~0)
418c2ecf20Sopenharmony_ci#define	CAM_TARGET_WILDCARD ((u_int)~0)
428c2ecf20Sopenharmony_ci#define	CAM_LUN_WILDCARD ((u_int)~0)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* CAM Status field values */
458c2ecf20Sopenharmony_citypedef enum {
468c2ecf20Sopenharmony_ci	CAM_REQ_INPROG,		/* CCB request is in progress */
478c2ecf20Sopenharmony_ci	CAM_REQ_CMP,		/* CCB request completed without error */
488c2ecf20Sopenharmony_ci	CAM_REQ_ABORTED,	/* CCB request aborted by the host */
498c2ecf20Sopenharmony_ci	CAM_UA_ABORT,		/* Unable to abort CCB request */
508c2ecf20Sopenharmony_ci	CAM_REQ_CMP_ERR,	/* CCB request completed with an error */
518c2ecf20Sopenharmony_ci	CAM_BUSY,		/* CAM subsystem is busy */
528c2ecf20Sopenharmony_ci	CAM_REQ_INVALID,	/* CCB request was invalid */
538c2ecf20Sopenharmony_ci	CAM_PATH_INVALID,	/* Supplied Path ID is invalid */
548c2ecf20Sopenharmony_ci	CAM_SEL_TIMEOUT,	/* Target Selection Timeout */
558c2ecf20Sopenharmony_ci	CAM_CMD_TIMEOUT,	/* Command timeout */
568c2ecf20Sopenharmony_ci	CAM_SCSI_STATUS_ERROR,	/* SCSI error, look at error code in CCB */
578c2ecf20Sopenharmony_ci	CAM_SCSI_BUS_RESET,	/* SCSI Bus Reset Sent/Received */
588c2ecf20Sopenharmony_ci	CAM_UNCOR_PARITY,	/* Uncorrectable parity error occurred */
598c2ecf20Sopenharmony_ci	CAM_AUTOSENSE_FAIL,	/* Autosense: request sense cmd fail */
608c2ecf20Sopenharmony_ci	CAM_NO_HBA,		/* No HBA Detected Error */
618c2ecf20Sopenharmony_ci	CAM_DATA_RUN_ERR,	/* Data Overrun error */
628c2ecf20Sopenharmony_ci	CAM_UNEXP_BUSFREE,	/* Unexpected Bus Free */
638c2ecf20Sopenharmony_ci	CAM_SEQUENCE_FAIL,	/* Protocol Violation */
648c2ecf20Sopenharmony_ci	CAM_CCB_LEN_ERR,	/* CCB length supplied is inadequate */
658c2ecf20Sopenharmony_ci	CAM_PROVIDE_FAIL,	/* Unable to provide requested capability */
668c2ecf20Sopenharmony_ci	CAM_BDR_SENT,		/* A SCSI BDR msg was sent to target */
678c2ecf20Sopenharmony_ci	CAM_REQ_TERMIO,		/* CCB request terminated by the host */
688c2ecf20Sopenharmony_ci	CAM_UNREC_HBA_ERROR,	/* Unrecoverable Host Bus Adapter Error */
698c2ecf20Sopenharmony_ci	CAM_REQ_TOO_BIG,	/* The request was too large for this host */
708c2ecf20Sopenharmony_ci	CAM_UA_TERMIO,		/* Unable to terminate I/O CCB request */
718c2ecf20Sopenharmony_ci	CAM_MSG_REJECT_REC,	/* Message Reject Received */
728c2ecf20Sopenharmony_ci	CAM_DEV_NOT_THERE,	/* SCSI Device Not Installed/there */
738c2ecf20Sopenharmony_ci	CAM_RESRC_UNAVAIL,	/* Resource Unavailable */
748c2ecf20Sopenharmony_ci	/*
758c2ecf20Sopenharmony_ci	 * This request should be requeued to preserve
768c2ecf20Sopenharmony_ci	 * transaction ordering.  This typically occurs
778c2ecf20Sopenharmony_ci	 * when the SIM recognizes an error that should
788c2ecf20Sopenharmony_ci	 * freeze the queue and must place additional
798c2ecf20Sopenharmony_ci	 * requests for the target at the sim level
808c2ecf20Sopenharmony_ci	 * back into the XPT queue.
818c2ecf20Sopenharmony_ci	 */
828c2ecf20Sopenharmony_ci	CAM_REQUEUE_REQ,
838c2ecf20Sopenharmony_ci	CAM_DEV_QFRZN		= 0x40,
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	CAM_STATUS_MASK		= 0x3F
868c2ecf20Sopenharmony_ci} cam_status;
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/*
898c2ecf20Sopenharmony_ci * Definitions for the asynchronous callback CCB fields.
908c2ecf20Sopenharmony_ci */
918c2ecf20Sopenharmony_citypedef enum {
928c2ecf20Sopenharmony_ci	AC_GETDEV_CHANGED	= 0x800,/* Getdev info might have changed */
938c2ecf20Sopenharmony_ci	AC_INQ_CHANGED		= 0x400,/* Inquiry info might have changed */
948c2ecf20Sopenharmony_ci	AC_TRANSFER_NEG		= 0x200,/* New transfer settings in effect */
958c2ecf20Sopenharmony_ci	AC_LOST_DEVICE		= 0x100,/* A device went away */
968c2ecf20Sopenharmony_ci	AC_FOUND_DEVICE		= 0x080,/* A new device was found */
978c2ecf20Sopenharmony_ci	AC_PATH_DEREGISTERED	= 0x040,/* A path has de-registered */
988c2ecf20Sopenharmony_ci	AC_PATH_REGISTERED	= 0x020,/* A new path has been registered */
998c2ecf20Sopenharmony_ci	AC_SENT_BDR		= 0x010,/* A BDR message was sent to target */
1008c2ecf20Sopenharmony_ci	AC_SCSI_AEN		= 0x008,/* A SCSI AEN has been received */
1018c2ecf20Sopenharmony_ci	AC_UNSOL_RESEL		= 0x002,/* Unsolicited reselection occurred */
1028c2ecf20Sopenharmony_ci	AC_BUS_RESET		= 0x001 /* A SCSI bus reset occurred */
1038c2ecf20Sopenharmony_ci} ac_code;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_citypedef enum {
1068c2ecf20Sopenharmony_ci	CAM_DIR_IN		= DMA_FROM_DEVICE,
1078c2ecf20Sopenharmony_ci	CAM_DIR_OUT		= DMA_TO_DEVICE,
1088c2ecf20Sopenharmony_ci	CAM_DIR_NONE		= DMA_NONE,
1098c2ecf20Sopenharmony_ci} ccb_flags;
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#endif /* _AIC7XXX_CAM_H */
112