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 /* 31*7c478bd9Sstevel@tonic-gate * Frame format and protocol definitions for transferring 32*7c478bd9Sstevel@tonic-gate * commands and data between a SCSI initiator and target 33*7c478bd9Sstevel@tonic-gate * using an FC4 serial link interface. 34*7c478bd9Sstevel@tonic-gate */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 37*7c478bd9Sstevel@tonic-gate extern "C" { 38*7c478bd9Sstevel@tonic-gate #endif 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* 42*7c478bd9Sstevel@tonic-gate * FCP Device Data Frame Information Categories 43*7c478bd9Sstevel@tonic-gate */ 44*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_DATA 0x01 /* frame contains SCSI data */ 45*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_CMD 0x02 /* frame contains SCSI command */ 46*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_RSP 0x03 /* frame contains SCSI response */ 47*7c478bd9Sstevel@tonic-gate #define FCP_SCSI_XFER_RDY 0x05 /* frame contains xfer rdy block */ 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * FCP SCSI Control structure 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate typedef struct fcp_cntl { 54*7c478bd9Sstevel@tonic-gate uchar_t cntl_reserved_0; /* reserved */ 55*7c478bd9Sstevel@tonic-gate uchar_t cntl_reserved_1 : 5, /* reserved */ 56*7c478bd9Sstevel@tonic-gate cntl_qtype : 3; /* tagged queueing type */ 57*7c478bd9Sstevel@tonic-gate uchar_t cntl_kill_tsk : 1, /* terminate task */ 58*7c478bd9Sstevel@tonic-gate cntl_clr_aca : 1, /* clear aca */ 59*7c478bd9Sstevel@tonic-gate cntl_reset : 1, /* reset */ 60*7c478bd9Sstevel@tonic-gate cntl_reserved_2 : 2, /* reserved */ 61*7c478bd9Sstevel@tonic-gate cntl_clr_tsk : 1, /* clear task set */ 62*7c478bd9Sstevel@tonic-gate cntl_abort_tsk : 1, /* abort task set */ 63*7c478bd9Sstevel@tonic-gate cntl_reserved_3 : 1; /* reserved */ 64*7c478bd9Sstevel@tonic-gate uchar_t cntl_reserved_4 : 6, /* reserved */ 65*7c478bd9Sstevel@tonic-gate cntl_read_data : 1, /* initiator read */ 66*7c478bd9Sstevel@tonic-gate cntl_write_data : 1; /* initiator write */ 67*7c478bd9Sstevel@tonic-gate } fcp_cntl_t; 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate /* 70*7c478bd9Sstevel@tonic-gate * FCP SCSI Control Tagged Queueing types - cntl_qtype 71*7c478bd9Sstevel@tonic-gate */ 72*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_SIMPLE 0 /* simple queueing */ 73*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_HEAD_OF_Q 1 /* head of queue */ 74*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_ORDERED 2 /* ordered queueing */ 75*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_ACA_Q_TAG 4 /* ACA queueing */ 76*7c478bd9Sstevel@tonic-gate #define FCP_QTYPE_UNTAGGED 5 /* Untagged */ 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate /* 80*7c478bd9Sstevel@tonic-gate * FCP SCSI Entity Address 81*7c478bd9Sstevel@tonic-gate * 82*7c478bd9Sstevel@tonic-gate * ent_addr_0 is always the first and highest layer of 83*7c478bd9Sstevel@tonic-gate * the hierarchy. The depth of the hierarchy of addressing, 84*7c478bd9Sstevel@tonic-gate * up to a maximum of four layers, is arbitrary and 85*7c478bd9Sstevel@tonic-gate * device-dependent. 86*7c478bd9Sstevel@tonic-gate */ 87*7c478bd9Sstevel@tonic-gate typedef struct fcp_ent_addr { 88*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_0; /* entity address 0 */ 89*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_1; /* entity address 1 */ 90*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_2; /* entity address 2 */ 91*7c478bd9Sstevel@tonic-gate ushort_t ent_addr_3; /* entity address 3 */ 92*7c478bd9Sstevel@tonic-gate } fcp_ent_addr_t; 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate /* 96*7c478bd9Sstevel@tonic-gate * Maximum size of SCSI cdb in FCP SCSI command 97*7c478bd9Sstevel@tonic-gate */ 98*7c478bd9Sstevel@tonic-gate #define FCP_CDB_SIZE 16 99*7c478bd9Sstevel@tonic-gate #define FCP_LUN_SIZE 8 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate /* 102*7c478bd9Sstevel@tonic-gate * FCP SCSI command payload 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate typedef struct fcp_cmd { 105*7c478bd9Sstevel@tonic-gate fcp_ent_addr_t fcp_ent_addr; /* entity address */ 106*7c478bd9Sstevel@tonic-gate fcp_cntl_t fcp_cntl; /* SCSI options */ 107*7c478bd9Sstevel@tonic-gate uchar_t fcp_cdb[FCP_CDB_SIZE]; /* SCSI cdb */ 108*7c478bd9Sstevel@tonic-gate int fcp_data_len; /* data length */ 109*7c478bd9Sstevel@tonic-gate } fcp_cmd_t; 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * FCP SCSI status 114*7c478bd9Sstevel@tonic-gate */ 115*7c478bd9Sstevel@tonic-gate typedef struct fcp_status { 116*7c478bd9Sstevel@tonic-gate ushort_t reserved_0; /* reserved */ 117*7c478bd9Sstevel@tonic-gate uchar_t reserved_1 : 4, /* reserved */ 118*7c478bd9Sstevel@tonic-gate resid_under : 1, /* resid non-zero */ 119*7c478bd9Sstevel@tonic-gate resid_over : 1, /* resid non-zero */ 120*7c478bd9Sstevel@tonic-gate sense_len_set : 1, /* sense_len non-zero */ 121*7c478bd9Sstevel@tonic-gate rsp_len_set : 1; /* response_len non-zero */ 122*7c478bd9Sstevel@tonic-gate uchar_t scsi_status; /* status of cmd */ 123*7c478bd9Sstevel@tonic-gate } fcp_status_t; 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate #define resid_len_set resid_over /* for pln */ 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate /* 129*7c478bd9Sstevel@tonic-gate * FCP SCSI Response Payload 130*7c478bd9Sstevel@tonic-gate */ 131*7c478bd9Sstevel@tonic-gate typedef struct fcp_rsp { 132*7c478bd9Sstevel@tonic-gate uint_t reserved_0; /* reserved */ 133*7c478bd9Sstevel@tonic-gate uint_t reserved_1; /* reserved */ 134*7c478bd9Sstevel@tonic-gate union { 135*7c478bd9Sstevel@tonic-gate fcp_status_t fcp_status; /* command status */ 136*7c478bd9Sstevel@tonic-gate uint_t i_fcp_status; 137*7c478bd9Sstevel@tonic-gate }fcp_u; 138*7c478bd9Sstevel@tonic-gate uint_t fcp_resid; /* resid of operation */ 139*7c478bd9Sstevel@tonic-gate uint_t fcp_sense_len; /* sense data length */ 140*7c478bd9Sstevel@tonic-gate uint_t fcp_response_len; /* response data length */ 141*7c478bd9Sstevel@tonic-gate /* 142*7c478bd9Sstevel@tonic-gate * 'm' bytes of scsi response info follow 143*7c478bd9Sstevel@tonic-gate * 'n' bytes of scsi sense info follow 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate } fcp_rsp_t; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate #define FCP_MAX_RSP_IU_SIZE 256 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate /* 150*7c478bd9Sstevel@tonic-gate * FCP RSP_INFO field format 151*7c478bd9Sstevel@tonic-gate */ 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate struct fcp_rsp_info { 154*7c478bd9Sstevel@tonic-gate uchar_t resvd1; 155*7c478bd9Sstevel@tonic-gate uchar_t resvd2; 156*7c478bd9Sstevel@tonic-gate uchar_t resvd3; 157*7c478bd9Sstevel@tonic-gate uchar_t rsp_code; 158*7c478bd9Sstevel@tonic-gate uchar_t resvd4; 159*7c478bd9Sstevel@tonic-gate uchar_t resvd5; 160*7c478bd9Sstevel@tonic-gate uchar_t resvd6; 161*7c478bd9Sstevel@tonic-gate uchar_t resvd7; 162*7c478bd9Sstevel@tonic-gate }; 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate /* RSP_CODE definitions */ 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate #define FCP_NO_FAILURE 0x0 167*7c478bd9Sstevel@tonic-gate #define FCP_DL_LEN_MISMATCH 0x1 168*7c478bd9Sstevel@tonic-gate #define FCP_CMND_INVALID 0x2 169*7c478bd9Sstevel@tonic-gate #define FCP_DATA_RO_MISMATCH 0x3 170*7c478bd9Sstevel@tonic-gate #define FCP_TASK_MGMT_NOT_SUPPTD 0x4 171*7c478bd9Sstevel@tonic-gate #define FCP_TASK_MGMT_FAILED 0x5 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate /* 175*7c478bd9Sstevel@tonic-gate * FCP SCSI_ XFER_RDY Payload 176*7c478bd9Sstevel@tonic-gate */ 177*7c478bd9Sstevel@tonic-gate typedef struct fcp_xfer_rdy { 178*7c478bd9Sstevel@tonic-gate ulong_t fcp_seq_offset; /* relative offset */ 179*7c478bd9Sstevel@tonic-gate ulong_t fcp_burst_len; /* buffer space */ 180*7c478bd9Sstevel@tonic-gate ulong_t reserved; /* reserved */ 181*7c478bd9Sstevel@tonic-gate } fcp_xfer_rdy_t; 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate /* 184*7c478bd9Sstevel@tonic-gate * FCP PRLI Payload 185*7c478bd9Sstevel@tonic-gate */ 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate struct fcp_prli { 188*7c478bd9Sstevel@tonic-gate uchar_t type; 189*7c478bd9Sstevel@tonic-gate uchar_t resvd1; 190*7c478bd9Sstevel@tonic-gate uint_t orig_process_assoc_valid:1; 191*7c478bd9Sstevel@tonic-gate uint_t resp_process_assoc_valid:1; 192*7c478bd9Sstevel@tonic-gate uint_t establish_image_pair:1; 193*7c478bd9Sstevel@tonic-gate uint_t resvd2:13; 194*7c478bd9Sstevel@tonic-gate uint_t orig_process_associator; 195*7c478bd9Sstevel@tonic-gate uint_t resp_process_associator; 196*7c478bd9Sstevel@tonic-gate uint_t resvd3:25; 197*7c478bd9Sstevel@tonic-gate uint_t data_overlay_allowed:1; 198*7c478bd9Sstevel@tonic-gate uint_t initiator_fn:1; 199*7c478bd9Sstevel@tonic-gate uint_t target_fn:1; 200*7c478bd9Sstevel@tonic-gate uint_t cmd_data_mixed:1; 201*7c478bd9Sstevel@tonic-gate uint_t data_resp_mixed:1; 202*7c478bd9Sstevel@tonic-gate uint_t read_xfer_rdy_disabled:1; 203*7c478bd9Sstevel@tonic-gate uint_t write_xfer_rdy_disabled:1; 204*7c478bd9Sstevel@tonic-gate }; 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate /* 207*7c478bd9Sstevel@tonic-gate * FCP PRLI ACC Payload 208*7c478bd9Sstevel@tonic-gate */ 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate struct fcp_prli_acc { 211*7c478bd9Sstevel@tonic-gate uchar_t type; 212*7c478bd9Sstevel@tonic-gate uchar_t resvd1; 213*7c478bd9Sstevel@tonic-gate uint_t orig_process_assoc_valid:1; 214*7c478bd9Sstevel@tonic-gate uint_t resp_process_assoc_valid:1; 215*7c478bd9Sstevel@tonic-gate uint_t image_pair_establsihed:1; 216*7c478bd9Sstevel@tonic-gate uint_t resvd2:1; 217*7c478bd9Sstevel@tonic-gate uint_t accept_response_code:4; 218*7c478bd9Sstevel@tonic-gate uint_t resvd3:8; 219*7c478bd9Sstevel@tonic-gate uint_t orig_process_associator; 220*7c478bd9Sstevel@tonic-gate uint_t resp_process_associator; 221*7c478bd9Sstevel@tonic-gate uint_t resvd4:26; 222*7c478bd9Sstevel@tonic-gate uint_t initiator_fn:1; 223*7c478bd9Sstevel@tonic-gate uint_t target_fn:1; 224*7c478bd9Sstevel@tonic-gate uint_t cmd_data_mixed:1; 225*7c478bd9Sstevel@tonic-gate uint_t data_resp_mixed:1; 226*7c478bd9Sstevel@tonic-gate uint_t read_xfer_rdy_disabled:1; 227*7c478bd9Sstevel@tonic-gate uint_t write_xfer_rdy_disabled:1; 228*7c478bd9Sstevel@tonic-gate }; 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 232*7c478bd9Sstevel@tonic-gate } 233*7c478bd9Sstevel@tonic-gate #endif 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate #endif /* _SYS_FC4_FCP_H */ 236