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 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H 27 #define _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL) 36 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 37 #endif /* _BIT_FIELDS_LTOH */ 38 39 40 #include <sys/scsi/adapters/mpapi_impl.h> 41 42 #define MPAPI_SCSI_MAXPCLASSLEN 25 43 44 /* Structure for MP_OID (kernel level only) */ 45 46 typedef struct mp_oid { 47 #if defined(_BIT_FIELDS_HTOL) 48 uint32_t tstamp; 49 uint32_t type:8, 50 seq_id:24; 51 #else 52 uint32_t seq_id:24, 53 type:8; 54 uint32_t tstamp; 55 #endif 56 } mp_oid_t; 57 58 typedef union mpoid { 59 uint64_t raw_oid; /* raw oid */ 60 mp_oid_t disc_oid; /* discrete oid */ 61 } mpoid_t; 62 63 64 /* 65 * MP API item - A generic one to use in a list setup 66 * in a common way for all types of elements of 67 * Object type items required for mpapi. 68 */ 69 70 typedef struct mpapi_item { 71 mpoid_t oid; 72 void *idata; /* item data */ 73 } mpapi_item_t; 74 75 typedef struct mpapi_item_list { 76 mpapi_item_t *item; 77 struct mpapi_item_list *next; 78 } mpapi_item_list_t; 79 80 /* 81 * MP API item header definition. 82 */ 83 84 typedef struct mpapi_list_header { 85 mpapi_item_list_t *head; 86 mpapi_item_list_t *tail; 87 } mpapi_list_header_t; 88 89 /* 90 * Structure to maintain mpapi initiator data. 91 */ 92 typedef struct mpapi_initiator_data { 93 void *resp; /* initiator-port prop */ 94 mpapi_list_header_t *path_list; 95 int valid; 96 mp_init_port_prop_t prop; 97 } mpapi_initiator_data_t; 98 99 /* 100 * Structure to maintain mpapi lu data. 101 */ 102 typedef struct mpapi_lu_data { 103 void *resp; /* vlun */ 104 mpapi_list_header_t *path_list; 105 mpapi_list_header_t *tpg_list; 106 int valid; 107 mp_logical_unit_prop_t prop; 108 } mpapi_lu_data_t; 109 110 /* 111 * Structure to maintain mpapi path data. 112 */ 113 typedef struct mpapi_path_data { 114 void *resp; /* pip */ 115 char *path_name; 116 int valid; 117 char pclass[MPAPI_SCSI_MAXPCLASSLEN]; 118 mp_path_prop_t prop; 119 } mpapi_path_data_t; 120 121 /* 122 * Structure to maintain mpapi tpg data. 123 */ 124 typedef struct mpapi_tpg_data { 125 void *resp; 126 mpapi_list_header_t *tport_list; 127 mpapi_list_header_t *lu_list; /* mpath lu or lun list */ 128 int valid; 129 char pclass[MPAPI_SCSI_MAXPCLASSLEN]; 130 mp_tpg_prop_t prop; 131 } mpapi_tpg_data_t; 132 133 /* 134 * Structure to maintain mpapi tport data. 135 */ 136 typedef struct mpapi_tport_data { 137 void *resp; /* target port prop */ 138 mpapi_list_header_t *path_list; 139 int valid; 140 mp_target_port_prop_t prop; 141 } mpapi_tport_data_t; 142 143 144 /* Structure for mpapi private data */ 145 146 typedef struct mpapi_priv { 147 148 /* 149 * Will be initialized with tod(time of day) 150 * This will enable detection of stale OIDs used by the upper layers. 151 */ 152 uint32_t tstamp; 153 /* 154 * The Sequence number space is unique within an Object Type - 155 * that is there can be a seq# 2 in Object Type "initiator port" 156 * and also a seq#2 in object type 'Path LU'. 157 * Even though the Seq# space collides, the Object type field 158 * will make the OIDs unique. 159 * The following field will indicate what the next sequence number 160 * that can be used for a particular type of Object type - 161 * Object type will be used to index into the array element. 162 */ 163 uint32_t oid_seq[MP_MAX_OBJECT_TYPE]; 164 165 /* 166 * One list for each type of object. 167 */ 168 mpapi_list_header_t *obj_hdr_list[MP_MAX_OBJECT_TYPE]; 169 170 } mpapi_priv_t; 171 172 #ifdef __cplusplus 173 } 174 #endif 175 176 #endif /* _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H */ 177