xref: /illumos-gate/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SRPT_STP_H
28 #define	_SRPT_STP_H
29 
30 /*
31  * Prototypes and data structures providing the SRP SCSI
32  * target port COMSTAR port provider function.
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Prototypes
41  */
42 int srpt_stp_start_srp(srpt_target_port_t *tgt);
43 void srpt_stp_stop_srp(srpt_target_port_t *tgt);
44 srpt_target_port_t *srpt_stp_alloc_port(srpt_ioc_t *ioc, ib_guid_t guid);
45 stmf_status_t srpt_stp_free_port(srpt_target_port_t *tgt);
46 stmf_status_t srpt_stp_deregister_port(srpt_target_port_t *tgt);
47 
48 srpt_session_t *srpt_stp_alloc_session(srpt_target_port_t *tgt,
49 	uint8_t *i_id, uint8_t *t_id, uint8_t port,
50 	char *local_gid, char *remote_gid);
51 void srpt_stp_free_session(srpt_session_t *session);
52 
53 srpt_channel_t *srpt_stp_login(srpt_target_port_t *tgt,
54 	srp_login_req_t *login, srp_login_rsp_t *login_rsp,
55 	srp_login_rej_t *login_rej, uint8_t login_port,
56 	char *local_gid, char *remote_gid);
57 
58 void srpt_stp_logout(srpt_channel_t *ch);
59 
60 stmf_status_t srpt_stp_send_status(struct scsi_task *task,
61 	uint32_t ioflags);
62 
63 ibt_status_t srpt_stp_send_response(srpt_iu_t *iu, uint8_t scsi_status,
64 	uint8_t flags, uint32_t resid, uint16_t sense_length,
65 	uint8_t *sense_data, uint_t fence);
66 ibt_status_t srpt_stp_send_mgmt_response(srpt_iu_t *iu, uint8_t srp_rsp,
67 	uint_t fence);
68 void srpt_stp_add_task(srpt_session_t *session, srpt_iu_t *iu);
69 void srpt_stp_remove_task(srpt_session_t *session, srpt_iu_t *iu);
70 
71 uint64_t srpt_stp_u8array2u64(uint8_t *array);
72 
73 #ifdef	__cplusplus
74 }
75 #endif
76 
77 #endif /* _SRPT_STP_H */
78