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_ULPIF_H 27*7836SJohn.Forte@Sun.COM #define _FC_ULPIF_H 28*7836SJohn.Forte@Sun.COM 29*7836SJohn.Forte@Sun.COM 30*7836SJohn.Forte@Sun.COM 31*7836SJohn.Forte@Sun.COM #include <sys/note.h> 32*7836SJohn.Forte@Sun.COM 33*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 34*7836SJohn.Forte@Sun.COM extern "C" { 35*7836SJohn.Forte@Sun.COM #endif 36*7836SJohn.Forte@Sun.COM 37*7836SJohn.Forte@Sun.COM /* 38*7836SJohn.Forte@Sun.COM * fctl does not support downward compatibility. When there is any change of 39*7836SJohn.Forte@Sun.COM * non-private structure or non-static interface in fctl, the module revision 40*7836SJohn.Forte@Sun.COM * number needs to be bumped up here, and for each ulp, the module revision 41*7836SJohn.Forte@Sun.COM * number in fc_ulp_modinfo needs to be updated. 42*7836SJohn.Forte@Sun.COM */ 43*7836SJohn.Forte@Sun.COM #define FCTL_ULP_MODREV_1 1 44*7836SJohn.Forte@Sun.COM #define FCTL_ULP_MODREV_2 2 45*7836SJohn.Forte@Sun.COM #define FCTL_ULP_MODREV_3 3 46*7836SJohn.Forte@Sun.COM #define FCTL_ULP_MODREV_4 4 47*7836SJohn.Forte@Sun.COM 48*7836SJohn.Forte@Sun.COM /* 49*7836SJohn.Forte@Sun.COM * Flag definitions to fc_ulp_get_portmap function. 50*7836SJohn.Forte@Sun.COM */ 51*7836SJohn.Forte@Sun.COM #define FC_ULP_PLOGI_DONTCARE 0 52*7836SJohn.Forte@Sun.COM #define FC_ULP_PLOGI_PRESERVE 1 53*7836SJohn.Forte@Sun.COM 54*7836SJohn.Forte@Sun.COM #define FC_ULP_DEVICE_OFFLINE 0 55*7836SJohn.Forte@Sun.COM #define FC_ULP_DEVICE_ONLINE 1 56*7836SJohn.Forte@Sun.COM 57*7836SJohn.Forte@Sun.COM /* 58*7836SJohn.Forte@Sun.COM * fc_ulp_port_reset() command codes 59*7836SJohn.Forte@Sun.COM */ 60*7836SJohn.Forte@Sun.COM #define FC_RESET_PORT 0x01 61*7836SJohn.Forte@Sun.COM #define FC_RESET_ADAPTER 0x02 62*7836SJohn.Forte@Sun.COM #define FC_RESET_DUMP 0x03 63*7836SJohn.Forte@Sun.COM #define FC_RESET_CRASH 0x04 64*7836SJohn.Forte@Sun.COM 65*7836SJohn.Forte@Sun.COM /* 66*7836SJohn.Forte@Sun.COM * port attach callback commands 67*7836SJohn.Forte@Sun.COM */ 68*7836SJohn.Forte@Sun.COM typedef enum fc_attach_cmd { 69*7836SJohn.Forte@Sun.COM FC_CMD_ATTACH, 70*7836SJohn.Forte@Sun.COM FC_CMD_RESUME, 71*7836SJohn.Forte@Sun.COM FC_CMD_POWER_UP 72*7836SJohn.Forte@Sun.COM } fc_attach_cmd_t; 73*7836SJohn.Forte@Sun.COM 74*7836SJohn.Forte@Sun.COM /* 75*7836SJohn.Forte@Sun.COM * port detach callback commands 76*7836SJohn.Forte@Sun.COM */ 77*7836SJohn.Forte@Sun.COM typedef enum fc_detach_cmd { 78*7836SJohn.Forte@Sun.COM FC_CMD_DETACH, 79*7836SJohn.Forte@Sun.COM FC_CMD_SUSPEND, 80*7836SJohn.Forte@Sun.COM FC_CMD_POWER_DOWN 81*7836SJohn.Forte@Sun.COM } fc_detach_cmd_t; 82*7836SJohn.Forte@Sun.COM 83*7836SJohn.Forte@Sun.COM typedef struct fc_portmap { 84*7836SJohn.Forte@Sun.COM int map_state; 85*7836SJohn.Forte@Sun.COM int map_flags; /* Status flags */ 86*7836SJohn.Forte@Sun.COM int map_type; /* OLD, NEW, CHANGED */ 87*7836SJohn.Forte@Sun.COM uint32_t map_fc4_types[8]; /* fc4 types */ 88*7836SJohn.Forte@Sun.COM la_wwn_t map_pwwn; 89*7836SJohn.Forte@Sun.COM la_wwn_t map_nwwn; 90*7836SJohn.Forte@Sun.COM fc_portid_t map_did; 91*7836SJohn.Forte@Sun.COM fc_hardaddr_t map_hard_addr; 92*7836SJohn.Forte@Sun.COM opaque_t map_pd; /* port device */ 93*7836SJohn.Forte@Sun.COM fc_ulp_rscn_info_t map_rscn_info; /* xport's RSCN info */ 94*7836SJohn.Forte@Sun.COM } fc_portmap_t; 95*7836SJohn.Forte@Sun.COM 96*7836SJohn.Forte@Sun.COM typedef struct ulp_port_info { 97*7836SJohn.Forte@Sun.COM struct modlinkage *port_linkage; 98*7836SJohn.Forte@Sun.COM dev_info_t *port_dip; 99*7836SJohn.Forte@Sun.COM opaque_t port_handle; 100*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *port_data_dma_attr; 101*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *port_cmd_dma_attr; 102*7836SJohn.Forte@Sun.COM ddi_dma_attr_t *port_resp_dma_attr; 103*7836SJohn.Forte@Sun.COM ddi_device_acc_attr_t *port_acc_attr; 104*7836SJohn.Forte@Sun.COM int port_fca_pkt_size; 105*7836SJohn.Forte@Sun.COM int port_fca_max_exch; 106*7836SJohn.Forte@Sun.COM uint32_t port_state; 107*7836SJohn.Forte@Sun.COM uint32_t port_flags; 108*7836SJohn.Forte@Sun.COM la_wwn_t port_pwwn; /* port WWN */ 109*7836SJohn.Forte@Sun.COM la_wwn_t port_nwwn; /* node WWN */ 110*7836SJohn.Forte@Sun.COM fc_reset_action_t port_reset_action; /* FCA reset action */ 111*7836SJohn.Forte@Sun.COM fc_dma_behavior_t port_dma_behavior; /* FCA DMA behavior */ 112*7836SJohn.Forte@Sun.COM fc_fcp_dma_t port_fcp_dma; /* FCP DVMA space */ 113*7836SJohn.Forte@Sun.COM } fc_ulp_port_info_t; 114*7836SJohn.Forte@Sun.COM 115*7836SJohn.Forte@Sun.COM typedef struct ulp_modinfo { 116*7836SJohn.Forte@Sun.COM opaque_t ulp_handle; /* not really needed */ 117*7836SJohn.Forte@Sun.COM uint32_t ulp_rev; /* ULP revision */ 118*7836SJohn.Forte@Sun.COM uchar_t ulp_type; /* FC-4 type */ 119*7836SJohn.Forte@Sun.COM char *ulp_name; /* ULP Name */ 120*7836SJohn.Forte@Sun.COM int ulp_statec_mask; /* state change mask */ 121*7836SJohn.Forte@Sun.COM int (*ulp_port_attach) (opaque_t ulp_handle, 122*7836SJohn.Forte@Sun.COM struct ulp_port_info *, fc_attach_cmd_t cmd, 123*7836SJohn.Forte@Sun.COM uint32_t s_id); 124*7836SJohn.Forte@Sun.COM int (*ulp_port_detach) (opaque_t ulp_handle, 125*7836SJohn.Forte@Sun.COM struct ulp_port_info *, fc_detach_cmd_t cmd); 126*7836SJohn.Forte@Sun.COM int (*ulp_port_ioctl) (opaque_t ulp_handle, 127*7836SJohn.Forte@Sun.COM opaque_t port_handle, dev_t dev, int cmd, 128*7836SJohn.Forte@Sun.COM intptr_t data, int mode, cred_t *credp, 129*7836SJohn.Forte@Sun.COM int *rval, uint32_t claimed); 130*7836SJohn.Forte@Sun.COM int (*ulp_els_callback) (opaque_t ulp_handle, 131*7836SJohn.Forte@Sun.COM opaque_t port_handle, fc_unsol_buf_t *payload, 132*7836SJohn.Forte@Sun.COM uint32_t claimed); 133*7836SJohn.Forte@Sun.COM int (*ulp_data_callback) (opaque_t ulp_handle, 134*7836SJohn.Forte@Sun.COM opaque_t port_handle, fc_unsol_buf_t *buf, 135*7836SJohn.Forte@Sun.COM uint32_t claimed); 136*7836SJohn.Forte@Sun.COM void (*ulp_statec_callback) (opaque_t ulp_handle, 137*7836SJohn.Forte@Sun.COM opaque_t port_handle, uint32_t statec, 138*7836SJohn.Forte@Sun.COM uint32_t port_flags, fc_portmap_t changelist[], 139*7836SJohn.Forte@Sun.COM uint32_t listlen, uint32_t s_id); 140*7836SJohn.Forte@Sun.COM } fc_ulp_modinfo_t; 141*7836SJohn.Forte@Sun.COM 142*7836SJohn.Forte@Sun.COM #if !defined(__lint) 143*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique for attach", ulp_port_info)) 144*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("stable data", ulp_modinfo)) 145*7836SJohn.Forte@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_portmap)) 146*7836SJohn.Forte@Sun.COM #endif /* __lint */ 147*7836SJohn.Forte@Sun.COM 148*7836SJohn.Forte@Sun.COM int fc_ulp_add(fc_ulp_modinfo_t *ulp_info); 149*7836SJohn.Forte@Sun.COM int fc_ulp_remove(fc_ulp_modinfo_t *ulp_info); 150*7836SJohn.Forte@Sun.COM int fc_ulp_init_packet(opaque_t port_handle, fc_packet_t *pkt, int sleep); 151*7836SJohn.Forte@Sun.COM int fc_ulp_uninit_packet(opaque_t port_handle, fc_packet_t *pkt); 152*7836SJohn.Forte@Sun.COM int fc_ulp_getportmap(opaque_t port_handle, fc_portmap_t **map, 153*7836SJohn.Forte@Sun.COM uint32_t *len, int flag); 154*7836SJohn.Forte@Sun.COM int fc_ulp_login(opaque_t port_handle, fc_packet_t **ulp_pkt, 155*7836SJohn.Forte@Sun.COM uint32_t listlen); 156*7836SJohn.Forte@Sun.COM opaque_t fc_ulp_get_remote_port(opaque_t port_handle, la_wwn_t *pwwn, 157*7836SJohn.Forte@Sun.COM int *error, int create); 158*7836SJohn.Forte@Sun.COM int fc_ulp_port_ns(opaque_t port_handle, opaque_t pd, fc_ns_cmd_t *ns_req); 159*7836SJohn.Forte@Sun.COM int fc_ulp_transport(opaque_t port_handle, fc_packet_t *pkt); 160*7836SJohn.Forte@Sun.COM int fc_ulp_issue_els(opaque_t port_handle, fc_packet_t *pkt); 161*7836SJohn.Forte@Sun.COM int fc_ulp_uballoc(opaque_t port_handle, uint32_t *count, 162*7836SJohn.Forte@Sun.COM uint32_t size, uint32_t type, uint64_t *tokens); 163*7836SJohn.Forte@Sun.COM int fc_ulp_ubfree(opaque_t port_handle, uint32_t count, 164*7836SJohn.Forte@Sun.COM uint64_t *tokens); 165*7836SJohn.Forte@Sun.COM int fc_ulp_ubrelease(opaque_t port_handle, uint32_t count, 166*7836SJohn.Forte@Sun.COM uint64_t *tokens); 167*7836SJohn.Forte@Sun.COM int fc_ulp_abort(opaque_t port_handle, fc_packet_t *pkt, int flags); 168*7836SJohn.Forte@Sun.COM int fc_ulp_linkreset(opaque_t port_handle, la_wwn_t *pwwn, int sleep); 169*7836SJohn.Forte@Sun.COM int fc_ulp_port_reset(opaque_t port_handle, uint32_t cmd); 170*7836SJohn.Forte@Sun.COM int fc_ulp_get_port_login_params(opaque_t port_handle, 171*7836SJohn.Forte@Sun.COM la_els_logi_t *login_params); 172*7836SJohn.Forte@Sun.COM int fc_ulp_get_port_instance(opaque_t port_handle); 173*7836SJohn.Forte@Sun.COM opaque_t fc_ulp_get_port_handle(int instance); 174*7836SJohn.Forte@Sun.COM int fc_ulp_error(int fc_errno, char **errmsg); 175*7836SJohn.Forte@Sun.COM int fc_ulp_pkt_error(fc_packet_t *pkt, char **state, char **reason, 176*7836SJohn.Forte@Sun.COM char **action, char **expln); 177*7836SJohn.Forte@Sun.COM int fc_ulp_is_name_present(caddr_t ulp_name); 178*7836SJohn.Forte@Sun.COM int fc_ulp_get_pwwn_by_did(opaque_t port_handle, fc_portid_t d_id, 179*7836SJohn.Forte@Sun.COM la_wwn_t *pwwn); 180*7836SJohn.Forte@Sun.COM int fc_ulp_pwwn_to_portmap(opaque_t port_handle, la_wwn_t *bytes, 181*7836SJohn.Forte@Sun.COM fc_portmap_t *map); 182*7836SJohn.Forte@Sun.COM opaque_t fc_ulp_get_fca_device(opaque_t port_handle, fc_portid_t d_id); 183*7836SJohn.Forte@Sun.COM int fc_ulp_port_notify(opaque_t port_handle, uint32_t cmd); 184*7836SJohn.Forte@Sun.COM void fc_ulp_disable_relogin(opaque_t *fc_port, la_wwn_t *pwwn); 185*7836SJohn.Forte@Sun.COM void fc_ulp_enable_relogin(opaque_t *fc_port, la_wwn_t *pwwn); 186*7836SJohn.Forte@Sun.COM int fc_ulp_busy_port(opaque_t port_handle); 187*7836SJohn.Forte@Sun.COM void fc_ulp_idle_port(opaque_t port_handle); 188*7836SJohn.Forte@Sun.COM void fc_ulp_copy_portmap(fc_portmap_t *map, opaque_t pd); 189*7836SJohn.Forte@Sun.COM int fc_ulp_get_adapter_paths(char *pathList, int count); 190*7836SJohn.Forte@Sun.COM uint32_t fc_ulp_get_rscn_count(opaque_t port_handle); 191*7836SJohn.Forte@Sun.COM void fc_ulp_hold_remote_port(opaque_t port_handle); 192*7836SJohn.Forte@Sun.COM int fc_ulp_get_npiv_port_list(opaque_t port_handle, char *pathList); 193*7836SJohn.Forte@Sun.COM int fc_ulp_get_npiv_port_num(opaque_t port_handle); 194*7836SJohn.Forte@Sun.COM void fc_ulp_log_device_event(opaque_t port_handle, int type); 195*7836SJohn.Forte@Sun.COM 196*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 197*7836SJohn.Forte@Sun.COM } 198*7836SJohn.Forte@Sun.COM #endif 199*7836SJohn.Forte@Sun.COM 200*7836SJohn.Forte@Sun.COM #endif /* _FC_ULPIF_H */ 201