xref: /openbmc/linux/drivers/scsi/aic7xxx/cam.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Data structures and definitions for the CAM system.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (c) 1997 Justin T. Gibbs.
51da177e4SLinus Torvalds  * Copyright (c) 2000 Adaptec Inc.
61da177e4SLinus Torvalds  * All rights reserved.
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  * Redistribution and use in source and binary forms, with or without
91da177e4SLinus Torvalds  * modification, are permitted provided that the following conditions
101da177e4SLinus Torvalds  * are met:
111da177e4SLinus Torvalds  * 1. Redistributions of source code must retain the above copyright
121da177e4SLinus Torvalds  *    notice, this list of conditions, and the following disclaimer,
131da177e4SLinus Torvalds  *    without modification.
141da177e4SLinus Torvalds  * 2. The name of the author may not be used to endorse or promote products
151da177e4SLinus Torvalds  *    derived from this software without specific prior written permission.
161da177e4SLinus Torvalds  *
171da177e4SLinus Torvalds  * Alternatively, this software may be distributed under the terms of the
181da177e4SLinus Torvalds  * GNU General Public License ("GPL").
191da177e4SLinus Torvalds  *
201da177e4SLinus Torvalds  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
211da177e4SLinus Torvalds  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221da177e4SLinus Torvalds  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231da177e4SLinus Torvalds  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
241da177e4SLinus Torvalds  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251da177e4SLinus Torvalds  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261da177e4SLinus Torvalds  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271da177e4SLinus Torvalds  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281da177e4SLinus Torvalds  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291da177e4SLinus Torvalds  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301da177e4SLinus Torvalds  * SUCH DAMAGE.
311da177e4SLinus Torvalds  *
321da177e4SLinus Torvalds  * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/cam.h#15 $
331da177e4SLinus Torvalds  */
341da177e4SLinus Torvalds 
351da177e4SLinus Torvalds #ifndef _AIC7XXX_CAM_H
361da177e4SLinus Torvalds #define _AIC7XXX_CAM_H 1
371da177e4SLinus Torvalds 
381da177e4SLinus Torvalds #include <linux/types.h>
391da177e4SLinus Torvalds 
401da177e4SLinus Torvalds #define	CAM_BUS_WILDCARD ((u_int)~0)
411da177e4SLinus Torvalds #define	CAM_TARGET_WILDCARD ((u_int)~0)
421da177e4SLinus Torvalds #define	CAM_LUN_WILDCARD ((u_int)~0)
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds /* CAM Status field values */
451da177e4SLinus Torvalds typedef enum {
461da177e4SLinus Torvalds 	CAM_REQ_INPROG,		/* CCB request is in progress */
471da177e4SLinus Torvalds 	CAM_REQ_CMP,		/* CCB request completed without error */
481da177e4SLinus Torvalds 	CAM_REQ_ABORTED,	/* CCB request aborted by the host */
491da177e4SLinus Torvalds 	CAM_UA_ABORT,		/* Unable to abort CCB request */
501da177e4SLinus Torvalds 	CAM_REQ_CMP_ERR,	/* CCB request completed with an error */
51*3a4fa0a2SRobert P. J. Day 	CAM_BUSY,		/* CAM subsystem is busy */
521da177e4SLinus Torvalds 	CAM_REQ_INVALID,	/* CCB request was invalid */
531da177e4SLinus Torvalds 	CAM_PATH_INVALID,	/* Supplied Path ID is invalid */
541da177e4SLinus Torvalds 	CAM_SEL_TIMEOUT,	/* Target Selection Timeout */
551da177e4SLinus Torvalds 	CAM_CMD_TIMEOUT,	/* Command timeout */
561da177e4SLinus Torvalds 	CAM_SCSI_STATUS_ERROR,	/* SCSI error, look at error code in CCB */
571da177e4SLinus Torvalds 	CAM_SCSI_BUS_RESET,	/* SCSI Bus Reset Sent/Received */
581da177e4SLinus Torvalds 	CAM_UNCOR_PARITY,	/* Uncorrectable parity error occurred */
591da177e4SLinus Torvalds 	CAM_AUTOSENSE_FAIL,	/* Autosense: request sense cmd fail */
601da177e4SLinus Torvalds 	CAM_NO_HBA,		/* No HBA Detected Error */
611da177e4SLinus Torvalds 	CAM_DATA_RUN_ERR,	/* Data Overrun error */
621da177e4SLinus Torvalds 	CAM_UNEXP_BUSFREE,	/* Unexpected Bus Free */
631da177e4SLinus Torvalds 	CAM_SEQUENCE_FAIL,	/* Protocol Violation */
641da177e4SLinus Torvalds 	CAM_CCB_LEN_ERR,	/* CCB length supplied is inadequate */
651da177e4SLinus Torvalds 	CAM_PROVIDE_FAIL,	/* Unable to provide requested capability */
661da177e4SLinus Torvalds 	CAM_BDR_SENT,		/* A SCSI BDR msg was sent to target */
671da177e4SLinus Torvalds 	CAM_REQ_TERMIO,		/* CCB request terminated by the host */
681da177e4SLinus Torvalds 	CAM_UNREC_HBA_ERROR,	/* Unrecoverable Host Bus Adapter Error */
691da177e4SLinus Torvalds 	CAM_REQ_TOO_BIG,	/* The request was too large for this host */
701da177e4SLinus Torvalds 	CAM_UA_TERMIO,		/* Unable to terminate I/O CCB request */
711da177e4SLinus Torvalds 	CAM_MSG_REJECT_REC,	/* Message Reject Received */
721da177e4SLinus Torvalds 	CAM_DEV_NOT_THERE,	/* SCSI Device Not Installed/there */
731da177e4SLinus Torvalds 	CAM_RESRC_UNAVAIL,	/* Resource Unavailable */
741da177e4SLinus Torvalds 	/*
751da177e4SLinus Torvalds 	 * This request should be requeued to preserve
761da177e4SLinus Torvalds 	 * transaction ordering.  This typically occurs
771da177e4SLinus Torvalds 	 * when the SIM recognizes an error that should
781da177e4SLinus Torvalds 	 * freeze the queue and must place additional
791da177e4SLinus Torvalds 	 * requests for the target at the sim level
801da177e4SLinus Torvalds 	 * back into the XPT queue.
811da177e4SLinus Torvalds 	 */
821da177e4SLinus Torvalds 	CAM_REQUEUE_REQ,
831da177e4SLinus Torvalds 	CAM_DEV_QFRZN		= 0x40,
841da177e4SLinus Torvalds 
851da177e4SLinus Torvalds 	CAM_STATUS_MASK		= 0x3F
861da177e4SLinus Torvalds } cam_status;
871da177e4SLinus Torvalds 
881da177e4SLinus Torvalds /*
891da177e4SLinus Torvalds  * Definitions for the asynchronous callback CCB fields.
901da177e4SLinus Torvalds  */
911da177e4SLinus Torvalds typedef enum {
921da177e4SLinus Torvalds 	AC_GETDEV_CHANGED	= 0x800,/* Getdev info might have changed */
931da177e4SLinus Torvalds 	AC_INQ_CHANGED		= 0x400,/* Inquiry info might have changed */
941da177e4SLinus Torvalds 	AC_TRANSFER_NEG		= 0x200,/* New transfer settings in effect */
951da177e4SLinus Torvalds 	AC_LOST_DEVICE		= 0x100,/* A device went away */
961da177e4SLinus Torvalds 	AC_FOUND_DEVICE		= 0x080,/* A new device was found */
971da177e4SLinus Torvalds 	AC_PATH_DEREGISTERED	= 0x040,/* A path has de-registered */
981da177e4SLinus Torvalds 	AC_PATH_REGISTERED	= 0x020,/* A new path has been registered */
991da177e4SLinus Torvalds 	AC_SENT_BDR		= 0x010,/* A BDR message was sent to target */
1001da177e4SLinus Torvalds 	AC_SCSI_AEN		= 0x008,/* A SCSI AEN has been received */
1011da177e4SLinus Torvalds 	AC_UNSOL_RESEL		= 0x002,/* Unsolicited reselection occurred */
1021da177e4SLinus Torvalds 	AC_BUS_RESET		= 0x001 /* A SCSI bus reset occurred */
1031da177e4SLinus Torvalds } ac_code;
1041da177e4SLinus Torvalds 
1051da177e4SLinus Torvalds typedef enum {
106be7db055S 	CAM_DIR_IN		= DMA_FROM_DEVICE,
107be7db055S 	CAM_DIR_OUT		= DMA_TO_DEVICE,
108be7db055S 	CAM_DIR_NONE		= DMA_NONE,
1091da177e4SLinus Torvalds } ccb_flags;
1101da177e4SLinus Torvalds 
1111da177e4SLinus Torvalds #endif /* _AIC7XXX_CAM_H */
112