xref: /titanic_52/usr/src/uts/common/sys/dktp/dadk.h (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
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) 1992 Sun Microsystems, Inc.  All Rights Reserved.
24  */
25 
26 #ifndef _SYS_DKTP_DADK_H
27 #define	_SYS_DKTP_DADK_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 struct	dadk {
36 	struct tgdk_ext	*dad_extp;	/* back pointer to ext data	*/
37 	struct scsi_device *dad_sd;	/* back pointer to SCSI_DEVICE 	*/
38 
39 	struct  tgdk_geom dad_logg;	/* logical disk geometry 	*/
40 	struct  tgdk_geom dad_phyg;	/* physical disk geometry 	*/
41 
42 	unsigned dad_rmb : 1;		/* removable device		*/
43 	unsigned dad_rdonly : 1;	/* read only device		*/
44 	unsigned dad_cdrom : 1;		/* cdrom device			*/
45 	unsigned dad_resv : 5;
46 	unsigned char dad_type;		/* device type			*/
47 	unsigned char dad_ctype;	/* controller type 		*/
48 
49 	short	 dad_secshf;
50 	short	 dad_blkshf;
51 
52 	opaque_t dad_bbhobjp;		/* bbh object ptr		*/
53 	opaque_t dad_flcobjp;		/* flow control object ptr	*/
54 	opaque_t dad_ctlobjp;		/* controller object ptr	*/
55 	struct	tgcom_obj dad_com;	/* com object for flowctrl	*/
56 	enum dkio_state dad_iostate;	/* ejected/inserted		*/
57 	kmutex_t	dad_mutex;	/* protect dad_state		*/
58 	kcondvar_t	dad_state_cv;	/* condition variable for state */
59 	uchar_t		dad_thread_cnt;	/* reference count on removable	*/
60 					/* - disk state watcher thread	*/
61 };
62 
63 #define	DAD_SECSIZ	dad_phyg.g_secsiz
64 
65 /*
66  * Local definitions, for clarity of code
67  */
68 
69 /*
70  * Parameters
71  */
72 #define	DADK_BSY_TIMEOUT	(drv_usectohz(5 * 1000000))
73 #define	DADK_IO_TIME		35
74 #define	DADK_RETRY_COUNT	5
75 #define	DADK_SILENT		1
76 
77 #define	PKT2DADK(pktp)	((struct dadk *)(pktp)->cp_dev_private)
78 
79 /*
80  * packet action codes
81  */
82 #define	COMMAND_DONE		0
83 #define	COMMAND_DONE_ERROR	1
84 #define	QUE_COMMAND		2
85 #define	QUE_SENSE		3
86 #define	JUST_RETURN		4
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _SYS_DKTP_DADK_H */
93