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 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_FC4_FCAL_TRANSPORT_H 28*0Sstevel@tonic-gate #define _SYS_FC4_FCAL_TRANSPORT_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/fc4/fcal.h> 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #ifdef __cplusplus 35*0Sstevel@tonic-gate extern "C" { 36*0Sstevel@tonic-gate #endif 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate /* 39*0Sstevel@tonic-gate * fc_devdata_t definitions 40*0Sstevel@tonic-gate * 41*0Sstevel@tonic-gate * See fc.h for TYPE field definitions 42*0Sstevel@tonic-gate */ 43*0Sstevel@tonic-gate typedef int fc_devdata_t; 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate /* 46*0Sstevel@tonic-gate * fc_ioclass_t definitions. 47*0Sstevel@tonic-gate */ 48*0Sstevel@tonic-gate typedef enum { 49*0Sstevel@tonic-gate FC_CLASS_OUTBOUND, 50*0Sstevel@tonic-gate FC_CLASS_INBOUND, 51*0Sstevel@tonic-gate FC_CLASS_SIMPLE, 52*0Sstevel@tonic-gate FC_CLASS_IO_WRITE, 53*0Sstevel@tonic-gate FC_CLASS_IO_READ, 54*0Sstevel@tonic-gate FC_CLASS_OFFLINE, 55*0Sstevel@tonic-gate FC_CLASS_UNSOLICITED 56*0Sstevel@tonic-gate } fc_ioclass_t; 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate /* 59*0Sstevel@tonic-gate * fc_transport() sleep parameter 60*0Sstevel@tonic-gate */ 61*0Sstevel@tonic-gate typedef enum { 62*0Sstevel@tonic-gate FCAL_SLEEP, /* sleep on queue full */ 63*0Sstevel@tonic-gate FCAL_NOSLEEP /* do not sleep on queue full */ 64*0Sstevel@tonic-gate } fcal_sleep_t; 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate typedef struct fcal_packet { 67*0Sstevel@tonic-gate void *fcal_pkt_cookie; /* identifies which FC device */ 68*0Sstevel@tonic-gate struct fcal_packet *fcal_pkt_next; 69*0Sstevel@tonic-gate void (*fcal_pkt_comp)(struct fcal_packet *); 70*0Sstevel@tonic-gate void *fcal_pkt_private; 71*0Sstevel@tonic-gate uint_t fcal_pkt_flags; /* flags */ 72*0Sstevel@tonic-gate uint_t fcal_cmd_state; 73*0Sstevel@tonic-gate uint_t fcal_pkt_status; /* SOC Status when complete */ 74*0Sstevel@tonic-gate uint_t fcal_diag_status; /* used only for diagnostics */ 75*0Sstevel@tonic-gate union { 76*0Sstevel@tonic-gate soc_request_t req; 77*0Sstevel@tonic-gate longlong_t l; 78*0Sstevel@tonic-gate } w; 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate #define fcal_socal_request w.req 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate fc_frame_header_t fcal_resp_hdr; 83*0Sstevel@tonic-gate uint_t fcal_magic; 84*0Sstevel@tonic-gate ushort_t fcal_ncmds; 85*0Sstevel@tonic-gate } fcal_packet_t; 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate /* 88*0Sstevel@tonic-gate * Fibre channel packet flags 89*0Sstevel@tonic-gate */ 90*0Sstevel@tonic-gate #define FCFLAG_NOINTR 1 /* run this command without intr */ 91*0Sstevel@tonic-gate #define FCFLAG_COMPLETE 2 /* command has completed */ 92*0Sstevel@tonic-gate #define FCFLAG_RESP_HEADER 4 /* valid response frame header */ 93*0Sstevel@tonic-gate #define FCFLAG_ABORTING 8 /* this packet is being aborted */ 94*0Sstevel@tonic-gate #define FCFLAG_ABORTED 0x10 /* the abort completed */ 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate /* 97*0Sstevel@tonic-gate * definitions for the cmd_state 98*0Sstevel@tonic-gate */ 99*0Sstevel@tonic-gate #define FCAL_CMD_IN_TRANSPORT 0x1 /* command in transport */ 100*0Sstevel@tonic-gate #define FCAL_CMD_COMPLETE 0x4 /* command complete */ 101*0Sstevel@tonic-gate #define FCAL_CMPLT_CALLED 0x10 /* Completion routine called */ 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate #define FCALP_MAGIC 0x4750703 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate typedef struct fcal_transport { 106*0Sstevel@tonic-gate void *fcal_handle; /* identifies which FC dev */ 107*0Sstevel@tonic-gate ddi_dma_lim_t *fcal_dmalimp; 108*0Sstevel@tonic-gate ddi_iblock_cookie_t fcal_iblock; 109*0Sstevel@tonic-gate ddi_dma_attr_t *fcal_dmaattr; 110*0Sstevel@tonic-gate ddi_device_acc_attr_t *fcal_accattr; 111*0Sstevel@tonic-gate caddr_t fcal_loginparms; /* from soc+ xram */ 112*0Sstevel@tonic-gate la_wwn_t fcal_n_wwn; /* node Worldwide name */ 113*0Sstevel@tonic-gate la_wwn_t fcal_p_wwn; /* port Worldwide name */ 114*0Sstevel@tonic-gate uint_t fcal_portno; /* which port */ 115*0Sstevel@tonic-gate uint_t fcal_cmdmax; /* max number of exchanges */ 116*0Sstevel@tonic-gate kmutex_t fcal_mtx; 117*0Sstevel@tonic-gate kcondvar_t fcal_cv; 118*0Sstevel@tonic-gate struct fcal_transport_ops *fcal_ops; 119*0Sstevel@tonic-gate } fcal_transport_t; 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate typedef struct fcal_transport_ops { 122*0Sstevel@tonic-gate uint_t (*fcal_transport)(fcal_packet_t *fcalpkt, 123*0Sstevel@tonic-gate fcal_sleep_t sleep, int 124*0Sstevel@tonic-gate req_q_no); 125*0Sstevel@tonic-gate uint_t (*fcal_transport_poll)(fcal_packet_t *fcalpkt, 126*0Sstevel@tonic-gate uint_t timeout, 127*0Sstevel@tonic-gate int req_q_no); 128*0Sstevel@tonic-gate uint_t (*fcal_lilp_map)(void *fcal_handle, 129*0Sstevel@tonic-gate uint_t port, 130*0Sstevel@tonic-gate uint32_t bufid, 131*0Sstevel@tonic-gate uint_t poll); 132*0Sstevel@tonic-gate uint_t (*fcal_force_lip)(void *fcal_handle, 133*0Sstevel@tonic-gate uint_t port, 134*0Sstevel@tonic-gate uint_t poll, 135*0Sstevel@tonic-gate uint_t lip_req); 136*0Sstevel@tonic-gate uint_t (*fcal_abort_cmd)(void *fcal_handle, 137*0Sstevel@tonic-gate uint_t port, 138*0Sstevel@tonic-gate fcal_packet_t *fcalpkt, 139*0Sstevel@tonic-gate uint_t poll); 140*0Sstevel@tonic-gate uint_t (*fcal_els)(void *fcal_handle, 141*0Sstevel@tonic-gate uint_t port, 142*0Sstevel@tonic-gate uint_t els_code, 143*0Sstevel@tonic-gate uint_t dest, 144*0Sstevel@tonic-gate void (*callback)(), 145*0Sstevel@tonic-gate void *arg, 146*0Sstevel@tonic-gate caddr_t reqpayload, 147*0Sstevel@tonic-gate caddr_t *rsppayload, 148*0Sstevel@tonic-gate uint_t poll); 149*0Sstevel@tonic-gate uint_t (*fcal_bypass_dev)(void *fcal_handle, 150*0Sstevel@tonic-gate uint_t port, 151*0Sstevel@tonic-gate uint_t dest); 152*0Sstevel@tonic-gate void (*fcal_force_reset)(void *fcal_handle, 153*0Sstevel@tonic-gate uint_t port, 154*0Sstevel@tonic-gate uint_t reset); 155*0Sstevel@tonic-gate void (*fcal_add_ulp)(void *fcal_handle, 156*0Sstevel@tonic-gate uint_t port, 157*0Sstevel@tonic-gate uchar_t type, 158*0Sstevel@tonic-gate void (*ulp_statec_callback)(), 159*0Sstevel@tonic-gate void (*ulp_els_callback)(), 160*0Sstevel@tonic-gate void (*ulp_data_callback)(), 161*0Sstevel@tonic-gate void *arg); 162*0Sstevel@tonic-gate void (*fcal_remove_ulp)(void *fcal_handle, 163*0Sstevel@tonic-gate uint_t port, 164*0Sstevel@tonic-gate uchar_t type, 165*0Sstevel@tonic-gate void *arg); 166*0Sstevel@tonic-gate void (*fcal_take_core)(void *fcal_handle); 167*0Sstevel@tonic-gate } fcal_transport_ops_t; 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gate /* 170*0Sstevel@tonic-gate * additional pseudo-status codes for login 171*0Sstevel@tonic-gate */ 172*0Sstevel@tonic-gate #define FCAL_STATUS_LOGIN_TIMEOUT 0x80000001 173*0Sstevel@tonic-gate #define FCAL_STATUS_CQFULL 0x80000002 174*0Sstevel@tonic-gate #define FCAL_STATUS_TRANSFAIL 0x80000003 175*0Sstevel@tonic-gate #define FCAL_STATUS_RESETFAIL 0x80000004 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate /* 178*0Sstevel@tonic-gate * interface and transport function return values 179*0Sstevel@tonic-gate */ 180*0Sstevel@tonic-gate #define FCAL_SUCCESS 0x000 181*0Sstevel@tonic-gate #define FCAL_TIMEOUT 0x001 182*0Sstevel@tonic-gate #define FCAL_ALLOC_FAILED 0x002 183*0Sstevel@tonic-gate #define FCAL_OLD_PORT 0x003 184*0Sstevel@tonic-gate #define FCAL_LINK_ERROR 0x004 185*0Sstevel@tonic-gate #define FCAL_OFFLINE 0x005 186*0Sstevel@tonic-gate #define FCAL_ABORTED 0x006 187*0Sstevel@tonic-gate #define FCAL_ABORT_FAILED 0x007 188*0Sstevel@tonic-gate #define FCAL_BAD_ABORT 0x008 189*0Sstevel@tonic-gate #define FCAL_BAD_PARAMS 0x009 190*0Sstevel@tonic-gate #define FCAL_OVERRUN 0x00a 191*0Sstevel@tonic-gate #define FCAL_NO_TRANSPORT 0x00b 192*0Sstevel@tonic-gate #define FCAL_TRANSPORT_SUCCESS 0x000 193*0Sstevel@tonic-gate #define FCAL_TRANSPORT_FAILURE 0x101 194*0Sstevel@tonic-gate #define FCAL_BAD_PACKET 0x102 195*0Sstevel@tonic-gate #define FCAL_TRANSPORT_UNAVAIL 0x103 196*0Sstevel@tonic-gate #define FCAL_TRANSPORT_QFULL 0x104 197*0Sstevel@tonic-gate #define FCAL_TRANSPORT_TIMEOUT 0x105 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate #define FCAL_FAILURE 0xffffffff 200*0Sstevel@tonic-gate /* 201*0Sstevel@tonic-gate * fc_uc_register() return values 202*0Sstevel@tonic-gate */ 203*0Sstevel@tonic-gate typedef void * fc_uc_cookie_t; 204*0Sstevel@tonic-gate 205*0Sstevel@tonic-gate /* 206*0Sstevel@tonic-gate * fc_transport() iotype parameter 207*0Sstevel@tonic-gate */ 208*0Sstevel@tonic-gate typedef enum { 209*0Sstevel@tonic-gate FC_TYPE_UNCATEGORIZED, 210*0Sstevel@tonic-gate FC_TYPE_DATA, 211*0Sstevel@tonic-gate FC_TYPE_UNSOL_CONTROL, 212*0Sstevel@tonic-gate FC_TYPE_SOLICITED_CONTROL, 213*0Sstevel@tonic-gate FC_TYPE_UNSOL_DATA, 214*0Sstevel@tonic-gate FC_TYPE_XFER_RDY, 215*0Sstevel@tonic-gate FC_TYPE_COMMAND, 216*0Sstevel@tonic-gate FC_TYPE_RESPONSE 217*0Sstevel@tonic-gate } fc_iotype_t; 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate /* 220*0Sstevel@tonic-gate * State changes related to the N-port interface communicated from below 221*0Sstevel@tonic-gate */ 222*0Sstevel@tonic-gate #define FCAL_STATE_RESET ((int)0xffffffffu) 223*0Sstevel@tonic-gate /* port reset, all cmds lost */ 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate #define FCAL_LILP_MAGIC 0x1107 226*0Sstevel@tonic-gate #define FCAL_BADLILP_MAGIC 0x1105 227*0Sstevel@tonic-gate #define FCAL_NO_LIP 0x0 228*0Sstevel@tonic-gate #define FCAL_FORCE_LIP 0x1 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate typedef struct fcal_lilp_map { 231*0Sstevel@tonic-gate ushort_t lilp_magic; 232*0Sstevel@tonic-gate ushort_t lilp_myalpa; 233*0Sstevel@tonic-gate uchar_t lilp_length; 234*0Sstevel@tonic-gate uchar_t lilp_alpalist[127]; 235*0Sstevel@tonic-gate } fcal_lilp_map_t; 236*0Sstevel@tonic-gate #ifdef __cplusplus 237*0Sstevel@tonic-gate } 238*0Sstevel@tonic-gate #endif 239*0Sstevel@tonic-gate 240*0Sstevel@tonic-gate #endif /* !_SYS_FC4_FCAL_TRANSPORT_H */ 241