summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohan Mossberg <johan.xx.mossberg@stericsson.com>2011-04-12 10:58:48 +0200
committerPhilippe Langlais <philippe.langlais@linaro.org>2011-07-22 15:45:39 +0200
commit53cf232a11b8acd0685ec39fc338bf5db9926af0 (patch)
tree26eef727e2a3b2cb6573c2c0b8b81834f2b6aa8a /include
parent852f219d37897ad6e57905d87aaa0ed8f945b6cd (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')
-rw-r--r--include/linux/hwmem.h22
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_ */