fmem: Add reserved_size to fmem
Due to a limitation in how the video hardware is able
to access memory, fmem needs to be able to allocate a
physically contiguous block of memory that can be split into
two pieces. One piece will be managed by fmem
while the other piece (reserved) will not be handled by fmem.
The hardware limitation requires the reserved part to be at
a lower address than the other piece managed by fmem.
Add a new parameter to fmem that allows platform
data to specify the size of the piece that should not
be managed by fmem.
Change-Id: I910680ca72233de9cef91ac3262a078a36f1b1fd
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/drivers/staging/qcache/fmem.c b/drivers/staging/qcache/fmem.c
index 3b44a2c..d12c8e8 100644
--- a/drivers/staging/qcache/fmem.c
+++ b/drivers/staging/qcache/fmem.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -51,12 +51,14 @@
{
struct fmem_platform_data *pdata = pdev->dev.platform_data;
- if (!pdata->size)
+ fmem_data.phys = pdata->phys + pdata->reserved_size;
+ fmem_data.size = pdata->size - pdata->reserved_size;
+ fmem_data.reserved_size = pdata->reserved_size;
+
+ if (!fmem_data.size)
return -ENODEV;
- fmem_data.phys = pdata->phys;
- fmem_data.size = pdata->size;
- fmem_data.area = get_vm_area(pdata->size, VM_IOREMAP);
+ fmem_data.area = get_vm_area(fmem_data.size, VM_IOREMAP);
if (!fmem_data.area)
return -ENOMEM;
diff --git a/include/linux/fmem.h b/include/linux/fmem.h
index c9e36b5..aebeec4 100644
--- a/include/linux/fmem.h
+++ b/include/linux/fmem.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -20,6 +20,7 @@
struct fmem_platform_data {
unsigned long phys;
unsigned long size;
+ unsigned long reserved_size;
};
struct fmem_data {
@@ -27,6 +28,7 @@
void *virt;
struct vm_struct *area;
unsigned long size;
+ unsigned long reserved_size;
};
enum fmem_state {