Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 1 | /* |
| 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 Handley | 5a06bb7 | 2014-08-04 11:41:20 +0100 | [diff] [blame] | 35 | #include "../fvp_def.h" |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 36 | |
| 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 Mathew | aa442d3 | 2014-08-04 16:02:05 +0100 | [diff] [blame] | 49 | #if DEBUG_XLAT_TABLE |
| 50 | #define PLATFORM_STACK_SIZE 0x800 |
| 51 | #elif IMAGE_BL1 |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 52 | #if TRUSTED_BOARD_BOOT |
| 53 | #define PLATFORM_STACK_SIZE 0x1000 |
| 54 | #else |
Soby Mathew | aa442d3 | 2014-08-04 16:02:05 +0100 | [diff] [blame] | 55 | #define PLATFORM_STACK_SIZE 0x440 |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 56 | #endif |
Soby Mathew | aa442d3 | 2014-08-04 16:02:05 +0100 | [diff] [blame] | 57 | #elif IMAGE_BL2 |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 58 | #if TRUSTED_BOARD_BOOT |
| 59 | #define PLATFORM_STACK_SIZE 0x1000 |
| 60 | #else |
Soby Mathew | aa442d3 | 2014-08-04 16:02:05 +0100 | [diff] [blame] | 61 | #define PLATFORM_STACK_SIZE 0x400 |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 62 | #endif |
Soby Mathew | aa442d3 | 2014-08-04 16:02:05 +0100 | [diff] [blame] | 63 | #elif IMAGE_BL31 |
| 64 | #define PLATFORM_STACK_SIZE 0x400 |
| 65 | #elif IMAGE_BL32 |
| 66 | #define PLATFORM_STACK_SIZE 0x440 |
| 67 | #endif |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 68 | |
Dan Handley | 6ad2e46 | 2014-07-29 17:14:00 +0100 | [diff] [blame] | 69 | #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 70 | |
| 71 | /* Trusted Boot Firmware BL2 */ |
| 72 | #define BL2_IMAGE_NAME "bl2.bin" |
| 73 | |
| 74 | /* EL3 Runtime Firmware BL31 */ |
| 75 | #define BL31_IMAGE_NAME "bl31.bin" |
| 76 | |
| 77 | /* Secure Payload BL32 (Trusted OS) */ |
| 78 | #define BL32_IMAGE_NAME "bl32.bin" |
| 79 | |
| 80 | /* Non-Trusted Firmware BL33 */ |
| 81 | #define BL33_IMAGE_NAME "bl33.bin" /* e.g. UEFI */ |
| 82 | |
Juan Castillo | 01df3c1 | 2015-01-07 13:49:59 +0000 | [diff] [blame^] | 83 | #if TRUSTED_BOARD_BOOT |
| 84 | /* Certificates */ |
| 85 | # define BL2_CERT_NAME "bl2.crt" |
| 86 | #endif /* TRUSTED_BOARD_BOOT */ |
| 87 | |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 88 | #define PLATFORM_CACHE_LINE_SIZE 64 |
| 89 | #define PLATFORM_CLUSTER_COUNT 2ull |
| 90 | #define PLATFORM_CLUSTER0_CORE_COUNT 4 |
| 91 | #define PLATFORM_CLUSTER1_CORE_COUNT 4 |
| 92 | #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \ |
| 93 | PLATFORM_CLUSTER0_CORE_COUNT) |
| 94 | #define PLATFORM_MAX_CPUS_PER_CLUSTER 4 |
Andrew Thoelke | 6c0b45d | 2014-06-20 00:36:14 +0100 | [diff] [blame] | 95 | #define PLATFORM_NUM_AFFS (PLATFORM_CLUSTER_COUNT + \ |
| 96 | PLATFORM_CORE_COUNT) |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 97 | #define MAX_IO_DEVICES 3 |
| 98 | #define MAX_IO_HANDLES 4 |
| 99 | |
| 100 | /******************************************************************************* |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 101 | * BL1 specific defines. |
| 102 | * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of |
| 103 | * addresses. |
| 104 | ******************************************************************************/ |
Juan Castillo | 637ebd2 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 105 | #define BL1_RO_BASE FVP_TRUSTED_ROM_BASE |
| 106 | #define BL1_RO_LIMIT (FVP_TRUSTED_ROM_BASE \ |
| 107 | + FVP_TRUSTED_ROM_SIZE) |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 108 | /* |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 109 | * Put BL1 RW at the top of the Trusted SRAM. BL1_RW_BASE is calculated using |
| 110 | * the current BL1 RW debug size plus a little space for growth. |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 111 | */ |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 112 | #if TRUSTED_BOARD_BOOT |
| 113 | #define BL1_RW_BASE (FVP_TRUSTED_SRAM_BASE \ |
| 114 | + FVP_TRUSTED_SRAM_SIZE - 0x8000) |
| 115 | #else |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 116 | #define BL1_RW_BASE (FVP_TRUSTED_SRAM_BASE \ |
| 117 | + FVP_TRUSTED_SRAM_SIZE - 0x6000) |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 118 | #endif |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 119 | #define BL1_RW_LIMIT (FVP_TRUSTED_SRAM_BASE \ |
| 120 | + FVP_TRUSTED_SRAM_SIZE) |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 121 | |
| 122 | /******************************************************************************* |
| 123 | * BL2 specific defines. |
| 124 | ******************************************************************************/ |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 125 | /* |
| 126 | * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug |
| 127 | * size plus a little space for growth. |
| 128 | */ |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 129 | #if TRUSTED_BOARD_BOOT |
| 130 | #define BL2_BASE (BL31_BASE - 0x1C000) |
| 131 | #else |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 132 | #define BL2_BASE (BL31_BASE - 0xC000) |
Juan Castillo | db6071c | 2015-01-13 12:21:04 +0000 | [diff] [blame] | 133 | #endif |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 134 | #define BL2_LIMIT BL31_BASE |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 135 | |
| 136 | /******************************************************************************* |
| 137 | * BL31 specific defines. |
| 138 | ******************************************************************************/ |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 139 | /* |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 140 | * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the |
| 141 | * current BL3-1 debug size plus a little space for growth. |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 142 | */ |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 143 | #define BL31_BASE (FVP_TRUSTED_SRAM_BASE \ |
| 144 | + FVP_TRUSTED_SRAM_SIZE - 0x1D000) |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 145 | #define BL31_PROGBITS_LIMIT BL1_RW_BASE |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 146 | #define BL31_LIMIT (FVP_TRUSTED_SRAM_BASE \ |
| 147 | + FVP_TRUSTED_SRAM_SIZE) |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 148 | |
| 149 | /******************************************************************************* |
| 150 | * BL32 specific defines. |
| 151 | ******************************************************************************/ |
| 152 | /* |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 153 | * On FVP, the TSP can execute from Trusted SRAM, Trusted DRAM or the DRAM |
| 154 | * region secured by the TrustZone controller. |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 155 | */ |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 156 | #if FVP_TSP_RAM_LOCATION_ID == FVP_TRUSTED_SRAM_ID |
Juan Castillo | 637ebd2 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 157 | # define TSP_SEC_MEM_BASE FVP_TRUSTED_SRAM_BASE |
| 158 | # define TSP_SEC_MEM_SIZE FVP_TRUSTED_SRAM_SIZE |
Dan Handley | 5a06bb7 | 2014-08-04 11:41:20 +0100 | [diff] [blame] | 159 | # define TSP_PROGBITS_LIMIT BL2_BASE |
Juan Castillo | 637ebd2 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 160 | # define BL32_BASE FVP_TRUSTED_SRAM_BASE |
Sandrine Bailleux | a1b6db6 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 161 | # define BL32_LIMIT BL31_BASE |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 162 | #elif FVP_TSP_RAM_LOCATION_ID == FVP_TRUSTED_DRAM_ID |
Juan Castillo | 637ebd2 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 163 | # define TSP_SEC_MEM_BASE FVP_TRUSTED_DRAM_BASE |
| 164 | # define TSP_SEC_MEM_SIZE FVP_TRUSTED_DRAM_SIZE |
Juan Castillo | 20d51ca | 2014-09-24 10:00:06 +0100 | [diff] [blame] | 165 | # define BL32_BASE FVP_TRUSTED_DRAM_BASE |
Juan Castillo | 637ebd2 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 166 | # define BL32_LIMIT (FVP_TRUSTED_DRAM_BASE + (1 << 21)) |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 167 | #elif FVP_TSP_RAM_LOCATION_ID == FVP_DRAM_ID |
| 168 | # define TSP_SEC_MEM_BASE DRAM1_SEC_BASE |
| 169 | # define TSP_SEC_MEM_SIZE DRAM1_SEC_SIZE |
| 170 | # define BL32_BASE DRAM1_SEC_BASE |
| 171 | # define BL32_LIMIT (DRAM1_SEC_BASE + DRAM1_SEC_SIZE) |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 172 | #else |
Juan Castillo | 637ebd2 | 2014-08-12 13:04:43 +0100 | [diff] [blame] | 173 | # error "Unsupported FVP_TSP_RAM_LOCATION_ID value" |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 174 | #endif |
| 175 | |
Dan Handley | 5a06bb7 | 2014-08-04 11:41:20 +0100 | [diff] [blame] | 176 | /* |
| 177 | * ID of the secure physical generic timer interrupt used by the TSP. |
| 178 | */ |
| 179 | #define TSP_IRQ_SEC_PHY_TIMER IRQ_SEC_PHY_TIMER |
| 180 | |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 181 | /******************************************************************************* |
| 182 | * Platform specific page table and MMU setup constants |
| 183 | ******************************************************************************/ |
| 184 | #define ADDR_SPACE_SIZE (1ull << 32) |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 185 | |
| 186 | #if IMAGE_BL1 |
Juan Castillo | 6fd9eaf | 2014-12-19 09:28:30 +0000 | [diff] [blame] | 187 | # define MAX_XLAT_TABLES 2 |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 188 | #elif IMAGE_BL2 |
| 189 | # define MAX_XLAT_TABLES 3 |
| 190 | #elif IMAGE_BL31 |
| 191 | # define MAX_XLAT_TABLES 2 |
| 192 | #elif IMAGE_BL32 |
| 193 | # if FVP_TSP_RAM_LOCATION_ID == FVP_DRAM_ID |
| 194 | # define MAX_XLAT_TABLES 3 |
| 195 | # else |
| 196 | # define MAX_XLAT_TABLES 2 |
| 197 | # endif |
Juan Castillo | 6fd9eaf | 2014-12-19 09:28:30 +0000 | [diff] [blame] | 198 | #endif |
Juan Castillo | 513dd3a | 2014-12-19 09:51:00 +0000 | [diff] [blame] | 199 | |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 200 | #define MAX_MMAP_REGIONS 16 |
| 201 | |
| 202 | /******************************************************************************* |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 203 | * Declarations and constants to access the mailboxes safely. Each mailbox is |
| 204 | * aligned on the biggest cache line size in the platform. This is known only |
| 205 | * to the platform as it might have a combination of integrated and external |
| 206 | * caches. Such alignment ensures that two maiboxes do not sit on the same cache |
| 207 | * line at any cache level. They could belong to different cpus/clusters & |
| 208 | * get written while being protected by different locks causing corruption of |
| 209 | * a valid mailbox address. |
| 210 | ******************************************************************************/ |
| 211 | #define CACHE_WRITEBACK_SHIFT 6 |
| 212 | #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) |
| 213 | |
Soby Mathew | 8c5fe0b | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 214 | #if !USE_COHERENT_MEM |
| 215 | /******************************************************************************* |
| 216 | * Size of the per-cpu data in bytes that should be reserved in the generic |
| 217 | * per-cpu data structure for the FVP port. |
| 218 | ******************************************************************************/ |
| 219 | #define PLAT_PCPU_DATA_SIZE 2 |
| 220 | #endif |
Dan Handley | 5f0cdb0 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 221 | |
| 222 | #endif /* __PLATFORM_DEF_H__ */ |