1 #ifndef __LOCAL_POC_H__
2 #define __LOCAL_POC_H__
3 
4 #define FASTRPC_INIT_CREATE 1
5 #define remote_arg_t union remote_arg
6 #define FASTRPC_IOCTL_INVOKE _IOWR('R', 1, struct fastrpc_ioctl_invoke)
7 #define FASTRPC_IOCTL_INVOKE_FD _IOWR('R', 4, struct fastrpc_ioctl_invoke_fd)
8 #define ADSP_MMAP_ADD_PAGES 0x1000
9 #define FASTRPC_IOCTL_MMAP _IOWR('R', 2, struct fastrpc_ioctl_mmap)
10 #define FASTRPC_IOCTL_INIT _IOWR('R', 6, struct fastrpc_ioctl_init)
11 #define FASTRPC_IOCTL_GETINFO _IOWR('R', 8, uint32_t)
12 #define FASTRPC_IOCTL_INIT_ATTRS _IOWR('R', 10, struct fastrpc_ioctl_init_attrs)
13 #define FASTRPC_IOCTL_MUNMAP_FD _IOWR('R', 13, struct fastrpc_ioctl_munmap_fd)
14 #define ION_HEAP(bit) (1 << (bit))
15 #define ION_BIT(nr) (1UL << (nr))
16 #define ION_FLAG_CP_TOUCH ION_BIT(17)
17 #define ION_FLAG_CP_BITSTREAM ION_BIT(18)
18 #define ION_FLAG_CP_PIXEL ION_BIT(19)
19 #define ION_FLAG_CP_NON_PIXEL ION_BIT(20)
20 #define ION_FLAG_CP_CAMERA ION_BIT(21)
21 #define ION_FLAG_CP_HLOS ION_BIT(22)
22 #define ION_FLAG_CP_HLOS_FREE ION_BIT(23)
23 #define ION_FLAG_CP_SEC_DISPLAY ION_BIT(25)
24 #define ION_FLAG_CP_APP ION_BIT(26)
25 #define ION_FLAG_CP_CAMERA_PREVIEW ION_BIT(27)
26 #define ION_IOC_MAGIC 'I'
27 #define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
28 #define ION_FLAG_SECURE ION_BIT(ION_HEAP_ID_RESERVED)
29 
30 struct remote_buf {
31   void *pv;
32   size_t len;
33 };
34 
35 struct remote_dma_handle {
36   int fd;
37   uint32_t offset;
38 };
39 
40 union remote_arg {
41   struct remote_buf buf;
42   struct remote_dma_handle dma;
43   uint32_t h;
44 };
45 
46 struct fastrpc_ioctl_invoke {
47   uint32_t handle;
48   uint32_t sc;
49   remote_arg_t *pra;
50 };
51 
52 struct fastrpc_ioctl_invoke_fd {
53   struct fastrpc_ioctl_invoke inv;
54   int *fds;
55 };
56 
57 struct fastrpc_ioctl_mmap {
58   int fd;                 /* ion fd */
59   uint32_t flags;         /* flags for dsp to map with */
60   unsigned long vaddrin;  /* optional virtual address */
61   size_t size;            /* size */
62   unsigned long vaddrout; /* dsps virtual address */
63 };
64 
65 struct fastrpc_ioctl_init {
66   uint32_t flags;
67   void *file;
68   uint32_t filelen;
69   int32_t filefd;
70   void *mem;
71   uint32_t memlen;
72   int32_t memfd;
73 };
74 
75 struct fastrpc_ioctl_init_attrs {
76   struct fastrpc_ioctl_init init;
77   int attrs;
78   unsigned int siglen;
79 };
80 
81 
82 struct fastrpc_ioctl_munmap_fd {
83   int fd;
84   uint32_t flags;
85   unsigned long va;
86   ssize_t len;
87 };
88 
89 enum ion_heap_ids {
90   INVALID_HEAP_ID = -1,
91   ION_CP_MM_HEAP_ID = 8,
92   ION_SECURE_HEAP_ID = 9,
93   ION_SECURE_DISPLAY_HEAP_ID = 10,
94   ION_CP_MFC_HEAP_ID = 12,
95   ION_SPSS_HEAP_ID = 13,   /* Secure Processor ION heap */
96   ION_CP_WB_HEAP_ID = 16,  /* 8660 only */
97   ION_CAMERA_HEAP_ID = 20, /* 8660 only */
98   ION_SYSTEM_CONTIG_HEAP_ID = 21,
99   ION_ADSP_HEAP_ID = 22,
100   ION_PIL1_HEAP_ID = 23, /* Currently used for other PIL images */
101   ION_SF_HEAP_ID = 24,
102   ION_SYSTEM_HEAP_ID = 25,
103   ION_PIL2_HEAP_ID = 26, /* Currently used for modem firmware images */
104   ION_QSECOM_HEAP_ID = 27,
105   ION_AUDIO_HEAP_ID = 28,
106 
107   ION_MM_FIRMWARE_HEAP_ID = 29,
108   ION_GOOGLE_HEAP_ID = 30,
109 
110   ION_HEAP_ID_RESERVED = 31 /**
111      * Bit reserved for ION_FLAG_SECURE flag
112      */
113 };
114 
115 struct ion_allocation_data {
116   uint64_t len;
117   uint32_t heap_id_mask;
118   uint32_t flags;
119   uint32_t fd;
120   uint32_t unused;
121 };
122 
123 #endif
124