Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / sep / sep_driver_config.h
1 /*
2 *
3 * sep_driver_config.h - Security Processor Driver configuration
4 *
5 * Copyright(c) 2009 Intel Corporation. All rights reserved.
6 * Copyright(c) 2009 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; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program; if not, write to the Free Software Foundation, Inc., 59
20 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 * CONTACTS:
23 *
24 * Mark Allyn mark.a.allyn@intel.com
25 *
26 * CHANGES:
27 *
28 * 2009.06.26 Initial publish
29 *
30 */
31
32 #ifndef __SEP_DRIVER_CONFIG_H__
33 #define __SEP_DRIVER_CONFIG_H__
34
35
36 /*--------------------------------------
37 DRIVER CONFIGURATION FLAGS
38 -------------------------------------*/
39
40 /* if flag is on , then the driver is running in polling and
41 not interrupt mode */
42 #define SEP_DRIVER_POLLING_MODE 1
43
44 /* flag which defines if the shared area address should be
45 reconfiged (send to SEP anew) during init of the driver */
46 #define SEP_DRIVER_RECONFIG_MESSAGE_AREA 0
47
48 /* the mode for running on the ARM1172 Evaluation platform (flag is 1) */
49 #define SEP_DRIVER_ARM_DEBUG_MODE 0
50
51 /*-------------------------------------------
52 INTERNAL DATA CONFIGURATION
53 -------------------------------------------*/
54
55 /* flag for the input array */
56 #define SEP_DRIVER_IN_FLAG 0
57
58 /* flag for output array */
59 #define SEP_DRIVER_OUT_FLAG 1
60
61 /* maximum number of entries in one LLI tables */
62 #define SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP 8
63
64
65 /*--------------------------------------------------------
66 SHARED AREA memory total size is 36K
67 it is divided is following:
68
69 SHARED_MESSAGE_AREA 8K }
70 }
71 STATIC_POOL_AREA 4K } MAPPED AREA ( 24 K)
72 }
73 DATA_POOL_AREA 12K }
74
75 SYNCHRONIC_DMA_TABLES_AREA 5K
76
77 FLOW_DMA_TABLES_AREA 4K
78
79 SYSTEM_MEMORY_AREA 3k
80
81 SYSTEM_MEMORY total size is 3k
82 it is divided as following:
83
84 TIME_MEMORY_AREA 8B
85 -----------------------------------------------------------*/
86
87
88
89 /*
90 the maximum length of the message - the rest of the message shared
91 area will be dedicated to the dma lli tables
92 */
93 #define SEP_DRIVER_MAX_MESSAGE_SIZE_IN_BYTES (8 * 1024)
94
95 /* the size of the message shared area in pages */
96 #define SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES (8 * 1024)
97
98 /* the size of the data pool static area in pages */
99 #define SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES (4 * 1024)
100
101 /* the size of the data pool shared area size in pages */
102 #define SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES (12 * 1024)
103
104 /* the size of the message shared area in pages */
105 #define SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_SIZE_IN_BYTES (1024 * 5)
106
107
108 /* the size of the data pool shared area size in pages */
109 #define SEP_DRIVER_FLOW_DMA_TABLES_AREA_SIZE_IN_BYTES (1024 * 4)
110
111 /* system data (time, caller id etc') pool */
112 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_SIZE_IN_BYTES 100
113
114
115 /* area size that is mapped - we map the MESSAGE AREA, STATIC POOL and
116 DATA POOL areas. area must be module 4k */
117 #define SEP_DRIVER_MMMAP_AREA_SIZE (1024 * 24)
118
119
120 /*-----------------------------------------------
121 offsets of the areas starting from the shared area start address
122 */
123
124 /* message area offset */
125 #define SEP_DRIVER_MESSAGE_AREA_OFFSET_IN_BYTES 0
126
127 /* static pool area offset */
128 #define SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES \
129 (SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES)
130
131 /* data pool area offset */
132 #define SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES \
133 (SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES + \
134 SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES)
135
136 /* synhronic dma tables area offset */
137 #define SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES \
138 (SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES + \
139 SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES)
140
141 /* sep driver flow dma tables area offset */
142 #define SEP_DRIVER_FLOW_DMA_TABLES_AREA_OFFSET_IN_BYTES \
143 (SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_OFFSET_IN_BYTES + \
144 SEP_DRIVER_SYNCHRONIC_DMA_TABLES_AREA_SIZE_IN_BYTES)
145
146 /* system memory offset in bytes */
147 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES \
148 (SEP_DRIVER_FLOW_DMA_TABLES_AREA_OFFSET_IN_BYTES + \
149 SEP_DRIVER_FLOW_DMA_TABLES_AREA_SIZE_IN_BYTES)
150
151 /* offset of the time area */
152 #define SEP_DRIVER_SYSTEM_TIME_MEMORY_OFFSET_IN_BYTES \
153 (SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES)
154
155
156
157 /* start physical address of the SEP registers memory in HOST */
158 #define SEP_IO_MEM_REGION_START_ADDRESS 0x80000000
159
160 /* size of the SEP registers memory region in HOST (for now 100 registers) */
161 #define SEP_IO_MEM_REGION_SIZE (2 * 0x100000)
162
163 /* define the number of IRQ for SEP interrupts */
164 #define SEP_DIRVER_IRQ_NUM 1
165
166 /* maximum number of add buffers */
167 #define SEP_MAX_NUM_ADD_BUFFERS 100
168
169 /* number of flows */
170 #define SEP_DRIVER_NUM_FLOWS 4
171
172 /* maximum number of entries in flow table */
173 #define SEP_DRIVER_MAX_FLOW_NUM_ENTRIES_IN_TABLE 25
174
175 /* offset of the num entries in the block length entry of the LLI */
176 #define SEP_NUM_ENTRIES_OFFSET_IN_BITS 24
177
178 /* offset of the interrupt flag in the block length entry of the LLI */
179 #define SEP_INT_FLAG_OFFSET_IN_BITS 31
180
181 /* mask for extracting data size from LLI */
182 #define SEP_TABLE_DATA_SIZE_MASK 0xFFFFFF
183
184 /* mask for entries after being shifted left */
185 #define SEP_NUM_ENTRIES_MASK 0x7F
186
187 /* default flow id */
188 #define SEP_FREE_FLOW_ID 0xFFFFFFFF
189
190 /* temp flow id used during cretiong of new flow until receiving
191 real flow id from sep */
192 #define SEP_TEMP_FLOW_ID (SEP_DRIVER_NUM_FLOWS + 1)
193
194 /* maximum add buffers message length in bytes */
195 #define SEP_MAX_ADD_MESSAGE_LENGTH_IN_BYTES (7 * 4)
196
197 /* maximum number of concurrent virtual buffers */
198 #define SEP_MAX_VIRT_BUFFERS_CONCURRENT 100
199
200 /* the token that defines the start of time address */
201 #define SEP_TIME_VAL_TOKEN 0x12345678
202
203 /* DEBUG LEVEL MASKS */
204 #define SEP_DEBUG_LEVEL_BASIC 0x1
205
206 #define SEP_DEBUG_LEVEL_EXTENDED 0x4
207
208
209 /* Debug helpers */
210
211 #define dbg(fmt, args...) \
212 do {\
213 if (debug & SEP_DEBUG_LEVEL_BASIC) \
214 printk(KERN_DEBUG fmt, ##args); \
215 } while(0);
216
217 #define edbg(fmt, args...) \
218 do { \
219 if (debug & SEP_DEBUG_LEVEL_EXTENDED) \
220 printk(KERN_DEBUG fmt, ##args); \
221 } while(0);
222
223
224
225 #endif