summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/scsi_hba_pkt_alloc.9f
blob: c549da395bf8432a8773f6ce0bfd7452486f6e9f (plain)
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
'\" 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 "11 Dec 2006" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
scsi_hba_pkt_alloc, scsi_hba_pkt_free \- allocate and free a scsi_pkt structure
.SH SYNOPSIS
.LP
.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
.sp
.LP
Solaris architecture specific (Solaris DDI).
.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIdip\fR\fR
.ad
.RS 13n
.rt  
Pointer to a \fBdev_info_t\fR structure, defining the \fBHBA\fR driver
instance.
.RE

.sp
.ne 2
.mk
.na
\fB\fIap\fR\fR
.ad
.RS 13n
.rt  
Pointer to a \fBscsi_address\fR(9S) structure, defining the target instance.
.RE

.sp
.ne 2
.mk
.na
\fB\fIcmdlen\fR\fR
.ad
.RS 13n
.rt  
Length in bytes to be allocated for the \fBSCSI\fR command descriptor block
(\fBCDB\fR).
.RE

.sp
.ne 2
.mk
.na
\fB\fIstatuslen\fR\fR
.ad
.RS 13n
.rt  
Length in bytes to be allocated for the \fBSCSI\fR status completion block
(\fBSCB\fR).
.RE

.sp
.ne 2
.mk
.na
\fB\fItgtlen\fR\fR
.ad
.RS 13n
.rt  
Length in bytes to be allocated for a private data area for the target driver's
exclusive use.
.RE

.sp
.ne 2
.mk
.na
\fB\fIhbalen\fR\fR
.ad
.RS 13n
.rt  
Length in bytes to be allocated for a private data area for the \fBHBA\fR
driver's exclusive use.
.RE

.sp
.ne 2
.mk
.na
\fB\fIcallback\fR\fR
.ad
.RS 13n
.rt  
Indicates what \fBscsi_hba_pkt_alloc()\fR should do when resources are not
available:
.sp
.ne 2
.mk
.na
\fB\fBNULL_FUNC\fR\fR
.ad
.RS 14n
.rt  
Do not wait for resources.  Return a \fINULL\fR pointer.
.RE

.sp
.ne 2
.mk
.na
\fB\fBSLEEP_FUNC\fR\fR
.ad
.RS 14n
.rt  
Wait indefinitely for resources.
.RE

.RE

.sp
.ne 2
.mk
.na
\fB\fIarg\fR\fR
.ad
.RS 13n
.rt  
Must be \fINULL.\fR
.RE

.sp
.ne 2
.mk
.na
\fB\fIpkt\fR\fR
.ad
.RS 13n
.rt  
A pointer to a \fBscsi_pkt\fR(9S) structure.
.RE

.SH DESCRIPTION
.sp
.LP
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
.mk
.na
\fB\fBpkt_ha_private\fR\fR
.ad
.RS 18n
.rt  
\fBHBA\fR private data area.
.RE

.sp
.ne 2
.mk
.na
\fB\fBpkt_private\fR\fR
.ad
.RS 18n
.rt  
Target driver private data area.
.RE

.sp
.ne 2
.mk
.na
\fB\fBpkt_scbp\fR\fR
.ad
.RS 18n
.rt  
\fBSCSI\fR status completion block.
.RE

.sp
.ne 2
.mk
.na
\fB\fBpkt_cdbp\fR\fR
.ad
.RS 18n
.rt  
\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
.sp
.LP
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
.sp
.LP
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
.sp
.LP
\fBtran_init_pkt\fR(9E), \fBscsi_address\fR(9S), \fBscsi_pkt\fR(9S)
.sp
.LP
\fIWriting Device Drivers\fR