1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22c946facaSallan * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte #ifndef _FCTIO_H 26fcf3ce44SJohn Forte #define _FCTIO_H 27fcf3ce44SJohn Forte 28fcf3ce44SJohn Forte #ifdef __cplusplus 29fcf3ce44SJohn Forte extern "C" { 30fcf3ce44SJohn Forte #endif 31fcf3ce44SJohn Forte 32fcf3ce44SJohn Forte #define FCT_IOCTL (((uint32_t)'F') << 24) 33fcf3ce44SJohn Forte #define FCTIO_CMD (FCT_IOCTL | 2007) 34fcf3ce44SJohn Forte #define FCTIO_SUB_CMD ('Z' << 8) 35fcf3ce44SJohn Forte #define FCTIO_ADAPTER_LIST (FCTIO_SUB_CMD + 0x01) 36fcf3ce44SJohn Forte #define FCTIO_GET_ADAPTER_ATTRIBUTES (FCTIO_SUB_CMD + 0x02) 37fcf3ce44SJohn Forte #define FCTIO_GET_ADAPTER_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x03) 38fcf3ce44SJohn Forte #define FCTIO_GET_DISCOVERED_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x04) 39fcf3ce44SJohn Forte #define FCTIO_GET_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x05) 40fcf3ce44SJohn Forte #define FCTIO_GET_ADAPTER_PORT_STATS (FCTIO_SUB_CMD + 0x06) 41c946facaSallan #define FCTIO_GET_LINK_STATUS (FCTIO_SUB_CMD + 0x07) 42*a7949318SReed #define FCTIO_FORCE_LIP (FCTIO_SUB_CMD + 0x08) 43fcf3ce44SJohn Forte 44fcf3ce44SJohn Forte /* 45fcf3ce44SJohn Forte * fcio_xfer definitions 46fcf3ce44SJohn Forte */ 47fcf3ce44SJohn Forte #define FCTIO_XFER_NONE 0x00 48fcf3ce44SJohn Forte #define FCTIO_XFER_READ 0x01 49fcf3ce44SJohn Forte #define FCTIO_XFER_WRITE 0x02 50fcf3ce44SJohn Forte #define FCTIO_XFER_RW (FCTIO_XFER_READ | FCTIO_XFER_WRITE) 51fcf3ce44SJohn Forte 52fcf3ce44SJohn Forte typedef struct fctio { 53fcf3ce44SJohn Forte uint16_t fctio_xfer; /* direction */ 54fcf3ce44SJohn Forte uint16_t fctio_cmd; /* sub command */ 55fcf3ce44SJohn Forte uint16_t fctio_flags; /* flags */ 56fcf3ce44SJohn Forte uint16_t fctio_cmd_flags; /* command specific flags */ 57fcf3ce44SJohn Forte uint32_t fctio_ilen; /* Input buffer length */ 58fcf3ce44SJohn Forte uint32_t fctio_olen; /* Output buffer length */ 59fcf3ce44SJohn Forte uint32_t fctio_alen; /* Auxillary buffer length */ 60fcf3ce44SJohn Forte uint32_t fctio_errno; /* FC internal error code */ 61fcf3ce44SJohn Forte uint64_t fctio_ibuf; /* Input buffer */ 62fcf3ce44SJohn Forte uint64_t fctio_obuf; /* Output buffer */ 63fcf3ce44SJohn Forte uint64_t fctio_abuf; /* Auxillary buffer */ 64fcf3ce44SJohn Forte } fctio_t; 65fcf3ce44SJohn Forte 66fcf3ce44SJohn Forte #define FCT_HBA_LIST_VERSION 1 67fcf3ce44SJohn Forte typedef struct fc_tgt_hba_list { 68fcf3ce44SJohn Forte uint32_t version; 69fcf3ce44SJohn Forte uint32_t numPorts; 70fcf3ce44SJohn Forte uint8_t port_wwn[1][8]; 71fcf3ce44SJohn Forte } fc_tgt_hba_list_t; 72fcf3ce44SJohn Forte 73fcf3ce44SJohn Forte #define FCT_HBA_ADAPTER_ATTRIBUTES_VERSION 1 74fcf3ce44SJohn Forte typedef struct fc_tgt_hba_adapter_attributes { 75fcf3ce44SJohn Forte uint32_t version; /* Set to FC_HBA_ADAPTER_ATTRIBUTES_VERSION */ 76fcf3ce44SJohn Forte uint32_t reserved_1; 77fcf3ce44SJohn Forte char Manufacturer[64]; 78fcf3ce44SJohn Forte char SerialNumber[64]; 79fcf3ce44SJohn Forte char Model[256]; 80fcf3ce44SJohn Forte char ModelDescription[256]; 81fcf3ce44SJohn Forte uint8_t NodeWWN[8]; 82fcf3ce44SJohn Forte char NodeSymbolicName[256]; 83fcf3ce44SJohn Forte char HardwareVersion[256]; 84fcf3ce44SJohn Forte char DriverVersion[256]; 85fcf3ce44SJohn Forte char OptionROMVersion[256]; 86fcf3ce44SJohn Forte char FirmwareVersion[256]; 87fcf3ce44SJohn Forte uint32_t VendorSpecificID; 88fcf3ce44SJohn Forte uint32_t NumberOfPorts; 89fcf3ce44SJohn Forte char DriverName[256]; 90fcf3ce44SJohn Forte uint64_t reserved_2; 91fcf3ce44SJohn Forte } fc_tgt_hba_adapter_attributes_t; 92fcf3ce44SJohn Forte 93fcf3ce44SJohn Forte #define FCT_HBA_PORT_ATTRIBUTES_VERSION 1 94fcf3ce44SJohn Forte typedef struct fc_tgt_hba_port_attributes { 95fcf3ce44SJohn Forte uint32_t version; /* FC_HBA_PORT_ATTRIBUTES_VERSION */ 96fcf3ce44SJohn Forte uint32_t reserved_1; 97fcf3ce44SJohn Forte uint64_t lastChange; 98fcf3ce44SJohn Forte uint8_t NodeWWN[8]; 99fcf3ce44SJohn Forte uint8_t PortWWN[8]; 100fcf3ce44SJohn Forte uint32_t PortFcId; 101fcf3ce44SJohn Forte uint32_t PortType; 102fcf3ce44SJohn Forte uint32_t PortState; 103fcf3ce44SJohn Forte uint32_t PortSupportedClassofService; 104fcf3ce44SJohn Forte uint8_t PortSupportedFc4Types[32]; 105fcf3ce44SJohn Forte uint8_t PortActiveFc4Types[32]; 106fcf3ce44SJohn Forte char PortSymbolicName[256]; 107fcf3ce44SJohn Forte uint32_t PortSupportedSpeed; 108fcf3ce44SJohn Forte uint32_t PortSpeed; 109fcf3ce44SJohn Forte uint32_t PortMaxFrameSize; 110fcf3ce44SJohn Forte uint32_t NumberofDiscoveredPorts; 111fcf3ce44SJohn Forte uint8_t FabricName[8]; 112fcf3ce44SJohn Forte uint64_t reserved_2; 113fcf3ce44SJohn Forte } fc_tgt_hba_port_attributes_t; 114fcf3ce44SJohn Forte 115fcf3ce44SJohn Forte #define FCT_HBA_ADAPTER_PORT_STATS_VERSION 1 116fcf3ce44SJohn Forte typedef struct fc_tgt_hba_adapter_port_stats { 117fcf3ce44SJohn Forte uint32_t version; /* FC_HBA_ADAPTER_PORT_STATS_VERSION */ 118fcf3ce44SJohn Forte uint32_t reserved_1; 119fcf3ce44SJohn Forte uint64_t SecondsSinceLastReset; 120fcf3ce44SJohn Forte uint64_t TxFrames; 121fcf3ce44SJohn Forte uint64_t TxWords; 122fcf3ce44SJohn Forte uint64_t RxFrames; 123fcf3ce44SJohn Forte uint64_t RxWords; 124fcf3ce44SJohn Forte uint64_t LIPCount; 125fcf3ce44SJohn Forte uint64_t NOSCount; 126fcf3ce44SJohn Forte uint64_t ErrorFrames; 127fcf3ce44SJohn Forte uint64_t DumpedFrames; 128fcf3ce44SJohn Forte uint64_t LinkFailureCount; 129fcf3ce44SJohn Forte uint64_t LossOfSyncCount; 130fcf3ce44SJohn Forte uint64_t LossOfSignalCount; 131fcf3ce44SJohn Forte uint64_t PrimitiveSeqProtocolErrCount; 132fcf3ce44SJohn Forte uint64_t InvalidTxWordCount; 133fcf3ce44SJohn Forte uint64_t InvalidCRCCount; 134fcf3ce44SJohn Forte uint64_t reserved_2; 135fcf3ce44SJohn Forte } fc_tgt_hba_adapter_port_stats_t; 136fcf3ce44SJohn Forte 137fcf3ce44SJohn Forte /* 138fcf3ce44SJohn Forte * Constant values derived from T11 FC-HBA 139fcf3ce44SJohn Forte */ 140fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_UNKNOWN 1 /* Unknown */ 141fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_OTHER 2 /* Other */ 142fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_NOTPRESENT 3 /* Not present */ 143fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_NPORT 5 /* Fabric */ 144fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_NLPORT 6 /* Public Loop */ 145fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_FLPORT 7 146fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_FPORT 8 /* Fabric Port */ 147fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_EPORT 9 /* Fabric expansion port */ 148fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_GPORT 10 /* Generic Fabric Port */ 149fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_LPORT 20 /* Private Loop */ 150fcf3ce44SJohn Forte #define FC_HBA_PORTTYPE_PTP 21 /* Point to Point */ 151fcf3ce44SJohn Forte 152fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_UNKNOWN 1 /* Unknown */ 153fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_ONLINE 2 /* Operational */ 154fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_OFFLINE 3 /* User Offline */ 155fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_BYPASSED 4 /* Bypassed */ 156fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_DIAGNOSTICS 5 /* In diagnostics mode */ 157fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_LINKDOWN 6 /* Link Down */ 158fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_ERROR 7 /* Port Error */ 159fcf3ce44SJohn Forte #define FC_HBA_PORTSTATE_LOOPBACK 8 /* Loopback */ 160fcf3ce44SJohn Forte 161fcf3ce44SJohn Forte /* 162fcf3ce44SJohn Forte * HBA/Port attributes tracked for the T11 FC-HBA specification 163fcf3ce44SJohn Forte */ 164fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver */ 165fcf3ce44SJohn Forte /* incable of reporting */ 166fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */ 167fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */ 168fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */ 169fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */ 170fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */ 171fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_16GBIT 32 /* 16 GBit/sec */ 172fcf3ce44SJohn Forte #define FC_HBA_PORTSPEED_NOT_NEGOTIATED (1<<15) /* Speed not established */ 173fcf3ce44SJohn Forte 174fcf3ce44SJohn Forte #define FCTIO_SUCCESS 0 175fcf3ce44SJohn Forte #define FCTIO_FAILURE 1 176fcf3ce44SJohn Forte #define FCTIO_BADWWN 2 177fcf3ce44SJohn Forte #define FCTIO_MOREDATA 3 178fcf3ce44SJohn Forte #define FCTIO_OUTOFBOUNDS 4 179fcf3ce44SJohn Forte 180fcf3ce44SJohn Forte /* Sysevent defs */ 181fcf3ce44SJohn Forte #define EC_SUNFC "EC_sunfc" 182fcf3ce44SJohn Forte #define ESC_SUNFC_PORT_ATTACH "ESC_sunfc_port_attach" 183fcf3ce44SJohn Forte #define ESC_SUNFC_PORT_DETACH "ESC_sunfc_port_detach" 184fcf3ce44SJohn Forte #define ESC_SUNFC_PORT_ONLINE "ESC_sunfc_port_online" 185fcf3ce44SJohn Forte #define ESC_SUNFC_PORT_OFFLINE "ESC_sunfc_port_offline" 186fcf3ce44SJohn Forte #define ESC_SUNFC_PORT_RSCN "ESC_sunfc_port_rscn" 187fcf3ce44SJohn Forte #define ESC_SUNFC_TARGET_ADD "ESC_sunfc_target_add" 188fcf3ce44SJohn Forte #define ESC_SUNFC_TARGET_REMOVE "ESC_sunfc_target_remove" 189fcf3ce44SJohn Forte 190fcf3ce44SJohn Forte #ifdef __cplusplus 191fcf3ce44SJohn Forte } 192fcf3ce44SJohn Forte #endif 193fcf3ce44SJohn Forte 194fcf3ce44SJohn Forte #endif /* _FCTIO_H */ 195