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