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/*
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _FCP_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _FCP_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Frame format and protocol definitions for transferring
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * commands and data between a SCSI initiator and target
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * using an FC4 serial link interface.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this file originally taken from fc4/fcp.h
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FCP Device Data Frame Information Categories
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_SCSI_DATA 0x01 /* frame contains SCSI data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_SCSI_CMD 0x02 /* frame contains SCSI command */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_SCSI_RSP 0x03 /* frame contains SCSI response */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_SCSI_XFER_RDY 0x05 /* frame contains xfer rdy block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp SCSI control structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fcp_cntl {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_reserved_0; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_reserved_1 : 5, /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_qtype : 3; /* tagged queueing type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_kill_tsk : 1, /* terminate task */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_clr_aca : 1, /* clear aca */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reset_tgt : 1, /* reset target */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reset_lun : 1, /* reset lun */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reserved_2 : 1, /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_clr_tsk : 1, /* clear task set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_abort_tsk : 1, /* abort task set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reserved_3 : 1; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_reserved_4 : 6, /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_read_data : 1, /* initiator read */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_write_data : 1; /* initiator write */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_qtype : 3, /* tagged queueing type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reserved_1 : 5; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_reserved_3 : 1, /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_abort_tsk : 1, /* abort task set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_clr_tsk : 1, /* clear task set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reserved_2 : 1, /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reset_lun : 1, /* reset lun */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reset_tgt : 1, /* reset target */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_clr_aca : 1, /* clear aca */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_kill_tsk : 1; /* terminate task */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cntl_write_data : 1, /* initiator write */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_read_data : 1, /* initiator read */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cntl_reserved_4 : 6; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#error one of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fcp_cntl_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp SCSI control tagged queueing types - cntl_qtype
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_QTYPE_SIMPLE 0 /* simple queueing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_QTYPE_HEAD_OF_Q 1 /* head of queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_QTYPE_ORDERED 2 /* ordered queueing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_QTYPE_ACA_Q_TAG 4 /* ACA queueing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_QTYPE_UNTAGGED 5 /* Untagged */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp SCSI entity address
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ent_addr_0 is always the first and highest layer of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the hierarchy. The depth of the hierarchy of addressing,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * up to a maximum of four layers, is arbitrary and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device-dependent.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fcp_ent_addr {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t ent_addr_0; /* entity address 0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t ent_addr_1; /* entity address 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t ent_addr_2; /* entity address 2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t ent_addr_3; /* entity address 3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fcp_ent_addr_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * maximum size of SCSI cdb in fcp SCSI command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_CDB_SIZE 16
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_LUN_SIZE 8
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_LUN_HEADER 8
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FCP SCSI command payload
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fcp_cmd {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_ent_addr_t fcp_ent_addr; /* entity address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_cntl_t fcp_cntl; /* SCSI options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t fcp_cdb[FCP_CDB_SIZE]; /* SCSI cdb */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fcp_data_len; /* data length */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fcp_cmd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp SCSI status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fcp_status {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t reserved_0; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reserved_1 : 4, /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resid_under : 1, /* resid non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resid_over : 1, /* resid non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sense_len_set : 1, /* sense_len non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rsp_len_set : 1; /* response_len non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t rsp_len_set : 1, /* response_len non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sense_len_set : 1, /* sense_len non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resid_over : 1, /* resid non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resid_under : 1, /* resid non-zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte reserved_1 : 4; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t scsi_status; /* status of cmd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fcp_status_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp SCSI response payload
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fcp_rsp {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t reserved_0; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t reserved_1; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte union {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_status_t fcp_status; /* command status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t i_fcp_status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } fcp_u;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fcp_resid; /* resid of operation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fcp_sense_len; /* sense data length */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t fcp_response_len; /* response data length */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 'm' bytes of scsi response info follow
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 'n' bytes of scsi sense info follow
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fcp_rsp_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* MAde 256 for sonoma as it wants to give tons of sense info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_MAX_RSP_IU_SIZE 256
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp rsp_info field format
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct fcp_rsp_info {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd3;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t rsp_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd4;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd5;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd6;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd7;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * rsp_code definitions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_NO_FAILURE 0x0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_DL_LEN_MISMATCH 0x1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_CMND_INVALID 0x2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_DATA_RO_MISMATCH 0x3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_TASK_MGMT_NOT_SUPPTD 0x4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FCP_TASK_MGMT_FAILED 0x5
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef THIS_NEEDED_YET
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp scsi_xfer_rdy payload
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fcp_xfer_rdy {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulong64_t fcp_seq_offset; /* relative offset */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulong64_t fcp_burst_len; /* buffer space */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulong64_t reserved; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fcp_xfer_rdy_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* THIS_NEEDED_YET */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp PRLI payload
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct fcp_prli {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t resvd1; /* rsvd by std */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t orig_process_assoc_valid : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resp_process_assoc_valid : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte establish_image_pair : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resvd2 : 13; /* rsvd by std */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t resvd2 : 13, /* rsvd by std */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte establish_image_pair : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resp_process_assoc_valid : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte orig_process_assoc_valid : 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t orig_process_associator;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t resp_process_associator;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t resvd3 : 23, /* rsvd by std */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retry : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte confirmed_compl_allowed : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte data_overlay_allowed : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initiator_fn : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte target_fn : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obsolete_2 : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obsolete_1 : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte read_xfer_rdy_disabled : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte write_xfer_rdy_disabled : 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t write_xfer_rdy_disabled : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte read_xfer_rdy_disabled : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obsolete_1 : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obsolete_2 : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte target_fn : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initiator_fn : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte data_overlay_allowed : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte confirmed_compl_allowed : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte retry : 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte resvd3 : 23; /* rsvd by std */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcp PRLI ACC payload
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct fcp_prli_acc {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t type;
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang uchar_t resvd1; /* type code extension */
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang#if defined(_BIT_FIELDS_HTOL)
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang uint16_t orig_process_assoc_valid : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang resp_process_assoc_valid : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang image_pair_established : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang resvd2 : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang accept_response_code : 4,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang resvd3 : 8;
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang#elif defined(_BIT_FIELDS_LTOH)
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang uint16_t resvd3 : 8,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang accept_response_code : 4,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang resvd2 : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang image_pair_established : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang resp_process_assoc_valid : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang orig_process_assoc_valid : 1;
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t orig_process_associator;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t resp_process_associator;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang#if defined(_BIT_FIELDS_HTOL)
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang uint32_t resvd4 : 26,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang initiator_fn : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang target_fn : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang cmd_data_mixed : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang data_resp_mixed : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang read_xfer_rdy_disabled : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang write_xfer_rdy_disabled : 1;
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang#elif defined(_BIT_FIELDS_LTOH)
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang uint32_t write_xfer_rdy_disabled : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang read_xfer_rdy_disabled : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang data_resp_mixed : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang cmd_data_mixed : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang target_fn : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang initiator_fn : 1,
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang resvd4 : 26;
7ff836697c120cb94bd30d5c2204eb9b74718e4cZhong Wang#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_UB_FCP_CDB_FLAG 0x0001 /* UB has valid cdb */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_UB_FCP_PORT_LOGOUT 0x0002 /* Port logout UB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_UB_FCP_ABORT_TASK 0x0004 /* Abort task UB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_UB_FCP_BUS_RESET 0x0008 /* Bus reset UB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_UB_FCP_CMD_DONE 0x8000 /* Work on this UB is done */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_UB_FCP_OOB_CMD (FC_UB_FCP_PORT_LOGOUT | FC_UB_FCP_ABORT_TASK \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte | FC_UB_FCP_BUS_RESET) /* Out-of-band traget cmds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(__lint)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_NOTE(SCHEME_PROTECTS_DATA("Unshared Data",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_cmd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_rsp
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_prli))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* __lint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FC4 type setttings for Name Server registration.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC4_TYPE_WORD_POS(x) ((uchar_t)(x) >> 5)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC4_TYPE_BIT_POS(x) ((uchar_t)(x) & 0x1F)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _FCP_H */