1/* include/linux/msm_hw3d.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 */
15
16
17#ifndef _MSM_HW3D_H_
18#define _MSM_HW3D_H_
19
20#include <linux/fs.h>
21#include <linux/ioctl.h>
22
23struct hw3d_region;
24
25#define HW3D_IOCTL_MAGIC		'h'
26#define HW3D_WAIT_FOR_REVOKE		_IO(HW3D_IOCTL_MAGIC, 0x80)
27#define HW3D_WAIT_FOR_INTERRUPT		_IO(HW3D_IOCTL_MAGIC, 0x81)
28#define HW3D_GET_REGIONS		\
29			_IOR(HW3D_IOCTL_MAGIC, 0x82, struct hw3d_region *)
30
31#define HW3D_REGION_OFFSET(id)		((((uint32_t)(id)) & 0xf) << 28)
32#define HW3D_REGION_ID(addr)		(((uint32_t)(addr) >> 28) & 0xf)
33#define HW3D_OFFSET_IN_REGION(addr)	((uint32_t)(addr) & ~(0xfUL << 28))
34
35enum {
36	HW3D_EBI		= 0,
37	HW3D_SMI		= 1,
38	HW3D_REGS		= 2,
39
40	HW3D_NUM_REGIONS	= HW3D_REGS + 1,
41};
42
43struct hw3d_region {
44	unsigned long		phys;
45	unsigned long		map_offset;
46	unsigned long		len;
47};
48
49int get_msm_hw3d_file(int fd, uint32_t *offs, unsigned long *pbase,
50		      unsigned long *len, struct file **filp);
51void put_msm_hw3d_file(struct file *file);
52bool is_msm_hw3d_file(struct file *file);
53
54#endif /* _MSM_HW3D_H_ */
55