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