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"
8 scsi_hba_pkt_alloc, scsi_hba_pkt_free \- allocate and free a scsi_pkt structure
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);
24 \fBvoid\fR \fBscsi_hba_pkt_free\fR(\fBstruct scsi_address *\fR\fIap\fR, \fBstruct scsi_pkt *\fR\fIpkt\fR);
30 Solaris architecture specific (Solaris DDI).
38 Pointer to a \fBdev_info_t\fR structure, defining the \fBHBA\fR driver
48 Pointer to a \fBscsi_address\fR(9S) structure, defining the target instance.
57 Length in bytes to be allocated for the \fBSCSI\fR command descriptor block
67 Length in bytes to be allocated for the \fBSCSI\fR status completion block
77 Length in bytes to be allocated for a private data area for the target driver's
87 Length in bytes to be allocated for a private data area for the \fBHBA\fR
88 driver's exclusive use.
97 Indicates what \fBscsi_hba_pkt_alloc()\fR should do when resources are not
102 \fB\fBNULL_FUNC\fR\fR
105 Do not wait for resources. Return a \fINULL\fR pointer.
111 \fB\fBSLEEP_FUNC\fR\fR
114 Wait indefinitely for resources.
134 A pointer to a \fBscsi_pkt\fR(9S) structure.
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
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
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
164 \fB\fBpkt_ha_private\fR\fR
167 \fBHBA\fR private data area.
173 \fB\fBpkt_private\fR\fR
176 Target driver private data area.
185 \fBSCSI\fR status completion block.
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.
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.
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
222 \fBtran_init_pkt\fR(9E), \fBscsi_address\fR(9S), \fBscsi_pkt\fR(9S)
225 \fIWriting Device Drivers\fR