1*8863SEdward.Pilatowicz@Sun.COM /* 2*8863SEdward.Pilatowicz@Sun.COM * CDDL HEADER START 3*8863SEdward.Pilatowicz@Sun.COM * 4*8863SEdward.Pilatowicz@Sun.COM * The contents of this file are subject to the terms of the 5*8863SEdward.Pilatowicz@Sun.COM * Common Development and Distribution License (the "License"). 6*8863SEdward.Pilatowicz@Sun.COM * You may not use this file except in compliance with the License. 7*8863SEdward.Pilatowicz@Sun.COM * 8*8863SEdward.Pilatowicz@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*8863SEdward.Pilatowicz@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*8863SEdward.Pilatowicz@Sun.COM * See the License for the specific language governing permissions 11*8863SEdward.Pilatowicz@Sun.COM * and limitations under the License. 12*8863SEdward.Pilatowicz@Sun.COM * 13*8863SEdward.Pilatowicz@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*8863SEdward.Pilatowicz@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*8863SEdward.Pilatowicz@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*8863SEdward.Pilatowicz@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*8863SEdward.Pilatowicz@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*8863SEdward.Pilatowicz@Sun.COM * 19*8863SEdward.Pilatowicz@Sun.COM * CDDL HEADER END 20*8863SEdward.Pilatowicz@Sun.COM */ 21*8863SEdward.Pilatowicz@Sun.COM /* 22*8863SEdward.Pilatowicz@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*8863SEdward.Pilatowicz@Sun.COM * Use is subject to license terms. 24*8863SEdward.Pilatowicz@Sun.COM */ 25*8863SEdward.Pilatowicz@Sun.COM 26*8863SEdward.Pilatowicz@Sun.COM #ifndef _XDF_SHELL_H 27*8863SEdward.Pilatowicz@Sun.COM #define _XDF_SHELL_H 28*8863SEdward.Pilatowicz@Sun.COM 29*8863SEdward.Pilatowicz@Sun.COM #ifdef __cplusplus 30*8863SEdward.Pilatowicz@Sun.COM extern "C" { 31*8863SEdward.Pilatowicz@Sun.COM #endif 32*8863SEdward.Pilatowicz@Sun.COM 33*8863SEdward.Pilatowicz@Sun.COM /* These interfaces are all dependant upon xdf */ 34*8863SEdward.Pilatowicz@Sun.COM #include <io/xdf.h> 35*8863SEdward.Pilatowicz@Sun.COM 36*8863SEdward.Pilatowicz@Sun.COM /* Include files required for this header file. */ 37*8863SEdward.Pilatowicz@Sun.COM #include <sys/vtoc.h> 38*8863SEdward.Pilatowicz@Sun.COM 39*8863SEdward.Pilatowicz@Sun.COM /* 40*8863SEdward.Pilatowicz@Sun.COM * These include files are not strictly required to include this header 41*8863SEdward.Pilatowicz@Sun.COM * file, but pretty much every xdf_shell client will need to include these 42*8863SEdward.Pilatowicz@Sun.COM * header files, so just include them here. 43*8863SEdward.Pilatowicz@Sun.COM */ 44*8863SEdward.Pilatowicz@Sun.COM #include <sys/cdio.h> 45*8863SEdward.Pilatowicz@Sun.COM #include <sys/dklabel.h> 46*8863SEdward.Pilatowicz@Sun.COM #include <sys/dktp/altsctr.h> 47*8863SEdward.Pilatowicz@Sun.COM #include <sys/dktp/bbh.h> 48*8863SEdward.Pilatowicz@Sun.COM #include <sys/dktp/cmdk.h> 49*8863SEdward.Pilatowicz@Sun.COM #include <sys/dktp/dadev.h> 50*8863SEdward.Pilatowicz@Sun.COM #include <sys/dktp/dadkio.h> 51*8863SEdward.Pilatowicz@Sun.COM #include <sys/fdio.h> 52*8863SEdward.Pilatowicz@Sun.COM 53*8863SEdward.Pilatowicz@Sun.COM /* 54*8863SEdward.Pilatowicz@Sun.COM * XDF Shell driver state structures 55*8863SEdward.Pilatowicz@Sun.COM */ 56*8863SEdward.Pilatowicz@Sun.COM typedef struct xdfs_state { 57*8863SEdward.Pilatowicz@Sun.COM dev_info_t *xdfss_dip; 58*8863SEdward.Pilatowicz@Sun.COM const char *xdfss_pv; 59*8863SEdward.Pilatowicz@Sun.COM const char *xdfss_hvm; 60*8863SEdward.Pilatowicz@Sun.COM 61*8863SEdward.Pilatowicz@Sun.COM /* Members below are protected by xdfss_mutex */ 62*8863SEdward.Pilatowicz@Sun.COM kmutex_t xdfss_mutex; 63*8863SEdward.Pilatowicz@Sun.COM kcondvar_t xdfss_cv; 64*8863SEdward.Pilatowicz@Sun.COM cmlb_handle_t xdfss_cmlbhandle; 65*8863SEdward.Pilatowicz@Sun.COM int xdfss_otyp_count[OTYPCNT][XDF_PEXT]; 66*8863SEdward.Pilatowicz@Sun.COM 67*8863SEdward.Pilatowicz@Sun.COM /* Members below are only valid when xdfss_tgt_attached is true */ 68*8863SEdward.Pilatowicz@Sun.COM dev_info_t *xdfss_tgt_dip; 69*8863SEdward.Pilatowicz@Sun.COM boolean_t xdfss_tgt_attached; 70*8863SEdward.Pilatowicz@Sun.COM int xdfss_tgt_holds; 71*8863SEdward.Pilatowicz@Sun.COM dev_t xdfss_tgt_dev; 72*8863SEdward.Pilatowicz@Sun.COM ddi_devid_t xdfss_tgt_devid; 73*8863SEdward.Pilatowicz@Sun.COM boolean_t xdfss_tgt_locked; 74*8863SEdward.Pilatowicz@Sun.COM boolean_t xdfss_tgt_is_cd; 75*8863SEdward.Pilatowicz@Sun.COM ldi_handle_t xdfss_tgt_lh[XDF_PEXT]; 76*8863SEdward.Pilatowicz@Sun.COM } xdfs_state_t; 77*8863SEdward.Pilatowicz@Sun.COM 78*8863SEdward.Pilatowicz@Sun.COM typedef struct xdfs_h2p_map { 79*8863SEdward.Pilatowicz@Sun.COM const char *xdfs_h2p_hvm; 80*8863SEdward.Pilatowicz@Sun.COM const char *xdfs_h2p_pv; 81*8863SEdward.Pilatowicz@Sun.COM } xdfs_h2p_map_t; 82*8863SEdward.Pilatowicz@Sun.COM 83*8863SEdward.Pilatowicz@Sun.COM /* 84*8863SEdward.Pilatowicz@Sun.COM * Globals defined by xdf_shell.c 85*8863SEdward.Pilatowicz@Sun.COM */ 86*8863SEdward.Pilatowicz@Sun.COM extern major_t xdfs_major; 87*8863SEdward.Pilatowicz@Sun.COM 88*8863SEdward.Pilatowicz@Sun.COM /* 89*8863SEdward.Pilatowicz@Sun.COM * Functions defined by xdf_shell.c 90*8863SEdward.Pilatowicz@Sun.COM */ 91*8863SEdward.Pilatowicz@Sun.COM extern int xdfs_lb_rdwr(dev_info_t *, uchar_t, void *, diskaddr_t, size_t, 92*8863SEdward.Pilatowicz@Sun.COM void *); 93*8863SEdward.Pilatowicz@Sun.COM extern int xdfs_strategy(struct buf *); 94*8863SEdward.Pilatowicz@Sun.COM extern void xdfs_minphys(struct buf *); 95*8863SEdward.Pilatowicz@Sun.COM 96*8863SEdward.Pilatowicz@Sun.COM /* 97*8863SEdward.Pilatowicz@Sun.COM * Globals that must be defined by xdf_shell.c clients 98*8863SEdward.Pilatowicz@Sun.COM */ 99*8863SEdward.Pilatowicz@Sun.COM extern const char *xdfs_c_name; 100*8863SEdward.Pilatowicz@Sun.COM extern const char *xdfs_c_linkinfo; 101*8863SEdward.Pilatowicz@Sun.COM extern void **xdfs_c_hvm_ss; 102*8863SEdward.Pilatowicz@Sun.COM extern const size_t xdfs_c_hvm_ss_size; 103*8863SEdward.Pilatowicz@Sun.COM extern const struct dev_ops *xdfs_c_hvm_dev_ops; 104*8863SEdward.Pilatowicz@Sun.COM extern const xdfs_h2p_map_t xdfs_c_h2p_map[]; 105*8863SEdward.Pilatowicz@Sun.COM 106*8863SEdward.Pilatowicz@Sun.COM /* 107*8863SEdward.Pilatowicz@Sun.COM * Functions that must be implemented by xdf_shell.c clients 108*8863SEdward.Pilatowicz@Sun.COM */ 109*8863SEdward.Pilatowicz@Sun.COM 110*8863SEdward.Pilatowicz@Sun.COM /* 111*8863SEdward.Pilatowicz@Sun.COM * xdfs_c_devid_setup() is invoked during device probe. If possible, it 112*8863SEdward.Pilatowicz@Sun.COM * should create a devid for the associated disk device. This routine will 113*8863SEdward.Pilatowicz@Sun.COM * not be invoked for cdrom devices. 114*8863SEdward.Pilatowicz@Sun.COM */ 115*8863SEdward.Pilatowicz@Sun.COM extern void xdfs_c_devid_setup(xdfs_state_t *); 116*8863SEdward.Pilatowicz@Sun.COM 117*8863SEdward.Pilatowicz@Sun.COM /* 118*8863SEdward.Pilatowicz@Sun.COM * xdfs_c_bb_check() is invoked during device probe. It should check for 119*8863SEdward.Pilatowicz@Sun.COM * the existance of bad blocks mappings in an alternate partition/slice and 120*8863SEdward.Pilatowicz@Sun.COM * return B_FALSE if there are no bad block mappings found and return B_TRUE 121*8863SEdward.Pilatowicz@Sun.COM * is there are bad block mappings found. The presence of bad block 122*8863SEdward.Pilatowicz@Sun.COM * mappings will cause the device attach to fail. This routine will not be 123*8863SEdward.Pilatowicz@Sun.COM * invoked for cdrom devices. 124*8863SEdward.Pilatowicz@Sun.COM */ 125*8863SEdward.Pilatowicz@Sun.COM extern boolean_t xdfs_c_bb_check(xdfs_state_t *); 126*8863SEdward.Pilatowicz@Sun.COM 127*8863SEdward.Pilatowicz@Sun.COM /* 128*8863SEdward.Pilatowicz@Sun.COM * xdfs_c_getpgeom() is invoked during device probe. It should return the 129*8863SEdward.Pilatowicz@Sun.COM * physical geometery of a disk device that is being attached. The failure 130*8863SEdward.Pilatowicz@Sun.COM * of this routine will cause the device attach to fail. This routine will 131*8863SEdward.Pilatowicz@Sun.COM * not be invoked for cdrom devices. 132*8863SEdward.Pilatowicz@Sun.COM */ 133*8863SEdward.Pilatowicz@Sun.COM extern int xdfs_c_getpgeom(dev_info_t *, cmlb_geom_t *); 134*8863SEdward.Pilatowicz@Sun.COM 135*8863SEdward.Pilatowicz@Sun.COM /* 136*8863SEdward.Pilatowicz@Sun.COM * xdfs_c_cmlb_node_type() and xdfs_c_cmlb_alter_behavior() are invoked 137*8863SEdward.Pilatowicz@Sun.COM * during device probe while initializing the cmlb module for the device 138*8863SEdward.Pilatowicz@Sun.COM * node being probed. They should return a cmlb node type and cmlb alter 139*8863SEdward.Pilatowicz@Sun.COM * behavior flag value that can be passed to cmlb_attach(). 140*8863SEdward.Pilatowicz@Sun.COM */ 141*8863SEdward.Pilatowicz@Sun.COM extern char *xdfs_c_cmlb_node_type(xdfs_state_t *); 142*8863SEdward.Pilatowicz@Sun.COM extern int xdfs_c_cmlb_alter_behavior(xdfs_state_t *); 143*8863SEdward.Pilatowicz@Sun.COM 144*8863SEdward.Pilatowicz@Sun.COM /* 145*8863SEdward.Pilatowicz@Sun.COM * xdfs_c_attach() is invoked during device attach. It provides an 146*8863SEdward.Pilatowicz@Sun.COM * opportunity for the client to create properties or do anything else 147*8863SEdward.Pilatowicz@Sun.COM * necessary for attach. 148*8863SEdward.Pilatowicz@Sun.COM */ 149*8863SEdward.Pilatowicz@Sun.COM extern void xdfs_c_attach(xdfs_state_t *); 150*8863SEdward.Pilatowicz@Sun.COM 151*8863SEdward.Pilatowicz@Sun.COM /* 152*8863SEdward.Pilatowicz@Sun.COM * xdfs_c_getpgeom() is invoked to handle ioctl operations. 153*8863SEdward.Pilatowicz@Sun.COM */ 154*8863SEdward.Pilatowicz@Sun.COM extern int xdfs_c_ioctl(xdfs_state_t *, dev_t, int, 155*8863SEdward.Pilatowicz@Sun.COM int, intptr_t, int, cred_t *, int *, boolean_t *); 156*8863SEdward.Pilatowicz@Sun.COM 157*8863SEdward.Pilatowicz@Sun.COM #ifdef __cplusplus 158*8863SEdward.Pilatowicz@Sun.COM } 159*8863SEdward.Pilatowicz@Sun.COM #endif 160*8863SEdward.Pilatowicz@Sun.COM 161*8863SEdward.Pilatowicz@Sun.COM #endif /* _XDF_SHELL_H */ 162