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 _FP_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _FP_H
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 * Debugging, Error reporting, and tracing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LOG_SIZE 1024 * 1024
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_1 0x00001 /* attach/detach PM CPR */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_2 0x00002 /* startup */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_3 0x00004 /* state change, discovery */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_4 0x00008 /* statec/devc to ULPs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_5 0x00010 /* FCA UB callbacks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_6 0x00020 /* Name Server */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_7 0x00040 /* RSCN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_8 0x00080 /* I/O tracing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_LEVEL_9 0x00100 /* Failure messages */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Log contents to system messages file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_1 (FP_LEVEL_1 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_2 (FP_LEVEL_2 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_3 (FP_LEVEL_3 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_4 (FP_LEVEL_4 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_5 (FP_LEVEL_5 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_6 (FP_LEVEL_6 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_7 (FP_LEVEL_7 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_8 (FP_LEVEL_8 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_LEVEL_9 (FP_LEVEL_9 | FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Log contents to trace buffer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_1 (FP_LEVEL_1 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_2 (FP_LEVEL_2 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_3 (FP_LEVEL_3 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_4 (FP_LEVEL_4 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_5 (FP_LEVEL_5 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_6 (FP_LEVEL_6 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_7 (FP_LEVEL_7 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_8 (FP_LEVEL_8 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_BUF_LEVEL_9 (FP_LEVEL_9 | FC_TRACE_LOG_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Log contents to both system messages file and trace buffer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_1 (FP_LEVEL_1 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_2 (FP_LEVEL_2 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_3 (FP_LEVEL_3 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_4 (FP_LEVEL_4 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_5 (FP_LEVEL_5 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_6 (FP_LEVEL_6 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_7 (FP_LEVEL_7 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_8 (FP_LEVEL_8 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_LEVEL_9 (FP_LEVEL_9 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Log contents to system messages file, console and trace buffer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_1 (FP_LEVEL_1 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_2 (FP_LEVEL_2 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_3 (FP_LEVEL_3 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_4 (FP_LEVEL_4 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_5 (FP_LEVEL_5 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_6 (FP_LEVEL_6 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_7 (FP_LEVEL_7 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_8 (FP_LEVEL_8 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MSG_BUF_CONSOLE_LEVEL_9 (FP_LEVEL_9 | FC_TRACE_LOG_BUF |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_TRACE_LOG_MSG | FC_TRACE_LOG_CONSOLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_DTRACE fc_trace_debug
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_DTRACE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TRACE fc_trace_debug
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TRACE_DEFAULT (FC_TRACE_LOG_MASK | FP_LEVEL_1 |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LEVEL_2 | FP_LEVEL_3 |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LEVEL_4 | FP_LEVEL_5 |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LEVEL_6 | FP_LEVEL_7 | FP_LEVEL_9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TRACE_DEFAULT (FC_TRACE_LOG_MASK | FP_LEVEL_1 |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LEVEL_2 | FP_LEVEL_3 |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LEVEL_4 | FP_LEVEL_5 |\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LEVEL_6 | FP_LEVEL_7 | FP_LEVEL_9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_THEAD(x, y, z) fp_logq, x->fp_ibuf, fp_trace, y, z
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_NHEAD1(x, y) FP_THEAD(port, FP_BUF_LEVEL_##x, y)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_NHEAD2(x, y) FP_THEAD(port, FP_MSG_BUF_LEVEL_##x, y)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_NHEAD3(x, y) FP_THEAD(port, FP_MSG_BUF_CONSOLE_LEVEL_##x, y)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* This is used in about a dozen or so places in fp.c */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_IS_PKT_ERROR(pkt) (((pkt)->pkt_state != FC_PKT_SUCCESS) ||\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((pkt)->pkt_state == FC_PKT_SUCCESS &&\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pkt)->pkt_resp_resid != 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is only used in fp_ns_init() and fp_fabric_online().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_MAX_DEVICES 255
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Software restoration bit fields while doing (PM)SUSPEND/(PM)RESUME
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used with the fp_restore field in the fc_local_port_t struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_RESTORE_WAIT_TIMEOUT 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_RESTORE_OFFLINE_TIMEOUT 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_ELS_TIMEOUT (20)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_NS_TIMEOUT (120)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_IS_F_PORT(p) ((p) & 0x1000)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_RETRY_COUNT (5)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_RETRY_DELAY (3) /* E_D_TOV + 1 second */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_OFFLINE_TICKER (90) /* seconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_DEFAULT_SID (0x000AE) /* Used once */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_DEFAULT_DID (0x000EA) /* Used once */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_PORT_IDENTIFIER_LEN (4)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_UNSOL_BUF_COUNT (20)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_UNSOL_BUF_SIZE (sizeof (la_els_logi_t))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMDWAIT_DELAY (240) /* Enough time for all cmds to complt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Values and macros used with fp_task and fp_last_task fields in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the fc_local_port_t struct. Also see fp_job_handler() for more info.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TASK_IDLE 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TASK_PORT_STARTUP 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TASK_OFFLINE 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TASK_ONLINE 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_TASK_GETMAP 4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd_flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMD_CFLAG_UNDEFINED (-1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMD_PLOGI_DONT_CARE 0x00
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMD_PLOGI_RETAIN 0x01 /* Retain LOGIN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMD_DELDEV_ON_ERROR 0x02 /* Remove device on error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd_dflags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMD_VALID_DMA_MEM 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_CMD_VALID_DMA_BIND 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_RESP_VALID_DMA_MEM 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_RESP_VALID_DMA_BIND 0x08
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Values for fp_flag field in the fc_local_port_t struct */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_IDLE 0x00
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_OPEN 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_EXCL 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_EXCL_BUSY 0x04 /* Exclusive operation in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* message block/unblock'ing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_WARNING_MESSAGES 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_FATAL_MESSAGES 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FP_IS_CLASS_1_OR_2(x) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((x) == FC_TRAN_CLASS1 || (x) == FC_TRAN_CLASS2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Driver message control
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum fp_mesg_dest {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_CONSOLE_ONLY,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LOG_ONLY,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FP_LOG_AND_CONSOLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fp_mesg_dest_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct soft_attach {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_attach_cmd_t att_cmd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_local_port *att_port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t att_need_pm_idle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fp_soft_attach_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fp_cmd {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t cmd_dflags; /* DMA flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ksema_t cmd_sema;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int cmd_flags; /* cmd flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int cmd_retry_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int cmd_retry_interval; /* milli secs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_packet_t cmd_pkt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t *cmd_port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t cmd_private;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fp_cmd *cmd_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_packet_t *cmd_ulp_pkt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *cmd_job;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*cmd_transport) (opaque_t fca_handle, fc_packet_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fp_cmd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fp_unsol_spec {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t *port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_unsol_buf_t *buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fp_unsol_spec_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(__lint)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", fp_cmd))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", soft_attach))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", fp_unsol_spec))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __lint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Procedure templates.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_detach(dev_info_t *dip, ddi_detach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *arg, void **result);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_power(dev_info_t *dip, int comp, int level);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_open(dev_t *devp, int flag, int otype, cred_t *credp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_close(dev_t dev, int flag, int otype, cred_t *credp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ioctl(dev_t dev, int cmd, intptr_t data, int mode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cred_t *credp, int *rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_attach_handler(dev_info_t *dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_resume_handler(dev_info_t *dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_power_up(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_resume_all(fc_local_port_t *port, fc_attach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_detach_handler(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_suspend_handler(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_power_down(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_suspend_all(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_cache_constructor(void *buf, void *cdarg, int kmflags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_cache_destructor(void *buf, void *cdarg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic fp_cmd_t *fp_alloc_pkt(fc_local_port_t *port, int cmd_len,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int resp_len, int kmflags, fc_remote_port_t *pd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_free_pkt(fp_cmd_t *cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_free_dma(fp_cmd_t *cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_job_handler(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_port_startup(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_startup_done(opaque_t arg, uchar_t result);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ulp_port_attach(void *arg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_sendcmd(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opaque_t fca_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_resendcmd(void *port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_retry_cmd(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_enque_cmd(fc_local_port_t *port, fp_cmd_t *cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_handle_reject(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uchar_t fp_get_nextclass(fc_local_port_t *port, uchar_t cur_class);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_is_class_supported(uint32_t cos, uchar_t tran_class);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic fp_cmd_t *fp_deque_cmd(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_jobwait(job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fp_state_to_rval(uchar_t state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_iodone(fp_cmd_t *cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_jobdone(job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_port_shutdown(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_get_loopmap(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_loop_online(fc_local_port_t *port, job_request_t *job,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int orphan);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_get_lilpmap(fc_local_port_t *port, fc_lilpmap_t *lilp_map);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fabric_login(fc_local_port_t *port, uint32_t s_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int flag, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_port_login(fc_local_port_t *port, uint32_t d_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int cmd_flag, int sleep, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_packet_t *ulp_pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_register_login(ddi_acc_handle_t *handle, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_els_logi_t *acc, uchar_t class);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_remote_port_offline(fc_remote_port_t *pd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_unregister_login(fc_remote_port_t *pd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_port_offline(fc_local_port_t *port, int notify);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_offline_timeout(void *port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_els_init(fp_cmd_t *cmd, uint32_t s_id, uint32_t d_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void (*comp) (), job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_xlogi_init(fc_local_port_t *port, fp_cmd_t *cmd, uint32_t s_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t d_id, void (*intr) (), job_request_t *job, uchar_t ls_code);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_logo_init(fc_remote_port_t *pd, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_adisc_init(fp_cmd_t *cmd, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ulp_statec_cb(fc_local_port_t *port, uint32_t state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portmap_t *changelist, uint32_t listlen, uint32_t alloc_len, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ulp_devc_cb(fc_local_port_t *port, fc_portmap_t *changelist,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t listlen, uint32_t alloc_len, int sleep, int sync);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_plogi_group(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ns_init(fc_local_port_t *port, job_request_t *job, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ns_fini(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ns_reg(fc_local_port_t *port, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t cmd_code, job_request_t *job, int polled, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_common_intr(fc_packet_t *pkt, int iodone);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_flogi_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_plogi_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_adisc_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_logo_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_rls_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_rnid_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_send_rnid(fc_local_port_t *port, intptr_t data, int mode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio_t *fcio, la_wwn_t *pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_get_rnid(fc_local_port_t *port, intptr_t data, int mode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio_t *fcio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_set_rnid(fc_local_port_t *port, intptr_t data, int mode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio_t *fcio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_statec_cb(opaque_t port_handle, uint32_t state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ns_scr(fc_local_port_t *port, job_request_t *job,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t scr_func, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ns_get_devcount(fc_local_port_t *port, job_request_t *job,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int create, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fciocmd(fc_local_port_t *port, intptr_t data, int mode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio_t *fcio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_copyout(void *from, void *to, size_t len, int mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fcio_copyout(fcio_t *fcio, intptr_t data, int mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_p2p_online(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fillout_p2pmap(fc_local_port_t *port, fcio_t *fcio, int mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_fabric_online(fc_local_port_t *port, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fillout_loopmap(fc_local_port_t *port, fcio_t *fcio, int mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_unsol_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_linit_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_unsol_cb(opaque_t port_handle, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_buf(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ba_rjt_init(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_unsol_buf_t *buf, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_els_rjt_init(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_unsol_buf_t *buf, uchar_t action, uchar_t reason, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_els_acc_init(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_unsol_buf_t *buf, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_logo(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_remote_port_t *pd, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_prlo(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_remote_port_t *pd, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_unsol_resp_init(fc_packet_t *pkt, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t r_ctl, uchar_t type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_i_handle_unsol_els(fc_local_port_t *port, fc_unsol_buf_t *buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_plogi(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_flogi(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_login_acc_init(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_unsol_buf_t *buf, job_request_t *job, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_rscn(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_fillout_old_map_held(fc_portmap_t *map, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_fillout_old_map(fc_portmap_t *map, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_fillout_changed_map(fc_portmap_t *map, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *new_did, la_wwn_t *new_pwwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_fillout_new_nsmap(fc_local_port_t *port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_acc_handle_t *handle, fc_portmap_t *port_map, ns_resp_gan_t *gan_resp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t d_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_remote_lip(fc_local_port_t *port, la_wwn_t *pwwn, int sleep,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_stuff_device_with_gan(ddi_acc_handle_t *handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_remote_port_t *pd, ns_resp_gan_t *gan_resp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ns_query(fc_local_port_t *port, fctl_ns_req_t *ns_cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int polled, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ct_init(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fctl_ns_req_t *ns_cmd, uint16_t cmd_code, caddr_t cmd_buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t cmd_len, uint16_t resp_len, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ns_intr(fc_packet_t *pkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_gan_handler(fc_packet_t *pkt, fctl_ns_req_t *ns_cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ns_query_handler(fc_packet_t *pkt, fctl_ns_req_t *ns_cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_handle_unsol_adisc(fc_local_port_t *port, fc_unsol_buf_t *buf,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_remote_port_t *pd, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_adisc_acc_init(fc_local_port_t *port, fp_cmd_t *cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_unsol_buf_t *buf, job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_load_ulp_modules(dev_info_t *dip, fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_logout(fc_local_port_t *port, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_attach_ulps(fc_local_port_t *port, fc_attach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ulp_notify(fc_local_port_t *port, uint32_t statec, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ns_getmap(fc_local_port_t *port, job_request_t *job,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portmap_t **map, uint32_t *len, uint32_t sid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic fc_remote_port_t *fp_create_remote_port_by_ns(fc_local_port_t *port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t d_id, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_check_perms(uchar_t open_flag, uint16_t ioctl_cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_bind_callbacks(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_retrieve_caps(fc_local_port_t *port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_validate_area_domain(fc_local_port_t *port, uint32_t id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t mask, job_request_t *job, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_validate_rscn_page(fc_local_port_t *port, fc_affected_id_t *page,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, fctl_ns_req_t *ns_cmd, fc_portmap_t *listptr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *listindex, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_ns_validate_device(fc_local_port_t *port, fc_remote_port_t *pd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job, int polled, int sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_validate_lilp_map(fc_lilpmap_t *lilp_map);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_is_valid_alpa(uchar_t al_pa);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_ulp_unsol_cb(void *arg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void fp_printf(fc_local_port_t *port, int level, fp_mesg_dest_t dest,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fc_errno, fc_packet_t *pkt, const char *fmt, ...);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fcio_logout(fc_local_port_t *port, fcio_t *fcio,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fp_fcio_login(fc_local_port_t *port, fcio_t *fcio,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_t *job);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _FP_H */