blob: b0460e08fb4e0d811de76ce5d1617523acdf6e72 [file] [log] [blame]
Dan Handleyed6ff952014-05-14 17:44:19 +01001/*
2 * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef __PLATFORM_DEF_H__
32#define __PLATFORM_DEF_H__
33
34#include <arch.h>
Dan Handley4fd2f5c2014-08-04 11:41:20 +010035#include "../fvp_def.h"
Dan Handleyed6ff952014-05-14 17:44:19 +010036
37
38/*******************************************************************************
39 * Platform binary types for linking
40 ******************************************************************************/
41#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
42#define PLATFORM_LINKER_ARCH aarch64
43
44/*******************************************************************************
45 * Generic platform constants
46 ******************************************************************************/
47
48/* Size of cacheable stacks */
Soby Mathew0b6c7062014-08-04 16:02:05 +010049#if DEBUG_XLAT_TABLE
50#define PLATFORM_STACK_SIZE 0x800
51#elif IMAGE_BL1
52#define PLATFORM_STACK_SIZE 0x440
53#elif IMAGE_BL2
54#define PLATFORM_STACK_SIZE 0x400
55#elif IMAGE_BL31
56#define PLATFORM_STACK_SIZE 0x400
57#elif IMAGE_BL32
58#define PLATFORM_STACK_SIZE 0x440
59#endif
Dan Handleyed6ff952014-05-14 17:44:19 +010060
Dan Handley91b624e2014-07-29 17:14:00 +010061#define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
Dan Handleyed6ff952014-05-14 17:44:19 +010062
63/* Trusted Boot Firmware BL2 */
64#define BL2_IMAGE_NAME "bl2.bin"
65
66/* EL3 Runtime Firmware BL31 */
67#define BL31_IMAGE_NAME "bl31.bin"
68
69/* Secure Payload BL32 (Trusted OS) */
70#define BL32_IMAGE_NAME "bl32.bin"
71
72/* Non-Trusted Firmware BL33 */
73#define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */
74
75#define PLATFORM_CACHE_LINE_SIZE 64
76#define PLATFORM_CLUSTER_COUNT 2ull
77#define PLATFORM_CLUSTER0_CORE_COUNT 4
78#define PLATFORM_CLUSTER1_CORE_COUNT 4
79#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
80 PLATFORM_CLUSTER0_CORE_COUNT)
81#define PLATFORM_MAX_CPUS_PER_CLUSTER 4
Andrew Thoelke56f44702014-06-20 00:36:14 +010082#define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \
83 PLATFORM_CORE_COUNT)
Dan Handleyed6ff952014-05-14 17:44:19 +010084#define MAX_IO_DEVICES 3
85#define MAX_IO_HANDLES 4
86
87/*******************************************************************************
Dan Handleyed6ff952014-05-14 17:44:19 +010088 * BL1 specific defines.
89 * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
90 * addresses.
91 ******************************************************************************/
Juan Castillo0c70c572014-08-12 13:04:43 +010092#define BL1_RO_BASE FVP_TRUSTED_ROM_BASE
93#define BL1_RO_LIMIT (FVP_TRUSTED_ROM_BASE \
94 + FVP_TRUSTED_ROM_SIZE)
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +010095/*
Juan Castillo42a617d2014-09-24 10:00:06 +010096 * Put BL1 RW at the top of the Trusted SRAM. BL1_RW_BASE is calculated using
97 * the current BL1 RW debug size plus a little space for growth.
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +010098 */
Juan Castillo42a617d2014-09-24 10:00:06 +010099#define BL1_RW_BASE (FVP_TRUSTED_SRAM_BASE \
100 + FVP_TRUSTED_SRAM_SIZE - 0x6000)
101#define BL1_RW_LIMIT (FVP_TRUSTED_SRAM_BASE \
102 + FVP_TRUSTED_SRAM_SIZE)
Dan Handleyed6ff952014-05-14 17:44:19 +0100103
104/*******************************************************************************
105 * BL2 specific defines.
106 ******************************************************************************/
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +0100107/*
108 * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug
109 * size plus a little space for growth.
110 */
111#define BL2_BASE (BL31_BASE - 0xC000)
112#define BL2_LIMIT BL31_BASE
Dan Handleyed6ff952014-05-14 17:44:19 +0100113
114/*******************************************************************************
115 * BL31 specific defines.
116 ******************************************************************************/
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +0100117/*
Juan Castillo42a617d2014-09-24 10:00:06 +0100118 * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the
119 * current BL3-1 debug size plus a little space for growth.
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +0100120 */
Juan Castillo42a617d2014-09-24 10:00:06 +0100121#define BL31_BASE (FVP_TRUSTED_SRAM_BASE \
122 + FVP_TRUSTED_SRAM_SIZE - 0x1D000)
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +0100123#define BL31_PROGBITS_LIMIT BL1_RW_BASE
Juan Castillo42a617d2014-09-24 10:00:06 +0100124#define BL31_LIMIT (FVP_TRUSTED_SRAM_BASE \
125 + FVP_TRUSTED_SRAM_SIZE)
Dan Handleyed6ff952014-05-14 17:44:19 +0100126
127/*******************************************************************************
128 * BL32 specific defines.
129 ******************************************************************************/
130/*
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000131 * On FVP, the TSP can execute from Trusted SRAM, Trusted DRAM or the DRAM
132 * region secured by the TrustZone controller.
Dan Handleyed6ff952014-05-14 17:44:19 +0100133 */
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000134#if FVP_TSP_RAM_LOCATION_ID == FVP_TRUSTED_SRAM_ID
Juan Castillo0c70c572014-08-12 13:04:43 +0100135# define TSP_SEC_MEM_BASE FVP_TRUSTED_SRAM_BASE
136# define TSP_SEC_MEM_SIZE FVP_TRUSTED_SRAM_SIZE
Dan Handley4fd2f5c2014-08-04 11:41:20 +0100137# define TSP_PROGBITS_LIMIT BL2_BASE
Juan Castillo0c70c572014-08-12 13:04:43 +0100138# define BL32_BASE FVP_TRUSTED_SRAM_BASE
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +0100139# define BL32_LIMIT BL31_BASE
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000140#elif FVP_TSP_RAM_LOCATION_ID == FVP_TRUSTED_DRAM_ID
Juan Castillo0c70c572014-08-12 13:04:43 +0100141# define TSP_SEC_MEM_BASE FVP_TRUSTED_DRAM_BASE
142# define TSP_SEC_MEM_SIZE FVP_TRUSTED_DRAM_SIZE
Juan Castillo42a617d2014-09-24 10:00:06 +0100143# define BL32_BASE FVP_TRUSTED_DRAM_BASE
Juan Castillo0c70c572014-08-12 13:04:43 +0100144# define BL32_LIMIT (FVP_TRUSTED_DRAM_BASE + (1 << 21))
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000145#elif FVP_TSP_RAM_LOCATION_ID == FVP_DRAM_ID
146# define TSP_SEC_MEM_BASE DRAM1_SEC_BASE
147# define TSP_SEC_MEM_SIZE DRAM1_SEC_SIZE
148# define BL32_BASE DRAM1_SEC_BASE
149# define BL32_LIMIT (DRAM1_SEC_BASE + DRAM1_SEC_SIZE)
Dan Handleyed6ff952014-05-14 17:44:19 +0100150#else
Juan Castillo0c70c572014-08-12 13:04:43 +0100151# error "Unsupported FVP_TSP_RAM_LOCATION_ID value"
Dan Handleyed6ff952014-05-14 17:44:19 +0100152#endif
153
Dan Handley4fd2f5c2014-08-04 11:41:20 +0100154/*
155 * ID of the secure physical generic timer interrupt used by the TSP.
156 */
157#define TSP_IRQ_SEC_PHY_TIMER IRQ_SEC_PHY_TIMER
158
Dan Handleyed6ff952014-05-14 17:44:19 +0100159/*******************************************************************************
160 * Platform specific page table and MMU setup constants
161 ******************************************************************************/
162#define ADDR_SPACE_SIZE (1ull << 32)
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000163
164#if IMAGE_BL1
165# define MAX_XLAT_TABLES 2
166#elif IMAGE_BL2
Juan Castillof3e02182014-12-19 09:28:30 +0000167# define MAX_XLAT_TABLES 3
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000168#elif IMAGE_BL31
Juan Castillof3e02182014-12-19 09:28:30 +0000169# define MAX_XLAT_TABLES 2
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000170#elif IMAGE_BL32
171# if FVP_TSP_RAM_LOCATION_ID == FVP_DRAM_ID
172# define MAX_XLAT_TABLES 3
173# else
174# define MAX_XLAT_TABLES 2
175# endif
Juan Castillof3e02182014-12-19 09:28:30 +0000176#endif
Juan Castilloe33ee5f2014-12-19 09:51:00 +0000177
Dan Handleyed6ff952014-05-14 17:44:19 +0100178#define MAX_MMAP_REGIONS 16
179
180/*******************************************************************************
Dan Handleyed6ff952014-05-14 17:44:19 +0100181 * Declarations and constants to access the mailboxes safely. Each mailbox is
182 * aligned on the biggest cache line size in the platform. This is known only
183 * to the platform as it might have a combination of integrated and external
184 * caches. Such alignment ensures that two maiboxes do not sit on the same cache
185 * line at any cache level. They could belong to different cpus/clusters &
186 * get written while being protected by different locks causing corruption of
187 * a valid mailbox address.
188 ******************************************************************************/
189#define CACHE_WRITEBACK_SHIFT 6
190#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
191
Soby Mathew523d6332015-01-08 18:02:19 +0000192#if !USE_COHERENT_MEM
193/*******************************************************************************
194 * Size of the per-cpu data in bytes that should be reserved in the generic
195 * per-cpu data structure for the FVP port.
196 ******************************************************************************/
197#define PLAT_PCPU_DATA_SIZE 2
198#endif
Dan Handleyed6ff952014-05-14 17:44:19 +0100199
200#endif /* __PLATFORM_DEF_H__ */