Include missing linux/slab.h inclusions
[linux-2.6.git] / drivers / staging / sep / sep_driver_config.h
blob7d7c7ab610b7d53f00539575d670272eb156422e
1 /*
3 * sep_driver_config.h - Security Processor Driver configuration
5 * Copyright(c) 2009-2011 Intel Corporation. All rights reserved.
6 * Contributions(c) 2009-2011 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
15 * more details.
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.
21 * CONTACTS:
23 * Mark Allyn mark.a.allyn@intel.com
24 * Jayant Mangalampalli jayant.mangalampalli@intel.com
26 * CHANGES:
28 * 2010.06.26 Upgrade to Medfield
29 * 2011.02.22 Enable kernel crypto
33 #ifndef __SEP_DRIVER_CONFIG_H__
34 #define __SEP_DRIVER_CONFIG_H__
37 /*--------------------------------------
38 DRIVER CONFIGURATION FLAGS
39 -------------------------------------*/
41 /* if flag is on , then the driver is running in polling and
42 not interrupt mode */
43 #define SEP_DRIVER_POLLING_MODE 0
45 /* flag which defines if the shared area address should be
46 reconfigured (send to SEP anew) during init of the driver */
47 #define SEP_DRIVER_RECONFIG_MESSAGE_AREA 0
49 /* the mode for running on the ARM1172 Evaluation platform (flag is 1) */
50 #define SEP_DRIVER_ARM_DEBUG_MODE 0
52 /* Critical message area contents for sanity checking */
53 #define SEP_START_MSG_TOKEN 0x02558808
54 /*-------------------------------------------
55 INTERNAL DATA CONFIGURATION
56 -------------------------------------------*/
58 /* flag for the input array */
59 #define SEP_DRIVER_IN_FLAG 0
61 /* flag for output array */
62 #define SEP_DRIVER_OUT_FLAG 1
64 /* maximum number of entries in one LLI tables */
65 #define SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP 31
67 /* minimum data size of the MLLI table */
68 #define SEP_DRIVER_MIN_DATA_SIZE_PER_TABLE 16
70 /* flag that signifies tah the lock is
71 currently held by the process (struct file) */
72 #define SEP_DRIVER_OWN_LOCK_FLAG 1
74 /* flag that signifies tah the lock is currently NOT
75 held by the process (struct file) */
76 #define SEP_DRIVER_DISOWN_LOCK_FLAG 0
78 /* indicates whether driver has mapped/unmapped shared area */
79 #define SEP_REQUEST_DAEMON_MAPPED 1
80 #define SEP_REQUEST_DAEMON_UNMAPPED 0
82 /*--------------------------------------------------------
83 SHARED AREA memory total size is 36K
84 it is divided is following:
86 SHARED_MESSAGE_AREA 8K }
88 STATIC_POOL_AREA 4K } MAPPED AREA ( 24 K)
90 DATA_POOL_AREA 12K }
92 SYNCHRONIC_DMA_TABLES_AREA 29K
94 placeholder until drver changes
95 FLOW_DMA_TABLES_AREA 4K
97 SYSTEM_MEMORY_AREA 3k
99 SYSTEM_MEMORY total size is 3k
100 it is divided as following:
102 TIME_MEMORY_AREA 8B
103 -----------------------------------------------------------*/
105 #define SEP_DEV_NAME "sep_sec_driver"
106 #define SEP_DEV_SINGLETON "sep_sec_singleton_driver"
107 #define SEP_DEV_DAEMON "sep_req_daemon_driver"
111 the minimum length of the message - includes 2 reserved fields
112 at the start, then token, message size and opcode fields. all dwords
114 #define SEP_DRIVER_MIN_MESSAGE_SIZE_IN_BYTES (5*sizeof(u32))
117 the maximum length of the message - the rest of the message shared
118 area will be dedicated to the dma lli tables
120 #define SEP_DRIVER_MAX_MESSAGE_SIZE_IN_BYTES (8 * 1024)
122 /* the size of the message shared area in pages */
123 #define SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES (8 * 1024)
125 /* the size of the data pool static area in pages */
126 #define SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES (4 * 1024)
128 /* the size of the data pool shared area size in pages */
129 #define SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES (16 * 1024)
131 /* the size of the message shared area in pages */
132 #define SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES (1024 * 29)
134 /* Placeholder until driver changes */
135 #define SEP_DRIVER_FLOW_DMA_TABLES_AREA_SIZE_IN_BYTES (1024 * 4)
137 /* system data (time, caller id etc') pool */
138 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_SIZE_IN_BYTES (1024 * 3)
140 /* Offset of the sep printf buffer in the message area */
141 #define SEP_DRIVER_PRINTF_OFFSET_IN_BYTES (5888)
143 /* the size in bytes of the time memory */
144 #define SEP_DRIVER_TIME_MEMORY_SIZE_IN_BYTES 8
146 /* the size in bytes of the RAR parameters memory */
147 #define SEP_DRIVER_SYSTEM_RAR_MEMORY_SIZE_IN_BYTES 8
149 /* area size that is mapped - we map the MESSAGE AREA, STATIC POOL and
150 DATA POOL areas. area must be module 4k */
151 #define SEP_DRIVER_MMMAP_AREA_SIZE (1024 * 28)
153 /*-----------------------------------------------
154 offsets of the areas starting from the shared area start address
157 /* message area offset */
158 #define SEP_DRIVER_MESSAGE_AREA_OFFSET_IN_BYTES 0
160 /* static pool area offset */
161 #define SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES \
162 (SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES)
164 /* data pool area offset */
165 #define SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES \
166 (SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES + \
167 SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES)
169 /* synchronic dma tables area offset */
170 #define SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES \
171 (SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES + \
172 SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES)
174 /* system memory offset in bytes */
175 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES \
176 (SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES + \
177 SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES)
179 /* offset of the time area */
180 #define SEP_DRIVER_SYSTEM_TIME_MEMORY_OFFSET_IN_BYTES \
181 (SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES)
183 /* offset of the RAR area */
184 #define SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES \
185 (SEP_DRIVER_SYSTEM_TIME_MEMORY_OFFSET_IN_BYTES + \
186 SEP_DRIVER_TIME_MEMORY_SIZE_IN_BYTES)
188 /* offset of the caller id area */
189 #define SEP_CALLER_ID_OFFSET_BYTES \
190 (SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES + \
191 SEP_DRIVER_SYSTEM_RAR_MEMORY_SIZE_IN_BYTES)
193 /* offset of the DCB area */
194 #define SEP_DRIVER_SYSTEM_DCB_MEMORY_OFFSET_IN_BYTES \
195 (SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES + \
196 0x400)
198 /* offset of the ext cache area */
199 #define SEP_DRIVER_SYSTEM_EXT_CACHE_ADDR_OFFSET_IN_BYTES \
200 SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES
202 /* offset of the allocation data pointer area */
203 #define SEP_DRIVER_DATA_POOL_ALLOCATION_OFFSET_IN_BYTES \
204 (SEP_CALLER_ID_OFFSET_BYTES + \
205 SEP_CALLER_ID_HASH_SIZE_IN_BYTES)
207 /* the token that defines the start of time address */
208 #define SEP_TIME_VAL_TOKEN 0x12345678
210 #define FAKE_RAR_SIZE (1024*1024) /* used only for mfld */
211 /* DEBUG LEVEL MASKS */
213 /* size of the caller id hash (sha2) */
214 #define SEP_CALLER_ID_HASH_SIZE_IN_BYTES 32
216 /* size of the caller id hash (sha2) in 32 bit words */
217 #define SEP_CALLER_ID_HASH_SIZE_IN_WORDS 8
219 /* maximum number of entries in the caller id table */
220 #define SEP_CALLER_ID_TABLE_NUM_ENTRIES 20
222 /* maximum number of symetric operation (that require DMA resource)
223 per one message */
224 #define SEP_MAX_NUM_SYNC_DMA_OPS 16
226 /* the token that defines the start of time address */
227 #define SEP_RAR_VAL_TOKEN 0xABABABAB
229 /* ioctl error that should be returned when trying
230 to realloc the cache/resident second time */
231 #define SEP_ALREADY_INITIALIZED_ERR 12
233 /* bit that locks access to the shared area */
234 #define SEP_TRANSACTION_STARTED_LOCK_BIT 0
236 /* bit that lock access to the poll - after send_command */
237 #define SEP_WORKING_LOCK_BIT 1
239 /* the token that defines the static pool address address */
240 #define SEP_STATIC_POOL_VAL_TOKEN 0xABBAABBA
242 /* the token that defines the data pool pointers address */
243 #define SEP_DATA_POOL_POINTERS_VAL_TOKEN 0xEDDEEDDE
245 /* the token that defines the data pool pointers address */
246 #define SEP_EXT_CACHE_ADDR_VAL_TOKEN 0xBABABABA
248 /* Time limit for SEP to finish */
249 #define WAIT_TIME 10
251 /* Delay for pm runtime suspend (reduces pm thrashing with bursty traffic */
252 #define SUSPEND_DELAY 10
254 /* Number of delays to wait until scu boots after runtime resume */
255 #define SCU_DELAY_MAX 50
257 /* Delay for each iteration (usec) wait for scu boots after runtime resume */
258 #define SCU_DELAY_ITERATION 10
262 * Bits used in struct sep_call_status to check that
263 * driver's APIs are called in valid order
266 /* Bit offset which indicates status of sep_write() */
267 #define SEP_FASTCALL_WRITE_DONE_OFFSET 0
269 /* Bit offset which indicates status of sep_mmap() */
270 #define SEP_LEGACY_MMAP_DONE_OFFSET 1
272 /* Bit offset which indicates status of the SEP_IOCSENDSEPCOMMAND ioctl */
273 #define SEP_LEGACY_SENDMSG_DONE_OFFSET 2
275 /* Bit offset which indicates status of sep_poll() */
276 #define SEP_LEGACY_POLL_DONE_OFFSET 3
278 /* Bit offset which indicates status of the SEP_IOCENDTRANSACTION ioctl */
279 #define SEP_LEGACY_ENDTRANSACTION_DONE_OFFSET 4
282 * Used to limit number of concurrent processes
283 * allowed to allocate dynamic buffers in fastcall
284 * interface.
286 #define SEP_DOUBLEBUF_USERS_LIMIT 3
288 /* Identifier for valid fastcall header */
289 #define SEP_FC_MAGIC 0xFFAACCAA
292 * Used for enabling driver runtime power management.
293 * Useful for enabling/disabling it during performance
294 * testing
296 #define SEP_ENABLE_RUNTIME_PM
298 #endif /* SEP DRIVER CONFIG */