blob: 614d1e36f72ce89a793e7658b71b87969885b44d [file] [log] [blame]
Colin Crossdd6770b2013-12-18 15:39:27 -08001/*
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_TEST_H
18#define _UAPI_LINUX_ION_TEST_H
19
20#include <linux/ioctl.h>
21#include <linux/types.h>
22
23/**
24 * struct ion_test_rw_data - metadata passed to the kernel to read handle
25 * @ptr: a pointer to an area at least as large as size
26 * @offset: offset into the ion buffer to start reading
27 * @size: size to read or write
28 * @write: 1 to write, 0 to read
29 */
30struct ion_test_rw_data {
31 __u64 ptr;
32 __u64 offset;
33 __u64 size;
34 int write;
35};
36
37#define ION_IOC_MAGIC 'I'
38
39/**
40 * DOC: ION_IOC_TEST_SET_DMA_BUF - attach a dma buf to the test driver
41 *
42 * Attaches a dma buf fd to the test driver. Passing a second fd or -1 will
43 * release the first fd.
44 */
45#define ION_IOC_TEST_SET_FD \
46 _IO(ION_IOC_MAGIC, 0xf0)
47
48/**
49 * DOC: ION_IOC_TEST_DMA_MAPPING - read or write memory from a handle as DMA
50 *
51 * Reads or writes the memory from a handle using an uncached mapping. Can be
52 * used by unit tests to emulate a DMA engine as close as possible. Only
53 * expected to be used for debugging and testing, may not always be available.
54 */
55#define ION_IOC_TEST_DMA_MAPPING \
56 _IOW(ION_IOC_MAGIC, 0xf1, struct ion_test_rw_data)
57
58/**
59 * DOC: ION_IOC_TEST_KERNEL_MAPPING - read or write memory from a handle
60 *
61 * Reads or writes the memory from a handle using a kernel mapping. Can be
62 * used by unit tests to test heap map_kernel functions. Only expected to be
63 * used for debugging and testing, may not always be available.
64 */
65#define ION_IOC_TEST_KERNEL_MAPPING \
66 _IOW(ION_IOC_MAGIC, 0xf2, struct ion_test_rw_data)
67
68
69#endif /* _UAPI_LINUX_ION_H */