aboutsummaryrefslogtreecommitdiff
path: root/include/linux/dma-buf-test-exporter.h
blob: db0e93898133043113745593488f85ac68e55cbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 *
 * (C) COPYRIGHT ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU licence.
 *
 * A copy of the licence is included with the program, and can also be obtained
 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 */




#ifndef _LINUX_DMA_BUF_TEST_EXPORTER_H_
#define _LINUX_DMA_BUF_TEST_EXPORTER_H_

#include <linux/types.h>
#include <asm/ioctl.h>

#define DMA_BUF_TE_VER_MAJOR 1
#define DMA_BUF_TE_VER_MINOR 0
#define DMA_BUF_TE_ENQ 0x642d7465
#define DMA_BUF_TE_ACK 0x68692100

struct dma_buf_te_ioctl_version
{
	int op;    /**< Must be set to DMA_BUF_TE_ENQ by client, driver will set it to DMA_BUF_TE_ACK */
	int major; /**< Major version */
	int minor; /**< Minor version */
};

struct dma_buf_te_ioctl_alloc
{
	__u64 size; /* size of buffer to allocate, in pages */
};

struct dma_buf_te_ioctl_status
{
	/* in */
	int fd; /* the dma_buf to query, only dma_buf objects exported by this driver is supported */
	/* out */
	int attached_devices; /* number of devices attached (active 'dma_buf_attach's) */
	int device_mappings; /* number of device mappings (active 'dma_buf_map_attachment's) */
	int cpu_mappings;    /* number of cpu mappings (active 'mmap's) */
};

struct dma_buf_te_ioctl_set_failing
{
	/* in */
	int fd; /* the dma_buf to set failure mode for, only dma_buf objects exported by this driver is supported */

	/* zero = no fail injection, non-zero = inject failure */
	int fail_attach;
	int fail_map;
	int fail_mmap;
};

struct dma_buf_te_ioctl_fill
{
	int fd;
	unsigned int value;
};

#define DMA_BUF_TE_IOCTL_BASE 'E'
/* Below all returning 0 if successful or -errcode except DMA_BUF_TE_ALLOC which will return fd or -errcode */
#define DMA_BUF_TE_VERSION         _IOR(DMA_BUF_TE_IOCTL_BASE, 0x00, struct dma_buf_te_ioctl_version)
#define DMA_BUF_TE_ALLOC           _IOR(DMA_BUF_TE_IOCTL_BASE, 0x01, struct dma_buf_te_ioctl_alloc)
#define DMA_BUF_TE_QUERY           _IOR(DMA_BUF_TE_IOCTL_BASE, 0x02, struct dma_buf_te_ioctl_status)
#define DMA_BUF_TE_SET_FAILING     _IOW(DMA_BUF_TE_IOCTL_BASE, 0x03, struct dma_buf_te_ioctl_set_failing)
#define DMA_BUF_TE_ALLOC_CONT      _IOR(DMA_BUF_TE_IOCTL_BASE, 0x04, struct dma_buf_te_ioctl_alloc)
#define DMA_BUF_TE_FILL            _IOR(DMA_BUF_TE_IOCTL_BASE, 0x05, struct dma_buf_te_ioctl_fill)

#endif /* _LINUX_DMA_BUF_TEST_EXPORTER_H_ */