2 * Copyright (c) 2014, Linaro Limited
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
28 #ifndef PLATFORM_CONFIG_H
29 #define PLATFORM_CONFIG_H
33 /* Make stacks aligned to data cache line length */
34 #define STACK_ALIGNMENT 64
38 #error "Pager not supported for ARM64"
42 /* SDP enable but no pool defined: reserve 4MB for SDP tests */
43 #if defined(CFG_SECURE_DATA_PATH) && !defined(CFG_TEE_SDP_MEM_BASE)
44 #define CFG_TEE_SDP_MEM_TEST_SIZE 0x00400000
46 #define CFG_TEE_SDP_MEM_TEST_SIZE 0
49 #if defined(PLATFORM_FLAVOR_fvp)
51 #define GIC_BASE 0x2c000000
52 #define UART0_BASE 0x1c090000
53 #define UART1_BASE 0x1c0a0000
54 #define UART2_BASE 0x1c0b0000
55 #define UART3_BASE 0x1c0c0000
56 #define TZC400_BASE 0x2a4a0000
60 #define CONSOLE_UART_BASE UART1_BASE
61 #define IT_CONSOLE_UART IT_UART1
63 #elif defined(PLATFORM_FLAVOR_juno)
65 #define GIC_BASE 0x2c010000
68 #define UART0_BASE 0x1c090000
70 #define UART1_BASE 0x1c0a0000
72 #define UART2_BASE 0x7ff80000
74 #define UART3_BASE 0x7ff70000
77 #define UART0_CLK_IN_HZ 24000000
78 #define UART1_CLK_IN_HZ 24000000
79 #define UART2_CLK_IN_HZ 7273800
80 #define UART3_CLK_IN_HZ 7273800
85 #define CONSOLE_UART_BASE UART3_BASE
86 #define IT_CONSOLE_UART IT_UART3
87 #define CONSOLE_UART_CLK_IN_HZ UART3_CLK_IN_HZ
89 #elif defined(PLATFORM_FLAVOR_qemu_virt)
91 #define GIC_BASE 0x08000000
92 #define UART0_BASE 0x09000000
93 #define UART1_BASE 0x09040000
94 #define PCSC_BASE 0x09100000
99 #define CONSOLE_UART_BASE UART1_BASE
100 #define IT_CONSOLE_UART IT_UART1
102 #elif defined(PLATFORM_FLAVOR_qemu_armv8a)
104 #define UART0_BASE 0x09000000
105 #define UART1_BASE 0x09040000
107 #define CONSOLE_UART_BASE UART1_BASE
110 #error "Unknown platform flavor"
113 #if defined(PLATFORM_FLAVOR_fvp)
118 #define DRAM0_BASE 0x80000000
119 #define DRAM0_SIZE 0x80000000
121 #ifdef CFG_WITH_PAGER
124 #define TZSRAM_BASE (0x06000000)
125 #define TZSRAM_SIZE CFG_CORE_TZSRAM_EMUL_SIZE
127 #define TZDRAM_BASE (TZSRAM_BASE + CFG_TEE_RAM_VA_SIZE)
128 #define TZDRAM_SIZE (0x02000000 - CFG_TEE_RAM_VA_SIZE)
130 #else /*CFG_WITH_PAGER*/
132 /* Location of trusted dram on the base fvp */
133 #define TZDRAM_BASE 0x06000000
134 #define TZDRAM_SIZE 0x02000000
136 #endif /*CFG_WITH_PAGER*/
138 #define CFG_TEE_CORE_NB_CORE 8
140 #define CFG_SHMEM_START (DRAM0_BASE + 0x3000000)
141 #define CFG_SHMEM_SIZE 0x200000
143 #define GICC_OFFSET 0x0
144 #define GICD_OFFSET 0x3000000
146 #elif defined(PLATFORM_FLAVOR_juno)
151 #define DRAM0_BASE 0x80000000
152 #define DRAM0_SIZE 0x7F000000
154 #ifdef CFG_WITH_PAGER
157 #define TZSRAM_BASE 0xFF000000
158 #define TZSRAM_SIZE CFG_CORE_TZSRAM_EMUL_SIZE
160 #define TZDRAM_BASE (TZSRAM_BASE + CFG_TEE_RAM_VA_SIZE)
161 #define TZDRAM_SIZE (0x00E00000 - CFG_TEE_RAM_VA_SIZE)
163 #else /*CFG_WITH_PAGER*/
165 * Last part of DRAM is reserved as secure dram, note that the last 2MiB
166 * of DRAM0 is used by SCP dor DDR retraining.
168 #define TZDRAM_BASE 0xFF000000
171 * #define TZDRAM_SIZE 0x00FF8000
172 * but is smaller due to SECTION_SIZE alignment, can be fixed once
173 * OP-TEE OS is mapped using small pages instead.
175 #define TZDRAM_SIZE 0x00E00000
176 #endif /*CFG_WITH_PAGER*/
178 #define CFG_TEE_CORE_NB_CORE 6
180 #define CFG_SHMEM_START (DRAM0_BASE + DRAM0_SIZE - CFG_SHMEM_SIZE)
181 #define CFG_SHMEM_SIZE 0x200000
183 #define GICC_OFFSET 0x1f000
184 #define GICD_OFFSET 0
186 #elif defined(PLATFORM_FLAVOR_qemu_virt)
188 * QEMU virt specifics.
191 #define DRAM0_BASE UINTPTR_C(0x40000000)
192 #define DRAM0_SIZE (UINTPTR_C(0x42100000) - CFG_SHMEM_SIZE)
194 #define DRAM0_TEERES_BASE (DRAM0_BASE + DRAM0_SIZE)
195 #define DRAM0_TEERES_SIZE CFG_SHMEM_SIZE
197 #define SECRAM_BASE 0x0e000000
198 #define SECRAM_SIZE 0x01000000
200 #ifdef CFG_WITH_PAGER
203 #define TZSRAM_BASE SECRAM_BASE
204 #define TZSRAM_SIZE CFG_CORE_TZSRAM_EMUL_SIZE
206 #define TZDRAM_BASE (TZSRAM_BASE + TZSRAM_SIZE)
207 #define TZDRAM_SIZE (SECRAM_SIZE - TZSRAM_SIZE)
209 #else /* CFG_WITH_PAGER */
211 #define TZDRAM_BASE SECRAM_BASE
212 #define TZDRAM_SIZE SECRAM_SIZE
214 #endif /* CFG_WITH_PAGER */
216 #define CFG_TEE_CORE_NB_CORE 2
218 #define CFG_SHMEM_START (DRAM0_TEERES_BASE + \
219 (DRAM0_TEERES_SIZE - CFG_SHMEM_SIZE))
220 #define CFG_SHMEM_SIZE 0x200000
222 #define GICD_OFFSET 0
223 #define GICC_OFFSET 0x10000
226 #elif defined(PLATFORM_FLAVOR_qemu_armv8a)
228 #ifdef CFG_WITH_PAGER
229 #error "Pager not supported for platform vexpress-qemu_armv8a"
232 #define DRAM0_BASE UINTPTR_C(0x40000000)
233 #define DRAM0_SIZE (UINTPTR_C(0x40000000) - CFG_SHMEM_SIZE)
235 #define DRAM0_TEERES_BASE (DRAM0_BASE + DRAM0_SIZE)
236 #define DRAM0_TEERES_SIZE CFG_SHMEM_SIZE
238 #define SECRAM_BASE 0x0e000000
239 #define SECRAM_SIZE 0x01000000
241 /* First 1MByte of the secure RAM is reserved to ARM-TF runtime services */
242 #define TZDRAM_BASE (SECRAM_BASE + 0x00100000)
243 #define TZDRAM_SIZE (SECRAM_SIZE - 0x00100000)
245 #define CFG_TEE_CORE_NB_CORE 2
247 #define CFG_SHMEM_START (DRAM0_TEERES_BASE + \
248 (DRAM0_TEERES_SIZE - CFG_SHMEM_SIZE))
249 #define CFG_SHMEM_SIZE 0x200000
252 #error "Unknown platform flavor"
255 #define CFG_TEE_RAM_VA_SIZE (1024 * 1024)
257 #ifndef CFG_TEE_LOAD_ADDR
258 #define CFG_TEE_LOAD_ADDR CFG_TEE_RAM_START
261 #ifdef CFG_WITH_PAGER
263 * Have TZSRAM either as real physical or emulated by reserving an area
266 * +------------------+
267 * | TZSRAM | TEE_RAM |
268 * +--------+---------+
269 * | TZDRAM | TA_RAM |
271 * | | SDP RAM | (SDP test pool, optional)
272 * +--------+---------+
274 #define CFG_TEE_RAM_PH_SIZE TZSRAM_SIZE
275 #define CFG_TEE_RAM_START TZSRAM_BASE
276 #define CFG_TA_RAM_START ROUNDUP(TZDRAM_BASE, CORE_MMU_DEVICE_SIZE)
280 * Assumes that either TZSRAM isn't large enough or TZSRAM doesn't exist,
281 * everything is in TZDRAM.
282 * +------------------+
284 * | TZDRAM +---------+
287 * | | SDP RAM | (test pool, optional)
288 * +--------+---------+
290 #define CFG_TEE_RAM_PH_SIZE CFG_TEE_RAM_VA_SIZE
291 #define CFG_TEE_RAM_START TZDRAM_BASE
292 #define CFG_TA_RAM_START ROUNDUP(TZDRAM_BASE + CFG_TEE_RAM_VA_SIZE, \
293 CORE_MMU_DEVICE_SIZE)
296 #define CFG_TA_RAM_SIZE ROUNDDOWN(TZDRAM_SIZE - \
297 (CFG_TA_RAM_START - TZDRAM_BASE) - \
298 CFG_TEE_SDP_MEM_TEST_SIZE, \
299 CORE_MMU_DEVICE_SIZE)
301 /* Secure data path test memory pool: located at end of TA RAM */
302 #if CFG_TEE_SDP_MEM_TEST_SIZE
303 #define CFG_TEE_SDP_MEM_SIZE CFG_TEE_SDP_MEM_TEST_SIZE
304 #define CFG_TEE_SDP_MEM_BASE (TZDRAM_BASE + TZDRAM_SIZE - \
305 CFG_TEE_SDP_MEM_SIZE)
309 #define GICD_BASE (GIC_BASE + GICD_OFFSET)
310 #define GICC_BASE (GIC_BASE + GICC_OFFSET)
313 #ifndef UART_BAUDRATE
314 #define UART_BAUDRATE 115200
316 #ifndef CONSOLE_BAUDRATE
317 #define CONSOLE_BAUDRATE UART_BAUDRATE
320 /* For virtual platforms where there isn't a clock */
321 #ifndef CONSOLE_UART_CLK_IN_HZ
322 #define CONSOLE_UART_CLK_IN_HZ 1
325 #endif /*PLATFORM_CONFIG_H*/