1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 23 /* 24 * Copyright (c) 1998-1999 by Sun Microsystems, Inc. 25 * All rights reserved. 26 */ 27 28 #ifndef _SYS_FC4_FCIO_H 29 #define _SYS_FC4_FCIO_H 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 33 /* 34 * Include any headers you depend on. 35 */ 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 #include <sys/fc4/fcal_linkapp.h> 42 43 /* 44 * ioctl definitions 45 */ 46 #define FIOC ('F'<<8) 47 #define SF_IOC (0xda << 8) 48 #define SFIOCGMAP (SF_IOC|1) /* Get device map */ 49 #define SF_NUM_ENTRIES_IN_MAP 127 50 51 #define FCIO_GETMAP (FIOC|175) /* Get limited map */ 52 #define FCIO_FORCE_LIP (FIOC|177) /* Force LIP */ 53 #define FCIO_LINKSTATUS (FIOC|183) /* Get link status */ 54 #define FCIO_FCODE_MCODE_VERSION (FIOC|202) /* Get code versions */ 55 56 #define IFPIOCGMAP SFIOCGMAP 57 #define IFP_NUM_ENTRIES_IN_MAP SF_NUM_ENTRIES_IN_MAP 58 #define IFPIO_FORCE_LIP FCIO_FORCE_LIP 59 #define IFPIO_LINKSTATUS FCIO_LINKSTATUS 60 61 typedef struct sf_al_addr_pair { 62 uchar_t sf_al_pa; 63 uchar_t sf_hard_address; 64 uchar_t sf_inq_dtype; 65 uchar_t sf_node_wwn[FC_WWN_SIZE]; 66 uchar_t sf_port_wwn[FC_WWN_SIZE]; 67 } sf_al_addr_pair_t; 68 69 typedef struct sf_al_map { 70 short sf_count; 71 sf_al_addr_pair_t sf_addr_pair[SF_NUM_ENTRIES_IN_MAP]; 72 sf_al_addr_pair_t sf_hba_addr; 73 } sf_al_map_t; 74 75 76 77 struct rls_payload { 78 uint_t rls_portno; 79 uint_t rls_linkfail; 80 uint_t rls_syncfail; 81 uint_t rls_sigfail; 82 uint_t rls_primitiverr; 83 uint_t rls_invalidword; 84 uint_t rls_invalidcrc; 85 }; 86 87 struct lilpmap { 88 ushort_t lilp_magic; 89 ushort_t lilp_myalpa; 90 uchar_t lilp_length; 91 uchar_t lilp_list[127]; 92 }; 93 94 95 struct socal_fm_version { 96 uint_t fcode_ver_len; 97 uint_t mcode_ver_len; 98 uint_t prom_ver_len; 99 char *fcode_ver; 100 char *mcode_ver; 101 char *prom_ver; 102 }; 103 104 /* 105 * kstat structures 106 */ 107 typedef struct sf_target_stats { 108 uint_t els_failures; /* failures on PLOGI, PRLI, ADISC etc */ 109 uint_t timeouts; 110 /* 111 * sf detected command timeouts, 112 * implies an ABTS 113 */ 114 uint_t abts_failures; /* ABTS failures */ 115 uint_t task_mgmt_failures; 116 /* 117 * SF task management(aborts, 118 * resets etc) failures 119 */ 120 uint_t data_ro_mismatches; /* SF_DATA RO mismatches */ 121 uint_t dl_len_mismatches; 122 /* 123 * SF_DATA length different from 124 * BURST_LEN 125 */ 126 uint_t logouts_recvd; 127 /* 128 * unsolicited LOGOs recvd from 129 * target 130 */ 131 } sf_target_stats_t; 132 133 typedef struct sf_stats { 134 uint_t version; /* version of this struct, >1 */ 135 uint_t lip_count; /* lips forced by sf */ 136 uint_t lip_failures; 137 /* 138 * lip failures, ie, no ONLINE response 139 * after forcing lip 140 */ 141 uint_t cralloc_failures; 142 /* 143 * command/response block allocation 144 * failures 145 */ 146 uint_t ncmds; /* outstanding commands */ 147 uint_t throttle_limit; /* current throttle limit */ 148 uint_t cr_pool_size; 149 /* 150 * num of chunks in command/response 151 * pool, each chunk allows 128 packets 152 */ 153 struct sf_target_stats tstats[127]; /* per target stats */ 154 char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */ 155 } sf_stats_t; 156 157 158 /* SOCAL Host Adapter kstat structures. */ 159 #define FC_STATUS_ENTRIES 256 160 struct fc_pstats { 161 uint_t port; /* which port 0 or 1 */ 162 uint_t requests; /* requests issued by this soc+ */ 163 uint_t sol_resps; /* solicited responses received */ 164 uint_t unsol_resps; /* unsolicited responses received */ 165 uint_t lips; /* forced loop initialization */ 166 uint_t els_sent; /* extended link service commands issued */ 167 uint_t els_rcvd; /* extended link service commands received */ 168 uint_t abts; /* aborts attempted */ 169 uint_t abts_ok; /* aborts successful */ 170 uint_t offlines; /* changes to offline state */ 171 uint_t onlines; /* changes to online state */ 172 uint_t online_loops; /* changes to online-loop state */ 173 uint_t resp_status[FC_STATUS_ENTRIES]; /* response status */ 174 }; 175 176 /* 177 * Fibre Channel Response codes 178 */ 179 #define FCAL_STATUS_OK 0 180 #define FCAL_STATUS_P_RJT 2 181 #define FCAL_STATUS_F_RJT 3 182 #define FCAL_STATUS_P_BSY 4 183 #define FCAL_STATUS_F_BSY 5 184 #define FCAL_STATUS_ONLINE 0x10 185 #define FCAL_STATUS_OLDPORT_ONLINE FCAL_STATUS_ONLINE 186 #define FCAL_STATUS_ERR_OFFLINE 0x11 187 #define FCAL_STATUS_TIMEOUT 0x12 188 #define FCAL_STATUS_ERR_OVERRUN 0x13 189 #define FCAL_STATUS_LOOP_ONLINE 0x14 190 #define FCAL_STATUS_OLD_PORT 0x15 191 #define FCAL_STATUS_AL_PORT 0x16 192 #define FCAL_STATUS_UNKNOWN_CQ_TYPE 0x20 /* unknown request type */ 193 #define FCAL_STATUS_BAD_SEG_CNT 0x21 /* insufficient # of segments */ 194 #define FCAL_STATUS_MAX_XCHG_EXCEEDED 0x22 195 #define FCAL_STATUS_BAD_XID 0x23 196 #define FCAL_STATUS_XCHG_BUSY 0x24 197 #define FCAL_STATUS_BAD_POOL_ID 0x25 198 #define FCAL_STATUS_INSUFFICIENT_CQES 0x26 199 #define FCAL_STATUS_ALLOC_FAIL 0x27 200 #define FCAL_STATUS_BAD_SID 0x28 201 #define FCAL_STATUS_NO_SEQ_INIT 0x29 202 #define FCAL_STATUS_BAD_DID 0x2a 203 #define FCAL_STATUS_ABORTED 0x30 204 #define FCAL_STATUS_ABORT_FAILED 0x31 205 #define FCAL_STATUS_DIAG_BUSY 0x32 206 #define FCAL_STATUS_DIAG_INVALID 0x33 207 #define FCAL_STATUS_INCOMPLETE_DMA_ERR 0x34 208 #define FCAL_STATUS_CRC_ERR 0x35 209 #define FCAL_STATUS_OPEN_FAIL 0x36 210 #define FCAL_STATUS_ERROR 0x80 211 #define FCAL_STATUS_ONLINE_TIMEOUT 0x81 212 #define FCAL_STATUS_MAX_STATUS FCAL_STATUS_CRC_ERR 213 214 typedef struct socal_stats { 215 uint_t version; /* version of this struct, >1 */ 216 uint_t resets; /* chip resets */ 217 uint_t reqq_intrs; /* request queue interrupts */ 218 uint_t qfulls; /* request queue full encountered */ 219 struct fc_pstats pstats[2]; /* per port kstats */ 220 char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */ 221 char fw_revision[MAXNAMELEN]; /* Firmware date string.\0 */ 222 char node_wwn[17]; /* Node WWN */ 223 char port_wwn[2][17]; /* Port WWN \0 */ 224 uint_t parity_chk_enabled; /* != 0 if HBA checks parity. */ 225 } socal_stats_t; 226 227 228 struct ifp_target_stats { 229 int logouts_recvd; 230 /* 231 * unsolicited LOGOs recvd from 232 * target 233 */ 234 int task_mgmt_failures; 235 int data_ro_mismatches; 236 int dl_len_mismatches; 237 }; 238 typedef struct ifp_target_stats ifp_target_stats_t; 239 240 struct ifp_stats { 241 int version; /* version of this struct, >1 */ 242 int lip_count; /* lips forced by ifp */ 243 int ncmds; /* outstanding commands */ 244 ifp_target_stats_t tstats[127]; /* per target stats */ 245 char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */ 246 char fw_revision[MAXNAMELEN]; /* Firmware date string.\0 */ 247 char node_wwn[17]; /* Node WWN */ 248 char port_wwn[17]; /* Port WWN \0 */ 249 uint_t parity_chk_enabled; /* != 0 if HBA checks parity. */ 250 uint_t resp_status[FC_STATUS_ENTRIES]; /* response status */ 251 }; 252 typedef struct ifp_stats ifp_stats_t; 253 254 /* 255 * Defines for the QLA21xx resp_status -- this is the command completion status 256 */ 257 #define IFP_CMD_CMPLT 0x00 /* no transport errors */ 258 #define IFP_CMD_INCOMPLETE 0x01 /* abnormal transport state */ 259 #define IFP_CMD_DMA_DERR 0x02 /* DMA direction error */ 260 #define IFP_CMD_TRAN_ERR 0x03 /* unspecified transport error */ 261 #define IFP_CMD_RESET 0x04 /* reset aborted transport */ 262 #define IFP_CMD_ABORTED 0x05 /* aborted on request */ 263 #define IFP_CMD_TIMEOUT 0x06 /* command timed out */ 264 #define IFP_CMD_DATA_OVR 0x07 /* data overrun--discard extra */ 265 #define IFP_CMD_ABORT_REJECTED 0x0e /* target rejected abort msg */ 266 #define IFP_CMD_RESET_REJECTED 0x12 /* target rejected reset msg */ 267 #define IFP_CMD_DATA_UNDER 0x15 /* data underrun */ 268 #define IFP_CMD_QUEUE_FULL 0x1c /* queue full SCSI status */ 269 #define IFP_CMD_PORT_UNAVAIL 0x28 /* port unavailable */ 270 #define IFP_CMD_PORT_LOGGED_OUT 0x29 /* port loged out */ 271 #define IFP_CMD_PORT_CONFIG_CHANGED 0x2a /* port name changed */ 272 273 274 275 #ifdef __cplusplus 276 } 277 #endif 278 279 #endif /* _SYS_FC4_FCIO_H */ 280