Mercurial > illumos > git > illumos-gate
annotate usr/src/man/man9f/ddi_dma_cookie_iter.9f @ 19431:5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Reviewed by: Alex Wilson <alex@uq.edu.au>
Reviewed by: Paul Winder <paul@winders.demon.co.uk>
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
author | Robert Mustacchi <rm@fingolfin.org> |
---|---|
date | Wed, 18 Dec 2019 06:18:35 +0000 |
parents | |
children |
rev | line source |
---|---|
19431
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
1 .\" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
2 .\" This file and its contents are supplied under the terms of the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
3 .\" Common Development and Distribution License ("CDDL"), version 1.0. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
4 .\" You may only use this file in accordance with the terms of version |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
5 .\" 1.0 of the CDDL. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
6 .\" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
7 .\" A full copy of the text of the CDDL should have accompanied this |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
8 .\" source. A copy of the CDDL is also available via the Internet at |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
9 .\" http://www.illumos.org/license/CDDL. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
10 .\" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
11 .\" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
12 .\" Copyright 2019 Robert Mustacchi |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
13 .\" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
14 .Dd December 9, 2019 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
15 .Dt DDI_DMA_COOKIE_ITER 9F |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
16 .Os |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
17 .Sh NAME |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
18 .Nm ddi_dma_cookie_get , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
19 .Nm ddi_dma_cookie_iter , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
20 .Nm ddi_dma_cookie_one , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
21 .Nm ddi_dma_ncookies , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
22 .Nm ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
23 .Nd retrieve DMA cookies |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
24 .Sh SYNOPSIS |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
25 .In sys/ddi.h |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
26 .In sys/sunddi.h |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
27 .Ft "const ddi_dma_cookie_t *" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
28 .Fo ddi_dma_cookie_iter |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
29 .Fa "ddi_dma_handle_t handle" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
30 .Fa "const ddi_dma_cookie_t *cookiep" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
31 .Fc |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
32 .Ft "const ddi_dma_cookie_t *" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
33 .Fo ddi_dma_cookie_get |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
34 .Fa "ddi_dma_handle_t handle" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
35 .Fa "uint_t index" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
36 .Fc |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
37 .Ft "const ddi_dma_cookie_t *" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
38 .Fo ddi_dma_cookie_one |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
39 .Fa "ddi_dma_handle_t handle" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
40 .Fc |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
41 .Ft "uint_t" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
42 .Fo ddi_dma_ncookies |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
43 .Fa "ddi_dma_handle_t handle" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
44 .Fc |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
45 .Ft void |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
46 .Fo ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
47 .Fa "ddi_dma_handle_t handle" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
48 .Fa "ddi_dma_cookie_t *cookiep" |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
49 .Fc |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
50 .Sh PARAMETERS |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
51 .Bl -tag -width Fa |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
52 .It Fa handle |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
53 The DMA handle obtained by a call to |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
54 .Xr ddi_dma_alloc_handle 9F . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
55 .It Fa cookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
56 A pointer to a |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
57 .Xr ddi_dma_cookie 9S |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
58 structure. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
59 .It Fa index |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
60 An unsigned integer that represents the index of a cookie to obtain. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
61 The first entry is at index zero. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
62 .El |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
63 .Sh DESCRIPTION |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
64 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
65 .Fn ddi_dma_cookie_iter , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
66 .Fn ddi_dma_cookie_get , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
67 and |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
68 .Fn ddi_dma_cookie_one |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
69 functions obtain information about DMA cookies. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
70 When a DMA request, represented by the DMA handle |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
71 .Fa handle , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
72 has been bound to a series of addresses with the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
73 .Xr ddi_dma_addr_bind_handle 9F |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
74 or |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
75 .Xr ddi_dma_buf_bind_handle 9F |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
76 functions, the resulting addresses are stored in one or more |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
77 .Xr ddi_dma_cookie 9S |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
78 structures. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
79 the three different functions provide different ways to obtain cookies |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
80 and are safe alternatives to the unsafe |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
81 .Fn ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
82 function. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
83 To see how to use these functions, please see the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
84 .Sx EXAMPLES |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
85 section. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
86 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
87 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
88 .Fn ddi_dma_cookie_iter |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
89 function provides a way to iterate over all the cookies that are |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
90 associated with the DMA handle |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
91 .Fa handle . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
92 To get the first handle, pass |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
93 .Dv NULL |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
94 in |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
95 .Fa cookiep . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
96 Do not use the DMA cookie returned from either of the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
97 .Xr ddi_dma_addr_bind_handle 9F |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
98 or |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
99 .Xr ddi_dma_buf_bind_handle 9F |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
100 functions. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
101 To get subsequent cookies, pass the returned cookie as the argument |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
102 .Fa cookiep . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
103 When the function returns |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
104 .Dv NULL |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
105 then that indicates that the last handle has been iterated over. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
106 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
107 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
108 .Fn ddi_dma_cookie_get |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
109 function returns a specific cookie. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
110 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
111 .Fa index |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
112 indicates which of the cookies should be returned. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
113 The first cookie is at index |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
114 .Sy 0 . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
115 If an invalid index is specified, the function returns |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
116 .Dv NULL . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
117 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
118 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
119 .Ft ddi_dma_cookie_one |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
120 function is a convenience function for DMA requests that have a single |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
121 cookie. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
122 This function always returns the single cookie assosciated with the DMA |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
123 handle |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
124 .Fa handle . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
125 If this function is used when there is a DMA request with multiple |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
126 cookies, then it will panic the system. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
127 It can never return |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
128 .Dv NULL . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
129 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
130 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
131 .Fn ddi_dma_ncookies |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
132 function returns the number of DMA cookies that are associated with the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
133 DMA handle |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
134 .Fa handle . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
135 If there are no DMA resources bound to the handle, then this will return |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
136 .Sy 0 . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
137 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
138 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
139 .Fn ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
140 function was the historical function that was associated with obtaining |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
141 DMA cookies. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
142 It should not be used due to several flaws. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
143 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
144 .Fn ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
145 function mutates the underlying DMA handle meaning that a driver cannot |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
146 obtain a cookie a second time and thus a device driver using this |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
147 interface must either manually keep storage of the cookie around wasting |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
148 space or rebind the handle, wasting time. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
149 In addition, there is no way for the function to indicate that a driver |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
150 has consumed all of its cookies. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
151 If for some reason a device driver calls the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
152 .Fn ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
153 function more times than there are cookies, the results are undefined. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
154 In short, this function should not be used for any purpose. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
155 Use the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
156 .Fn ddi_dma_cookie_iter , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
157 .Fn ddi_dma_cookie_get , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
158 or |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
159 .Fn ddi_dma_cookie_one |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
160 functions instead. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
161 .Sh CONTEXT |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
162 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
163 .Fn ddi_dma_cookie_iter , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
164 .Fn ddi_dma_cookie_get , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
165 .Fn ddi_dma_cookie_one , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
166 .Fn ddi_dma_ncookies , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
167 and |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
168 .Fn ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
169 functions may be called from |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
170 .Sy user , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
171 .Sy kernel , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
172 or |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
173 .Sy interrupt |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
174 context. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
175 .Sh RETURN VALUES |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
176 Upon successful completion, the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
177 .Fn ddi_dma_cookie_iter , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
178 .Fn ddi_dma_cookie_get , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
179 .Fn ddi_dma_cookie_one |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
180 functions will return the requested DMA cookie. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
181 If there are no more cookies, or |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
182 .Fa coookiep |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
183 is invalid, the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
184 .Fn ddi_dma_cookie_iter |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
185 function will return |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
186 .Dv NULL . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
187 If |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
188 .Fa index |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
189 does not correspond to a valid cookie, the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
190 .Fn ddi_dma_cookie_get |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
191 function will return |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
192 .Dv NULL . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
193 If there is not exactly one DMA cookie, or another issue occurs, then the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
194 .Fn ddi_dma_cookie_one |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
195 function will panic the system. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
196 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
197 Upon successful completion, the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
198 .Fn ddi_dma_ncookies |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
199 function returns the number of cookies associated with |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
200 .Fa handle . |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
201 If there are none, then |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
202 .Sy 0 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
203 is returned. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
204 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
205 The |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
206 .Fn ddi_dma_nextcookie |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
207 function always updates |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
208 .Fa cookiep |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
209 regardless of whether it is valid or not. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
210 .Sh EXAMPLES |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
211 .Sy Example 1 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
212 Using the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
213 .Fn ddi_dma_cookie_iter |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
214 function to obtain all DMA cookies. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
215 .Bd -literal |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
216 /* |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
217 * This example assumes that either ddi_dma_addr_bind_handle() or |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
218 * ddi_dma_buf_bind_handle() has already been successfully called. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
219 */ |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
220 void |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
221 program_dma(ddi_dma_handle_t handle) |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
222 { |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
223 const ddi_dma_cookie_t *c; |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
224 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
225 for (cookie = ddi_dma_cookie_iter(handle, NULL); c != NULL; |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
226 c = ddi_dma_cookie_iter(handle, c)) { |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
227 /* |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
228 * Use the dmac_laddress and dmac_size members to |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
229 * properly program the device or descriptor rings. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
230 */ |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
231 } |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
232 } |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
233 .Ed |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
234 .Pp |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
235 .Sy Example 2 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
236 Using the |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
237 .Fn ddi_dma_cookie_get |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
238 function. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
239 .Bd -literal |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
240 /* |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
241 * This example assumes that either ddi_dma_mem_alloc() has already |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
242 * been successfully called. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
243 */ |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
244 int |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
245 bind_dma(ddi_dma_handle_t handle, void *addr, size_t len) |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
246 { |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
247 int ret; |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
248 uint_t i, ncookies; |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
249 ddi_dma_cookie_t first; |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
250 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
251 ret = ddi_dma_addr_bind_handle(handle, NULL, addr, len, |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
252 DDI_DMA_RDWR | DDI_DMA_CONSISTENT, NULL, NULL, &first, |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
253 &ncookies); |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
254 if (ret != DDI_DMA_MAPPED) { |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
255 return (ret); |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
256 } |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
257 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
258 /* |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
259 * A driver doesn't need to store ncookies. It can get it again |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
260 * by simply calling ddi_dma_ncookies() and using the result in |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
261 * place of ncookies from ddi_dma_addr_bind_handle(). |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
262 */ |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
263 for (i = 0; i < ncookies; i++) { |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
264 const ddi_dma_cookie_t *cookie; |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
265 |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
266 cookie = ddi_dma_coookie_get(handle, i); |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
267 /* |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
268 * Use the dmac_laddress and dmac_size members to |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
269 * properly program the device or descriptor rings. |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
270 */ |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
271 } |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
272 } |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
273 .Ed |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
274 .Sh SEE ALSO |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
275 .Xr ddi_dma_addr_bind_handle 9F , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
276 .Xr ddi_dma_alloc_handle 9F , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
277 .Xr ddi_dma_buf_bind_handle 9F , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
278 .Xr ddi_dma_unbind_handle 9F , |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
279 .Xr ddi_dma_cookie 9S |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
280 .Rs |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
281 .%T Writing Device Drivers |
5599be23ae32
12183 Want new IPD 13 DMA Cookie APIs
Robert Mustacchi <rm@fingolfin.org>
parents:
diff
changeset
|
282 .Re |