3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 #ifndef _LINUX_ROCKCHIP_ION_H
17 #define _LINUX_ROCKCHIP_ION_H
20 #include "../../drivers/staging/android/ion/ion.h"
22 #include <linux/ion.h>
25 #define ROCKCHIP_ION_VERSION "v1.0"
35 ION_HEAP_ID_RESERVED = 31
38 #define ION_HEAP(bit) (1 << (bit))
40 #define ION_CMA_HEAP_NAME "cma"
41 #define ION_IOMMU_HEAP_NAME "iommu"
42 #define ION_VMALLOC_HEAP_NAME "vmalloc"
43 #define ION_DRM_HEAP_NAME "drm"
44 #define ION_CARVEOUT_HEAP_NAME "carveout"
46 #define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED)
47 #define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED)
49 #define ION_IS_CACHED(__flags) ((__flags) & ION_FLAG_CACHED)
51 /* struct ion_flush_data - data passed to ion for flushing caches
53 * @handle: handle with data to flush
55 * @vaddr: userspace virtual address mapped with mmap
56 * @offset: offset into the handle to flush
57 * @length: length of handle to flush
59 * Performs cache operations on the handle. If p is the start address
60 * of the handle, p + offset through p + offset + length will have
61 * the cache operations performed
63 struct ion_flush_data {
64 ion_user_handle_t handle;
71 struct ion_phys_data {
72 ion_user_handle_t handle;
77 struct ion_share_id_data {
82 #define ION_IOC_ROCKCHIP_MAGIC 'R'
85 * Clean the caches of the handle specified.
87 #define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
88 struct ion_flush_data)
90 * Invalidate the caches of the handle specified.
92 #define ION_IOC_INV_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 1, \
93 struct ion_flush_data)
95 * Clean and invalidate the caches of the handle specified.
97 #define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_ROCKCHIP_MAGIC, 2, \
98 struct ion_flush_data)
101 * Get phys addr of the handle specified.
103 #define ION_IOC_GET_PHYS _IOWR(ION_IOC_ROCKCHIP_MAGIC, 3, \
104 struct ion_phys_data)
107 * Get share object of the fd specified.
109 #define ION_IOC_GET_SHARE_ID _IOWR(ION_IOC_ROCKCHIP_MAGIC, 4, \
110 struct ion_share_id_data)
113 * Set share object and associate new fd.
115 #define ION_IOC_SHARE_BY_ID _IOWR(ION_IOC_ROCKCHIP_MAGIC, 5, \
116 struct ion_share_id_data)