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 _SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_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#if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _BIT_FIELDS_LTOH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Link Application Opcodes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RJT 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ACC 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_PLOGI 0x03
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_FLOGI 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_LOGO 0x05
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ABTX 0x06
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RCS 0x07
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RES 0x08
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RSS 0x09
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RSI 0x0a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ESTS 0x0b
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ESTC 0x0c
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ADVC 0x0d
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RTV 0x0e
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RLS 0x0f
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ECHO 0x10
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RRQ 0x12
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_PRLI 0x20
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_PRLO 0x21
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_SCN 0x22
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_TPLS 0x23
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_GPRLO 0x24
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_GAID 0x30
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_FACT 0x31
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_FDACT 0x32
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_NACT 0x33
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_NDACT 0x34
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_QoSR 0x40
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RVCS 0x41
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_PDISC 0x50
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_FDISC 0x51
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_ADISC 0x52
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RSCN 0x61
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_SCR 0x62
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_LINIT 0x70
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LA_ELS_RNID 0x78
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LINIT status codes in the ACC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_LINIT_SUCCESS 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_LINIT_FAILURE 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Basic Accept Payload. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_ba_acc {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t org_sid : 24,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte seq_id : 8;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t seq_id : 8,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte org_sid : 24;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _BIT_FIELDS_LTOH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t ox_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t rx_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_ba_acc_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Basic Reject. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_ba_rjt {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reserved;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reason_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t explanation;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t vendor;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_ba_rjt_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Logout payload. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_els_logo {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ls_code_t ls_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portid_t nport_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t nport_ww_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_els_logo_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Address discovery */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_els_adisc {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ls_code_t ls_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_hardaddr_t hard_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t port_wwn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte la_wwn_t node_wwn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_portid_t nport_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_els_adisc_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Link Application Reject */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_els_rjt {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ls_code_t ls_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t action;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reason;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reserved;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t vu;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_els_rjt_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Process Login/Logout Service Parameter Page */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_OPA_VALID 0x8000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_RPA_VALID 0x4000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_ESTABLISH_IMAGE_PAIR 0x2000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_RESP_CODE_MASK 0x0F00
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_RESP_CODE_REQ_EXECUTED 0x0100
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct service_parameter_page {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t type_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t type_code_ext;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t opa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t rpa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t sp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} service_parameter_page_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Process login */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_els_prli {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t payload_length : 16,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte page_length : 8,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ls_code : 8;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ls_code : 8,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte page_length : 8,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte payload_length : 16;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _BIT_FIELDS_LTOH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t service_params[16];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_els_prli_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Process Logout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct la_els_prlo {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t ls_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t page_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t payload_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t type_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t type_code_extension;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t opa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t rpa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t reserved;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} la_els_prlo_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(__lint)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", la_ba_rjt))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_logo))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_adisc))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rjt))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_prli_t))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("unique per request", la_ba_acc))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __lint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H */