xref: /illumos-gate/usr/src/uts/common/sys/dktp/cmdk.h (revision 3ccda647)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_DKTP_CMDK_H
287c478bd9Sstevel@tonic-gate #define	_SYS_DKTP_CMDK_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
36*3ccda647Slclee #include <sys/cmlb.h>
3743369e13Slclee #include <sys/dktp/tgdk.h>
3843369e13Slclee 
397c478bd9Sstevel@tonic-gate #define	CMDK_UNITSHF	6
407c478bd9Sstevel@tonic-gate #define	CMDK_MAXPART	(1 << CMDK_UNITSHF)
417c478bd9Sstevel@tonic-gate 
42*3ccda647Slclee /*
43*3ccda647Slclee  * Model number is 40 ASCII characters
44*3ccda647Slclee  * Serial number is 20 ASCII characters
45*3ccda647Slclee  */
46*3ccda647Slclee #define	CMDK_HWIDLEN	(64)
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate struct	cmdk {
49*3ccda647Slclee 	/* set during probe */
507c478bd9Sstevel@tonic-gate 	dev_info_t	*dk_dip;
517c478bd9Sstevel@tonic-gate 	dev_t		dk_dev;
52*3ccda647Slclee 	struct tgdk_obj *dk_tgobjp;		/* target disk object pointer */
537c478bd9Sstevel@tonic-gate 
54*3ccda647Slclee 	/* set during attach */
55*3ccda647Slclee 	cmlb_handle_t	dk_cmlbhandle;
56*3ccda647Slclee 	ddi_devid_t	dk_devid;
577c478bd9Sstevel@tonic-gate 
58*3ccda647Slclee 	kmutex_t	dk_mutex;		/* mutex for cmdk struct */
597c478bd9Sstevel@tonic-gate 
60*3ccda647Slclee 	long		dk_flag;
61*3ccda647Slclee 	uint64_t	dk_open_reg[OTYPCNT];	/* bit per partition: 2^6 */
62*3ccda647Slclee 	ulong_t		dk_open_lyr[CMDK_MAXPART]; /* OTYP_LYR cnt/partition */
63*3ccda647Slclee 	uint64_t	dk_open_exl;		/* bit per partition: 2^6 */
64*3ccda647Slclee 
65*3ccda647Slclee 	struct bbh_obj	dk_bbh_obj;
66*3ccda647Slclee 
67*3ccda647Slclee 	/*
68*3ccda647Slclee 	 * BBH variables
69*3ccda647Slclee 	 * protected by dk_bbh_mutex
70*3ccda647Slclee 	 */
71*3ccda647Slclee 	krwlock_t	dk_bbh_mutex;		/* bbh mutex */
72*3ccda647Slclee 	tgdk_iob_handle	dk_alts_hdl;		/* iob for V_ALTSCTR */
73*3ccda647Slclee 	uint32_t	dk_altused;		/* num entries in V_ALTSCTR */
74*3ccda647Slclee 	uint32_t	*dk_slc_cnt;		/* entries per slice */
75*3ccda647Slclee 	struct alts_ent	**dk_slc_ent;		/* link to remap data */
767c478bd9Sstevel@tonic-gate };
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*	common disk flags definitions					*/
797c478bd9Sstevel@tonic-gate #define	CMDK_OPEN		0x1
807c478bd9Sstevel@tonic-gate #define	CMDK_TGDK_OPEN		0x4
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #define	CMDKUNIT(dev) (getminor((dev)) >> CMDK_UNITSHF)
837c478bd9Sstevel@tonic-gate #define	CMDKPART(dev) (getminor((dev)) & (CMDK_MAXPART - 1))
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
867c478bd9Sstevel@tonic-gate }
877c478bd9Sstevel@tonic-gate #endif
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #endif	/* _SYS_DKTP_CMDK_H */
90