blob: 6d39026dafd4f937dc889861c31bb404291496ca [file] [log] [blame]
Mona Hossain2892b6b2012-02-17 13:53:11 -08001#ifndef __QSEECOM_H_
2#define __QSEECOM_H_
3
4#include <linux/types.h>
5#include <linux/ioctl.h>
6
7#define MAX_ION_FD 4
8#define MAX_APP_NAME_SIZE 32
9
10/*
11 * struct qseecom_register_listener_req -
12 * for register listener ioctl request
13 * @listener_id - service id (shared between userspace and QSE)
14 * @ifd_data_fd - ion handle
15 * @virt_sb_base - shared buffer base in user space
16 * @sb_size - shared buffer size
17 */
18struct qseecom_register_listener_req {
19 uint32_t listener_id; /* in */
20 int32_t ifd_data_fd; /* in */
21 uint32_t virt_sb_base; /* in */
22 uint32_t sb_size; /* in */
23};
24
25/*
26 * struct qseecom_send_cmd_req - for send command ioctl request
27 * @cmd_req_len - command buffer length
28 * @cmd_req_buf - command buffer
29 * @resp_len - response buffer length
30 * @resp_buf - response buffer
31 */
32struct qseecom_send_cmd_req {
33 void *cmd_req_buf; /* in */
34 unsigned int cmd_req_len; /* in */
35 void *resp_buf; /* in/out */
36 unsigned int resp_len; /* in/out */
37};
38
39
40/*
41 * struct qseecom_ion_fd_info - ion fd handle data information
42 * @fd - ion handle to some memory allocated in user space
43 * @cmd_buf_offset - command buffer offset
44 */
45struct qseecom_ion_fd_info {
46 int32_t fd;
47 uint32_t cmd_buf_offset;
48};
49/*
50 * struct qseecom_send_modfd_cmd_req - for send command ioctl request
51 * @cmd_req_len - command buffer length
52 * @cmd_req_buf - command buffer
53 * @resp_len - response buffer length
54 * @resp_buf - response buffer
55 * @ifd_data_fd - ion handle to memory allocated in user space
56 * @cmd_buf_offset - command buffer offset
57 */
58struct qseecom_send_modfd_cmd_req {
59 void *cmd_req_buf; /* in */
60 unsigned int cmd_req_len; /* in */
61 void *resp_buf; /* in/out */
62 unsigned int resp_len; /* in/out */
63 struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
64};
65/*
66 * struct qseecom_listener_send_resp_req - signal to continue the send_cmd req.
67 * Used as a trigger from HLOS service to notify QSEECOM that it's done with its
68 * operation and provide the response for QSEECOM can continue the incomplete
69 * command execution
70 * @resp_len - Length of the response
71 * @resp_buf - Response buffer where the response of the cmd should go.
72 */
73struct qseecom_send_resp_req {
74 void *resp_buf; /* in */
75 unsigned int resp_len; /* in */
76};
77
78/*
79 * struct qseecom_load_img_data - for sending image length information and
80 * ion file descriptor to the qseecom driver. ion file descriptor is used
81 * for retrieving the ion file handle and in turn the physical address of
82 * the image location.
83 * @mdt_len - Length of the .mdt file in bytes.
84 * @img_len - Length of the .mdt + .b00 +..+.bxx images files in bytes
85 * @ion_fd - Ion file descriptor used when allocating memory.
86 * @img_name - Name of the image.
87*/
88struct qseecom_load_img_req {
89 uint32_t mdt_len; /* in */
90 uint32_t img_len; /* in */
91 int32_t ifd_data_fd; /* in */
92 char img_name[MAX_APP_NAME_SIZE]; /* in */
93 int app_id; /* out*/
94};
95
96struct qseecom_set_sb_mem_param_req {
97 int32_t ifd_data_fd; /* in */
98 uint32_t virt_sb_base; /* in */
99 uint32_t sb_len; /* in */
100};
101
102/*
103 * struct qseecom_qseos_version_req - get qseos version
104 * @qseos_version - version number
105 */
106struct qseecom_qseos_version_req {
107 unsigned int qseos_version; /* in */
108};
109
110#define QSEECOM_IOC_MAGIC 0x97
111
112
113#define QSEECOM_IOCTL_REGISTER_LISTENER_REQ \
114 _IOWR(QSEECOM_IOC_MAGIC, 1, struct qseecom_register_listener_req)
115
116#define QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ \
117 _IO(QSEECOM_IOC_MAGIC, 2)
118
119#define QSEECOM_IOCTL_SEND_CMD_REQ \
120 _IOWR(QSEECOM_IOC_MAGIC, 3, struct qseecom_send_cmd_req)
121
122#define QSEECOM_IOCTL_SEND_MODFD_CMD_REQ \
123 _IOWR(QSEECOM_IOC_MAGIC, 4, struct qseecom_send_modfd_cmd_req)
124
125#define QSEECOM_IOCTL_RECEIVE_REQ \
126 _IO(QSEECOM_IOC_MAGIC, 5)
127
128#define QSEECOM_IOCTL_SEND_RESP_REQ \
129 _IO(QSEECOM_IOC_MAGIC, 6)
130
131#define QSEECOM_IOCTL_LOAD_APP_REQ \
132 _IOWR(QSEECOM_IOC_MAGIC, 7, struct qseecom_load_img_req)
133
134#define QSEECOM_IOCTL_SET_MEM_PARAM_REQ \
135 _IOWR(QSEECOM_IOC_MAGIC, 8, struct qseecom_set_sb_mem_param_req)
136
137#define QSEECOM_IOCTL_UNLOAD_APP_REQ \
138 _IO(QSEECOM_IOC_MAGIC, 9)
139
140#define QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ \
141 _IOWR(QSEECOM_IOC_MAGIC, 10, struct qseecom_qseos_version_req)
142
143#define QSEECOM_IOCTL_PERF_ENABLE_REQ \
144 _IO(QSEECOM_IOC_MAGIC, 11)
145
146#define QSEECOM_IOCTL_PERF_DISABLE_REQ \
147 _IO(QSEECOM_IOC_MAGIC, 12)
148
149#endif /* __QSEECOM_H_ */