xref: /illumos-gate/usr/src/uts/common/sys/1394/targets/scsa1394/sbp2.h (revision f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_1394_TARGETS_SCSA1394_SBP2_H
28 #define	_SYS_1394_TARGETS_SCSA1394_SBP2_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * SCSI command and status encapsulation in SBP-2
34  *
35  * References are to ANSI NCITS 325-1998 unless specified otherwise
36  */
37 
38 #include <sys/sbp2/defs.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /* SCSI command block ORB (ref: B.1) */
45 typedef struct scsa1394_cmd_orb {
46 	sbp2_orbp_t	co_next_orb;	/* next ORB pointer */
47 	uint32_t	co_data_descr[2]; /* data descriptor */
48 	uint16_t	co_params;	/* parameters */
49 	uint16_t	co_data_size;	/* parameters */
50 	uint8_t		co_cdb[12];	/* CDB */
51 } scsa1394_cmd_orb_t;
52 
53 
54 /* status block with SCSI sense data (ref: B.1) */
55 typedef struct scsa1394_status {
56 	uint8_t		st_param;	/* parameters */
57 	uint8_t		st_sbp_status;	/* SBP status */
58 	uint16_t	st_orb_offset_hi; /* ORB offset hi */
59 	uint32_t	st_orb_offset_lo; /* ORB offset lo */
60 	uint8_t		st_status;	/* SCSI status */
61 	uint8_t		st_sense_bits;	/* misc sense bits */
62 	uint8_t		st_sense_code;	/* sense code */
63 	uint8_t		st_sense_qual;	/* sense qualifier */
64 	uint8_t		st_info[4];	/* information bytes */
65 	uint8_t		st_cdb[4];	/* CDB-dependent */
66 	uint8_t		st_fru;		/* FRU code */
67 	uint8_t		st_sks[3];	/* sense_key-dependent */
68 	uint32_t	st_vendor[2];	/* vendor-dependent */
69 } scsa1394_status_t;
70 
71 /* st_status */
72 #define	SCSA1394_ST_SFMT		0xC0	/* status block format */
73 #define	SCSA1394_ST_SFMT_SHIFT		6
74 #define	SCSA1394_ST_STATUS		0x3F	/* SCSI status */
75 
76 /* status block formats */
77 #define	SCSA1394_ST_SFMT_CURRENT	0x00	/* current error */
78 #define	SCSA1394_ST_SFMT_DEFERRED	0x40	/* deferred error */
79 #define	SCSA1394_ST_SFMT_VENDOR		0xC0	/* vendor-dependent */
80 
81 /* st_sense_bits */
82 #define	SCSA1394_ST_VALID		0x80	/* valid bit */
83 #define	SCSA1394_ST_VALID_SHIFT		7
84 #define	SCSA1394_ST_MARK		0x40	/* filemark */
85 #define	SCSA1394_ST_MARK_SHIFT		6
86 #define	SCSA1394_ST_EOM			0x20	/* EOM */
87 #define	SCSA1394_ST_EOM_SHIFT		5
88 #define	SCSA1394_ST_ILI			0x10	/* ILI */
89 #define	SCSA1394_ST_ILI_SHIFT		4
90 #define	SCSA1394_ST_SENSE_KEY		0x0F	/* sense key */
91 
92 /* st_extra */
93 #define	SCSA1394_ST_FRU			0xFF000000 /* FRU */
94 #define	SCSA1394_ST_FRU_SHIFT		24
95 #define	SCSA1394_ST_SKEY_DEP		0x00FFFFFF /* sense key-dependent */
96 #define	SCSA1394_ST_SKEY_DEP_SHIFT	0
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif	/* _SYS_1394_TARGETS_SCSA1394_SBP2_H */
103