xref: /onnv-gate/usr/src/uts/common/sys/dktp/cmdk.h (revision 5295:a21f2449e5f9)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*5295Srandyf  * Common Development and Distribution License (the "License").
6*5295Srandyf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*5295Srandyf 
220Sstevel@tonic-gate /*
23*5295Srandyf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _SYS_DKTP_CMDK_H
280Sstevel@tonic-gate #define	_SYS_DKTP_CMDK_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
36786Slclee #include <sys/cmlb.h>
37753Slclee #include <sys/dktp/tgdk.h>
38753Slclee 
390Sstevel@tonic-gate #define	CMDK_UNITSHF	6
400Sstevel@tonic-gate #define	CMDK_MAXPART	(1 << CMDK_UNITSHF)
410Sstevel@tonic-gate 
42786Slclee /*
43786Slclee  * Model number is 40 ASCII characters
44786Slclee  * Serial number is 20 ASCII characters
45786Slclee  */
46786Slclee #define	CMDK_HWIDLEN	(64)
470Sstevel@tonic-gate 
480Sstevel@tonic-gate struct	cmdk {
49786Slclee 	/* set during probe */
500Sstevel@tonic-gate 	dev_info_t	*dk_dip;
510Sstevel@tonic-gate 	dev_t		dk_dev;
52786Slclee 	struct tgdk_obj *dk_tgobjp;		/* target disk object pointer */
530Sstevel@tonic-gate 
54786Slclee 	/* set during attach */
55786Slclee 	cmlb_handle_t	dk_cmlbhandle;
56786Slclee 	ddi_devid_t	dk_devid;
57786Slclee 
58786Slclee 	kmutex_t	dk_mutex;		/* mutex for cmdk struct */
590Sstevel@tonic-gate 
60786Slclee 	long		dk_flag;
61786Slclee 	uint64_t	dk_open_reg[OTYPCNT];	/* bit per partition: 2^6 */
62786Slclee 	ulong_t		dk_open_lyr[CMDK_MAXPART]; /* OTYP_LYR cnt/partition */
63786Slclee 	uint64_t	dk_open_exl;		/* bit per partition: 2^6 */
64786Slclee 
65786Slclee 	struct bbh_obj	dk_bbh_obj;
660Sstevel@tonic-gate 
67786Slclee 	/*
68786Slclee 	 * BBH variables
69786Slclee 	 * protected by dk_bbh_mutex
70786Slclee 	 */
71786Slclee 	krwlock_t	dk_bbh_mutex;		/* bbh mutex */
72786Slclee 	tgdk_iob_handle	dk_alts_hdl;		/* iob for V_ALTSCTR */
73786Slclee 	uint32_t	dk_altused;		/* num entries in V_ALTSCTR */
74786Slclee 	uint32_t	*dk_slc_cnt;		/* entries per slice */
75786Slclee 	struct alts_ent	**dk_slc_ent;		/* link to remap data */
76*5295Srandyf 
77*5295Srandyf 	/*
78*5295Srandyf 	 * for power management
79*5295Srandyf 	 */
80*5295Srandyf 	kmutex_t	dk_pm_mutex;
81*5295Srandyf 	kcondvar_t	dk_suspend_cv;
82*5295Srandyf 	uint32_t	dk_pm_level;
83*5295Srandyf 	uint32_t	dk_pm_is_enabled;
840Sstevel@tonic-gate };
850Sstevel@tonic-gate 
86*5295Srandyf /*
87*5295Srandyf  * Power Management definitions
88*5295Srandyf  */
89*5295Srandyf #define	CMDK_SPINDLE_UNINIT	((uint_t)(-1))
90*5295Srandyf #define	CMDK_SPINDLE_OFF	0x0
91*5295Srandyf #define	CMDK_SPINDLE_ON		0x1
92*5295Srandyf 
930Sstevel@tonic-gate /*	common disk flags definitions					*/
940Sstevel@tonic-gate #define	CMDK_OPEN		0x1
95*5295Srandyf #define	CMDK_SUSPEND		0x2
960Sstevel@tonic-gate #define	CMDK_TGDK_OPEN		0x4
970Sstevel@tonic-gate 
980Sstevel@tonic-gate #define	CMDKUNIT(dev) (getminor((dev)) >> CMDK_UNITSHF)
990Sstevel@tonic-gate #define	CMDKPART(dev) (getminor((dev)) & (CMDK_MAXPART - 1))
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate #ifdef	__cplusplus
1020Sstevel@tonic-gate }
1030Sstevel@tonic-gate #endif
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate #endif	/* _SYS_DKTP_CMDK_H */
106