xref: /titanic_52/usr/src/uts/common/sys/scsi/generic/status.h (revision c7158ae983f5a04c4a998f468ecefba6d23ba721)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SCSI_GENERIC_STATUS_H
28 #define	_SYS_SCSI_GENERIC_STATUS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * SCSI status completion block
38  *
39  * The SCSI standard specifies one byte of status.
40  */
41 
42 /*
43  * The definition of of the Status block as a bitfield
44  */
45 
46 struct scsi_status {
47 #if defined(_BIT_FIELDS_LTOH)
48 	uchar_t	sts_vu0		: 1,	/* vendor unique 		*/
49 		sts_chk		: 1,	/* check condition 		*/
50 		sts_cm		: 1,	/* condition met 		*/
51 		sts_busy	: 1,	/* device busy or reserved 	*/
52 		sts_is		: 1,	/* intermediate status sent 	*/
53 		sts_vu6		: 1,	/* vendor unique 		*/
54 		sts_vu7		: 1,	/* vendor unique 		*/
55 		sts_resvd	: 1;	/* reserved 			*/
56 #elif defined(_BIT_FIELDS_HTOL)
57 	uchar_t	sts_resvd	: 1,	/* reserved */
58 		sts_vu7		: 1,	/* vendor unique */
59 		sts_vu6		: 1,	/* vendor unique */
60 		sts_is		: 1,	/* intermediate status sent */
61 		sts_busy	: 1,	/* device busy or reserved */
62 		sts_cm		: 1,	/* condition met */
63 		sts_chk		: 1,	/* check condition */
64 		sts_vu0		: 1;	/* vendor unique */
65 #else
66 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
67 #endif	/* _BIT_FIELDS_LTOH */
68 };
69 #define	sts_scsi2	sts_vu6		/* SCSI modifier bit */
70 
71 /*
72  * if auto request sense has been enabled, then use this structure
73  */
74 struct scsi_arq_status {
75 	struct scsi_status	sts_status;
76 	struct scsi_status	sts_rqpkt_status;
77 	uchar_t			sts_rqpkt_reason;	/* reason completion */
78 	uchar_t			sts_rqpkt_resid;	/* residue */
79 	uint_t			sts_rqpkt_state;	/* state of command */
80 	uint_t			sts_rqpkt_statistics;	/* statistics */
81 	struct scsi_extended_sense sts_sensedata;
82 };
83 
84 #define	SECMDS_STATUS_SIZE  (sizeof (struct scsi_arq_status))
85 
86 /*
87  * Bit Mask definitions, for use accessing the status as a byte.
88  */
89 
90 #define	STATUS_MASK			0x3E
91 #define	STATUS_GOOD			0x00
92 #define	STATUS_CHECK			0x02
93 #define	STATUS_MET			0x04
94 #define	STATUS_BUSY			0x08
95 #define	STATUS_INTERMEDIATE		0x10
96 #define	STATUS_SCSI2			0x20
97 #define	STATUS_INTERMEDIATE_MET		0x14
98 #define	STATUS_RESERVATION_CONFLICT	0x18
99 #define	STATUS_TERMINATED		0x22
100 #define	STATUS_QFULL			0x28
101 #define	STATUS_ACA_ACTIVE		0x30
102 
103 #ifdef	__cplusplus
104 }
105 #endif
106 
107 /*
108  * Some deviations from the one byte of Status are known. Each
109  * implementation will define them specifically
110  */
111 
112 #include <sys/scsi/impl/status.h>
113 
114 #endif	/* _SYS_SCSI_GENERIC_STATUS_H */
115