18cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes/****************************************************************************
28cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ****************************************************************************
38cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***
48cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   This header was automatically generated from a Linux kernel header
58cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   of the same name, to make information necessary for userspace to
68cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   call into the kernel available to libc.  It contains only constants,
78cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   structures, and macros generated from the original header, and thus,
88cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   contains no copyrightable information.
98cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***
108cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   To edit the content of this header, modify the corresponding
118cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   source file (e.g. under external/kernel-headers/original/) then
128cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   run bionic/libc/kernel/tools/update_all.py
138cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***
148cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   Any manual change here will be lost the next time this script will
158cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***   be run. You've been warned!
168cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ***
178cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ****************************************************************************
188cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes ****************************************************************************/
19356a4e4a3243ddb40c41a9bbaf7e86f821aaa912Elliott Hughes#ifndef _UAPI_LINUX_ION_H
20356a4e4a3243ddb40c41a9bbaf7e86f821aaa912Elliott Hughes#define _UAPI_LINUX_ION_H
21356a4e4a3243ddb40c41a9bbaf7e86f821aaa912Elliott Hughes#include <linux/ioctl.h>
228cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes#include <linux/types.h>
231a0344d65dd0f5d965029110985094d94d177389Christopher Ferristypedef int ion_user_handle_t;
248cb52b056cfc302e05304d847c4228dff15715cfElliott Hughesenum ion_heap_type {
25d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  ION_HEAP_TYPE_SYSTEM,
26d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  ION_HEAP_TYPE_SYSTEM_CONTIG,
27d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  ION_HEAP_TYPE_CARVEOUT,
28d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  ION_HEAP_TYPE_CHUNK,
29d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  ION_HEAP_TYPE_DMA,
30d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  ION_HEAP_TYPE_CUSTOM,
318cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes};
3282d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris#define ION_NUM_HEAP_IDS (sizeof(unsigned int) * 8)
338cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes#define ION_FLAG_CACHED 1
34356a4e4a3243ddb40c41a9bbaf7e86f821aaa912Elliott Hughes#define ION_FLAG_CACHED_NEEDS_SYNC 2
358cb52b056cfc302e05304d847c4228dff15715cfElliott Hughesstruct ion_allocation_data {
361a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  size_t len;
371a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  size_t align;
381a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  unsigned int heap_id_mask;
391a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  unsigned int flags;
401a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  ion_user_handle_t handle;
411a0344d65dd0f5d965029110985094d94d177389Christopher Ferris};
421a0344d65dd0f5d965029110985094d94d177389Christopher Ferrisstruct ion_fd_data {
431a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  ion_user_handle_t handle;
441a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  int fd;
451a0344d65dd0f5d965029110985094d94d177389Christopher Ferris};
461a0344d65dd0f5d965029110985094d94d177389Christopher Ferrisstruct ion_handle_data {
471a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  ion_user_handle_t handle;
481a0344d65dd0f5d965029110985094d94d177389Christopher Ferris};
491a0344d65dd0f5d965029110985094d94d177389Christopher Ferrisstruct ion_custom_data {
501a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  unsigned int cmd;
511a0344d65dd0f5d965029110985094d94d177389Christopher Ferris  unsigned long arg;
528cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes};
536a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MAX_HEAP_NAME 32
546a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferrisstruct ion_heap_data {
556a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  char name[MAX_HEAP_NAME];
566a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 type;
576a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 heap_id;
586a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 reserved0;
596a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 reserved1;
606a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 reserved2;
616a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris};
626a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferrisstruct ion_heap_query {
636a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 cnt;
646a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 reserved0;
656a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u64 heaps;
666a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 reserved1;
676a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 reserved2;
686a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris};
696a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define ION_IOC_MAGIC 'I'
70d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
711a0344d65dd0f5d965029110985094d94d177389Christopher Ferris#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
721a0344d65dd0f5d965029110985094d94d177389Christopher Ferris#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
731a0344d65dd0f5d965029110985094d94d177389Christopher Ferris#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
741a0344d65dd0f5d965029110985094d94d177389Christopher Ferris#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
751a0344d65dd0f5d965029110985094d94d177389Christopher Ferris#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
761a0344d65dd0f5d965029110985094d94d177389Christopher Ferris#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
776a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define ION_IOC_HEAP_QUERY _IOWR(ION_IOC_MAGIC, 8, struct ion_heap_query)
788cb52b056cfc302e05304d847c4228dff15715cfElliott Hughes#endif
79