summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/1394/targets/scsa1394/sbp2.h
blob: 7227603a4caad7ea63efb7a09bfcaff9eece3626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_SYS_1394_TARGETS_SCSA1394_SBP2_H
#define	_SYS_1394_TARGETS_SCSA1394_SBP2_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * SCSI command and status encapsulation in SBP-2
 *
 * References are to ANSI NCITS 325-1998 unless specified otherwise
 */

#include <sys/sbp2/defs.h>

#ifdef	__cplusplus
extern "C" {
#endif

/* SCSI command block ORB (ref: B.1) */
typedef struct scsa1394_cmd_orb {
	sbp2_orbp_t	co_next_orb;	/* next ORB pointer */
	uint32_t	co_data_descr[2]; /* data descriptor */
	uint16_t	co_params;	/* parameters */
	uint16_t	co_data_size;	/* parameters */
	uint8_t		co_cdb[12];	/* CDB */
} scsa1394_cmd_orb_t;


/* status block with SCSI sense data (ref: B.1) */
typedef struct scsa1394_status {
	uint8_t		st_param;	/* parameters */
	uint8_t		st_sbp_status;	/* SBP status */
	uint16_t	st_orb_offset_hi; /* ORB offset hi */
	uint32_t	st_orb_offset_lo; /* ORB offset lo */
	uint8_t		st_status;	/* SCSI status */
	uint8_t		st_sense_bits;	/* misc sense bits */
	uint8_t		st_sense_code;	/* sense code */
	uint8_t		st_sense_qual;	/* sense qualifier */
	uint8_t		st_info[4];	/* information bytes */
	uint8_t		st_cdb[4];	/* CDB-dependent */
	uint8_t		st_fru;		/* FRU code */
	uint8_t		st_sks[3];	/* sense_key-dependent */
	uint32_t	st_vendor[2];	/* vendor-dependent */
} scsa1394_status_t;

/* st_status */
#define	SCSA1394_ST_SFMT		0xC0	/* status block format */
#define	SCSA1394_ST_SFMT_SHIFT		6
#define	SCSA1394_ST_STATUS		0x3F	/* SCSI status */

/* status block formats */
#define	SCSA1394_ST_SFMT_CURRENT	0x00	/* current error */
#define	SCSA1394_ST_SFMT_DEFERRED	0x40	/* deferred error */
#define	SCSA1394_ST_SFMT_VENDOR		0xC0	/* vendor-dependent */

/* st_sense_bits */
#define	SCSA1394_ST_VALID		0x80	/* valid bit */
#define	SCSA1394_ST_VALID_SHIFT		7
#define	SCSA1394_ST_MARK		0x40	/* filemark */
#define	SCSA1394_ST_MARK_SHIFT		6
#define	SCSA1394_ST_EOM			0x20	/* EOM */
#define	SCSA1394_ST_EOM_SHIFT		5
#define	SCSA1394_ST_ILI			0x10	/* ILI */
#define	SCSA1394_ST_ILI_SHIFT		4
#define	SCSA1394_ST_SENSE_KEY		0x0F	/* sense key */

/* st_extra */
#define	SCSA1394_ST_FRU			0xFF000000 /* FRU */
#define	SCSA1394_ST_FRU_SHIFT		24
#define	SCSA1394_ST_SKEY_DEP		0x00FFFFFF /* sense key-dependent */
#define	SCSA1394_ST_SKEY_DEP_SHIFT	0

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_1394_TARGETS_SCSA1394_SBP2_H */