linux-4.4.1/dma_init_coherent_memory()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#w7d8167a]
#backlinks
*説明 [#abfb73f8]
-パス: [[linux-4.4.1/drivers/base/dma-coherent.c]]
-FIXME: これは何?
--説明
**引数 [#e84d902f]
-phys_addr_t phys_addr
--
--[[linux-4.4.1/phys_addr_t]]
-dma_addr_t device_addr
--
--[[linux-4.4.1/dma_addr_t]]
-size_t size
--
-int flags
--
-struct dma_coherent_mem **mem
--
--[[linux-4.4.1/dma_coherent_mem]]
**返り値 [#o9cd045e]
-int
--
**参考 [#h296e7af]
*実装 [#zf210d31]
static int dma_init_coherent_memory(phys_addr_t phys_add...
size_t size, int flags,
struct dma_coherent_mem **m...
{
struct dma_coherent_mem *dma_mem = NULL;
void __iomem *mem_base = NULL;
int pages = size >> PAGE_SHIFT;
int bitmap_size = BITS_TO_LONGS(pages) * sizeof(...
-
--[[linux-4.4.1/dma_coherent_mem]]
--[[linux-4.4.1/__iomem]]
--[[linux-4.4.1/PAGE_SHIFT]]
--[[linux-4.4.1/BITS_TO_LONGS()]]
if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) =...
goto out;
if (!size)
goto out;
mem_base = ioremap(phys_addr, size);
if (!mem_base)
goto out;
-
--[[linux-4.4.1/ioremap()]]
dma_mem = kzalloc(sizeof(struct dma_coherent_mem...
if (!dma_mem)
goto out;
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/dma_coherent_mem]]
dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNE...
if (!dma_mem->bitmap)
goto out;
dma_mem->virt_base = mem_base;
dma_mem->device_base = device_addr;
dma_mem->pfn_base = PFN_DOWN(phys_addr);
dma_mem->size = pages;
dma_mem->flags = flags;
spin_lock_init(&dma_mem->spinlock);
-
--[[linux-4.4.1/PFN_DOWN()]]
--[[linux-4.4.1/spin_lock_init()]]
*mem = dma_mem;
if (flags & DMA_MEMORY_MAP)
return DMA_MEMORY_MAP;
return DMA_MEMORY_IO;
out:
kfree(dma_mem);
if (mem_base)
iounmap(mem_base);
-
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/iounmap()]]
return 0;
}
*コメント [#v7dbd3a2]
終了行:
*参照元 [#w7d8167a]
#backlinks
*説明 [#abfb73f8]
-パス: [[linux-4.4.1/drivers/base/dma-coherent.c]]
-FIXME: これは何?
--説明
**引数 [#e84d902f]
-phys_addr_t phys_addr
--
--[[linux-4.4.1/phys_addr_t]]
-dma_addr_t device_addr
--
--[[linux-4.4.1/dma_addr_t]]
-size_t size
--
-int flags
--
-struct dma_coherent_mem **mem
--
--[[linux-4.4.1/dma_coherent_mem]]
**返り値 [#o9cd045e]
-int
--
**参考 [#h296e7af]
*実装 [#zf210d31]
static int dma_init_coherent_memory(phys_addr_t phys_add...
size_t size, int flags,
struct dma_coherent_mem **m...
{
struct dma_coherent_mem *dma_mem = NULL;
void __iomem *mem_base = NULL;
int pages = size >> PAGE_SHIFT;
int bitmap_size = BITS_TO_LONGS(pages) * sizeof(...
-
--[[linux-4.4.1/dma_coherent_mem]]
--[[linux-4.4.1/__iomem]]
--[[linux-4.4.1/PAGE_SHIFT]]
--[[linux-4.4.1/BITS_TO_LONGS()]]
if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) =...
goto out;
if (!size)
goto out;
mem_base = ioremap(phys_addr, size);
if (!mem_base)
goto out;
-
--[[linux-4.4.1/ioremap()]]
dma_mem = kzalloc(sizeof(struct dma_coherent_mem...
if (!dma_mem)
goto out;
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/dma_coherent_mem]]
dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNE...
if (!dma_mem->bitmap)
goto out;
dma_mem->virt_base = mem_base;
dma_mem->device_base = device_addr;
dma_mem->pfn_base = PFN_DOWN(phys_addr);
dma_mem->size = pages;
dma_mem->flags = flags;
spin_lock_init(&dma_mem->spinlock);
-
--[[linux-4.4.1/PFN_DOWN()]]
--[[linux-4.4.1/spin_lock_init()]]
*mem = dma_mem;
if (flags & DMA_MEMORY_MAP)
return DMA_MEMORY_MAP;
return DMA_MEMORY_IO;
out:
kfree(dma_mem);
if (mem_base)
iounmap(mem_base);
-
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/iounmap()]]
return 0;
}
*コメント [#v7dbd3a2]
ページ名: