summaryrefslogtreecommitdiff
path: root/bmm_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'bmm_lib.c')
-rw-r--r--bmm_lib.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/bmm_lib.c b/bmm_lib.c
index ab33cde..4def40b 100644
--- a/bmm_lib.c
+++ b/bmm_lib.c
@@ -51,7 +51,7 @@ void bmm_exit()
bmm_fd = -1;
}
-void *bmm_malloc(unsigned long size, int attr)
+void *bmm_malloc_aligned(unsigned long size, int attr, unsigned align)
{
int ret;
void *vaddr;
@@ -63,6 +63,8 @@ void *bmm_malloc(unsigned long size, int attr)
if(bmm_init() < 0)
return NULL;
+ pr_debug("%s(size=%lu,attr=%x,align=%u)\n", __FUNCTION__, size, attr, align);
+
/* obsolete, only for back-compatible */
if ((attr & BMM_ATTR_NONBUFFERABLE)&&(attr & BMM_ATTR_NONCACHEABLE))
attr = BMM_ATTR_NONCACHED;
@@ -70,10 +72,11 @@ void *bmm_malloc(unsigned long size, int attr)
if ((!(attr & BMM_ATTR_NONBUFFERABLE))&&(attr & BMM_ATTR_NONCACHEABLE))
attr = BMM_ATTR_WRITECOMBINE;
- io.input = size;
+ io.input = align;
+ io.length = size;
io.output = 0;
io.arg = attr;
- ret = ioctl(bmm_fd, BMM_MALLOC, &io);
+ ret = ioctl(bmm_fd, BMM_MALLOC_ALIGNED, &io);
if(ret < 0 || io.output == 0)
return NULL;
@@ -83,6 +86,11 @@ void *bmm_malloc(unsigned long size, int attr)
return ((int)vaddr == -1) ? NULL : vaddr;
}
+void *bmm_malloc(unsigned long size, int attr)
+{
+ return bmm_malloc_aligned(size, attr, sizeof(int));
+}
+
void bmm_free(void *vaddr)
{
unsigned long size;