1*fcf3ce44SJohn Forte /* 2*fcf3ce44SJohn Forte * CDDL HEADER START 3*fcf3ce44SJohn Forte * 4*fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5*fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6*fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7*fcf3ce44SJohn Forte * 8*fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10*fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11*fcf3ce44SJohn Forte * and limitations under the License. 12*fcf3ce44SJohn Forte * 13*fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14*fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16*fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17*fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18*fcf3ce44SJohn Forte * 19*fcf3ce44SJohn Forte * CDDL HEADER END 20*fcf3ce44SJohn Forte */ 21*fcf3ce44SJohn Forte /* 22*fcf3ce44SJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*fcf3ce44SJohn Forte * Use is subject to license terms. 24*fcf3ce44SJohn Forte */ 25*fcf3ce44SJohn Forte 26*fcf3ce44SJohn Forte #ifndef _FC_APPIF_H 27*fcf3ce44SJohn Forte #define _FC_APPIF_H 28*fcf3ce44SJohn Forte 29*fcf3ce44SJohn Forte #include <sys/note.h> 30*fcf3ce44SJohn Forte 31*fcf3ce44SJohn Forte #ifdef __cplusplus 32*fcf3ce44SJohn Forte extern "C" { 33*fcf3ce44SJohn Forte #endif 34*fcf3ce44SJohn Forte 35*fcf3ce44SJohn Forte #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL) 36*fcf3ce44SJohn Forte #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 37*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_LTOH */ 38*fcf3ce44SJohn Forte 39*fcf3ce44SJohn Forte /* 40*fcf3ce44SJohn Forte * Local port topology definitions 41*fcf3ce44SJohn Forte * 42*fcf3ce44SJohn Forte * fp/fctl use these a lot with the fp_topology field in the fc_port_t struct, 43*fcf3ce44SJohn Forte * but use is not limited to fp_topology. These are also understood by ULPs. 44*fcf3ce44SJohn Forte */ 45*fcf3ce44SJohn Forte #define FC_TOP_UNKNOWN 0 46*fcf3ce44SJohn Forte #define FC_TOP_PRIVATE_LOOP 1 47*fcf3ce44SJohn Forte #define FC_TOP_PUBLIC_LOOP 2 48*fcf3ce44SJohn Forte #define FC_TOP_FABRIC 3 49*fcf3ce44SJohn Forte #define FC_TOP_PT_PT 4 50*fcf3ce44SJohn Forte #define FC_TOP_NO_NS 5 51*fcf3ce44SJohn Forte 52*fcf3ce44SJohn Forte /* 53*fcf3ce44SJohn Forte * Macros used with the preceeding topology #defines. 54*fcf3ce44SJohn Forte * fp/fctl use these a lot with the fp_topology field in the fc_port_t struct, 55*fcf3ce44SJohn Forte * but use is not limited to fp_topology. These are also understood by ULPs. 56*fcf3ce44SJohn Forte */ 57*fcf3ce44SJohn Forte #define FC_TOP_EXTERNAL(t) FC_IS_TOP_SWITCH(t) 58*fcf3ce44SJohn Forte #define FC_IS_TOP_SWITCH(t) (((t) == FC_TOP_FABRIC) ||\ 59*fcf3ce44SJohn Forte ((t) == FC_TOP_PUBLIC_LOOP)) 60*fcf3ce44SJohn Forte 61*fcf3ce44SJohn Forte /* 62*fcf3ce44SJohn Forte * fc_remote_port state (map_state) definitions. 63*fcf3ce44SJohn Forte * 64*fcf3ce44SJohn Forte * Used with the pd_state field in the fc_remote_port_t struct. 65*fcf3ce44SJohn Forte */ 66*fcf3ce44SJohn Forte #define PORT_DEVICE_INVALID 0 /* State when created or login failed */ 67*fcf3ce44SJohn Forte #define PORT_DEVICE_VALID 1 /* Logged out */ 68*fcf3ce44SJohn Forte #define PORT_DEVICE_LOGGED_IN 2 /* Logged in */ 69*fcf3ce44SJohn Forte 70*fcf3ce44SJohn Forte 71*fcf3ce44SJohn Forte /* 72*fcf3ce44SJohn Forte * Firmware, FCode revision field lengths 73*fcf3ce44SJohn Forte */ 74*fcf3ce44SJohn Forte #define FC_FCODE_REV_SIZE 25 75*fcf3ce44SJohn Forte #define FC_FW_REV_SIZE 25 76*fcf3ce44SJohn Forte 77*fcf3ce44SJohn Forte typedef struct ct_header { 78*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH) 79*fcf3ce44SJohn Forte uint32_t ct_inid : 24, /* Initial Node ID */ 80*fcf3ce44SJohn Forte ct_rev : 8; /* Revision */ 81*fcf3ce44SJohn Forte 82*fcf3ce44SJohn Forte uint32_t ct_reserved1 : 8, 83*fcf3ce44SJohn Forte ct_options : 8, 84*fcf3ce44SJohn Forte ct_fcssubtype : 8, 85*fcf3ce44SJohn Forte ct_fcstype : 8; 86*fcf3ce44SJohn Forte 87*fcf3ce44SJohn Forte uint32_t ct_aiusize : 16, 88*fcf3ce44SJohn Forte ct_cmdrsp : 16; 89*fcf3ce44SJohn Forte 90*fcf3ce44SJohn Forte uint32_t ct_vendor : 8, 91*fcf3ce44SJohn Forte ct_expln : 8, 92*fcf3ce44SJohn Forte ct_reason : 8, 93*fcf3ce44SJohn Forte ct_reserved2 : 8; 94*fcf3ce44SJohn Forte 95*fcf3ce44SJohn Forte #else 96*fcf3ce44SJohn Forte uint32_t ct_rev : 8, /* revision */ 97*fcf3ce44SJohn Forte ct_inid : 24; /* initial node ID */ 98*fcf3ce44SJohn Forte uint32_t ct_fcstype : 8, /* type of service */ 99*fcf3ce44SJohn Forte ct_fcssubtype : 8, /* subtype of service */ 100*fcf3ce44SJohn Forte ct_options : 8, /* options */ 101*fcf3ce44SJohn Forte ct_reserved1 : 8; /* reserved */ 102*fcf3ce44SJohn Forte 103*fcf3ce44SJohn Forte uint32_t ct_cmdrsp : 16, /* command/response code */ 104*fcf3ce44SJohn Forte ct_aiusize : 16; /* AIU/residual size */ 105*fcf3ce44SJohn Forte 106*fcf3ce44SJohn Forte uint32_t ct_reserved2 : 8, /* reserved */ 107*fcf3ce44SJohn Forte ct_reason : 8, /* reason code */ 108*fcf3ce44SJohn Forte ct_expln : 8, /* reason explanation */ 109*fcf3ce44SJohn Forte ct_vendor : 8; /* vendor unique */ 110*fcf3ce44SJohn Forte 111*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_LTOH */ 112*fcf3ce44SJohn Forte } fc_ct_header_t; 113*fcf3ce44SJohn Forte 114*fcf3ce44SJohn Forte /* World Wide Name format */ 115*fcf3ce44SJohn Forte typedef union la_wwn { 116*fcf3ce44SJohn Forte uchar_t raw_wwn[8]; 117*fcf3ce44SJohn Forte uint32_t i_wwn[2]; 118*fcf3ce44SJohn Forte 119*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH) 120*fcf3ce44SJohn Forte struct { 121*fcf3ce44SJohn Forte uint32_t wwn_hi : 16, 122*fcf3ce44SJohn Forte nport_id : 12, 123*fcf3ce44SJohn Forte naa_id : 4; 124*fcf3ce44SJohn Forte uint32_t wwn_lo; 125*fcf3ce44SJohn Forte }w; 126*fcf3ce44SJohn Forte 127*fcf3ce44SJohn Forte #else 128*fcf3ce44SJohn Forte struct { 129*fcf3ce44SJohn Forte uint32_t naa_id : 4, 130*fcf3ce44SJohn Forte nport_id : 12, 131*fcf3ce44SJohn Forte wwn_hi : 16; 132*fcf3ce44SJohn Forte uint32_t wwn_lo; 133*fcf3ce44SJohn Forte }w; 134*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_LTOH */ 135*fcf3ce44SJohn Forte } la_wwn_t; 136*fcf3ce44SJohn Forte 137*fcf3ce44SJohn Forte /* 138*fcf3ce44SJohn Forte * Values for naa_id 139*fcf3ce44SJohn Forte */ 140*fcf3ce44SJohn Forte #define NAA_ID_IEEE 1 141*fcf3ce44SJohn Forte #define NAA_ID_IEEE_EXTENDED 2 142*fcf3ce44SJohn Forte 143*fcf3ce44SJohn Forte #ifndef FC_WWN_SIZE 144*fcf3ce44SJohn Forte #define FC_WWN_SIZE (sizeof (la_wwn_t)) 145*fcf3ce44SJohn Forte #endif /* FC_WWN_SIZE */ 146*fcf3ce44SJohn Forte 147*fcf3ce44SJohn Forte typedef struct service_param { 148*fcf3ce44SJohn Forte uint16_t class_opt; 149*fcf3ce44SJohn Forte uint16_t initiator_ctl; 150*fcf3ce44SJohn Forte uint16_t recipient_ctl; 151*fcf3ce44SJohn Forte uint16_t rcv_size; 152*fcf3ce44SJohn Forte uint16_t conc_sequences; 153*fcf3ce44SJohn Forte uint16_t n_port_e_to_e_credit; 154*fcf3ce44SJohn Forte uint16_t open_seq_per_xchng; 155*fcf3ce44SJohn Forte uint16_t rsvd; 156*fcf3ce44SJohn Forte } svc_param_t; 157*fcf3ce44SJohn Forte 158*fcf3ce44SJohn Forte typedef struct common_service { 159*fcf3ce44SJohn Forte uint16_t fcph_version; 160*fcf3ce44SJohn Forte uint16_t btob_credit; 161*fcf3ce44SJohn Forte uint16_t cmn_features; 162*fcf3ce44SJohn Forte uint16_t rx_bufsize; 163*fcf3ce44SJohn Forte uint16_t conc_sequences; 164*fcf3ce44SJohn Forte uint16_t relative_offset; 165*fcf3ce44SJohn Forte uint32_t e_d_tov; 166*fcf3ce44SJohn Forte } com_svc_t; 167*fcf3ce44SJohn Forte 168*fcf3ce44SJohn Forte typedef struct ls_code { 169*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH) 170*fcf3ce44SJohn Forte uint32_t mbz : 24, 171*fcf3ce44SJohn Forte ls_code : 8; 172*fcf3ce44SJohn Forte 173*fcf3ce44SJohn Forte #else 174*fcf3ce44SJohn Forte uint32_t ls_code : 8, 175*fcf3ce44SJohn Forte mbz : 24; 176*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_LTOH */ 177*fcf3ce44SJohn Forte } ls_code_t; 178*fcf3ce44SJohn Forte 179*fcf3ce44SJohn Forte 180*fcf3ce44SJohn Forte /* Login Payload. */ 181*fcf3ce44SJohn Forte typedef struct la_els_logi { 182*fcf3ce44SJohn Forte ls_code_t ls_code; 183*fcf3ce44SJohn Forte com_svc_t common_service; 184*fcf3ce44SJohn Forte 185*fcf3ce44SJohn Forte la_wwn_t nport_ww_name; 186*fcf3ce44SJohn Forte la_wwn_t node_ww_name; 187*fcf3ce44SJohn Forte 188*fcf3ce44SJohn Forte svc_param_t class_1; 189*fcf3ce44SJohn Forte svc_param_t class_2; 190*fcf3ce44SJohn Forte svc_param_t class_3; 191*fcf3ce44SJohn Forte 192*fcf3ce44SJohn Forte uchar_t reserved[16]; 193*fcf3ce44SJohn Forte uchar_t vendor_version[16]; 194*fcf3ce44SJohn Forte } la_els_logi_t; 195*fcf3ce44SJohn Forte 196*fcf3ce44SJohn Forte typedef struct fc_ns_cmd { 197*fcf3ce44SJohn Forte uint32_t ns_flags; /* for future use */ 198*fcf3ce44SJohn Forte uint16_t ns_cmd; /* NS command type */ 199*fcf3ce44SJohn Forte uint16_t ns_req_len; 200*fcf3ce44SJohn Forte caddr_t ns_req_payload; /* No CT header */ 201*fcf3ce44SJohn Forte uint16_t ns_resp_len; 202*fcf3ce44SJohn Forte caddr_t ns_resp_payload; /* no CT header */ 203*fcf3ce44SJohn Forte void *ns_fctl_private; /* Transport private */ 204*fcf3ce44SJohn Forte fc_ct_header_t ns_resp_hdr; /* for the curious */ 205*fcf3ce44SJohn Forte } fc_ns_cmd_t; 206*fcf3ce44SJohn Forte 207*fcf3ce44SJohn Forte #if defined(_SYSCALL32) 208*fcf3ce44SJohn Forte 209*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 210*fcf3ce44SJohn Forte #pragma pack(4) 211*fcf3ce44SJohn Forte #endif 212*fcf3ce44SJohn Forte 213*fcf3ce44SJohn Forte typedef struct la_els_logi32 { 214*fcf3ce44SJohn Forte ls_code_t ls_code; 215*fcf3ce44SJohn Forte com_svc_t common_service; 216*fcf3ce44SJohn Forte la_wwn_t nport_ww_name; 217*fcf3ce44SJohn Forte la_wwn_t node_ww_name; 218*fcf3ce44SJohn Forte svc_param_t class_1; 219*fcf3ce44SJohn Forte svc_param_t class_2; 220*fcf3ce44SJohn Forte svc_param_t class_3; 221*fcf3ce44SJohn Forte uchar_t reserved[16]; 222*fcf3ce44SJohn Forte uchar_t vendor_version[16]; 223*fcf3ce44SJohn Forte } la_els_logi32_t; 224*fcf3ce44SJohn Forte 225*fcf3ce44SJohn Forte typedef struct fc_ns_cmd32 { 226*fcf3ce44SJohn Forte uint32_t ns_flags; /* for future use */ 227*fcf3ce44SJohn Forte uint16_t ns_cmd; /* NS command type */ 228*fcf3ce44SJohn Forte uint16_t ns_req_len; 229*fcf3ce44SJohn Forte caddr_t ns_req_payload; /* No CT header */ 230*fcf3ce44SJohn Forte uint16_t ns_resp_len; 231*fcf3ce44SJohn Forte caddr_t ns_resp_payload; /* no CT header */ 232*fcf3ce44SJohn Forte void *ns_fctl_private; /* Transport private */ 233*fcf3ce44SJohn Forte fc_ct_header_t ns_resp_hdr; /* for the curious */ 234*fcf3ce44SJohn Forte } fc_ns_cmd32_t; 235*fcf3ce44SJohn Forte 236*fcf3ce44SJohn Forte #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 237*fcf3ce44SJohn Forte #pragma pack() 238*fcf3ce44SJohn Forte #endif 239*fcf3ce44SJohn Forte 240*fcf3ce44SJohn Forte #endif /* _SYSCALL32 */ 241*fcf3ce44SJohn Forte 242*fcf3ce44SJohn Forte /* Link Error Parameters in the RLS Accept payload */ 243*fcf3ce44SJohn Forte typedef struct fc_rls_acc_params { 244*fcf3ce44SJohn Forte uint32_t rls_link_fail; /* link failure count */ 245*fcf3ce44SJohn Forte uint32_t rls_sync_loss; /* loss of sync count */ 246*fcf3ce44SJohn Forte uint32_t rls_sig_loss; /* loss of signal count */ 247*fcf3ce44SJohn Forte uint32_t rls_prim_seq_err; /* primitive seq error */ 248*fcf3ce44SJohn Forte uint32_t rls_invalid_word; /* invalid tx word */ 249*fcf3ce44SJohn Forte uint32_t rls_invalid_crc; /* invalid CRC count */ 250*fcf3ce44SJohn Forte } fc_rls_acc_t; 251*fcf3ce44SJohn Forte 252*fcf3ce44SJohn Forte /* RLS Payload. */ 253*fcf3ce44SJohn Forte typedef struct la_els_rls { 254*fcf3ce44SJohn Forte ls_code_t ls_code; 255*fcf3ce44SJohn Forte fc_portid_t rls_portid; /* port identifier */ 256*fcf3ce44SJohn Forte } la_els_rls_t; 257*fcf3ce44SJohn Forte 258*fcf3ce44SJohn Forte /* RLS accept payload */ 259*fcf3ce44SJohn Forte typedef struct la_els_rls_acc { 260*fcf3ce44SJohn Forte ls_code_t ls_code; 261*fcf3ce44SJohn Forte fc_rls_acc_t rls_link_params; /* link error status block */ 262*fcf3ce44SJohn Forte } la_els_rls_acc_t; 263*fcf3ce44SJohn Forte 264*fcf3ce44SJohn Forte /* Node Id Parameters in the RNID Get/Set Accept/Request payload */ 265*fcf3ce44SJohn Forte typedef struct fc_rnid_params { 266*fcf3ce44SJohn Forte uchar_t global_id[16]; /* global name */ 267*fcf3ce44SJohn Forte uint32_t unit_type; /* unit type */ 268*fcf3ce44SJohn Forte uint32_t port_id; /* port id */ 269*fcf3ce44SJohn Forte uint32_t num_attached; /* number of attached nodes */ 270*fcf3ce44SJohn Forte uint16_t ip_version; /* ip version */ 271*fcf3ce44SJohn Forte uint16_t udp_port; /* udp port number */ 272*fcf3ce44SJohn Forte uchar_t ip_addr[16]; /* ip address */ 273*fcf3ce44SJohn Forte uint16_t specific_id_resv; /* reserved */ 274*fcf3ce44SJohn Forte uint16_t topo_flags; /* topology discovery flags */ 275*fcf3ce44SJohn Forte } fc_rnid_t; 276*fcf3ce44SJohn Forte 277*fcf3ce44SJohn Forte /* RNID get data format flag */ 278*fcf3ce44SJohn Forte #define FCIO_CFLAGS_RNID_GET_GENERAL_TOPOLOGY 0xDF 279*fcf3ce44SJohn Forte #define FCIO_CFLAGS_RNID_GET_VENDOR_SPECIFIC 0xE0 280*fcf3ce44SJohn Forte 281*fcf3ce44SJohn Forte /* RNID maximum data length - common data(16) + specific data(252) */ 282*fcf3ce44SJohn Forte #define FCIO_RNID_MAX_DATA_LEN 268 283*fcf3ce44SJohn Forte 284*fcf3ce44SJohn Forte /* RNID Payload. */ 285*fcf3ce44SJohn Forte typedef struct la_els_rnid { 286*fcf3ce44SJohn Forte ls_code_t ls_code; 287*fcf3ce44SJohn Forte uchar_t data_format; /* data format returned */ 288*fcf3ce44SJohn Forte uchar_t resv[3]; 289*fcf3ce44SJohn Forte } la_els_rnid_t; 290*fcf3ce44SJohn Forte 291*fcf3ce44SJohn Forte /* 292*fcf3ce44SJohn Forte * ELS RNID header 293*fcf3ce44SJohn Forte * - cmn_len can be 0 or 16 - if it is 0 then specific data starts at 294*fcf3ce44SJohn Forte * offset 8 else specific data starts at offset 24 in the RNID els response 295*fcf3ce44SJohn Forte */ 296*fcf3ce44SJohn Forte typedef struct fc_rnid_hdr { 297*fcf3ce44SJohn Forte uchar_t data_format; 298*fcf3ce44SJohn Forte uchar_t cmn_len; 299*fcf3ce44SJohn Forte uchar_t resv; 300*fcf3ce44SJohn Forte uchar_t specific_len; 301*fcf3ce44SJohn Forte }fc_rnid_hdr_t; 302*fcf3ce44SJohn Forte 303*fcf3ce44SJohn Forte typedef struct la_els_rnid_acc { 304*fcf3ce44SJohn Forte ls_code_t ls_code; 305*fcf3ce44SJohn Forte fc_rnid_hdr_t hdr; 306*fcf3ce44SJohn Forte uchar_t data[FCIO_RNID_MAX_DATA_LEN]; 307*fcf3ce44SJohn Forte } la_els_rnid_acc_t; 308*fcf3ce44SJohn Forte 309*fcf3ce44SJohn Forte typedef struct la_npiv_create_entry { 310*fcf3ce44SJohn Forte la_wwn_t VNodeWWN; 311*fcf3ce44SJohn Forte la_wwn_t VPortWWN; 312*fcf3ce44SJohn Forte uint32_t vindex; 313*fcf3ce44SJohn Forte } la_npiv_create_entry_t; 314*fcf3ce44SJohn Forte 315*fcf3ce44SJohn Forte #if !defined(__lint) 316*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_ns_cmd)) 317*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", ct_header)) 318*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_logi)) 319*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_wwn)) 320*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_rls_acc_params)) 321*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rls)) 322*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rls_acc)) 323*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_rnid_params)) 324*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rnid)) 325*fcf3ce44SJohn Forte _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rnid_acc)) 326*fcf3ce44SJohn Forte #endif /* __lint */ 327*fcf3ce44SJohn Forte 328*fcf3ce44SJohn Forte #ifdef __cplusplus 329*fcf3ce44SJohn Forte } 330*fcf3ce44SJohn Forte #endif 331*fcf3ce44SJohn Forte 332*fcf3ce44SJohn Forte #endif /* _FC_APPIF_H */ 333