1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22*4b31676fSsrivijitha dugganapalli * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 23fcf3ce44SJohn Forte */ 24fcf3ce44SJohn Forte #ifndef _STMF_IOCTL_H 25fcf3ce44SJohn Forte #define _STMF_IOCTL_H 26fcf3ce44SJohn Forte 27fcf3ce44SJohn Forte #ifdef __cplusplus 28fcf3ce44SJohn Forte extern "C" { 29fcf3ce44SJohn Forte #endif 30fcf3ce44SJohn Forte 31fcf3ce44SJohn Forte #define STMF_VERSION_1 1 32fcf3ce44SJohn Forte 33fcf3ce44SJohn Forte #define STMF_IOCTL (((uint32_t)'S') << 24) 34fcf3ce44SJohn Forte #define STMF_IOCTL_LU_LIST (STMF_IOCTL | 1) 35fcf3ce44SJohn Forte #define STMF_IOCTL_TARGET_PORT_LIST (STMF_IOCTL | 2) 36fcf3ce44SJohn Forte #define STMF_IOCTL_SESSION_LIST (STMF_IOCTL | 3) 37fcf3ce44SJohn Forte #define STMF_IOCTL_GET_LU_PROPERTIES (STMF_IOCTL | 4) 38fcf3ce44SJohn Forte #define STMF_IOCTL_GET_TARGET_PORT_PROPERTIES (STMF_IOCTL | 5) 39fcf3ce44SJohn Forte #define STMF_IOCTL_SET_STMF_STATE (STMF_IOCTL | 6) 40fcf3ce44SJohn Forte #define STMF_IOCTL_GET_STMF_STATE (STMF_IOCTL | 7) 41fcf3ce44SJohn Forte #define STMF_IOCTL_SET_LU_STATE (STMF_IOCTL | 8) 42fcf3ce44SJohn Forte #define STMF_IOCTL_SET_TARGET_PORT_STATE (STMF_IOCTL | 9) 43fcf3ce44SJohn Forte #define STMF_IOCTL_CREATE_HOST_GROUP (STMF_IOCTL | 10) 44fcf3ce44SJohn Forte #define STMF_IOCTL_REMOVE_HOST_GROUP (STMF_IOCTL | 11) 45fcf3ce44SJohn Forte #define STMF_IOCTL_ADD_HG_ENTRY (STMF_IOCTL | 12) 46fcf3ce44SJohn Forte #define STMF_IOCTL_REMOVE_HG_ENTRY (STMF_IOCTL | 13) 47fcf3ce44SJohn Forte #define STMF_IOCTL_CREATE_TARGET_GROUP (STMF_IOCTL | 14) 48fcf3ce44SJohn Forte #define STMF_IOCTL_REMOVE_TARGET_GROUP (STMF_IOCTL | 15) 49fcf3ce44SJohn Forte #define STMF_IOCTL_ADD_TG_ENTRY (STMF_IOCTL | 16) 50fcf3ce44SJohn Forte #define STMF_IOCTL_REMOVE_TG_ENTRY (STMF_IOCTL | 17) 51fcf3ce44SJohn Forte #define STMF_IOCTL_ADD_VIEW_ENTRY (STMF_IOCTL | 18) 52fcf3ce44SJohn Forte #define STMF_IOCTL_REMOVE_VIEW_ENTRY (STMF_IOCTL | 19) 53fcf3ce44SJohn Forte #define STMF_IOCTL_GET_HG_LIST (STMF_IOCTL | 20) 54fcf3ce44SJohn Forte #define STMF_IOCTL_GET_TG_LIST (STMF_IOCTL | 21) 55fcf3ce44SJohn Forte #define STMF_IOCTL_GET_HG_ENTRIES (STMF_IOCTL | 22) 56fcf3ce44SJohn Forte #define STMF_IOCTL_GET_TG_ENTRIES (STMF_IOCTL | 23) 57fcf3ce44SJohn Forte #define STMF_IOCTL_GET_VE_LIST (STMF_IOCTL | 24) 58fcf3ce44SJohn Forte #define STMF_IOCTL_LOAD_PP_DATA (STMF_IOCTL | 25) 59fcf3ce44SJohn Forte #define STMF_IOCTL_CLEAR_PP_DATA (STMF_IOCTL | 26) 608fe96085Stim szeto #define STMF_IOCTL_GET_PP_DATA (STMF_IOCTL | 27) 618fe96085Stim szeto #define STMF_IOCTL_CLEAR_TRACE (STMF_IOCTL | 28) 628fe96085Stim szeto #define STMF_IOCTL_ADD_TRACE (STMF_IOCTL | 29) 638fe96085Stim szeto #define STMF_IOCTL_GET_TRACE_POSITION (STMF_IOCTL | 30) 648fe96085Stim szeto #define STMF_IOCTL_GET_TRACE (STMF_IOCTL | 31) 658fe96085Stim szeto #define STMF_IOCTL_REG_LU_LIST (STMF_IOCTL | 32) 668fe96085Stim szeto #define STMF_IOCTL_VE_LU_LIST (STMF_IOCTL | 33) 678fe96085Stim szeto #define STMF_IOCTL_LU_VE_LIST (STMF_IOCTL | 34) 6863ed874aStim szeto #define STMF_IOCTL_VALIDATE_VIEW (STMF_IOCTL | 35) 6945039663SJohn Forte #define STMF_IOCTL_SET_ALUA_STATE (STMF_IOCTL | 36) 7045039663SJohn Forte #define STMF_IOCTL_GET_ALUA_STATE (STMF_IOCTL | 37) 71*4b31676fSsrivijitha dugganapalli #define STMF_IOCTL_SET_STMF_PROPS (STMF_IOCTL | 38) 72fcf3ce44SJohn Forte 73fcf3ce44SJohn Forte typedef struct stmf_iocdata { 74fcf3ce44SJohn Forte uint32_t stmf_version; 75fcf3ce44SJohn Forte uint32_t stmf_error; 76fcf3ce44SJohn Forte uint32_t stmf_ibuf_size; 77fcf3ce44SJohn Forte uint32_t stmf_obuf_size; 78fcf3ce44SJohn Forte uint32_t stmf_obuf_nentries; /* # entries xferred */ 79fcf3ce44SJohn Forte uint32_t stmf_obuf_max_nentries; /* #,could have been xferred */ 80fcf3ce44SJohn Forte uint64_t stmf_ibuf; 81fcf3ce44SJohn Forte uint64_t stmf_obuf; 82fcf3ce44SJohn Forte } stmf_iocdata_t; 83fcf3ce44SJohn Forte 84fcf3ce44SJohn Forte typedef struct slist_lu { 85fcf3ce44SJohn Forte uint8_t lu_guid[16]; 86fcf3ce44SJohn Forte } slist_lu_t; 87fcf3ce44SJohn Forte 88fcf3ce44SJohn Forte typedef struct slist_target_port { 89fcf3ce44SJohn Forte uint8_t target[260]; 90fcf3ce44SJohn Forte } slist_target_port_t; 91fcf3ce44SJohn Forte 92fcf3ce44SJohn Forte typedef struct slist_scsi_session { 93fcf3ce44SJohn Forte uint8_t initiator[260]; 94fcf3ce44SJohn Forte /* creation_time is really time_t. But time_t is defined as long. */ 95fcf3ce44SJohn Forte uint32_t creation_time; 96fcf3ce44SJohn Forte char alias[256]; 97fcf3ce44SJohn Forte } slist_scsi_session_t; 98fcf3ce44SJohn Forte 99fcf3ce44SJohn Forte /* 100fcf3ce44SJohn Forte * States for LUs and LPORTs 101fcf3ce44SJohn Forte */ 102fcf3ce44SJohn Forte #define STMF_STATE_OFFLINE 0 103fcf3ce44SJohn Forte #define STMF_STATE_ONLINING 1 104fcf3ce44SJohn Forte #define STMF_STATE_ONLINE 2 105fcf3ce44SJohn Forte #define STMF_STATE_OFFLINING 3 106fcf3ce44SJohn Forte 107fcf3ce44SJohn Forte /* 108fcf3ce44SJohn Forte * States for the STMF config. 109fcf3ce44SJohn Forte */ 110fcf3ce44SJohn Forte #define STMF_CONFIG_NONE 0 111fcf3ce44SJohn Forte #define STMF_CONFIG_INIT 1 112fcf3ce44SJohn Forte #define STMF_CONFIG_INIT_DONE 2 113fcf3ce44SJohn Forte 114fcf3ce44SJohn Forte typedef struct sioc_lu_props { 115fcf3ce44SJohn Forte uint8_t lu_guid[16]; 116fcf3ce44SJohn Forte uint8_t lu_state:4, 117fcf3ce44SJohn Forte lu_present:1, 118fcf3ce44SJohn Forte lu_rsvd:3; 119fcf3ce44SJohn Forte char lu_provider_name[255]; 120fcf3ce44SJohn Forte char lu_alias[256]; 121fcf3ce44SJohn Forte } sioc_lu_props_t; 122fcf3ce44SJohn Forte 123fcf3ce44SJohn Forte typedef struct sioc_target_port_props { 124fcf3ce44SJohn Forte uint8_t tgt_id[260]; 125fcf3ce44SJohn Forte uint8_t tgt_state:4, 126fcf3ce44SJohn Forte tgt_present:1, 127fcf3ce44SJohn Forte tgt_rsvd:3; 128fcf3ce44SJohn Forte char tgt_provider_name[255]; 129fcf3ce44SJohn Forte char tgt_alias[256]; 130fcf3ce44SJohn Forte } sioc_target_port_props_t; 131fcf3ce44SJohn Forte 132fcf3ce44SJohn Forte /* 133fcf3ce44SJohn Forte * This struct is used for getting and setting state of LU/LPORT or STMF. 134fcf3ce44SJohn Forte */ 135fcf3ce44SJohn Forte typedef struct stmf_state_desc { 136fcf3ce44SJohn Forte uint8_t ident[260]; /* N/A for STMF itself */ 137fcf3ce44SJohn Forte uint8_t state; 138fcf3ce44SJohn Forte uint8_t config_state; /* N/A for LU/LPORTs */ 139fcf3ce44SJohn Forte } stmf_state_desc_t; 140fcf3ce44SJohn Forte 14145039663SJohn Forte /* 14245039663SJohn Forte * This struct is used for setting the alua state 14345039663SJohn Forte */ 14445039663SJohn Forte typedef struct stmf_alua_state_desc { 14545039663SJohn Forte uint8_t alua_state; 14645039663SJohn Forte uint16_t alua_node; 14745039663SJohn Forte } stmf_alua_state_desc_t; 14845039663SJohn Forte 1498fe96085Stim szeto /* Error definitions for group/view entry/provider dataioctls */ 150fcf3ce44SJohn Forte #define STMF_IOCERR_NONE 0 151fcf3ce44SJohn Forte #define STMF_IOCERR_HG_EXISTS 1 152fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_HG 2 153fcf3ce44SJohn Forte #define STMF_IOCERR_TG_EXISTS 3 154fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_TG 4 155fcf3ce44SJohn Forte #define STMF_IOCERR_HG_ENTRY_EXISTS 5 156fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_HG_ENTRY 6 157fcf3ce44SJohn Forte #define STMF_IOCERR_TG_ENTRY_EXISTS 7 158fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_TG_ENTRY 8 159fcf3ce44SJohn Forte #define STMF_IOCERR_TG_UPDATE_NEED_SVC_OFFLINE 9 160fcf3ce44SJohn Forte #define STMF_IOCERR_LU_NUMBER_IN_USE 10 161fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_LU_ID 11 162fcf3ce44SJohn Forte #define STMF_IOCERR_VIEW_ENTRY_CONFLICT 12 163fcf3ce44SJohn Forte #define STMF_IOCERR_HG_IN_USE 13 164fcf3ce44SJohn Forte #define STMF_IOCERR_TG_IN_USE 14 165fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_VIEW_ENTRY 15 166fcf3ce44SJohn Forte #define STMF_IOCERR_INVALID_VE_ID 16 167fcf3ce44SJohn Forte #define STMF_IOCERR_UPDATE_NEED_CFG_INIT 17 1688fe96085Stim szeto #define STMF_IOCERR_PPD_UPDATED 18 1698fe96085Stim szeto #define STMF_IOCERR_INSUFFICIENT_BUF 19 1705c8cac22Stim szeto #define STMF_IOCERR_TG_NEED_TG_OFFLINE 20 1718fe96085Stim szeto 172fcf3ce44SJohn Forte 173fcf3ce44SJohn Forte typedef struct stmf_group_name { 174fcf3ce44SJohn Forte uint16_t name_size; /* in bytes */ 175fcf3ce44SJohn Forte uint16_t rsvd_1; 176fcf3ce44SJohn Forte uint32_t rsvd_2; 177fcf3ce44SJohn Forte uint8_t name[512]; /* 256 * wchar_t */ 178fcf3ce44SJohn Forte } stmf_group_name_t; 179fcf3ce44SJohn Forte 180fcf3ce44SJohn Forte /* 181fcf3ce44SJohn Forte * struct used to operate (add/remove entry) on a group. 182fcf3ce44SJohn Forte */ 1838fe96085Stim szeto 1848fe96085Stim szeto typedef struct stmf_ge_ident { 1858fe96085Stim szeto uint16_t ident_size; 1868fe96085Stim szeto uint8_t ident[256]; 1878fe96085Stim szeto } stmf_ge_ident_t; 188fcf3ce44SJohn Forte 189fcf3ce44SJohn Forte typedef struct stmf_group_op_data { 190fcf3ce44SJohn Forte stmf_group_name_t group; 191fcf3ce44SJohn Forte uint8_t ident[260]; 192fcf3ce44SJohn Forte } stmf_group_op_data_t; 193fcf3ce44SJohn Forte 194fcf3ce44SJohn Forte typedef struct stmf_view_op_entry { 195fcf3ce44SJohn Forte uint32_t ve_ndx_valid:1, 196fcf3ce44SJohn Forte ve_lu_number_valid:1, 197fcf3ce44SJohn Forte ve_all_hosts:1, 198fcf3ce44SJohn Forte ve_all_targets:1, 199fcf3ce44SJohn Forte rsvd:28; 200fcf3ce44SJohn Forte uint32_t ve_ndx; 201fcf3ce44SJohn Forte uint8_t ve_lu_nbr[8]; 202fcf3ce44SJohn Forte uint8_t ve_guid[16]; 203fcf3ce44SJohn Forte stmf_group_name_t ve_host_group; 204fcf3ce44SJohn Forte stmf_group_name_t ve_target_group; 205fcf3ce44SJohn Forte } stmf_view_op_entry_t; 206fcf3ce44SJohn Forte 207fcf3ce44SJohn Forte typedef struct stmf_ppioctl_data { 208fcf3ce44SJohn Forte char ppi_name[255]; /* Provider name including \0 */ 209fcf3ce44SJohn Forte uint8_t ppi_port_provider:1, 210fcf3ce44SJohn Forte ppi_lu_provider:1, 2118fe96085Stim szeto ppi_token_valid:1, 2128fe96085Stim szeto ppt_rsvd:5; 2138fe96085Stim szeto uint64_t ppi_token; 214fcf3ce44SJohn Forte uint64_t ppi_data_size; 215fcf3ce44SJohn Forte uint8_t ppi_data[8]; 216fcf3ce44SJohn Forte } stmf_ppioctl_data_t; 217fcf3ce44SJohn Forte 218*4b31676fSsrivijitha dugganapalli typedef struct stmf_set_props { 219*4b31676fSsrivijitha dugganapalli uint32_t default_lu_state_value; 220*4b31676fSsrivijitha dugganapalli uint32_t default_target_state_value; 221*4b31676fSsrivijitha dugganapalli } stmf_set_props_t; 222*4b31676fSsrivijitha dugganapalli 223fcf3ce44SJohn Forte /* 224fcf3ce44SJohn Forte * SCSI device ID descriptor as per SPC3 7.6.3 225fcf3ce44SJohn Forte */ 226fcf3ce44SJohn Forte typedef struct scsi_devid_desc { 227fcf3ce44SJohn Forte #ifdef _BIT_FIELDS_HTOL 228fcf3ce44SJohn Forte uint8_t protocol_id:4, 229fcf3ce44SJohn Forte code_set:4; 230fcf3ce44SJohn Forte uint8_t piv:1, 231fcf3ce44SJohn Forte rsvd1:1, 232fcf3ce44SJohn Forte association:2, 233fcf3ce44SJohn Forte ident_type:4; 234fcf3ce44SJohn Forte #else 235fcf3ce44SJohn Forte uint8_t code_set:4, 236fcf3ce44SJohn Forte protocol_id:4; 237fcf3ce44SJohn Forte uint8_t ident_type:4, 238fcf3ce44SJohn Forte association:2, 239fcf3ce44SJohn Forte rsvd1:1, 240fcf3ce44SJohn Forte piv:1; 241fcf3ce44SJohn Forte #endif 242fcf3ce44SJohn Forte uint8_t rsvd2; 243fcf3ce44SJohn Forte uint8_t ident_length; 244fcf3ce44SJohn Forte uint8_t ident[1]; 245fcf3ce44SJohn Forte } scsi_devid_desc_t; 246fcf3ce44SJohn Forte 247fcf3ce44SJohn Forte /* 248fcf3ce44SJohn Forte * Protocol Identifier 249fcf3ce44SJohn Forte */ 250fcf3ce44SJohn Forte #define PROTOCOL_FIBRE_CHANNEL 0 251fcf3ce44SJohn Forte #define PROTOCOL_PARALLEL_SCSI 1 252fcf3ce44SJohn Forte #define PROTOCOL_SSA 2 253fcf3ce44SJohn Forte #define PROTOCOL_IEEE_1394 3 254fcf3ce44SJohn Forte #define PROTOCOL_SRP 4 255fcf3ce44SJohn Forte #define PROTOCOL_iSCSI 5 256fcf3ce44SJohn Forte #define PROTOCOL_SAS 6 257fcf3ce44SJohn Forte #define PROTOCOL_ADT 7 258fcf3ce44SJohn Forte #define PROTOCOL_ATAPI 8 259fcf3ce44SJohn Forte #define PROTOCOL_ANY 15 260fcf3ce44SJohn Forte 261fcf3ce44SJohn Forte /* 262fcf3ce44SJohn Forte * Code set definitions 263fcf3ce44SJohn Forte */ 264fcf3ce44SJohn Forte #define CODE_SET_BINARY 1 265fcf3ce44SJohn Forte #define CODE_SET_ASCII 2 266fcf3ce44SJohn Forte #define CODE_SET_UTF8 3 267fcf3ce44SJohn Forte 268fcf3ce44SJohn Forte /* 269fcf3ce44SJohn Forte * Association values 270fcf3ce44SJohn Forte */ 271fcf3ce44SJohn Forte #define ID_IS_LOGICAL_UNIT 0 272fcf3ce44SJohn Forte #define ID_IS_TARGET_PORT 1 273fcf3ce44SJohn Forte #define ID_IS_TARGET_CONTAINING_LU 2 274fcf3ce44SJohn Forte 275fcf3ce44SJohn Forte /* 276fcf3ce44SJohn Forte * ident type 277fcf3ce44SJohn Forte */ 278fcf3ce44SJohn Forte #define ID_TYPE_VENDOR_SPECIFIC 0 279fcf3ce44SJohn Forte #define ID_TYPE_T10_VID 1 280fcf3ce44SJohn Forte #define ID_TYPE_EUI64 2 281fcf3ce44SJohn Forte #define ID_TYPE_NAA 3 282fcf3ce44SJohn Forte #define ID_TYPE_RELATIVE_TARGET_PORT 4 283fcf3ce44SJohn Forte #define ID_TYPE_TARGET_PORT_GROUP 5 284fcf3ce44SJohn Forte #define ID_TYPE_LOGICAL_UNIT_GROUP 6 285fcf3ce44SJohn Forte #define ID_TYPE_MD5_LOGICAL_UNIT 7 286fcf3ce44SJohn Forte #define ID_TYPE_SCSI_NAME_STRING 8 287fcf3ce44SJohn Forte 288fcf3ce44SJohn Forte int stmf_copyin_iocdata(intptr_t data, int mode, stmf_iocdata_t **iocd, 289fcf3ce44SJohn Forte void **ibuf, void **obuf); 290fcf3ce44SJohn Forte int stmf_copyout_iocdata(intptr_t data, int mode, stmf_iocdata_t *iocd, 291fcf3ce44SJohn Forte void *obuf); 292fcf3ce44SJohn Forte 293fcf3ce44SJohn Forte #ifdef __cplusplus 294fcf3ce44SJohn Forte } 295fcf3ce44SJohn Forte #endif 296fcf3ce44SJohn Forte 297fcf3ce44SJohn Forte #endif /* _STMF_IOCTL_H */ 298