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 $
71 .\" $DragonFly: src/share/man/man9/bus_dma.9,v 1.8 2007/04/09 21:20:37 swildner Exp $
78 .Nm bus_dma_tag_create ,
79 .Nm bus_dma_tag_destroy ,
80 .Nm bus_dmamap_create ,
81 .Nm bus_dmamap_destroy ,
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_dma_filter_t *filtfunc" "void *filtfuncarg" "bus_size_t maxsize" \
100 "int nsegments" "bus_size_t maxsegsz" "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_mbuf "bus_dma_tag_t dmat" "bus_dmamap_t map" \
113 "struct mbuf *mbuf" "bus_dmamap_callback2_t *callback" "void *callback_arg" \
116 .Fn bus_dmamap_load_mbuf_segment "bus_dma_tag_t dmat" "bus_dmamap_t map" \
117 "struct mbuf *mbuf" "bus_dma_segment_t *segs" "int maxsegs" "int *nsegs" \
120 .Fn bus_dmamap_load_mbuf_defrag "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_uio "bus_dma_tag_t dmat" "bus_dmamap_t map" \
125 "struct uio *uio" "bus_dmamap_callback2_t *callback" "void *callback_arg" \
128 .Fn bus_dmamem_alloc "bus_dma_tag_t dmat" "void **vaddr" \
129 "int flags" "bus_dmamap_t *mapp"
131 .Fn bus_dmamem_coherent "bus_dma_tag_t parent" "bus_size_t alignment" \
132 "bus_size_t boundary" "bus_addr_t lowaddr" "bus_addr_t highaddr" \
133 "bus_size_t maxsize" "int flags" "bus_dmamem_t *dmem"
135 .Fn bus_dmamem_coherent_any "bus_dma_tag_t parent" "bus_size_t alignment" \
136 "bus_size_t maxsize" "int flags" "bus_dma_tag_t *dtag" "bus_dmamap_t *dmap" \
137 "bus_addr_t *busaddr"
139 .Fn bus_dmamap_unload "bus_dma_tag_t dmat" "bus_dmamap_t map"
141 .Fn bus_dmamap_sync "bus_dma_tag_t dmat" "bus_dmamap_t map" \
142 "bus_dmasync_op_t op"
144 .Fn bus_dmamem_free "bus_dma_tag_t dmat" "void *vaddr" \
147 Direct Memory Access (DMA) is a method of transferring data
148 without involving the CPU, thus providing higher performance.
149 A DMA transaction can be achieved between device to memory,
150 device to device, or memory to memory.
154 API is a bus, device, and machine-independent (MI) interface to
156 It provides the client with flexibility and simplicity by
157 abstracting machine dependent issues like setting up
158 DMA mappings, handling cache issues, bus specific features
160 .Sh STRUCTURES AND TYPES
161 .Bl -tag -width compact
163 A machine-dependent (MD) opaque type that describes the
164 characteristics of DMA transactions.
165 DMA tags are organized into a hierarchy, with each child
166 tag inheriting the restrictions of its parent.
167 This allows all devices along the path of DMA transactions
168 to contribute to the constraints of those transactions.
169 .It Vt bus_dma_filter_t
170 Client specified address filter having the format:
171 .Bl -tag -width compact
173 .Fn "client_filter" "void *filtarg" "bus_addr_t testaddr"
176 Address filters can be specified during tag creation to allow
177 for devices who's DMA address restrictions cannot be specified
181 is client specified during tag creation to be passed to all
182 invocations of the callback.
185 argument contains a potential starting address of a DMA mapping.
186 The filter function operates on the set of addresses from
189 .Ql trunc_page(testaddr) + PAGE_SIZE - 1 ,
191 The filter function should return zero for any mapping in this range
192 that can be accommodated by the device and non-zero otherwise.
193 .It Vt bus_dma_segment_t
194 A machine-dependent type that describes individual
203 field contains the device visible address of the DMA segment, and
205 contains the length of the DMA segment.
206 Although the DMA segments returned by a mapping call will adhere to
207 all restrictions necessary for a successful DMA operation, some conversion
208 (e.g. a conversion from host byte order to the device's byte order) is
209 almost always required when presenting segment information to the device.
211 A machine-dependent opaque type describing an individual mapping.
212 Multiple DMA maps can be associated with one DMA tag.
214 A machine-dependent type that describes DMA memory created by
215 .Fn bus_dmamem_coherent .
217 bus_dma_tag_t dmem_tag;
218 bus_dmamap_t dmem_map;
220 bus_addr_t dmem_busaddr;
225 field contains the DMA tag of the DMA memory and
227 field contains the DMA map of the DMA memory.
230 field points to the allocated DMA memory in kernel virtual address space.
233 field contains the device visible address of the DMA memory.
234 .It Vt bus_dmamap_callback_t
235 Client specified callback for receiving mapping information resulting from
239 .Fn bus_dmamap_load .
240 Callbacks are of the format:
241 .Bl -tag -width compact
243 .Fn "client_callback" "void *callback_arg" "bus_dma_segment_t *segs" \
244 "int nseg" "int error"
249 is the callback argument passed to dmamap load functions.
254 parameters describe an array of
255 .Vt bus_dma_segment_t
256 structures that represent the mapping.
257 This array is only valid within the scope of the callback function.
258 The success or failure of the mapping is indicated by the
261 More information on the use of callbacks can be found in the
262 description of the individual dmamap load functions.
263 .It Vt bus_dmamap_callback2_t
264 Client specified callback for receiving mapping information resulting from
268 .Fn bus_dmamap_load_uio
270 .Fn bus_dmamap_load_mbuf .
272 Callback2s are of the format:
273 .Bl -tag -width compact
275 .Fn "client_callback2" "void *callback_arg" "bus_dma_segment_t *segs" \
276 "int nseg" "bus_size_t mapsize" "int error"
279 Callback2's behavior is the same as
280 .Vt bus_dmamap_callback_t
281 with the addition that the length of the data mapped is provided via
283 .It Vt bus_dmasync_op_t
284 Memory synchronization operation specifier.
285 Bus DMA requires explicit synchronization of memory with it's device
286 visible mapping in order to guarantee memory coherency.
289 allows the type of DMA operation that will be or has been performed
290 to be communicated to the system so that the correct coherency measures
292 All operations specified below are performed from the DMA engine's
294 .Bl -tag -width BUS_DMASYNC_POSTWRITE
295 .It Dv BUS_DMASYNC_PREREAD
296 Perform any synchronization required after an update of memory by the CPU
297 but prior to DMA read operations.
298 .It Dv BUS_DMASYNC_PREWRITE
299 Perform any synchronization required after an update of memory by the CPU
300 but prior to DMA write operations.
301 .It Dv BUS_DMASYNC_POSTREAD
302 Perform any synchronization required after DMA read operations, but prior
303 to CPU access of the memory.
304 .It Dv BUS_DMASYNC_POSTWRITE
305 Perform any synchronization required after DMA write operations, but prior
306 to CPU access of the memory.
311 .Bl -tag -width compact
312 .It Fn bus_dma_tag_create "parent" "alignment" "boundary" "lowaddr" \
313 "highaddr" "*filtfunc" "*filtfuncarg" "maxsize" "nsegments" "maxsegsz" \
315 Allocates a device specific DMA tag, and initializes it according to
316 the arguments provided:
317 .Bl -tag -width *filtfuncarg -compact
319 Indicates restrictions between the parent bridge, CPU memory, and the
321 May be NULL, if no DMA restrictions are to be inherited.
323 Alignment constraint, in bytes, of any mappings created using this tag.
324 The alignment must be a power of 2.
325 Hardware that can DMA starting at any address would specify
328 Hardware requiring DMA transfers to start on a multiple of 4K
332 Boundary constraint, in bytes, of the target DMA memory region.
333 The boundary indicates the set of addresses, all multiples of the
334 boundary argument, that cannot be crossed by a single
335 .Vt bus_dma_segment_t .
336 The boundary must be either a power of 2 or 0.
338 indicates that there are no boundary restrictions.
341 Bounds of the window of bus address space that
343 be directly accessed by the device.
344 The window contains all address greater than lowaddr and
345 less than or equal to highaddr.
346 For example, a device incapable of DMA above 4GB, would specify
348 .Dv BUS_SPACE_MAXADDR
350 .Dv BUS_SPACE_MAXADDR_32BIT .
351 Similarly a device that can only dma to addresses bellow 16MB would
352 specify a highaddr of
353 .Dv BUS_SPACE_MAXADDR
355 .Dv BUS_SPACE_MAXADDR_24BIT .
356 Some implementations requires that some region of device visible
357 address space, overlapping available host memory, be outside the
361 is used to bounce requests that would otherwise conflict with
362 the exclusion window.
364 Optional filter function (may be NULL) to be called for any attempt to
365 map memory into the window described by
369 A filter function is only required when the single window described
374 cannot adequately describe the constraints of the device.
375 The filter function will be called for every machine page
376 that overlaps the exclusion window.
378 Argument passed to all calls to the filter function for this tag.
381 Maximum size, in bytes, of the sum of all segment lengths in a given
382 DMA mapping associated with this tag.
384 Number of discontinuities (scatter/gather segments) allowed
385 in a DMA mapped region.
386 If there is no restriction,
387 .Dv BUS_SPACE_UNRESTRICTED
390 Maximum size, in bytes, of a segment in any DMA mapped region associated
395 .Bl -tag -width ".Dv BUS_DMA_ALLOCNOW" -compact
396 .It Dv BUS_DMA_ALLOCNOW
397 Allocate the minimum resources necessary to guarantee that all map load
398 operations associated with this tag may not block.
399 If sufficient resources are not available,
402 .It Dv BUS_DMA_WAITOK
403 Indicates that it is OK to wait for resources.
407 it is not guaranteed that the resource allocation will succeed.
408 This flag is the default one,
412 .It Dv BUS_DMA_NOWAIT
413 If the resource allocation request cannot be immediately fulfilled,
416 .It Dv BUS_DMA_ONEBPAGE
417 Allocte one bounce page at most,
420 indicates that multiple bounce pages are needed.
421 .It Dv BUS_DMA_ALIGNED
422 Indicates that all memory to be loaded into the DMA maps associated
423 with this DMA tag is properly aligned according to
428 will be allocated due to the
431 If unaligned memory was loaded into the DMA maps associated with this DMA tag,
435 Pointer to a bus_dma_tag_t where the resulting DMA tag will
441 if sufficient memory is not available for tag creation
442 or allocating mapping resources.
443 .It Fn bus_dma_tag_destroy "dmat"
444 Deallocate the DMA tag
447 .Fn bus_dma_tag_create .
451 if any DMA maps remain associated with
456 .It Fn bus_dmamap_create "dmat" "flags" "*mapp"
457 Allocates and initializes a DMA map.
458 Arguments are as follows:
459 .Bl -tag -width nsegments -compact
464 .Bl -tag -width ".Dv BUS_DMA_ONEBPAGE" -compact
465 .It Dv BUS_DMA_WAITOK
466 Indicates that it is OK to wait for resources.
470 it is not guaranteed that the resource allocation will succeed.
471 This flag is the default one,
475 .It Dv BUS_DMA_NOWAIT
476 If the resource allocation request cannot be immediately fulfilled,
479 .It Dv BUS_DMA_ONEBPAGE
480 Allocte one bounce page at most,
485 indicates that multiple bounce pages are needed.
490 where the resulting DMA map will be stored.
495 if sufficient memory is not available for creating the
496 map or allocating mapping resources.
497 .It Fn bus_dmamap_destroy "dmat" "map"
498 Frees all resources associated with a given DMA map.
499 Arguments are as follows:
500 .Bl -tag -width dmat -compact
502 DMA tag used to allocate
505 The DMA map to destroy.
510 if a mapping is still active for
512 .It Fn bus_dmamap_load "dmat" "map" "buf" "buflen" "*callback" "..."
513 Creates a mapping in device visible address space of
517 associated with the DMA map
519 Arguments are as follows:
520 .Bl -tag -width buflen -compact
522 DMA tag used to allocate
525 A DMA map without a currently active mapping.
527 A kernel virtual address pointer to a contiguous (in KVA) buffer, to be
528 mapped into device visible address space.
530 The size of the buffer.
531 .It Fa callback Fa callback_arg
532 The callback function, and its argument.
534 The value of this argument is currently undefined, and should be
539 Return values to the caller are as follows:
540 .Bl -tag -width ".Er EINPROGRESS" -compact
542 The callback has been called and completed.
543 The status of the mapping has been delivered to the callback.
545 The mapping has been deferred for lack of resources.
546 The callback will be called as soon as resources are available.
547 Callbacks are serviced in FIFO order.
548 DMA maps created from DMA tags that are allocated with
551 flag will never return this status for a load operation.
553 The load request was invalid.
554 The callback has not, and will not be called.
555 This error value may indicate that
565 argument used to create the dma tag
569 When the callback is called, it is presented with an error value
570 indicating the disposition of the mapping.
571 Error may be one of the following:
572 .Bl -tag -width ".Er EINPROGRESS" -compact
574 The mapping was successful and the
576 callback argument contains an array of
577 .Vt bus_dma_segment_t
578 elements describing the mapping.
579 This array is only valid during the scope of the callback function.
581 A mapping could not be achieved within the segment constraints provided
582 in the tag even though the requested allocation size was less than maxsize.
584 .It Fn bus_dmamap_load_mbuf "dmat" "map" "mbuf" "callback2" "callback_arg" \
586 This is a variation of
588 which maps mbuf chains
592 argument is also passed to the callback routine, which
593 contains the mbuf chain's packet header length.
595 Mbuf chains are assumed to be in kernel virtual address space.
599 if the size of the mbuf chain exceeds the maximum limit of the
601 .It Fn bus_dmamap_load_mbuf_segment "dmat" "map" "mbuf" "*segs" "maxsegs" \
604 .Fn bus_dmamap_load_mbuf
606 Segmentation information are saved in the
610 if the loading is successful.
613 which indicates the number of elements in the
615 must be set by the caller and must be at least 1 but less than the
625 This function will not block.
626 When system is short of DMA resources,
627 this function will return
631 .It Fn bus_dmamap_load_mbuf_defrag "dmat" "map" "*mbuf" "*segs" "maxsegs" \
633 This function is like
634 .Fn bus_dmamap_load_mbuf_segment ,
640 if low level code indicates too many fragments in the
644 will be updated under this situation.
647 would not be freed by this function,
657 .It Fn bus_dmamap_load_uio "dmat" "map" "uio" "callback2" "callback_arg" "flags"
658 This is a variation of
660 which maps buffers pointed to by
665 argument is also passed to the callback routine, which contains the size of
674 then it is assumed that the buffer,
677 .Fa "uio->uio_td->td_proc" Ns 's
679 User space memory must be in-core and wired prior to attempting a map
681 .It Fn bus_dmamap_unload "dmat" "map"
683 Arguments are as follows:
684 .Bl -tag -width dmam -compact
686 DMA tag used to allocate
689 The DMA map that is to be unloaded.
692 .Fn bus_dmamap_unload
693 will not perform any implicit synchronization of DMA buffers.
694 This must be done explicitly by a call to
696 prior to unloading the map.
697 .It Fn bus_dmamap_sync "dmat" "map" "op"
698 Performs synchronization of a device visible mapping with the CPU visible
699 memory referenced by that mapping.
700 Arguments are as follows:
701 .Bl -tag -width dmat -compact
703 DMA tag used to allocate
706 The DMA mapping to be synchronized.
708 Type of synchronization operation to perform.
709 See the definition of
711 for a description of the acceptable values for
716 is the method used to ensure that CPU and device DMA access to shared
718 For example, the CPU might be used to setup the contents of a buffer
719 that is to be DMA'ed into a device.
720 To ensure that the data are visible via the device's mapping of that
721 memory, the buffer must be loaded and a dma sync operation of
722 .Dv BUS_DMASYNC_PREREAD
724 Additional sync operations must be performed after every CPU write
725 to this memory if additional DMA reads are to be performed.
726 Conversely, for the DMA write case, the buffer must be loaded,
727 and a dma sync operation of
728 .Dv BUS_DMASYNC_PREWRITE
730 The CPU will only be able to see the results of this DMA write
731 once the DMA has completed and a
732 .Dv BUS_DMASYNC_POSTWRITE
733 operation has been performed.
735 If DMA read and write operations are not preceded and followed by the
736 appropriate synchronization operations, behavior is undefined.
737 .It Fn bus_dmamem_alloc "dmat" "**vaddr" "flags" "mapp"
738 Allocates memory that is mapped into KVA at the address returned
741 that is permanently loaded into the newly created
745 Arguments are as follows:
746 .Bl -tag -width alignment -compact
748 DMA tag describing the constraints of the DMA mapping.
750 Pointer to a pointer that will hold the returned KVA mapping of
751 the allocated region.
753 Flags are defined as follows:
754 .Bl -tag -width ".Dv BUS_DMA_NOWAIT" -compact
755 .It Dv BUS_DMA_WAITOK
756 The routine can safely wait (sleep) for resources.
757 .It Dv BUS_DMA_NOWAIT
758 The routine is not allowed to wait for resources.
759 If resources are not available,
762 .It Dv BUS_DMA_COHERENT
763 Attempt to map this memory such that cache sync operations are
764 as cheap as possible.
765 This flag is typically set on memory that will be accessed by both
766 a CPU and a DMA engine, frequently.
767 Use of this flag does not remove the requirement of using
768 bus_dmamap_sync, but it may reduce the cost of performing
771 Causes the allocated memory to be set to all zeros.
774 Pointer to storage for the returned DMA map.
777 The size of memory to be allocated is
782 The current implementation of
784 will allocate all requests as a single segment.
786 Although no explicit loading is required to access the memory
787 referenced by the returned map, the synchronization requirements
794 if sufficient memory is not available for completing
796 .It Fn bus_dmamem_coherent "parent" "alignment" "boundary" "lowaddr" \
797 "highaddr" "maxsize" "flags" "*dmem"
798 This is a convenient function to create one segment of DMA memory.
799 It combines following
803 bus_dma_tag_create(..., dtag);
804 bus_dmamem_alloc(*dtag, vaddr, ..., dmap);
805 bus_dmamap_load(*dtag, *dmap, *vaddr, ..., \\
806 callback, busaddr, ...);
809 The final results of the above function calls are:
812 DMA memory's kernel virtual address and
813 its device visible address.
814 .Fn bus_dmamem_coherent
826 .Fn bus_dma_tag_create
831 .Fn bus_dma_tag_create
839 .Fn bus_dma_tag_create
846 will be first or'ed with
849 The final results of the above three functions,
852 DMA memory's kernel virtual address and
853 its device visible address,
856 If any of the three functions failed,
857 this function will return the error code and the
860 .It Fn bus_dmamem_coherent_any "parent" "alignment" "maxsize" "flags" \
861 "*dtag" "*dmap" "*busaddr"
862 This function is a simplified version of
863 .Fn bus_dmamem_coherent
871 .Dv BUS_SPACE_MAXADDR
875 .Dv BUS_SPACE_MAXADDR .
878 usually should not be NULL.
880 Return the DMA memory's kernel virtual address.
881 The DMA tag, DMA map and device visible address are returned in
886 If this function failed,
887 NULL will be returned;
893 .It Fn bus_dmamem_free "dmat" "*vaddr" "map"
894 Frees memory previously allocated by
895 .Fn bus_dmamem_alloc .
898 Arguments are as follows:
899 .Bl -tag -width vaddr -compact
903 Kernel virtual address of the memory.
905 DMA map to be invalidated.
909 Behavior is undefined if invalid arguments are passed to
910 any of the above functions.
911 If sufficient resources cannot be allocated for a given
916 routines that are not of type,
918 will return 0 on success or an error
919 code, as discussed above.
923 routines will succeed if provided with valid arguments.
930 .%A "Jason R. Thorpe"
931 .%T "A Machine-Independent DMA Framework for NetBSD"
932 .%J "Proceedings of the Summer 1998 USENIX Technical Conference"
933 .%Q "USENIX Association"
939 interface first appeared in
946 for use in the CAM SCSI subsystem.
947 The alterations to the original API were aimed to remove the need for
949 .Vt bus_dma_segment_t
952 while allowing callers to queue up on scarce resources.
956 interface was designed and implemented by
958 of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
959 Additional input on the
961 design was provided by
963 .An Chris Demetriou ,
971 This manual page was written by
974 .An Justin T. Gibbs .