4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Definitions for stmf local ports and port providers.
31 #include <sys/stmf_defines.h>
37 typedef struct stmf_dbuf_store
{
38 void *ds_stmf_private
;
39 void *ds_port_private
;
41 stmf_data_buf_t
*(*ds_alloc_data_buf
)(struct scsi_task
*task
,
42 uint32_t size
, uint32_t *pminsize
, uint32_t flags
);
44 void (*ds_free_data_buf
)(
45 struct stmf_dbuf_store
*ds
, stmf_data_buf_t
*dbuf
);
47 stmf_status_t (*ds_setup_dbuf
)(struct scsi_task
*task
,
48 stmf_data_buf_t
*dbuf
, uint32_t flags
);
50 void (*ds_teardown_dbuf
)(
51 struct stmf_dbuf_store
*ds
, stmf_data_buf_t
*dbuf
);
54 #define PORTIF_REV_1 0x00010000
56 typedef struct stmf_local_port
{
57 void *lport_stmf_private
;
58 void *lport_port_private
;
60 uint32_t lport_abort_timeout
;
62 struct scsi_devid_desc
*lport_id
;
64 struct stmf_port_provider
*lport_pp
;
65 struct stmf_dbuf_store
*lport_ds
;
67 stmf_status_t (*lport_xfer_data
)(struct scsi_task
*task
,
68 struct stmf_data_buf
*dbuf
, uint32_t ioflags
);
69 stmf_status_t (*lport_send_status
)(struct scsi_task
*task
,
71 void (*lport_task_free
)(struct scsi_task
*task
);
72 stmf_status_t (*lport_abort
)(struct stmf_local_port
*lport
,
73 int abort_cmd
, void *arg
, uint32_t flags
);
74 void (*lport_task_poll
)(struct scsi_task
*task
);
75 void (*lport_ctl
)(struct stmf_local_port
*lport
,
77 stmf_status_t (*lport_info
)(uint32_t cmd
,
78 struct stmf_local_port
*lport
, void *arg
, uint8_t *buf
,
80 void (*lport_event_handler
)(
81 struct stmf_local_port
*lport
, int eventid
, void *arg
,
85 typedef struct stmf_remote_port
{
86 struct scsi_transport_id
*rport_tptid
;
87 uint16_t rport_tptid_sz
;
90 typedef struct stmf_dflt_scsi_tptid
{
91 #if defined(_BIT_FIELDS_LTOH)
92 uint8_t protocol_id
: 4,
95 #elif defined(_BIT_FIELDS_HTOL)
96 uint8_t format_code
: 2,
100 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
101 #endif /* _BIT_FIELDS_LTOH */
103 uint8_t ident_len
[2];
105 } stmf_dflt_scsi_tptid_t
;
109 #define STMF_LPORT_ABORT_TASK 0x40
111 typedef struct stmf_port_provider
{
112 void *pp_stmf_private
;
113 void *pp_provider_private
;
115 uint32_t pp_portif_rev
; /* Currently PORTIF_REV_1 */
118 void (*pp_cb
)(struct stmf_port_provider
*pp
,
119 int cmd
, void *arg
, uint32_t flags
);
120 } stmf_port_provider_t
;
122 #define STMF_SESSION_ID_NONE ((uint64_t)0)
124 typedef struct stmf_scsi_session
{
125 void *ss_stmf_private
;
126 void *ss_port_private
;
128 struct scsi_devid_desc
*ss_rport_id
;
129 char *ss_rport_alias
;
130 struct stmf_local_port
*ss_lport
;
131 uint64_t ss_session_id
;
132 struct stmf_remote_port
*ss_rport
;
133 } stmf_scsi_session_t
;
135 stmf_status_t
stmf_register_port_provider(stmf_port_provider_t
*pp
);
136 stmf_status_t
stmf_deregister_port_provider(stmf_port_provider_t
*pp
);
137 stmf_status_t
stmf_register_local_port(stmf_local_port_t
*lportp
);
138 stmf_status_t
stmf_deregister_local_port(stmf_local_port_t
*lport
);
139 stmf_status_t
stmf_register_scsi_session(stmf_local_port_t
*lport
,
140 stmf_scsi_session_t
*ss
);
141 void stmf_deregister_scsi_session(stmf_local_port_t
*lport
,
142 stmf_scsi_session_t
*ss
);
143 void stmf_set_port_standby(stmf_local_port_t
*lport
, uint16_t rtpid
);
144 void stmf_set_port_alua(stmf_local_port_t
*lport
);
150 #endif /* _PORTIF_H */