*参照元 [#of70a3b1]
#backlinks

*説明 [#t5d7ba20]
-パス: [[linux-4.4.1/drivers/staging/android/ion/ion_carveout_heap.c]]

-FIXME: これは何?
--説明


**引数 [#me815f29]
-struct ion_platform_heap *heap_data
--
--[[linux-4.4.1/ion_platform_heap]]


**返り値 [#o6c51a10]
-struct ion_heap *
--
--[[linux-4.4.1/ion_heap]]


**参考 [#uf3ec923]


*実装 [#v069d91e]
 struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
 {
         struct ion_carveout_heap *carveout_heap;
         int ret;
 
-
--[[linux-4.4.1/ion_carveout_heap]]

         struct page *page;
         size_t size;
 
-
--[[linux-4.4.1/page]]

         page = pfn_to_page(PFN_DOWN(heap_data->base));
         size = heap_data->size;
 
-
--[[linux-4.4.1/pfn_to_page()]]
--[[linux-4.4.1/PFN_DOWN()]]

         ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL);
 
-
--[[linux-4.4.1/ion_pages_sync_for_device()]]
--[[linux-4.4.1/DMA_BIDIRECTIONAL]]

         ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL));
         if (ret)
                 return ERR_PTR(ret);
 
-
--[[linux-4.4.1/ion_heap_pages_zero()]]
--[[linux-4.4.1/pgprot_writecombine()]]
--[[linux-4.4.1/PAGE_KERNEL]]
--[[linux-4.4.1/ERR_PTR()]]

         carveout_heap = kzalloc(sizeof(struct ion_carveout_heap), GFP_KERNEL);
         if (!carveout_heap)
                 return ERR_PTR(-ENOMEM);
 
-
--[[linux-4.4.1/kzalloc()]]

         carveout_heap->pool = gen_pool_create(12, -1);
         if (!carveout_heap->pool) {
                 kfree(carveout_heap);
                 return ERR_PTR(-ENOMEM);
         }
-
--[[linux-4.4.1/gen_pool_create()]]
--[[linux-4.4.1/kfree()]]

         carveout_heap->base = heap_data->base;
         gen_pool_add(carveout_heap->pool, carveout_heap->base, heap_data->size,
                      -1);
-
--[[linux-4.4.1/gen_pool_add()]]

         carveout_heap->heap.ops = &carveout_heap_ops;
         carveout_heap->heap.type = ION_HEAP_TYPE_CARVEOUT;
         carveout_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
 
-
--[[linux-4.4.1/carveout_heap_ops(global)]]
--[[linux-4.4.1/ion_heap_type]]
--[[linux-4.4.1/ION_HEAP_FLAG_DEFER_FREE]]

         return &carveout_heap->heap;
 }


*コメント [#sdbf6b6a]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS