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/dktp/tgdk.h> 37 38 #define CMDK_UNITSHF 6 39 #define CMDK_MAXPART (1 << CMDK_UNITSHF) 40 41 struct dk_openinfo { 42 uint64_t dk_reg[OTYPCNT]; /* bit per partition: 2^6 */ 43 ulong_t dk_lyr[CMDK_MAXPART]; /* OTYP_LYR cnt per partition */ 44 uint64_t dk_exl; /* bit per partition: 2^6 */ 45 }; 46 47 struct cmdk { 48 long dk_flag; 49 dev_info_t *dk_dip; 50 dev_t dk_dev; 51 52 ksema_t dk_semoclose; /* lock for opens/closes */ 53 struct dk_openinfo dk_open; 54 55 struct tgdk_obj *dk_tgobjp; /* target disk object pointer */ 56 opaque_t dk_lbobjp; 57 58 kmutex_t dk_pinfo_lock; 59 kcondvar_t dk_pinfo_cv; 60 int dk_pinfo_state; 61 }; 62 63 /* common disk flags definitions */ 64 #define CMDK_OPEN 0x1 65 #define CMDK_VALID_LABEL 0x2 66 #define CMDK_TGDK_OPEN 0x4 67 68 #define CMDKUNIT(dev) (getminor((dev)) >> CMDK_UNITSHF) 69 #define CMDKPART(dev) (getminor((dev)) & (CMDK_MAXPART - 1)) 70 71 #define CMDK_TGOBJP(dkp) (dkp)->dk_tgobjp 72 73 /* dk_pinfo_states for cmdk_part_info() */ 74 #define CMDK_PARTINFO_INVALID 0 75 #define CMDK_PARTINFO_BUSY 1 76 #define CMDK_PARTINFO_BUSY2 2 77 #define CMDK_PARTINFO_VALID 3 78 79 80 #ifdef __cplusplus 81 } 82 #endif 83 84 #endif /* _SYS_DKTP_CMDK_H */ 85