450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * CDDL HEADER START
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * The contents of this file are subject to the terms of the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Common Development and Distribution License (the "License").
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * You may not use this file except in compliance with the License.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * or http://www.opensolaris.org/os/licensing.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * See the License for the specific language governing permissions
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * and limitations under the License.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * If applicable, add the following below this CDDL HEADER, with the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * CDDL HEADER END
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
716c180559045549271833327182dc6a266134f1Nattuvetty Bhavyan * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#ifndef _SYS_PPPT_IC_IF_H
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#define _SYS_PPPT_IC_IF_H
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#include <sys/stmf_defines.h>
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#ifdef __cplusplus
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forteextern "C" {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#endif
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * ALUA messaging and interconnect API.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Message type.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef enum {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_REGISTER_PROXY_PORT = 0,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_DEREGISTER_PROXY_PORT,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_REGISTER_LUN,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_DEREGISTER_LUN,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_SCSI_CMD,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_SCSI_DATA,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_SCSI_DATA_XFER_DONE,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_SCSI_STATUS,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_R2T,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_STATUS,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_SESSION_CREATE,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_SESSION_DESTROY,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_ECHO_REQUEST,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_ECHO_REPLY,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_LUN_ACTIVE,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_ICM_MAX_MSG_TYPE
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_msg_type_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Message id: uniquely identifies a message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * This need not be a sequence number since we don't depend on
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * messages being delivered in sequence.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef uint64_t stmf_ic_msgid_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * IC message. This is a container for the various specific message types.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Note that the message contains a pointer to an nvlist. This pointer
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * is valid only in the case of messages which are unmarshaled from
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * nvlists. In that case, it's important to retain a pointer to the nvlist,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * since the message and the nvlist share data in the case of strings
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * and array elements, and data in the message may be invalid if used
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * after the nvlist is freed.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct stmf_ic_msg {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msg_type_t icm_msg_type;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icm_msgid;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte nvlist_t *icm_nvlist; /* nvlist associated with the msg */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte void *icm_msg; /* ptr to the specific msg */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Register port message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *icrp_port_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t icrp_relative_port_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* opaque callback data */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t icrp_cb_arg_len;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrp_cb_arg;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_reg_port_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Deregister port message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *icdp_port_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* opaque callback data */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t icdp_cb_arg_len;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icdp_cb_arg;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_dereg_port_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Register/deregister lun message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icrl_lun_id[16];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *icrl_lu_provider_name;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* opaque callback data */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t icrl_cb_arg_len;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_cb_arg;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_reg_dereg_lun_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI cmd msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icsc_task_msgid;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *icsc_ini_devid;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *icsc_tgt_devid;
716c180559045549271833327182dc6a266134f1Nattuvetty Bhavyan stmf_remote_port_t *icsc_rport;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_lun_id[16];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * fields from scsi_task_t
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icsc_session_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_task_lun_no[8];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t icsc_task_expected_xfer_length;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t icsc_task_cdb_length;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icsc_task_cdb;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_task_flags; /* See def. for task flags */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_task_priority; /* As per SAM-3 */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsc_task_mgmt_function; /* if is a TM req */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t icsc_immed_data_len;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icsc_immed_data;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_scsi_cmd_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI data message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icsd_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icsd_session_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icsd_lun_id[16];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icsd_data_len;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icsd_data;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_scsi_data_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI data xfer done msg
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icsx_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icsx_session_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_status_t icsx_status;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_scsi_data_xfer_done_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * SCSI status msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icss_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icss_session_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_lun_id[16];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_response; /* was command processed? */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_status;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_flags; /* TASK_SCTRL_OVER, TASK_SCTRL_UNDER */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t icss_resid;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t icss_sense_len;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icss_sense;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_scsi_status_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Ready to transfer (r2t) msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t icrt_task_msgid; /* matches msgid of cmd */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icrt_session_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t icrt_offset;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t icrt_length;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_r2t_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Status message: sent in response to messages other than SCSI messages.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msg_type_t ics_msg_type; /* msg type rpting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t ics_msgid; /* msgid reporting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_status_t ics_status;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_status_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Session create/destroy message.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t icscd_session_id;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *icscd_ini_devid;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *icscd_tgt_devid;
716c180559045549271833327182dc6a266134f1Nattuvetty Bhavyan stmf_remote_port_t *icscd_rport;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_session_create_destroy_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Echo request/reply message
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef struct {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icerr_data;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t icerr_datalen;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_echo_request_reply_msg_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef enum {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_IC_MSG_SUCCESS = 0,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_IC_MSG_IC_DOWN,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_IC_MSG_TIMED_OUT,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte STMF_IC_MSG_INTERNAL_ERROR
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte} stmf_ic_msg_status_t;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Function prototypes.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Note: Functions which are exported to other modules must have a function
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * typedef and a prototype; the function type definition is used by
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * the other module to import the symbol using ddi_modsym().
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortevoid stmf_ic_ioctl_cmd(void *ibuf, uint32_t ibuf_size);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a register port message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_reg_port_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *port_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t relative_port_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_reg_port_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *port_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t relative_port_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a deregister port message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_dereg_port_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *port_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_dereg_port_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_devid_desc_t *port_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a register lun message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_reg_lun_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_lun_id, /* should be 16 bytes */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *lu_provider_name,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_reg_lun_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_lun_id, /* should be 16 bytes */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *lu_provider_name,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a lun active message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_lun_active_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_lun_id, /* should be 16 bytes */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *lu_provider_name,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_lun_active_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_lun_id, /* should be 16 bytes */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *lu_provider_name,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a deregister lun message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_dereg_lun_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_lun_id, /* should be 16 bytes */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *lu_provider_name,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_dereg_lun_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *icrl_lun_id, /* should be 16 bytes */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *lu_provider_name,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint16_t cb_arg_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *cb_arg,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi cmd message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_scsi_cmd_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_task_t *scsi_task,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t immed_data_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *immed_data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_scsi_cmd_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte scsi_task_t *scsi_task,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t immed_data_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *immed_data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi data message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_scsi_data_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t session_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *lun_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t data_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_scsi_data_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t session_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *lun_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t data_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi transfer done message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_scsi_data_xfer_done_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t session_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_status_t status,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_scsi_data_xfer_done_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t session_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_status_t status,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi status message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_scsi_status_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t session_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *lun_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t response, /* was command processed? */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t status,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t flags,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t resid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t sense_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *sense,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid); /* must match corresponding scsi cmd msgid */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a scsi ready to transfer (r2t) message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_r2t_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t task_msgid,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t session_id,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t offset,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t length,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid); /* must match corresponding scsi cmd msgid */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a status message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_status_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_status_t status,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msg_type_t msg_type, /* msg type reporting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid); /* id of msg reporting status on */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a session create message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_session_create_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_scsi_session_t *session,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_session_create_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_scsi_session_t *session,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate a session destroy message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *(*stmf_ic_session_destroy_msg_alloc_func_t)(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_scsi_session_t *session,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_session_destroy_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_scsi_session_t *session,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate an echo request message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_echo_request_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t data_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* Allocate an echo reply message */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_t *stmf_ic_echo_reply_msg_alloc(
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t data_len,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint8_t *data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte stmf_ic_msgid_t msgid);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Free a msg.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef void (*stmf_ic_msg_free_func_t)(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortevoid stmf_ic_msg_free(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Send a message out over the interconnect, in the process marshalling
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * the arguments.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * After being sent, the message is freed by tx_msg().
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetypedef stmf_ic_msg_status_t (*stmf_ic_tx_msg_func_t)(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_ic_msg_status_t stmf_ic_tx_msg(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * This is a low-level upcall which is called when a message has
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * been received on the interconnect.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortevoid stmf_ic_rx_msg(char *buf, size_t len);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_status_t stmf_msg_rx(stmf_ic_msg_t *msg);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#ifdef __cplusplus
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#endif
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#endif /* _SYS_PPPT_IC_IF_H */