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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 27 #ifndef _SDBC_IOCTL_H 28 #define _SDBC_IOCTL_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <sys/unistat/spcs_s.h> /* included for unistat */ 35 36 /* 37 * Generic sdbc ioctl arguments structure. 38 * Individual ioctl's will use 0-n of these arguments. 39 * 40 * Each sdbc ioctl is described first by the command number 41 * e.g. #define SDBC_ADUMP _SDBC_(4) 42 * 43 * Followed by a description of each argument (if any). 44 * Each argument is on a single line. 45 * 46 */ 47 48 typedef struct _sdbc_ioctl_s { 49 long arg0; 50 long arg1; 51 long arg2; 52 long arg3; 53 long arg4; 54 long magic; 55 spcs_s_info_t sdbc_ustatus; 56 long pad[1]; 57 } _sdbc_ioctl_t; 58 59 typedef struct _sdbc_ioctl32_s { 60 int32_t arg0; 61 int32_t arg1; 62 int32_t arg2; 63 int32_t arg3; 64 int32_t arg4; 65 int32_t magic; 66 spcs_s_info32_t sdbc_ustatus; 67 int32_t pad[1]; 68 } _sdbc_ioctl32_t; 69 70 /* 71 * Ioctl command numbers 72 */ 73 74 #define _SDBC_(x) (('B'<<16)|('C'<<8)|(x)) 75 76 /* 77 * Old ioctl commands prior to ioctl reorg. These could be re-used 78 * at a later date 79 */ 80 #define SDBC_UNUSED_1 _SDBC_(1) /* OLD out of date syscall -> ioctl stuff */ 81 #define SDBC_UNUSED_2 _SDBC_(2) /* OLD INFSD_CONC_WRITE */ 82 #define SDBC_UNUSED_3 _SDBC_(3) /* OLD muli-subopcode configuration */ 83 84 #define SDBC_ADUMP _SDBC_(4) 85 /* 86 * int cd; 87 * _sdtr_table * table; 88 * _sdtr_t * trace_buffer; 89 * int size_of_trace_buffer; 90 * int flags; 91 */ 92 93 #define SDBC_TEST_INIT _SDBC_(5) /* TESTING - tdaemon parameters */ 94 /* 95 * char * device_name; 96 * int index; 97 * int len; 98 * int track_size; 99 * int flags; 100 */ 101 102 #define SDBC_TEST_START _SDBC_(6) /* TESTING - tdaemon .... */ 103 /* 104 * int num; 105 * int type; 106 * int loops; 107 * int from; 108 * int seed; 109 */ 110 111 #define SDBC_TEST_END _SDBC_(7) /* TESTING - tdaemon .... */ 112 /* NO-ARGS */ 113 114 #define SDBC_ENABLE _SDBC_(8) /* configure sdbc */ 115 /* 116 * _sd_cache_param_t * user_configuration; 117 */ 118 119 #define SDBC_DISABLE _SDBC_(9) /* deconfigure sdbc */ 120 /* NO-ARGS */ 121 122 #define SDBC_SET_CD_HINT _SDBC_(10) 123 /* 124 * int cd; 125 * int hint; 126 * int flags; 127 */ 128 129 #define SDBC_GET_CD_HINT _SDBC_(11) 130 /* 131 * int cd; 132 */ 133 134 #define SDBC_SET_NODE_HINT _SDBC_(12) 135 /* 136 * int hint; 137 * int flags; 138 */ 139 140 #define SDBC_GET_NODE_HINT _SDBC_(13) 141 /* NO-ARGS */ 142 143 #define SDBC_STATS _SDBC_(14) 144 /* 145 * _sd_stats_t * stats buffer; 146 */ 147 148 #define SDBC_ZAP_STATS _SDBC_(15) 149 /* NO-ARGS */ 150 151 #define SDBC_GET_CD_BLK _SDBC_(16) 152 /* 153 * int cd; 154 * nsc_off_t * block_number; 155 * void * addresses[5]; 156 */ 157 158 #define SDBC_GET_CLUSTER_SIZE _SDBC_(17) 159 /* 160 * int * cluster_size; 161 */ 162 163 #define SDBC_GET_CLUSTER_DATA _SDBC_(18) 164 /* 165 * char * buffer[2*cluster_size]; 166 */ 167 168 #define SDBC_GET_GLMUL_SIZES _SDBC_(19) 169 /* 170 * int * global_sizes; 171 */ 172 173 #define SDBC_GET_GLMUL_INFO _SDBC_(20) 174 /* 175 * char * buffer[ 2 times sum of global_sizes]; 176 */ 177 178 /* Unused _SDBC(21,22) */ 179 180 #define SDBC_STATE_DEV _SDBC_(23) /* set path to sdbc state file/volume */ 181 /* 182 * char * device_name; 183 * int device_name_length; 184 */ 185 #define SDBC_TOGGLE_FLUSH _SDBC_(24) /* TESTING - toggle flusher enable */ 186 /* NO-ARGS */ 187 188 #define SDBC_INJ_IOERR _SDBC_(25) /* TESTING - inject i/o error */ 189 /* 190 * int cd 191 * int io_error_number; 192 */ 193 194 #define SDBC_CLR_IOERR _SDBC_(26) /* TESTING - clear injected i/o error */ 195 /* 196 * int cd 197 */ 198 199 #define SDBC_GET_CONFIG _SDBC_(27) /* retrieve current configuration */ 200 /* 201 * _sdbc_config_t *current_config; 202 */ 203 204 #define SDBC_SET_CONFIG _SDBC_(28) /* enable cache configuration info */ 205 /* 206 * _sdbc_config_t *mgmt_config_info; 207 */ 208 209 /* Unused _SDBC(29) */ 210 211 #define SDBC_MAXFILES _SDBC_(30) /* get maxfiles */ 212 /* 213 * int * max_files; 214 */ 215 216 #define SDBC_VERSION _SDBC_(31) 217 /* 218 * cache_version_t *cache_version; 219 */ 220 221 #define _SD_MAGIC 0xD017 222 223 #define MAX_CACHE_NET 4 224 #define MAX_REMOTE_MIRRORS 64 225 #define MAX_MIR_SEGS MAX_REMOTE_MIRRORS 226 #define MAX_CACHE_SIZE 1024 227 228 /* unexposed configuration bits */ 229 #define CFG_USE_DMCHAIN 0x1 230 #define CFG_STATIC_CACHE 0x2 231 232 #define RESERVED1_DEFAULTS (CFG_STATIC_CACHE) 233 234 /* maintain _sd_cache_param struct layout (MAX_CACHE_NET is deprecated) */ 235 #define CACHE_MEM_PAD 4 236 237 typedef struct _sd_cache_param { 238 int mirror_host; 239 int blk_size; 240 int threads; 241 int procs; 242 int test_demons; 243 int write_cache; 244 int trace_size; 245 int trace_mask; 246 int trace_lbolt; 247 int trace_good; 248 int trace_net; /* not used */ 249 int iobuf; 250 int num_handles; 251 int cache_mem[CACHE_MEM_PAD]; 252 int prot_lru; 253 int gen_pattern; 254 uint_t fill_pattern; 255 short nodes_conf[MAX_REMOTE_MIRRORS]; /* Actual Nodes in conf file */ 256 short num_nodes; /* Number of nodes in sd.cf */ 257 short net_type; /* not used */ 258 ushort_t magic; /* Check for proper sd_cadmin */ 259 int reserved1; /* unexposed config options */ 260 int reserved[8]; 261 } _sd_cache_param_t; 262 263 typedef struct _sdbc_config { 264 int cache_mem[CACHE_MEM_PAD]; 265 int threads; 266 int enabled; 267 ushort_t magic; 268 } _sdbc_config_t; 269 270 typedef struct cache_version { 271 int major; /* Major release number */ 272 int minor; /* Minor release number */ 273 int micro; /* Micro release number */ 274 int baseline; /* Baseline revison number */ 275 } cache_version_t; 276 277 #if !defined(_KERNEL) 278 279 280 /* Keep this definition in sync with the one in rdc_ioctl.h. */ 281 #ifndef SDBC_IOCTL 282 #define SDBC_IOCTL(cmd, a0, a1, a2, a3, a4, ustatus) \ 283 sdbc_ioctl((long)(cmd), (long)(a0), (long)(a1), (long)(a2), \ 284 (long)(a3), (long)(a4), (spcs_s_info_t *)(ustatus)) 285 #endif 286 287 int sdbc_ioctl(long, long, long, long, long, long, spcs_s_info_t *); 288 289 290 #endif /* ! _KERNEL */ 291 292 #ifdef __cplusplus 293 } 294 #endif 295 296 #endif /* _SDBC_IOCTL_H */