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