#ifndef _FCTIO_H
#define _FCTIO_H
#ifdef __cplusplus
extern "C" {
#endif
#define FCT_IOCTL (((uint32_t)'F') << 24)
#define FCTIO_CMD (FCT_IOCTL | 2007)
#define FCTIO_SUB_CMD ('Z' << 8)
#define FCTIO_ADAPTER_LIST (FCTIO_SUB_CMD + 0x01)
#define FCTIO_GET_ADAPTER_ATTRIBUTES (FCTIO_SUB_CMD + 0x02)
#define FCTIO_GET_ADAPTER_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x03)
#define FCTIO_GET_DISCOVERED_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x04)
#define FCTIO_GET_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x05)
#define FCTIO_GET_ADAPTER_PORT_STATS (FCTIO_SUB_CMD + 0x06)
#define FCTIO_GET_LINK_STATUS (FCTIO_SUB_CMD + 0x07)
#define FCTIO_FORCE_LIP (FCTIO_SUB_CMD + 0x08)
#define FCTIO_XFER_NONE 0x00
#define FCTIO_XFER_READ 0x01
#define FCTIO_XFER_WRITE 0x02
#define FCTIO_XFER_RW (FCTIO_XFER_READ | FCTIO_XFER_WRITE)
typedef struct fctio {
uint16_t fctio_xfer;
uint16_t fctio_cmd;
uint16_t fctio_flags;
uint16_t fctio_cmd_flags;
uint32_t fctio_ilen;
uint32_t fctio_olen;
uint32_t fctio_alen;
uint32_t fctio_errno;
uint64_t fctio_ibuf;
uint64_t fctio_obuf;
uint64_t fctio_abuf;
} fctio_t;
#define FCT_HBA_LIST_VERSION 1
typedef struct fc_tgt_hba_list {
uint32_t version;
uint32_t numPorts;
uint8_t port_wwn[1][8];
} fc_tgt_hba_list_t;
#define FCT_HBA_ADAPTER_ATTRIBUTES_VERSION 1
typedef struct fc_tgt_hba_adapter_attributes {
uint32_t version;
uint32_t reserved_1;
char Manufacturer[64];
char SerialNumber[64];
char Model[256];
char ModelDescription[256];
uint8_t NodeWWN[8];
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_2;
} fc_tgt_hba_adapter_attributes_t;
#define FCT_HBA_PORT_ATTRIBUTES_VERSION 1
typedef struct fc_tgt_hba_port_attributes {
uint32_t version;
uint32_t reserved_1;
uint64_t lastChange;
uint8_t NodeWWN[8];
uint8_t PortWWN[8];
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;
uint32_t NumberofDiscoveredPorts;
uint8_t FabricName[8];
uint64_t reserved_2;
} fc_tgt_hba_port_attributes_t;
#define FCT_HBA_ADAPTER_PORT_STATS_VERSION 1
typedef struct fc_tgt_hba_adapter_port_stats {
uint32_t version;
uint32_t reserved_1;
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_2;
} fc_tgt_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
#define FC_HBA_PORTSPEED_UNKNOWN 0
#define FC_HBA_PORTSPEED_1GBIT 1
#define FC_HBA_PORTSPEED_2GBIT 2
#define FC_HBA_PORTSPEED_10GBIT 4
#define FC_HBA_PORTSPEED_4GBIT 8
#define FC_HBA_PORTSPEED_8GBIT 16
#define FC_HBA_PORTSPEED_16GBIT 32
#define FC_HBA_PORTSPEED_32GBIT 64
#define FC_HBA_PORTSPEED_NOT_NEGOTIATED (1<<15)
#define FCTIO_SUCCESS 0
#define FCTIO_FAILURE 1
#define FCTIO_BADWWN 2
#define FCTIO_MOREDATA 3
#define FCTIO_OUTOFBOUNDS 4
#define EC_SUNFC "EC_sunfc"
#define ESC_SUNFC_PORT_ATTACH "ESC_sunfc_port_attach"
#define ESC_SUNFC_PORT_DETACH "ESC_sunfc_port_detach"
#define ESC_SUNFC_PORT_ONLINE "ESC_sunfc_port_online"
#define ESC_SUNFC_PORT_OFFLINE "ESC_sunfc_port_offline"
#define ESC_SUNFC_PORT_RSCN "ESC_sunfc_port_rscn"
#define ESC_SUNFC_TARGET_ADD "ESC_sunfc_target_add"
#define ESC_SUNFC_TARGET_REMOVE "ESC_sunfc_target_remove"
#ifdef __cplusplus
}
#endif
#endif