ion: rockchip-ion: add API to set memory region secured
[firefly-linux-kernel-4.4.55.git] / include / linux / rockchip_ion.h
1 /*
2  *
3  * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
4  *
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.
8  *
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.
13  *
14  */
15
16 #ifndef _LINUX_ROCKCHIP_ION_H
17 #define _LINUX_ROCKCHIP_ION_H
18
19 #ifdef __KERNEL__
20 #include "../../drivers/staging/android/ion/ion.h"
21 #else
22 #include <linux/ion.h>
23 #endif
24
25 #define ROCKCHIP_ION_VERSION    "v1.1"
26
27 /*
28  * ion_heap_ids order by ion_heap_type
29  */
30 enum ion_heap_ids {
31        ION_VMALLOC_HEAP_ID = 0,
32        ION_CARVEOUT_HEAP_ID = 2,
33        ION_CMA_HEAP_ID = 4,
34        ION_DRM_HEAP_ID = 5,
35 };
36
37 #define ION_HEAP(bit) (1 << (bit))
38
39 struct ion_phys_data {
40         ion_user_handle_t handle;
41         unsigned long phys;
42         unsigned long size;
43 };
44
45 #define ION_IOC_ROCKCHIP_MAGIC 'R'
46
47 /**
48  * Get phys addr of the handle specified.
49  */
50 #define ION_IOC_GET_PHYS        _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
51                                                 struct ion_phys_data)
52 /**
53  * Set memory region secured.
54  */
55 #define ION_IOC_SET_SECURED     _IOWR(ION_IOC_ROCKCHIP_MAGIC, 1, bool)
56 #endif