#ifndef _FCIO_H
#define _FCIO_H
#include <sys/note.h>
#include <sys/fibre-channel/fc_types.h>
#include <sys/fibre-channel/fc_appif.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FCTIO ('F'<< 8)
#define FCIO_CMD (FCTIO | 1998)
#define FCIO_SUB_CMD ('Z' << 8)
#define FCIO_GET_NUM_DEVS (FCIO_SUB_CMD + 0x01)
#define FCIO_GET_DEV_LIST (FCIO_SUB_CMD + 0x02)
#define FCIO_GET_SYM_PNAME (FCIO_SUB_CMD + 0x03)
#define FCIO_GET_SYM_NNAME (FCIO_SUB_CMD + 0x04)
#define FCIO_SET_SYM_PNAME (FCIO_SUB_CMD + 0x05)
#define FCIO_SET_SYM_NNAME (FCIO_SUB_CMD + 0x06)
#define FCIO_GET_LOGI_PARAMS (FCIO_SUB_CMD + 0x07)
#define FCIO_DEV_LOGIN (FCIO_SUB_CMD + 0x08)
#define FCIO_DEV_LOGOUT (FCIO_SUB_CMD + 0x09)
#define FCIO_GET_STATE (FCIO_SUB_CMD + 0x0A)
#define FCIO_DEV_REMOVE (FCIO_SUB_CMD + 0x0B)
#define FCIO_GET_FCODE_REV (FCIO_SUB_CMD + 0x0C)
#define FCIO_GET_FW_REV (FCIO_SUB_CMD + 0x0D)
#define FCIO_GET_DUMP_SIZE (FCIO_SUB_CMD + 0x0E)
#define FCIO_FORCE_DUMP (FCIO_SUB_CMD + 0x0F)
#define FCIO_GET_DUMP (FCIO_SUB_CMD + 0x10)
#define FCIO_GET_TOPOLOGY (FCIO_SUB_CMD + 0x11)
#define FCIO_RESET_LINK (FCIO_SUB_CMD + 0x12)
#define FCIO_RESET_HARD (FCIO_SUB_CMD + 0x13)
#define FCIO_RESET_HARD_CORE (FCIO_SUB_CMD + 0x14)
#define FCIO_DIAG (FCIO_SUB_CMD + 0x15)
#define FCIO_NS (FCIO_SUB_CMD + 0x16)
#define FCIO_DOWNLOAD_FW (FCIO_SUB_CMD + 0x17)
#define FCIO_GET_HOST_PARAMS (FCIO_SUB_CMD + 0x18)
#define FCIO_LINK_STATUS (FCIO_SUB_CMD + 0x19)
#define FCIO_DOWNLOAD_FCODE (FCIO_SUB_CMD + 0x1A)
#define FCIO_GET_NODE_ID (FCIO_SUB_CMD + 0x1B)
#define FCIO_SET_NODE_ID (FCIO_SUB_CMD + 0x1C)
#define FCIO_SEND_NODE_ID (FCIO_SUB_CMD + 0x1D)
#define FCIO_GET_ADAPTER_ATTRIBUTES (FCIO_SUB_CMD + 0x1E)
#define FCIO_GET_OTHER_ADAPTER_PORTS (FCIO_SUB_CMD + 0x1F)
#define FCIO_GET_ADAPTER_PORT_ATTRIBUTES (FCIO_SUB_CMD + 0x20)
#define FCIO_GET_DISCOVERED_PORT_ATTRIBUTES (FCIO_SUB_CMD + 0x21)
#define FCIO_GET_PORT_ATTRIBUTES (FCIO_SUB_CMD + 0x22)
#define FCIO_GET_ADAPTER_PORT_STATS (FCIO_SUB_CMD + 0x23)
#define FCIO_GET_ADAPTER_PORT_NPIV_ATTRIBUTES (FCIO_SUB_CMD + 0x24)
#define FCIO_CREATE_NPIV_PORT (FCIO_SUB_CMD + 0x25)
#define FCIO_GET_NPIV_ATTRIBUTES (FCIO_SUB_CMD + 0x26)
#define FCIO_GET_DISCOVERED_NPIV_ATTRIBUTES (FCIO_SUB_CMD + 0x27)
#define FCIO_GET_NPIV_PORT_LIST (FCIO_SUB_CMD + 0x28)
#define FCIO_DELETE_NPIV_PORT (FCIO_SUB_CMD + 0x29)
#define FCIO_NPIV_GET_ADAPTER_ATTRIBUTES (FCIO_SUB_CMD + 0x2a)
#define FCIO_DIAG_PORT_DISABLE (FCIO_SUB_CMD + 0x80)
#define FCIO_DIAG_PORT_ENABLE (FCIO_SUB_CMD + 0x81)
#define FCIO_CFLAGS_RLS_DEST_NPORT 0x0000
#define FCIO_CFLAGS_RLS_DEST_FPORT 0x0001
typedef struct fc_port_dev {
uchar_t dev_dtype;
uint32_t dev_type[8];
uint32_t dev_state;
fc_portid_t dev_did;
fc_hardaddr_t dev_hard_addr;
la_wwn_t dev_pwwn;
la_wwn_t dev_nwwn;
} fc_port_dev_t;
#if defined(_SYSCALL32)
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack(4)
#endif
typedef struct fc_port_dev32 {
uchar_t dev_dtype;
uint32_t dev_type[8];
uint32_t dev_state;
fc_portid_t dev_did;
fc_hardaddr_t dev_hard_addr;
la_wwn_t dev_pwwn;
la_wwn_t dev_nwwn;
} fc_port_dev32_t;
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack()
#endif
#endif
typedef struct fc_port_dev fc_ns_map_entry_t;
#define FCIO_XFER_NONE 0x00
#define FCIO_XFER_READ 0x01
#define FCIO_XFER_WRITE 0x02
#define FCIO_XFER_RW (FCIO_XFER_READ | FCIO_XFER_WRITE)
typedef struct fcio {
uint16_t fcio_xfer;
uint16_t fcio_cmd;
uint16_t fcio_flags;
uint16_t fcio_cmd_flags;
size_t fcio_ilen;
caddr_t fcio_ibuf;
size_t fcio_olen;
caddr_t fcio_obuf;
size_t fcio_alen;
caddr_t fcio_abuf;
int fcio_errno;
} fcio_t;
#define FC_HBA_LIST_VERSION 1
typedef struct fc_hba_list {
uint32_t version;
uint32_t numAdapters;
uint64_t reserved;
char hbaPaths[1][MAXPATHLEN];
} fc_hba_list_t;
#define FC_HBA_NPIV_PORT_LIST_VERSION 1
typedef struct fc_hba_npiv_port_list {
uint32_t version;
uint32_t numAdapters;
uint64_t reserved;
char hbaPaths[1][MAXPATHLEN];
} fc_hba_npiv_port_list_t;
#define FC_HBA_NPIV_ATTRIBUTES_VERSION 1
typedef struct fc_hba_npiv_attributes {
uint32_t version;
la_wwn_t NodeWWN;
la_wwn_t PortWWN;
fc_hba_state_change_t lastChange;
} fc_hba_npiv_attributes_t;
#define FC_HBA_PORT_NPIV_ATTRIBUTES_VERSION 1
typedef struct fc_hba_port_npiv_attributes {
uint32_t version;
int npivflag;
fc_hba_state_change_t lastChange;
la_wwn_t NodeWWN;
la_wwn_t PortWWN;
uint32_t MaxNumberOfNPIVPorts;
uint32_t NumberOfNPIVPorts;
} fc_hba_port_npiv_attributes_t;
#define FC_HBA_SINGLE_VERSION 1
typedef struct fc_hba_single {
uint32_t version;
uint64_t reserved;
char hbaPath[MAXPATHLEN];
} fc_hba_single_t;
#define FC_HBA_ADAPTER_ATTRIBUTES_VERSION 1
typedef struct fc_hba_adapter_attributes {
uint32_t version;
char Manufacturer[64];
char SerialNumber[64];
char Model[256];
char ModelDescription[256];
la_wwn_t NodeWWN;
char NodeSymbolicName[256];
char HardwareVersion[256];
char DriverVersion[256];
char OptionROMVersion[256];
char FirmwareVersion[256];
uint32_t VendorSpecificID;
uint32_t NumberOfPorts;
char DriverName[256];
uint64_t reserved;
} fc_hba_adapter_attributes_t;
#if defined(_SYSCALL32)
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack(4)
#endif
typedef struct fc_hba_adapter_attributes32 {
uint32_t version;
char Manufacturer[64];
char SerialNumber[64];
char Model[256];
char ModelDescription[256];
la_wwn_t NodeWWN;
char NodeSymbolicName[256];
char HardwareVersion[256];
char DriverVersion[256];
char OptionROMVersion[256];
char FirmwareVersion[256];
uint32_t VendorSpecificID;
uint32_t NumberOfPorts;
char DriverName[256];
uint64_t reserved;
} fc_hba_adapter_attributes32_t;
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack()
#endif
#endif
#define FC_HBA_PORT_ATTRIBUTES_VERSION 1
typedef struct fc_hba_port_attributes {
uint32_t version;
fc_hba_state_change_t lastChange;
minor_t fp_minor;
la_wwn_t NodeWWN;
la_wwn_t PortWWN;
uint32_t PortFcId;
uint32_t PortType;
uint32_t PortState;
uint32_t PortSupportedClassofService;
uint8_t PortSupportedFc4Types[32];
uint8_t PortActiveFc4Types[32];
char PortSymbolicName[256];
uint32_t PortSupportedSpeed;
uint32_t PortSpeed;
uint32_t PortMaxFrameSize;
la_wwn_t FabricName;
uint32_t NumberofDiscoveredPorts;
uint64_t reserved;
} fc_hba_port_attributes_t;
#if defined(_SYSCALL32)
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack(4)
#endif
typedef struct fc_hba_port_attributes32 {
uint32_t version;
fc_hba_state_change_t lastChange;
minor_t fp_minor;
la_wwn_t NodeWWN;
la_wwn_t PortWWN;
uint32_t PortFcId;
uint32_t PortType;
uint32_t PortState;
uint32_t PortSupportedClassofService;
uint8_t PortSupportedFc4Types[32];
uint8_t PortActiveFc4Types[32];
char PortSymbolicName[256];
uint32_t PortSupportedSpeed;
uint32_t PortSpeed;
uint32_t PortMaxFrameSize;
la_wwn_t FabricName;
uint32_t NumberofDiscoveredPorts;
uint64_t reserved;
} fc_hba_port_attributes32_t;
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
#pragma pack()
#endif
#endif
#define FC_HBA_ADAPTER_PORT_STATS_VERSION 1
typedef struct fc_hba_adapter_port_stats {
uint32_t version;
uint64_t SecondsSinceLastReset;
uint64_t TxFrames;
uint64_t TxWords;
uint64_t RxFrames;
uint64_t RxWords;
uint64_t LIPCount;
uint64_t NOSCount;
uint64_t ErrorFrames;
uint64_t DumpedFrames;
uint64_t LinkFailureCount;
uint64_t LossOfSyncCount;
uint64_t LossOfSignalCount;
uint64_t PrimitiveSeqProtocolErrCount;
uint64_t InvalidTxWordCount;
uint64_t InvalidCRCCount;
uint64_t reserved;
} fc_hba_adapter_port_stats_t;
#define FC_HBA_PORTTYPE_UNKNOWN 1
#define FC_HBA_PORTTYPE_OTHER 2
#define FC_HBA_PORTTYPE_NOTPRESENT 3
#define FC_HBA_PORTTYPE_NPORT 5
#define FC_HBA_PORTTYPE_NLPORT 6
#define FC_HBA_PORTTYPE_FLPORT 7
#define FC_HBA_PORTTYPE_FPORT 8
#define FC_HBA_PORTTYPE_EPORT 9
#define FC_HBA_PORTTYPE_GPORT 10
#define FC_HBA_PORTTYPE_LPORT 20
#define FC_HBA_PORTTYPE_PTP 21
#define FC_HBA_PORTSTATE_UNKNOWN 1
#define FC_HBA_PORTSTATE_ONLINE 2
#define FC_HBA_PORTSTATE_OFFLINE 3
#define FC_HBA_PORTSTATE_BYPASSED 4
#define FC_HBA_PORTSTATE_DIAGNOSTICS 5
#define FC_HBA_PORTSTATE_LINKDOWN 6
#define FC_HBA_PORTSTATE_ERROR 7
#define FC_HBA_PORTSTATE_LOOPBACK 8
#if defined(_SYSCALL32)
struct fcio32 {
uint16_t fcio_xfer;
uint16_t fcio_cmd;
uint16_t fcio_flags;
uint16_t fcio_cmd_flags;
size32_t fcio_ilen;
caddr32_t fcio_ibuf;
size32_t fcio_olen;
caddr32_t fcio_obuf;
size32_t fcio_alen;
caddr32_t fcio_abuf;
int fcio_errno;
};
#if !defined(__lint)
_NOTE(SCHEME_PROTECTS_DATA("unique per request", fcio32))
#endif
#endif
#if !defined(__lint)
_NOTE(SCHEME_PROTECTS_DATA("unique per request", fcio fc_port_dev))
#endif
#ifdef __cplusplus
}
#endif
#endif