dma-mapping.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. /* Use ops->dma_mapping_error (if it exists) or assume success */
  22. // #undef DMA_ERROR_CODE
  23. static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
  24. {
  25. return &dma_noop_ops;
  26. }
  27. static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
  28. {
  29. if (!dev->dma_mask)
  30. return false;
  31. return addr + size - 1 <= *dev->dma_mask;
  32. }
  33. #endif /* __ASM_RISCV_DMA_MAPPING_H */