1f77d3fa4Srs /* 2f77d3fa4Srs * CDDL HEADER START 3f77d3fa4Srs * 4f77d3fa4Srs * The contents of this file are subject to the terms of the 5f77d3fa4Srs * Common Development and Distribution License (the "License"). 6f77d3fa4Srs * You may not use this file except in compliance with the License. 7f77d3fa4Srs * 8f77d3fa4Srs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9f77d3fa4Srs * or http://www.opensolaris.org/os/licensing. 10f77d3fa4Srs * See the License for the specific language governing permissions 11f77d3fa4Srs * and limitations under the License. 12f77d3fa4Srs * 13f77d3fa4Srs * When distributing Covered Code, include this CDDL HEADER in each 14f77d3fa4Srs * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15f77d3fa4Srs * If applicable, add the following below this CDDL HEADER, with the 16f77d3fa4Srs * fields enclosed by brackets "[]" replaced with your own identifying 17f77d3fa4Srs * information: Portions Copyright [yyyy] [name of copyright owner] 18f77d3fa4Srs * 19f77d3fa4Srs * CDDL HEADER END 20f77d3fa4Srs */ 218c4f8890Srs /* 22*4c06356bSdh * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 238c4f8890Srs * Use is subject to license terms. 248c4f8890Srs */ 258c4f8890Srs 268c4f8890Srs #ifndef _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H 278c4f8890Srs #define _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H 288c4f8890Srs 298c4f8890Srs #ifdef __cplusplus 308c4f8890Srs extern "C" { 318c4f8890Srs #endif 328c4f8890Srs 338c4f8890Srs #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL) 348c4f8890Srs #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 358c4f8890Srs #endif /* _BIT_FIELDS_LTOH */ 368c4f8890Srs 378c4f8890Srs 388c4f8890Srs #include <sys/scsi/adapters/mpapi_impl.h> 398c4f8890Srs 400e838bceSrs #define MPAPI_SCSI_MAXPCLASSLEN 25 410e838bceSrs 428c4f8890Srs /* Structure for MP_OID (kernel level only) */ 438c4f8890Srs 448c4f8890Srs typedef struct mp_oid { 458c4f8890Srs #if defined(_BIT_FIELDS_HTOL) 468c4f8890Srs uint32_t tstamp; 478c4f8890Srs uint32_t type:8, 488c4f8890Srs seq_id:24; 498c4f8890Srs #else 508c4f8890Srs uint32_t seq_id:24, 518c4f8890Srs type:8; 528c4f8890Srs uint32_t tstamp; 538c4f8890Srs #endif 548c4f8890Srs } mp_oid_t; 558c4f8890Srs 568c4f8890Srs typedef union mpoid { 578c4f8890Srs uint64_t raw_oid; /* raw oid */ 588c4f8890Srs mp_oid_t disc_oid; /* discrete oid */ 598c4f8890Srs } mpoid_t; 608c4f8890Srs 618c4f8890Srs 628c4f8890Srs /* 638c4f8890Srs * MP API item - A generic one to use in a list setup 648c4f8890Srs * in a common way for all types of elements of 658c4f8890Srs * Object type items required for mpapi. 668c4f8890Srs */ 678c4f8890Srs 688c4f8890Srs typedef struct mpapi_item { 698c4f8890Srs mpoid_t oid; 708c4f8890Srs void *idata; /* item data */ 713c70f4b3Scm kmutex_t item_mutex; 720e838bceSrs } mpapi_item_t; 738c4f8890Srs 748c4f8890Srs typedef struct mpapi_item_list { 758c4f8890Srs mpapi_item_t *item; 768c4f8890Srs struct mpapi_item_list *next; 770e838bceSrs } mpapi_item_list_t; 788c4f8890Srs 798c4f8890Srs /* 808c4f8890Srs * MP API item header definition. 818c4f8890Srs */ 828c4f8890Srs 838c4f8890Srs typedef struct mpapi_list_header { 848c4f8890Srs mpapi_item_list_t *head; 858c4f8890Srs mpapi_item_list_t *tail; 860e838bceSrs } mpapi_list_header_t; 878c4f8890Srs 888c4f8890Srs /* 89f77d3fa4Srs * Structure to maintain mpapi initiator data. 908c4f8890Srs */ 918c4f8890Srs typedef struct mpapi_initiator_data { 92f77d3fa4Srs void *resp; /* initiator-port prop */ 938c4f8890Srs mpapi_list_header_t *path_list; 948c4f8890Srs int valid; 958c4f8890Srs mp_init_port_prop_t prop; 968c4f8890Srs } mpapi_initiator_data_t; 978c4f8890Srs 988c4f8890Srs /* 99f77d3fa4Srs * Structure to maintain mpapi lu data. 1008c4f8890Srs */ 1018c4f8890Srs typedef struct mpapi_lu_data { 1028c4f8890Srs void *resp; /* vlun */ 1038c4f8890Srs mpapi_list_header_t *path_list; 1048c4f8890Srs mpapi_list_header_t *tpg_list; 1058c4f8890Srs int valid; 1068c4f8890Srs mp_logical_unit_prop_t prop; 1078c4f8890Srs } mpapi_lu_data_t; 1088c4f8890Srs 1098c4f8890Srs /* 110f77d3fa4Srs * Structure to maintain mpapi path data. 111*4c06356bSdh * 112*4c06356bSdh * The hide flag is set when pip was detroyed or should 113*4c06356bSdh * have been destroyed(MDI_PATHINFO_FLAGS_DEVICE_REMOVED). 114*4c06356bSdh * The valid flag is set to 0 when the path is neither online 115*4c06356bSdh * nor standby state. When hide flag is set the valid flag set 116*4c06356bSdh * to 0 also. 1178c4f8890Srs */ 1188c4f8890Srs typedef struct mpapi_path_data { 1198c4f8890Srs void *resp; /* pip */ 1208c4f8890Srs char *path_name; 1218c4f8890Srs int valid; 122*4c06356bSdh int hide; 1230e838bceSrs char pclass[MPAPI_SCSI_MAXPCLASSLEN]; 1248c4f8890Srs mp_path_prop_t prop; 1258c4f8890Srs } mpapi_path_data_t; 1268c4f8890Srs 1278c4f8890Srs /* 128f77d3fa4Srs * Structure to maintain mpapi tpg data. 1298c4f8890Srs */ 1308c4f8890Srs typedef struct mpapi_tpg_data { 131f77d3fa4Srs void *resp; 1328c4f8890Srs mpapi_list_header_t *tport_list; 1338c4f8890Srs mpapi_list_header_t *lu_list; /* mpath lu or lun list */ 1348c4f8890Srs int valid; 1350e838bceSrs char pclass[MPAPI_SCSI_MAXPCLASSLEN]; 1368c4f8890Srs mp_tpg_prop_t prop; 1378c4f8890Srs } mpapi_tpg_data_t; 1388c4f8890Srs 1398c4f8890Srs /* 140f77d3fa4Srs * Structure to maintain mpapi tport data. 1418c4f8890Srs */ 1428c4f8890Srs typedef struct mpapi_tport_data { 1438c4f8890Srs void *resp; /* target port prop */ 1448c4f8890Srs mpapi_list_header_t *path_list; 1458c4f8890Srs int valid; 1468c4f8890Srs mp_target_port_prop_t prop; 1478c4f8890Srs } mpapi_tport_data_t; 1488c4f8890Srs 1498c4f8890Srs 1508c4f8890Srs /* Structure for mpapi private data */ 1518c4f8890Srs 1528c4f8890Srs typedef struct mpapi_priv { 1538c4f8890Srs 1548c4f8890Srs /* 155f77d3fa4Srs * Will be initialized with tod(time of day) 156f77d3fa4Srs * This will enable detection of stale OIDs used by the upper layers. 1578c4f8890Srs */ 1588c4f8890Srs uint32_t tstamp; 1598c4f8890Srs /* 160f77d3fa4Srs * The Sequence number space is unique within an Object Type - 161f77d3fa4Srs * that is there can be a seq# 2 in Object Type "initiator port" 162f77d3fa4Srs * and also a seq#2 in object type 'Path LU'. 163f77d3fa4Srs * Even though the Seq# space collides, the Object type field 164f77d3fa4Srs * will make the OIDs unique. 165f77d3fa4Srs * The following field will indicate what the next sequence number 166f77d3fa4Srs * that can be used for a particular type of Object type - 167f77d3fa4Srs * Object type will be used to index into the array element. 1688c4f8890Srs */ 1698c4f8890Srs uint32_t oid_seq[MP_MAX_OBJECT_TYPE]; 1708c4f8890Srs 1718c4f8890Srs /* 1728c4f8890Srs * One list for each type of object. 1738c4f8890Srs */ 1748c4f8890Srs mpapi_list_header_t *obj_hdr_list[MP_MAX_OBJECT_TYPE]; 1758c4f8890Srs 1768c4f8890Srs } mpapi_priv_t; 1778c4f8890Srs 1788c4f8890Srs #ifdef __cplusplus 1798c4f8890Srs } 1808c4f8890Srs #endif 1818c4f8890Srs 1828c4f8890Srs #endif /* _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H */ 183