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 _FC_FCAIF_H 27*7836SJohn.Forte@Sun.COM #define _FC_FCAIF_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 /* 37*7836SJohn.Forte@Sun.COM * Version for FCA vectors 38*7836SJohn.Forte@Sun.COM */ 39*7836SJohn.Forte@Sun.COM #define FCTL_FCA_MODREV_1 1 40*7836SJohn.Forte@Sun.COM #define FCTL_FCA_MODREV_2 2 41*7836SJohn.Forte@Sun.COM #define FCTL_FCA_MODREV_3 3 42*7836SJohn.Forte@Sun.COM #define FCTL_FCA_MODREV_4 4 43*7836SJohn.Forte@Sun.COM #define FCTL_FCA_MODREV_5 5 44*7836SJohn.Forte@Sun.COM 45*7836SJohn.Forte@Sun.COM /* 46*7836SJohn.Forte@Sun.COM * State change codes 47*7836SJohn.Forte@Sun.COM */ 48*7836SJohn.Forte@Sun.COM #define FC_SC_OFFLINE 0 49*7836SJohn.Forte@Sun.COM #define FC_SC_ONLINE 1 50*7836SJohn.Forte@Sun.COM 51*7836SJohn.Forte@Sun.COM /* 52*7836SJohn.Forte@Sun.COM * pm_cmd_flag definitions 53*7836SJohn.Forte@Sun.COM */ 54*7836SJohn.Forte@Sun.COM #define FC_FCA_PM_NOP 0x00 55*7836SJohn.Forte@Sun.COM #define FC_FCA_PM_READ 0x01 56*7836SJohn.Forte@Sun.COM #define FC_FCA_PM_WRITE 0x02 57*7836SJohn.Forte@Sun.COM #define FC_FCA_PM_RW (FC_FCA_PM_READ | FC_FCA_PM_WRITE) 58*7836SJohn.Forte@Sun.COM 59*7836SJohn.Forte@Sun.COM /* 60*7836SJohn.Forte@Sun.COM * Command codes for fca_reset() 61*7836SJohn.Forte@Sun.COM */ 62*7836SJohn.Forte@Sun.COM #define FC_FCA_LINK_RESET 0x01 63*7836SJohn.Forte@Sun.COM #define FC_FCA_CORE 0x02 64*7836SJohn.Forte@Sun.COM #define FC_FCA_RESET_CORE 0x03 65*7836SJohn.Forte@Sun.COM #define FC_FCA_RESET 0x04 66*7836SJohn.Forte@Sun.COM 67*7836SJohn.Forte@Sun.COM /* 68*7836SJohn.Forte@Sun.COM * fca_port_manage() command codes 69*7836SJohn.Forte@Sun.COM */ 70*7836SJohn.Forte@Sun.COM #define FC_PORT_BYPASS 0x01 71*7836SJohn.Forte@Sun.COM #define FC_PORT_UNBYPASS 0x02 72*7836SJohn.Forte@Sun.COM #define FC_PORT_DIAG 0x03 73*7836SJohn.Forte@Sun.COM #define FC_PORT_ERR_STATS 0x04 74*7836SJohn.Forte@Sun.COM #define FC_PORT_GET_FW_REV 0x05 75*7836SJohn.Forte@Sun.COM #define FC_PORT_GET_FCODE_REV 0x06 76*7836SJohn.Forte@Sun.COM #define FC_PORT_GET_DUMP_SIZE 0x07 77*7836SJohn.Forte@Sun.COM #define FC_PORT_FORCE_DUMP 0x08 78*7836SJohn.Forte@Sun.COM #define FC_PORT_GET_DUMP 0x09 79*7836SJohn.Forte@Sun.COM #define FC_PORT_LOOPBACK 0x0A 80*7836SJohn.Forte@Sun.COM #define FC_PORT_LINK_STATE 0x0B 81*7836SJohn.Forte@Sun.COM #define FC_PORT_INITIALIZE 0x0C 82*7836SJohn.Forte@Sun.COM #define FC_PORT_DOWNLOAD_FW 0x0D 83*7836SJohn.Forte@Sun.COM #define FC_PORT_RLS 0x0E 84*7836SJohn.Forte@Sun.COM #define FC_PORT_DOWNLOAD_FCODE 0x0F 85*7836SJohn.Forte@Sun.COM #define FC_PORT_GET_NODE_ID 0x10 86*7836SJohn.Forte@Sun.COM #define FC_PORT_SET_NODE_ID 0x11 87*7836SJohn.Forte@Sun.COM #define FC_PORT_GET_P2P_INFO 0x12 88*7836SJohn.Forte@Sun.COM 89*7836SJohn.Forte@Sun.COM /* 90*7836SJohn.Forte@Sun.COM * FCA capability strings 91*7836SJohn.Forte@Sun.COM */ 92*7836SJohn.Forte@Sun.COM #define FC_NODE_WWN "FCA node WWN" 93*7836SJohn.Forte@Sun.COM #define FC_LOGIN_PARAMS "FCA login parameters" 94*7836SJohn.Forte@Sun.COM #define FC_CAP_UNSOL_BUF "number of unsolicited bufs" 95*7836SJohn.Forte@Sun.COM #define FC_CAP_PAYLOAD_SIZE "exchange payload max" 96*7836SJohn.Forte@Sun.COM #define FC_CAP_POST_RESET_BEHAVIOR "port reset behavior" 97*7836SJohn.Forte@Sun.COM #define FC_CAP_NOSTREAM_ON_UNALIGN_BUF "no dma streaming on unaligned buf" 98*7836SJohn.Forte@Sun.COM #define FC_CAP_FCP_DMA "FCP cmd response in DVMA space" 99*7836SJohn.Forte@Sun.COM 100*7836SJohn.Forte@Sun.COM typedef struct fc_fca_bind { 101*7836SJohn.Forte@Sun.COM int port_num; 102*7836SJohn.Forte@Sun.COM opaque_t port_handle; 103*7836SJohn.Forte@Sun.COM void (*port_statec_cb) (opaque_t port_handle, uint32_t state); 104*7836SJohn.Forte@Sun.COM void (*port_unsol_cb) (opaque_t port_handle, 105*7836SJohn.Forte@Sun.COM fc_unsol_buf_t *buf, uint32_t type); 106*7836SJohn.Forte@Sun.COM la_wwn_t port_nwwn; /* virtual port pwwn */ 107*7836SJohn.Forte@Sun.COM la_wwn_t port_pwwn; /* virtual port nwwn */ 108*7836SJohn.Forte@Sun.COM int port_npiv; /* virtual port flag */ 109*7836SJohn.Forte@Sun.COM } fc_fca_bind_info_t; 110*7836SJohn.Forte@Sun.COM 111*7836SJohn.Forte@Sun.COM typedef struct fc_fca_rnid { 112*7836SJohn.Forte@Sun.COM int status; 113*7836SJohn.Forte@Sun.COM fc_rnid_t params; 114*7836SJohn.Forte@Sun.COM }fc_fca_rnid_t; 115*7836SJohn.Forte@Sun.COM 116*7836SJohn.Forte@Sun.COM typedef struct fc_fca_port_info { 117*7836SJohn.Forte@Sun.COM uchar_t pi_topology; /* Unused */ 118*7836SJohn.Forte@Sun.COM uint32_t pi_error; 119*7836SJohn.Forte@Sun.COM uint32_t pi_port_state; 120*7836SJohn.Forte@Sun.COM fc_portid_t pi_s_id; /* Unused */ 121*7836SJohn.Forte@Sun.COM fc_hardaddr_t pi_hard_addr; /* Hard address */ 122*7836SJohn.Forte@Sun.COM la_els_logi_t pi_login_params; 123*7836SJohn.Forte@Sun.COM fc_fca_rnid_t pi_rnid_params; 124*7836SJohn.Forte@Sun.COM fca_port_attrs_t pi_attrs; 125*7836SJohn.Forte@Sun.COM } fc_fca_port_info_t; 126*7836SJohn.Forte@Sun.COM 127*7836SJohn.Forte@Sun.COM typedef struct fc_fca_pm { 128*7836SJohn.Forte@Sun.COM uint32_t pm_cmd_code; /* port manage command */ 129*7836SJohn.Forte@Sun.COM uint32_t pm_cmd_flags; /* READ/WRITE */ 130*7836SJohn.Forte@Sun.COM size_t pm_cmd_len; /* cmd buffer length */ 131*7836SJohn.Forte@Sun.COM caddr_t pm_cmd_buf; /* cmd buffer */ 132*7836SJohn.Forte@Sun.COM size_t pm_data_len; /* data buffer length */ 133*7836SJohn.Forte@Sun.COM caddr_t pm_data_buf; /* data buffer */ 134*7836SJohn.Forte@Sun.COM size_t pm_stat_len; /* status buffer length */ 135*7836SJohn.Forte@Sun.COM caddr_t pm_stat_buf; /* status buffer */ 136*7836SJohn.Forte@Sun.COM } fc_fca_pm_t; 137*7836SJohn.Forte@Sun.COM 138*7836SJohn.Forte@Sun.COM typedef struct fc_fca_p2p_info { 139*7836SJohn.Forte@Sun.COM uint32_t fca_d_id; /* HBA port D_ID */ 140*7836SJohn.Forte@Sun.COM uint32_t d_id; /* Remote port D_ID */ 141*7836SJohn.Forte@Sun.COM la_wwn_t pwwn; /* Remote port PWWN */ 142*7836SJohn.Forte@Sun.COM la_wwn_t nwwn; /* Remote port NWWN */ 143*7836SJohn.Forte@Sun.COM } fc_fca_p2p_info_t; 144*7836SJohn.Forte@Sun.COM 145*7836SJohn.Forte@Sun.COM typedef struct fca_tran { 146*7836SJohn.Forte@Sun.COM int fca_version; 147*7836SJohn.Forte@Sun.COM int fca_numports; 148*7836SJohn.Forte@Sun.COM int fca_pkt_size; 149*7836SJohn.Forte@Sun.COM uint32_t fca_cmd_max; 150*7836SJohn.Forte@Sun.COM ddi_dma_lim_t *fca_dma_lim; 151*7836SJohn.Forte@Sun.COM ddi_iblock_cookie_t *fca_iblock; 152*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_attr; 153*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcp_cmd_attr; 154*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcp_rsp_attr; 155*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcp_data_attr; 156*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcip_cmd_attr; 157*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcip_rsp_attr; 158*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcsm_cmd_attr; 159*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *fca_dma_fcsm_rsp_attr; 160*7836SJohn.Forte@Sun.COM ddi_device_acc_attr_t *fca_acc_attr; 161*7836SJohn.Forte@Sun.COM int fca_num_npivports; 162*7836SJohn.Forte@Sun.COM /* number of virtual ports supported, 0 means unsupported */ 163*7836SJohn.Forte@Sun.COM la_wwn_t fca_perm_pwwn; 164*7836SJohn.Forte@Sun.COM /* permanent port wwn for the port */ 165*7836SJohn.Forte@Sun.COM 166*7836SJohn.Forte@Sun.COM opaque_t (*fca_bind_port) (dev_info_t *dip, 167*7836SJohn.Forte@Sun.COM fc_fca_port_info_t *port_info, fc_fca_bind_info_t *bind_info); 168*7836SJohn.Forte@Sun.COM 169*7836SJohn.Forte@Sun.COM void (*fca_unbind_port) (opaque_t fca_handle); 170*7836SJohn.Forte@Sun.COM 171*7836SJohn.Forte@Sun.COM int (*fca_init_pkt) (opaque_t fca_handle, fc_packet_t *pkt, int sleep); 172*7836SJohn.Forte@Sun.COM 173*7836SJohn.Forte@Sun.COM int (*fca_un_init_pkt) (opaque_t fca_handle, fc_packet_t *pkt); 174*7836SJohn.Forte@Sun.COM 175*7836SJohn.Forte@Sun.COM int (*fca_els_send) (opaque_t fca_handle, fc_packet_t *pkt); 176*7836SJohn.Forte@Sun.COM 177*7836SJohn.Forte@Sun.COM int (*fca_get_cap) (opaque_t fca_handle, char *cap, void *ptr); 178*7836SJohn.Forte@Sun.COM 179*7836SJohn.Forte@Sun.COM int (*fca_set_cap) (opaque_t fca_handle, char *cap, void *ptr); 180*7836SJohn.Forte@Sun.COM 181*7836SJohn.Forte@Sun.COM int (*fca_getmap) (opaque_t fca_handle, fc_lilpmap_t *map); 182*7836SJohn.Forte@Sun.COM 183*7836SJohn.Forte@Sun.COM int (*fca_transport) (opaque_t fca_handle, fc_packet_t *pkt); 184*7836SJohn.Forte@Sun.COM 185*7836SJohn.Forte@Sun.COM int (*fca_ub_alloc) (opaque_t fca_handle, uint64_t *tokens, 186*7836SJohn.Forte@Sun.COM uint32_t ub_size, uint32_t *ub_count, uint32_t type); 187*7836SJohn.Forte@Sun.COM 188*7836SJohn.Forte@Sun.COM int (*fca_ub_free) (opaque_t fca_handle, uint32_t count, 189*7836SJohn.Forte@Sun.COM uint64_t tokens[]); 190*7836SJohn.Forte@Sun.COM 191*7836SJohn.Forte@Sun.COM int (*fca_ub_release) (opaque_t fca_handle, uint32_t count, 192*7836SJohn.Forte@Sun.COM uint64_t tokens[]); 193*7836SJohn.Forte@Sun.COM 194*7836SJohn.Forte@Sun.COM int (*fca_abort) (opaque_t fca_handle, fc_packet_t *pkt, int flags); 195*7836SJohn.Forte@Sun.COM 196*7836SJohn.Forte@Sun.COM int (*fca_reset) (opaque_t fca_handle, uint32_t cmd); 197*7836SJohn.Forte@Sun.COM 198*7836SJohn.Forte@Sun.COM int (*fca_port_manage) (opaque_t fca_port, fc_fca_pm_t *arg); 199*7836SJohn.Forte@Sun.COM 200*7836SJohn.Forte@Sun.COM opaque_t (*fca_get_device) (opaque_t fca_port, fc_portid_t d_id); 201*7836SJohn.Forte@Sun.COM 202*7836SJohn.Forte@Sun.COM int (*fca_notify) (opaque_t fca_handle, uint32_t cmd); 203*7836SJohn.Forte@Sun.COM 204*7836SJohn.Forte@Sun.COM } fc_fca_tran_t; 205*7836SJohn.Forte@Sun.COM 206*7836SJohn.Forte@Sun.COM void fc_fca_init(struct dev_ops *fca_devops_p); 207*7836SJohn.Forte@Sun.COM int fc_fca_attach(dev_info_t *, fc_fca_tran_t *); 208*7836SJohn.Forte@Sun.COM int fc_fca_detach(dev_info_t *fca_dip); 209*7836SJohn.Forte@Sun.COM int fc_fca_update_errors(fc_packet_t *pkt); 210*7836SJohn.Forte@Sun.COM int fc_fca_error(int fc_errno, char **errmsg); 211*7836SJohn.Forte@Sun.COM int fc_fca_pkt_error(fc_packet_t *pkt, char **state, char **reason, 212*7836SJohn.Forte@Sun.COM char **action, char **expln); 213*7836SJohn.Forte@Sun.COM 214*7836SJohn.Forte@Sun.COM #if !defined(__lint) 215*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per fca_bind", fc_fca_port_info)) 216*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per fca_bind", fc_fca_bind)) 217*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("stable data", fca_tran)) 218*7836SJohn.Forte@Sun.COM #endif /* __lint */ 219*7836SJohn.Forte@Sun.COM 220*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 221*7836SJohn.Forte@Sun.COM } 222*7836SJohn.Forte@Sun.COM #endif 223*7836SJohn.Forte@Sun.COM 224*7836SJohn.Forte@Sun.COM #endif /* _FC_FCAIF_H */ 225