blob: ee77b83237fdf2977393ce7cd576f559d55549ed [file] [log] [blame]
Sandrine Bailleux798140d2014-07-17 16:06:39 +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>
Sandrine Bailleux1fe43362014-07-17 09:56:29 +010035#include "../juno_def.h"
Sandrine Bailleux798140d2014-07-17 16:06:39 +010036
37/*******************************************************************************
38 * Platform binary types for linking
39 ******************************************************************************/
40#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
41#define PLATFORM_LINKER_ARCH aarch64
42
43/*******************************************************************************
44 * Generic platform constants
45 ******************************************************************************/
46
47/* Size of cacheable stacks */
48#define PLATFORM_STACK_SIZE 0x800
49
50#define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
51
52/* Trusted Boot Firmware BL2 */
53#define BL2_IMAGE_NAME "bl2.bin"
54
55/* EL3 Runtime Firmware BL3-1 */
56#define BL31_IMAGE_NAME "bl31.bin"
57
58/* SCP Firmware BL3-0 */
59#define BL30_IMAGE_NAME "bl30.bin"
60
61/* Secure Payload BL3-2 (Trusted OS) */
62#define BL32_IMAGE_NAME "bl32.bin"
63
64/* Non-Trusted Firmware BL3-3 */
65#define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */
66
67/* Firmware Image Package */
68#define FIP_IMAGE_NAME "fip.bin"
69
70#define PLATFORM_CACHE_LINE_SIZE 64
71#define PLATFORM_CLUSTER_COUNT 2
72#define PLATFORM_CORE_COUNT 6
73#define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \
74 PLATFORM_CORE_COUNT)
75#define MAX_IO_DEVICES 3
76#define MAX_IO_HANDLES 4
77
78/*******************************************************************************
Sandrine Bailleux798140d2014-07-17 16:06:39 +010079 * BL1 specific defines.
80 * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 base
81 * addresses.
82 ******************************************************************************/
83#define BL1_RO_BASE TZROM_BASE
84#define BL1_RO_LIMIT (TZROM_BASE + TZROM_SIZE)
Juan Castillo6ba59eb2014-11-07 09:44:58 +000085
86/*
87 * Put BL1 RW at the top of the Trusted SRAM. BL1_RW_BASE is calculated using
88 * the current BL1 RW debug size plus a little space for growth.
89 */
90#define BL1_RW_BASE (TZRAM_BASE + TZRAM_SIZE - 0x6000)
91#define BL1_RW_LIMIT (TZRAM_BASE + TZRAM_SIZE)
Sandrine Bailleux798140d2014-07-17 16:06:39 +010092
93/*******************************************************************************
94 * BL2 specific defines.
95 ******************************************************************************/
Juan Castillo6ba59eb2014-11-07 09:44:58 +000096/*
97 * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug
98 * size plus a little space for growth.
99 */
100#define BL2_BASE (BL31_BASE - 0xC000)
101#define BL2_LIMIT BL31_BASE
Sandrine Bailleux798140d2014-07-17 16:06:39 +0100102
103/*******************************************************************************
104 * Load address of BL3-0 in the Juno port
105 * BL3-0 is loaded to the same place as BL3-1. Once BL3-0 is transferred to the
106 * SCP, it is discarded and BL3-1 is loaded over the top.
107 ******************************************************************************/
108#define BL30_BASE BL31_BASE
109
110/*******************************************************************************
111 * BL3-1 specific defines.
112 ******************************************************************************/
Juan Castillo6ba59eb2014-11-07 09:44:58 +0000113/*
114 * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the
115 * current BL3-1 debug size plus a little space for growth.
116 */
117#define BL31_BASE (TZRAM_BASE + TZRAM_SIZE - 0x1D000)
118#define BL31_PROGBITS_LIMIT BL1_RW_BASE
119#define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
Sandrine Bailleux798140d2014-07-17 16:06:39 +0100120
121/*******************************************************************************
122 * BL3-2 specific defines.
123 ******************************************************************************/
Juan Castillo921b8772014-09-05 17:29:38 +0100124#if (PLAT_TSP_LOCATION_ID == PLAT_TRUSTED_SRAM_ID)
125# define TSP_SEC_MEM_BASE TZRAM_BASE
126# define TSP_SEC_MEM_SIZE TZRAM_SIZE
Juan Castillo6ba59eb2014-11-07 09:44:58 +0000127# define BL32_BASE TZRAM_BASE
128# define BL32_LIMIT BL31_BASE
129# define BL32_PROGBITS_LIMIT BL2_BASE
Juan Castillo921b8772014-09-05 17:29:38 +0100130#elif (PLAT_TSP_LOCATION_ID == PLAT_DRAM_ID)
131# define TSP_SEC_MEM_BASE DRAM_SEC_BASE
132# define TSP_SEC_MEM_SIZE (DRAM_SEC_SIZE - DRAM_SCP_SIZE)
133# define BL32_BASE DRAM_SEC_BASE
134# define BL32_LIMIT (DRAM_SEC_BASE + DRAM_SEC_SIZE - \
135 DRAM_SCP_SIZE)
136#else
137# error "Unsupported PLAT_TSP_LOCATION_ID value"
138#endif
Sandrine Bailleux798140d2014-07-17 16:06:39 +0100139
140/*******************************************************************************
141 * Load address of BL3-3 in the Juno port
142 ******************************************************************************/
143#define NS_IMAGE_OFFSET 0xE0000000
144
145/*******************************************************************************
146 * Platform specific page table and MMU setup constants
147 ******************************************************************************/
148#define ADDR_SPACE_SIZE (1ull << 32)
Juan Castillo921b8772014-09-05 17:29:38 +0100149
150#if IMAGE_BL1 || IMAGE_BL31
151# define MAX_XLAT_TABLES 2
152#endif
153
154#if IMAGE_BL2 || IMAGE_BL32
155# define MAX_XLAT_TABLES 3
156#endif
157
Sandrine Bailleux798140d2014-07-17 16:06:39 +0100158#define MAX_MMAP_REGIONS 16
159
160/*******************************************************************************
Sandrine Bailleux1fe43362014-07-17 09:56:29 +0100161 * ID of the secure physical generic timer interrupt used by the TSP
Sandrine Bailleux798140d2014-07-17 16:06:39 +0100162 ******************************************************************************/
Sandrine Bailleux1fe43362014-07-17 09:56:29 +0100163#define TSP_IRQ_SEC_PHY_TIMER IRQ_SEC_PHY_TIMER
Sandrine Bailleux798140d2014-07-17 16:06:39 +0100164
165/*******************************************************************************
166 * Declarations and constants to access the mailboxes safely. Each mailbox is
167 * aligned on the biggest cache line size in the platform. This is known only
168 * to the platform as it might have a combination of integrated and external
169 * caches. Such alignment ensures that two maiboxes do not sit on the same cache
170 * line at any cache level. They could belong to different cpus/clusters &
171 * get written while being protected by different locks causing corruption of
172 * a valid mailbox address.
173 ******************************************************************************/
174#define CACHE_WRITEBACK_SHIFT 6
175#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
176
177#endif /* __PLATFORM_DEF_H__ */