1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved
.\" 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.
.\" 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.
.\" 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]
.TH SCSI_HBA_PKT_ALLOC 9F "Dec 11, 2006"
.SH NAME
scsi_hba_pkt_alloc, scsi_hba_pkt_free \- allocate and free a scsi_pkt structure
.SH SYNOPSIS
.nf
#include <sys/scsi/scsi.h>
\fBstruct scsi_pkt *\fR\fBscsi_hba_pkt_alloc\fR(\fBdev_info_t *\fR\fIdip\fR,
\fBstruct scsi_address *\fR\fIap\fR, \fBint\fR \fIcmdlen\fR, \fBint\fR \fIstatuslen\fR,
\fBint\fR \fItgtlen\fR, \fBint\fR \fIhbalen\fR,
\fBint\fR (*\fIcallback\fR)(\fBcaddr_t\fR \fIarg\fR), \fBcaddr_t\fR \fIarg\fR);
.fi
.LP
.nf
\fBvoid\fR \fBscsi_hba_pkt_free\fR(\fBstruct scsi_address *\fR\fIap\fR, \fBstruct scsi_pkt *\fR\fIpkt\fR);
.fi
.SH INTERFACE LEVEL
illumos architecture specific (illumos DDI).
.SH PARAMETERS
.ne 2
.na
\fB\fIdip\fR\fR
.ad
.RS 13n
Pointer to a \fBdev_info_t\fR structure, defining the \fBHBA\fR driver
instance.
.RE
.sp
.ne 2
.na
\fB\fIap\fR\fR
.ad
.RS 13n
Pointer to a \fBscsi_address\fR(9S) structure, defining the target instance.
.RE
.sp
.ne 2
.na
\fB\fIcmdlen\fR\fR
.ad
.RS 13n
Length in bytes to be allocated for the \fBSCSI\fR command descriptor block
(\fBCDB\fR).
.RE
.sp
.ne 2
.na
\fB\fIstatuslen\fR\fR
.ad
.RS 13n
Length in bytes to be allocated for the \fBSCSI\fR status completion block
(\fBSCB\fR).
.RE
.sp
.ne 2
.na
\fB\fItgtlen\fR\fR
.ad
.RS 13n
Length in bytes to be allocated for a private data area for the target driver's
exclusive use.
.RE
.sp
.ne 2
.na
\fB\fIhbalen\fR\fR
.ad
.RS 13n
Length in bytes to be allocated for a private data area for the \fBHBA\fR
driver's exclusive use.
.RE
.sp
.ne 2
.na
\fB\fIcallback\fR\fR
.ad
.RS 13n
Indicates what \fBscsi_hba_pkt_alloc()\fR should do when resources are not
available:
.sp
.ne 2
.na
\fB\fBNULL_FUNC\fR\fR
.ad
.RS 14n
Do not wait for resources. Return a \fINULL\fR pointer.
.RE
.sp
.ne 2
.na
\fB\fBSLEEP_FUNC\fR\fR
.ad
.RS 14n
Wait indefinitely for resources.
.RE
.RE
.sp
.ne 2
.na
\fB\fIarg\fR\fR
.ad
.RS 13n
Must be \fINULL.\fR
.RE
.sp
.ne 2
.na
\fB\fIpkt\fR\fR
.ad
.RS 13n
A pointer to a \fBscsi_pkt\fR(9S) structure.
.RE
.SH DESCRIPTION
For \fBscsi_hba_pkt_alloc()\fR:
.sp
.LP
The \fBscsi_hba_pkt_alloc()\fR function allocates space for a \fBscsi_pkt\fR
structure. \fBHBA\fR drivers must use this interface when allocating a
\fBscsi_pkt\fR from their \fBtran_init_pkt\fR(9E) entry point.
.sp
.LP
If \fIcallback\fR is \fBNULL_FUNC\fR, \fBscsi_hba_pkt_alloc()\fR may not sleep
when allocating resources, and callers should be prepared to deal with
allocation failures.
.sp
.LP
The \fBscsi_hba_pkt_alloc()\fR function copies the \fBscsi_address\fR(9S)
structure pointed to by \fIap\fR to the \fBpkt_address\fR field in the
\fBscsi_pkt\fR(9S).
.sp
.LP
The \fBscsi_hba_pkt_alloc()\fR function also allocates memory for these
\fBscsi_pkt\fR(9S) data areas, and sets these fields to point to the allocated
memory:
.sp
.ne 2
.na
\fB\fBpkt_ha_private\fR\fR
.ad
.RS 18n
\fBHBA\fR private data area.
.RE
.sp
.ne 2
.na
\fB\fBpkt_private\fR\fR
.ad
.RS 18n
Target driver private data area.
.RE
.sp
.ne 2
.na
\fB\fBpkt_scbp\fR\fR
.ad
.RS 18n
\fBSCSI\fR status completion block.
.RE
.sp
.ne 2
.na
\fB\fBpkt_cdbp\fR\fR
.ad
.RS 18n
\fBSCSI\fR command descriptor block.
.RE
.sp
.LP
For \fBscsi_hba_pkt_free()\fR:
.sp
.LP
The \fBscsi_hba_pkt_free()\fR function frees the space allocated for the
\fBscsi_pkt\fR(9S) structure.
.SH RETURN VALUES
The \fBscsi_hba_pkt_alloc()\fR function returns a pointer to the \fBscsi_pkt\fR
structure, or \fINULL\fR if no space is available.
.SH CONTEXT
The \fBscsi_hba_pkt_alloc()\fR function can be called from user, interrupt, or
kernel context. Drivers must not allow \fBscsi_hba_pkt_alloc()\fR to sleep if
called from an interrupt routine.
.sp
.LP
The \fBscsi_hba_pkt_free()\fR function can be called from user, interrupt, or
kernel context.
.SH SEE ALSO
\fBtran_init_pkt\fR(9E), \fBscsi_address\fR(9S), \fBscsi_pkt\fR(9S)
.sp
.LP
\fIWriting Device Drivers\fR
|