rk: ion: ion's heap id order by heap type

need update android, including:
    hardware/rk29/libgralloc_ump/
    hardware/rk29/camera/
    external/rk-pcba-test/
This commit is contained in:
CMY
2014-12-23 17:51:27 +08:00
parent 8689409d5b
commit be6254128b
7 changed files with 33 additions and 135 deletions

View File

@@ -638,14 +638,14 @@
#address-cells = <1>;
#size-cells = <0>;
ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <1>;
rockchip,ion_heap = <4>;
reg = <0x00000000 0x00000000>; /* 0MB */
};
rockchip,ion-heap@3 { /* VMALLOC HEAP */
rockchip,ion-heap@0 { /* VMALLOC HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <3>;
rockchip,ion_heap = <0>;
};
};

View File

@@ -931,14 +931,14 @@
#address-cells = <1>;
#size-cells = <0>;
ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <1>;
rockchip,ion_heap = <4>;
reg = <0x00000000 0x800000>; /* 8MB */
};
rockchip,ion-heap@3 { /* VMALLOC HEAP */
rockchip,ion-heap@0 { /* VMALLOC HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <3>;
rockchip,ion_heap = <0>;
};
};
cif: cif@1010a000 {

View File

@@ -265,14 +265,14 @@
compatible = "rockchip,ion";
#address-cells = <1>;
#size-cells = <0>;
ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <1>;
rockchip,ion_heap = <4>;
reg = <0x00000000 0x04000000>; /* 64MB */
};
rockchip,ion-heap@3 { /* VMALLOC HEAP */
rockchip,ion-heap@0 { /* VMALLOC HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <3>;
rockchip,ion_heap = <0>;
};
};

View File

@@ -978,14 +978,14 @@
#address-cells = <1>;
#size-cells = <0>;
ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <1>;
rockchip,ion_heap = <4>;
reg = <0x00000000 0x28000000>; /* 640MB */
};
rockchip,ion-heap@3 { /* VMALLOC HEAP */
rockchip,ion-heap@0 { /* VMALLOC HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <3>;
rockchip,ion_heap = <0>;
};
};

View File

@@ -807,7 +807,7 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
mutex_lock(&buffer->lock);
if (ION_IS_CACHED(buffer->flags)) {
if (ion_buffer_cached(buffer)) {
pr_err("%s: Cannot map iommu as cached.\n", __func__);
ret = -EINVAL;
goto out;

View File

@@ -45,7 +45,14 @@ extern struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
int id);
extern int ion_handle_put(struct ion_handle *handle);
#define ION_CMA_HEAP_NAME "cma"
#define ION_IOMMU_HEAP_NAME "iommu"
#define ION_VMALLOC_HEAP_NAME "vmalloc"
#define ION_DRM_HEAP_NAME "drm"
#define ION_CARVEOUT_HEAP_NAME "carveout"
#define MAX_ION_HEAP 10
static struct ion_platform_heap ion_plat_heap[MAX_ION_HEAP];
struct ion_platform_data ion_pdata = {
.nr = 0,
@@ -112,10 +119,6 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
pr_debug("[%s %d] cmd=%X\n", __func__, __LINE__, cmd);
switch (cmd) {
case ION_IOC_CLEAN_CACHES:
case ION_IOC_INV_CACHES:
case ION_IOC_CLEAN_INV_CACHES:
break;
case ION_IOC_GET_PHYS:
{
struct ion_phys_data data;
@@ -139,47 +142,6 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
return -EFAULT;
break;
}
case ION_IOC_GET_SHARE_ID:
{
struct ion_share_id_data data;
struct dma_buf *dmabuf = NULL;
if (copy_from_user(&data, (void __user *)arg,
sizeof(struct ion_share_id_data)))
return -EFAULT;
dmabuf = dma_buf_get(data.fd);
if (IS_ERR(dmabuf))
return PTR_ERR(dmabuf);
data.id = (unsigned int)dmabuf;
// dma_buf_put(dmabuf);
if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_share_id_data)))
return -EFAULT;
break;
}
case ION_IOC_SHARE_BY_ID:
{
struct ion_share_id_data data;
int fd = 0;
if (copy_from_user(&data, (void __user *)arg,
sizeof(struct ion_share_id_data)))
return -EFAULT;
fd = dma_buf_fd((struct dma_buf*)data.id, O_CLOEXEC);
if (fd < 0)
return fd;
data.fd = fd;
if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_share_id_data)))
return -EFAULT;
break;
}
default:
return -ENOTTY;
}

View File

@@ -22,96 +22,32 @@
#include <linux/ion.h>
#endif
#define ROCKCHIP_ION_VERSION "v1.0"
#define ROCKCHIP_ION_VERSION "v1.1"
/*
* ion_heap_ids order by ion_heap_type
*/
enum ion_heap_ids {
INVALID_HEAP_ID = -1,
ION_CMA_HEAP_ID = 1,
ION_IOMMU_HEAP_ID,
ION_VMALLOC_HEAP_ID,
ION_DRM_HEAP_ID,
ION_CARVEOUT_HEAP_ID,
ION_HEAP_ID_RESERVED = 31
ION_VMALLOC_HEAP_ID = 0,
ION_CARVEOUT_HEAP_ID = 2,
ION_CMA_HEAP_ID = 4,
ION_DRM_HEAP_ID = 5,
};
#define ION_HEAP(bit) (1 << (bit))
#define ION_CMA_HEAP_NAME "cma"
#define ION_IOMMU_HEAP_NAME "iommu"
#define ION_VMALLOC_HEAP_NAME "vmalloc"
#define ION_DRM_HEAP_NAME "drm"
#define ION_CARVEOUT_HEAP_NAME "carveout"
#define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED)
#define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED)
#define ION_IS_CACHED(__flags) ((__flags) & ION_FLAG_CACHED)
/* struct ion_flush_data - data passed to ion for flushing caches
*
* @handle: handle with data to flush
* @fd: fd to flush
* @vaddr: userspace virtual address mapped with mmap
* @offset: offset into the handle to flush
* @length: length of handle to flush
*
* Performs cache operations on the handle. If p is the start address
* of the handle, p + offset through p + offset + length will have
* the cache operations performed
*/
struct ion_flush_data {
ion_user_handle_t handle;
int fd;
void *vaddr;
unsigned int offset;
unsigned int length;
};
struct ion_phys_data {
ion_user_handle_t handle;
unsigned long phys;
unsigned long size;
};
struct ion_share_id_data {
int fd;
unsigned int id;
};
#define ION_IOC_ROCKCHIP_MAGIC 'R'
/**
* Clean the caches of the handle specified.
*/
#define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
struct ion_flush_data)
/**
* Invalidate the caches of the handle specified.
*/
#define ION_IOC_INV_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 1, \
struct ion_flush_data)
/**
* Clean and invalidate the caches of the handle specified.
*/
#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 2, \
struct ion_flush_data)
/**
* Get phys addr of the handle specified.
*/
#define ION_IOC_GET_PHYS _IOWR(ION_IOC_ROCKCHIP_MAGIC, 3, \
#define ION_IOC_GET_PHYS _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
struct ion_phys_data)
/**
* Get share object of the fd specified.
*/
#define ION_IOC_GET_SHARE_ID _IOWR(ION_IOC_ROCKCHIP_MAGIC, 4, \
struct ion_share_id_data)
/**
* Set share object and associate new fd.
*/
#define ION_IOC_SHARE_BY_ID _IOWR(ION_IOC_ROCKCHIP_MAGIC, 5, \
struct ion_share_id_data)
#endif