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