blob: 99832663090e75063d045b7052349d51de8600e6 [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>
35
36
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
Dan Handleyed6ff952014-05-14 17:44:19 +010050#define FIRMWARE_WELCOME_STR "Booting trusted firmware boot loader stage 1\n\r"
51
52/* Trusted Boot Firmware BL2 */
53#define BL2_IMAGE_NAME "bl2.bin"
54
55/* EL3 Runtime Firmware BL31 */
56#define BL31_IMAGE_NAME "bl31.bin"
57
58/* Secure Payload BL32 (Trusted OS) */
59#define BL32_IMAGE_NAME "bl32.bin"
60
61/* Non-Trusted Firmware BL33 */
62#define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */
63
64#define PLATFORM_CACHE_LINE_SIZE 64
65#define PLATFORM_CLUSTER_COUNT 2ull
66#define PLATFORM_CLUSTER0_CORE_COUNT 4
67#define PLATFORM_CLUSTER1_CORE_COUNT 4
68#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
69 PLATFORM_CLUSTER0_CORE_COUNT)
70#define PLATFORM_MAX_CPUS_PER_CLUSTER 4
Andrew Thoelke56f44702014-06-20 00:36:14 +010071#define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \
72 PLATFORM_CORE_COUNT)
Dan Handleyed6ff952014-05-14 17:44:19 +010073#define PRIMARY_CPU 0x0
74#define MAX_IO_DEVICES 3
75#define MAX_IO_HANDLES 4
76
77/*******************************************************************************
78 * Platform memory map related constants
79 ******************************************************************************/
80#define TZROM_BASE 0x00000000
81#define TZROM_SIZE 0x04000000
82
83#define TZRAM_BASE 0x04000000
84#define TZRAM_SIZE 0x40000
85
86/* Location of trusted dram on the base fvp */
87#define TZDRAM_BASE 0x06000000
88#define TZDRAM_SIZE 0x02000000
89
90/*******************************************************************************
91 * BL1 specific defines.
92 * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
93 * addresses.
94 ******************************************************************************/
95#define BL1_RO_BASE TZROM_BASE
96#define BL1_RO_LIMIT (TZROM_BASE + TZROM_SIZE)
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +010097/*
98 * Put BL1 RW at the top of the Trusted SRAM. BL1_RW_BASE is calculated using
99 * the current BL1 RW debug size plus a little space for growth.
100 */
101#define BL1_RW_BASE (TZRAM_BASE + TZRAM_SIZE - 0x6000)
102#define BL1_RW_LIMIT (TZRAM_BASE + TZRAM_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/*
118 * 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.
120 */
121#define BL31_BASE (TZRAM_BASE + TZRAM_SIZE - 0x1D000)
122#define BL31_PROGBITS_LIMIT BL1_RW_BASE
123#define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
Dan Handleyed6ff952014-05-14 17:44:19 +0100124
125/*******************************************************************************
126 * BL32 specific defines.
127 ******************************************************************************/
128/*
129 * On FVP, the TSP can execute either from Trusted SRAM or Trusted DRAM.
130 */
131#define TSP_IN_TZRAM 0
132#define TSP_IN_TZDRAM 1
133
134#if TSP_RAM_LOCATION_ID == TSP_IN_TZRAM
135# define TSP_SEC_MEM_BASE TZRAM_BASE
136# define TSP_SEC_MEM_SIZE TZRAM_SIZE
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +0100137# define BL32_BASE TZRAM_BASE
138# define BL32_PROGBITS_LIMIT BL2_BASE
139# define BL32_LIMIT BL31_BASE
Dan Handleyed6ff952014-05-14 17:44:19 +0100140#elif TSP_RAM_LOCATION_ID == TSP_IN_TZDRAM
141# define TSP_SEC_MEM_BASE TZDRAM_BASE
142# define TSP_SEC_MEM_SIZE TZDRAM_SIZE
143# define BL32_BASE (TZDRAM_BASE + 0x2000)
144# define BL32_LIMIT (TZDRAM_BASE + (1 << 21))
145#else
146# error "Unsupported TSP_RAM_LOCATION_ID value"
147#endif
148
149/*******************************************************************************
150 * Platform specific page table and MMU setup constants
151 ******************************************************************************/
152#define ADDR_SPACE_SIZE (1ull << 32)
Andrew Thoelke30b04fc2014-06-20 12:23:20 +0100153#define MAX_XLAT_TABLES 2
Dan Handleyed6ff952014-05-14 17:44:19 +0100154#define MAX_MMAP_REGIONS 16
155
156/*******************************************************************************
157 * ID of the secure physical generic timer interrupt.
158 ******************************************************************************/
159#define IRQ_SEC_PHY_TIMER 29
160
161/*******************************************************************************
162 * CCI-400 related constants
163 ******************************************************************************/
164#define CCI400_BASE 0x2c090000
165#define CCI400_SL_IFACE_CLUSTER0 3
166#define CCI400_SL_IFACE_CLUSTER1 4
167#define CCI400_SL_IFACE_INDEX(mpidr) (mpidr & MPIDR_CLUSTER_MASK ? \
168 CCI400_SL_IFACE_CLUSTER1 : \
169 CCI400_SL_IFACE_CLUSTER0)
170
171
172/*******************************************************************************
173 * Declarations and constants to access the mailboxes safely. Each mailbox is
174 * aligned on the biggest cache line size in the platform. This is known only
175 * to the platform as it might have a combination of integrated and external
176 * caches. Such alignment ensures that two maiboxes do not sit on the same cache
177 * line at any cache level. They could belong to different cpus/clusters &
178 * get written while being protected by different locks causing corruption of
179 * a valid mailbox address.
180 ******************************************************************************/
181#define CACHE_WRITEBACK_SHIFT 6
182#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
183
184
185#endif /* __PLATFORM_DEF_H__ */