18c4f8890Srs135747 /* 2f77d3fa4Srs135747 * CDDL HEADER START 3f77d3fa4Srs135747 * 4f77d3fa4Srs135747 * The contents of this file are subject to the terms of the 5f77d3fa4Srs135747 * Common Development and Distribution License (the "License"). 6f77d3fa4Srs135747 * You may not use this file except in compliance with the License. 7f77d3fa4Srs135747 * 8f77d3fa4Srs135747 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9f77d3fa4Srs135747 * or http://www.opensolaris.org/os/licensing. 10f77d3fa4Srs135747 * See the License for the specific language governing permissions 11f77d3fa4Srs135747 * and limitations under the License. 12f77d3fa4Srs135747 * 13f77d3fa4Srs135747 * When distributing Covered Code, include this CDDL HEADER in each 14f77d3fa4Srs135747 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15f77d3fa4Srs135747 * If applicable, add the following below this CDDL HEADER, with the 16f77d3fa4Srs135747 * fields enclosed by brackets "[]" replaced with your own identifying 17f77d3fa4Srs135747 * information: Portions Copyright [yyyy] [name of copyright owner] 18f77d3fa4Srs135747 * 19f77d3fa4Srs135747 * CDDL HEADER END 20f77d3fa4Srs135747 */ 21f77d3fa4Srs135747 /* 2217d71211SJiri Svoboda * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 23*19d47a18SJason King * Copyright 2021 RackTop Systems, Inc. 248c4f8890Srs135747 */ 258c4f8890Srs135747 268c4f8890Srs135747 #ifndef _SYS_SCSI_ADAPTERS_MPAPI_IMPL_H 278c4f8890Srs135747 #define _SYS_SCSI_ADAPTERS_MPAPI_IMPL_H 288c4f8890Srs135747 298c4f8890Srs135747 #include <sys/sunmdi.h> 308c4f8890Srs135747 #include <sys/sunddi.h> 318c4f8890Srs135747 #include <sys/mdi_impldefs.h> 32*19d47a18SJason King #include <sys/debug.h> 338c4f8890Srs135747 348c4f8890Srs135747 #ifdef __cplusplus 358c4f8890Srs135747 extern "C" { 368c4f8890Srs135747 #endif 378c4f8890Srs135747 388c4f8890Srs135747 #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL) 398c4f8890Srs135747 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 408c4f8890Srs135747 #endif /* _BIT_FIELDS_LTOH */ 418c4f8890Srs135747 428c4f8890Srs135747 /* 438c4f8890Srs135747 * All the structures (except mp_iocdata_t) are 64-bit aligned (padded, 448c4f8890Srs135747 * where necessary) to facilitate the use of the same structure for 458c4f8890Srs135747 * handling ioctl calls made by both 32-bit and 64-bit applications. 468c4f8890Srs135747 * There are no pointers to other structures inside these structures 478c4f8890Srs135747 * as copyout to user land may not produce desired result. 488c4f8890Srs135747 * The caddr_t structure is kept at the end due to the undeterminstic 498c4f8890Srs135747 * size it could accrue to its parent structure. 508c4f8890Srs135747 */ 518c4f8890Srs135747 528c4f8890Srs135747 /* Structure for MP_PLUGIN_PROPERTIES */ 538c4f8890Srs135747 548c4f8890Srs135747 typedef struct mp_driver_prop { 558c4f8890Srs135747 char driverVersion[256]; 568c4f8890Srs135747 uint32_t supportedLoadBalanceTypes; 578c4f8890Srs135747 boolean_t canSetTPGAccess; 588c4f8890Srs135747 boolean_t canOverridePaths; 598c4f8890Srs135747 boolean_t exposesPathDeviceFiles; 608c4f8890Srs135747 char deviceFileNamespace[256]; 618c4f8890Srs135747 uint32_t onlySupportsSpecifiedProducts; 628c4f8890Srs135747 uint32_t maximumWeight; 638c4f8890Srs135747 uint32_t failbackPollingRateMax; 648c4f8890Srs135747 uint32_t currentFailbackPollingRate; 658c4f8890Srs135747 uint32_t autoFailbackSupport; 668c4f8890Srs135747 uint32_t autoFailbackEnabled; 678c4f8890Srs135747 uint32_t defaultLoadBalanceType; 688c4f8890Srs135747 uint32_t probingPollingRateMax; 698c4f8890Srs135747 uint32_t currentProbingPollingRate; 708c4f8890Srs135747 uint32_t autoProbingSupport; 718c4f8890Srs135747 uint32_t autoProbingEnabled; 728c4f8890Srs135747 uint32_t proprietaryPropSize; 738c4f8890Srs135747 caddr_t proprietaryProp; 74*19d47a18SJason King #ifdef _ILP32 75*19d47a18SJason King uint32_t pad; 76*19d47a18SJason King #endif 778c4f8890Srs135747 } mp_driver_prop_t; 78*19d47a18SJason King CTASSERT(sizeof (mp_driver_prop_t) == 0x248); 798c4f8890Srs135747 808c4f8890Srs135747 818c4f8890Srs135747 /* Size of "proprietaryProp" field */ 828c4f8890Srs135747 838c4f8890Srs135747 #define MP_MAX_PROP_BUF_SIZE 1024 848c4f8890Srs135747 858c4f8890Srs135747 868c4f8890Srs135747 /* Constants for autoFailbackSupport */ 878c4f8890Srs135747 888c4f8890Srs135747 /* 898c4f8890Srs135747 * Both MP_DRVR_AUTO_FAILBACK_SUPPORT and 908c4f8890Srs135747 * MP_DRVR_AUTO_FAILBACK_SUPPORT_LU 918c4f8890Srs135747 * can be supported at the same time. 928c4f8890Srs135747 */ 938c4f8890Srs135747 948c4f8890Srs135747 #define MP_DRVR_AUTO_FAILBACK_SUPPORT_NONE 0 958c4f8890Srs135747 #define MP_DRVR_AUTO_FAILBACK_SUPPORT (1<<0) 968c4f8890Srs135747 #define MP_DRVR_AUTO_FAILBACK_SUPPORT_LU (1<<1) 978c4f8890Srs135747 988c4f8890Srs135747 998c4f8890Srs135747 100800deabcScm136836 /* 101800deabcScm136836 * Declaration of the MP_LOAD_BALANCE_TYPE constants - should be 102800deabcScm136836 * the same defines as in mpapi.h 103800deabcScm136836 */ 104800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_NONE 0 105800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_UNKNOWN (1<<0) 106800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_ROUNDROBIN (1<<1) 107800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_LEASTBLOCKS (1<<2) 108800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_LEASTIO (1<<3) 109800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_DEVICE_PRODUCT (1<<4) 110800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_LBA_REGION (1<<5) 111800deabcScm136836 #define MP_DRVR_LOAD_BALANCE_TYPE_FAILOVER_ONLY (1<<6) 112800deabcScm136836 /* 113800deabcScm136836 * Proprietary load balance type should start from 0x10000(1<<16) or greater. 114800deabcScm136836 * It is exposed through API MP_GetProprietaryLoadBalanceProperties if exists. 115800deabcScm136836 */ 1168c4f8890Srs135747 #define MP_DRVR_LOAD_BALANCE_TYPE_PROPRIETARY1 (1<<16) 1178c4f8890Srs135747 #define MP_DRVR_LOAD_BALANCE_TYPE_PROPRIETARY2 (1<<17) 1188c4f8890Srs135747 1198c4f8890Srs135747 /* Constants for autoProbingSupport */ 1208c4f8890Srs135747 1218c4f8890Srs135747 /* 1228c4f8890Srs135747 * Both MP_DRVR_AUTO_PROBING_SUPPORT and 1238c4f8890Srs135747 * MP_DRVR_AUTO_PROBING_SUPPORT_LU 1248c4f8890Srs135747 * can be supported at the same time. 1258c4f8890Srs135747 */ 1268c4f8890Srs135747 1278c4f8890Srs135747 #define MP_DRVR_AUTO_PROBING_SUPPORT_NONE 0 1288c4f8890Srs135747 #define MP_DRVR_AUTO_PROBING_SUPPORT (1<<0) 1298c4f8890Srs135747 #define MP_DRVR_AUTO_PROBING_SUPPORT_LU (1<<1) 1308c4f8890Srs135747 1318c4f8890Srs135747 1328c4f8890Srs135747 /* Structures for MP_DEVICE_PRODUCT_PROPERTIES */ 1338c4f8890Srs135747 1348c4f8890Srs135747 typedef struct mp_vendor_prod_info { 1358c4f8890Srs135747 char vendor[8]; 1368c4f8890Srs135747 char product[16]; 1378c4f8890Srs135747 char revision[4]; 1388c4f8890Srs135747 char reserved[4]; /* padding for 64bit alignment */ 1398c4f8890Srs135747 } mp_vendor_prod_info_t; 1408c4f8890Srs135747 1418c4f8890Srs135747 typedef struct mp_dev_prod_prop { 1428c4f8890Srs135747 struct mp_vendor_prod_info prodInfo; 1438c4f8890Srs135747 uint32_t supportedLoadBalanceTypes; 1448c4f8890Srs135747 uint32_t reserved; /* 64bit alignment padding */ 1458c4f8890Srs135747 uint64_t id; 1468c4f8890Srs135747 } mp_dev_prod_prop_t; 1478c4f8890Srs135747 1488c4f8890Srs135747 1498c4f8890Srs135747 /* Structure for MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES */ 1508c4f8890Srs135747 1518c4f8890Srs135747 typedef struct mp_logical_unit_prop { 1528c4f8890Srs135747 struct mp_vendor_prod_info prodInfo; 1538c4f8890Srs135747 char name[256]; /* guid */ 1548c4f8890Srs135747 uint32_t nameType; 1558c4f8890Srs135747 uint32_t luGroupID; 1568c4f8890Srs135747 char deviceFileName[256]; 1578c4f8890Srs135747 uint64_t id; 1588c4f8890Srs135747 boolean_t asymmetric; 1598c4f8890Srs135747 uint32_t currentLoadBalanceType; 1608c4f8890Srs135747 boolean_t autoFailbackEnabled; 1618c4f8890Srs135747 uint32_t failbackPollingRateMax; 1628c4f8890Srs135747 uint32_t currentFailBackPollingRate; 1638c4f8890Srs135747 uint32_t autoProbingEnabled; 1648c4f8890Srs135747 uint32_t probingPollingRateMax; 1658c4f8890Srs135747 uint32_t currentProbingPollingRate; 1668c4f8890Srs135747 uint64_t overridePathID; 1678c4f8890Srs135747 boolean_t overridePathInUse; 1688c4f8890Srs135747 uint32_t proprietaryPropSize; 1698c4f8890Srs135747 caddr_t proprietaryProp; 170*19d47a18SJason King #ifdef _ILP32 171*19d47a18SJason King uint32_t pad; 172*19d47a18SJason King #endif 1738c4f8890Srs135747 } mp_logical_unit_prop_t; 174*19d47a18SJason King CTASSERT(sizeof (mp_logical_unit_prop_t) == 0x268); 1758c4f8890Srs135747 1768c4f8890Srs135747 1778c4f8890Srs135747 /* Constants for nameType */ 1788c4f8890Srs135747 1798c4f8890Srs135747 #define MP_DRVR_NAME_TYPE_UNKNOWN 0 1808c4f8890Srs135747 #define MP_DRVR_NAME_TYPE_VPD83_TYPE1 1 1818c4f8890Srs135747 #define MP_DRVR_NAME_TYPE_VPD83_TYPE2 2 1828c4f8890Srs135747 #define MP_DRVR_NAME_TYPE_VPD83_TYPE3 3 1838c4f8890Srs135747 #define MP_DRVR_NAME_TYPE_DEVICE_SPECIFIC 4 1848c4f8890Srs135747 1858c4f8890Srs135747 1868c4f8890Srs135747 /* Structure for MP_INITIATOR_PORT_PROPERTIES */ 1878c4f8890Srs135747 1888c4f8890Srs135747 typedef struct mp_init_port_prop { 1898c4f8890Srs135747 char portID[256]; 1908c4f8890Srs135747 char osDeviceFile[256]; 1918c4f8890Srs135747 uint32_t portType; 1928c4f8890Srs135747 uint32_t reserved; /* padding for 64bit alignment */ 1938c4f8890Srs135747 uint64_t id; 1948c4f8890Srs135747 } mp_init_port_prop_t; 1958c4f8890Srs135747 1968c4f8890Srs135747 1978c4f8890Srs135747 /* Constants for portType */ 1988c4f8890Srs135747 1998c4f8890Srs135747 #define MP_DRVR_TRANSPORT_TYPE_UNKNOWN 0 2008c4f8890Srs135747 #define MP_DRVR_TRANSPORT_TYPE_FC 2 2018c4f8890Srs135747 #define MP_DRVR_TRANSPORT_TYPE_SPI 3 2028c4f8890Srs135747 #define MP_DRVR_TRANSPORT_TYPE_ISCSI 4 2038c4f8890Srs135747 #define MP_DRVR_TRANSPORT_TYPE_IFB 5 2048c4f8890Srs135747 2058c4f8890Srs135747 2068c4f8890Srs135747 /* Structure for MP_TARGET_PORT_PROPERTIES */ 2078c4f8890Srs135747 2088c4f8890Srs135747 typedef struct mp_target_port_prop { 2098c4f8890Srs135747 char portName[256]; 2108c4f8890Srs135747 uint32_t relativePortID; 2118c4f8890Srs135747 uint32_t reserved; /* padding for 64bit alignment */ 2128c4f8890Srs135747 uint64_t id; 2138c4f8890Srs135747 } mp_target_port_prop_t; 2148c4f8890Srs135747 2158c4f8890Srs135747 2168c4f8890Srs135747 /* Structure for MP_TARGET_PORT_GROUP_PROPERTIES */ 2178c4f8890Srs135747 2188c4f8890Srs135747 typedef struct mp_tpg_prop { 2198c4f8890Srs135747 uint32_t accessState; 2208c4f8890Srs135747 boolean_t explicitFailover; 2218c4f8890Srs135747 uint32_t tpgId; /* T10 defined id in report/set TPG */ 2228c4f8890Srs135747 boolean_t preferredLuPath; 2238c4f8890Srs135747 boolean_t supportsLuAssignment; 2248c4f8890Srs135747 uint32_t reserved; /* padding for 64bit alignment */ 2258c4f8890Srs135747 uint64_t id; 2268c4f8890Srs135747 } mp_tpg_prop_t; 2278c4f8890Srs135747 2288c4f8890Srs135747 2298c4f8890Srs135747 /* Constants for accessState */ 2308c4f8890Srs135747 2318c4f8890Srs135747 #define MP_DRVR_ACCESS_STATE_ACTIVE_OPTIMIZED 0 2328c4f8890Srs135747 #define MP_DRVR_ACCESS_STATE_ACTIVE_NONOPTIMIZED 0x1 2338c4f8890Srs135747 #define MP_DRVR_ACCESS_STATE_STANDBY 0x2 2348c4f8890Srs135747 #define MP_DRVR_ACCESS_STATE_UNAVAILABLE 0x3 2358c4f8890Srs135747 #define MP_DRVR_ACCESS_STATE_TRANSITIONING 0xf 2368c4f8890Srs135747 #define MP_DRVR_ACCESS_STATE_ACTIVE 0x10 2378c4f8890Srs135747 2388c4f8890Srs135747 2398c4f8890Srs135747 /* Structure for MP_PATH_LOGICAL_UNIT_PROPERTIES */ 2408c4f8890Srs135747 2418c4f8890Srs135747 typedef struct mp_path_prop { 2428c4f8890Srs135747 uint32_t weight; 2438c4f8890Srs135747 uint32_t pathState; 2448c4f8890Srs135747 boolean_t disabled; 2458c4f8890Srs135747 uint32_t reserved; /* 64bit alignment padding */ 2468c4f8890Srs135747 uint64_t id; 2478c4f8890Srs135747 struct mp_init_port_prop initPort; 2488c4f8890Srs135747 struct mp_target_port_prop targetPort; 2498c4f8890Srs135747 struct mp_logical_unit_prop logicalUnit; 2508c4f8890Srs135747 } mp_path_prop_t; 2518c4f8890Srs135747 2528c4f8890Srs135747 2538c4f8890Srs135747 /* Constants for pathState */ 2548c4f8890Srs135747 2558c4f8890Srs135747 #define MP_DRVR_PATH_STATE_ACTIVE 0 2568c4f8890Srs135747 #define MP_DRVR_PATH_STATE_PASSIVE 1 2578c4f8890Srs135747 #define MP_DRVR_PATH_STATE_PATH_ERR 2 2588c4f8890Srs135747 #define MP_DRVR_PATH_STATE_LU_ERR 3 2598c4f8890Srs135747 #define MP_DRVR_PATH_STATE_RESERVED 4 2608c4f8890Srs135747 #define MP_DRVR_PATH_STATE_REMOVED 5 2618c4f8890Srs135747 #define MP_DRVR_PATH_STATE_TRANSITIONING 6 2628c4f8890Srs135747 #define MP_DRVR_PATH_STATE_UNKNOWN 7 2634c06356bSdh142964 #define MP_DRVR_PATH_STATE_UNINIT 8 2648c4f8890Srs135747 2658c4f8890Srs135747 2668c4f8890Srs135747 /* Structure for MP_PROPRIETARY_LOAD_BALANCE_PROPERTIES */ 2678c4f8890Srs135747 2688c4f8890Srs135747 typedef struct mp_proprietary_loadbalance_prop { 2698c4f8890Srs135747 char name[256]; 2708c4f8890Srs135747 char vendorName[256]; 2718c4f8890Srs135747 uint64_t id; 2728c4f8890Srs135747 uint32_t typeIndex; 2738c4f8890Srs135747 uint32_t proprietaryPropSize; 2748c4f8890Srs135747 caddr_t proprietaryProp; 275*19d47a18SJason King #ifdef _ILP32 276*19d47a18SJason King uint32_t pad; 277*19d47a18SJason King #endif 2788c4f8890Srs135747 } mp_proprietary_loadbalance_prop_t; 279*19d47a18SJason King CTASSERT(sizeof (mp_proprietary_loadbalance_prop_t) == 0x218); 2808c4f8890Srs135747 2818c4f8890Srs135747 2828c4f8890Srs135747 /* 2838c4f8890Srs135747 * Structure used as input to 2848c4f8890Srs135747 * MP_ASSIGN_LU_TO_TPG subcmd. 2858c4f8890Srs135747 */ 2868c4f8890Srs135747 2878c4f8890Srs135747 typedef struct mp_lu_tpg_pair { 2888c4f8890Srs135747 uint64_t luId; 2898c4f8890Srs135747 uint64_t tpgId; 2908c4f8890Srs135747 } mp_lu_tpg_pair_t; 2918c4f8890Srs135747 2923c70f4b3Scm136836 /* used for uscsi commmands */ 2933c70f4b3Scm136836 typedef struct mp_uscsi_cmd { 2943c70f4b3Scm136836 struct scsi_address *ap; /* address of the path */ 2953c70f4b3Scm136836 struct uscsi_cmd *uscmdp; /* uscsi command */ 2963c70f4b3Scm136836 struct buf *cmdbp; /* original buffer */ 2973c70f4b3Scm136836 struct buf *rqbp; /* auto-rqsense packet */ 2983c70f4b3Scm136836 mdi_pathinfo_t *pip; /* path information */ 2993c70f4b3Scm136836 int arq_enabled; /* auto-rqsense enable flag */ 3003c70f4b3Scm136836 } mp_uscsi_cmd_t; 3018c4f8890Srs135747 3028c4f8890Srs135747 /* 3038c4f8890Srs135747 * Structure used as input to 3048c4f8890Srs135747 * MP_SET_TPG_ACCESS_STATE subcmd. 3058c4f8890Srs135747 */ 3068c4f8890Srs135747 3078c4f8890Srs135747 typedef struct mp_set_tpg_state_req { 3088c4f8890Srs135747 struct mp_lu_tpg_pair luTpgPair; 3098c4f8890Srs135747 uint32_t desiredState; 3108c4f8890Srs135747 uint32_t reserved; /* padding for 64bit boundary */ 3118c4f8890Srs135747 } mp_set_tpg_state_req_t; 3128c4f8890Srs135747 3138c4f8890Srs135747 3148c4f8890Srs135747 /* 3158c4f8890Srs135747 * Structure for ioctl data 3168c4f8890Srs135747 */ 3178c4f8890Srs135747 typedef struct mp_iocdata { 3188c4f8890Srs135747 uint16_t mp_xfer; /* direction */ 3198c4f8890Srs135747 uint16_t mp_cmd; /* sub command */ 3208c4f8890Srs135747 uint16_t mp_flags; /* flags */ 3218c4f8890Srs135747 uint16_t mp_cmd_flags; /* command specific flags */ 3228c4f8890Srs135747 size_t mp_ilen; /* Input buffer length */ 3238c4f8890Srs135747 caddr_t mp_ibuf; /* Input buffer */ 3248c4f8890Srs135747 size_t mp_olen; /* Output buffer length */ 3258c4f8890Srs135747 caddr_t mp_obuf; /* Output buffer */ 3268c4f8890Srs135747 size_t mp_alen; /* Auxiliary buffer length */ 3278c4f8890Srs135747 caddr_t mp_abuf; /* Auxiliary buffer */ 3288c4f8890Srs135747 int mp_errno; /* MPAPI driver internal error code */ 3298c4f8890Srs135747 } mp_iocdata_t; 3308c4f8890Srs135747 3318c4f8890Srs135747 3328c4f8890Srs135747 #ifdef _KERNEL 3338c4f8890Srs135747 3348c4f8890Srs135747 #if defined(_SYSCALL32) 3358c4f8890Srs135747 3368c4f8890Srs135747 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3378c4f8890Srs135747 #pragma pack(4) 3388c4f8890Srs135747 #endif 3398c4f8890Srs135747 3408c4f8890Srs135747 /* 3418c4f8890Srs135747 * Structure for 32-bit ioctl data 3428c4f8890Srs135747 */ 3438c4f8890Srs135747 3448c4f8890Srs135747 typedef struct mp_iocdata32 { 3458c4f8890Srs135747 uint16_t mp_xfer; /* direction */ 3468c4f8890Srs135747 uint16_t mp_cmd; /* sub command */ 3478c4f8890Srs135747 uint16_t mp_flags; /* flags */ 3488c4f8890Srs135747 uint16_t mp_cmd_flags; /* command specific flags */ 3498c4f8890Srs135747 uint32_t mp_ilen; /* Input buffer length */ 3508c4f8890Srs135747 caddr32_t mp_ibuf; /* Input buffer */ 3518c4f8890Srs135747 uint32_t mp_olen; /* Output buffer length */ 3528c4f8890Srs135747 caddr32_t mp_obuf; /* Output buffer */ 3538c4f8890Srs135747 uint32_t mp_alen; /* Auxiliary buffer length */ 3548c4f8890Srs135747 caddr32_t mp_abuf; /* Auxiliary buffer */ 3558c4f8890Srs135747 int32_t mp_errno; /* MPAPI driver internal error code */ 3568c4f8890Srs135747 } mp_iocdata32_t; 3578c4f8890Srs135747 3588c4f8890Srs135747 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3598c4f8890Srs135747 #pragma pack() 3608c4f8890Srs135747 #endif 3618c4f8890Srs135747 3628c4f8890Srs135747 #endif /* _SYSCALL32 */ 3638c4f8890Srs135747 3648c4f8890Srs135747 #endif /* _KERNEL */ 3658c4f8890Srs135747 3668c4f8890Srs135747 3678c4f8890Srs135747 /* Constants for MP_XFER */ 3688c4f8890Srs135747 3698c4f8890Srs135747 #define MP_XFER_NONE 0x00 3708c4f8890Srs135747 #define MP_XFER_READ 0x01 3718c4f8890Srs135747 #define MP_XFER_WRITE 0x02 3728c4f8890Srs135747 #define MP_XFER_RW (MP_XFER_READ | MP_XFER_WRITE) 3738c4f8890Srs135747 3748c4f8890Srs135747 3758c4f8890Srs135747 /* Constants for MP_OBJECT_TYPE */ 3768c4f8890Srs135747 3778c4f8890Srs135747 #define MP_OBJECT_TYPE_UNKNOWN 0 3788c4f8890Srs135747 #define MP_OBJECT_TYPE_PLUGIN 1 3798c4f8890Srs135747 #define MP_OBJECT_TYPE_INITIATOR_PORT 2 3808c4f8890Srs135747 #define MP_OBJECT_TYPE_TARGET_PORT 3 3818c4f8890Srs135747 #define MP_OBJECT_TYPE_MULTIPATH_LU 4 3828c4f8890Srs135747 #define MP_OBJECT_TYPE_PATH_LU 5 3838c4f8890Srs135747 #define MP_OBJECT_TYPE_DEVICE_PRODUCT 6 3848c4f8890Srs135747 #define MP_OBJECT_TYPE_TARGET_PORT_GROUP 7 3858c4f8890Srs135747 #define MP_OBJECT_TYPE_PROPRIETARY_LOAD_BALANCE 8 3868c4f8890Srs135747 #define MP_OBJECT_TYPE_LAST_ENTRY MP_OBJECT_TYPE_PROPRIETARY_LOAD_BALANCE 3878c4f8890Srs135747 #define MP_MAX_OBJECT_TYPE (MP_OBJECT_TYPE_LAST_ENTRY + 1) 3888c4f8890Srs135747 3898c4f8890Srs135747 3908c4f8890Srs135747 /* Constants for MP_CMD */ 3918c4f8890Srs135747 3928c4f8890Srs135747 #define MPAPI_CTL ('m'<<8) 3938c4f8890Srs135747 #define MP_CMD (MPAPI_CTL | 2005) 3948c4f8890Srs135747 #define MP_SUB_CMD ('M'<<8) 3958c4f8890Srs135747 3968c4f8890Srs135747 #define MP_API_SUBCMD_MIN (MP_SUB_CMD + 0x01) 3978c4f8890Srs135747 #define MP_GET_DRIVER_PROP (MP_SUB_CMD + 0x01) 3988c4f8890Srs135747 #define MP_GET_DEV_PROD_LIST (MP_SUB_CMD + 0x02) 3998c4f8890Srs135747 #define MP_GET_DEV_PROD_PROP (MP_SUB_CMD + 0x03) 4008c4f8890Srs135747 #define MP_GET_LU_LIST (MP_SUB_CMD + 0x04) 4018c4f8890Srs135747 #define MP_GET_LU_LIST_FROM_TPG (MP_SUB_CMD + 0x05) 4028c4f8890Srs135747 #define MP_GET_LU_PROP (MP_SUB_CMD + 0x06) 4038c4f8890Srs135747 #define MP_GET_PATH_LIST_FOR_MP_LU (MP_SUB_CMD + 0x07) 4048c4f8890Srs135747 #define MP_GET_PATH_LIST_FOR_INIT_PORT (MP_SUB_CMD + 0x08) 4058c4f8890Srs135747 #define MP_GET_PATH_LIST_FOR_TARGET_PORT (MP_SUB_CMD + 0x09) 4068c4f8890Srs135747 #define MP_GET_PATH_PROP (MP_SUB_CMD + 0x0a) 4078c4f8890Srs135747 #define MP_GET_INIT_PORT_LIST (MP_SUB_CMD + 0x0b) 4088c4f8890Srs135747 #define MP_GET_INIT_PORT_PROP (MP_SUB_CMD + 0x0c) 4098c4f8890Srs135747 #define MP_GET_TARGET_PORT_PROP (MP_SUB_CMD + 0x0d) 4108c4f8890Srs135747 #define MP_GET_TPG_LIST (MP_SUB_CMD + 0x0e) 4118c4f8890Srs135747 #define MP_GET_TPG_PROP (MP_SUB_CMD + 0x0f) 4128c4f8890Srs135747 #define MP_GET_TPG_LIST_FOR_LU (MP_SUB_CMD + 0x10) 4138c4f8890Srs135747 #define MP_GET_TARGET_PORT_LIST_FOR_TPG (MP_SUB_CMD + 0x11) 4148c4f8890Srs135747 #define MP_SET_TPG_ACCESS_STATE (MP_SUB_CMD + 0x12) 4158c4f8890Srs135747 #define MP_ENABLE_AUTO_FAILBACK (MP_SUB_CMD + 0x13) 4168c4f8890Srs135747 #define MP_DISABLE_AUTO_FAILBACK (MP_SUB_CMD + 0x14) 4178c4f8890Srs135747 #define MP_ENABLE_PATH (MP_SUB_CMD + 0x15) 4188c4f8890Srs135747 #define MP_DISABLE_PATH (MP_SUB_CMD + 0x16) 4198c4f8890Srs135747 #define MP_GET_PROPRIETARY_LOADBALANCE_LIST (MP_SUB_CMD + 0x17) 4208c4f8890Srs135747 #define MP_GET_PROPRIETARY_LOADBALANCE_PROP (MP_SUB_CMD + 0x18) 4218c4f8890Srs135747 #define MP_ASSIGN_LU_TO_TPG (MP_SUB_CMD + 0x19) 4223c70f4b3Scm136836 #define MP_SEND_SCSI_CMD (MP_SUB_CMD + 0x1a) 4233c70f4b3Scm136836 #define MP_API_SUBCMD_MAX (MP_SEND_SCSI_CMD) 4248c4f8890Srs135747 4258c4f8890Srs135747 4268c4f8890Srs135747 /* 4278c4f8890Srs135747 * Typical MP API ioctl interface specific Return Values 4288c4f8890Srs135747 */ 4298c4f8890Srs135747 4308c4f8890Srs135747 #define MP_IOCTL_ERROR_START 0x5533 4318c4f8890Srs135747 #define MP_MORE_DATA (MP_IOCTL_ERROR_START + 1) 4328c4f8890Srs135747 #define MP_DRVR_INVALID_ID (MP_IOCTL_ERROR_START + 2) 4338c4f8890Srs135747 #define MP_DRVR_ID_OBSOLETE (MP_IOCTL_ERROR_START + 3) 4348c4f8890Srs135747 #define MP_DRVR_ACCESS_SYMMETRIC (MP_IOCTL_ERROR_START + 4) 4358c4f8890Srs135747 #define MP_DRVR_PATH_UNAVAILABLE (MP_IOCTL_ERROR_START + 5) 4368c4f8890Srs135747 #define MP_DRVR_IDS_NOT_ASSOCIATED (MP_IOCTL_ERROR_START + 6) 4378c4f8890Srs135747 #define MP_DRVR_ILLEGAL_ACCESS_STATE_REQUEST (MP_IOCTL_ERROR_START + 7) 4383c70f4b3Scm136836 #define MP_DRVR_IO_ERROR (MP_IOCTL_ERROR_START + 8) 4398c4f8890Srs135747 4408c4f8890Srs135747 /* 4418c4f8890Srs135747 * Macros for OID operations 4428c4f8890Srs135747 */ 4438c4f8890Srs135747 #define MP_ID_SHIFT4MAJOR 32 4448c4f8890Srs135747 #define MP_GET_MAJOR_FROM_ID(id) ((id) >> MP_ID_SHIFT4MAJOR) 4458c4f8890Srs135747 #define MP_GET_INST_FROM_ID(id) ((id) & 0x00000000ffffffff) 4468c4f8890Srs135747 #define MP_STORE_INST_TO_ID(inst, id) (((uint64_t)(inst)) | id) 4478c4f8890Srs135747 #define MP_STORE_MAJOR_TO_ID(major, id) \ 4488c4f8890Srs135747 ((((uint64_t)(major)) << MP_ID_SHIFT4MAJOR) | id) 4498c4f8890Srs135747 4508c4f8890Srs135747 /* 4518c4f8890Srs135747 * Event Class and Sub-Class definitions 4528c4f8890Srs135747 */ 4538c4f8890Srs135747 #define EC_SUN_MP "EC_sun_mp" 4548c4f8890Srs135747 45517d71211SJiri Svoboda #define ESC_SUN_MP_PLUGIN_CHANGE "ESC_sun_mp_plugin_change" 45617d71211SJiri Svoboda 4578c4f8890Srs135747 #define ESC_SUN_MP_LU_CHANGE "ESC_sun_mp_lu_change" 45817d71211SJiri Svoboda #define ESC_SUN_MP_LU_ADD "ESC_sun_mp_lu_add" 45917d71211SJiri Svoboda #define ESC_SUN_MP_LU_REMOVE "ESC_sun_mp_lu_remove" 4608c4f8890Srs135747 4618c4f8890Srs135747 #define ESC_SUN_MP_PATH_CHANGE "ESC_sun_mp_path_change" 4628c4f8890Srs135747 #define ESC_SUN_MP_PATH_ADD "ESC_sun_mp_path_add" 4638c4f8890Srs135747 #define ESC_SUN_MP_PATH_REMOVE "ESC_sun_mp_path_remove" 4648c4f8890Srs135747 4658c4f8890Srs135747 #define ESC_SUN_MP_INIT_PORT_CHANGE "ESC_sun_mp_init_port_change" 4668c4f8890Srs135747 4678c4f8890Srs135747 #define ESC_SUN_MP_TPG_CHANGE "ESC_sun_mp_tpg_change" 4688c4f8890Srs135747 #define ESC_SUN_MP_TPG_ADD "ESC_sun_mp_tpg_add" 4698c4f8890Srs135747 #define ESC_SUN_MP_TPG_REMOVE "ESC_sun_mp_tpg_remove" 4708c4f8890Srs135747 4718c4f8890Srs135747 #define ESC_SUN_MP_TARGET_PORT_CHANGE "ESC_sun_mp_target_port_change" 4728c4f8890Srs135747 #define ESC_SUN_MP_TARGET_PORT_ADD "ESC_sun_mp_target_port_add" 4738c4f8890Srs135747 #define ESC_SUN_MP_TARGET_PORT_REMOVE "ESC_sun_mp_target_port_remove" 4748c4f8890Srs135747 4758c4f8890Srs135747 #define ESC_SUN_MP_DEV_PROD_CHANGE "ESC_sun_mp_dev_prod_change" 4768c4f8890Srs135747 #define ESC_SUN_MP_DEV_PROD_ADD "ESC_sun_mp_dev_prod_add" 4778c4f8890Srs135747 #define ESC_SUN_MP_DEV_PROD_REMOVE "ESC_sun_mp_dev_prod_remove" 4788c4f8890Srs135747 4798c4f8890Srs135747 #ifdef __cplusplus 4808c4f8890Srs135747 } 4818c4f8890Srs135747 #endif 4828c4f8890Srs135747 4838c4f8890Srs135747 #endif /* _SYS_SCSI_ADAPTERS_MPAPI_IMPL_H */ 484