blob: 79d789d1b2e7af53697388bfcc14278e18e195d8 [file] [log] [blame]
Dan Handley5f0cdb02014-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>
Juan Castillo637ebd22014-08-12 13:04:43 +010035#include <../fvp_def.h>
Dan Handley5f0cdb02014-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 */
49#define PLATFORM_STACK_SIZE 0x800
50
Dan Handley5f0cdb02014-05-14 17:44:19 +010051#define FIRMWARE_WELCOME_STR "Booting trusted firmware boot loader stage 1\n\r"
52
53/* Trusted Boot Firmware BL2 */
54#define BL2_IMAGE_NAME "bl2.bin"
55
56/* EL3 Runtime Firmware BL31 */
57#define BL31_IMAGE_NAME "bl31.bin"
58
59/* Secure Payload BL32 (Trusted OS) */
60#define BL32_IMAGE_NAME "bl32.bin"
61
62/* Non-Trusted Firmware BL33 */
63#define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */
64
65#define PLATFORM_CACHE_LINE_SIZE 64
66#define PLATFORM_CLUSTER_COUNT 2ull
67#define PLATFORM_CLUSTER0_CORE_COUNT 4
68#define PLATFORM_CLUSTER1_CORE_COUNT 4
69#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
70 PLATFORM_CLUSTER0_CORE_COUNT)
71#define PLATFORM_MAX_CPUS_PER_CLUSTER 4
Andrew Thoelke6c0b45d2014-06-20 00:36:14 +010072#define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \
73 PLATFORM_CORE_COUNT)
Dan Handley5f0cdb02014-05-14 17:44:19 +010074#define MAX_IO_DEVICES 3
75#define MAX_IO_HANDLES 4
76
77/*******************************************************************************
Dan Handley5f0cdb02014-05-14 17:44:19 +010078 * BL1 specific defines.
79 * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
80 * addresses.
81 ******************************************************************************/
Juan Castillo637ebd22014-08-12 13:04:43 +010082#define BL1_RO_BASE FVP_TRUSTED_ROM_BASE
83#define BL1_RO_LIMIT (FVP_TRUSTED_ROM_BASE \
84 + FVP_TRUSTED_ROM_SIZE)
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +010085/*
Juan Castillo186c1d42014-08-12 13:51:51 +010086 * Put BL1 RW at the top of the Trusted SRAM (just below the shared memory, if
87 * present). BL1_RW_BASE is calculated using the current BL1 RW debug size plus
88 * a little space for growth.
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +010089 */
Juan Castillo186c1d42014-08-12 13:51:51 +010090#define BL1_RW_BASE (FVP_TRUSTED_SRAM_LIMIT - 0x6000)
91#define BL1_RW_LIMIT FVP_TRUSTED_SRAM_LIMIT
Dan Handley5f0cdb02014-05-14 17:44:19 +010092
93/*******************************************************************************
94 * BL2 specific defines.
95 ******************************************************************************/
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +010096/*
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
Dan Handley5f0cdb02014-05-14 17:44:19 +0100102
103/*******************************************************************************
104 * BL31 specific defines.
105 ******************************************************************************/
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +0100106/*
Juan Castillo186c1d42014-08-12 13:51:51 +0100107 * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
108 * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
109 * little space for growth.
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +0100110 */
Juan Castillo186c1d42014-08-12 13:51:51 +0100111#define BL31_BASE (FVP_TRUSTED_SRAM_LIMIT - 0x1D000)
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +0100112#define BL31_PROGBITS_LIMIT BL1_RW_BASE
Juan Castillo186c1d42014-08-12 13:51:51 +0100113#define BL31_LIMIT FVP_TRUSTED_SRAM_LIMIT
Dan Handley5f0cdb02014-05-14 17:44:19 +0100114
115/*******************************************************************************
116 * BL32 specific defines.
117 ******************************************************************************/
118/*
119 * On FVP, the TSP can execute either from Trusted SRAM or Trusted DRAM.
120 */
Juan Castillo637ebd22014-08-12 13:04:43 +0100121#if FVP_TSP_RAM_LOCATION_ID == FVP_IN_TRUSTED_SRAM
122# define TSP_SEC_MEM_BASE FVP_TRUSTED_SRAM_BASE
123# define TSP_SEC_MEM_SIZE FVP_TRUSTED_SRAM_SIZE
124# define BL32_BASE FVP_TRUSTED_SRAM_BASE
Sandrine Bailleuxa1b6db62014-06-16 16:12:27 +0100125# define BL32_PROGBITS_LIMIT BL2_BASE
126# define BL32_LIMIT BL31_BASE
Juan Castillo637ebd22014-08-12 13:04:43 +0100127#elif FVP_TSP_RAM_LOCATION_ID == FVP_IN_TRUSTED_DRAM
128# define TSP_SEC_MEM_BASE FVP_TRUSTED_DRAM_BASE
129# define TSP_SEC_MEM_SIZE FVP_TRUSTED_DRAM_SIZE
Juan Castillo186c1d42014-08-12 13:51:51 +0100130# define BL32_BASE (FVP_TRUSTED_DRAM_BASE \
131 + FVP_SHARED_RAM_SIZE)
Juan Castillo637ebd22014-08-12 13:04:43 +0100132# define BL32_LIMIT (FVP_TRUSTED_DRAM_BASE + (1 << 21))
Dan Handley5f0cdb02014-05-14 17:44:19 +0100133#else
Juan Castillo637ebd22014-08-12 13:04:43 +0100134# error "Unsupported FVP_TSP_RAM_LOCATION_ID value"
Dan Handley5f0cdb02014-05-14 17:44:19 +0100135#endif
136
137/*******************************************************************************
138 * Platform specific page table and MMU setup constants
139 ******************************************************************************/
140#define ADDR_SPACE_SIZE (1ull << 32)
Andrew Thoelke15f195b2014-06-20 12:23:20 +0100141#define MAX_XLAT_TABLES 2
Dan Handley5f0cdb02014-05-14 17:44:19 +0100142#define MAX_MMAP_REGIONS 16
143
144/*******************************************************************************
145 * ID of the secure physical generic timer interrupt.
146 ******************************************************************************/
147#define IRQ_SEC_PHY_TIMER 29
148
149/*******************************************************************************
150 * CCI-400 related constants
151 ******************************************************************************/
152#define CCI400_BASE 0x2c090000
153#define CCI400_SL_IFACE_CLUSTER0 3
154#define CCI400_SL_IFACE_CLUSTER1 4
155#define CCI400_SL_IFACE_INDEX(mpidr) (mpidr & MPIDR_CLUSTER_MASK ? \
156 CCI400_SL_IFACE_CLUSTER1 : \
157 CCI400_SL_IFACE_CLUSTER0)
158
159
160/*******************************************************************************
161 * Declarations and constants to access the mailboxes safely. Each mailbox is
162 * aligned on the biggest cache line size in the platform. This is known only
163 * to the platform as it might have a combination of integrated and external
164 * caches. Such alignment ensures that two maiboxes do not sit on the same cache
165 * line at any cache level. They could belong to different cpus/clusters &
166 * get written while being protected by different locks causing corruption of
167 * a valid mailbox address.
168 ******************************************************************************/
169#define CACHE_WRITEBACK_SHIFT 6
170#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
171
172
173#endif /* __PLATFORM_DEF_H__ */