emlxs_dfclib.h revision 93c20f2609342fd05f6625f16dfcb9348e7977f2
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Emulex. All rights reserved.
* Use is subject to License terms.
*/
#ifndef _EMLXS_DFCLIB_H
#define _EMLXS_DFCLIB_H
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_DFC_EVENTS 16
#define MAX_EMLXS_BRDS 128
#define MAX_CFG_PARAM 64
#define MAX_NODES 4096
#ifndef MAX_VPORTS
#ifdef NPIV_SUPPORT
#define MAX_VPORTS 256
#else
#define MAX_VPORTS 1
#endif /* NPIV_SUPPORT */
#endif /* MAX_VPORTS */
#ifdef EMLXS_SPARC /* BIG ENDIAN */
#define EMLXS_BIG_ENDIAN
#else /* LITTLE ENDIAN */
#define EMLXS_LITTLE_ENDIAN
#endif
typedef struct brdinfo {
} brdinfo_t;
typedef struct dfc_brdinfo {
typedef struct ulp_bde {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
} ulp_bde_t;
typedef struct ulp_bde64 {
union {
uint32_t w;
struct {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
/* buffer */
/* addr */
} f;
} tus;
} ulp_bde64_t;
typedef struct read_sparm_var {
union {
} un;
typedef struct read_rev_var {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
union {
struct {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
} b;
} un;
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
typedef struct dump_var {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
} dump_var_t;
typedef struct read_cfg_var {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
/* Defines for topology (defined previously) */
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
#define LMT_1GB_CAPABLE 0x0004
#define LMT_2GB_CAPABLE 0x0008
#define LMT_4GB_CAPABLE 0x0040
#define LMT_8GB_CAPABLE 0x0080
#define LMT_10GB_CAPABLE 0x0100
typedef struct read_log_var {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
typedef struct log_status_var {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
typedef struct read_evt_log_var {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
union {
} un;
typedef struct dfc_mailbox {
#ifdef EMLXS_BIG_ENDIAN
#endif
#ifdef EMLXS_LITTLE_ENDIAN
#endif
union {
} un;
typedef struct dfc_ioinfo {
} dfc_ioinfo_t;
typedef struct dfc_linkinfo {
/* values for a_topology */
#define LNK_LOOP 0x1
#define LNK_PUBLIC_LOOP 0x2
#define LNK_FABRIC 0x3
#define LNK_PT2PT 0x4
#define LNK_MENLO_MAINTENANCE 0x5
/* values for a_linkState */
#define LNK_DOWN 0x1
#define LNK_UP 0x2
#define LNK_FLOGI 0x3
#define LNK_DISCOVERY 0x4
#define LNK_REDISCOVERY 0x5
#define LNK_READY 0x6
typedef struct dfc_traceinfo {
typedef struct dfc_cfgparam {
char a_string[32];
/* user */
/* reboot */
/* restart */
char a_help[80];
typedef struct dfc_nodeinfo {
/* Defines for a_state */
#define NODE_UNUSED 0 /* unused NL_PORT entry */
/* Defines for a_flag */
typedef struct dfc_vpd {
#define DFC_VPD_VERSION 1
} dfc_vpd_t;
typedef struct dfc_destid {
} dfc_destid_t;
typedef struct dfc_loopback {
typedef struct dfc_drvinfo {
#define DFC_DRVINFO_VERSION2 0x02
#ifdef NPIV_SUPPORT
#endif /* NPIV_SUPPORT */
#ifdef DHCHAP_SUPPORT
#endif /* DHCHAP_SUPPORT */
/* Level */
#if (DFC_DRVINFO_VERSION >= DFC_DRVINFO_VERSION3)
#define DFC_DRVINFO_NPIV_DRV 0x00000001
#define DFC_DRVINFO_NPIV_MODS 0x00000002
#define DFC_DRVINFO_NPIV_PARMS 0x00000004
#define DFC_DRVINFO_NPIV_FW 0x00000008
#endif /* >= DFC_DRVINFO_VERSION3 */
#if (DFC_DRVINFO_VERSION >= DFC_DRVINFO_VERSION4)
#define DFC_DRVINFO_FEATURE_DIAG 0x00000001
#define DFC_DRVINFO_FEATURE_MAPPING 0x00000002
#define DFC_DRVINFO_FEATURE_DHCHAP 0x00000004
#define DFC_DRVINFO_FEATURE_IKE 0x00000008
#define DFC_DRVINFO_FEATURE_NPIV 0x00000010
#define DFC_DRVINFO_FEATURE_RESET_WWN 0x00000020
#define DFC_DRVINFO_FEATURE_VOLATILE_WWN 0x00000040
#define DFC_DRVINFO_FEATURE_E2E_AUTH 0x00000080
#endif /* >= DFC_DRVINFO_VERSION4 */
typedef struct dfc_regevent {
void *ctx;
void (*func) ();
/* state */
#define CHILD_UNKNOWN 0
#define CHILD_UNBORN 1
#define CHILD_ALIVE 2
#define CHILD_REGISTERED 3
#define CHILD_ASLEEP 4
#define CHILD_AWAKE 5
#define CHILD_DIED 6
/* flags */
#define EVENT_REGISTERED 0x01
#define EVENT_SERVICE_ACTIVE 0x02
/* Defines for RegisterForEvent mask */
/* events */
/* FCOE events */
#define MAX_RSCN_PAYLOAD 1024
/* Temperature event types */
#define DFC_TEMP_CRITICAL 1
#define DFC_TEMP_WARNING 2
#define DFC_TEMP_SAFE 3
/* bits in a_onmask */
/* bits in a_offmask */
/* state */
#define DDI_SHOW 0x0
#define DDI_ONDI 0x1
#define DDI_OFFDI 0x2
#define DDI_WARMDI 0x3
#define DDI_DIAGDI 0x4
/* mbxStatus */
#define DFC_MBX_SUCCESS 0x00
#define DFC_MBXERR_NUM_RINGS 0x01
#define DFC_MBXERR_NUM_IOCBS 0x02
#define DFC_MBXERR_IOCBS_EXCEEDED 0x03
#define DFC_MBXERR_BAD_RING_NUMBER 0x04
#define DFC_MBXERR_MASK_ENTRIES_RANGE 0x05
#define DFC_MBXERR_MASKS_EXCEEDED 0x06
#define DFC_MBXERR_BAD_PROFILE 0x07
#define DFC_MBXERR_BAD_DEF_CLASS 0x08
#define DFC_MBXERR_BAD_MAX_RESPONDER 0x09
#define DFC_MBXERR_BAD_MAX_ORIGINATOR 0x0A
#define DFC_MBXERR_RPI_REGISTERED 0x0B
#define DFC_MBXERR_RPI_FULL 0x0C
#define DFC_MBXERR_NO_RESOURCES 0x0D
#define DFC_MBXERR_BAD_RCV_LENGTH 0x0E
#define DFC_MBXERR_DMA_ERROR 0x0F
#define DFC_MBXERR_ERROR 0x10
#define DFC_MBXERR_OVERTEMP_ERROR 0xFA
#define DFC_MBXERR_HARDWARE_ERROR 0xFB
#define DFC_MBXERR_DRVR_ERROR 0xFC
#define DFC_MBXERR_BUSY 0xFD
#define DFC_MBXERR_TIMEOUT 0xFE
#define DFC_MBX_NOT_FINISHED 0xFF
/* Error codes for library calls */
#define DFC_ERR_GENERAL_ERROR 0x1
#define DFC_ERR_MBOX_ERROR 0x2
#define DFC_ERR_LINK_DOWN 0x2
#define DFC_ERR_INCORRECT_VER 0x2
#define DFC_ERR_INVALID_ID 0x2
#define DFC_ERR_TIMEOUT 0x2
#define DFC_ERR_NOT_SUPPORTED 0x2
#define DFC_ERR_NPIV_ACTIVE 0x2
#define DFC_ERR_NO_RPI 0x3
#define DFC_ERR_BUFFER_OVERFLOW 0x3
#define DFC_ERR_INVALID_LOOPBACK_TYPE 0x3
#define DFC_ERR_OVERTEMP 0x3
#define DFC_ERR_LOOPBACK_BUSY 0x4
#define DFC_ERR_INVALID_RESET_TYPE 0x4
#define DFC_ERR_MENLO_LINKDOWN 0x4
#define DFC_ERR_SEQ_TIMEOUT 0x5
#define DFC_ERR_NO_XMIT 0x6
#define DFC_ERR_INVALID_NUMBER 0x6
#define DFC_ERR_RESET_RECV 0x7
/* type definitions for GetBindList function */
typedef enum dfc_bindtype {
typedef struct dfc_bind_entry {
/* Bind Entry flags */
typedef struct dfc_bind_list {
/* Defines for error codes -OLD- */
#define FC_ERROR_BUFFER_OVERFLOW 0xff
#define FC_ERROR_RESPONSE_TIMEOUT 0xfe
#define FC_ERROR_LINK_UNAVAILABLE 0xfd
#define FC_ERROR_INSUFFICIENT_RESOURCES 0xfc
#define FC_ERROR_EXISTING_REGISTRATION 0xfb
#define FC_ERROR_INVALID_TAG 0xfa
#define FC_ERROR_INVALID_WWN 0xf9
#define FC_ERROR_CREATEVENT_FAILED 0xf8
typedef union dfc_ct_rev {
/* Structure is in Big Endian format */
struct {
} bits;
} dfc_ct_rev_t;
typedef union dfc_ct_resp {
/* Structure is in Big Endian format */
struct {
} bits;
typedef struct dfc_ct_request {
/* Structure is in Big Endian format */
/* Emulex Vendor-Unique CT Request Command Codes */
/* 0x0106 reserved */
/* 0x0115 reserved */
/* 0x0116 reserved */
/* 0x0131 reserved */
/* 0x0132 reserved */
/* re-read;sync */
/* Lun# */
/* (AutoPilotManager) */
/* (AutoPilotManager) */
/* Information [GDLM] */
#ifdef NPIV_SUPPORT
/* NPIV return codes */
#define DFC_NPIV_SUCCESS 0
#define DFC_NPIV_GENERAL_ERROR 1
#define DFC_NPIV_NOT_SUPPORTED 2
#define DFC_NPIV_NO_RESOURCES 3
#define DFC_NPIV_INVALID_HANDLE 3
#define DFC_NPIV_ILLEGAL_WWPN 4
#define DFC_NPIV_TOO_MANY_VPORTS 4
#define DFC_NPIV_ILLEGAL_WWN 5
#define DFC_NPIV_BUSY 5
#define DFC_NPIV_INVALID_WWN 6
#define DFC_NPIV_LINK_DOWN 7
#define DFC_NPIV_MORE_DATA 7
#define DFC_NPIV_FABRIC_NOT_SUPPORTED 8
#define DFC_NPIV_FABRIC_OUT_OF_RESOURCE 9
#define DFC_NPIV_INVALID_ACCESS_KEY 10
#define DFC_NPIV_INVALID_HANDLE_AT_CREATE 11
#define DFC_NPIV_UNSUPPORTED_OPTION 12
typedef struct dfc_vport_QoS {
/* VPORT type */
#define VPORT_TYPE_PHYSICAL 0
#define VPORT_TYPE_VIRTUAL 1
/* VPORT States */
#define VPORT_STATE_UNKNOWN 0
#define VPORT_STATE_LINKDOWN 1
#define VPORT_STATE_INIT 2
#define VPORT_STATE_NO_FABRIC_SUPPORT 3
#define VPORT_STATE_NO_FABRIC_RESOURCE 4
#define VPORT_STATE_FABRIC_LOGOUT 5
#define VPORT_STATE_FABRIC_REJECT_WWN 6
#define VPORT_STATE_FABRIC_LOGIN_FAIL 7
#define VPORT_STATE_ACTIVE 8
#define VPORT_STATE_AUTH_FAILED 9
/* VPORT Options */
#define VPORT_OPT_AUTORETRY 0x00000001
#define VPORT_OPT_AUTOWWN 0x00000002
#define VPORT_OPT_ACTIVATE 0x00000004
#define VPORT_OPT_SAVE_CREATE_ONLY 0x00000000
#define VPORT_OPT_SAVE_CREATE_UPDATE 0x00000010
#define VPORT_OPT_SAVE_UPDATE_ONLY 0x00000018
#define VPORT_OPT_SAVE_MASK 0x00000018
#define VPORT_OPT_RESTRICT 0x00000020
#define VPORT_OPT_UNRESTRICT 0x00000040
#define VPORT_OPT_RESTRICT_MASK 0x00000060
#define VPORT_OPT_FAILOVER 0x00000080
/* Check list bit-mapped value */
#define CL_NPIV_PARM_ENABLE 0x00000001
#define CL_SLI3_ENABLE 0x00000002
#define CL_HBA_SUPPORT_NPIV 0x00000004
#define CL_HBA_HAS_RESOURCES 0x00000008
#define CL_HBA_LINKUP 0x00000010
#define CL_P2P_TOPOLOGY 0x00000020
#define CL_FABRIC_SUPPORTS_NPIV 0x00000040
#define CL_FABRIC_HAS_RESOURCES 0x00000080
#define CL_NPIV_READY 0x000000FF
#define DFC_VPORT_ATTR_VERSION 2
typedef struct dfc_vport_attrs {
/* compatibility check */
/* successfully */
typedef struct dfc_vport_entry {
typedef struct dfc_vport_entry_list {
typedef struct dfc_vport_nodeinfo_entry {
#define VPORT_NODE_BINDDID 0x0000
#define VPORT_NODE_BINDWWNN 0x0001
#define VPORT_NODE_BINDWWPN 0x0002
#define VPORT_NODE_AUTOMAP 0x0004
#define VPORT_NODE_UNMASK_ALL_LUN 0x0008
#define VPORT_NODE_DISABLE_LUN_AUTOMAP 0x0010
#define VPORT_NODE_ALPA 0x0020
#define VPORT_NODESTATE_EXIST 0x0001
#define VPORT_NODESTATE_READY 0x0002
#define VPORT_NODESTATE_LINKDOWN 0x0004
#define VPORT_NODESTATE_UNMAPPED 0x0008
#define VPORT_NODESTATE_BOUND 0x0010
typedef struct dfc_vport_get_nodeinfo {
/* start of the dfc_vport_nodeinfo_entry_t array */
typedef struct dfc_vport_resource {
typedef struct dfc_vlinkinfo {
#define VPORT_FAIL_UNKNOWN 0
#define VPORT_FAIL_LINKDOWN 1
#define VPORT_FAIL_FAB_UNSUPPORTED 2
#define VPORT_FAIL_FAB_NORESOURCES 3
#define VPORT_FAIL_FAB_LOGOUT 4
#define VPORT_FAIL_HBA_NORESOURCES 5
void *vlink;
#endif /* NPIV_SUPPORT */
#ifdef DHCHAP_SUPPORT
/* DHCHAP return code */
#define DFC_AUTH_STATUS_NOT_CONFIGURED 0x8001
#define DFC_AUTH_STATUS_AUTH_FAILED_NO_SA_FOUND 0x8002
#define DFC_AUTH_STATUS_AUTH_INIT_OK_AUTH_FAILED 0x8003
#define DFC_AUTH_STATUS_COMPARE_FAILED 0x8004
#define DFC_AUTH_STATUS_WWN_NOT_FOUND 0x8005
#define DFC_AUTH_STATUS_PASSWORD_INVALID 0x8006
#define DFC_AUTH_STATUS_INVALID_ENTITY 0x8007
#define DFC_AUTH_STATUS_ENTITY_NOT_ACTIVE 0x8008
#define DFC_AUTH_STATUS_INVALID_OPERATION 0x8009
#define DFC_AUTH_STATUS_OUT_OF_RESOURCES 0x800a
#define DFC_AUTH_STATUS_AUTHENTICATION_GOINGON 0x800b
#define DFC_AUTH_STATUS_INVALID_BOARD_NO 0x800c
#define DFC_AUTH_STATUS_IO_ERROR 0x800d
#define DFC_AUTH_STATUS_CREATE_STORKEY_ERROR 0x800e
#define DFC_AUTH_STATUS_CREATE_PARMKEY_ERROR 0x800f
#define DFC_AUTH_STATUS_CREATE_AUTHKEY_ERROR 0x8010
#define DFC_AUTH_STATUS_CREATE_BORDKEY_ERROR 0x8020
#define DFC_AUTH_STATUS_DRVTYPE_NOT_SUPPORTED 0x8030
#define DFC_AUTH_STATUS_AUTHENTICATION_NOT_SUPPORTED 0x8031
#define DFC_AUTH_STATUS_GENERAL_ERROR 0x8032
#define DFC_AUTH_STATUS_CONFIG_NOT_FOUND 0x8034
#define DFC_AUTH_STATUS_NOT_PRIVILEGE_USER 0x8040
typedef struct dfc_fcsp_config {
#define DFC_AUTH_TOV_MIN 20
#define DFC_AUTH_TOV_MAX 1000
#define DFC_AUTH_TOV_DEFAULT 45
#define DFC_AUTH_MODE_DISABLED 1
#define DFC_AUTH_MODE_ACTIVE 2
#define DFC_AUTH_MODE_PASSIVE 3
#define DFC_AUTH_BIDIR_DISABLED 0
#define DFC_AUTH_BIDIR_ENABLED 1
#define DFC_AUTH_TYPE_FCAP 2
#define DFC_AUTH_TYPE_FCPAP 3
#define DFC_AUTH_TYPE_KERBEROS 4
#define DFC_AUTH_TYPE_MAX 4
#define DFC_AUTH_TYPE_DEFAULT1 0
#define DFC_AUTH_TYPE_DEFAULT2 0
#define DFC_AUTH_TYPE_DEFAULT3 0
#define DFC_AUTH_HASH_MD5 1
#define DFC_AUTH_HASH_SHA1 2
#define DFC_AUTH_HASH_MAX 2
#define DFC_AUTH_HASH_DEFAULT2 0
#define DFC_AUTH_HASH_DEFAULT3 0
#define DFC_AUTH_GROUP_NULL 1
#define DFC_AUTH_GROUP_1024 2
#define DFC_AUTH_GROUP_1280 3
#define DFC_AUTH_GROUP_1536 4
#define DFC_AUTH_GROUP_2048 5
#define DFC_AUTH_GROUP_MAX 5
#define DFC_AUTH_GROUP_DEFAULT5 0
#define DFC_AUTH_GROUP_DEFAULT6 0
#define DFC_AUTH_GROUP_DEFAULT7 0
#define DFC_REAUTH_TOV_MIN 0
#define DFC_REAUTH_TOV_MAX 7200
#define DFC_REAUTH_TOV_DEFAULT 1440
typedef struct dfc_password {
#define DFC_PASSWORD_LENGTH_MIN 8
#define DFC_PASSWORD_LENGTH_MAX 128
#define DFC_PASSWORD_TYPE_ASCII 1
#define DFC_PASSWORD_TYPE_BINARY 2
#define DFC_PASSWORD_TYPE_IGNORE 3
typedef struct dfc_auth_password {
typedef struct dfc_auth_cfglist {
typedef struct dfc_auth_status {
#define DFC_AUTH_STATE_OFF 1
#define DFC_AUTH_STATE_INP 2
#define DFC_AUTH_STATE_ON 3
#define DFC_AUTH_STATE_FAILED 4
#define DFC_AUTH_FAIL_GENERIC 1
#define DFC_AUTH_FAIL_ELS_TMO 2
#define DFC_AUTH_FAIL_XACT_TMO 3
#define DFC_AUTH_FAIL_LS_RJT 4
#define DFC_AUTH_FAIL_BSY_LS_RJT 5
#define DFC_AUTH_FAIL_REJECTED 6
#endif /* DHCHAP_SUPPORT */
/*
* Start of FCP specific structures
*/
#ifndef MAX_FCP_SNS
typedef struct emlxs_fcp_rsp {
#define SCSI_STAT_GOOD 0x00
#define SCSI_STAT_CHECK_COND 0x02
#define SCSI_STAT_COND_MET 0x04
#define SCSI_STAT_BUSY 0x08
#define SCSI_STAT_INTERMED 0x10
#define SCSI_STAT_INTERMED_CM 0x14
#define SCSI_STAT_RES_CNFLCT 0x18
#define SCSI_STAT_CMD_TERM 0x22
#define SCSI_STAT_QUE_FULL 0x28
#define SCSI_STAT_ACA_ACTIVE 0x30
#define SCSI_STAT_TASK_ABORT 0x40
/* fcpStatus2 */
/* Received in Big Endian format */
/* Received in Big Endian format */
/* Received in Big Endian format */
#define RSP_NO_FAILURE 0x00
#define RSP_DATA_BURST_ERR 0x01
#define RSP_CMD_FIELD_ERR 0x02
#define RSP_RO_MISMATCH_ERR 0x03
/*
* Define maximum size of SCSI Sense buffer. Seagate never issues
* more than 18 bytes of Sense data
*/
#define MAX_FCP_SNS 128
typedef emlxs_fcp_rsp FCP_RSP;
#endif /* MAX_FCP_SNS */
#ifndef FC_LUN_SHIFT
typedef struct emlxs_fcp_cmd {
/*
* # of bits to shift lun id to end up in right payload word, little
* endian = 8, big = 16.
*/
#ifdef EMLXS_LITTLE_ENDIAN
#define FC_LUN_SHIFT 8
#define FC_ADDR_MODE_SHIFT 0
#endif
#ifdef EMLXS_BIG_ENDIAN
#define FC_LUN_SHIFT 16
#define FC_ADDR_MODE_SHIFT 24
#endif
#define SIMPLE_Q 0x00
#define HEAD_OF_Q 0x01
#define ORDERED_Q 0x02
#define ACA_Q 0x04
#define UNTAGGED 0x05
typedef emlxs_fcp_cmd_t FCP_CMND;
#endif /* FC_LUN_SHIFT */
/*
* Used by libdfc (SendScsiCmd, SendFcpCmd, DFC_SendScsiCmdV2, DFC_SendFcpCmdV2
* and emlxs_dfc_send_scsi_fcp functions
*/
typedef struct dfc_send_scsi_fcp_cmd_info {
#define SCSI_RSP_CNT(x) x.cnt1
#define SCSI_SNS_CNT(x) x.cnt2
#define FC_DATA_CNT(x) x.cnt1
#define FC_RSP_CNT(x) x.cnt2
#define DFC_SEND_SCSI_FCP_V1 1
#define DFC_SEND_SCSI_FCP_V2 2
#ifdef __cplusplus
}
#endif
#endif /* _EMLXS_DFCLIB_H */