Home | History | Annotate | Download | only in linux
      1 # Copyright 2017 syzkaller project authors. All rights reserved.
      2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
      3 
      4 include <asm/ioctl.h>
      5 include <uapi/linux/fcntl.h>
      6 include <uapi/linux/dma-buf.h>
      7 include <drivers/staging/android/uapi/ion.h>
      8 
      9 resource fd_ion[fd]
     10 resource fd_dma_buf[fd]
     11 
     12 openat$ion(fd const[AT_FDCWD], file ptr[in, string["/dev/ion"]], flags flags[open_flags], mode const[0]) fd_ion
     13 
     14 ioctl$ION_IOC_ALLOC(fd fd_ion, cmd const[ION_IOC_ALLOC], arg ptr[inout, ion_allocation_data])
     15 ioctl$ION_IOC_HEAP_QUERY(fd fd_ion, cmd const[ION_IOC_HEAP_QUERY], arg ptr[inout, ion_heap_query])
     16 
     17 ioctl$DMA_BUF_IOCTL_SYNC(fd fd_dma_buf, cmd const[DMA_BUF_IOCTL_SYNC], arg ptr[in, flags[dma_buf_sync_flags, int64]])
     18 
     19 ion_allocation_data {
     20 	len		int64
     21 	heap_id_mask	flags[ion_heap_mask, int32]
     22 	flags		flags[ion_alloc_flags, int32]
     23 	fd		fd_dma_buf[opt]
     24 	unused		const[0, int32]
     25 }
     26 
     27 ion_heap_query {
     28 	cnt		len[heaps, int32]
     29 	reserved0	const[0, int32]
     30 	heaps		ptr64[out, ion_heap_data]
     31 	reserved1	const[0, int32]
     32 	reserved2	const[0, int32]
     33 }
     34 
     35 ion_heap_data {
     36 	name		string["name", MAX_HEAP_NAME]
     37 	type		int32
     38 	heap_id		int32
     39 	reserved0	int32
     40 	reserved1	int32
     41 	reserved2	int32
     42 }
     43 
     44 ion_alloc_flags = ION_FLAG_CACHED
     45 ion_heap_mask = ION_HEAP_TYPE_SYSTEM_BIT, ION_HEAP_TYPE_SYSTEM_CONTIG_BIT, ION_HEAP_TYPE_CARVEOUT_BIT, ION_HEAP_TYPE_CHUNK_BIT, ION_HEAP_TYPE_DMA_BIT, ION_HEAP_TYPE_CUSTOM_BIT
     46 dma_buf_sync_flags = DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, DMA_BUF_SYNC_END
     47 
     48 define ION_HEAP_TYPE_SYSTEM_BIT	1 << ION_HEAP_TYPE_SYSTEM
     49 define ION_HEAP_TYPE_SYSTEM_CONTIG_BIT	1 << ION_HEAP_TYPE_SYSTEM_CONTIG
     50 define ION_HEAP_TYPE_CARVEOUT_BIT	1 << ION_HEAP_TYPE_CARVEOUT
     51 define ION_HEAP_TYPE_CHUNK_BIT	1 << ION_HEAP_TYPE_CHUNK
     52 define ION_HEAP_TYPE_DMA_BIT	1 << ION_HEAP_TYPE_DMA
     53 define ION_HEAP_TYPE_CUSTOM_BIT	1 << ION_HEAP_TYPE_CUSTOM
     54