6718 tran_tgt_init(9E) returns int, not void
[unleashed.git] / usr / src / man / man9e / tran_tgt_init.9e
blob12c358785c462485f4f1b91f84e8681fcc016092
1 '\" te
2 .\"  Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH TRAN_TGT_INIT 9E "Mar 13, 2016"
7 .SH NAME
8 tran_tgt_init \- request to initialize HBA resources on behalf of a particular
9 target
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/scsi/scsi.h>
17 \fBint prefix\fR\fBtran_tgt_init\fR(\fBdev_info_t *\fR\fIhba_dip\fR, \fBdev_info_t *\fR\fItgt_dip\fR,
18      \fBscsi_hba_tran_t *\fR\fIhba_tran\fR, \fBstruct scsi_device *\fR\fIsd\fR);
19 .fi
21 .SH INTERFACE LEVEL
22 .LP
23 Solaris architecture specific (Solaris DDI).
24 .SH PARAMETERS
25 .ne 2
26 .na
27 \fB\fIhba_dip\fR \fR
28 .ad
29 .RS 13n
30 Pointer to a  \fBdev_info_t\fR structure, referring to the \fBHBA\fR device
31 instance.
32 .RE
34 .sp
35 .ne 2
36 .na
37 \fB\fItgt_dip\fR \fR
38 .ad
39 .RS 13n
40 Pointer to a \fBdev_info_t\fR structure, referring to the target device
41 instance.
42 .RE
44 .sp
45 .ne 2
46 .na
47 \fB\fIhba_tran\fR \fR
48 .ad
49 .RS 13n
50 Pointer to a  \fBscsi_hba_tran\fR(9S) structure, consisting of the \fBHBA\fR's
51 transport vectors.
52 .RE
54 .sp
55 .ne 2
56 .na
57 \fB\fIsd\fR \fR
58 .ad
59 .RS 13n
60 Pointer to a  \fBscsi_device\fR(9S) structure, describing the target.
61 .RE
63 .SH DESCRIPTION
64 .LP
65 The \fBtran_tgt_init()\fR vector in the \fBscsi_hba_tran\fR(9S) structure may
66 be initialized during the \fBHBA\fR driver's \fBattach\fR(9E) to point to an
67 \fBHBA\fR driver function to be called by the system when an instance of a
68 target device is being created.  The \fBtran_tgt_init()\fR vector, if not
69 \fINULL\fR,is called after the \fBdev_info\fR node structure is created for
70 this target device instance, but before \fBprobe\fR(9E) for this instance is
71 called. Before receiving transport requests from the target driver instance,
72 the \fBHBA\fR may perform any initialization required for this particular
73 target during the call of the \fBtran_tgt_init()\fR vector.
74 .sp
75 .LP
76 Note that \fIhba_tran\fR will point to a cloned copy of the
77 \fBscsi_hba_tran_t\fR structure allocated by the \fBHBA\fR driver if the
78 \fBSCSI_HBA_TRAN_CLONE\fR flag was specified in the call to
79 \fBscsi_hba_attach\fR(9F). In this case, the \fBHBA\fR driver may choose to
80 initialize the \fItran_tgt_private\fR field in the structure pointed to by
81 \fIhba_tran\fR, to point to the data specific to the particular target device
82 instance.
83 .SH RETURN VALUES
84 .LP
85 \fBtran_tgt_init()\fR must return:
86 .sp
87 .ne 2
88 .na
89 \fB\fBDDI_SUCCESS\fR \fR
90 .ad
91 .RS 16n
92 the \fBHBA\fR driver can support the addressed target, and was able to
93 initialize per-target resources.
94 .RE
96 .sp
97 .ne 2
98 .na
99 \fB\fBDDI_FAILURE\fR \fR
101 .RS 16n
102 the \fBHBA\fR driver cannot support the addressed target, or was unable to
103 initialize per-target resources. In this event, the initialization of this
104 instance of the target device will not be continued, the target driver's
105 \fBprobe\fR(9E) will not be called, and the \fItgt_dip\fR structure destroyed.
108 .SH SEE ALSO
110 \fBattach\fR(9E), \fBprobe\fR(9E), \fBtran_tgt_free\fR(9E),
111 \fBtran_tgt_probe\fR(9E), \fBscsi_hba_attach_setup\fR(9F),
112 \fBscsi_device\fR(9S), \fBscsi_hba_tran\fR(9S)
115 \fIWriting Device Drivers\fR