linux-4.4.1/ion_cma_allocate()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#ke80853a]
#backlinks
*説明 [#f1caced6]
-パス: [[linux-4.4.1/drivers/staging/android/ion/ion_cma_...
-FIXME: これは何?
--説明
--dma_alloc_coherent() がメモリを確保する
**引数 [#b8c93305]
-struct ion_heap *heap
--
--[[linux-4.4.1/ion_heap]]
-struct ion_buffer *buffer
--
--[[linux-4.4.1/ion_buffer]]
-unsigned long len
--割り当てる領域の大きさ
-unsigned long align
--アラインメント、4096 まで
-unsigned long flags
--割り当てる領域の属性フラグ
--ION_FLAG_XXX を OR で指定
**返り値 [#dd184e5f]
-int
--成功なら 0、失敗なら ION_CMA_ALLOCATE_FAILED
**参考 [#rc834b84]
*実装 [#n977d501]
/* ION CMA heap operations functions */
static int ion_cma_allocate(struct ion_heap *heap, struc...
unsigned long len, unsigned ...
unsigned long flags)
{
struct ion_cma_heap *cma_heap = to_cma_heap(heap);
struct device *dev = cma_heap->dev;
struct ion_cma_buffer_info *info;
-
--[[linux-4.4.1/ion_cma_heap]]
--[[linux-4.4.1/to_cma_heap()]]
--[[linux-4.4.1/device]]
--[[linux-4.4.1/ion_cma_buffer_info]]
dev_dbg(dev, "Request buffer allocation len %ld\...
-
--[[linux-4.4.1/dev_dbg()]]
if (buffer->flags & ION_FLAG_CACHED)
return -EINVAL;
if (align > PAGE_SIZE)
return -EINVAL;
info = kzalloc(sizeof(struct ion_cma_buffer_info...
if (!info)
return ION_CMA_ALLOCATE_FAILED;
-
--[[linux-4.4.1/kzalloc()]]
info->cpu_addr = dma_alloc_coherent(dev, len, &(...
GFP_HIGH...
if (!info->cpu_addr) {
dev_err(dev, "Fail to allocate buffer\n");
goto err;
}
-
--[[linux-4.4.1/dma_alloc_coherent()]]
--[[linux-4.4.1/dev_err()]]
info->table = kmalloc(sizeof(struct sg_table), G...
if (!info->table)
goto free_mem;
-
--[[linux-4.4.1/kmalloc()]]
--[[linux-4.4.1/sg_table]]
if (dma_get_sgtable(dev, info->table, info->cpu_...
len))
goto free_table;
-
--[[linux-4.4.1/dma_get_sgtable()]]
/* keep this for memory release */
buffer->priv_virt = info;
dev_dbg(dev, "Allocate buffer %p\n", buffer);
return 0;
free_table:
kfree(info->table);
-
--[[linux-4.4.1/kfree()]]
free_mem:
dma_free_coherent(dev, len, info->cpu_addr, info...
-
--[[linux-4.4.1/dma_free_coherent()]]
err:
kfree(info);
return ION_CMA_ALLOCATE_FAILED;
}
*コメント [#i1e16b2b]
終了行:
*参照元 [#ke80853a]
#backlinks
*説明 [#f1caced6]
-パス: [[linux-4.4.1/drivers/staging/android/ion/ion_cma_...
-FIXME: これは何?
--説明
--dma_alloc_coherent() がメモリを確保する
**引数 [#b8c93305]
-struct ion_heap *heap
--
--[[linux-4.4.1/ion_heap]]
-struct ion_buffer *buffer
--
--[[linux-4.4.1/ion_buffer]]
-unsigned long len
--割り当てる領域の大きさ
-unsigned long align
--アラインメント、4096 まで
-unsigned long flags
--割り当てる領域の属性フラグ
--ION_FLAG_XXX を OR で指定
**返り値 [#dd184e5f]
-int
--成功なら 0、失敗なら ION_CMA_ALLOCATE_FAILED
**参考 [#rc834b84]
*実装 [#n977d501]
/* ION CMA heap operations functions */
static int ion_cma_allocate(struct ion_heap *heap, struc...
unsigned long len, unsigned ...
unsigned long flags)
{
struct ion_cma_heap *cma_heap = to_cma_heap(heap);
struct device *dev = cma_heap->dev;
struct ion_cma_buffer_info *info;
-
--[[linux-4.4.1/ion_cma_heap]]
--[[linux-4.4.1/to_cma_heap()]]
--[[linux-4.4.1/device]]
--[[linux-4.4.1/ion_cma_buffer_info]]
dev_dbg(dev, "Request buffer allocation len %ld\...
-
--[[linux-4.4.1/dev_dbg()]]
if (buffer->flags & ION_FLAG_CACHED)
return -EINVAL;
if (align > PAGE_SIZE)
return -EINVAL;
info = kzalloc(sizeof(struct ion_cma_buffer_info...
if (!info)
return ION_CMA_ALLOCATE_FAILED;
-
--[[linux-4.4.1/kzalloc()]]
info->cpu_addr = dma_alloc_coherent(dev, len, &(...
GFP_HIGH...
if (!info->cpu_addr) {
dev_err(dev, "Fail to allocate buffer\n");
goto err;
}
-
--[[linux-4.4.1/dma_alloc_coherent()]]
--[[linux-4.4.1/dev_err()]]
info->table = kmalloc(sizeof(struct sg_table), G...
if (!info->table)
goto free_mem;
-
--[[linux-4.4.1/kmalloc()]]
--[[linux-4.4.1/sg_table]]
if (dma_get_sgtable(dev, info->table, info->cpu_...
len))
goto free_table;
-
--[[linux-4.4.1/dma_get_sgtable()]]
/* keep this for memory release */
buffer->priv_virt = info;
dev_dbg(dev, "Allocate buffer %p\n", buffer);
return 0;
free_table:
kfree(info->table);
-
--[[linux-4.4.1/kfree()]]
free_mem:
dma_free_coherent(dev, len, info->cpu_addr, info...
-
--[[linux-4.4.1/dma_free_coherent()]]
err:
kfree(info);
return ION_CMA_ALLOCATE_FAILED;
}
*コメント [#i1e16b2b]
ページ名: