1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_FC4_FCP_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_FC4_FCP_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * Frame format and protocol definitions for transferring 34*7c478bd9Sstevel@tonic-gate * commands and data between a SCSI initiator and target 35*7c478bd9Sstevel@tonic-gate * using an FC4 serial link interface. 36*7c478bd9Sstevel@tonic-gate */ 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 39*7c478bd9Sstevel@tonic-gate extern "C" { 40*7c478bd9Sstevel@tonic-gate #endif 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* 44*7c478bd9Sstevel@tonic-gate * FCP Device Data Frame Information Categories 45*7c478bd9Sstevel@tonic-gate */ 46*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_DATA 0x01 /* frame contains SCSI data */ 47*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_CMD 0x02 /* frame contains SCSI command */ 48*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_RSP 0x03 /* frame contains SCSI response */ 49*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_XFER_RDY 0x05 /* frame contains xfer rdy block */ 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate /* 53*7c478bd9Sstevel@tonic-gate * FCP SCSI Control structure 54*7c478bd9Sstevel@tonic-gate */ 55*7c478bd9Sstevel@tonic-gate typedef struct fcp_cntl { 56*7c478bd9Sstevel@tonic-gate uchar_t cntl_reserved_0; /* reserved */ 57*7c478bd9Sstevel@tonic-gate uchar_t cntl_reserved_1 : 5, /* reserved */ 58*7c478bd9Sstevel@tonic-gate cntl_qtype : 3; /* tagged queueing type */ 59*7c478bd9Sstevel@tonic-gate uchar_t cntl_kill_tsk : 1, /* terminate task */ 60*7c478bd9Sstevel@tonic-gate cntl_clr_aca : 1, /* clear aca */ 61*7c478bd9Sstevel@tonic-gate cntl_reset : 1, /* reset */ 62*7c478bd9Sstevel@tonic-gate cntl_reserved_2 : 2, /* reserved */ 63*7c478bd9Sstevel@tonic-gate cntl_clr_tsk : 1, /* clear task set */ 64*7c478bd9Sstevel@tonic-gate cntl_abort_tsk : 1, /* abort task set */ 65*7c478bd9Sstevel@tonic-gate cntl_reserved_3 : 1; /* reserved */ 66*7c478bd9Sstevel@tonic-gate uchar_t cntl_reserved_4 : 6, /* reserved */ 67*7c478bd9Sstevel@tonic-gate cntl_read_data : 1, /* initiator read */ 68*7c478bd9Sstevel@tonic-gate cntl_write_data : 1; /* initiator write */ 69*7c478bd9Sstevel@tonic-gate } fcp_cntl_t; 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate /* 72*7c478bd9Sstevel@tonic-gate * FCP SCSI Control Tagged Queueing types - cntl_qtype 73*7c478bd9Sstevel@tonic-gate */ 74*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_SIMPLE 0 /* simple queueing */ 75*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_HEAD_OF_Q 1 /* head of queue */ 76*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_ORDERED 2 /* ordered queueing */ 77*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_ACA_Q_TAG 4 /* ACA queueing */ 78*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_UNTAGGED 5 /* Untagged */ 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate /* 82*7c478bd9Sstevel@tonic-gate * FCP SCSI Entity Address 83*7c478bd9Sstevel@tonic-gate * 84*7c478bd9Sstevel@tonic-gate * ent_addr_0 is always the first and highest layer of 85*7c478bd9Sstevel@tonic-gate * the hierarchy. The depth of the hierarchy of addressing, 86*7c478bd9Sstevel@tonic-gate * up to a maximum of four layers, is arbitrary and 87*7c478bd9Sstevel@tonic-gate * device-dependent. 88*7c478bd9Sstevel@tonic-gate */ 89*7c478bd9Sstevel@tonic-gate typedef struct fcp_ent_addr { 90*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_0; /* entity address 0 */ 91*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_1; /* entity address 1 */ 92*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_2; /* entity address 2 */ 93*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_3; /* entity address 3 */ 94*7c478bd9Sstevel@tonic-gate } fcp_ent_addr_t; 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate /* 98*7c478bd9Sstevel@tonic-gate * Maximum size of SCSI cdb in FCP SCSI command 99*7c478bd9Sstevel@tonic-gate */ 100*7c478bd9Sstevel@tonic-gate #define FCP_CDB_SIZE 16 101*7c478bd9Sstevel@tonic-gate #define FCP_LUN_SIZE 8 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate /* 104*7c478bd9Sstevel@tonic-gate * FCP SCSI command payload 105*7c478bd9Sstevel@tonic-gate */ 106*7c478bd9Sstevel@tonic-gate typedef struct fcp_cmd { 107*7c478bd9Sstevel@tonic-gate fcp_ent_addr_t fcp_ent_addr; /* entity address */ 108*7c478bd9Sstevel@tonic-gate fcp_cntl_t fcp_cntl; /* SCSI options */ 109*7c478bd9Sstevel@tonic-gate uchar_t fcp_cdb[FCP_CDB_SIZE]; /* SCSI cdb */ 110*7c478bd9Sstevel@tonic-gate int fcp_data_len; /* data length */ 111*7c478bd9Sstevel@tonic-gate } fcp_cmd_t; 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* 115*7c478bd9Sstevel@tonic-gate * FCP SCSI status 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate typedef struct fcp_status { 118*7c478bd9Sstevel@tonic-gate ushort_t reserved_0; /* reserved */ 119*7c478bd9Sstevel@tonic-gate uchar_t reserved_1 : 4, /* reserved */ 120*7c478bd9Sstevel@tonic-gate resid_under : 1, /* resid non-zero */ 121*7c478bd9Sstevel@tonic-gate resid_over : 1, /* resid non-zero */ 122*7c478bd9Sstevel@tonic-gate sense_len_set : 1, /* sense_len non-zero */ 123*7c478bd9Sstevel@tonic-gate rsp_len_set : 1; /* response_len non-zero */ 124*7c478bd9Sstevel@tonic-gate uchar_t scsi_status; /* status of cmd */ 125*7c478bd9Sstevel@tonic-gate } fcp_status_t; 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #define resid_len_set resid_over /* for pln */ 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate /* 131*7c478bd9Sstevel@tonic-gate * FCP SCSI Response Payload 132*7c478bd9Sstevel@tonic-gate */ 133*7c478bd9Sstevel@tonic-gate typedef struct fcp_rsp { 134*7c478bd9Sstevel@tonic-gate uint_t reserved_0; /* reserved */ 135*7c478bd9Sstevel@tonic-gate uint_t reserved_1; /* reserved */ 136*7c478bd9Sstevel@tonic-gate union { 137*7c478bd9Sstevel@tonic-gate fcp_status_t fcp_status; /* command status */ 138*7c478bd9Sstevel@tonic-gate uint_t i_fcp_status; 139*7c478bd9Sstevel@tonic-gate }fcp_u; 140*7c478bd9Sstevel@tonic-gate uint_t fcp_resid; /* resid of operation */ 141*7c478bd9Sstevel@tonic-gate uint_t fcp_sense_len; /* sense data length */ 142*7c478bd9Sstevel@tonic-gate uint_t fcp_response_len; /* response data length */ 143*7c478bd9Sstevel@tonic-gate /* 144*7c478bd9Sstevel@tonic-gate * 'm' bytes of scsi response info follow 145*7c478bd9Sstevel@tonic-gate * 'n' bytes of scsi sense info follow 146*7c478bd9Sstevel@tonic-gate */ 147*7c478bd9Sstevel@tonic-gate } fcp_rsp_t; 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate #define FCP_MAX_RSP_IU_SIZE 256 150*7c478bd9Sstevel@tonic-gate 151*7c478bd9Sstevel@tonic-gate /* 152*7c478bd9Sstevel@tonic-gate * FCP RSP_INFO field format 153*7c478bd9Sstevel@tonic-gate */ 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate struct fcp_rsp_info { 156*7c478bd9Sstevel@tonic-gate uchar_t resvd1; 157*7c478bd9Sstevel@tonic-gate uchar_t resvd2; 158*7c478bd9Sstevel@tonic-gate uchar_t resvd3; 159*7c478bd9Sstevel@tonic-gate uchar_t rsp_code; 160*7c478bd9Sstevel@tonic-gate uchar_t resvd4; 161*7c478bd9Sstevel@tonic-gate uchar_t resvd5; 162*7c478bd9Sstevel@tonic-gate uchar_t resvd6; 163*7c478bd9Sstevel@tonic-gate uchar_t resvd7; 164*7c478bd9Sstevel@tonic-gate }; 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate /* RSP_CODE definitions */ 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate #define FCP_NO_FAILURE 0x0 169*7c478bd9Sstevel@tonic-gate #define FCP_DL_LEN_MISMATCH 0x1 170*7c478bd9Sstevel@tonic-gate #define FCP_CMND_INVALID 0x2 171*7c478bd9Sstevel@tonic-gate #define FCP_DATA_RO_MISMATCH 0x3 172*7c478bd9Sstevel@tonic-gate #define FCP_TASK_MGMT_NOT_SUPPTD 0x4 173*7c478bd9Sstevel@tonic-gate #define FCP_TASK_MGMT_FAILED 0x5 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate /* 177*7c478bd9Sstevel@tonic-gate * FCP SCSI_ XFER_RDY Payload 178*7c478bd9Sstevel@tonic-gate */ 179*7c478bd9Sstevel@tonic-gate typedef struct fcp_xfer_rdy { 180*7c478bd9Sstevel@tonic-gate ulong_t fcp_seq_offset; /* relative offset */ 181*7c478bd9Sstevel@tonic-gate ulong_t fcp_burst_len; /* buffer space */ 182*7c478bd9Sstevel@tonic-gate ulong_t reserved; /* reserved */ 183*7c478bd9Sstevel@tonic-gate } fcp_xfer_rdy_t; 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate /* 186*7c478bd9Sstevel@tonic-gate * FCP PRLI Payload 187*7c478bd9Sstevel@tonic-gate */ 188*7c478bd9Sstevel@tonic-gate 189*7c478bd9Sstevel@tonic-gate struct fcp_prli { 190*7c478bd9Sstevel@tonic-gate uchar_t type; 191*7c478bd9Sstevel@tonic-gate uchar_t resvd1; 192*7c478bd9Sstevel@tonic-gate uint_t orig_process_assoc_valid:1; 193*7c478bd9Sstevel@tonic-gate uint_t resp_process_assoc_valid:1; 194*7c478bd9Sstevel@tonic-gate uint_t establish_image_pair:1; 195*7c478bd9Sstevel@tonic-gate uint_t resvd2:13; 196*7c478bd9Sstevel@tonic-gate uint_t orig_process_associator; 197*7c478bd9Sstevel@tonic-gate uint_t resp_process_associator; 198*7c478bd9Sstevel@tonic-gate uint_t resvd3:25; 199*7c478bd9Sstevel@tonic-gate uint_t data_overlay_allowed:1; 200*7c478bd9Sstevel@tonic-gate uint_t initiator_fn:1; 201*7c478bd9Sstevel@tonic-gate uint_t target_fn:1; 202*7c478bd9Sstevel@tonic-gate uint_t cmd_data_mixed:1; 203*7c478bd9Sstevel@tonic-gate uint_t data_resp_mixed:1; 204*7c478bd9Sstevel@tonic-gate uint_t read_xfer_rdy_disabled:1; 205*7c478bd9Sstevel@tonic-gate uint_t write_xfer_rdy_disabled:1; 206*7c478bd9Sstevel@tonic-gate }; 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate /* 209*7c478bd9Sstevel@tonic-gate * FCP PRLI ACC Payload 210*7c478bd9Sstevel@tonic-gate */ 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate struct fcp_prli_acc { 213*7c478bd9Sstevel@tonic-gate uchar_t type; 214*7c478bd9Sstevel@tonic-gate uchar_t resvd1; 215*7c478bd9Sstevel@tonic-gate uint_t orig_process_assoc_valid:1; 216*7c478bd9Sstevel@tonic-gate uint_t resp_process_assoc_valid:1; 217*7c478bd9Sstevel@tonic-gate uint_t image_pair_establsihed:1; 218*7c478bd9Sstevel@tonic-gate uint_t resvd2:1; 219*7c478bd9Sstevel@tonic-gate uint_t accept_response_code:4; 220*7c478bd9Sstevel@tonic-gate uint_t resvd3:8; 221*7c478bd9Sstevel@tonic-gate uint_t orig_process_associator; 222*7c478bd9Sstevel@tonic-gate uint_t resp_process_associator; 223*7c478bd9Sstevel@tonic-gate uint_t resvd4:26; 224*7c478bd9Sstevel@tonic-gate uint_t initiator_fn:1; 225*7c478bd9Sstevel@tonic-gate uint_t target_fn:1; 226*7c478bd9Sstevel@tonic-gate uint_t cmd_data_mixed:1; 227*7c478bd9Sstevel@tonic-gate uint_t data_resp_mixed:1; 228*7c478bd9Sstevel@tonic-gate uint_t read_xfer_rdy_disabled:1; 229*7c478bd9Sstevel@tonic-gate uint_t write_xfer_rdy_disabled:1; 230*7c478bd9Sstevel@tonic-gate }; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 234*7c478bd9Sstevel@tonic-gate } 235*7c478bd9Sstevel@tonic-gate #endif 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate #endif /* _SYS_FC4_FCP_H */ 238