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