xref: /netbsd-src/sys/external/bsd/common/include/linux/dmapool.h (revision 41a0e28382d8c6900d656ef2e0c4cbf2826af49f)
1*41a0e283Sriastradh /*	$NetBSD: dmapool.h,v 1.1 2022/10/25 23:32:37 riastradh Exp $	*/
2*41a0e283Sriastradh 
3*41a0e283Sriastradh /*-
4*41a0e283Sriastradh  * Copyright (c) 2022 The NetBSD Foundation, Inc.
5*41a0e283Sriastradh  * All rights reserved.
6*41a0e283Sriastradh  *
7*41a0e283Sriastradh  * Redistribution and use in source and binary forms, with or without
8*41a0e283Sriastradh  * modification, are permitted provided that the following conditions
9*41a0e283Sriastradh  * are met:
10*41a0e283Sriastradh  * 1. Redistributions of source code must retain the above copyright
11*41a0e283Sriastradh  *    notice, this list of conditions and the following disclaimer.
12*41a0e283Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
13*41a0e283Sriastradh  *    notice, this list of conditions and the following disclaimer in the
14*41a0e283Sriastradh  *    documentation and/or other materials provided with the distribution.
15*41a0e283Sriastradh  *
16*41a0e283Sriastradh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*41a0e283Sriastradh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*41a0e283Sriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*41a0e283Sriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*41a0e283Sriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*41a0e283Sriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*41a0e283Sriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*41a0e283Sriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*41a0e283Sriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*41a0e283Sriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*41a0e283Sriastradh  * POSSIBILITY OF SUCH DAMAGE.
27*41a0e283Sriastradh  */
28*41a0e283Sriastradh 
29*41a0e283Sriastradh #ifndef	_LINUX_DMAPOOL_H_
30*41a0e283Sriastradh #define	_LINUX_DMAPOOL_H_
31*41a0e283Sriastradh 
32*41a0e283Sriastradh #include <sys/types.h>
33*41a0e283Sriastradh 
34*41a0e283Sriastradh #include <sys/bus.h>
35*41a0e283Sriastradh 
36*41a0e283Sriastradh #include <linux/gfp.h>
37*41a0e283Sriastradh #include <linux/types.h>
38*41a0e283Sriastradh 
39*41a0e283Sriastradh /* namespace */
40*41a0e283Sriastradh #define	dma_pool_create		linux_dma_pool_create
41*41a0e283Sriastradh #define	dma_pool_destroy	linux_dma_pool_destroy
42*41a0e283Sriastradh #define	dma_pool_free		linux_dma_pool_free
43*41a0e283Sriastradh #define	dma_pool_zalloc		linux_dma_pool_zalloc
44*41a0e283Sriastradh 
45*41a0e283Sriastradh struct dma_pool;
46*41a0e283Sriastradh 
47*41a0e283Sriastradh struct dma_pool *dma_pool_create(const char *, bus_dma_tag_t, size_t, size_t,
48*41a0e283Sriastradh     size_t);
49*41a0e283Sriastradh void dma_pool_destroy(struct dma_pool *);
50*41a0e283Sriastradh 
51*41a0e283Sriastradh void *dma_pool_zalloc(struct dma_pool *, gfp_t, dma_addr_t *);
52*41a0e283Sriastradh void dma_pool_free(struct dma_pool *, void *, dma_addr_t);
53*41a0e283Sriastradh 
54*41a0e283Sriastradh #endif	/* _LINUX_DMAPOOL_H_ */
55