cmlb_impl.h revision c31fac72a0572e58d0f06438a238d835dee8ffa7
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License (the "License").
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern "C" {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * FDISK partitions - 4 primary and MAX_EXT_PARTS number of Extended
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Partitions.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#endif /* __i386 || __amd64 */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/* Driver Logging Levels */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define CMLB_LABEL(cl) (ddi_driver_name((cl->cl_devi)))
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define ISCD(cl) (cl->cl_device_type == DTYPE_RODIRECT)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define CMLBUNIT(dev) (getminor((dev)) >> CMLBUNIT_SHIFT)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define CMLBPART(dev) (getminor((dev)) & CMLBPART_MASK)
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi * Return codes of cmlb_uselabel().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fdisk partition mapping structure
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/* for cm_state */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef enum {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef enum
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtypedef struct cmlb_lun {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj diskaddr_t cl_solaris_size; /* size of Solaris partition */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint_t cl_solaris_offset; /* offset to Solaris part. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi struct dk_map cl_map[MAXPART]; /* logical partitions */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* cylno is overloaded. used */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* for starting block for EFI */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi diskaddr_t cl_offset[MAXPART]; /* partition start blocks */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj struct fmap cl_fmap[FDISK_PARTS]; /* fdisk partitions */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uchar_t cl_asciilabel[LEN_DKL_ASCII]; /* Disk ASCII label */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This is the HBAs current notion of the geometry of the drive,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * for HBAs that support the "geometry" property.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * This is the geometry of the device as reported by the MODE SENSE,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * command, Page 3 (Format Device Page) and Page 4 (Rigid Disk Drive
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Geometry Page), assuming MODE SENSE is supported by the target.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj cmlb_label_t cl_def_labeltype; /* default label type */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj /* label type based on which minor nodes were created last */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj cmlb_label_t cl_cur_labeltype; /* current label type */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj /* indicates whether vtoc label is read from media */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj /* the following are passed in at attach time */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Flag indicating whether extended partition nodes should be created
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * or not. Is set in cmlb_attach. After creating nodes in
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * cmlb_read_fdisk, it will be unset.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif /* __i386 || __amd64 */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* certain log messages */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cmlb_tg_ops))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cl_devi))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cl_is_removable))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cl_is_hotpluggable))
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cl_node_type))
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cl_sys_blocksize))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(SCHEME_PROTECTS_DATA("stable data", cmlb_lun::cl_alter_behavior))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(SCHEME_PROTECTS_DATA("safe sharing", cmlb_lun::cl_f_geometry_is_valid))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi_NOTE(MUTEX_PROTECTS_DATA(cmlb_lun::cl_mutex, cmlb_lun::cl_vtoc))
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#define DK_TG_READ(ihdlp, bufaddr, start_block, reqlength, tg_cookie)\
c40d7343efa60b18ad1ceb316eb337caeea79046cindi (ihdlp->cmlb_tg_ops->tg_rdwr)(CMLB_DEVINFO(ihdlp), TG_READ, \
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define DK_TG_WRITE(ihdlp, bufaddr, start_block, reqlength, tg_cookie)\
c40d7343efa60b18ad1ceb316eb337caeea79046cindi (ihdlp->cmlb_tg_ops->tg_rdwr)(CMLB_DEVINFO(ihdlp), TG_WRITE,\
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (ihdlp->cmlb_tg_ops->tg_getinfo)(CMLB_DEVINFO(ihdlp), TG_GETPHYGEOM,\
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#define DK_TG_GETVIRTGEOM(ihdlp, virtgeomp, tg_cookie) \
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (ihdlp->cmlb_tg_ops->tg_getinfo)(CMLB_DEVINFO(ihdlp), TG_GETVIRTGEOM,\
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (ihdlp->cmlb_tg_ops->tg_getinfo)(CMLB_DEVINFO(ihdlp), TG_GETCAPACITY,\
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (ihdlp->cmlb_tg_ops->tg_getinfo)(CMLB_DEVINFO(ihdlp),\
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define DK_TG_GETATTRIBUTE(ihdlp, attributep, tg_cookie) \
c40d7343efa60b18ad1ceb316eb337caeea79046cindi (ihdlp->cmlb_tg_ops->tg_getinfo)(CMLB_DEVINFO(ihdlp), TG_GETATTR,\
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#endif /* _SYS_CMLB_IMPL_H */