gpu: ion: Refactor platform data
Refactor platform data to allow for better expansion in the future. Add void * for elements unique to each heap type. Change-Id: I435679819c67ce917b5798009eff7e71047fd2ea Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> [sboyd: drop board file changes] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
committed by
Stephen Boyd
parent
900908129a
commit
02d86ef9d7
@@ -417,13 +417,20 @@ struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
|
||||
carveout_heap->heap.type = ION_HEAP_TYPE_CARVEOUT;
|
||||
carveout_heap->allocated_bytes = 0;
|
||||
carveout_heap->total_size = heap_data->size;
|
||||
if (heap_data->setup_region)
|
||||
carveout_heap->bus_id = heap_data->setup_region();
|
||||
if (heap_data->request_region)
|
||||
carveout_heap->request_region = heap_data->request_region;
|
||||
if (heap_data->release_region)
|
||||
carveout_heap->release_region = heap_data->release_region;
|
||||
|
||||
if (heap_data->extra_data) {
|
||||
struct ion_co_heap_pdata *extra_data =
|
||||
heap_data->extra_data;
|
||||
|
||||
if (extra_data->setup_region)
|
||||
carveout_heap->bus_id = extra_data->setup_region();
|
||||
if (extra_data->request_region)
|
||||
carveout_heap->request_region =
|
||||
extra_data->request_region;
|
||||
if (extra_data->release_region)
|
||||
carveout_heap->release_region =
|
||||
extra_data->release_region;
|
||||
}
|
||||
return &carveout_heap->heap;
|
||||
}
|
||||
|
||||
|
||||
@@ -623,7 +623,6 @@ struct ion_heap *ion_cp_heap_create(struct ion_platform_heap *heap_data)
|
||||
if (ret < 0)
|
||||
goto destroy_pool;
|
||||
|
||||
cp_heap->permission_type = heap_data->permission_type;
|
||||
cp_heap->allocated_bytes = 0;
|
||||
cp_heap->alloc_count = 0;
|
||||
cp_heap->umap_count = 0;
|
||||
@@ -632,13 +631,17 @@ struct ion_heap *ion_cp_heap_create(struct ion_platform_heap *heap_data)
|
||||
cp_heap->heap.ops = &cp_heap_ops;
|
||||
cp_heap->heap.type = ION_HEAP_TYPE_CP;
|
||||
cp_heap->heap_secured = NON_SECURED_HEAP;
|
||||
if (heap_data->setup_region)
|
||||
cp_heap->bus_id = heap_data->setup_region();
|
||||
if (heap_data->request_region)
|
||||
cp_heap->request_region = heap_data->request_region;
|
||||
if (heap_data->release_region)
|
||||
cp_heap->release_region = heap_data->release_region;
|
||||
|
||||
if (heap_data->extra_data) {
|
||||
struct ion_cp_heap_pdata *extra_data =
|
||||
heap_data->extra_data;
|
||||
cp_heap->permission_type = extra_data->permission_type;
|
||||
if (extra_data->setup_region)
|
||||
cp_heap->bus_id = extra_data->setup_region();
|
||||
if (extra_data->request_region)
|
||||
cp_heap->request_region = extra_data->request_region;
|
||||
if (extra_data->release_region)
|
||||
cp_heap->release_region = extra_data->release_region;
|
||||
}
|
||||
return &cp_heap->heap;
|
||||
|
||||
destroy_pool:
|
||||
|
||||
@@ -143,12 +143,22 @@ struct ion_platform_heap {
|
||||
ion_phys_addr_t base;
|
||||
size_t size;
|
||||
enum ion_memory_types memory_type;
|
||||
void *extra_data;
|
||||
};
|
||||
|
||||
struct ion_cp_heap_pdata {
|
||||
enum ion_permission_type permission_type;
|
||||
int (*request_region)(void *);
|
||||
int (*release_region)(void *);
|
||||
void *(*setup_region)(void);
|
||||
};
|
||||
|
||||
struct ion_co_heap_pdata {
|
||||
int (*request_region)(void *);
|
||||
int (*release_region)(void *);
|
||||
void *(*setup_region)(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ion_platform_data - array of platform heaps passed from board file
|
||||
* @nr: number of structures in the array
|
||||
|
||||
Reference in New Issue
Block a user