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 * Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_FC4_FC_H 28*0Sstevel@tonic-gate #define _SYS_FC4_FC_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate /* 37*0Sstevel@tonic-gate * Fibre Channel Physical and Signaling Interface (FC-PH) definitions. 38*0Sstevel@tonic-gate * 39*0Sstevel@tonic-gate * NOTE: modifications of this file affect drivers, mpsas models, PLUTO 40*0Sstevel@tonic-gate * firmware, SOC assembly code. Please be communicative. 41*0Sstevel@tonic-gate */ 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate #define FC_PH_VERSION 0x06 /* 0x06 means 4.0 ! */ 44*0Sstevel@tonic-gate #define MAX_FRAME_SIZE 2112 /* maximum size of frame payload */ 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate /* 47*0Sstevel@tonic-gate * This is the standard frame header for FC-PH frames. 48*0Sstevel@tonic-gate */ 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate typedef struct FC2_FRAME_HDR { 51*0Sstevel@tonic-gate uint_t r_ctl:8, d_id:24; 52*0Sstevel@tonic-gate uint_t reserved1:8, s_id:24; 53*0Sstevel@tonic-gate uint_t type:8, f_ctl:24; 54*0Sstevel@tonic-gate uint_t seq_id:8, df_ctl:8, seq_cnt:16; 55*0Sstevel@tonic-gate ushort_t ox_id, rx_id; 56*0Sstevel@tonic-gate uint_t ro; 57*0Sstevel@tonic-gate }aFC2_FRAME_HDR, *FC2_FRAME_HDRptr, fc_frame_header_t; 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate #define WE_ARE_ORIGINATOR(fh) (fh->f_ctl & F_CTL_XCHG_CONTEXT) 60*0Sstevel@tonic-gate #define UNSOLICITED_FRAME(fh) (fh->rx_id == 0xffff) 61*0Sstevel@tonic-gate #define FIRST_SEQUENCE(fh) (fh->f_ctl & F_CTL_FIRST_SEQ) 62*0Sstevel@tonic-gate #define LAST_FRAME_OF_SEQUENCE(fh) (fh->f_ctl & F_CTL_END_SEQ) 63*0Sstevel@tonic-gate #define LAST_SEQUENCE_OF_EXCHANGE(fh) (fh->f_ctl & F_CTL_LAST_SEQ) 64*0Sstevel@tonic-gate #define TRANSFER_INITIATIVE(fh) (fh->f_ctl & F_CTL_SEQ_INITIATIVE) 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate /* legal values for r_ctl */ 68*0Sstevel@tonic-gate #define R_CTL_ROUTING 0xf0 /* mask for routing bits */ 69*0Sstevel@tonic-gate #define R_CTL_INFO 0x0f /* mask for information bits */ 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #define R_CTL_DEVICE_DATA 0x00 /* all I/O related frames */ 72*0Sstevel@tonic-gate #define R_CTL_EXTENDED_SVC 0x20 /* extended link services (PLOGI) */ 73*0Sstevel@tonic-gate #define R_CTL_FC4_SVC 0x30 /* FC-4 link services (FCP_LOGI) */ 74*0Sstevel@tonic-gate #define R_CTL_VIDEO_BUFF 0x40 /* not yet defined */ 75*0Sstevel@tonic-gate #define R_CTL_BASIC_SVC 0x80 /* basic link services (NOP) */ 76*0Sstevel@tonic-gate #define R_CTL_LINK_CTL 0xc0 /* ACKs, etc. */ 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate /* legal values for r_ctl: Device Data */ 79*0Sstevel@tonic-gate #define R_CTL_UNCATEGORIZED 0x00 80*0Sstevel@tonic-gate #define R_CTL_SOLICITED_DATA 0x01 81*0Sstevel@tonic-gate #define R_CTL_UNSOL_CONTROL 0x02 82*0Sstevel@tonic-gate #define R_CTL_SOLICITED_CONTROL 0x03 83*0Sstevel@tonic-gate #define R_CTL_UNSOL_DATA 0x04 84*0Sstevel@tonic-gate #define R_CTL_XFER_RDY 0x05 85*0Sstevel@tonic-gate #define R_CTL_COMMAND 0x06 86*0Sstevel@tonic-gate #define R_CTL_STATUS 0x07 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate /* legal values for r_ctl: Basic Link Services, type 0 */ 89*0Sstevel@tonic-gate #define R_CTL_LS_NOP 0x80 90*0Sstevel@tonic-gate #define R_CTL_LS_ABTS 0x81 91*0Sstevel@tonic-gate #define R_CTL_LS_RMC 0x82 92*0Sstevel@tonic-gate #define R_CTL_LS_BA_ACC 0x84 93*0Sstevel@tonic-gate #define R_CTL_LS_BA_RJT 0x85 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate /* legal values for r_ctl: Extended Link Services, type 1 */ 96*0Sstevel@tonic-gate #define R_CTL_ELS_REQ 0x22 97*0Sstevel@tonic-gate #define R_CTL_ELS_RSP 0x23 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate /* Extended Link Service command codes, type 1 */ 100*0Sstevel@tonic-gate #define LS_RJT 0x01000000 101*0Sstevel@tonic-gate #define LS_ACC 0x02000000 102*0Sstevel@tonic-gate #define LS_PLOGI 0x03000000 103*0Sstevel@tonic-gate #define LS_FLOGI 0x04000000 104*0Sstevel@tonic-gate #define LS_LOGO 0x05000000 105*0Sstevel@tonic-gate #define LS_ABTX 0x06000000 106*0Sstevel@tonic-gate #define LS_RCS 0x07000000 107*0Sstevel@tonic-gate #define LS_RES 0x08000000 108*0Sstevel@tonic-gate #define LS_RSS 0x09000000 109*0Sstevel@tonic-gate #define LS_RSI 0x0a000000 110*0Sstevel@tonic-gate #define LS_ESTS 0x0b000000 111*0Sstevel@tonic-gate #define LS_ESTC 0x0c000000 112*0Sstevel@tonic-gate #define LS_ADVC 0x0d000000 113*0Sstevel@tonic-gate #define LS_RTV 0x0e000000 114*0Sstevel@tonic-gate #define LS_RLS 0x0f000000 115*0Sstevel@tonic-gate #define LS_ECHO 0x10000000 116*0Sstevel@tonic-gate #define LS_TEST 0x11000000 117*0Sstevel@tonic-gate #define LS_RRQ 0x12000000 118*0Sstevel@tonic-gate #define LS_IDENT 0x20000000 /* vendor unique */ 119*0Sstevel@tonic-gate #define LS_DISPLAY 0x21000000 /* vendor unique */ 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate /* legal values for r_ctl: Link Control */ 122*0Sstevel@tonic-gate #define R_CTL_ACK_1 0xc0 123*0Sstevel@tonic-gate #define R_CTL_ACK_N 0xc1 124*0Sstevel@tonic-gate #define R_CTL_P_RJT 0xc2 125*0Sstevel@tonic-gate #define R_CTL_F_RJT 0xc3 126*0Sstevel@tonic-gate #define R_CTL_P_BSY 0xc4 127*0Sstevel@tonic-gate #define R_CTL_F_BSY_DF 0xc5 128*0Sstevel@tonic-gate #define R_CTL_F_BSY_LC 0xc6 129*0Sstevel@tonic-gate #define R_CTL_LCR 0xc7 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate /* type field definitions for Link Data frames: */ 132*0Sstevel@tonic-gate #define TYPE_BASIC_LS 0x00 133*0Sstevel@tonic-gate #define TYPE_EXTENDED_LS 0x01 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate /* type field definitions for Device Data frames (from FC-PH 4.1): */ 136*0Sstevel@tonic-gate #define TYPE_IS8802 0x04 137*0Sstevel@tonic-gate #define TYPE_IS8802_SNAP 0x05 138*0Sstevel@tonic-gate #define TYPE_SCSI_FCP 0x08 /* we use this one */ 139*0Sstevel@tonic-gate #define TYPE_SCSI_GPP 0x09 140*0Sstevel@tonic-gate #define TYPE_HIPP_FP 0x0a 141*0Sstevel@tonic-gate #define TYPE_IPI3_MASTER 0x11 142*0Sstevel@tonic-gate #define TYPE_IPI3_SLAVE 0x12 143*0Sstevel@tonic-gate #define TYPE_IPI3_PEER 0x13 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate #define F_CTL_XCHG_CONTEXT 0x800000 /* 0 if SID is XCHG originator */ 146*0Sstevel@tonic-gate #define F_CTL_SEQ_CONTEXT 0x400000 /* 0 if SID is SEQ initiator */ 147*0Sstevel@tonic-gate #define F_CTL_FIRST_SEQ 0x200000 /* 1 if first sequence of XCHG */ 148*0Sstevel@tonic-gate #define F_CTL_LAST_SEQ 0x100000 /* 1 if last SEQ of XCHG */ 149*0Sstevel@tonic-gate #define F_CTL_END_SEQ 0x080000 /* 1 if last frame of a SEQ */ 150*0Sstevel@tonic-gate #define F_CTL_END_CONNECT 0x040000 /* always 0 */ 151*0Sstevel@tonic-gate #define F_CTL_CHAINED_SEQ 0x020000 /* always 0 */ 152*0Sstevel@tonic-gate #define F_CTL_SEQ_INITIATIVE 0x010000 /* when 1 xfrs SEQ initiative */ 153*0Sstevel@tonic-gate #define F_CTL_XID_REASSIGNED 0x008000 /* always 0 */ 154*0Sstevel@tonic-gate #define F_CTL_INVALIDATE_XID 0x004000 /* always 0 */ 155*0Sstevel@tonic-gate #define F_CTL_CONTINUE_SEQ 0x0000C0 /* always 0 */ 156*0Sstevel@tonic-gate #define F_CTL_ABORT_SEQ 0x000030 /* always 0 */ 157*0Sstevel@tonic-gate #define F_CTL_RO_PRESENT 0x000008 /* 1 if param field == RO */ 158*0Sstevel@tonic-gate #define F_CTL_XCHG_REASSEMBLE 0x000004 /* always 0 */ 159*0Sstevel@tonic-gate #define F_CTL_FILL_BYTES 0x000003 /* # of fill bytes in this frame */ 160*0Sstevel@tonic-gate #define F_CTL_RESERVED 0x003F00 161*0Sstevel@tonic-gate #define F_CTL_ALWAYS_ZERO (F_CTL_RESERVED | F_CTL_XCHG_REASSEMBLE | \ 162*0Sstevel@tonic-gate F_CTL_ABORT_SEQ | F_CTL_CONTINUE_SEQ| F_CTL_INVALIDATE_XID | \ 163*0Sstevel@tonic-gate F_CTL_XID_REASSIGNED | F_CTL_CHAINED_SEQ | F_CTL_END_CONNECT) 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate /* Well known addresses ... */ 166*0Sstevel@tonic-gate #define FS_GENERAL_MULTICAST 0xfffff7 167*0Sstevel@tonic-gate #define FS_WELL_KNOWN_MULTICAST 0xfffff8 168*0Sstevel@tonic-gate #define FS_HUNT_GROUP 0xfffff9 169*0Sstevel@tonic-gate #define FS_MANAGEMENT_SERVER 0xfffffa 170*0Sstevel@tonic-gate #define FS_TIME_SERVER 0xfffffb 171*0Sstevel@tonic-gate #define FS_NAME_SERVER 0xfffffc 172*0Sstevel@tonic-gate #define FS_FABRIC_CONTROLLER 0xfffffd 173*0Sstevel@tonic-gate #define FS_FABRIC_F_PORT 0xfffffe 174*0Sstevel@tonic-gate #define FS_BROADCAST 0xffffff 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate /* Fabric Busy Reason Codes */ 177*0Sstevel@tonic-gate #define FABRIC_BUSY 0x01 178*0Sstevel@tonic-gate #define NPORT_BUSY 0x03 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate /* NPort Busy Reason Codes */ 181*0Sstevel@tonic-gate #define PHYSICAL_BUSY 0x01 182*0Sstevel@tonic-gate #define RESOURSE_BUSY 0x03 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate /* Reject Reason Codes */ 185*0Sstevel@tonic-gate 186*0Sstevel@tonic-gate typedef struct FC2_RJT_PARAM { 187*0Sstevel@tonic-gate uchar_t rjt_action; 188*0Sstevel@tonic-gate uchar_t rjt_reason; 189*0Sstevel@tonic-gate uchar_t reserved[2]; 190*0Sstevel@tonic-gate } aFC2_RJT_PARAM; 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate #define INVALID_D_ID 0x01 193*0Sstevel@tonic-gate #define INVALID_S_ID 0x02 194*0Sstevel@tonic-gate #define NPORT_NOT_AVAIL_TEMP 0x03 195*0Sstevel@tonic-gate #define NPORT_NOT_AVAIL_PERM 0x04 196*0Sstevel@tonic-gate #define CLASS_NOT_SUPPORTED 0x05 197*0Sstevel@tonic-gate #define DELIMITER_ERROR 0x06 198*0Sstevel@tonic-gate #define TYPE_NOT_SUPPORTED 0x07 199*0Sstevel@tonic-gate #define INVALID_LINK_CONTROL 0x08 200*0Sstevel@tonic-gate #define INVALID_R_CTL 0x09 201*0Sstevel@tonic-gate #define INVALID_F_CTL 0x0a 202*0Sstevel@tonic-gate #define INVALID_OX_ID 0x0b 203*0Sstevel@tonic-gate #define INVALID_RX_ID 0x0c 204*0Sstevel@tonic-gate #define INVALID_SEQ_ID 0x0d 205*0Sstevel@tonic-gate #define INVALID_DF_CTL 0x0e 206*0Sstevel@tonic-gate #define INVALID_SEQ_CNT 0x0f 207*0Sstevel@tonic-gate #define INVALID_PARAMETER 0x10 208*0Sstevel@tonic-gate #define EXCHANGE_ERROR 0x11 209*0Sstevel@tonic-gate #define PROTOCOL_ERROR 0x12 210*0Sstevel@tonic-gate #define INCORRECT_LENGTH 0x13 211*0Sstevel@tonic-gate #define UNEXPECTED_ACK 0x14 212*0Sstevel@tonic-gate #define UNEXPECTED_LINK_RESP 0x15 213*0Sstevel@tonic-gate #define LOGIN_REQUIRED 0x16 214*0Sstevel@tonic-gate #define EXCESSIVE_SEQUENCES 0x17 215*0Sstevel@tonic-gate #define CANT_ESTABLISH_EXCHANGE 0x18 216*0Sstevel@tonic-gate #define SECURITY_NOT_SUPPORTED 0x19 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate /* BA_RJT and LS_RJT reason codes */ 219*0Sstevel@tonic-gate #define RJT_INVALID_CMD_CODE 0x01 220*0Sstevel@tonic-gate #define RJT_LOGICAL_ERROR 0x03 221*0Sstevel@tonic-gate #define RJT_LOGICAL_BUSY 0x05 222*0Sstevel@tonic-gate #define RJT_PROTOCOL_ERR 0x07 223*0Sstevel@tonic-gate #define RJT_CANT_PERFORM_RQST 0x09 224*0Sstevel@tonic-gate #define RJT_CMD_NOT_SUPPORTED 0x0b 225*0Sstevel@tonic-gate 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate /* 228*0Sstevel@tonic-gate * Frame Payloads that the SOC understands 229*0Sstevel@tonic-gate * Transfer Ready: 230*0Sstevel@tonic-gate */ 231*0Sstevel@tonic-gate 232*0Sstevel@tonic-gate typedef struct Xfer_Rdy { 233*0Sstevel@tonic-gate int seq_ro; 234*0Sstevel@tonic-gate int burst_len; 235*0Sstevel@tonic-gate int reserved; 236*0Sstevel@tonic-gate } aXFER_RDY, *XFER_RDYptr; 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate /* 239*0Sstevel@tonic-gate * Link Error Status Block 240*0Sstevel@tonic-gate */ 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate typedef struct LA_RLS_reply { 243*0Sstevel@tonic-gate int code; 244*0Sstevel@tonic-gate int link_failure; 245*0Sstevel@tonic-gate int loss_of_sync; 246*0Sstevel@tonic-gate int loss_of_signal; 247*0Sstevel@tonic-gate int primitive_error; 248*0Sstevel@tonic-gate int code_violations; 249*0Sstevel@tonic-gate int invalid_crc; 250*0Sstevel@tonic-gate } aLA_RLS_reply, *LA_RLS_replyptr; 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate 253*0Sstevel@tonic-gate /* 254*0Sstevel@tonic-gate * Login 255*0Sstevel@tonic-gate */ 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate typedef struct LOGI_PAYLOAD { 258*0Sstevel@tonic-gate uint_t code; 259*0Sstevel@tonic-gate uchar_t common_service_params[16]; 260*0Sstevel@tonic-gate uchar_t port_name[8]; 261*0Sstevel@tonic-gate uchar_t node_name[8]; 262*0Sstevel@tonic-gate uchar_t class1_service_params[16]; 263*0Sstevel@tonic-gate uchar_t class2_service_params[16]; 264*0Sstevel@tonic-gate uchar_t class3_service_params[16]; 265*0Sstevel@tonic-gate } aLOGI_PAYLOAD, *LOGI_PAYLOADptr; 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate #define SP_F_PORT_LOGIN 0x10 268*0Sstevel@tonic-gate 269*0Sstevel@tonic-gate 270*0Sstevel@tonic-gate /* 271*0Sstevel@tonic-gate * Extended Link Service Payload 272*0Sstevel@tonic-gate */ 273*0Sstevel@tonic-gate 274*0Sstevel@tonic-gate /* Arbitrary upper limit for now... */ 275*0Sstevel@tonic-gate #define FC_MAX_ELS (60-4) 276*0Sstevel@tonic-gate 277*0Sstevel@tonic-gate typedef struct ELS_payload { 278*0Sstevel@tonic-gate union els_cmd_u { 279*0Sstevel@tonic-gate struct { 280*0Sstevel@tonic-gate uchar_t ls_command; 281*0Sstevel@tonic-gate uchar_t reserved[3]; 282*0Sstevel@tonic-gate } c; 283*0Sstevel@tonic-gate uint_t i; 284*0Sstevel@tonic-gate } els_cmd; 285*0Sstevel@tonic-gate uchar_t els_data[FC_MAX_ELS]; 286*0Sstevel@tonic-gate } els_payload_t; 287*0Sstevel@tonic-gate 288*0Sstevel@tonic-gate /* 289*0Sstevel@tonic-gate * NOTE: This dataseg definition makes this file unique 290*0Sstevel@tonic-gate * from the Pluto fc_ph file. 291*0Sstevel@tonic-gate */ 292*0Sstevel@tonic-gate 293*0Sstevel@tonic-gate /* 294*0Sstevel@tonic-gate * Data segment definition 295*0Sstevel@tonic-gate */ 296*0Sstevel@tonic-gate typedef struct fc_dataseg { 297*0Sstevel@tonic-gate uint32_t fc_base; /* Address of buffer. */ 298*0Sstevel@tonic-gate uint32_t fc_count; /* Length of buffer. */ 299*0Sstevel@tonic-gate } fc_dataseg_t; 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate #ifdef __cplusplus 302*0Sstevel@tonic-gate } 303*0Sstevel@tonic-gate #endif 304*0Sstevel@tonic-gate 305*0Sstevel@tonic-gate #endif /* !_SYS_FC4_FC_H */ 306