diff options
author | Johan Mossberg <johan.xx.mossberg@stericsson.com> | 2011-04-12 10:58:48 +0200 |
---|---|---|
committer | Henrik Aberg <henrik.aberg@stericsson.com> | 2011-05-18 09:40:09 +0200 |
commit | 4b30876875b6425fa1c74957783a54a66c849632 (patch) | |
tree | 474eebfbb9137a9298d6305adf228b72b8da6d9c /include/linux | |
parent | 7f7e2a42594cb10210c491788ec6afe5157e4237 (diff) |
HWMEM: Break out allocator
Break out allocator in order to be able to run it in multiple instances
ie support multiple regions. Multiple regions can be used to battle
fragmentation by letting clients allocating in a non fragmenting way
allocate from their own region. For STE this will probably mean letting
camera/video have their own region. A positive side effect is that we
can use HWMEM as an allocator for SRAM if we want to.
ST-Ericsson ID: 334992
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10068
Change-Id: I449f2dde8f1ceeb05dd55384dd4070e91997276f
Signed-off-by: Johan Mossberg <johan.xx.mossberg@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/20638
Reviewed-by: QATEST
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/hwmem.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/include/linux/hwmem.h b/include/linux/hwmem.h index a2eb91d9d9a..ba4c116f4b9 100644 --- a/include/linux/hwmem.h +++ b/include/linux/hwmem.h @@ -569,15 +569,25 @@ s32 hwmem_get_name(struct hwmem_alloc *alloc); */ struct hwmem_alloc *hwmem_resolve_by_name(s32 name); -/* Internal */ +/* Integration */ + +struct hwmem_allocator_api { + void *(*alloc)(void *instance, size_t size); + void (*free)(void *instance, void *alloc); + phys_addr_t (*get_alloc_paddr)(void *alloc); + void *(*get_alloc_kaddr)(void *instance, void *alloc); + size_t (*get_alloc_size)(void *alloc); +}; -struct hwmem_platform_data { - /* Physical address of memory region */ - u32 start; - /* Size of memory region */ - u32 size; +struct hwmem_mem_type_struct { + enum hwmem_mem_type id; + struct hwmem_allocator_api allocator_api; + void *allocator_instance; }; +extern struct hwmem_mem_type_struct *hwmem_mem_types; +extern unsigned int hwmem_num_mem_types; + #endif #endif /* _HWMEM_H_ */ |