summaryrefslogtreecommitdiff
path: root/bmm_lib.h
diff options
context:
space:
mode:
authorRussell King <rmk+cubox@arm.linux.org.uk>2013-12-08 21:29:56 +0000
committerRussell King <rmk@arm.linux.org.uk>2013-12-08 22:02:42 +0000
commit6f2e8ec4c736fbffe3d0e0f1ec07f453910441a1 (patch)
tree3adfc685d5addab0a3d7a609a0d620b0046a6bee /bmm_lib.h
parentdcad449e26e81b71e4a498dc5bfaf014a5566acd (diff)
BMMv2: dma_buf based BMMHEADv2.0.0master
This is a complete redesign and rewrite of libbmm. This implementation is based upon dma_bufs - where a dma_buf is a kernel-side buffer which can be passed to and from other subsystems. libbmm becomes a provider of dma_bufs - it permits userspace to allocate such things. When a dma_buf is allocated, userspace is handed a file descriptor which is unique to this buffer. This file descriptor can then be passed into other subsystems, which can then request access to this buffer. The file descriptor supports very few operations - it can be mmap()d to provide userspace access to the buffer, and it can be closed when it is no longer required. Internally in the kernel, dma_bufs are reference counted, so the dma_buf will only be freed when the last user gives up its reference.
Diffstat (limited to 'bmm_lib.h')
-rw-r--r--bmm_lib.h28
1 files changed, 7 insertions, 21 deletions
diff --git a/bmm_lib.h b/bmm_lib.h
index 09348ef..a381f25 100644
--- a/bmm_lib.h
+++ b/bmm_lib.h
@@ -40,27 +40,13 @@ extern "C" {
int bmm_init(void);
void bmm_exit(void);
-void *bmm_malloc(unsigned long size, int attr);
-void *bmm_malloc_aligned(unsigned long size, int attr, unsigned align);
-void *bmm_malloc_aligned_phys(unsigned long size, int attr, unsigned align,
- unsigned long *paddr);
-void bmm_free(void *vaddr);
-void *bmm_attach(unsigned long paddr, unsigned long len);
-void bmm_detach(void *vaddr, unsigned long len);
-void *bmm_get_vaddr(unsigned long paddr);
-unsigned long bmm_get_paddr(void *vaddr);
-int bmm_get_dmabuf_fd(void *vaddr);
-int bmm_get_phys_dmabuf_fd(unsigned long paddr);
-int bmm_get_mem_attr(void *vaddr);
-int bmm_set_mem_attr(void *vaddr, int attr); /* Not supported yet */
-unsigned long bmm_get_mem_size(void *vaddr);
-unsigned long bmm_get_total_space(void);
-unsigned long bmm_get_free_space(void);
-unsigned long bmm_get_allocated_space(void);
-void bmm_flush_cache(void *vaddr, int dir);
-void bmm_flush_cache_range(void *start, size_t size, int direction);
-void bmm_flush_user(void *start, long size, int direction);
-void bmm_dump(void); /* for debugging */
+
+int bmm_dmabuf_alloc(unsigned long size, int attr, unsigned align);
+void *bmm_dmabuf_map(int fd, unsigned offset, unsigned size);
+void bmm_dmabuf_unmap(void *addr);
+int bmm_dmabuf_flush(int fd, void *addr, unsigned offset, unsigned size, unsigned direction);
+int bmm_dmabuf_fd(void *addr);
+void bmm_dmabuf_free(int fd);
#if defined (__cplusplus)
}