1*7836SJohn.Forte@Sun.COM /* 2*7836SJohn.Forte@Sun.COM * CDDL HEADER START 3*7836SJohn.Forte@Sun.COM * 4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 7*7836SJohn.Forte@Sun.COM * 8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 11*7836SJohn.Forte@Sun.COM * and limitations under the License. 12*7836SJohn.Forte@Sun.COM * 13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7836SJohn.Forte@Sun.COM * 19*7836SJohn.Forte@Sun.COM * CDDL HEADER END 20*7836SJohn.Forte@Sun.COM */ 21*7836SJohn.Forte@Sun.COM /* 22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*7836SJohn.Forte@Sun.COM * Use is subject to license terms. 24*7836SJohn.Forte@Sun.COM */ 25*7836SJohn.Forte@Sun.COM 26*7836SJohn.Forte@Sun.COM #ifndef _SYS_FIBRE_CHANNEL_IMPL_FCPH_H 27*7836SJohn.Forte@Sun.COM #define _SYS_FIBRE_CHANNEL_IMPL_FCPH_H 28*7836SJohn.Forte@Sun.COM 29*7836SJohn.Forte@Sun.COM 30*7836SJohn.Forte@Sun.COM #include <sys/note.h> 31*7836SJohn.Forte@Sun.COM 32*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 33*7836SJohn.Forte@Sun.COM extern "C" { 34*7836SJohn.Forte@Sun.COM #endif 35*7836SJohn.Forte@Sun.COM 36*7836SJohn.Forte@Sun.COM #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL) 37*7836SJohn.Forte@Sun.COM #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 38*7836SJohn.Forte@Sun.COM #endif /* _BIT_FIELDS_LTOH */ 39*7836SJohn.Forte@Sun.COM 40*7836SJohn.Forte@Sun.COM /* legal values for r_ctl */ 41*7836SJohn.Forte@Sun.COM #define R_CTL_ROUTING 0xF0 /* mask for routing bits */ 42*7836SJohn.Forte@Sun.COM #define R_CTL_INFO 0x0F /* mask for information bits */ 43*7836SJohn.Forte@Sun.COM 44*7836SJohn.Forte@Sun.COM #define R_CTL_DEVICE_DATA 0x00 /* all I/O related frames */ 45*7836SJohn.Forte@Sun.COM #define R_CTL_EXTENDED_SVC 0x20 /* extended link services (PLOGI) */ 46*7836SJohn.Forte@Sun.COM #define R_CTL_FC4_SVC 0x30 /* FC-4 link services (FCP_LOGI) */ 47*7836SJohn.Forte@Sun.COM #define R_CTL_VIDEO_BUFF 0x40 /* not yet defined */ 48*7836SJohn.Forte@Sun.COM #define R_CTL_BASIC_SVC 0x80 /* basic link services (NOP) */ 49*7836SJohn.Forte@Sun.COM #define R_CTL_LINK_CTL 0xC0 /* ACKs, etc. */ 50*7836SJohn.Forte@Sun.COM 51*7836SJohn.Forte@Sun.COM /* legal values for r_ctl: Device Data */ 52*7836SJohn.Forte@Sun.COM #define R_CTL_UNCATEGORIZED 0x00 53*7836SJohn.Forte@Sun.COM #define R_CTL_SOLICITED_DATA 0x01 54*7836SJohn.Forte@Sun.COM #define R_CTL_UNSOL_CONTROL 0x02 55*7836SJohn.Forte@Sun.COM #define R_CTL_SOLICITED_CONTROL 0x03 56*7836SJohn.Forte@Sun.COM #define R_CTL_UNSOL_DATA 0x04 57*7836SJohn.Forte@Sun.COM #define R_CTL_XFER_RDY 0x05 58*7836SJohn.Forte@Sun.COM #define R_CTL_COMMAND 0x06 59*7836SJohn.Forte@Sun.COM #define R_CTL_STATUS 0x07 60*7836SJohn.Forte@Sun.COM 61*7836SJohn.Forte@Sun.COM /* legal values for r_ctl: Basic Link Services, type 0 */ 62*7836SJohn.Forte@Sun.COM #define R_CTL_LS_NOP 0x80 63*7836SJohn.Forte@Sun.COM #define R_CTL_LS_ABTS 0x81 64*7836SJohn.Forte@Sun.COM #define R_CTL_LS_RMC 0x82 65*7836SJohn.Forte@Sun.COM #define R_CTL_LS_BA_ACC 0x84 66*7836SJohn.Forte@Sun.COM #define R_CTL_LS_BA_RJT 0x85 67*7836SJohn.Forte@Sun.COM 68*7836SJohn.Forte@Sun.COM /* legal values for r_ctl: Extended Link Services, type 1 */ 69*7836SJohn.Forte@Sun.COM #define R_CTL_ELS_REQ 0x22 70*7836SJohn.Forte@Sun.COM #define R_CTL_ELS_RSP 0x23 71*7836SJohn.Forte@Sun.COM 72*7836SJohn.Forte@Sun.COM /* legal values for r_ctl: Link Control */ 73*7836SJohn.Forte@Sun.COM #define R_CTL_ACK_1 0xC0 74*7836SJohn.Forte@Sun.COM #define R_CTL_ACK_N 0xC1 75*7836SJohn.Forte@Sun.COM #define R_CTL_P_RJT 0xC2 76*7836SJohn.Forte@Sun.COM #define R_CTL_F_RJT 0xC3 77*7836SJohn.Forte@Sun.COM #define R_CTL_P_BSY 0xC4 78*7836SJohn.Forte@Sun.COM #define R_CTL_F_BSY_DF 0xC5 79*7836SJohn.Forte@Sun.COM #define R_CTL_F_BSY_LC 0xC6 80*7836SJohn.Forte@Sun.COM #define R_CTL_LCR 0xC7 81*7836SJohn.Forte@Sun.COM 82*7836SJohn.Forte@Sun.COM /* type field definitions for Link Data frames: */ 83*7836SJohn.Forte@Sun.COM #define FC_TYPE_BASIC_LS 0x00 84*7836SJohn.Forte@Sun.COM #define FC_TYPE_EXTENDED_LS 0x01 85*7836SJohn.Forte@Sun.COM 86*7836SJohn.Forte@Sun.COM /* type field definitions for Device Data frames (from FC-PH 4.1): */ 87*7836SJohn.Forte@Sun.COM #define FC_TYPE_IS8802 0x04 88*7836SJohn.Forte@Sun.COM #define FC_TYPE_IS8802_SNAP 0x05 89*7836SJohn.Forte@Sun.COM #define FC_TYPE_SCSI_FCP 0x08 90*7836SJohn.Forte@Sun.COM #define FC_TYPE_SCSI_GPP 0x09 91*7836SJohn.Forte@Sun.COM #define FC_TYPE_HIPP_FP 0x0a 92*7836SJohn.Forte@Sun.COM #define FC_TYPE_IPI3_MASTER 0x11 93*7836SJohn.Forte@Sun.COM #define FC_TYPE_IPI3_SLAVE 0x12 94*7836SJohn.Forte@Sun.COM #define FC_TYPE_IPI3_PEER 0x13 95*7836SJohn.Forte@Sun.COM #define FC_TYPE_FC_SERVICES 0x20 96*7836SJohn.Forte@Sun.COM 97*7836SJohn.Forte@Sun.COM #define F_CTL_XCHG_CONTEXT 0x800000 /* 0 if SID is XCHG originator */ 98*7836SJohn.Forte@Sun.COM #define F_CTL_SEQ_CONTEXT 0x400000 /* 0 if SID is SEQ initiator */ 99*7836SJohn.Forte@Sun.COM #define F_CTL_FIRST_SEQ 0x200000 /* 1 if first sequence of XCHG */ 100*7836SJohn.Forte@Sun.COM #define F_CTL_LAST_SEQ 0x100000 /* 1 if last SEQ of XCHG */ 101*7836SJohn.Forte@Sun.COM #define F_CTL_END_SEQ 0x080000 /* 1 if last frame of a SEQ */ 102*7836SJohn.Forte@Sun.COM #define F_CTL_END_CONNECT 0x040000 /* always 0 */ 103*7836SJohn.Forte@Sun.COM #define F_CTL_CHAINED_SEQ 0x020000 /* always 0 */ 104*7836SJohn.Forte@Sun.COM #define F_CTL_SEQ_INITIATIVE 0x010000 /* when 1 xfrs SEQ initiative */ 105*7836SJohn.Forte@Sun.COM #define F_CTL_XID_REASSIGNED 0x008000 /* always 0 */ 106*7836SJohn.Forte@Sun.COM #define F_CTL_INVALIDATE_XID 0x004000 /* always 0 */ 107*7836SJohn.Forte@Sun.COM #define F_CTL_CONTINUE_SEQ 0x0000C0 /* always 0 */ 108*7836SJohn.Forte@Sun.COM #define F_CTL_ABORT_SEQ 0x000030 /* always 0 */ 109*7836SJohn.Forte@Sun.COM #define F_CTL_RO_PRESENT 0x000008 /* 1 if param field == RO */ 110*7836SJohn.Forte@Sun.COM #define F_CTL_XCHG_REASSEMBLE 0x000004 /* always 0 */ 111*7836SJohn.Forte@Sun.COM #define F_CTL_FILL_BYTES 0x000003 /* # of fill bytes in this frame */ 112*7836SJohn.Forte@Sun.COM #define F_CTL_RESERVED 0x003F00 113*7836SJohn.Forte@Sun.COM 114*7836SJohn.Forte@Sun.COM /* values for DF_CTL */ 115*7836SJohn.Forte@Sun.COM #define DF_CTL_EXT_FR_HDR 0x80 116*7836SJohn.Forte@Sun.COM #define DF_CTL_EXP_SEC_HDR 0x40 117*7836SJohn.Forte@Sun.COM #define DF_CTL_NET_HDR 0x20 118*7836SJohn.Forte@Sun.COM #define DF_CTL_ASSOC_HDR 0x10 119*7836SJohn.Forte@Sun.COM #define DF_CTL_RESERVED 0x0C 120*7836SJohn.Forte@Sun.COM #define DF_CTL_DEV_HDR_16 0x01 121*7836SJohn.Forte@Sun.COM #define DF_CTL_DEV_HDR_32 0x02 122*7836SJohn.Forte@Sun.COM #define DF_CTL_DEV_HDR_64 0x03 123*7836SJohn.Forte@Sun.COM #define DF_CTL_NO_DEV_HDR 0x00 124*7836SJohn.Forte@Sun.COM 125*7836SJohn.Forte@Sun.COM /* Well known addresses ... */ 126*7836SJohn.Forte@Sun.COM #define NPORT_ID_DOM_CTLR_START 0xFFFC01 /* N_Port IDs for domain controller */ 127*7836SJohn.Forte@Sun.COM #define NPORT_ID_DOM_CTLR_END 0xFFFCFE 128*7836SJohn.Forte@Sun.COM 129*7836SJohn.Forte@Sun.COM #define FS_GENERAL_MULTICAST 0xFFFFF7 130*7836SJohn.Forte@Sun.COM #define FS_WELL_KNOWN_MULTICAST 0xFFFFF8 131*7836SJohn.Forte@Sun.COM #define FS_HUNT_GROUP 0xFFFFF9 132*7836SJohn.Forte@Sun.COM #define FS_MANAGEMENT_SERVER 0xFFFFFA 133*7836SJohn.Forte@Sun.COM #define FS_TIME_SERVER 0xFFFFFB 134*7836SJohn.Forte@Sun.COM #define FS_NAME_SERVER 0xFFFFFC 135*7836SJohn.Forte@Sun.COM #define FS_FABRIC_CONTROLLER 0xFFFFFD 136*7836SJohn.Forte@Sun.COM #define FS_FABRIC_F_PORT 0xFFFFFE 137*7836SJohn.Forte@Sun.COM #define FS_BROADCAST 0xFFFFFF 138*7836SJohn.Forte@Sun.COM 139*7836SJohn.Forte@Sun.COM #define FC_WELL_KNOWN_START 0xFFFFF0 140*7836SJohn.Forte@Sun.COM #define FC_WELL_KNOWN_END 0xFFFFFF 141*7836SJohn.Forte@Sun.COM #define FC_WELL_KNOWN_ADDR(x) (((x) >= FC_WELL_KNOWN_START &&\ 142*7836SJohn.Forte@Sun.COM (x) <= FC_WELL_KNOWN_END) || \ 143*7836SJohn.Forte@Sun.COM ((x) >= NPORT_ID_DOM_CTLR_START && \ 144*7836SJohn.Forte@Sun.COM (x) <= NPORT_ID_DOM_CTLR_END)) 145*7836SJohn.Forte@Sun.COM 146*7836SJohn.Forte@Sun.COM /* 147*7836SJohn.Forte@Sun.COM * frame header 148*7836SJohn.Forte@Sun.COM */ 149*7836SJohn.Forte@Sun.COM typedef struct frame_header { 150*7836SJohn.Forte@Sun.COM 151*7836SJohn.Forte@Sun.COM #if defined(_BIT_FIELDS_LTOH) 152*7836SJohn.Forte@Sun.COM uint32_t d_id : 24, 153*7836SJohn.Forte@Sun.COM r_ctl : 8; 154*7836SJohn.Forte@Sun.COM uint32_t s_id : 24, 155*7836SJohn.Forte@Sun.COM rsvd : 8; 156*7836SJohn.Forte@Sun.COM uint32_t f_ctl : 24, 157*7836SJohn.Forte@Sun.COM type : 8; 158*7836SJohn.Forte@Sun.COM uint32_t seq_cnt : 16, 159*7836SJohn.Forte@Sun.COM df_ctl : 8, 160*7836SJohn.Forte@Sun.COM seq_id : 8; 161*7836SJohn.Forte@Sun.COM uint32_t rx_id : 16, 162*7836SJohn.Forte@Sun.COM ox_id : 16; 163*7836SJohn.Forte@Sun.COM uint32_t ro; 164*7836SJohn.Forte@Sun.COM 165*7836SJohn.Forte@Sun.COM #else 166*7836SJohn.Forte@Sun.COM uint32_t r_ctl : 8, 167*7836SJohn.Forte@Sun.COM d_id : 24; 168*7836SJohn.Forte@Sun.COM uint32_t rsvd : 8, 169*7836SJohn.Forte@Sun.COM s_id : 24; 170*7836SJohn.Forte@Sun.COM uint32_t type : 8, 171*7836SJohn.Forte@Sun.COM f_ctl : 24; 172*7836SJohn.Forte@Sun.COM uint32_t seq_id : 8, 173*7836SJohn.Forte@Sun.COM df_ctl : 8, 174*7836SJohn.Forte@Sun.COM seq_cnt : 16; 175*7836SJohn.Forte@Sun.COM uint32_t ox_id : 16, 176*7836SJohn.Forte@Sun.COM rx_id : 16; 177*7836SJohn.Forte@Sun.COM uint32_t ro; 178*7836SJohn.Forte@Sun.COM #endif /* _BIT_FIELDS_LTOH */ 179*7836SJohn.Forte@Sun.COM } fc_frame_hdr_t; 180*7836SJohn.Forte@Sun.COM 181*7836SJohn.Forte@Sun.COM #if !defined(__lint) 182*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", frame_header)) 183*7836SJohn.Forte@Sun.COM #endif /* __lint */ 184*7836SJohn.Forte@Sun.COM 185*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 186*7836SJohn.Forte@Sun.COM } 187*7836SJohn.Forte@Sun.COM #endif 188*7836SJohn.Forte@Sun.COM 189*7836SJohn.Forte@Sun.COM #endif /* _SYS_FIBRE_CHANNEL_IMPL_FCPH_H */ 190