fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _FC_ULPIF_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _FC_ULPIF_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/note.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fctl does not support downward compatibility. When there is any change of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-private structure or non-static interface in fctl, the module revision
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * number needs to be bumped up here, and for each ulp, the module revision
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * number in fc_ulp_modinfo needs to be updated.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCTL_ULP_MODREV_1 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCTL_ULP_MODREV_2 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCTL_ULP_MODREV_3 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCTL_ULP_MODREV_4 4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flag definitions to fc_ulp_get_portmap function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_PLOGI_DONTCARE 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_PLOGI_PRESERVE 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_DEVICE_OFFLINE 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_ULP_DEVICE_ONLINE 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fc_ulp_port_reset() command codes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_RESET_PORT 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_RESET_ADAPTER 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_RESET_DUMP 0x03
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_RESET_CRASH 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port attach callback commands
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum fc_attach_cmd {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_CMD_ATTACH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_CMD_RESUME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_CMD_POWER_UP
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_attach_cmd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port detach callback commands
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum fc_detach_cmd {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_CMD_DETACH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_CMD_SUSPEND,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_CMD_POWER_DOWN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_detach_cmd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_portmap {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int map_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int map_flags; /* Status flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int map_type; /* OLD, NEW, CHANGED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t map_fc4_types[8]; /* fc4 types */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t map_pwwn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t map_nwwn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portid_t map_did;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_hardaddr_t map_hard_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t map_pd; /* port device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_rscn_info_t map_rscn_info; /* xport's RSCN info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_portmap_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ulp_port_info {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct modlinkage *port_linkage;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_info_t *port_dip;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t port_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_dma_attr_t *port_data_dma_attr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_dma_attr_t *port_cmd_dma_attr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_dma_attr_t *port_resp_dma_attr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_device_acc_attr_t *port_acc_attr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_fca_pkt_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int port_fca_max_exch;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t port_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t port_flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t port_pwwn; /* port WWN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t port_nwwn; /* node WWN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_reset_action_t port_reset_action; /* FCA reset action */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_dma_behavior_t port_dma_behavior; /* FCA DMA behavior */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_fcp_dma_t port_fcp_dma; /* FCP DVMA space */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_ulp_port_info_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ulp_modinfo {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t ulp_handle; /* not really needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ulp_rev; /* ULP revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t ulp_type; /* FC-4 type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *ulp_name; /* ULP Name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ulp_statec_mask; /* state change mask */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*ulp_port_attach) (opaque_t ulp_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct ulp_port_info *, fc_attach_cmd_t cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t s_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*ulp_port_detach) (opaque_t ulp_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct ulp_port_info *, fc_detach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*ulp_port_ioctl) (opaque_t ulp_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t port_handle, dev_t dev, int cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte intptr_t data, int mode, cred_t *credp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *rval, uint32_t claimed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*ulp_els_callback) (opaque_t ulp_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t port_handle, fc_unsol_buf_t *payload,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t claimed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*ulp_data_callback) (opaque_t ulp_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t port_handle, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t claimed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void (*ulp_statec_callback) (opaque_t ulp_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t port_handle, uint32_t statec,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t port_flags, fc_portmap_t changelist[],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t listlen, uint32_t s_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_ulp_modinfo_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(__lint)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique for attach", ulp_port_info))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("stable data", ulp_modinfo))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_portmap))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __lint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_add(fc_ulp_modinfo_t *ulp_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_remove(fc_ulp_modinfo_t *ulp_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_init_packet(opaque_t port_handle, fc_packet_t *pkt, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_uninit_packet(opaque_t port_handle, fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_getportmap(opaque_t port_handle, fc_portmap_t **map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *len, int flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_login(opaque_t port_handle, fc_packet_t **ulp_pkt,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t listlen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteopaque_t fc_ulp_get_remote_port(opaque_t port_handle, la_wwn_t *pwwn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *error, int create);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_port_ns(opaque_t port_handle, opaque_t pd, fc_ns_cmd_t *ns_req);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_transport(opaque_t port_handle, fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_issue_els(opaque_t port_handle, fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_uballoc(opaque_t port_handle, uint32_t *count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t size, uint32_t type, uint64_t *tokens);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_ubfree(opaque_t port_handle, uint32_t count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t *tokens);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_ubrelease(opaque_t port_handle, uint32_t count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t *tokens);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_abort(opaque_t port_handle, fc_packet_t *pkt, int flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_linkreset(opaque_t port_handle, la_wwn_t *pwwn, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_port_reset(opaque_t port_handle, uint32_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_get_port_login_params(opaque_t port_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_els_logi_t *login_params);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_get_port_instance(opaque_t port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteopaque_t fc_ulp_get_port_handle(int instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_error(int fc_errno, char **errmsg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_pkt_error(fc_packet_t *pkt, char **state, char **reason,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char **action, char **expln);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_is_name_present(caddr_t ulp_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_get_pwwn_by_did(opaque_t port_handle, fc_portid_t d_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_pwwn_to_portmap(opaque_t port_handle, la_wwn_t *bytes,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portmap_t *map);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteopaque_t fc_ulp_get_fca_device(opaque_t port_handle, fc_portid_t d_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_port_notify(opaque_t port_handle, uint32_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid fc_ulp_disable_relogin(opaque_t *fc_port, la_wwn_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid fc_ulp_enable_relogin(opaque_t *fc_port, la_wwn_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_busy_port(opaque_t port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid fc_ulp_idle_port(opaque_t port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid fc_ulp_copy_portmap(fc_portmap_t *map, opaque_t pd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_get_adapter_paths(char *pathList, int count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint32_t fc_ulp_get_rscn_count(opaque_t port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid fc_ulp_hold_remote_port(opaque_t port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_get_npiv_port_list(opaque_t port_handle, char *pathList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fc_ulp_get_npiv_port_num(opaque_t port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid fc_ulp_log_device_event(opaque_t port_handle, int type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _FC_ULPIF_H */