xref: /illumos-gate/usr/src/uts/common/sys/dktp/cmdk.h (revision 75ab5f91d942eea4138efe4799ca0589870c3899)
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 _SYS_DKTP_CMDK_H
28 #define	_SYS_DKTP_CMDK_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/cmlb.h>
37 #include <sys/dktp/tgdk.h>
38 
39 #define	CMDK_UNITSHF	6
40 #define	CMDK_MAXPART	(1 << CMDK_UNITSHF)
41 
42 /*
43  * Model number is 40 ASCII characters
44  * Serial number is 20 ASCII characters
45  */
46 #define	CMDK_HWIDLEN	(64)
47 
48 struct	cmdk {
49 	/* set during probe */
50 	dev_info_t	*dk_dip;
51 	dev_t		dk_dev;
52 	struct tgdk_obj *dk_tgobjp;		/* target disk object pointer */
53 
54 	/* set during attach */
55 	cmlb_handle_t	dk_cmlbhandle;
56 	ddi_devid_t	dk_devid;
57 
58 	kmutex_t	dk_mutex;		/* mutex for cmdk struct */
59 
60 	long		dk_flag;
61 	uint64_t	dk_open_reg[OTYPCNT];	/* bit per partition: 2^6 */
62 	ulong_t		dk_open_lyr[CMDK_MAXPART]; /* OTYP_LYR cnt/partition */
63 	uint64_t	dk_open_exl;		/* bit per partition: 2^6 */
64 
65 	struct bbh_obj	dk_bbh_obj;
66 
67 	/*
68 	 * BBH variables
69 	 * protected by dk_bbh_mutex
70 	 */
71 	krwlock_t	dk_bbh_mutex;		/* bbh mutex */
72 	tgdk_iob_handle	dk_alts_hdl;		/* iob for V_ALTSCTR */
73 	uint32_t	dk_altused;		/* num entries in V_ALTSCTR */
74 	uint32_t	*dk_slc_cnt;		/* entries per slice */
75 	struct alts_ent	**dk_slc_ent;		/* link to remap data */
76 };
77 
78 /*	common disk flags definitions					*/
79 #define	CMDK_OPEN		0x1
80 #define	CMDK_TGDK_OPEN		0x4
81 
82 #define	CMDKUNIT(dev) (getminor((dev)) >> CMDK_UNITSHF)
83 #define	CMDKPART(dev) (getminor((dev)) & (CMDK_MAXPART - 1))
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif	/* _SYS_DKTP_CMDK_H */
90