1 /*
2  * Copyright (C) 2012-2013, 2016-2017 ARM Limited. All rights reserved.
3  *
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  *
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10 
11 #ifndef __UMPLOCK_IOCTL_H__
12 #define __UMPLOCK_IOCTL_H__
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <linux/types.h>
19 #include <linux/ioctl.h>
20 
21 #ifndef __user
22 #define __user
23 #endif
24 
25 
26 /**
27  * @file umplock_ioctl.h
28  * This file describes the interface needed to use the Linux device driver.
29  * The interface is used by the userpace Mali DDK.
30  */
31 
32 typedef enum {
33 	_LOCK_ACCESS_RENDERABLE = 1,
34 	_LOCK_ACCESS_TEXTURE,
35 	_LOCK_ACCESS_CPU_WRITE,
36 	_LOCK_ACCESS_CPU_READ,
37 } _lock_access_usage;
38 
39 typedef struct _lock_item_s {
40 	unsigned int secure_id;
41 	_lock_access_usage usage;
42 } _lock_item_s;
43 
44 
45 #define LOCK_IOCTL_GROUP 0x91
46 
47 #define _LOCK_IOCTL_CREATE_CMD  0   /* create kernel lock item        */
48 #define _LOCK_IOCTL_PROCESS_CMD 1   /* process kernel lock item       */
49 #define _LOCK_IOCTL_RELEASE_CMD 2   /* release kernel lock item       */
50 #define _LOCK_IOCTL_ZAP_CMD     3   /* clean up all kernel lock items */
51 #define _LOCK_IOCTL_DUMP_CMD    4   /* dump all the items */
52 
53 #define LOCK_IOCTL_MAX_CMDS     5
54 
55 #define LOCK_IOCTL_CREATE  _IOW( LOCK_IOCTL_GROUP, _LOCK_IOCTL_CREATE_CMD,  _lock_item_s )
56 #define LOCK_IOCTL_PROCESS _IOW( LOCK_IOCTL_GROUP, _LOCK_IOCTL_PROCESS_CMD, _lock_item_s )
57 #define LOCK_IOCTL_RELEASE _IOW( LOCK_IOCTL_GROUP, _LOCK_IOCTL_RELEASE_CMD, _lock_item_s )
58 #define LOCK_IOCTL_ZAP     _IO ( LOCK_IOCTL_GROUP, _LOCK_IOCTL_ZAP_CMD )
59 #define LOCK_IOCTL_DUMP    _IO ( LOCK_IOCTL_GROUP, _LOCK_IOCTL_DUMP_CMD )
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif /* __UMPLOCK_IOCTL_H__ */
66 
67