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