blob: ffef06f63133fb874e38c1445947a1b35175dd75 [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;
Colin Crossb04f75a2013-12-19 18:58:20 -080035 int __padding;
Colin Crossdd6770b2013-12-18 15:39:27 -080036};
37
38#define ION_IOC_MAGIC 'I'
39
40/**
41 * DOC: ION_IOC_TEST_SET_DMA_BUF - attach a dma buf to the test driver
42 *
43 * Attaches a dma buf fd to the test driver. Passing a second fd or -1 will
44 * release the first fd.
45 */
46#define ION_IOC_TEST_SET_FD \
47 _IO(ION_IOC_MAGIC, 0xf0)
48
49/**
50 * DOC: ION_IOC_TEST_DMA_MAPPING - read or write memory from a handle as DMA
51 *
52 * Reads or writes the memory from a handle using an uncached mapping. Can be
53 * used by unit tests to emulate a DMA engine as close as possible. Only
54 * expected to be used for debugging and testing, may not always be available.
55 */
56#define ION_IOC_TEST_DMA_MAPPING \
57 _IOW(ION_IOC_MAGIC, 0xf1, struct ion_test_rw_data)
58
59/**
60 * DOC: ION_IOC_TEST_KERNEL_MAPPING - read or write memory from a handle
61 *
62 * Reads or writes the memory from a handle using a kernel mapping. Can be
63 * used by unit tests to test heap map_kernel functions. Only expected to be
64 * used for debugging and testing, may not always be available.
65 */
66#define ION_IOC_TEST_KERNEL_MAPPING \
67 _IOW(ION_IOC_MAGIC, 0xf2, struct ion_test_rw_data)
68
69
70#endif /* _UAPI_LINUX_ION_H */