Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\dma\coherent.c Create Date:2022-07-28 10:33:46
Last Modify:2020-03-17 14:54:14 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:dma_init_coherent_memory

Proto:static int dma_init_coherent_memory(phys_addr_t phys_addr, dma_addr_t device_addr, size_t size, struct dma_coherent_mem **mem)

Type:int

Parameter:

TypeParameterName
phys_addr_tphys_addr
dma_addr_tdevice_addr
size_tsize
struct dma_coherent_mem **mem
44  struct dma_coherent_mem * dma_mem = NULL
45  void * mem_base = NULL
46  pages = size >> PAGE_SHIFT determines the page size
47  bitmap_size = BITS_TO_LONGS(pages) * sizeof(long)
50  If Not size Then
51  ret = -EINVAL
52  Go to out
55  mem_base = memremap() - remap an iomem_resource as cacheable memory*@offset: iomem resource start address*@size: size of remap*@flags: any of MEMREMAP_WB, MEMREMAP_WT, MEMREMAP_WC,* MEMREMAP_ENC, MEMREMAP_DEC* memremap() is "ioremap" for cases where it is known that
56  If Not mem_base Then
57  ret = -EINVAL
58  Go to out
60  dma_mem = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
61  If Not dma_mem Then
62  ret = -ENOMEM
63  Go to out
65  bitmap = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
66  If Not bitmap Then
67  ret = -ENOMEM
68  Go to out
71  virt_base = mem_base
72  device_base = device_addr
73  pfn_base = PFN_DOWN(phys_addr)
74  size = pages
75  Process spin lock initialization( & spinlock)
77  mem = dma_mem
78  Return 0
80  out :
81  kfree(dma_mem)
82  If mem_base Then memunmap(mem_base)
84  Return ret
Caller
NameDescribe
dma_declare_coherent_memory