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*3c70f4b3Scm * Copyright 2007 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 #pragma ident "%Z%%M% %I% %E% SMI" 308c4f8890Srs 318c4f8890Srs #ifdef __cplusplus 328c4f8890Srs extern "C" { 338c4f8890Srs #endif 348c4f8890Srs 358c4f8890Srs #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL) 368c4f8890Srs #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 378c4f8890Srs #endif /* _BIT_FIELDS_LTOH */ 388c4f8890Srs 398c4f8890Srs 408c4f8890Srs #include <sys/scsi/adapters/mpapi_impl.h> 418c4f8890Srs 420e838bceSrs #define MPAPI_SCSI_MAXPCLASSLEN 25 430e838bceSrs 448c4f8890Srs /* Structure for MP_OID (kernel level only) */ 458c4f8890Srs 468c4f8890Srs typedef struct mp_oid { 478c4f8890Srs #if defined(_BIT_FIELDS_HTOL) 488c4f8890Srs uint32_t tstamp; 498c4f8890Srs uint32_t type:8, 508c4f8890Srs seq_id:24; 518c4f8890Srs #else 528c4f8890Srs uint32_t seq_id:24, 538c4f8890Srs type:8; 548c4f8890Srs uint32_t tstamp; 558c4f8890Srs #endif 568c4f8890Srs } mp_oid_t; 578c4f8890Srs 588c4f8890Srs typedef union mpoid { 598c4f8890Srs uint64_t raw_oid; /* raw oid */ 608c4f8890Srs mp_oid_t disc_oid; /* discrete oid */ 618c4f8890Srs } mpoid_t; 628c4f8890Srs 638c4f8890Srs 648c4f8890Srs /* 658c4f8890Srs * MP API item - A generic one to use in a list setup 668c4f8890Srs * in a common way for all types of elements of 678c4f8890Srs * Object type items required for mpapi. 688c4f8890Srs */ 698c4f8890Srs 708c4f8890Srs typedef struct mpapi_item { 718c4f8890Srs mpoid_t oid; 728c4f8890Srs void *idata; /* item data */ 73*3c70f4b3Scm kmutex_t item_mutex; 740e838bceSrs } mpapi_item_t; 758c4f8890Srs 768c4f8890Srs typedef struct mpapi_item_list { 778c4f8890Srs mpapi_item_t *item; 788c4f8890Srs struct mpapi_item_list *next; 790e838bceSrs } mpapi_item_list_t; 808c4f8890Srs 818c4f8890Srs /* 828c4f8890Srs * MP API item header definition. 838c4f8890Srs */ 848c4f8890Srs 858c4f8890Srs typedef struct mpapi_list_header { 868c4f8890Srs mpapi_item_list_t *head; 878c4f8890Srs mpapi_item_list_t *tail; 880e838bceSrs } mpapi_list_header_t; 898c4f8890Srs 908c4f8890Srs /* 91f77d3fa4Srs * Structure to maintain mpapi initiator data. 928c4f8890Srs */ 938c4f8890Srs typedef struct mpapi_initiator_data { 94f77d3fa4Srs void *resp; /* initiator-port prop */ 958c4f8890Srs mpapi_list_header_t *path_list; 968c4f8890Srs int valid; 978c4f8890Srs mp_init_port_prop_t prop; 988c4f8890Srs } mpapi_initiator_data_t; 998c4f8890Srs 1008c4f8890Srs /* 101f77d3fa4Srs * Structure to maintain mpapi lu data. 1028c4f8890Srs */ 1038c4f8890Srs typedef struct mpapi_lu_data { 1048c4f8890Srs void *resp; /* vlun */ 1058c4f8890Srs mpapi_list_header_t *path_list; 1068c4f8890Srs mpapi_list_header_t *tpg_list; 1078c4f8890Srs int valid; 1088c4f8890Srs mp_logical_unit_prop_t prop; 1098c4f8890Srs } mpapi_lu_data_t; 1108c4f8890Srs 1118c4f8890Srs /* 112f77d3fa4Srs * Structure to maintain mpapi path data. 1138c4f8890Srs */ 1148c4f8890Srs typedef struct mpapi_path_data { 1158c4f8890Srs void *resp; /* pip */ 1168c4f8890Srs char *path_name; 1178c4f8890Srs int valid; 1180e838bceSrs char pclass[MPAPI_SCSI_MAXPCLASSLEN]; 1198c4f8890Srs mp_path_prop_t prop; 1208c4f8890Srs } mpapi_path_data_t; 1218c4f8890Srs 1228c4f8890Srs /* 123f77d3fa4Srs * Structure to maintain mpapi tpg data. 1248c4f8890Srs */ 1258c4f8890Srs typedef struct mpapi_tpg_data { 126f77d3fa4Srs void *resp; 1278c4f8890Srs mpapi_list_header_t *tport_list; 1288c4f8890Srs mpapi_list_header_t *lu_list; /* mpath lu or lun list */ 1298c4f8890Srs int valid; 1300e838bceSrs char pclass[MPAPI_SCSI_MAXPCLASSLEN]; 1318c4f8890Srs mp_tpg_prop_t prop; 1328c4f8890Srs } mpapi_tpg_data_t; 1338c4f8890Srs 1348c4f8890Srs /* 135f77d3fa4Srs * Structure to maintain mpapi tport data. 1368c4f8890Srs */ 1378c4f8890Srs typedef struct mpapi_tport_data { 1388c4f8890Srs void *resp; /* target port prop */ 1398c4f8890Srs mpapi_list_header_t *path_list; 1408c4f8890Srs int valid; 1418c4f8890Srs mp_target_port_prop_t prop; 1428c4f8890Srs } mpapi_tport_data_t; 1438c4f8890Srs 1448c4f8890Srs 1458c4f8890Srs /* Structure for mpapi private data */ 1468c4f8890Srs 1478c4f8890Srs typedef struct mpapi_priv { 1488c4f8890Srs 1498c4f8890Srs /* 150f77d3fa4Srs * Will be initialized with tod(time of day) 151f77d3fa4Srs * This will enable detection of stale OIDs used by the upper layers. 1528c4f8890Srs */ 1538c4f8890Srs uint32_t tstamp; 1548c4f8890Srs /* 155f77d3fa4Srs * The Sequence number space is unique within an Object Type - 156f77d3fa4Srs * that is there can be a seq# 2 in Object Type "initiator port" 157f77d3fa4Srs * and also a seq#2 in object type 'Path LU'. 158f77d3fa4Srs * Even though the Seq# space collides, the Object type field 159f77d3fa4Srs * will make the OIDs unique. 160f77d3fa4Srs * The following field will indicate what the next sequence number 161f77d3fa4Srs * that can be used for a particular type of Object type - 162f77d3fa4Srs * Object type will be used to index into the array element. 1638c4f8890Srs */ 1648c4f8890Srs uint32_t oid_seq[MP_MAX_OBJECT_TYPE]; 1658c4f8890Srs 1668c4f8890Srs /* 1678c4f8890Srs * One list for each type of object. 1688c4f8890Srs */ 1698c4f8890Srs mpapi_list_header_t *obj_hdr_list[MP_MAX_OBJECT_TYPE]; 1708c4f8890Srs 1718c4f8890Srs } mpapi_priv_t; 1728c4f8890Srs 1738c4f8890Srs #ifdef __cplusplus 1748c4f8890Srs } 1758c4f8890Srs #endif 1768c4f8890Srs 1778c4f8890Srs #endif /* _SYS_SCSI_ADAPTERS_MPAPI_SCSI_VHCI_H */ 178