#include <linux/debugfs.h>
#include <linux/android_pmem.h>
+#include <asm/cacheflush.h>
#include "ion_priv.h"
#define DEBUG
static long ion_share_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct ion_buffer *buffer = filp->private_data;
- struct pmem_region region;
-
- region.offset = buffer->priv_phys;
- region.len = buffer->size;
+
+ switch (cmd) {
+ case PMEM_GET_PHYS:
+ {
+ struct pmem_region region;
+ region.offset = buffer->priv_phys;
+ region.len = buffer->size;
- if (copy_to_user((void __user *)arg, ®ion,
+ if (copy_to_user((void __user *)arg, ®ion,
+ sizeof(struct pmem_region)))
+ return -EFAULT;
+ break;
+ }
+ case PMEM_CACHE_FLUSH:
+ {
+ struct pmem_region region;
+ if (copy_from_user(®ion, (void __user *)arg,
sizeof(struct pmem_region)))
- return -EFAULT;
+ return -EFAULT;
+ dmac_flush_range((void *)region.offset, (void *)(region.offset + region.len));
+ break;
+ }
+ default:
+ return -ENOTTY;
+ }
return 0;
}
data.flags);
if (copy_to_user((void __user *)arg, &data, sizeof(data)))
return -EFAULT;
+ printk("%s: alloc 0x%x bytes, phy addr is 0x%lx\n",
+ __func__, data.len, data.handle->buffer->priv_phys);
break;
}
case ION_IOC_FREE:
static int num_heaps;
static struct ion_heap **heaps;
+static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
+ unsigned long arg)
+{
+ return 0;
+}
static int rockchip_ion_probe(struct platform_device *pdev)
{
struct ion_device *idev;
num_heaps = pdata->nr;
heaps = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL);
- idev = ion_device_create(NULL);
+ idev = ion_device_create(rockchip_custom_ioctl);
if (IS_ERR_OR_NULL(idev)) {
kfree(heaps);
return PTR_ERR(idev);
}
-
/* create the heaps as specified in the board file */
for (i = 0; i < num_heaps; i++) {
struct ion_platform_heap *heap_data = &pdata->heaps[i];