4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
33 /* These interfaces are all dependant upon xdf */
36 /* Include files required for this header file. */
40 * These include files are not strictly required to include this header
41 * file, but pretty much every xdf_shell client will need to include these
42 * header files, so just include them here.
45 #include <sys/dklabel.h>
46 #include <sys/dktp/altsctr.h>
47 #include <sys/dktp/bbh.h>
48 #include <sys/dktp/cmdk.h>
49 #include <sys/dktp/dadev.h>
50 #include <sys/dktp/dadkio.h>
54 * XDF Shell driver state structures
56 typedef struct xdfs_state
{
57 dev_info_t
*xdfss_dip
;
59 const char *xdfss_hvm
;
61 /* Members below are protected by xdfss_mutex */
64 cmlb_handle_t xdfss_cmlbhandle
;
65 int xdfss_otyp_count
[OTYPCNT
][XDF_PEXT
];
67 /* Members below are only valid when xdfss_tgt_attached is true */
68 dev_info_t
*xdfss_tgt_dip
;
69 boolean_t xdfss_tgt_attached
;
72 ddi_devid_t xdfss_tgt_devid
;
73 boolean_t xdfss_tgt_locked
;
74 boolean_t xdfss_tgt_is_cd
;
75 ldi_handle_t xdfss_tgt_lh
[XDF_PEXT
];
78 typedef struct xdfs_h2p_map
{
79 const char *xdfs_h2p_hvm
;
80 const char *xdfs_h2p_pv
;
84 * Globals defined by xdf_shell.c
86 extern major_t xdfs_major
;
89 * Functions defined by xdf_shell.c
91 extern int xdfs_lb_rdwr(dev_info_t
*, uchar_t
, void *, diskaddr_t
, size_t,
93 extern int xdfs_strategy(struct buf
*);
94 extern void xdfs_minphys(struct buf
*);
97 * Globals that must be defined by xdf_shell.c clients
99 extern const char *xdfs_c_name
;
100 extern const char *xdfs_c_linkinfo
;
101 extern void **xdfs_c_hvm_ss
;
102 extern const size_t xdfs_c_hvm_ss_size
;
103 extern const struct dev_ops
*xdfs_c_hvm_dev_ops
;
104 extern const xdfs_h2p_map_t xdfs_c_h2p_map
[];
107 * Functions that must be implemented by xdf_shell.c clients
111 * xdfs_c_devid_setup() is invoked during device probe. If possible, it
112 * should create a devid for the associated disk device. This routine will
113 * not be invoked for cdrom devices.
115 extern void xdfs_c_devid_setup(xdfs_state_t
*);
118 * xdfs_c_bb_check() is invoked during device probe. It should check for
119 * the existance of bad blocks mappings in an alternate partition/slice and
120 * return B_FALSE if there are no bad block mappings found and return B_TRUE
121 * is there are bad block mappings found. The presence of bad block
122 * mappings will cause the device attach to fail. This routine will not be
123 * invoked for cdrom devices.
125 extern boolean_t
xdfs_c_bb_check(xdfs_state_t
*);
128 * xdfs_c_getpgeom() is invoked during device probe. It should return the
129 * physical geometery of a disk device that is being attached. The failure
130 * of this routine will cause the device attach to fail. This routine will
131 * not be invoked for cdrom devices.
133 extern int xdfs_c_getpgeom(dev_info_t
*, cmlb_geom_t
*);
136 * xdfs_c_cmlb_node_type() and xdfs_c_cmlb_alter_behavior() are invoked
137 * during device probe while initializing the cmlb module for the device
138 * node being probed. They should return a cmlb node type and cmlb alter
139 * behavior flag value that can be passed to cmlb_attach().
141 extern char *xdfs_c_cmlb_node_type(xdfs_state_t
*);
142 extern int xdfs_c_cmlb_alter_behavior(xdfs_state_t
*);
145 * xdfs_c_attach() is invoked during device attach. It provides an
146 * opportunity for the client to create properties or do anything else
147 * necessary for attach.
149 extern void xdfs_c_attach(xdfs_state_t
*);
152 * xdfs_c_getpgeom() is invoked to handle ioctl operations.
154 extern int xdfs_c_ioctl(xdfs_state_t
*, dev_t
, int,
155 int, intptr_t, int, cred_t
*, int *, boolean_t
*);
161 #endif /* _XDF_SHELL_H */