Lines Matching +full:dma +full:- +full:safe +full:- +full:map
1 /* SPDX-License-Identifier: GPL-2.0 */
9 #include <linux/dma-direction.h>
15 * List of possible attributes associated with a DMA mapping. The semantics
16 * of each attribute should be defined in Documentation/core-api/dma-attributes.rst.
46 * DMA_ATTR_ALLOC_SINGLE_PAGES: This is a hint to the DMA-mapping subsystem
52 * DMA_ATTR_NO_WARN: This tells the DMA-mapping subsystem to suppress
60 * at least read-only at lesser-privileged levels).
65 * A dma_addr_t can hold any valid DMA or bus address for the platform. It can
66 * be given to a device to use as a DMA source or target. It is specific to a
76 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
99 return -ENOMEM; in dma_mapping_error()
183 return -EOPNOTSUPP; in dma_map_sgtable()
213 return -ENOMEM; in dma_mapping_error()
237 return -ENXIO; in dma_get_sgtable_attrs()
243 return -ENXIO; in dma_mmap_attrs()
255 return -EIO; in dma_set_mask()
259 return -EIO; in dma_set_coherent_mask()
298 return -EINVAL; in dma_mmap_noncontiguous()
325 /* DMA must never operate on areas that might be remapped. */ in dma_map_single_attrs()
327 "rejecting DMA map of vmalloc memory\n")) in dma_map_single_attrs()
355 * dma_unmap_sgtable - Unmap the given buffer for DMA
356 * @dev: The device for which to perform the DMA operation
358 * @dir: DMA direction
359 * @attrs: Optional DMA attributes for the unmap operation
362 * object for the @dir DMA operation by the @dev device. After this function
368 dma_unmap_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs); in dma_unmap_sgtable()
372 * dma_sync_sgtable_for_cpu - Synchronize the given buffer for CPU access
373 * @dev: The device for which to perform the DMA operation
375 * @dir: DMA direction
378 * buffer back to the CPU domain, so it is safe to perform any access to it
379 * by the CPU. Before doing any further DMA operations, one has to transfer
380 * the ownership of the buffer back to the DMA domain by calling the
386 dma_sync_sg_for_cpu(dev, sgt->sgl, sgt->orig_nents, dir); in dma_sync_sgtable_for_cpu()
390 * dma_sync_sgtable_for_device - Synchronize the given buffer for DMA
391 * @dev: The device for which to perform the DMA operation
393 * @dir: DMA direction
396 * buffer back to the DMA domain, so it is safe to perform the DMA operation.
403 dma_sync_sg_for_device(dev, sgt->sgl, sgt->orig_nents, dir); in dma_sync_sgtable_for_device()
431 if (dev->dma_mask && *dev->dma_mask) in dma_get_mask()
432 return *dev->dma_mask; in dma_get_mask()
437 * Set both the DMA mask and the coherent DMA mask to the same thing.
439 * as the DMA API guarantees that the coherent DMA mask can be set to
440 * the same or smaller than the streaming DMA mask.
452 * does not have dev->dma_mask appropriately setup.
456 dev->dma_mask = &dev->coherent_dma_mask; in dma_coerce_mask_and_coherent()
461 * dma_addressing_limited - return if the device is addressing limited
464 * Return %true if the devices DMA mask is too small to address all memory in
470 return min_not_zero(dma_get_mask(dev), dev->bus_dma_limit) < in dma_addressing_limited()
476 if (dev->dma_parms && dev->dma_parms->max_segment_size) in dma_get_max_seg_size()
477 return dev->dma_parms->max_segment_size; in dma_get_max_seg_size()
483 if (dev->dma_parms) { in dma_set_max_seg_size()
484 dev->dma_parms->max_segment_size = size; in dma_set_max_seg_size()
487 return -EIO; in dma_set_max_seg_size()
492 if (dev->dma_parms && dev->dma_parms->segment_boundary_mask) in dma_get_seg_boundary()
493 return dev->dma_parms->segment_boundary_mask; in dma_get_seg_boundary()
498 * dma_get_seg_boundary_nr_pages - return the segment boundary in "page" units
506 * non-DMA API callers.
518 if (dev->dma_parms) { in dma_set_seg_boundary()
519 dev->dma_parms->segment_boundary_mask = mask; in dma_set_seg_boundary()
522 return -EIO; in dma_set_seg_boundary()
527 if (dev->dma_parms) in dma_get_min_align_mask()
528 return dev->dma_parms->min_align_mask; in dma_get_min_align_mask()
535 if (WARN_ON_ONCE(!dev->dma_parms)) in dma_set_min_align_mask()
536 return -EIO; in dma_set_min_align_mask()
537 dev->dma_parms->min_align_mask = min_align_mask; in dma_set_min_align_mask()
586 #define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
587 #define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
588 #define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
589 #define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))