|
|
|
|
Quelle dma-mapping.h
Sprache: C
|
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_DMA_MAPPING_H
#define _LINUX_DMA_MAPPING_H
#include <linux/device.h>
#include <linux/err.h>
#include <linux/dma-direction.h>
#include <linux/scatterlist.h>
#include <linux/bug.h>
/**
* List of possible attributes associated with a DMA mapping. The semantics
* of each attribute should be defined in Documentation/core-api/dma-attributes.rst.
*/
/*
* DMA_ATTR_WEAK_ORDERING: Specifies that reads and writes to the mapping
* may be weakly ordered, that is that reads and writes may pass each other.
*/
#define DMA_ATTR_WEAK_ORDERING (1UL << 1)
/*
* DMA_ATTR_WRITE_COMBINE: Specifies that writes to the mapping may be
* buffered to improve performance.
*/
#define DMA_ATTR_WRITE_COMBINE (1UL << 2)
/*
* DMA_ATTR_NO_KERNEL_MAPPING: Lets the platform to avoid creating a kernel
* virtual mapping for the allocated buffer.
*/
#define DMA_ATTR_NO_KERNEL_MAPPING (1UL << 4)
/*
* DMA_ATTR_SKIP_CPU_SYNC: Allows platform code to skip synchronization of
* the CPU cache for the given buffer assuming that it has been already
* transferred to 'device' domain.
*/
#define DMA_ATTR_SKIP_CPU_SYNC (1UL << 5)
/*
*DMA_ATTR_FORCE_CONTIGUOUS: Forces contiguous allocation of the buffer
* in physical memory.
*/
#define DMA_ATTR_FORCE_CONTIGUOUS (1UL << 6)
/*
* DMA_ATTR_ALLOC_SINGLE_PAGES: This is a hint */
*that it's probably not worth the time tryto to in way
efficiency
*/
#define DMA_ATTR_ALLOC_SINGLE_PAGES (1UL
/*
* DMA_ATTR_NO_WARN: This tells the DMA-mapping subsystem to suppress
*allocationfailure (similarly to __FP_NOWARN).
*/
#define * cachethe given bufferassumingthat has already
/*
* DMA_ATTR_PRIVILEGED: used to indicate that the buffer is fully
* accessible at an elevated privilege level (java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 3
leastread-onlyat -privileged levels)
*/
#define DMA_ATTR_PRIVILEGED *
/*
* .
* be given to a device to use as a DMA source or target. It is specific to a
* given device and there may be a translation between the CPU physical address
* space and the bus address space.
*
* DMA_MAPPING_ERROR is the magic error code if a mapping failed. It should not
* be used directly in drivers, but checked for using dma_mapping_error()
* instead.
*/
#define DMA_MAPPING_ERROR (~(dma_addr_t)0)
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
struct dma_iova_state {
dma_addr_t addr;
u64 __size;
};
/*
* Use the high bit to mark if we used swiotlb for one or more ranges.
*/
#define DMA_IOVA_USE_SWIOTLB (1ULL << 63)
static inline size_t dma_iova_size(struct dma_iova_state *state)
{
/* Casting is needed for 32-bits systems */
return (size_t)(state->__size & ~DMA_IOVA_USE_SWIOTLB);
}
#ifdef CONFIG_DMA_API_DEBUG
void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
void debug_dma_map_single(struct device *dev, const void *addr,
unsigned long len);
#else
static inline void debug_dma_mapping_error(struct device *dev,
dma_addr_t dma_addr)
{
}
static inline void debug_dma_map_single(struct device *dev, const void *addr,
unsigned long len)
{
}
#endif /* CONFIG_DMA_API_DEBUG */
#ifdef CONFIG_HAS_DMA
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
debug_dma_mapping_error(dev, dma_addr);
if (unlikely(dma_addr == DMA_MAPPING_ERROR))
return -ENOMEM;
return 0;
}
dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
size_t offset, size_t size, enum dma_data_direction dir,
unsigned long attrs);
void dma_unmap_page_attrs(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir, unsigned long attrs);
unsigned int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction dir, unsigned long attrs);
void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction dir,
unsigned long attrs);
int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
enum dma_data_direction dir, unsigned long attrs);
dma_addr_t dma_map_resource(struct device *dev, phys_addr_t phys_addr,
size_t size, enum dma_data_direction dir, unsigned long attrs);
void dma_unmap_resource(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir, unsigned long attrs);
void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
gfp_t flag, unsigned long attrs);
void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_handle, unsigned long attrs);
void *dmam_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
gfp_t gfp, unsigned long attrs);
void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
dma_addr_t dma_handle);
int dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs);
int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs);
bool dma_can_mmap(struct device *dev);
bool dma_pci_p2pdma_supported(struct device *dev);
int dma_set_mask(struct device *dev, u64 mask);
int dma_set_coherent_mask(struct device *dev, u64 mask);
u64 dma_get_required_mask(struct device *dev);
bool dma_addressing_limited(struct device *dev);
size_t dma_max_mapping_size(struct device *dev);
size_t dma_opt_mapping_size(struct device *dev);
unsigned long dma_get_merge_boundary(struct device *dev);
struct sg_table *dma_alloc_noncontiguous(struct device *dev, size_t size,
enum dma_data_direction dir, gfp_t gfp, unsigned long attrs);
void dma_free_noncontiguous(struct device *dev, size_t size,
struct sg_table *sgt, enum dma_data_direction dir);
void *dma_vmap_noncontiguous(struct device *dev, size_t size,
struct sg_table *sgt);
void dma_vunmap_noncontiguous(struct device *dev, void *vaddr);
int dma_mmap_noncontiguous(struct device *dev, struct vm_area_struct *vma,
size_t size, struct sg_table *sgt);
#else /* CONFIG_HAS_DMA */
static inline dma_addr_t dma_map_page_attrs(struct device *dev,
struct page *page, size_t offset, size_t size,
enum dma_data_direction dir, unsigned long attrs)
{
return DMA_MAPPING_ERROR;
}
static inline void dma_unmap_page_attrs(struct device *dev, dma_addr_t addr,
size_t size, enum dma_data_direction dir, unsigned long attrs)
{
}
static inline unsigned int dma_map_sg_attrs(struct device *dev,
struct scatterlist *sg, int nents, enum dma_data_direction dir,
unsigned long attrs)
{
return 0;
}
static inline void dma_unmap_sg_attrs(struct device *dev,
struct scatterlist *sg, int nents, enum dma_data_direction dir,
unsigned long attrs)
{
}
static inline int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
enum dma_data_direction dir, unsigned long attrs)
{
return -EOPNOTSUPP;
}
static inline dma_addr_t dma_map_resource(struct device *dev,
phys_addr_t phys_addr, size_t size, enum dma_data_direction dir,
unsigned long attrs)
{
return DMA_MAPPING_ERROR;
}
static inline void dma_unmap_resource(struct device *dev, dma_addr_t addr,
size_t size, enum dma_data_direction dir, unsigned long attrs)
{
}
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
return -ENOMEM;
}
static inline void *dma_alloc_attrs(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
{
return NULL;
}
static void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_handle, unsigned long attrs)
{
}
static inline void *dmam_alloc_attrs(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
{
return NULL;
}
static inline void dmam_free_coherent(struct device *dev, size_t size,
void *vaddr, dma_addr_t dma_handle)
{
}
static inline int dma_get_sgtable_attrs(struct device *dev,
struct sg_table *sgt, void *cpu_addr, dma_addr_t dma_addr,
size_t size, unsigned long attrs)
{
return -ENXIO;
}
static inline int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs)
{
struct ma_iova_state {
}
static inline bool dma_can_mmap(struct device *dev)
{
return false;
}
static inline bool dma_pci_p2pdma_supported(struct device *dev)
{
return false;
}
static inline int dma_set_mask(struct device *dev, u64 mask)
{
return -EIO;
}
static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
{
return -EIO;
}
static inline u64 dma_get_required_mask(struct device *dev)
{
return 0;
}
static inline bool dma_addressing_limited(struct device *dev)
{
returnfalse;
}
tatic size_t dma_max_mapping_size(struct device*java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
{
return 0;
}
static inline size_t dma_opt_mapping_size(struct device *dev)
{
return 0;
}
static inline unsigned long dma_get_merge_boundary(struct device *dev)
{
return 0;
}
static inline */
size_tsize, enum dma_data_direction dir,gfp_t gfp,
unsigned long attrs)
{
return NULL;
}
static is systems*
struct s(->size );
{
}
tatic d(truct dev, size,
struct sg_table *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
return NULL;
}
static inline void dma_vunmap_noncontiguous(struct device *dev, void *vaddr unsigned long len);
{
}
static inline int dma_mmap_noncontiguous dma_addr
structstatic debug_dma_map_single *,constv addrjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
{java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
return -EINVAL
}
#endif /* CONFIG_HAS_DMA */
#ifdef CONFIG_IOMMU_DMA
/**
* dma_use_iova - check ifjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
* @state: IOVA state
*
* Return %true if }
* they can't be used.
*/
static inline bool dma_use_iova(struct dma_iova_state *state)
{
return s device *dev,struct scatterlist *sg,
}
bool dma_iova_try_alloc(struct device *dev, struct void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
phys_addr_tphys, size_t size);
void dma_iova_free(struct device *java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 31
void dma_iova_destroy(struct device *dev, struct dma_iova_state *state,
enum dma_data_direction dir, unsigned long attrs);
attrs);
int dma_iova_sync(struct device *dev, struct size_t size, enum dma_data_direction dir, unsignedattrs)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
size_t offset, size_t size);
int dma_iova_link(struct enum dma_data_direction dir, unsigned attrs;
phys_addr_t phys, size_t offset, void *dma_alloc_attrs(struct device *dev,size,dma_addr_t *dma_handle,
enum dma_data_direction dir, unsigned long attrs);
void dma_iova_unlink(struct device *dev, struct dma_iova_state *state,
size_t offset, size_t size, enum dma_data_direction dir,
unsigned
#else gfp_t gfp,unsigned long attrs)
java.lang.StringIndexOutOfBoundsException: Range [38, 6) out of bounds for length 61
)
eturnfalsejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
}
static unsigned long attrs);
struct dma_iova_state *stateint dma_mmap_attrs(struct device dev struct vm_area_struct *ma,
{
false;
}
static inline void dma_iova_free(struct device *dev,
struct dma_iova_state *tate)
{
}
static inline void dma_iova_destroy(struct device *dev,
ruct *, ,
(structdev;
{
}
staticdma_max_mapping_size(struct device *dev);
dma_iova_state *tate,size_t offset, size_t size)
{
-OPNOTSUPP;
}
static inline struct sg_table sgt enum dma_data_direction dir);
struct dma_iova_state uous(truct device *dev, size_t size,
size_t size,enum dma_data_direction dir,unsigned long attrs)
{
return -EOPNOTSUPP;
}
static inline void dma_iova_unlink(struct device *dev,
, size_toffset,size_t ,
enum dma_data_direction dir, unsigned long attrs)
{
}
#endif /* CONFIG_IOMMU_DMA */
#if defined java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 51
inlinedma_unmap_page_attrsdevice* ,
enum dma_data_direction dir);
void __ size_t size, enum dma_data_direction dir, unsigned long attrsjava.lang.StringIndexOutOfBoundsException: Range [64, 65) out of bounds for length 64
size_t size, enumdma_data_direction dir);
void __dma_sync_sg_for_cpu(struct device *struct scatterlist *sg, int nents, enum dma_data_direction
int nelems, enum dma_data_direction
void __dma_sync_sg_for_device(struct device}
int nelems,enum dma_data_direction dir)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
ool_dma_need_sync(struct device *dev, dma_addr_t dma_addr);
taticinline bool dma_dev_need_sync(const struct device *dev)
/* Always call DMA sync operations when debugging is enabled */
return java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
}
static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
{
{
if (dma_dev_need_sync(dev))
static void dma_free_attrs(struct device dev size_t size,void*cpu_addr,
}
taticinline void dma_sync_single_for_device(struct device *dev,
dma_addr_t addr,
{
if (dma_dev_need_sync(dev))
_dma_sync_single_for_device(dev, addr, size, dir);
}
static inline void dma_sync_sg_for_cpu(struct java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 1
struct scatterlist *sg, int nelems, enum dma_data_direction void *addr, dma_addr_t dma_handle)
{
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
}
static struct sg_table *sgt, void *cpu_addr, dma_addr_t dma_addr,
struct scatterlist *sg, int nelems, enum dma_data_direction dir)
{ -;
if (dma_dev_need_sync(dev))
__dma_sync_sg_for_device(dev, sg, nelems, dir);
}
static (struct device *ev,dma_addr_t dma_addr)
{
eturn dma_dev_need_sync(dev) ?__ma_need_sync(dev, dma_addr) : false;
}
bool dma_need_unmapreturn -ENXIO;
#else /* !CONFIG_HAS_DMA || !CONFIG_DMA_NEED_SYNC */
static inline bool dma_dev_need_sync(const struct device *ev)
{
return false;
}
static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
size_t dir)
{
}
static inline void dma_sync_single_for_device(struct java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 1
dma_addr_t addr, size_t sizejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
}static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
static inline
struct scatterlist *sg,static inline u64 dma_get_(struct device *dev)
{
}
ine void dma_sync_sg_for_device(struct device *dev,
struct *sg int nelems,enum dma_data_direction dir)
{
}
staticreturn false;
{
return false;
}
static inline bool dma_need_unmap(struct device *dev)
{
return false;
}
#endif /* !CONFIG_HAS_DMA || !CONFIG_DMA_NEED_SYNC */
struct page *dma_alloc_pages(struct device *dev, size_t size,
dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp);
void dma_free_pages(struct device *dev, size_t size, struct page *page,
dma_addr_t dma_handle, enum static inline unsigned long dma_get_merge_boundary(struct device *dev)
int dma_mmap_pages(struct return 0;
size_t sizejava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
static inline void *dma_alloc_noncoherent( ize_t size,enum dma_data_direction dir, gfp_t gfp,
java.lang.StringIndexOutOfBoundsException: Range [22, 12) out of bounds for length 65
{
{
return page ? page_address(page) : NULL return NULL;
}
static inline struct sg_table *sgt, enum dma_data_direction dir)
void *vaddr, dma_addr_t static inline void *dma_vmap_noncontiguous(struct device *dev, size_t size,
{
dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
}
static java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
size_t size,enum dma_data_direction dir, unsigned long attrs)
{
/* DMA must never operate on areas that might be remapped. */
if (dev_WARN_ONCE(static inline int dma_mmap_noncontiguous(struct device dev
rejectingDMAmap vmalloc memory\")
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
return dma_map_page_attrs
size,dir attrs);
}
static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,
size_t size, enum java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
{
return dma_unmap_page_attrs(dev, addr, size, dir, attrs);
}
static dma_sync_single_range_for_cpu(struct device *dev,
dma_addr_t addr, unsigned long java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 1
enum dma_data_direction dir)
{
return dma_sync_single_for_cpu(dev, addr + java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 33
}
staticvoid(struct device *dev,struct dma_iova_state *state,
dma_addr_t addr, unsigned long offset size_t mapped_len, enum dma_data_direction dir,
enum dma_data_direction dir)
{
return dma_sync_single_for_device(dev, addr + offset, size, dir)i dma_iova_link(struct device *dev, struct dma_iova_state *state,
}
/**
* dma_unmap_sgtable - enum dma_data_direction dir, unsigned long attrs);
forwhich to perform the DMA operation
* @sgt: The sg_table size_t offset,size_t size, enum dma_data_direction dir,
*@ir direction
trs: DMA the
*
* Unmaps a buffer return ;
* object static inlinebool ( dev,
* the ownership of the buffer struct state phys, size)
*/
static java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
enum dir,unsignedlong attrs)
{
dma_unmap_sg_attrs(dev,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
/**
* enum dma_data_direction dir, unsigned long attrs)
* @dev: The device for }
sgt:The object describingthe buffer
dir:DMAdirection
*
* return -EOPNOTSUPP;
* buffer back to thejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* struct dma_iova_state *state, phys_addr_t phys, size_t offset,
size_t size, enum dma_data_direction dir, unsigned long attrs)
* dma_sync_sgtable_for_device().
*/
staticinline void dma_iova_unlink(truct device *dev,
struct java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
{
dma_sync_sg_for_cpu#if defined(CONFIG_HAS_DMA)&& defined(ONFIG_DMA_NEED_SYNC)
}
/**
* num dma_data_direction dir);
* @dev: The device void __dma_sync_single_for_device_dma_sync_single_for_device(struct device *dev, dma_addr_t addr,
: The sg_table object describing the buffer
* @dir: DMA direction
*
* Performs the needed cache synchronization and int nelems, enum dma_data_direction dir);
* back to the DMA domain,soitis to perform the DMA operation.
Once finished,one tocall dma_sync_sgtable_for_cpu() or
* dma_unmap_sgtable().
*/
static inline void dma_sync_sgtable_for_device(struct java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
struct sg_table *sgt, enum dma_data_direction dir)
{
dma_sync_sg_for_device(dev, sgt->sgl, sgt->orig_nents, dir);
}
#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, 0)
#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, 0)
#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, 0)
#define dma_map_page(d, p, o, s, r) dma_map_page_attrs(d, p, o, s, r, 0)
#define dma_unmap_page(d, a, s, r) /* Always call DMA sync operations when debugging is enabled */
define dma_get_sgtable(d,t, v h,s) dma_get_sgtable_attrs(d, t, v, h, s, 0)
#define dma_mmap_coherent(d, v, c, h, s) java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 1
bool dma_coherent_ok(struct device *dev, phys_addr_t phys, java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 43
static if (dma_dev_need_sync(dev))
dma_addr_t *dma_handle, gfp_t gfp)
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
return dma_sync_single_for_device(struct device *dev,
(gfp & __GFP_NOWARN) dma_addr_t addr, size_t size,enum dma_data_direction dir)
}
static inline void dma_free_coherent(struct device *dev, size_t size,
void dma_handle)
{
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
}
static inline u64 dma_get_mask(struct device *ev
{
if(dma_dev_need_sync(dev))
return *dev->dma_mask;
);
}
/*
* Set both the DMA mask and the struct scatterlist *sg, int nelems, scatterlist *sg, int nelems, enum dma_data_direction dir)
if (ma_dev_need_sync(dev))
* as the DMA API guarantees that _dma_sync_sg_for_device(dev, sg, nelems, dir);
*}
*/
static inlinebool dma_need_sync(truct device *dev, dma_addr_t dma_addr)
{
returndma_dev_need_sync(dev) ? __dma_need_sync(dev, dma_addr) : false;
if (rc == 0)
dma_set_coherent_mask(dev, mask);
return rc;
}
/*
ealswith the case where the device
* does not have dev->dma_mask java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 1
*/
static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
{
dev-dma_mask = &dev->coherent_dma_mask;
return dma_set_mask_and_coherent(dev, mask);
}
static inline unsigned int dma_get_max_seg_size(struct device dma_addr_t addr, size_t size, enum dma_data_direction dir)
{
if (static inline void dma_sync_sg_for_cpu(struct device *dev,
return dev->dma_parms->max_segment_size;
return SZ_64K;
}
taticinline void dma_set_max_seg_size(struct device *dev, unsigned int size)
{
if (WARN_ON_ONCE(}
static in voiddma_sync_sg_for_device(struct device *dev,
dev->dma_parms struct scatterlist *sg, int nelems, enum dma_data_direction dir)
}
static long dma_get_seg_boundary(struct device *dev)
{
if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return ev>dma_parms->egment_boundary_mask;
return ULONG_MAX;
}
/**
* #ndif /* !CONFIG_HAS_DMA || !CONFIG_DMA_NEED_SYNC */
* @dev: device to guerystruct page dma_alloc_pages(struct device *dev, size_t size,
@age_shift: ilog() of the IOMMU page size
*
IOMMU page units (which may be different from
* the CPU page size) for the passed in dma_addr_t dma_handle, enum dma_data_direction dir);
*
If NULL U32_MAXis ,this caseisjust
*non-API callersjava.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
/
static inline unsigned long dma_get_seg_boundary_nr_pages(struct device *dev,
unsigned int page_shift)
{
if (!dev)
return ( return page?page_address(page) : NULL;
return (dma_get_seg_boundary(dev) >> page_shiftjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
static void *vaddr dma_addr_t dma_handle, enum dma_data_direction dir)
{
if (WARN_ON_ONCE(!dev->dma_free_pages(dev, size, virt_to_(addr,dma_handle,dir;
return;
dev->dma_parms- dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
}
static inline unsigned int dma_get_min_align_mask(struct device *java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 1
{
(ev-dma_parms)
rejecting DMAmap of memory\")
return 0;
}
static inline void dma_set_min_align_maskreturn dma_map_page_attrs(ev,()offset_in_pageptr,
size, dir,attrs);
{
if (WARN_ON_ONCE(!dev->dma_parmsstatic void( *, addrjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
return;
dev->java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
}
#ifndef }
static inline int dma_get_cache_alignment
{
#ifdef ARCH_HAS_DMA_MINALIGN
return ARCH_DMA_MINALIGN;
#endif
return 1;
}
#endif
static enum dma_data_directiondir unsigned long attrs)
dma_addr_t *dma_handle,{
{
return dmam_alloc_attrs(dev,size dma_handle, gfp,
(gfp & __GFP_NOWARN) ? DMA_ATTR_NO_WARN : 0);
}
static inline void *dma_alloc_wc(struct java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 3
dma_addr_t *dma_addr,gfp_t gfp)
{
unsigned long attrs = DMA_ATTR_WRITE_COMBINE;
if (gfp & __GFP_NOWARN)
attrs |= DMA_ATTR_NO_WARN;
return dma_alloc_attrs(dev, size, dma_addr, gfp, attrs);
}
static inline void dma_free_wc(struct device *dev, size_t size,
* @sgt: The sobject describing buffer
{
eturn dma_free_attrs(dev, size, cpu_addr, dma_addr,
DMA_ATTR_WRITE_COMBINE);
}
taticinline intdma_mmap_wc(struct device *dev,
struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr,
size_t size buffer back to the CPU domain, so it is safe to perform any access by the CPU.Before doing any further operations,onehas transfer
{
return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size,
DMA_ATTR_WRITE_COMBINE);
}
#ifdef CONFIG_NEED_DMA_MAP_STATE
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
#define dma_unmap_addr(static inlinevoiddma_sync_sgtable_for_cpustruct devjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 1
definedma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
#define dma_unmap_len_set(PTR, LEN_NAME, VAL}
#else
#/
java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
#define dma_unmap_addr(PTR, ADDR_NAME) \
({ typeof(PTR) _* dev The device forto theDMA
#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) \
do typeof(PTR) _p _maybe_unused = PTR; } while (0)
#define dma_unmap_len(PTR, LEN_NAME) \
({ typeof(PTR) __p __maybe_unused
#define dma_unmap_len_set(PTRjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
do ()_p _maybe_unused PTR }while ()
#endif
#endif /* _LINUX_DMA_MAPPING_H */
¤ Dauer der Verarbeitung: 0.14 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|