2 .\" Copyright (c) 2002, 2003, 2004 The DragonFly Project. All rights reserved.
4 .\" This code is derived from software contributed to The DragonFly Project
5 .\" by Hiten Pandya <hmp@backplane.com>.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in
15 .\" the documentation and/or other materials provided with the
17 .\" 3. Neither the name of The DragonFly Project nor the names of its
18 .\" contributors may be used to endorse or promote products derived
19 .\" from this software without specific, prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
35 .\" All rights reserved.
37 .\" This code is derived from software contributed to The NetBSD Foundation
38 .\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
39 .\" NASA Ames Research Center.
41 .\" Redistribution and use in source and binary forms, with or without
42 .\" modification, are permitted provided that the following conditions
44 .\" 1. Redistributions of source code must retain the above copyright
45 .\" notice, this list of conditions and the following disclaimer.
46 .\" 2. Redistributions in binary form must reproduce the above copyright
47 .\" notice, this list of conditions and the following disclaimer in the
48 .\" documentation and/or other materials provided with the distribution.
49 .\" 3. All advertising materials mentioning features or use of this software
50 .\" must display the following acknowledgment:
51 .\" This product includes software developed by the NetBSD
52 .\" Foundation, Inc. and its contributors.
53 .\" 4. Neither the name of The NetBSD Foundation nor the names of its
54 .\" contributors may be used to endorse or promote products derived
55 .\" from this software without specific prior written permission.
57 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
58 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
59 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
60 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
61 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
67 .\" POSSIBILITY OF SUCH DAMAGE.
69 .\" $FreeBSD: /repoman/r/ncvs/src/share/man/man9/bus_dma.9,v 1.7 2003/07/27 14:05:29 mux Exp $
70 .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $
77 .Nm bus_dma_tag_create ,
78 .Nm bus_dma_tag_destroy ,
79 .Nm bus_dmamap_create ,
80 .Nm bus_dmamap_destroy ,
82 .Nm bus_dmamap_load_ccb ,
83 .Nm bus_dmamap_load_mbuf ,
84 .Nm bus_dmamap_load_mbuf_segment ,
85 .Nm bus_dmamap_load_mbuf_defrag ,
86 .Nm bus_dmamap_load_uio ,
87 .Nm bus_dmamap_unload ,
89 .Nm bus_dmamem_alloc ,
90 .Nm bus_dmamem_coherent ,
91 .Nm bus_dmamem_coherent_any ,
93 .Nd Bus and Machine Independent DMA Mapping Interface
97 .Fn bus_dma_tag_create "bus_dma_tag_t parent" "bus_size_t alignment" \
98 "bus_size_t boundary" "bus_addr_t lowaddr" "bus_addr_t highaddr" \
99 "bus_size_t maxsize" "int nsegments" "bus_size_t maxsegsz" \
100 "int flags" "bus_dma_tag_t *dmat"
102 .Fn bus_dma_tag_destroy "bus_dma_tag_t dmat"
104 .Fn bus_dmamap_create "bus_dma_tag_t dmat" "int flags" "bus_dmamap_t *mapp"
106 .Fn bus_dmamap_destroy "bus_dma_tag_t dmat" "bus_dmamap_t map"
108 .Fn bus_dmamap_load "bus_dma_tag_t dmat" "bus_dmamap_t map" "void *buf" \
109 "bus_size_t buflen" "bus_dmamap_callback_t *callback" "void *callback_arg" \
112 .Fn bus_dmamap_load_ccb "bus_dma_tag_t dmat" "bus_dmamap_t map" \
113 "union ccb *ccb" "bus_dmamap_callback_t *callback" "void *callback_arg" \
116 .Fn bus_dmamap_load_mbuf "bus_dma_tag_t dmat" "bus_dmamap_t map" \
117 "struct mbuf *mbuf" "bus_dmamap_callback2_t *callback" "void *callback_arg" \
120 .Fn bus_dmamap_load_mbuf_segment "bus_dma_tag_t dmat" "bus_dmamap_t map" \
121 "struct mbuf *mbuf" "bus_dma_segment_t *segs" "int maxsegs" "int *nsegs" \
124 .Fn bus_dmamap_load_mbuf_defrag "bus_dma_tag_t dmat" "bus_dmamap_t map" \
125 "struct mbuf **mbuf" "bus_dma_segment_t *segs" "int maxsegs" "int *nsegs" \
128 .Fn bus_dmamap_load_uio "bus_dma_tag_t dmat" "bus_dmamap_t map" \
129 "struct uio *uio" "bus_dmamap_callback2_t *callback" "void *callback_arg" \
132 .Fn bus_dmamem_alloc "bus_dma_tag_t dmat" "void **vaddr" \
133 "int flags" "bus_dmamap_t *mapp"
135 .Fn bus_dmamem_coherent "bus_dma_tag_t parent" "bus_size_t alignment" \
136 "bus_size_t boundary" "bus_addr_t lowaddr" "bus_addr_t highaddr" \
137 "bus_size_t maxsize" "int flags" "bus_dmamem_t *dmem"
139 .Fn bus_dmamem_coherent_any "bus_dma_tag_t parent" "bus_size_t alignment" \
140 "bus_size_t maxsize" "int flags" "bus_dma_tag_t *dtag" "bus_dmamap_t *dmap" \
141 "bus_addr_t *busaddr"
143 .Fn bus_dmamap_unload "bus_dma_tag_t dmat" "bus_dmamap_t map"
145 .Fn bus_dmamap_sync "bus_dma_tag_t dmat" "bus_dmamap_t map" \
146 "bus_dmasync_op_t op"
148 .Fn bus_dmamem_free "bus_dma_tag_t dmat" "void *vaddr" \
151 Direct Memory Access (DMA) is a method of transferring data
152 without involving the CPU, thus providing higher performance.
153 A DMA transaction can be achieved between device to memory,
154 device to device, or memory to memory.
158 API is a bus, device, and machine-independent (MI) interface to
160 It provides the client with flexibility and simplicity by
161 abstracting machine dependent issues like setting up
162 DMA mappings, handling cache issues, bus specific features
164 .Sh STRUCTURES AND TYPES
165 .Bl -tag -width compact
167 A machine-dependent (MD) opaque type that describes the
168 characteristics of DMA transactions.
169 DMA tags are organized into a hierarchy, with each child
170 tag inheriting the restrictions of its parent.
171 This allows all devices along the path of DMA transactions
172 to contribute to the constraints of those transactions.
173 .It Vt bus_dma_segment_t
174 A machine-dependent type that describes individual
183 field contains the device visible address of the DMA segment, and
185 contains the length of the DMA segment.
186 Although the DMA segments returned by a mapping call will adhere to
187 all restrictions necessary for a successful DMA operation, some conversion
188 (e.g. a conversion from host byte order to the device's byte order) is
189 almost always required when presenting segment information to the device.
191 A machine-dependent opaque type describing an individual mapping.
192 Multiple DMA maps can be associated with one DMA tag.
194 A machine-dependent type that describes DMA memory created by
195 .Fn bus_dmamem_coherent .
197 bus_dma_tag_t dmem_tag;
198 bus_dmamap_t dmem_map;
200 bus_addr_t dmem_busaddr;
205 field contains the DMA tag of the DMA memory and
207 field contains the DMA map of the DMA memory.
210 field points to the allocated DMA memory in kernel virtual address space.
213 field contains the device visible address of the DMA memory.
214 .It Vt bus_dmamap_callback_t
215 Client specified callback for receiving mapping information resulting from
221 .Fn bus_dmamap_load_ccb .
222 Callbacks are of the format:
223 .Bl -tag -width compact
225 .Fn "client_callback" "void *callback_arg" "bus_dma_segment_t *segs" \
226 "int nseg" "int error"
231 is the callback argument passed to dmamap load functions.
236 parameters describe an array of
237 .Vt bus_dma_segment_t
238 structures that represent the mapping.
239 This array is only valid within the scope of the callback function.
240 The success or failure of the mapping is indicated by the
243 More information on the use of callbacks can be found in the
244 description of the individual dmamap load functions.
245 .It Vt bus_dmamap_callback2_t
246 Client specified callback for receiving mapping information resulting from
250 .Fn bus_dmamap_load_uio
252 .Fn bus_dmamap_load_mbuf .
254 Callback2s are of the format:
255 .Bl -tag -width compact
257 .Fn "client_callback2" "void *callback_arg" "bus_dma_segment_t *segs" \
258 "int nseg" "bus_size_t mapsize" "int error"
261 Callback2's behavior is the same as
262 .Vt bus_dmamap_callback_t
263 with the addition that the length of the data mapped is provided via
265 .It Vt bus_dmasync_op_t
266 Memory synchronization operation specifier.
267 Bus DMA requires explicit synchronization of memory with its device
268 visible mapping in order to guarantee memory coherency.
271 allows the type of DMA operation that will be or has been performed
272 to be communicated to the system so that the correct coherency measures
274 All operations specified below are performed from the DMA engine's
276 .Bl -tag -width BUS_DMASYNC_POSTWRITE
277 .It Dv BUS_DMASYNC_PREREAD
278 Perform any synchronization required after an update of memory by the CPU
279 but prior to DMA read operations.
280 .It Dv BUS_DMASYNC_PREWRITE
281 Perform any synchronization required after an update of memory by the CPU
282 but prior to DMA write operations.
283 .It Dv BUS_DMASYNC_POSTREAD
284 Perform any synchronization required after DMA read operations, but prior
285 to CPU access of the memory.
286 .It Dv BUS_DMASYNC_POSTWRITE
287 Perform any synchronization required after DMA write operations, but prior
288 to CPU access of the memory.
293 .Bl -tag -width compact
294 .It Fn bus_dma_tag_create "parent" "alignment" "boundary" "lowaddr" \
295 "highaddr" "maxsize" "nsegments" "maxsegsz" "flags" "*dmat"
296 Allocates a device specific DMA tag, and initializes it according to
297 the arguments provided:
298 .Bl -tag -width alignment -compact
300 Indicates restrictions between the parent bridge, CPU memory, and the
302 May be NULL, if no DMA restrictions are to be inherited.
304 Alignment constraint, in bytes, of any mappings created using this tag.
305 The alignment must be a power of 2.
306 Hardware that can DMA starting at any address would specify
309 Hardware requiring DMA transfers to start on a multiple of 4K
313 Boundary constraint, in bytes, of the target DMA memory region.
314 The boundary indicates the set of addresses, all multiples of the
315 boundary argument, that cannot be crossed by a single
316 .Vt bus_dma_segment_t .
317 The boundary must be either a power of 2 or 0.
319 indicates that there are no boundary restrictions.
322 Bounds of the window of bus address space that
324 be directly accessed by the device.
325 The window contains all address greater than lowaddr and
326 less than or equal to highaddr.
327 For example, a device incapable of DMA above 4GB, would specify
329 .Dv BUS_SPACE_MAXADDR
331 .Dv BUS_SPACE_MAXADDR_32BIT .
332 Similarly a device that can only dma to addresses below 16MB would
333 specify a highaddr of
334 .Dv BUS_SPACE_MAXADDR
336 .Dv BUS_SPACE_MAXADDR_24BIT .
337 Some implementations requires that some region of device visible
338 address space, overlapping available host memory, be outside the
342 is used to bounce requests that would otherwise conflict with
343 the exclusion window.
345 Maximum size, in bytes, of the sum of all segment lengths in a given
346 DMA mapping associated with this tag.
348 Number of discontinuities (scatter/gather segments) allowed
349 in a DMA mapped region.
350 If there is no restriction,
351 .Dv BUS_SPACE_UNRESTRICTED
352 may be specified for the tag intended to be used as the parent.
353 .Dv BUS_SPACE_UNRESTRICTED
354 must not be specified for the tags
355 which will be used to create maps.
356 For tags which will be used to create maps,
357 this argument must be less than 16384 on x86_64.
359 Maximum size, in bytes, of a segment in any DMA mapped region associated
364 .Bl -tag -width ".Dv BUS_DMA_PRIVBZONE" -compact
365 .It Dv BUS_DMA_ALLOCNOW
366 Allocate the minimum resources necessary to guarantee that all map load
367 operations associated with this tag may not block.
368 If sufficient resources are not available,
371 .It Dv BUS_DMA_WAITOK
372 Indicates that it is OK to wait for resources.
376 it is not guaranteed that the resource allocation will succeed.
377 This flag is the default one,
381 .It Dv BUS_DMA_NOWAIT
382 If the resource allocation request cannot be immediately fulfilled,
385 .It Dv BUS_DMA_ONEBPAGE
386 Allocte one bounce page at most,
389 indicates that multiple bounce pages are needed.
390 .It Dv BUS_DMA_ALIGNED
391 Indicates that all memory to be loaded into the DMA maps associated
392 with this DMA tag is properly aligned according to
397 will be allocated due to the
400 If unaligned memory was loaded into the DMA maps associated with this DMA tag,
402 .It Dv BUS_DMA_PRIVBZONE
403 Uses a private bounce zone instead of a shared one.
404 A private bounce zone will vanish if the DMA tag is destroyed.
405 .It Dv BUS_DMA_ALLOCALL
406 Allocate all required resources (mainly the bounce buffer).
407 If any allocation fails,
408 .Fn bus_dma_tag_create
410 .It Dv BUS_DMA_PROTECTED
411 All of the functions called with the DMA tag are already protected by the
414 code need not protect the internal data structures.
417 Pointer to a bus_dma_tag_t where the resulting DMA tag will
423 if sufficient memory is not available for tag creation
424 or allocating mapping resources.
425 .It Fn bus_dma_tag_destroy "dmat"
426 Deallocate the DMA tag
429 .Fn bus_dma_tag_create .
433 if any DMA maps remain associated with
438 .It Fn bus_dmamap_create "dmat" "flags" "*mapp"
439 Allocates and initializes a DMA map.
440 Arguments are as follows:
441 .Bl -tag -width nsegments -compact
446 .Bl -tag -width ".Dv BUS_DMA_ONEBPAGE" -compact
447 .It Dv BUS_DMA_WAITOK
448 Indicates that it is OK to wait for resources.
452 it is not guaranteed that the resource allocation will succeed.
453 This flag is the default one,
457 .It Dv BUS_DMA_NOWAIT
458 If the resource allocation request cannot be immediately fulfilled,
461 .It Dv BUS_DMA_ONEBPAGE
462 Allocte one bounce page at most,
467 indicates that multiple bounce pages are needed.
472 where the resulting DMA map will be stored.
477 if sufficient memory is not available for creating the
478 map or allocating mapping resources.
479 .It Fn bus_dmamap_destroy "dmat" "map"
480 Frees all resources associated with a given DMA map.
481 Arguments are as follows:
482 .Bl -tag -width dmat -compact
484 DMA tag used to allocate
487 The DMA map to destroy.
492 if a mapping is still active for
494 .It Fn bus_dmamap_load "dmat" "map" "buf" "buflen" "*callback" "..."
495 Creates a mapping in device visible address space of
499 associated with the DMA map
501 Arguments are as follows:
502 .Bl -tag -width buflen -compact
504 DMA tag used to allocate
507 A DMA map without a currently active mapping.
509 A kernel virtual address pointer to a contiguous (in KVA) buffer, to be
510 mapped into device visible address space.
512 The size of the buffer.
513 .It Fa callback Fa callback_arg
514 The callback function, and its argument.
516 The value of this argument is currently undefined, and should be
521 Return values to the caller are as follows:
522 .Bl -tag -width ".Er EINPROGRESS" -compact
524 The callback has been called and completed.
525 The status of the mapping has been delivered to the callback.
527 The mapping has been deferred for lack of resources.
528 The callback will be called as soon as resources are available.
529 Callbacks are serviced in FIFO order.
530 DMA maps created from DMA tags that are allocated with
533 flag will never return this status for a load operation.
535 The load request was invalid.
536 The callback has not, and will not be called.
537 This error value may indicate that
547 argument used to create the dma tag
551 When the callback is called, it is presented with an error value
552 indicating the disposition of the mapping.
553 Error may be one of the following:
554 .Bl -tag -width ".Er EINPROGRESS" -compact
556 The mapping was successful and the
558 callback argument contains an array of
559 .Vt bus_dma_segment_t
560 elements describing the mapping.
561 This array is only valid during the scope of the callback function.
563 A mapping could not be achieved within the segment constraints provided
564 in the tag even though the requested allocation size was less than maxsize.
566 .It Fn bus_dmamap_load_ccb "dmat" "map" "ccb" "callback" "callback_arg" "flags"
567 This is a variation of
569 which maps data pointed to by
572 .It Fn bus_dmamap_load_mbuf "dmat" "map" "mbuf" "callback2" "callback_arg" \
574 This is a variation of
576 which maps mbuf chains
580 argument is also passed to the callback routine, which
581 contains the mbuf chain's packet header length.
583 Mbuf chains are assumed to be in kernel virtual address space.
587 if the size of the mbuf chain exceeds the maximum limit of the
589 .It Fn bus_dmamap_load_mbuf_segment "dmat" "map" "mbuf" "*segs" "maxsegs" \
592 .Fn bus_dmamap_load_mbuf
594 Segmentation information are saved in the
598 if the loading is successful.
601 which indicates the number of elements in the
603 must be set by the caller and must be at least 1 and at most equal the
613 This function will not block.
614 When system is short of DMA resources,
615 this function will return
619 .It Fn bus_dmamap_load_mbuf_defrag "dmat" "map" "*mbuf" "*segs" "maxsegs" \
621 This function is like
622 .Fn bus_dmamap_load_mbuf_segment ,
628 if low level code indicates too many fragments in the
632 will be updated under this situation.
635 would not be freed by this function,
645 .It Fn bus_dmamap_load_uio "dmat" "map" "uio" "callback2" "callback_arg" "flags"
646 This is a variation of
648 which maps buffers pointed to by
653 argument is also passed to the callback routine, which contains the size of
662 then it is assumed that the buffer,
665 .Fa "uio->uio_td->td_proc" Ns 's
667 User space memory must be in-core and wired prior to attempting a map
669 .It Fn bus_dmamap_unload "dmat" "map"
671 Arguments are as follows:
672 .Bl -tag -width dmam -compact
674 DMA tag used to allocate
677 The DMA map that is to be unloaded.
680 .Fn bus_dmamap_unload
681 will not perform any implicit synchronization of DMA buffers.
682 This must be done explicitly by a call to
684 prior to unloading the map.
685 .It Fn bus_dmamap_sync "dmat" "map" "op"
686 Performs synchronization of a device visible mapping with the CPU visible
687 memory referenced by that mapping.
688 Arguments are as follows:
689 .Bl -tag -width dmat -compact
691 DMA tag used to allocate
694 The DMA mapping to be synchronized.
696 Type of synchronization operation to perform.
697 See the definition of
699 for a description of the acceptable values for
704 is the method used to ensure that CPU and device DMA access to shared
706 For example, the CPU might be used to setup the contents of a buffer
707 that is to be DMA'ed into a device.
708 To ensure that the data are visible via the device's mapping of that
709 memory, the buffer must be loaded and a dma sync operation of
710 .Dv BUS_DMASYNC_PREREAD
712 Additional sync operations must be performed after every CPU write
713 to this memory if additional DMA reads are to be performed.
714 Conversely, for the DMA write case, the buffer must be loaded,
715 and a dma sync operation of
716 .Dv BUS_DMASYNC_PREWRITE
718 The CPU will only be able to see the results of this DMA write
719 once the DMA has completed and a
720 .Dv BUS_DMASYNC_POSTWRITE
721 operation has been performed.
723 If DMA read and write operations are not preceded and followed by the
724 appropriate synchronization operations, behavior is undefined.
725 .It Fn bus_dmamem_alloc "dmat" "**vaddr" "flags" "mapp"
726 Allocates memory that is mapped into KVA at the address returned
729 that is permanently loaded into the newly created
733 Arguments are as follows:
734 .Bl -tag -width alignment -compact
736 DMA tag describing the constraints of the DMA mapping.
738 Pointer to a pointer that will hold the returned KVA mapping of
739 the allocated region.
741 Flags are defined as follows:
742 .Bl -tag -width ".Dv BUS_DMA_COHERENT" -compact
743 .It Dv BUS_DMA_WAITOK
744 The routine can safely wait (sleep) for resources.
745 .It Dv BUS_DMA_NOWAIT
746 The routine is not allowed to wait for resources.
747 If resources are not available,
750 .It Dv BUS_DMA_COHERENT
751 Attempt to map this memory such that cache sync operations are
752 as cheap as possible.
753 This flag is typically set on memory that will be accessed by both
754 a CPU and a DMA engine, frequently.
755 Use of this flag does not remove the requirement of using
756 bus_dmamap_sync, but it may reduce the cost of performing
759 Causes the allocated memory to be set to all zeros.
760 .It Dv BUS_DMA_NOCACHE
761 The allocated memory will not be cached in the processor caches.
762 All memory accesses appear on the bus and are executed
767 Strong Uncacheable PAT to be set for the allocated virtual address range.
770 Pointer to storage for the returned DMA map.
773 The size of memory to be allocated is
778 The current implementation of
780 will allocate all requests as a single segment.
782 Although no explicit loading is required to access the memory
783 referenced by the returned map, the synchronization requirements
790 if sufficient memory is not available for completing
792 .It Fn bus_dmamem_coherent "parent" "alignment" "boundary" "lowaddr" \
793 "highaddr" "maxsize" "flags" "*dmem"
794 This is a convenient function to create one segment of DMA memory.
795 It combines following
799 bus_dma_tag_create(..., dtag);
800 bus_dmamem_alloc(*dtag, vaddr, ..., dmap);
801 bus_dmamap_load(*dtag, *dmap, *vaddr, ..., \\
802 callback, busaddr, ...);
805 The final results of the above function calls are:
808 DMA memory's kernel virtual address and
809 its device visible address.
810 .Fn bus_dmamem_coherent
822 .Fn bus_dma_tag_create
827 .Fn bus_dma_tag_create
835 .Fn bus_dma_tag_create
842 will be first or'ed with
845 The final results of the above three functions,
848 DMA memory's kernel virtual address and
849 its device visible address,
852 If any of the three functions failed,
853 this function will return the error code and the
856 .It Fn bus_dmamem_coherent_any "parent" "alignment" "maxsize" "flags" \
857 "*dtag" "*dmap" "*busaddr"
858 This function is a simplified version of
859 .Fn bus_dmamem_coherent
867 .Dv BUS_SPACE_MAXADDR
871 .Dv BUS_SPACE_MAXADDR .
874 usually should not be NULL.
876 Return the DMA memory's kernel virtual address.
877 The DMA tag, DMA map and device visible address are returned in
882 If this function failed,
883 NULL will be returned;
889 .It Fn bus_dmamem_free "dmat" "*vaddr" "map"
890 Frees memory previously allocated by
891 .Fn bus_dmamem_alloc .
894 Arguments are as follows:
895 .Bl -tag -width vaddr -compact
899 Kernel virtual address of the memory.
901 DMA map to be invalidated.
905 Behavior is undefined if invalid arguments are passed to
906 any of the above functions.
907 If sufficient resources cannot be allocated for a given
912 routines that are not of type,
914 will return 0 on success or an error
915 code, as discussed above.
919 routines will succeed if provided with valid arguments.
926 .%A "Jason R. Thorpe"
927 .%T "A Machine-Independent DMA Framework for NetBSD"
928 .%J "Proceedings of the Summer 1998 USENIX Technical Conference"
929 .%Q "USENIX Association"
935 interface first appeared in
942 for use in the CAM SCSI subsystem.
943 The alterations to the original API were aimed to remove the need for
945 .Vt bus_dma_segment_t
948 while allowing callers to queue up on scarce resources.
952 interface was designed and implemented by
954 of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
955 Additional input on the
957 design was provided by
959 .An Chris Demetriou ,
967 This manual page was written by
970 .An Justin T. Gibbs .