1 // SPDX-License-Identifier: GPL-2.0 !! 1 #include <linux/kernel.h> 2 /* !! 2 #include <linux/dma-mapping.h> 3 * Copyright (C) 2009-2010 PetaLogix !! 3 #include <linux/dma-debug.h> 4 * Copyright (C) 2006 Benjamin Herrenschmidt, << 5 * << 6 * Provide default implementations of the DMA << 7 * directly mapped busses. << 8 */ << 9 4 10 #include <linux/device.h> !! 5 #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 15) 11 #include <linux/dma-map-ops.h> << 12 #include <linux/gfp.h> << 13 #include <linux/export.h> << 14 #include <linux/bug.h> << 15 #include <asm/cacheflush.h> << 16 6 17 static void __dma_sync(phys_addr_t paddr, size !! 7 static int __init dma_init(void) 18 enum dma_data_direction direct << 19 { 8 { 20 switch (direction) { !! 9 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); 21 case DMA_TO_DEVICE: !! 10 return 0; 22 case DMA_BIDIRECTIONAL: << 23 flush_dcache_range(paddr, padd << 24 break; << 25 case DMA_FROM_DEVICE: << 26 invalidate_dcache_range(paddr, << 27 break; << 28 default: << 29 BUG(); << 30 } << 31 } << 32 << 33 void arch_sync_dma_for_device(phys_addr_t padd << 34 enum dma_data_direction dir) << 35 { << 36 __dma_sync(paddr, size, dir); << 37 } << 38 << 39 void arch_sync_dma_for_cpu(phys_addr_t paddr, << 40 enum dma_data_direction dir) << 41 { << 42 __dma_sync(paddr, size, dir); << 43 } 11 } >> 12 fs_initcall(dma_init); 44 13
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.