hyperion.ng
ion.h
1 /*
2  * drivers/staging/android/uapi/ion.h
3  *
4  * Copyright (C) 2011 Google, Inc.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  */
16 
17 #ifndef _UAPI_LINUX_ION_H
18 #define _UAPI_LINUX_ION_H
19 
20 #include <linux/ioctl.h>
21 #include <linux/types.h>
22 
23 typedef int ion_user_handle_t;
24 
37 enum ion_heap_type {
38  ION_HEAP_TYPE_SYSTEM,
39  ION_HEAP_TYPE_SYSTEM_CONTIG,
40  ION_HEAP_TYPE_CARVEOUT,
41  ION_HEAP_TYPE_CHUNK,
42  ION_HEAP_TYPE_DMA,
43  ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
44  are at the end of this enum */
45  ION_NUM_HEAPS = 16,
46 };
47 
48 #define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
49 #define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
50 #define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
51 #define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
52 
53 #define ION_NUM_HEAP_IDS sizeof(unsigned int) * 8
54 
59 #define ION_FLAG_CACHED 1 /* mappings of this buffer should be
60  cached, ion will do cache
61  maintenance when the buffer is
62  mapped for dma */
63 #define ION_FLAG_CACHED_NEEDS_SYNC 2 /* mappings of this buffer will created
64  at mmap time, if this is set
65  caches must be managed manually */
66 
87  size_t len;
88  size_t align;
89  unsigned int heap_id_mask;
90  unsigned int flags;
91  ion_user_handle_t handle;
92 };
93 
104 struct ion_fd_data {
105  ion_user_handle_t handle;
106  int fd;
107 };
108 
114  ion_user_handle_t handle;
115 };
116 
126  unsigned int cmd;
127  unsigned long arg;
128 };
129 
130 #define ION_IOC_MAGIC 'I'
131 
138 #define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
139  struct ion_allocation_data)
140 
146 #define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
147 
156 #define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
157 
167 #define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
168 
176 #define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
177 
186 #define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
187 
194 #define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
195 
196 #endif /* _UAPI_LINUX_ION_H */
197 
struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair : a handle : a file descr...
Definition: ion.h:104
struct ion_custom_data - metadata passed to/from userspace for a custom ioctl : the custom ioctl func...
Definition: ion.h:125
DOC: Ion Userspace API.
Definition: ion.h:86
struct ion_handle_data - a handle passed to/from the kernel : a handle
Definition: ion.h:113