My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
otz_client.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Trustzone client driver defintions.
25  */
26 
27 #ifndef __OTZ_CLIENT_H_
28 #define __OTZ_CLIENT_H_
29 #ifndef ARM_ARCH_ARMV7
30 #include <uuid_structure.h>
31 #endif
32 #define OTZ_CLIENT_FULL_PATH_DEV_NAME "/dev/otz_client"
33 #define OTZ_CLIENT_DEV "otz_client"
34 
35 #define OTZ_CLIENT_IOC_MAGIC 0x775B777F /* "OTZ Client" */
36 
37 #undef TDEBUG
38 #ifdef OTZ_DEBUG
39 #define TDEBUG(fmt, args...) printk(KERN_DEBUG "%s(%i, %s): " fmt "\n", \
40  __func__, current->pid, current->comm, ## args)
41 #else
42 #define TDEBUG(fmt, args...)
43 #endif
44 
45 #undef TERR
46 #define TERR(fmt, args...) printk(KERN_ERR "%s(%i, %s): " fmt "\n", \
47  __func__, current->pid, current->comm, ## args)
48 
56  unsigned int len;
57  void* data;
58  int offset;
59  int flags;
61 
62  int encode_id;
65  unsigned int cmd_id;
66 };
67 
71 struct ser_ses_id{
74 };
75 
82  #ifdef ARM_ARCH_ARMV7
83  unsigned int user_mem_addr;
84  #else
85  unsigned long user_mem_addr;
86  #endif
87 };
88 
92 struct otz_smc_cdata {
93  int cmd_addr;
94  int ret_val;
95  int cmd_id;
96  #ifndef ARM_ARCH_ARMV7
99  #endif
100 };
101 
102 void *memncpy(void *dst, const void *src, unsigned int count,
103  unsigned int dst_len, unsigned int src_len);
104 
112 void strncpy_safe(char* dst, const char* src, size_t n);
113 
114 /* For general service */
115 #define OTZ_CLIENT_IOCTL_SEND_CMD_REQ \
116  _IOWR(OTZ_CLIENT_IOC_MAGIC, 3, struct otz_client_encode_cmd)
117 #define OTZ_CLIENT_IOCTL_SES_OPEN_REQ \
118  _IOW(OTZ_CLIENT_IOC_MAGIC, 4, struct ser_ses_id)
119 #define OTZ_CLIENT_IOCTL_SES_CLOSE_REQ \
120  _IOWR(OTZ_CLIENT_IOC_MAGIC, 5, struct ser_ses_id)
121 #define OTZ_CLIENT_IOCTL_SHR_MEM_FREE_REQ \
122  _IOWR(OTZ_CLIENT_IOC_MAGIC, 6, struct otz_session_shared_mem_info )
123 
124 #define OTZ_CLIENT_IOCTL_ENC_UINT32 \
125  _IOWR(OTZ_CLIENT_IOC_MAGIC, 7, struct otz_client_encode_cmd)
126 #define OTZ_CLIENT_IOCTL_ENC_ARRAY \
127  _IOWR(OTZ_CLIENT_IOC_MAGIC, 8, struct otz_client_encode_cmd)
128 #define OTZ_CLIENT_IOCTL_ENC_ARRAY_SPACE \
129  _IOWR(OTZ_CLIENT_IOC_MAGIC, 9, struct otz_client_encode_cmd)
130 #define OTZ_CLIENT_IOCTL_ENC_MEM_REF \
131  _IOWR(OTZ_CLIENT_IOC_MAGIC, 10, struct otz_client_encode_cmd)
132 
133 #define OTZ_CLIENT_IOCTL_DEC_UINT32 \
134  _IOWR(OTZ_CLIENT_IOC_MAGIC, 11, struct otz_client_encode_cmd)
135 #define OTZ_CLIENT_IOCTL_DEC_ARRAY_SPACE \
136  _IOWR(OTZ_CLIENT_IOC_MAGIC, 12, struct otz_client_encode_cmd)
137 #define OTZ_CLIENT_IOCTL_OPERATION_RELEASE \
138  _IOWR(OTZ_CLIENT_IOC_MAGIC, 13, struct otz_client_encode_cmd)
139 #define OTZ_CLIENT_IOCTL_SHR_MEM_ALLOCATE_REQ \
140  _IOWR(OTZ_CLIENT_IOC_MAGIC, 14, struct otz_session_shared_mem_info)
141 #define OTZ_CLIENT_IOCTL_GET_DECODE_TYPE \
142  _IOWR(OTZ_CLIENT_IOC_MAGIC, 15, struct otz_client_encode_cmd)
143 
144 #endif /* __OTZ_CLIENT_H_ */
int service_id
Definition: otz_client.h:72
int cmd_addr
Definition: otz_client.h:93
int service_id
Definition: otz_client.h:63
int cmd_id
Definition: otz_client.h:95
int encode_id
Definition: otz_client.h:62
Definition: uuid_structure.h:33
int service_id
Definition: otz_client.h:80
int session_id
Definition: otz_client.h:64
unsigned long user_mem_addr
Definition: otz_client.h:85
Shared memory used for smc processing.
Definition: otz_client.h:92
void strncpy_safe(char *dst, const char *src, size_t n)
copies n size of string src to string dst
Definition: otz_tee_api.c:1047
int session_id
Definition: otz_client.h:73
unsigned int cmd_id
Definition: otz_client.h:65
Shared memory information for the session.
Definition: otz_client.h:79
Session details structure.
Definition: otz_client.h:71
int session_id
Definition: otz_client.h:81
unsigned int len
Definition: otz_client.h:56
TEE_UUID uuid
Definition: otz_client.h:97
Definition: uuid_structure.h:26
void * data
Definition: otz_client.h:57
s32int count
Definition: virtual_keyboard.c:40
void * memncpy(void *dst, const void *src, unsigned int count, unsigned int dst_len, unsigned int src_len)
Definition: otz_tee_api.c:1053
smc_call_version revision
Definition: otz_client.h:98
int ret_val
Definition: otz_client.h:94
int flags
Definition: otz_client.h:59
int param_type
Definition: otz_client.h:60
Encode command structure.
Definition: otz_client.h:55
int offset
Definition: otz_client.h:58