1 /* 2 * 3 * sep_driver_config.h - Security Processor Driver configuration 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.06.26 Upgrade to Medfield 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 0 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 31 63 64 /* minimum data size of the MLLI table */ 65 #define SEP_DRIVER_MIN_DATA_SIZE_PER_TABLE 16 66 67 /* flag that signifies tah the lock is 68 currently held by the process (struct file) */ 69 #define SEP_DRIVER_OWN_LOCK_FLAG 1 70 71 /* flag that signifies tah the lock is currently NOT 72 held by the process (struct file) */ 73 #define SEP_DRIVER_DISOWN_LOCK_FLAG 0 74 75 /* indicates whether driver has mapped/unmapped shared area */ 76 #define SEP_REQUEST_DAEMON_MAPPED 1 77 #define SEP_REQUEST_DAEMON_UNMAPPED 0 78 79 #define SEP_DEV_NAME "sep_sec_driver" 80 #define SEP_DEV_SINGLETON "sep_sec_singleton_driver" 81 #define SEP_DEV_DAEMON "sep_req_daemon_driver" 82 83 /*-------------------------------------------------------- 84 SHARED AREA memory total size is 36K 85 it is divided is following: 86 87 SHARED_MESSAGE_AREA 8K } 88 } 89 STATIC_POOL_AREA 4K } MAPPED AREA ( 24 K) 90 } 91 DATA_POOL_AREA 12K } 92 93 SYNCHRONIC_DMA_TABLES_AREA 5K 94 95 placeholder until drver changes 96 FLOW_DMA_TABLES_AREA 4K 97 98 SYSTEM_MEMORY_AREA 3k 99 100 SYSTEM_MEMORY total size is 3k 101 it is divided as following: 102 103 TIME_MEMORY_AREA 8B 104 -----------------------------------------------------------*/ 105 106 #define SEP_DEV_NAME "sep_sec_driver" 107 #define SEP_DEV_SINGLETON "sep_sec_singleton_driver" 108 #define SEP_DEV_DAEMON "sep_req_daemon_driver" 109 110 111 /* 112 the maximum length of the message - the rest of the message shared 113 area will be dedicated to the dma lli tables 114 */ 115 #define SEP_DRIVER_MAX_MESSAGE_SIZE_IN_BYTES (8 * 1024) 116 117 /* the size of the message shared area in pages */ 118 #define SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES (8 * 1024) 119 120 /* the size of the data pool static area in pages */ 121 #define SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES (4 * 1024) 122 123 /* the size of the data pool shared area size in pages */ 124 #define SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES (16 * 1024) 125 126 /* the size of the message shared area in pages */ 127 #define SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES (1024 * 5) 128 129 /* Placeholder until driver changes */ 130 #define SEP_DRIVER_FLOW_DMA_TABLES_AREA_SIZE_IN_BYTES (1024 * 4) 131 132 /* system data (time, caller id etc') pool */ 133 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_SIZE_IN_BYTES (1024 * 3) 134 135 /* the size in bytes of the time memory */ 136 #define SEP_DRIVER_TIME_MEMORY_SIZE_IN_BYTES 8 137 138 /* the size in bytes of the RAR parameters memory */ 139 #define SEP_DRIVER_SYSTEM_RAR_MEMORY_SIZE_IN_BYTES 8 140 141 /* area size that is mapped - we map the MESSAGE AREA, STATIC POOL and 142 DATA POOL areas. area must be module 4k */ 143 #define SEP_DRIVER_MMMAP_AREA_SIZE (1024 * 28) 144 145 /*----------------------------------------------- 146 offsets of the areas starting from the shared area start address 147 */ 148 149 /* message area offset */ 150 #define SEP_DRIVER_MESSAGE_AREA_OFFSET_IN_BYTES 0 151 152 /* static pool area offset */ 153 #define SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES \ 154 (SEP_DRIVER_MESSAGE_SHARED_AREA_SIZE_IN_BYTES) 155 156 /* data pool area offset */ 157 #define SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES \ 158 (SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES + \ 159 SEP_DRIVER_STATIC_AREA_SIZE_IN_BYTES) 160 161 /* synhronic dma tables area offset */ 162 #define SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES \ 163 (SEP_DRIVER_DATA_POOL_AREA_OFFSET_IN_BYTES + \ 164 SEP_DRIVER_DATA_POOL_SHARED_AREA_SIZE_IN_BYTES) 165 166 /* system memory offset in bytes */ 167 #define SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES \ 168 (SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES + \ 169 SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES) 170 171 /* offset of the time area */ 172 #define SEP_DRIVER_SYSTEM_TIME_MEMORY_OFFSET_IN_BYTES \ 173 (SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES) 174 175 /* offset of the RAR area */ 176 #define SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES \ 177 (SEP_DRIVER_SYSTEM_TIME_MEMORY_OFFSET_IN_BYTES + \ 178 SEP_DRIVER_TIME_MEMORY_SIZE_IN_BYTES) 179 180 /* offset of the caller id area */ 181 #define SEP_CALLER_ID_OFFSET_BYTES \ 182 (SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES + \ 183 SEP_DRIVER_SYSTEM_RAR_MEMORY_SIZE_IN_BYTES) 184 185 /* offset of the DCB area */ 186 #define SEP_DRIVER_SYSTEM_DCB_MEMORY_OFFSET_IN_BYTES \ 187 (SEP_DRIVER_SYSTEM_DATA_MEMORY_OFFSET_IN_BYTES + \ 188 0x400) 189 190 /* offset of the ext cache area */ 191 #define SEP_DRIVER_SYSTEM_EXT_CACHE_ADDR_OFFSET_IN_BYTES \ 192 SEP_DRIVER_SYSTEM_RAR_MEMORY_OFFSET_IN_BYTES 193 194 /* offset of the allocation data pointer area */ 195 #define SEP_DRIVER_DATA_POOL_ALLOCATION_OFFSET_IN_BYTES \ 196 (SEP_CALLER_ID_OFFSET_BYTES + \ 197 SEP_CALLER_ID_HASH_SIZE_IN_BYTES) 198 199 /* the token that defines the start of time address */ 200 #define SEP_TIME_VAL_TOKEN 0x12345678 201 202 #define FAKE_RAR_SIZE (1024*1024) /* used only for mfld */ 203 /* DEBUG LEVEL MASKS */ 204 205 /* size of the caller id hash (sha2) */ 206 #define SEP_CALLER_ID_HASH_SIZE_IN_BYTES 32 207 208 /* size of the caller id hash (sha2) in 32 bit words */ 209 #define SEP_CALLER_ID_HASH_SIZE_IN_WORDS 8 210 211 /* maximum number of entries in the caller id table */ 212 #define SEP_CALLER_ID_TABLE_NUM_ENTRIES 20 213 214 /* maximum number of symetric operation (that require DMA resource) 215 per one message */ 216 #define SEP_MAX_NUM_SYNC_DMA_OPS 16 217 218 /* the token that defines the start of time address */ 219 #define SEP_RAR_VAL_TOKEN 0xABABABAB 220 221 /* ioctl error that should be returned when trying 222 to realloc the cache/resident second time */ 223 #define SEP_ALREADY_INITIALIZED_ERR 12 224 225 /* bit that locks access to the shared area */ 226 #define SEP_MMAP_LOCK_BIT 0 227 228 /* bit that lock access to the poll - after send_command */ 229 #define SEP_SEND_MSG_LOCK_BIT 1 230 231 /* the token that defines the static pool address address */ 232 #define SEP_STATIC_POOL_VAL_TOKEN 0xABBAABBA 233 234 /* the token that defines the data pool pointers address */ 235 #define SEP_DATA_POOL_POINTERS_VAL_TOKEN 0xEDDEEDDE 236 237 /* the token that defines the data pool pointers address */ 238 #define SEP_EXT_CACHE_ADDR_VAL_TOKEN 0xBABABABA 239 240 /* Time limit for SEP to finish */ 241 #define WAIT_TIME 10 242 243 #endif /* SEP DRIVER CONFIG */ 244