xref: /titanic_44/usr/src/lib/libbc/inc/include/scsi/impl/uscsi.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SCSI_IMPL_USCSI_H
28 #define	_SCSI_IMPL_USCSI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Defines for user SCSI commands
34  */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * definition for user-scsi command structure
42  */
43 struct uscsi_cmd {
44 	caddr_t	uscsi_cdb;
45 	int	uscsi_cdblen;
46 	caddr_t	uscsi_bufaddr;
47 	int	uscsi_buflen;
48 	unsigned char	uscsi_status;
49 	int	uscsi_flags;
50 };
51 
52 /*
53  * flags for uscsi_flags field
54  */
55 #define	USCSI_SILENT	0x01	/* no error messages */
56 #define	USCSI_DIAGNOSE	0x02	/* fail if any error occurs */
57 #define	USCSI_ISOLATE	0x04	/* isolate from normal commands */
58 #define	USCSI_READ	0x08	/* get data from device */
59 #define	USCSI_WRITE	0xFFF7	/* use to zero the READ bit in uscsi_flags */
60 
61 /*
62  * User SCSI io control command
63  */
64 #define	USCSICMD	_IOWR('u', 1, struct uscsi_cmd) /* user scsi command */
65 
66 /*
67  * user scsi status bit masks
68  */
69 
70 #define	USCSI_STATUS_GOOD			0x00
71 #define	USCSI_STATUS_CHECK			0x02
72 #define	USCSI_STATUS_MET			0x04
73 #define	USCSI_STATUS_BUSY			0x08
74 #define	USCSI_STATUS_INTERMEDIATE		0x10
75 #define	USCSI_STATUS_RESERVATION_CONFLICT	\
76 	(USCSI_STATUS_INTERMEDIATE | USCSI_STATUS_BUSY)
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _SCSI_IMPL_USCSI_H */
83