9022 loader.efi: module placement must check memory map
[unleashed.git] / share / man / man9f / scsi_hba_pkt_alloc.9f
blob3ee7964bfdfa32ef2e941b97bd079520c65f6d88
1 '\" te
2 .\"  Copyright (c) 2006, 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 SCSI_HBA_PKT_ALLOC 9F "Dec 11, 2006"
7 .SH NAME
8 scsi_hba_pkt_alloc, scsi_hba_pkt_free \- allocate and free a scsi_pkt structure
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/scsi/scsi.h>
16 \fBstruct scsi_pkt *\fR\fBscsi_hba_pkt_alloc\fR(\fBdev_info_t *\fR\fIdip\fR,
17      \fBstruct scsi_address *\fR\fIap\fR, \fBint\fR \fIcmdlen\fR, \fBint\fR \fIstatuslen\fR,
18      \fBint\fR \fItgtlen\fR, \fBint\fR \fIhbalen\fR,
19      \fBint\fR (*\fIcallback\fR)(\fBcaddr_t\fR \fIarg\fR), \fBcaddr_t\fR \fIarg\fR);
20 .fi
22 .LP
23 .nf
24 \fBvoid\fR \fBscsi_hba_pkt_free\fR(\fBstruct scsi_address *\fR\fIap\fR, \fBstruct scsi_pkt *\fR\fIpkt\fR);
25 .fi
27 .SH INTERFACE LEVEL
28 .sp
29 .LP
30 Solaris architecture specific (Solaris DDI).
31 .SH PARAMETERS
32 .sp
33 .ne 2
34 .na
35 \fB\fIdip\fR\fR
36 .ad
37 .RS 13n
38 Pointer to a \fBdev_info_t\fR structure, defining the \fBHBA\fR driver
39 instance.
40 .RE
42 .sp
43 .ne 2
44 .na
45 \fB\fIap\fR\fR
46 .ad
47 .RS 13n
48 Pointer to a \fBscsi_address\fR(9S) structure, defining the target instance.
49 .RE
51 .sp
52 .ne 2
53 .na
54 \fB\fIcmdlen\fR\fR
55 .ad
56 .RS 13n
57 Length in bytes to be allocated for the \fBSCSI\fR command descriptor block
58 (\fBCDB\fR).
59 .RE
61 .sp
62 .ne 2
63 .na
64 \fB\fIstatuslen\fR\fR
65 .ad
66 .RS 13n
67 Length in bytes to be allocated for the \fBSCSI\fR status completion block
68 (\fBSCB\fR).
69 .RE
71 .sp
72 .ne 2
73 .na
74 \fB\fItgtlen\fR\fR
75 .ad
76 .RS 13n
77 Length in bytes to be allocated for a private data area for the target driver's
78 exclusive use.
79 .RE
81 .sp
82 .ne 2
83 .na
84 \fB\fIhbalen\fR\fR
85 .ad
86 .RS 13n
87 Length in bytes to be allocated for a private data area for the \fBHBA\fR
88 driver's exclusive use.
89 .RE
91 .sp
92 .ne 2
93 .na
94 \fB\fIcallback\fR\fR
95 .ad
96 .RS 13n
97 Indicates what \fBscsi_hba_pkt_alloc()\fR should do when resources are not
98 available:
99 .sp
100 .ne 2
102 \fB\fBNULL_FUNC\fR\fR
104 .RS 14n
105 Do not wait for resources.  Return a \fINULL\fR pointer.
109 .ne 2
111 \fB\fBSLEEP_FUNC\fR\fR
113 .RS 14n
114 Wait indefinitely for resources.
120 .ne 2
122 \fB\fIarg\fR\fR
124 .RS 13n
125 Must be \fINULL.\fR
129 .ne 2
131 \fB\fIpkt\fR\fR
133 .RS 13n
134 A pointer to a \fBscsi_pkt\fR(9S) structure.
137 .SH DESCRIPTION
140 For \fBscsi_hba_pkt_alloc()\fR:
143 The \fBscsi_hba_pkt_alloc()\fR function allocates space for a \fBscsi_pkt\fR
144 structure. \fBHBA\fR drivers must use this interface when allocating a
145 \fBscsi_pkt\fR from their \fBtran_init_pkt\fR(9E) entry point.
148 If \fIcallback\fR is \fBNULL_FUNC\fR, \fBscsi_hba_pkt_alloc()\fR may not sleep
149 when allocating resources, and callers should be prepared to deal with
150 allocation failures.
153 The \fBscsi_hba_pkt_alloc()\fR function copies the \fBscsi_address\fR(9S)
154 structure pointed to by \fIap\fR to the \fBpkt_address\fR field in the
155 \fBscsi_pkt\fR(9S).
158 The \fBscsi_hba_pkt_alloc()\fR function also allocates memory for these
159 \fBscsi_pkt\fR(9S) data areas, and sets these fields to point to the allocated
160 memory:
162 .ne 2
164 \fB\fBpkt_ha_private\fR\fR
166 .RS 18n
167 \fBHBA\fR private data area.
171 .ne 2
173 \fB\fBpkt_private\fR\fR
175 .RS 18n
176 Target driver private data area.
180 .ne 2
182 \fB\fBpkt_scbp\fR\fR
184 .RS 18n
185 \fBSCSI\fR status completion block.
189 .ne 2
191 \fB\fBpkt_cdbp\fR\fR
193 .RS 18n
194 \fBSCSI\fR command descriptor block.
199 For \fBscsi_hba_pkt_free()\fR:
202 The \fBscsi_hba_pkt_free()\fR function frees the space allocated for the
203 \fBscsi_pkt\fR(9S) structure.
204 .SH RETURN VALUES
207 The \fBscsi_hba_pkt_alloc()\fR function returns a pointer to the \fBscsi_pkt\fR
208 structure, or \fINULL\fR if no space is available.
209 .SH CONTEXT
212 The \fBscsi_hba_pkt_alloc()\fR function can be called from user, interrupt, or
213 kernel context. Drivers must not allow \fBscsi_hba_pkt_alloc()\fR to sleep if
214 called from an interrupt routine.
217 The \fBscsi_hba_pkt_free()\fR function can be called from user, interrupt, or
218 kernel context.
219 .SH SEE ALSO
222 \fBtran_init_pkt\fR(9E), \fBscsi_address\fR(9S), \fBscsi_pkt\fR(9S)
225 \fIWriting Device Drivers\fR