Palmer Dabbelt | 6d60b6e | 2017-07-10 18:05:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2003-2004 Hewlett-Packard Co |
| 3 | * David Mosberger-Tang <davidm@hpl.hp.com> |
| 4 | * Copyright (C) 2012 ARM Ltd. |
| 5 | * Copyright (C) 2016 SiFive, Inc. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | #ifndef __ASM_RISCV_DMA_MAPPING_H |
| 20 | #define __ASM_RISCV_DMA_MAPPING_H |
| 21 | |
| 22 | /* Use ops->dma_mapping_error (if it exists) or assume success */ |
| 23 | // #undef DMA_ERROR_CODE |
| 24 | |
| 25 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
| 26 | { |
| 27 | return &dma_noop_ops; |
| 28 | } |
| 29 | |
| 30 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
| 31 | { |
| 32 | if (!dev->dma_mask) |
| 33 | return false; |
| 34 | |
| 35 | return addr + size - 1 <= *dev->dma_mask; |
| 36 | } |
| 37 | |
| 38 | #endif /* __ASM_RISCV_DMA_MAPPING_H */ |