]> Pileus Git - ~andy/linux/blob - drivers/staging/sep/sep_driver_api.h
staging/comedi/me4000: fix sparse warning "obsolete struct initializer"
[~andy/linux] / drivers / staging / sep / sep_driver_api.h
1 /*
2  *
3  *  sep_driver_api.h - Security Processor Driver api definitions
4  *
5  *  Copyright(c) 2009,2010 Intel Corporation. All rights reserved.
6  *  Contributions(c) 2009,2010 Discretix. All rights reserved.
7  *
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.
11  *
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
15  *  more details.
16  *
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.
20  *
21  *  CONTACTS:
22  *
23  *  Mark Allyn          mark.a.allyn@intel.com
24  *  Jayant Mangalampalli jayant.mangalampalli@intel.com
25  *
26  *  CHANGES:
27  *
28  *  2010.09.14  Upgrade to Medfield
29  *
30  */
31
32 #ifndef __SEP_DRIVER_API_H__
33 #define __SEP_DRIVER_API_H__
34
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
39
40
41 /*-------------------------------------------
42     TYPEDEFS
43 ----------------------------------------------*/
44
45 /*
46  * Note that several members of these structres are only here
47  * for campatability with the middleware; they are not used
48  * by this driver.
49  * All user space buffer addresses are set to aligned u64
50  * in order to ensure compatibility with 64 bit systems
51  */
52
53 /*
54   init command struct; this will go away when SCU does init
55 */
56 struct init_struct {
57         /* address that SEP can access for message */
58         aligned_u64   message_addr;
59
60         /* message size */
61         u32   message_size_in_words;
62
63         /* offset of the init message in the sep sram */
64         u32   sep_sram_addr;
65
66         /* -not used- resident size in bytes*/
67         u32   unused_resident_size_in_bytes;
68
69         /* -not used- cache size in bytes*/
70         u32   unused_cache_size_in_bytes;
71
72         /* -not used- ext cache current address */
73         aligned_u64   unused_extcache_addr;
74
75         /* -not used- ext cache size in bytes*/
76         u32   unused_extcache_size_in_bytes;
77 };
78
79 struct realloc_ext_struct {
80         /* -not used- current external cache address */
81         aligned_u64   unused_ext_cache_addr;
82
83         /* -not used- external cache size in bytes*/
84         u32   unused_ext_cache_size_in_bytes;
85 };
86
87 struct alloc_struct {
88         /* offset from start of shared pool area */
89         u32  offset;
90         /* number of bytes to allocate */
91         u32  num_bytes;
92 };
93
94 /*
95         Note that all app addresses are cast as u32; the sep
96         middleware sends them as fixed 32 bit words
97 */
98 struct bld_syn_tab_struct {
99         /* address value of the data in (user space addr) */
100         aligned_u64 app_in_address;
101
102         /* size of data in */
103         u32 data_in_size;
104
105         /* address of the data out (user space addr) */
106         aligned_u64 app_out_address;
107
108         /* the size of the block of the operation - if needed,
109            every table will be modulo this parameter */
110         u32 block_size;
111
112         /* -not used- distinct user/kernel layout */
113         bool isKernelVirtualAddress;
114
115 };
116
117 /* command struct for getting caller id value and address */
118 struct caller_id_struct {
119         /* pid of the process */
120         u32 pid;
121         /* virtual address of the caller id hash */
122         aligned_u64 callerIdAddress;
123         /* caller id hash size in bytes */
124         u32 callerIdSizeInBytes;
125 };
126
127 /*
128   structure that represents DCB
129 */
130 struct sep_dcblock {
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 */
144         aligned_u64 out_vr_tail_pt;
145         /* size of tail data */
146         u32     tail_data_size;
147         /* input tail data array */
148         u8      tail_data[68];
149 };
150
151 struct sep_caller_id_entry {
152         int pid;
153         unsigned char callerIdHash[SEP_CALLER_ID_HASH_SIZE_IN_BYTES];
154 };
155
156 /*
157         command structure for building dcb block (currently for ext app only
158 */
159 struct build_dcb_struct {
160         /* address value of the data in */
161         aligned_u64 app_in_address;
162         /* size of data in */
163         u32  data_in_size;
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 */
168         u32  block_size;
169         /* the size of the block of the operation - if needed,
170         every table will be modulo this parameter */
171         u32  tail_block_size;
172 };
173
174 /**
175  * @struct sep_dma_map
176  *
177  * Structure that contains all information needed for mapping the user pages
178  *           or kernel buffers for dma operations
179  *
180  *
181  */
182 struct sep_dma_map {
183         /* mapped dma address */
184         dma_addr_t    dma_addr;
185         /* size of the mapped data */
186         size_t        size;
187 };
188
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;
193
194         /* array of pointers to the pages that represent out
195         data for the synchronic DMA action */
196         struct page **out_page_array;
197
198         /* number of pages in the sep_in_page_array */
199         u32 in_num_pages;
200
201         /* number of pages in the sep_out_page_array */
202         u32 out_num_pages;
203
204         /* map array of the input data */
205         struct sep_dma_map *in_map_array;
206
207         /* map array of the output data */
208         struct sep_dma_map *out_map_array;
209
210         /* number of entries of the input mapp array */
211         u32 in_map_num_entries;
212
213         /* number of entries of the output mapp array */
214         u32 out_map_num_entries;
215 };
216
217
218 /* command struct for translating rar handle to bus address
219    and setting it at predefined location */
220 struct rar_hndl_to_bus_struct {
221
222         /* rar handle */
223         aligned_u64 rar_handle;
224 };
225
226 /*
227   structure that represent one entry in the DMA LLI table
228 */
229 struct sep_lli_entry {
230         /* physical address */
231         u32 bus_address;
232
233         /* block size */
234         u32 block_size;
235 };
236
237 /*----------------------------------------------------------------
238         IOCTL command defines
239         -----------------------------------------------------------------*/
240
241 /* magic number 1 of the sep IOCTL command */
242 #define SEP_IOC_MAGIC_NUMBER                         's'
243
244 /* sends interrupt to sep that message is ready */
245 #define SEP_IOCSENDSEPCOMMAND    \
246         _IO(SEP_IOC_MAGIC_NUMBER, 0)
247
248 /* sends interrupt to sep that message is ready */
249 #define SEP_IOCSENDSEPRPLYCOMMAND        \
250         _IO(SEP_IOC_MAGIC_NUMBER, 1)
251
252 /* allocate memory in data pool */
253 #define SEP_IOCALLOCDATAPOLL    \
254         _IOW(SEP_IOC_MAGIC_NUMBER, 2, struct alloc_struct)
255
256 /* create sym dma lli tables */
257 #define SEP_IOCCREATESYMDMATABLE        \
258         _IOW(SEP_IOC_MAGIC_NUMBER, 5, struct bld_syn_tab_struct)
259
260 /* free dynamic data aalocated during table creation */
261 #define SEP_IOCFREEDMATABLEDATA  \
262         _IO(SEP_IOC_MAGIC_NUMBER, 7)
263
264 /* get the static pool area addersses (physical and virtual) */
265 #define SEP_IOCGETSTATICPOOLADDR        \
266         _IO(SEP_IOC_MAGIC_NUMBER, 8)
267
268 /* start sep command */
269 #define SEP_IOCSEPSTART  \
270         _IO(SEP_IOC_MAGIC_NUMBER, 12)
271
272 /* init sep command */
273 #define SEP_IOCSEPINIT  \
274         _IOW(SEP_IOC_MAGIC_NUMBER, 13, struct init_struct)
275
276 /* end transaction command */
277 #define SEP_IOCENDTRANSACTION    \
278         _IO(SEP_IOC_MAGIC_NUMBER, 15)
279
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)
284
285 #define SEP_IOCRARPREPAREMESSAGE        \
286         _IOW(SEP_IOC_MAGIC_NUMBER, 20, struct rar_hndl_to_bus_struct)
287
288 #define SEP_IOCTLSETCALLERID    \
289         _IOW(SEP_IOC_MAGIC_NUMBER, 34, struct caller_id_struct)
290
291 #define SEP_IOCPREPAREDCB                                       \
292         _IOW(SEP_IOC_MAGIC_NUMBER, 35, struct build_dcb_struct)
293
294 #define SEP_IOCFREEDCB                                  \
295         _IO(SEP_IOC_MAGIC_NUMBER, 36)
296
297 #endif