2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
9 #ifndef __ASM_DMA_COHERENCE_H
10 #define __ASM_DMA_COHERENCE_H
12 enum coherent_io_user_state
{
15 IO_COHERENCE_DISABLED
,
18 #if defined(CONFIG_DMA_PERDEV_COHERENT)
19 /* Don't provide (hw_)coherentio to avoid misuse */
20 #elif defined(CONFIG_DMA_MAYBE_COHERENT)
21 extern enum coherent_io_user_state coherentio
;
22 extern int hw_coherentio
;
24 static inline bool dev_is_dma_coherent(struct device
*dev
)
26 return coherentio
== IO_COHERENCE_ENABLED
||
27 (coherentio
== IO_COHERENCE_DEFAULT
&& hw_coherentio
);
30 #ifdef CONFIG_DMA_NONCOHERENT
31 #define coherentio IO_COHERENCE_DISABLED
33 #define coherentio IO_COHERENCE_ENABLED
35 #define hw_coherentio 0
36 #endif /* CONFIG_DMA_MAYBE_COHERENT */