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