summaryrefslogtreecommitdiff
path: root/drivers/misc/bmm_dmabuf.h
blob: 632982b0c9ba97e70ccb84115e0612e093f29ee8 (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
/*
 * bmm_dmabuf.h
 *
 * CMA backed dma_buf management
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Portions (C) Copyright 2007 Marvell International Ltd.
 * All Rights Reserved
 */

#ifndef _BMM_DMABUF_H
#define _BMM_DMABUF_H

#include <linux/dma-mapping.h>
#include <linux/ioctl.h>
#include <linux/types.h>

/* ioctl commands */
struct bmm_fd_alloc {
	__u64 size;
	__u64 align;
	__u32 attr;
	__s32 fd;
};

struct bmm_fd_flush {
	__u64 size;
	__u64 offset;
	__u64 ptr;
	__s32 fd;
	__u32 direction;
};

#define BMEM_IOCTL_MAGIC 'G'
#define BMM_FD_ALLOC		_IOWR(BMEM_IOCTL_MAGIC, 64, struct bmm_fd_alloc)
#define BMM_FD_FLUSH		_IOW(BMEM_IOCTL_MAGIC, 65, struct bmm_fd_flush)

/* ioctl arguments: memory attributes */
#define BMM_ATTR_DEFAULT	(0)		/* cacheable bufferable */
#define BMM_ATTR_WRITECOMBINE	(1 << 0)	/* non-cacheable & bufferable */
#define BMM_ATTR_NONCACHED	(1 << 1)	/* non-cacheable & non-bufferable */

/* ioctl arguments: cache flush direction */
#define BMM_DMA_BIDIRECTIONAL	0
#define BMM_DMA_TO_DEVICE	1
#define BMM_DMA_FROM_DEVICE	2
#define BMM_DMA_NONE		3

#endif