xref: /illumos-gate/usr/src/uts/common/sys/pppt_ic_if.h (revision 716c1805)
145039663SJohn Forte /*
245039663SJohn Forte  * CDDL HEADER START
345039663SJohn Forte  *
445039663SJohn Forte  * The contents of this file are subject to the terms of the
545039663SJohn Forte  * Common Development and Distribution License (the "License").
645039663SJohn Forte  * You may not use this file except in compliance with the License.
745039663SJohn Forte  *
845039663SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
945039663SJohn Forte  * or http://www.opensolaris.org/os/licensing.
1045039663SJohn Forte  * See the License for the specific language governing permissions
1145039663SJohn Forte  * and limitations under the License.
1245039663SJohn Forte  *
1345039663SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
1445039663SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1545039663SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
1645039663SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
1745039663SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
1845039663SJohn Forte  *
1945039663SJohn Forte  * CDDL HEADER END
2045039663SJohn Forte  */
2145039663SJohn Forte /*
22*716c1805SNattuvetty Bhavyan  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
2345039663SJohn Forte  */
2445039663SJohn Forte #ifndef _SYS_PPPT_IC_IF_H
2545039663SJohn Forte #define	_SYS_PPPT_IC_IF_H
2645039663SJohn Forte 
2745039663SJohn Forte #include <sys/stmf_defines.h>
2845039663SJohn Forte 
2945039663SJohn Forte #ifdef	__cplusplus
3045039663SJohn Forte extern "C" {
3145039663SJohn Forte #endif
3245039663SJohn Forte 
3345039663SJohn Forte /*
3445039663SJohn Forte  * ALUA messaging and interconnect API.
3545039663SJohn Forte  */
3645039663SJohn Forte 
3745039663SJohn Forte /*
3845039663SJohn Forte  * Message type.
3945039663SJohn Forte  */
4045039663SJohn Forte typedef enum {
4145039663SJohn Forte 	STMF_ICM_REGISTER_PROXY_PORT = 0,
4245039663SJohn Forte 	STMF_ICM_DEREGISTER_PROXY_PORT,
4345039663SJohn Forte 	STMF_ICM_REGISTER_LUN,
4445039663SJohn Forte 	STMF_ICM_DEREGISTER_LUN,
4545039663SJohn Forte 	STMF_ICM_SCSI_CMD,
4645039663SJohn Forte 	STMF_ICM_SCSI_DATA,
4745039663SJohn Forte 	STMF_ICM_SCSI_DATA_XFER_DONE,
4845039663SJohn Forte 	STMF_ICM_SCSI_STATUS,
4945039663SJohn Forte 	STMF_ICM_R2T,
5045039663SJohn Forte 	STMF_ICM_STATUS,
5145039663SJohn Forte 	STMF_ICM_SESSION_CREATE,
5245039663SJohn Forte 	STMF_ICM_SESSION_DESTROY,
5345039663SJohn Forte 	STMF_ICM_ECHO_REQUEST,
5445039663SJohn Forte 	STMF_ICM_ECHO_REPLY,
5545039663SJohn Forte 	STMF_ICM_LUN_ACTIVE,
5645039663SJohn Forte 	STMF_ICM_MAX_MSG_TYPE
5745039663SJohn Forte } stmf_ic_msg_type_t;
5845039663SJohn Forte 
5945039663SJohn Forte /*
6045039663SJohn Forte  * Message id: uniquely identifies a message.
6145039663SJohn Forte  * This need not be a sequence number since we don't depend on
6245039663SJohn Forte  * messages being delivered in sequence.
6345039663SJohn Forte  */
6445039663SJohn Forte typedef uint64_t stmf_ic_msgid_t;
6545039663SJohn Forte 
6645039663SJohn Forte /*
6745039663SJohn Forte  * IC message.  This is a container for the various specific message types.
6845039663SJohn Forte  *
6945039663SJohn Forte  * Note that the message contains a pointer to an nvlist.  This pointer
7045039663SJohn Forte  * is valid only in the case of messages which are unmarshaled from
7145039663SJohn Forte  * nvlists.  In that case, it's important to retain a pointer to the nvlist,
7245039663SJohn Forte  * since the message and the nvlist share data in the case of strings
7345039663SJohn Forte  * and array elements, and data in the message may be invalid if used
7445039663SJohn Forte  * after the nvlist is freed.
7545039663SJohn Forte  */
7645039663SJohn Forte typedef struct stmf_ic_msg {
7745039663SJohn Forte 	stmf_ic_msg_type_t icm_msg_type;
7845039663SJohn Forte 	stmf_ic_msgid_t icm_msgid;
7945039663SJohn Forte 	nvlist_t *icm_nvlist;		/* nvlist associated with the msg */
8045039663SJohn Forte 	void *icm_msg;			/* ptr to the specific msg */
8145039663SJohn Forte } stmf_ic_msg_t;
8245039663SJohn Forte 
8345039663SJohn Forte /*
8445039663SJohn Forte  * Register port message.
8545039663SJohn Forte  */
8645039663SJohn Forte typedef struct {
8745039663SJohn Forte 	scsi_devid_desc_t 	*icrp_port_id;
8845039663SJohn Forte 	uint16_t 		icrp_relative_port_id;
8945039663SJohn Forte 	/* opaque callback data */
9045039663SJohn Forte 	uint16_t		icrp_cb_arg_len;
9145039663SJohn Forte 	uint8_t			*icrp_cb_arg;
9245039663SJohn Forte } stmf_ic_reg_port_msg_t;
9345039663SJohn Forte 
9445039663SJohn Forte /*
9545039663SJohn Forte  * Deregister port message.
9645039663SJohn Forte  */
9745039663SJohn Forte typedef struct {
9845039663SJohn Forte 	scsi_devid_desc_t 	*icdp_port_id;
9945039663SJohn Forte 	/* opaque callback data */
10045039663SJohn Forte 	uint16_t		icdp_cb_arg_len;
10145039663SJohn Forte 	uint8_t			*icdp_cb_arg;
10245039663SJohn Forte } stmf_ic_dereg_port_msg_t;
10345039663SJohn Forte 
10445039663SJohn Forte /*
10545039663SJohn Forte  * Register/deregister lun message.
10645039663SJohn Forte  */
10745039663SJohn Forte typedef struct {
10845039663SJohn Forte 	uint8_t 		icrl_lun_id[16];
10945039663SJohn Forte 	char			*icrl_lu_provider_name;
11045039663SJohn Forte 	/* opaque callback data */
11145039663SJohn Forte 	uint16_t		icrl_cb_arg_len;
11245039663SJohn Forte 	uint8_t			*icrl_cb_arg;
11345039663SJohn Forte } stmf_ic_reg_dereg_lun_msg_t;
11445039663SJohn Forte 
11545039663SJohn Forte /*
11645039663SJohn Forte  * SCSI cmd msg.
11745039663SJohn Forte  */
11845039663SJohn Forte typedef struct {
11945039663SJohn Forte 	stmf_ic_msgid_t		icsc_task_msgid;
12045039663SJohn Forte 	scsi_devid_desc_t	*icsc_ini_devid;
12145039663SJohn Forte 	scsi_devid_desc_t	*icsc_tgt_devid;
122*716c1805SNattuvetty Bhavyan 	stmf_remote_port_t	*icsc_rport;
12345039663SJohn Forte 	uint8_t 		icsc_lun_id[16];
12445039663SJohn Forte 	/*
12545039663SJohn Forte 	 * fields from scsi_task_t
12645039663SJohn Forte 	 */
12745039663SJohn Forte 	uint64_t	icsc_session_id;
12845039663SJohn Forte 	uint8_t		icsc_task_lun_no[8];
12945039663SJohn Forte 	uint32_t	icsc_task_expected_xfer_length;
13045039663SJohn Forte 	uint16_t	icsc_task_cdb_length;
13145039663SJohn Forte 	uint8_t 	*icsc_task_cdb;
13245039663SJohn Forte 	uint8_t		icsc_task_flags;	/* See def. for task flags */
13345039663SJohn Forte 	uint8_t		icsc_task_priority;	/* As per SAM-3 */
13445039663SJohn Forte 	uint8_t		icsc_task_mgmt_function;	/* if is a TM req */
13545039663SJohn Forte 	uint32_t	icsc_immed_data_len;
13645039663SJohn Forte 	uint8_t		*icsc_immed_data;
13745039663SJohn Forte } stmf_ic_scsi_cmd_msg_t;
13845039663SJohn Forte 
13945039663SJohn Forte /*
14045039663SJohn Forte  * SCSI data message.
14145039663SJohn Forte  */
14245039663SJohn Forte typedef struct {
14345039663SJohn Forte 	stmf_ic_msgid_t icsd_task_msgid;	/* matches msgid of cmd */
14445039663SJohn Forte 	uint64_t icsd_session_id;
14545039663SJohn Forte 	uint8_t icsd_lun_id[16];
14645039663SJohn Forte 	uint64_t icsd_data_len;
14745039663SJohn Forte 	uint8_t *icsd_data;
14845039663SJohn Forte } stmf_ic_scsi_data_msg_t;
14945039663SJohn Forte 
15045039663SJohn Forte /*
15145039663SJohn Forte  * SCSI data xfer done msg
15245039663SJohn Forte  */
15345039663SJohn Forte typedef struct {
15445039663SJohn Forte 	stmf_ic_msgid_t icsx_task_msgid;	/* matches msgid of cmd */
15545039663SJohn Forte 	uint64_t icsx_session_id;
15645039663SJohn Forte 	stmf_status_t	icsx_status;
15745039663SJohn Forte } stmf_ic_scsi_data_xfer_done_msg_t;
15845039663SJohn Forte 
15945039663SJohn Forte /*
16045039663SJohn Forte  * SCSI status msg.
16145039663SJohn Forte  */
16245039663SJohn Forte typedef struct {
16345039663SJohn Forte 	stmf_ic_msgid_t icss_task_msgid;	/* matches msgid of cmd */
16445039663SJohn Forte 	uint64_t icss_session_id;
16545039663SJohn Forte 	uint8_t icss_lun_id[16];
16645039663SJohn Forte 	uint8_t icss_response;		/* was command processed? */
16745039663SJohn Forte 	uint8_t icss_status;
16845039663SJohn Forte 	uint8_t	icss_flags;		/* TASK_SCTRL_OVER, TASK_SCTRL_UNDER */
16945039663SJohn Forte 	uint32_t icss_resid;
17045039663SJohn Forte 	uint8_t	icss_sense_len;
17145039663SJohn Forte 	uint8_t	*icss_sense;
17245039663SJohn Forte } stmf_ic_scsi_status_msg_t;
17345039663SJohn Forte 
17445039663SJohn Forte /*
17545039663SJohn Forte  * Ready to transfer (r2t) msg.
17645039663SJohn Forte  */
17745039663SJohn Forte typedef struct {
17845039663SJohn Forte 	stmf_ic_msgid_t icrt_task_msgid;	/* matches msgid of cmd */
17945039663SJohn Forte 	uint64_t icrt_session_id;
18045039663SJohn Forte 	uint32_t icrt_offset;
18145039663SJohn Forte 	uint32_t icrt_length;
18245039663SJohn Forte } stmf_ic_r2t_msg_t;
18345039663SJohn Forte 
18445039663SJohn Forte /*
18545039663SJohn Forte  * Status message: sent in response to messages other than SCSI messages.
18645039663SJohn Forte  */
18745039663SJohn Forte typedef struct {
18845039663SJohn Forte 	stmf_ic_msg_type_t ics_msg_type;	/* msg type rpting status on */
18945039663SJohn Forte 	stmf_ic_msgid_t ics_msgid;		/* msgid reporting status on */
19045039663SJohn Forte 	stmf_status_t ics_status;
19145039663SJohn Forte } stmf_ic_status_msg_t;
19245039663SJohn Forte 
19345039663SJohn Forte /*
19445039663SJohn Forte  * Session create/destroy message.
19545039663SJohn Forte  */
19645039663SJohn Forte typedef struct {
19745039663SJohn Forte 	uint64_t		icscd_session_id;
19845039663SJohn Forte 	scsi_devid_desc_t	*icscd_ini_devid;
19945039663SJohn Forte 	scsi_devid_desc_t	*icscd_tgt_devid;
200*716c1805SNattuvetty Bhavyan 	stmf_remote_port_t	*icscd_rport;
20145039663SJohn Forte } stmf_ic_session_create_destroy_msg_t;
20245039663SJohn Forte 
20345039663SJohn Forte /*
20445039663SJohn Forte  * Echo request/reply message
20545039663SJohn Forte  */
20645039663SJohn Forte typedef struct {
20745039663SJohn Forte 	uint8_t			*icerr_data;
20845039663SJohn Forte 	uint32_t		icerr_datalen;
20945039663SJohn Forte } stmf_ic_echo_request_reply_msg_t;
21045039663SJohn Forte 
21145039663SJohn Forte typedef enum {
21245039663SJohn Forte 	STMF_IC_MSG_SUCCESS = 0,
21345039663SJohn Forte 	STMF_IC_MSG_IC_DOWN,
21445039663SJohn Forte 	STMF_IC_MSG_TIMED_OUT,
21545039663SJohn Forte 	STMF_IC_MSG_INTERNAL_ERROR
21645039663SJohn Forte } stmf_ic_msg_status_t;
21745039663SJohn Forte 
21845039663SJohn Forte /*
21945039663SJohn Forte  * Function prototypes.
22045039663SJohn Forte  *
22145039663SJohn Forte  * Note: Functions which are exported to other modules must have a function
22245039663SJohn Forte  * typedef and a prototype; the function type definition is used by
22345039663SJohn Forte  * the other module to import the symbol using ddi_modsym().
22445039663SJohn Forte  */
22545039663SJohn Forte 
22645039663SJohn Forte void stmf_ic_ioctl_cmd(void *ibuf, uint32_t ibuf_size);
22745039663SJohn Forte 
22845039663SJohn Forte /* Allocate a register port message */
22945039663SJohn Forte typedef
23045039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_reg_port_msg_alloc_func_t)(
23145039663SJohn Forte     scsi_devid_desc_t *port_id,
23245039663SJohn Forte     uint16_t relative_port_id,
23345039663SJohn Forte     uint16_t cb_arg_len,
23445039663SJohn Forte     uint8_t *cb_arg,
23545039663SJohn Forte     stmf_ic_msgid_t msgid);
23645039663SJohn Forte 
23745039663SJohn Forte stmf_ic_msg_t *stmf_ic_reg_port_msg_alloc(
23845039663SJohn Forte     scsi_devid_desc_t *port_id,
23945039663SJohn Forte     uint16_t relative_port_id,
24045039663SJohn Forte     uint16_t cb_arg_len,
24145039663SJohn Forte     uint8_t *cb_arg,
24245039663SJohn Forte     stmf_ic_msgid_t msgid);
24345039663SJohn Forte 
24445039663SJohn Forte /* Allocate a deregister port message */
24545039663SJohn Forte typedef
24645039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_dereg_port_msg_alloc_func_t)(
24745039663SJohn Forte     scsi_devid_desc_t *port_id,
24845039663SJohn Forte     uint16_t cb_arg_len,
24945039663SJohn Forte     uint8_t *cb_arg,
25045039663SJohn Forte     stmf_ic_msgid_t msgid);
25145039663SJohn Forte 
25245039663SJohn Forte stmf_ic_msg_t *stmf_ic_dereg_port_msg_alloc(
25345039663SJohn Forte     scsi_devid_desc_t *port_id,
25445039663SJohn Forte     uint16_t cb_arg_len,
25545039663SJohn Forte     uint8_t *cb_arg,
25645039663SJohn Forte     stmf_ic_msgid_t msgid);
25745039663SJohn Forte 
25845039663SJohn Forte 
25945039663SJohn Forte /* Allocate a register lun message */
26045039663SJohn Forte typedef
26145039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_reg_lun_msg_alloc_func_t)(
26245039663SJohn Forte     uint8_t *icrl_lun_id,	/* should be 16 bytes */
26345039663SJohn Forte     char *lu_provider_name,
26445039663SJohn Forte     uint16_t cb_arg_len,
26545039663SJohn Forte     uint8_t *cb_arg,
26645039663SJohn Forte     stmf_ic_msgid_t msgid);
26745039663SJohn Forte 
26845039663SJohn Forte stmf_ic_msg_t *stmf_ic_reg_lun_msg_alloc(
26945039663SJohn Forte     uint8_t *icrl_lun_id,	/* should be 16 bytes */
27045039663SJohn Forte     char *lu_provider_name,
27145039663SJohn Forte     uint16_t cb_arg_len,
27245039663SJohn Forte     uint8_t *cb_arg,
27345039663SJohn Forte     stmf_ic_msgid_t msgid);
27445039663SJohn Forte 
27545039663SJohn Forte /* Allocate a lun active message */
27645039663SJohn Forte typedef
27745039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_lun_active_msg_alloc_func_t)(
27845039663SJohn Forte     uint8_t *icrl_lun_id,	/* should be 16 bytes */
27945039663SJohn Forte     char *lu_provider_name,
28045039663SJohn Forte     uint16_t cb_arg_len,
28145039663SJohn Forte     uint8_t *cb_arg,
28245039663SJohn Forte     stmf_ic_msgid_t msgid);
28345039663SJohn Forte 
28445039663SJohn Forte stmf_ic_msg_t *stmf_ic_lun_active_msg_alloc(
28545039663SJohn Forte     uint8_t *icrl_lun_id,	/* should be 16 bytes */
28645039663SJohn Forte     char *lu_provider_name,
28745039663SJohn Forte     uint16_t cb_arg_len,
28845039663SJohn Forte     uint8_t *cb_arg,
28945039663SJohn Forte     stmf_ic_msgid_t msgid);
29045039663SJohn Forte 
29145039663SJohn Forte /* Allocate a deregister lun message */
29245039663SJohn Forte typedef
29345039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_dereg_lun_msg_alloc_func_t)(
29445039663SJohn Forte     uint8_t *icrl_lun_id,	/* should be 16 bytes */
29545039663SJohn Forte     char *lu_provider_name,
29645039663SJohn Forte     uint16_t cb_arg_len,
29745039663SJohn Forte     uint8_t *cb_arg,
29845039663SJohn Forte     stmf_ic_msgid_t msgid);
29945039663SJohn Forte 
30045039663SJohn Forte stmf_ic_msg_t *stmf_ic_dereg_lun_msg_alloc(
30145039663SJohn Forte     uint8_t *icrl_lun_id,	/* should be 16 bytes */
30245039663SJohn Forte     char *lu_provider_name,
30345039663SJohn Forte     uint16_t cb_arg_len,
30445039663SJohn Forte     uint8_t *cb_arg,
30545039663SJohn Forte     stmf_ic_msgid_t msgid);
30645039663SJohn Forte 
30745039663SJohn Forte /* Allocate a scsi cmd message */
30845039663SJohn Forte typedef
30945039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_scsi_cmd_msg_alloc_func_t)(
31045039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
31145039663SJohn Forte     scsi_task_t 	*scsi_task,
31245039663SJohn Forte     uint32_t		immed_data_len,
31345039663SJohn Forte     uint8_t		*immed_data,
31445039663SJohn Forte     stmf_ic_msgid_t msgid);
31545039663SJohn Forte 
31645039663SJohn Forte stmf_ic_msg_t *stmf_ic_scsi_cmd_msg_alloc(
31745039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
31845039663SJohn Forte     scsi_task_t 	*scsi_task,
31945039663SJohn Forte     uint32_t		immed_data_len,
32045039663SJohn Forte     uint8_t		*immed_data,
32145039663SJohn Forte     stmf_ic_msgid_t msgid);
32245039663SJohn Forte 
32345039663SJohn Forte /* Allocate a scsi data message */
32445039663SJohn Forte typedef
32545039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_scsi_data_msg_alloc_func_t)(
32645039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
32745039663SJohn Forte     uint64_t		session_id,
32845039663SJohn Forte     uint8_t		*lun_id,
32945039663SJohn Forte     uint64_t		data_len,
33045039663SJohn Forte     uint8_t		*data,
33145039663SJohn Forte     stmf_ic_msgid_t msgid);
33245039663SJohn Forte 
33345039663SJohn Forte stmf_ic_msg_t *stmf_ic_scsi_data_msg_alloc(
33445039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
33545039663SJohn Forte     uint64_t		session_id,
33645039663SJohn Forte     uint8_t		*lun_id,
33745039663SJohn Forte     uint64_t		data_len,
33845039663SJohn Forte     uint8_t		*data,
33945039663SJohn Forte     stmf_ic_msgid_t msgid);
34045039663SJohn Forte 
34145039663SJohn Forte /* Allocate a scsi transfer done message */
34245039663SJohn Forte typedef
34345039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_scsi_data_xfer_done_msg_alloc_func_t)(
34445039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
34545039663SJohn Forte     uint64_t		session_id,
34645039663SJohn Forte     stmf_status_t	status,
34745039663SJohn Forte     stmf_ic_msgid_t	msgid);
34845039663SJohn Forte 
34945039663SJohn Forte stmf_ic_msg_t *stmf_ic_scsi_data_xfer_done_msg_alloc(
35045039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
35145039663SJohn Forte     uint64_t		session_id,
35245039663SJohn Forte     stmf_status_t	status,
35345039663SJohn Forte     stmf_ic_msgid_t	msgid);
35445039663SJohn Forte 
35545039663SJohn Forte 
35645039663SJohn Forte /* Allocate a scsi status message */
35745039663SJohn Forte stmf_ic_msg_t *stmf_ic_scsi_status_msg_alloc(
35845039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
35945039663SJohn Forte     uint64_t		session_id,
36045039663SJohn Forte     uint8_t		*lun_id,
36145039663SJohn Forte     uint8_t		response,		/* was command processed? */
36245039663SJohn Forte     uint8_t		status,
36345039663SJohn Forte     uint8_t		flags,
36445039663SJohn Forte     uint32_t 		resid,
36545039663SJohn Forte     uint8_t		sense_len,
36645039663SJohn Forte     uint8_t		*sense,
36745039663SJohn Forte     stmf_ic_msgid_t msgid);	/* must match corresponding scsi cmd msgid */
36845039663SJohn Forte 
36945039663SJohn Forte 
37045039663SJohn Forte /* Allocate a scsi ready to transfer (r2t) message */
37145039663SJohn Forte stmf_ic_msg_t *stmf_ic_r2t_msg_alloc(
37245039663SJohn Forte     stmf_ic_msgid_t 	task_msgid,
37345039663SJohn Forte     uint64_t		session_id,
37445039663SJohn Forte     uint32_t		offset,
37545039663SJohn Forte     uint32_t		length,
37645039663SJohn Forte     stmf_ic_msgid_t msgid);	/* must match corresponding scsi cmd msgid */
37745039663SJohn Forte 
37845039663SJohn Forte /* Allocate a status message */
37945039663SJohn Forte stmf_ic_msg_t *stmf_ic_status_msg_alloc(
38045039663SJohn Forte     stmf_status_t	status,
38145039663SJohn Forte     stmf_ic_msg_type_t	msg_type,	/* msg type reporting status on */
38245039663SJohn Forte     stmf_ic_msgid_t 	msgid);		/* id of msg reporting status on */
38345039663SJohn Forte 
38445039663SJohn Forte /* Allocate a session create message */
38545039663SJohn Forte typedef
38645039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_session_create_msg_alloc_func_t)(
38745039663SJohn Forte     stmf_scsi_session_t *session,
38845039663SJohn Forte     stmf_ic_msgid_t msgid);
38945039663SJohn Forte 
39045039663SJohn Forte stmf_ic_msg_t *stmf_ic_session_create_msg_alloc(
39145039663SJohn Forte     stmf_scsi_session_t *session,
39245039663SJohn Forte     stmf_ic_msgid_t msgid);
39345039663SJohn Forte 
39445039663SJohn Forte /* Allocate a session destroy message */
39545039663SJohn Forte typedef
39645039663SJohn Forte stmf_ic_msg_t *(*stmf_ic_session_destroy_msg_alloc_func_t)(
39745039663SJohn Forte     stmf_scsi_session_t *session,
39845039663SJohn Forte     stmf_ic_msgid_t msgid);
39945039663SJohn Forte 
40045039663SJohn Forte stmf_ic_msg_t *stmf_ic_session_destroy_msg_alloc(
40145039663SJohn Forte     stmf_scsi_session_t *session,
40245039663SJohn Forte     stmf_ic_msgid_t msgid);
40345039663SJohn Forte 
40445039663SJohn Forte /* Allocate an echo request message */
40545039663SJohn Forte stmf_ic_msg_t *stmf_ic_echo_request_msg_alloc(
40645039663SJohn Forte     uint32_t data_len,
40745039663SJohn Forte     uint8_t *data,
40845039663SJohn Forte     stmf_ic_msgid_t msgid);
40945039663SJohn Forte 
41045039663SJohn Forte /* Allocate an echo reply message */
41145039663SJohn Forte stmf_ic_msg_t *stmf_ic_echo_reply_msg_alloc(
41245039663SJohn Forte     uint32_t data_len,
41345039663SJohn Forte     uint8_t *data,
41445039663SJohn Forte     stmf_ic_msgid_t msgid);
41545039663SJohn Forte 
41645039663SJohn Forte /*
41745039663SJohn Forte  * Free a msg.
41845039663SJohn Forte  */
41945039663SJohn Forte typedef void (*stmf_ic_msg_free_func_t)(stmf_ic_msg_t *msg);
42045039663SJohn Forte void stmf_ic_msg_free(stmf_ic_msg_t *msg);
42145039663SJohn Forte 
42245039663SJohn Forte /*
42345039663SJohn Forte  * Send a message out over the interconnect, in the process marshalling
42445039663SJohn Forte  * the arguments.
42545039663SJohn Forte  *
42645039663SJohn Forte  * After being sent, the message is freed by tx_msg().
42745039663SJohn Forte  */
42845039663SJohn Forte typedef stmf_ic_msg_status_t (*stmf_ic_tx_msg_func_t)(stmf_ic_msg_t *msg);
42945039663SJohn Forte stmf_ic_msg_status_t stmf_ic_tx_msg(stmf_ic_msg_t *msg);
43045039663SJohn Forte 
43145039663SJohn Forte /*
43245039663SJohn Forte  * This is a low-level upcall which is called when a message has
43345039663SJohn Forte  * been received on the interconnect.
43445039663SJohn Forte  */
43545039663SJohn Forte void stmf_ic_rx_msg(char *buf, size_t len);
43645039663SJohn Forte 
43745039663SJohn Forte stmf_status_t stmf_msg_rx(stmf_ic_msg_t *msg);
43845039663SJohn Forte 
43945039663SJohn Forte #ifdef	__cplusplus
44045039663SJohn Forte }
44145039663SJohn Forte #endif
44245039663SJohn Forte 
44345039663SJohn Forte #endif	/* _SYS_PPPT_IC_IF_H */
444