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