xref: /titanic_50/usr/src/uts/common/sys/scsi/generic/status.h (revision 0205780bc43902d17f94f07ceacb0cd8d5eab20f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0205780bSrralphs  * Common Development and Distribution License (the "License").
6*0205780bSrralphs  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*0205780bSrralphs  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*0205780bSrralphs  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_STATUS_H
277c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_STATUS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * SCSI status completion block
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * The SCSI standard specifies one byte of status.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * The definition of of the Status block as a bitfield
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate struct scsi_status {
467c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
477c478bd9Sstevel@tonic-gate 	uchar_t	sts_vu0		: 1,	/* vendor unique 		*/
487c478bd9Sstevel@tonic-gate 		sts_chk		: 1,	/* check condition 		*/
497c478bd9Sstevel@tonic-gate 		sts_cm		: 1,	/* condition met 		*/
507c478bd9Sstevel@tonic-gate 		sts_busy	: 1,	/* device busy or reserved 	*/
517c478bd9Sstevel@tonic-gate 		sts_is		: 1,	/* intermediate status sent 	*/
527c478bd9Sstevel@tonic-gate 		sts_vu6		: 1,	/* vendor unique 		*/
537c478bd9Sstevel@tonic-gate 		sts_vu7		: 1,	/* vendor unique 		*/
547c478bd9Sstevel@tonic-gate 		sts_resvd	: 1;	/* reserved 			*/
557c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
567c478bd9Sstevel@tonic-gate 	uchar_t	sts_resvd	: 1,	/* reserved */
577c478bd9Sstevel@tonic-gate 		sts_vu7		: 1,	/* vendor unique */
587c478bd9Sstevel@tonic-gate 		sts_vu6		: 1,	/* vendor unique */
597c478bd9Sstevel@tonic-gate 		sts_is		: 1,	/* intermediate status sent */
607c478bd9Sstevel@tonic-gate 		sts_busy	: 1,	/* device busy or reserved */
617c478bd9Sstevel@tonic-gate 		sts_cm		: 1,	/* condition met */
627c478bd9Sstevel@tonic-gate 		sts_chk		: 1,	/* check condition */
637c478bd9Sstevel@tonic-gate 		sts_vu0		: 1;	/* vendor unique */
647c478bd9Sstevel@tonic-gate #else
657c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
667c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
677c478bd9Sstevel@tonic-gate };
687c478bd9Sstevel@tonic-gate #define	sts_scsi2	sts_vu6		/* SCSI modifier bit */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * if auto request sense has been enabled, then use this structure
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate struct scsi_arq_status {
747c478bd9Sstevel@tonic-gate 	struct scsi_status	sts_status;
757c478bd9Sstevel@tonic-gate 	struct scsi_status	sts_rqpkt_status;
767c478bd9Sstevel@tonic-gate 	uchar_t			sts_rqpkt_reason;	/* reason completion */
777c478bd9Sstevel@tonic-gate 	uchar_t			sts_rqpkt_resid;	/* residue */
787c478bd9Sstevel@tonic-gate 	uint_t			sts_rqpkt_state;	/* state of command */
797c478bd9Sstevel@tonic-gate 	uint_t			sts_rqpkt_statistics;	/* statistics */
807c478bd9Sstevel@tonic-gate 	struct scsi_extended_sense sts_sensedata;
817c478bd9Sstevel@tonic-gate };
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define	SECMDS_STATUS_SIZE  (sizeof (struct scsi_arq_status))
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * Bit Mask definitions, for use accessing the status as a byte.
877c478bd9Sstevel@tonic-gate  */
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #define	STATUS_MASK			0x3E
907c478bd9Sstevel@tonic-gate #define	STATUS_GOOD			0x00
917c478bd9Sstevel@tonic-gate #define	STATUS_CHECK			0x02
927c478bd9Sstevel@tonic-gate #define	STATUS_MET			0x04
937c478bd9Sstevel@tonic-gate #define	STATUS_BUSY			0x08
947c478bd9Sstevel@tonic-gate #define	STATUS_INTERMEDIATE		0x10
957c478bd9Sstevel@tonic-gate #define	STATUS_SCSI2			0x20
967c478bd9Sstevel@tonic-gate #define	STATUS_INTERMEDIATE_MET		0x14
977c478bd9Sstevel@tonic-gate #define	STATUS_RESERVATION_CONFLICT	0x18
987c478bd9Sstevel@tonic-gate #define	STATUS_TERMINATED		0x22
997c478bd9Sstevel@tonic-gate #define	STATUS_QFULL			0x28
1007c478bd9Sstevel@tonic-gate #define	STATUS_ACA_ACTIVE		0x30
101*0205780bSrralphs #define	STATUS_TASK_ABORT		0x40
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * Some deviations from the one byte of Status are known. Each
1097c478bd9Sstevel@tonic-gate  * implementation will define them specifically
1107c478bd9Sstevel@tonic-gate  */
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/status.h>
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_STATUS_H */
115