linux-4.4.1/ion_heap_map_kernel()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#nf6e140c]
#backlinks
*説明 [#t05467ca]
-パス: [[linux-4.4.1/drivers/staging/android/ion/ion_heap...
-FIXME: これは何?
--説明
**引数 [#r2d5f0f8]
-struct ion_heap *heap
--
--[[linux-4.4.1/ion_heap]]
-struct ion_buffer *buffer
--
--[[linux-4.4.1/ion_buffer]]
**返り値 [#dc871c4d]
-void *
--
**参考 [#ta113385]
*実装 [#ufa8a7d2]
void *ion_heap_map_kernel(struct ion_heap *heap,
struct ion_buffer *buffer)
{
struct scatterlist *sg;
int i, j;
void *vaddr;
pgprot_t pgprot;
struct sg_table *table = buffer->sg_table;
int npages = PAGE_ALIGN(buffer->size) / PAGE_SIZE;
struct page **pages = vmalloc(sizeof(struct page...
struct page **tmp = pages;
-
--[[linux-4.4.1/scatterlist]]
--[[linux-4.4.1/pgprot_t]]
--[[linux-4.4.1/sg_table]]
--[[linux-4.4.1/PAGE_ALIGN()]]
--[[linux-4.4.1/PAGE_SIZE]]
--[[linux-4.4.1/page]]
--[[linux-4.4.1/vmalloc()]]
if (!pages)
return NULL;
if (buffer->flags & ION_FLAG_CACHED)
pgprot = PAGE_KERNEL;
else
pgprot = pgprot_writecombine(PAGE_KERNEL);
-
--[[linux-4.4.1/PAGE_KERNEL]]
--[[linux-4.4.1/ION_FLAG_CACHED]]
--[[linux-4.4.1/pgprot_writecombine()]]
for_each_sg(table->sgl, sg, table->nents, i) {
int npages_this_entry = PAGE_ALIGN(sg->l...
struct page *page = sg_page(sg);
-
--[[linux-4.4.1/for_each_sg()]]
--[[linux-4.4.1/sg_page()]]
BUG_ON(i >= npages);
for (j = 0; j < npages_this_entry; j++)
*(tmp++) = page++;
-
--[[linux-4.4.1/BUG_ON()]]
}
vaddr = vmap(pages, npages, VM_MAP, pgprot);
vfree(pages);
-
--[[linux-4.4.1/vmap()]]
--[[linux-4.4.1/vfree()]]
if (!vaddr)
return ERR_PTR(-ENOMEM);
-
--[[linux-4.4.1/ERR_PTR()]]
return vaddr;
}
*コメント [#c8f24fbf]
終了行:
*参照元 [#nf6e140c]
#backlinks
*説明 [#t05467ca]
-パス: [[linux-4.4.1/drivers/staging/android/ion/ion_heap...
-FIXME: これは何?
--説明
**引数 [#r2d5f0f8]
-struct ion_heap *heap
--
--[[linux-4.4.1/ion_heap]]
-struct ion_buffer *buffer
--
--[[linux-4.4.1/ion_buffer]]
**返り値 [#dc871c4d]
-void *
--
**参考 [#ta113385]
*実装 [#ufa8a7d2]
void *ion_heap_map_kernel(struct ion_heap *heap,
struct ion_buffer *buffer)
{
struct scatterlist *sg;
int i, j;
void *vaddr;
pgprot_t pgprot;
struct sg_table *table = buffer->sg_table;
int npages = PAGE_ALIGN(buffer->size) / PAGE_SIZE;
struct page **pages = vmalloc(sizeof(struct page...
struct page **tmp = pages;
-
--[[linux-4.4.1/scatterlist]]
--[[linux-4.4.1/pgprot_t]]
--[[linux-4.4.1/sg_table]]
--[[linux-4.4.1/PAGE_ALIGN()]]
--[[linux-4.4.1/PAGE_SIZE]]
--[[linux-4.4.1/page]]
--[[linux-4.4.1/vmalloc()]]
if (!pages)
return NULL;
if (buffer->flags & ION_FLAG_CACHED)
pgprot = PAGE_KERNEL;
else
pgprot = pgprot_writecombine(PAGE_KERNEL);
-
--[[linux-4.4.1/PAGE_KERNEL]]
--[[linux-4.4.1/ION_FLAG_CACHED]]
--[[linux-4.4.1/pgprot_writecombine()]]
for_each_sg(table->sgl, sg, table->nents, i) {
int npages_this_entry = PAGE_ALIGN(sg->l...
struct page *page = sg_page(sg);
-
--[[linux-4.4.1/for_each_sg()]]
--[[linux-4.4.1/sg_page()]]
BUG_ON(i >= npages);
for (j = 0; j < npages_this_entry; j++)
*(tmp++) = page++;
-
--[[linux-4.4.1/BUG_ON()]]
}
vaddr = vmap(pages, npages, VM_MAP, pgprot);
vfree(pages);
-
--[[linux-4.4.1/vmap()]]
--[[linux-4.4.1/vfree()]]
if (!vaddr)
return ERR_PTR(-ENOMEM);
-
--[[linux-4.4.1/ERR_PTR()]]
return vaddr;
}
*コメント [#c8f24fbf]
ページ名: