xref: /openbsd/share/man/man9/dma_alloc.9 (revision a6445c1d)
1.\"	$OpenBSD: dma_alloc.9,v 1.6 2013/06/04 19:27:05 schwarze Exp $
2.\"	$NetBSD: pool.9,v 1.18 2001/06/21 11:59:01 wiz Exp $
3.\"
4.\" Copyright (c) 2011 Theo de Raadt
5.\" All rights reserved.
6.\"
7.\" Permission to use, copy, modify, and distribute this software for any
8.\" purpose with or without fee is hereby granted, provided that the above
9.\" copyright notice and this permission notice appear in all copies.
10.\"
11.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\"
19.Dd $Mdocdate: June 4 2013 $
20.Dt DMA_ALLOC 9
21.Os
22.Sh NAME
23.Nm dma_alloc ,
24.Nm dma_free
25.Nd DMA-safe memory allocator
26.Sh SYNOPSIS
27.In sys/types.h
28.In sys/pool.h
29.Ft void *
30.Fo dma_alloc
31.Fa "size_t size"
32.Fa "int flags"
33.Fc
34.Ft void
35.Fo dma_free
36.Fa "void *m"
37.Fa "size_t size"
38.Fc
39.Sh DESCRIPTION
40This allocator provides DMA-safe memory managed using the
41.Xr pool 9
42interface.
43It is safe to call in most contexts and is
44typically used for temporary buffers up to 65536 bytes.
45When buffers are used many times it may be better to consider
46using other DMA-safe allocators.
47.Pp
48Interrupt protection is set to
49.Va IPL_VM
50using
51.Xr pool_setipl 9 .
52.Pp
53The
54.Ar flags
55argument is a selection of
56.Xr pool_get 9
57flag arguments.
58.Pp
59The same
60.Va size
61argument must be passed to both
62.Fn dma_alloc
63and the subsequent
64.Fn dma_free .
65Allocations over 65536 will fail.
66.Sh SEE ALSO
67.Xr bus_dma 9 ,
68.Xr mbuf 9 ,
69.Xr pool 9
70.Sh HISTORY
71The
72.Nm
73interface first appeared in
74.Ox 4.8 .
75