summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/get_pktiopb.9f
blob: b7583d4507d5f4f30cab806a6eef17b442fad6ac (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
'\" te
.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
.\" 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 GET_PKTIOPB 9F "May 24, 2014"
.SH NAME
get_pktiopb, free_pktiopb \- allocate/free a SCSI packet in the iopb map
.SH SYNOPSIS
.LP
.nf
#include <sys/scsi/scsi.h>



\fBstruct scsi_pkt *\fR\fBget_pktiopb\fR(\fBstruct scsi_address *\fR\fIap\fR,
     \fBcaddr_t *\fR\fIdatap\fR, \fBint\fR \fIcdblen\fR, \fBint\fR \fIstatuslen\fR, \fBint\fR \fIdatalen\fR,
     \fBint\fR \fIreadflag\fR, \fBint (*\fR\fIcallback\fR);
.fi

.LP
.nf
\fBvoid\fR \fBfree_pktiopb\fR(\fBstruct scsi_pkt *\fR\fIpkt\fR, \fBcaddr_t\fR \fIdatap\fR, \fBint\fR \fIdatalen\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
These interfaces are obsolete. Use \fBscsi_alloc_consistent_buf\fR(9F) instead
of \fBget_pktiopb()\fR. Use \fBscsi_free_consistent_buf\fR(9F) instead of
\fBfree_pktiopb()\fR.
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIap\fR\fR
.ad
.RS 13n
Pointer to the target's \fBscsi_address\fR structure.
.RE

.sp
.ne 2
.na
\fB\fIdatap\fR\fR
.ad
.RS 13n
Pointer to the address of the packet, set by this function.
.RE

.sp
.ne 2
.na
\fB\fIcdblen\fR\fR
.ad
.RS 13n
Number of bytes required for the \fBSCSI \fRcommand descriptor block (CDB).
.RE

.sp
.ne 2
.na
\fB\fIstatuslen\fR\fR
.ad
.RS 13n
Number of bytes required for the \fBSCSI \fRstatus area.
.RE

.sp
.ne 2
.na
\fB\fIdatalen\fR\fR
.ad
.RS 13n
Number of bytes required for the data area of the \fBSCSI \fRcommand.
.RE

.sp
.ne 2
.na
\fB\fIreadflag\fR\fR
.ad
.RS 13n
If non-zero, data will be transferred from the \fBSCSI \fRtarget.
.RE

.sp
.ne 2
.na
\fB\fIcallback\fR\fR
.ad
.RS 13n
Pointer to a callback function, or \fBNULL_FUNC\fR or \fBSLEEP_FUNC\fR
.RE

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

.SH DESCRIPTION
.sp
.LP
The \fBget_pktiopb()\fR function allocates a \fBscsi_pkt\fR structure that has
a small data area allocated. It is used by some \fBSCSI \fRcommands such as
\fBREQUEST_SENSE\fR, which involve a small amount of data and require
cache-consistent memory for proper operation. It uses \fBddi_iopb_alloc\fR(9F)
for allocating the data area and \fBscsi_resalloc\fR(9F) to allocate the packet
and \fBDMA\fR resources.
.sp
.LP
\fIcallback\fR indicates what \fBget_pktiopb()\fR should do when resources are
not available:
.sp
.ne 2
.na
\fB\fBNULL_FUNC\fR\fR
.ad
.RS 16n
Do not wait for resources. Return a \fINULL\fR pointer.
.RE

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

.sp
.ne 2
.na
\fBOther Values\fR
.ad
.RS 16n
\fIcallback\fR points to a function which is called when resources may have
become available. \fIcallback\fR \fBmust\fR return either \fB0\fR (indicating
that it attempted to allocate resources but failed to do so again), in which
case it is put back on a list to be called again later, or \fB1\fR indicating
either success in allocating resources or indicating that it no longer cares
for a retry.
.RE

.sp
.LP
The \fBfree_pktiopb()\fR function is used for freeing the packet and its
associated resources.
.SH RETURN VALUES
.sp
.LP
The \fBget_pktiopb()\fR function returns a pointer to the newly allocated
\fBscsi_pkt\fR or a \fINULL\fR pointer.
.SH CONTEXT
.sp
.LP
If \fIcallback\fR is \fBSLEEP_FUNC\fR, then this routine can be called only
from user or kernel context. Otherwise, it can be called from user, interrupt,
or kernel context. The \fIcallback\fR function should not block or call
routines that block.
.sp
.LP
The \fBfree_pktiopb()\fR function can be called from user, interrupt, or kernel
context.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for a description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Stability Level	Obsolete
.TE

.SH SEE ALSO
.sp
.LP
\fBattributes\fR(5),
\fBscsi_alloc_consistent_buf\fR(9F), \fBscsi_free_consistent_buf\fR(9F),
\fBscsi_pktalloc\fR(9F), \fBscsi_resalloc\fR(9F), \fBscsi_pkt\fR(9S)
.sp
.LP
\fIWriting Device Drivers\fR
.SH NOTES
.sp
.LP
The \fBget_pktiopb()\fR and \fBfree_pktiopb()\fR functions are obsolete and
will be discontinued in a future release. These functions have been replaced
by, respectively, \fBscsi_alloc_consistent_buf\fR(9F) and
\fBscsi_free_consistent_buf\fR(9F).
.sp
.LP
The \fBget_pktiopb()\fR function uses scarce resources. For this reason and its
obsolescence (see above), its use is discouraged.