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