1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22d8c54e3dSSam Cramer * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte #ifndef _FCT_DEFINES_H 26fcf3ce44SJohn Forte #define _FCT_DEFINES_H 27fcf3ce44SJohn Forte 28fcf3ce44SJohn Forte #ifdef __cplusplus 29fcf3ce44SJohn Forte extern "C" { 30fcf3ce44SJohn Forte #endif 31fcf3ce44SJohn Forte 32fcf3ce44SJohn Forte typedef stmf_status_t fct_status_t; 33fcf3ce44SJohn Forte /* 34fcf3ce44SJohn Forte * Error codes 35fcf3ce44SJohn Forte */ 36fcf3ce44SJohn Forte #define FCT_SUCCESS STMF_SUCCESS 37fcf3ce44SJohn Forte #define FCT_FAILURE STMF_TARGET_FAILURE 38fcf3ce44SJohn Forte #define FCT_FCA_FAILURE (FCT_FAILURE | (uint64_t)0x0100000000000000) 39fcf3ce44SJohn Forte #define FCT_BUSY STMF_BUSY 40fcf3ce44SJohn Forte #define FCT_ABORT_SUCCESS STMF_ABORT_SUCCESS 41fcf3ce44SJohn Forte #define FCT_ABORTED STMF_ABORTED 42fcf3ce44SJohn Forte #define FCT_NOT_FOUND STMF_NOT_FOUND 43fcf3ce44SJohn Forte #define FCT_TIMEOUT STMF_TIMEOUT 44fcf3ce44SJohn Forte 45fcf3ce44SJohn Forte #define FCT_WORKER_STUCK (FCT_FAILURE | STMF_FSC(1)) 46fcf3ce44SJohn Forte #define FCT_ALLOC_FAILURE (FCT_FAILURE | STMF_FSC(2)) 47fcf3ce44SJohn Forte #define FCT_LOCAL_PORT_OFFLINE (FCT_FAILURE | STMF_FSC(3)) 48fcf3ce44SJohn Forte #define FCT_NO_XCHG_RESOURCE (FCT_FAILURE | STMF_FSC(4)) 49fcf3ce44SJohn Forte #define FCT_NOT_LOGGED_IN (FCT_FAILURE | STMF_FSC(5)) 50fcf3ce44SJohn Forte #define FCT_ABTS_RECEIVED (FCT_FAILURE | STMF_FSC(6)) 51fcf3ce44SJohn Forte #define FCT_RPORT_SENT_REJECT (FCT_FAILURE | STMF_FSC(7)) 52fcf3ce44SJohn Forte 53fcf3ce44SJohn Forte #define FCT_REJECT_STATUS(reason, expln) \ 54fcf3ce44SJohn Forte (FCT_RPORT_SENT_REJECT | (((uint64_t)(reason)) << 8) | \ 55fcf3ce44SJohn Forte ((uint64_t)(expln))) 56fcf3ce44SJohn Forte 57fcf3ce44SJohn Forte /* 58fcf3ce44SJohn Forte * Event codes 59fcf3ce44SJohn Forte */ 60fcf3ce44SJohn Forte #define FCT_EVENT_LINK_UP 0x01 61fcf3ce44SJohn Forte #define FCT_EVENT_LINK_DOWN 0x02 62fcf3ce44SJohn Forte #define FCT_EVENT_LINK_RESET 0x03 63fcf3ce44SJohn Forte #define FCT_EVENT_ADAPTER_FATAL 0x04 64fcf3ce44SJohn Forte 65fcf3ce44SJohn Forte /* 66fcf3ce44SJohn Forte * ELS OP codes 67fcf3ce44SJohn Forte */ 68fcf3ce44SJohn Forte #define ELS_OP_LSRJT 0x01 69fcf3ce44SJohn Forte #define ELS_OP_ACC 0x02 70fcf3ce44SJohn Forte #define ELS_OP_PLOGI 0x03 71fcf3ce44SJohn Forte #define ELS_OP_FLOGI 0x04 72fcf3ce44SJohn Forte #define ELS_OP_LOGO 0x05 73fcf3ce44SJohn Forte #define ELS_OP_ABTX 0x06 74*c946facaSallan #define ELS_OP_RLS 0x0f 75fcf3ce44SJohn Forte #define ELS_OP_ECHO 0x10 76fcf3ce44SJohn Forte #define ELS_OP_REC 0x13 77fcf3ce44SJohn Forte #define ELS_OP_SRR 0x14 78fcf3ce44SJohn Forte #define ELS_OP_PRLI 0x20 79fcf3ce44SJohn Forte #define ELS_OP_PRLO 0x21 80fcf3ce44SJohn Forte #define ELS_OP_SCN 0x22 81fcf3ce44SJohn Forte #define ELS_OP_TPRLO 0x24 82fcf3ce44SJohn Forte #define ELS_OP_PDISC 0x50 83fcf3ce44SJohn Forte #define ELS_OP_ADISC 0x52 84fcf3ce44SJohn Forte #define ELS_OP_RSCN 0x61 85fcf3ce44SJohn Forte #define ELS_OP_SCR 0x62 86fcf3ce44SJohn Forte #define ELS_OP_RNID 0x78 87fcf3ce44SJohn Forte 88fcf3ce44SJohn Forte /* 89fcf3ce44SJohn Forte * BLS replies 90fcf3ce44SJohn Forte */ 91fcf3ce44SJohn Forte #define BLS_OP_BA_ACC 0x84 92fcf3ce44SJohn Forte #define BLS_OP_BA_RJT 0x85 93fcf3ce44SJohn Forte 94fcf3ce44SJohn Forte /* 95fcf3ce44SJohn Forte * Name Service Command Codes 96fcf3ce44SJohn Forte */ 97fcf3ce44SJohn Forte #define NS_GA_NXT 0x0100 /* Get All next */ 98fcf3ce44SJohn Forte #define NS_GPN_ID 0x0112 /* Get Port Name */ 99fcf3ce44SJohn Forte #define NS_GNN_ID 0x0113 /* Get Node Name */ 100fcf3ce44SJohn Forte #define NS_GCS_ID 0x0114 /* Get Class Of service */ 101fcf3ce44SJohn Forte #define NS_GFT_ID 0x0117 /* Get FC-4 Types */ 102fcf3ce44SJohn Forte #define NS_GSPN_ID 0x0118 /* Get Sym Port name */ 103fcf3ce44SJohn Forte #define NS_GPT_ID 0x011A /* Get Port Type */ 104fcf3ce44SJohn Forte #define NS_GID_PN 0x0121 /* Get port id for PN */ 105fcf3ce44SJohn Forte #define NS_GID_NN 0x0131 /* Get port id for NN */ 106fcf3ce44SJohn Forte #define NS_GIP_NN 0x0135 /* Get IP address */ 107fcf3ce44SJohn Forte #define NS_GIPA_NN 0x0136 /* Get I.P.A */ 108fcf3ce44SJohn Forte #define NS_GSNN_NN 0x0139 /* Get Sym Node name */ 109fcf3ce44SJohn Forte #define NS_GNN_IP 0x0153 /* Get Node name for IP */ 110fcf3ce44SJohn Forte #define NS_GIPA_IP 0x0156 /* Get I.P.A for IP */ 111fcf3ce44SJohn Forte #define NS_GID_FT 0x0171 /* Get port Id for FC-4 type */ 112fcf3ce44SJohn Forte #define NS_GID_PT 0x01A1 /* Get port Id for type */ 113fcf3ce44SJohn Forte #define NS_RPN_ID 0x0212 /* Reg port name */ 114fcf3ce44SJohn Forte #define NS_RNN_ID 0x0213 /* Reg node name */ 115fcf3ce44SJohn Forte #define NS_RCS_ID 0x0214 /* Reg C.O.S */ 116fcf3ce44SJohn Forte #define NS_RFT_ID 0x0217 /* Reg FC-4 Types */ 117fcf3ce44SJohn Forte #define NS_RSPN_ID 0x0218 /* Reg Sym Port name */ 118fcf3ce44SJohn Forte #define NS_RPT_ID 0x021A /* Reg Port Type */ 119fcf3ce44SJohn Forte #define NS_RIP_NN 0x0235 /* Reg I.P address */ 120fcf3ce44SJohn Forte #define NS_RIPA_NN 0x0236 /* Reg I.P.A */ 121fcf3ce44SJohn Forte #define NS_RSNN_NN 0x0239 /* Reg Sym Node name */ 122fcf3ce44SJohn Forte #define NS_DA_ID 0x0300 /* De-Register all */ 123fcf3ce44SJohn Forte 124fcf3ce44SJohn Forte #define CT_OP_RJT 0x8001 125fcf3ce44SJohn Forte #define CT_OP_ACC 0x8002 126fcf3ce44SJohn Forte 127fcf3ce44SJohn Forte /* 128fcf3ce44SJohn Forte * PRLI bits 129fcf3ce44SJohn Forte */ 130fcf3ce44SJohn Forte #define PRLI_BIT_WRITE_XRDY_DISABLED 0x00000001 131fcf3ce44SJohn Forte #define PRLI_BIT_READ_XRDY_DISABLED 0x00000002 132fcf3ce44SJohn Forte #define PRLI_BIT_TARGET_FUNCTION 0x00000010 133fcf3ce44SJohn Forte #define PRLI_BIT_INITIATOR_FUNCTION 0x00000020 134fcf3ce44SJohn Forte #define PRLI_BIT_DATA_OVERLAY_ALLOWED 0x00000040 135fcf3ce44SJohn Forte #define PRLI_BIT_FCP_CONF_ALLOWED 0x00000080 136fcf3ce44SJohn Forte #define PRLI_BIT_RETRY 0x00000100 137fcf3ce44SJohn Forte #define PRLI_BIT_TASK_RETRY_IDENT_REQUESTED 0x00000200 138fcf3ce44SJohn Forte #define PRLI_BIT_REC_SUPPORT 0x00000400 139fcf3ce44SJohn Forte 140fcf3ce44SJohn Forte #define FC_NS_CLASSF 0x01 141fcf3ce44SJohn Forte #define FC_NS_CLASS1 0x02 142fcf3ce44SJohn Forte #define FC_NS_CLASS2 0x04 143fcf3ce44SJohn Forte #define FC_NS_CLASS3 0x08 144fcf3ce44SJohn Forte #define FC_NS_CLASS4 0x10 145fcf3ce44SJohn Forte #define FC_NS_CLASS5 0x20 146fcf3ce44SJohn Forte #define FC_NS_CLASS6 0x40 147fcf3ce44SJohn Forte 148fcf3ce44SJohn Forte /* 149fcf3ce44SJohn Forte * SCR function code 150fcf3ce44SJohn Forte */ 151fcf3ce44SJohn Forte #define FC_SCR_FABRIC_REGISTRATION 0x01 152fcf3ce44SJohn Forte #define FC_SCR_NPORT_REGISTRATION 0x02 153fcf3ce44SJohn Forte #define FC_SCR_FULL_REGISTRATION 0x03 154fcf3ce44SJohn Forte #define FC_SCR_CLEAR_REGISTRATION 0xFF 155fcf3ce44SJohn Forte 156fcf3ce44SJohn Forte /* 157fcf3ce44SJohn Forte * FCP_CNTL bits 158fcf3ce44SJohn Forte */ 159fcf3ce44SJohn Forte #define FCP_CNTL_TASK_ATTR(fcp_cntl) ((((uint32_t)(fcp_cntl)) >> 16) & 7) 160fcf3ce44SJohn Forte #define TASK_ATTR_SIMPLE_Q 0 161fcf3ce44SJohn Forte #define TASK_ATTR_HEAD_OF_Q 1 162fcf3ce44SJohn Forte #define TASK_ATTR_ORDERED_Q 2 163fcf3ce44SJohn Forte #define TASK_ATTR_ACA_Q 4 164fcf3ce44SJohn Forte #define TASK_ATTR_UNTAGGED 5 165fcf3ce44SJohn Forte #define FCP_CNTL_IS_TASK_MGMT(fcp_cntl) (((uint32_t)(fcp_cntl)) & 0xff00) 166fcf3ce44SJohn Forte #define FCP_CNTL_TERMINATE_TASK 0x8000 167fcf3ce44SJohn Forte #define FCP_CNTL_CLEAR_ACA 0x4000 168fcf3ce44SJohn Forte #define FCP_CNTL_TARGET_RESET 0x2000 169fcf3ce44SJohn Forte #define FCP_CNTL_LUN_RESET 0x1000 170fcf3ce44SJohn Forte #define FCP_CNTL_CLEAR_TASK_SET 0x0400 171fcf3ce44SJohn Forte #define FCP_CNTL_ABORT_TASK_SET 0x0200 172fcf3ce44SJohn Forte #define FCP_CNTL_READ_DATA 0x2 173fcf3ce44SJohn Forte #define FCP_CNTL_WRITE_DATA 0x1 174fcf3ce44SJohn Forte 175fcf3ce44SJohn Forte /* 176fcf3ce44SJohn Forte * SCSI STATUS BITS 177fcf3ce44SJohn Forte */ 178fcf3ce44SJohn Forte #define FCP_BIDI_RESP 0x8000 179fcf3ce44SJohn Forte #define FCP_BIDI_UNDER 0x4000 180fcf3ce44SJohn Forte #define FCP_BIDI_OVER 0x2000 181fcf3ce44SJohn Forte #define FCP_CONF_REQ 0x1000 182fcf3ce44SJohn Forte #define FCP_RESID_UNDER 0x0800 183fcf3ce44SJohn Forte #define FCP_RESID_OVER 0x0400 184fcf3ce44SJohn Forte #define FCP_SNS_LEN_VALID 0x0200 185fcf3ce44SJohn Forte #define FCP_RESP_LEN_VALID 0x0100 186fcf3ce44SJohn Forte 187fcf3ce44SJohn Forte /* 188fcf3ce44SJohn Forte * Well known addresses ... 189fcf3ce44SJohn Forte */ 190fcf3ce44SJohn Forte #define NPORT_ID_DOM_CTLR_START 0xFFFC01 191fcf3ce44SJohn Forte #define NPORT_ID_DOM_CTLR_END 0xFFFCFE 192fcf3ce44SJohn Forte 193fcf3ce44SJohn Forte #define FS_GENERAL_MULTICAST 0xFFFFF7 194fcf3ce44SJohn Forte #define FS_WELL_KNOWN_MULTICAST 0xFFFFF8 195fcf3ce44SJohn Forte #define FS_HUNT_GROUP 0xFFFFF9 196fcf3ce44SJohn Forte #define FS_MANAGEMENT_SERVER 0xFFFFFA 197fcf3ce44SJohn Forte #define FS_TIME_SERVER 0xFFFFFB 198fcf3ce44SJohn Forte #define FS_NAME_SERVER 0xFFFFFC 199fcf3ce44SJohn Forte #define FS_FABRIC_CONTROLLER 0xFFFFFD 200fcf3ce44SJohn Forte #define FS_FABRIC_F_PORT 0xFFFFFE 201fcf3ce44SJohn Forte #define FS_BROADCAST 0xFFFFFF 202fcf3ce44SJohn Forte 203fcf3ce44SJohn Forte #define FC_WELL_KNOWN_START 0xFFFFF0 204fcf3ce44SJohn Forte #define FC_WELL_KNOWN_END 0xFFFFFF 205fcf3ce44SJohn Forte #define FC_WELL_KNOWN_ADDR(x) \ 206fcf3ce44SJohn Forte ((((x) >= FC_WELL_KNOWN_START) && ((x) <= FC_WELL_KNOWN_END)) ||\ 207fcf3ce44SJohn Forte (((x) >= NPORT_ID_DOM_CTLR_START) && ((x) <= NPORT_ID_DOM_CTLR_END))) 208fcf3ce44SJohn Forte 209fcf3ce44SJohn Forte #define FC_WWN_LEN 8 210d8c54e3dSSam Cramer /* 211d8c54e3dSSam Cramer * NB: FC_WWN_BUFLEN should be 64-bit aligned (divisible by 8). 212d8c54e3dSSam Cramer */ 213d8c54e3dSSam Cramer #define FC_WWN_BUFLEN (FC_WWN_LEN * 3) 214d8c54e3dSSam Cramer #define FC_WWN_STRLEN (FC_WWN_BUFLEN - 1) /* add trailing null */ 215fcf3ce44SJohn Forte 216fcf3ce44SJohn Forte struct fct_cmd; 217fcf3ce44SJohn Forte struct fct_local_port; 218fcf3ce44SJohn Forte struct fct_els; 219fcf3ce44SJohn Forte struct fct_link_info; 220fcf3ce44SJohn Forte struct fct_flogi_xchg; 221fcf3ce44SJohn Forte struct fct_dbuf_store; 222fcf3ce44SJohn Forte 223fcf3ce44SJohn Forte #ifdef __cplusplus 224fcf3ce44SJohn Forte } 225fcf3ce44SJohn Forte #endif 226fcf3ce44SJohn Forte 227fcf3ce44SJohn Forte #endif /* _FCT_DEFINES_H */ 228