3 * sep_driver_api.h - Security Processor Driver api definitions
5 * Copyright(c) 2009,2010 Intel Corporation. All rights reserved.
6 * Contributions(c) 2009,2010 Discretix. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * Mark Allyn mark.a.allyn@intel.com
24 * Jayant Mangalampalli jayant.mangalampalli@intel.com
28 * 2010.09.14 Upgrade to Medfield
32 #ifndef __SEP_DRIVER_API_H__
33 #define __SEP_DRIVER_API_H__
35 /* Type of request from device */
36 #define SEP_DRIVER_SRC_REPLY 1
37 #define SEP_DRIVER_SRC_REQ 2
38 #define SEP_DRIVER_SRC_PRINTF 3
41 /*-------------------------------------------
43 ----------------------------------------------*/
46 * Note that several members of these structres are only here
47 * for campatability with the middleware; they are not used
49 * All user space buffer addresses are set to aligned u64
50 * in order to ensure compatibility with 64 bit systems
54 init command struct; this will go away when SCU does init
57 /* address that SEP can access for message */
58 aligned_u64 message_addr;
61 u32 message_size_in_words;
63 /* offset of the init message in the sep sram */
66 /* -not used- resident size in bytes*/
67 u32 unused_resident_size_in_bytes;
69 /* -not used- cache size in bytes*/
70 u32 unused_cache_size_in_bytes;
72 /* -not used- ext cache current address */
73 aligned_u64 unused_extcache_addr;
75 /* -not used- ext cache size in bytes*/
76 u32 unused_extcache_size_in_bytes;
79 struct realloc_ext_struct {
80 /* -not used- current external cache address */
81 aligned_u64 unused_ext_cache_addr;
83 /* -not used- external cache size in bytes*/
84 u32 unused_ext_cache_size_in_bytes;
88 /* offset from start of shared pool area */
90 /* number of bytes to allocate */
95 Note that all app addresses are cast as u32; the sep
96 middleware sends them as fixed 32 bit words
98 struct bld_syn_tab_struct {
99 /* address value of the data in (user space addr) */
100 aligned_u64 app_in_address;
102 /* size of data in */
105 /* address of the data out (user space addr) */
106 aligned_u64 app_out_address;
108 /* the size of the block of the operation - if needed,
109 every table will be modulo this parameter */
112 /* -not used- distinct user/kernel layout */
113 bool isKernelVirtualAddress;
117 /* command struct for getting caller id value and address */
118 struct caller_id_struct {
119 /* pid of the process */
121 /* virtual address of the caller id hash */
122 aligned_u64 callerIdAddress;
123 /* caller id hash size in bytes */
124 u32 callerIdSizeInBytes;
128 structure that represents DCB
131 /* physical address of the first input mlli */
132 u32 input_mlli_address;
133 /* num of entries in the first input mlli */
134 u32 input_mlli_num_entries;
135 /* size of data in the first input mlli */
136 u32 input_mlli_data_size;
137 /* physical address of the first output mlli */
138 u32 output_mlli_address;
139 /* num of entries in the first output mlli */
140 u32 output_mlli_num_entries;
141 /* size of data in the first output mlli */
142 u32 output_mlli_data_size;
143 /* pointer to the output virtual tail */
145 /* size of tail data */
147 /* input tail data array */
151 struct sep_caller_id_entry {
153 unsigned char callerIdHash[SEP_CALLER_ID_HASH_SIZE_IN_BYTES];
157 command structure for building dcb block (currently for ext app only
159 struct build_dcb_struct {
160 /* address value of the data in */
161 aligned_u64 app_in_address;
162 /* size of data in */
164 /* address of the data out */
165 aligned_u64 app_out_address;
166 /* the size of the block of the operation - if needed,
167 every table will be modulo this parameter */
169 /* the size of the block of the operation - if needed,
170 every table will be modulo this parameter */
175 * @struct sep_dma_map
177 * Structure that contains all information needed for mapping the user pages
178 * or kernel buffers for dma operations
183 /* mapped dma address */
185 /* size of the mapped data */
189 struct sep_dma_resource {
190 /* array of pointers to the pages that represent
191 input data for the synchronic DMA action */
192 struct page **in_page_array;
194 /* array of pointers to the pages that represent out
195 data for the synchronic DMA action */
196 struct page **out_page_array;
198 /* number of pages in the sep_in_page_array */
201 /* number of pages in the sep_out_page_array */
204 /* map array of the input data */
205 struct sep_dma_map *in_map_array;
207 /* map array of the output data */
208 struct sep_dma_map *out_map_array;
210 /* number of entries of the input mapp array */
211 u32 in_map_num_entries;
213 /* number of entries of the output mapp array */
214 u32 out_map_num_entries;
218 /* command struct for translating rar handle to bus address
219 and setting it at predefined location */
220 struct rar_hndl_to_bus_struct {
223 aligned_u64 rar_handle;
227 structure that represent one entry in the DMA LLI table
229 struct sep_lli_entry {
230 /* physical address */
237 /*----------------------------------------------------------------
238 IOCTL command defines
239 -----------------------------------------------------------------*/
241 /* magic number 1 of the sep IOCTL command */
242 #define SEP_IOC_MAGIC_NUMBER 's'
244 /* sends interrupt to sep that message is ready */
245 #define SEP_IOCSENDSEPCOMMAND \
246 _IO(SEP_IOC_MAGIC_NUMBER, 0)
248 /* sends interrupt to sep that message is ready */
249 #define SEP_IOCSENDSEPRPLYCOMMAND \
250 _IO(SEP_IOC_MAGIC_NUMBER, 1)
252 /* allocate memory in data pool */
253 #define SEP_IOCALLOCDATAPOLL \
254 _IOW(SEP_IOC_MAGIC_NUMBER, 2, struct alloc_struct)
256 /* create sym dma lli tables */
257 #define SEP_IOCCREATESYMDMATABLE \
258 _IOW(SEP_IOC_MAGIC_NUMBER, 5, struct bld_syn_tab_struct)
260 /* free dynamic data aalocated during table creation */
261 #define SEP_IOCFREEDMATABLEDATA \
262 _IO(SEP_IOC_MAGIC_NUMBER, 7)
264 /* get the static pool area addersses (physical and virtual) */
265 #define SEP_IOCGETSTATICPOOLADDR \
266 _IO(SEP_IOC_MAGIC_NUMBER, 8)
268 /* start sep command */
269 #define SEP_IOCSEPSTART \
270 _IO(SEP_IOC_MAGIC_NUMBER, 12)
272 /* init sep command */
273 #define SEP_IOCSEPINIT \
274 _IOW(SEP_IOC_MAGIC_NUMBER, 13, struct init_struct)
276 /* end transaction command */
277 #define SEP_IOCENDTRANSACTION \
278 _IO(SEP_IOC_MAGIC_NUMBER, 15)
280 /* reallocate external app; unused structure still needed for
281 * compatability with middleware */
282 #define SEP_IOCREALLOCEXTCACHE \
283 _IOW(SEP_IOC_MAGIC_NUMBER, 18, struct realloc_ext_struct)
285 #define SEP_IOCRARPREPAREMESSAGE \
286 _IOW(SEP_IOC_MAGIC_NUMBER, 20, struct rar_hndl_to_bus_struct)
288 #define SEP_IOCTLSETCALLERID \
289 _IOW(SEP_IOC_MAGIC_NUMBER, 34, struct caller_id_struct)
291 #define SEP_IOCPREPAREDCB \
292 _IOW(SEP_IOC_MAGIC_NUMBER, 35, struct build_dcb_struct)
294 #define SEP_IOCFREEDCB \
295 _IO(SEP_IOC_MAGIC_NUMBER, 36)