blob: c79ec64afd7aa269ec4b939e289e7fe2efc62838 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Andy Shevchenkof2b047f2017-07-06 14:41:51 +03002/*
3 * (C) Copyright 2007
4 * Stelian Pop <stelian@popies.net>
5 * Lead Tech Design <www.leadtechdesign.com>
Andy Shevchenkof2b047f2017-07-06 14:41:51 +03006 */
7#ifndef __ASM_X86_DMA_MAPPING_H
8#define __ASM_X86_DMA_MAPPING_H
9
Vignesh Raghavendra4a81a212020-01-16 14:23:45 +053010#include <asm/cache.h>
11#include <cpu_func.h>
Masahiro Yamadaef205ea2017-08-26 00:50:17 +090012#include <linux/dma-direction.h>
Masahiro Yamada7167d672020-02-14 16:40:17 +090013#include <linux/types.h>
Vignesh Raghavendra4a81a212020-01-16 14:23:45 +053014#include <malloc.h>
Andy Shevchenkof2b047f2017-07-06 14:41:51 +030015
Andy Shevchenkof2b047f2017-07-06 14:41:51 +030016static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
17{
18 *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
19 return (void *)*handle;
20}
21
22static inline void dma_free_coherent(void *addr)
23{
24 free(addr);
25}
26
Andy Shevchenkof2b047f2017-07-06 14:41:51 +030027#endif /* __ASM_X86_DMA_MAPPING_H */